nestjs-typesense 0.1.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/LICENSE +21 -0
- package/README.md +318 -0
- package/dist/client/typesense.client.d.ts +38 -0
- package/dist/client/typesense.client.d.ts.map +1 -0
- package/dist/client/typesense.client.js +100 -0
- package/dist/client/typesense.client.js.map +1 -0
- package/dist/collections/typesense-collections.d.ts +21 -0
- package/dist/collections/typesense-collections.d.ts.map +1 -0
- package/dist/collections/typesense-collections.js +120 -0
- package/dist/collections/typesense-collections.js.map +1 -0
- package/dist/collectors/typesense-collector.d.ts +22 -0
- package/dist/collectors/typesense-collector.d.ts.map +1 -0
- package/dist/collectors/typesense-collector.decorator.d.ts +11 -0
- package/dist/collectors/typesense-collector.decorator.d.ts.map +1 -0
- package/dist/collectors/typesense-collector.decorator.js +27 -0
- package/dist/collectors/typesense-collector.decorator.js.map +1 -0
- package/dist/collectors/typesense-collector.js +3 -0
- package/dist/collectors/typesense-collector.js.map +1 -0
- package/dist/collectors/typesense-indexer.d.ts +34 -0
- package/dist/collectors/typesense-indexer.d.ts.map +1 -0
- package/dist/collectors/typesense-indexer.js +110 -0
- package/dist/collectors/typesense-indexer.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/schema/collection.d.ts +87 -0
- package/dist/schema/collection.d.ts.map +1 -0
- package/dist/schema/collection.js +64 -0
- package/dist/schema/collection.js.map +1 -0
- package/dist/schema/decorators.d.ts +73 -0
- package/dist/schema/decorators.d.ts.map +1 -0
- package/dist/schema/decorators.js +126 -0
- package/dist/schema/decorators.js.map +1 -0
- package/dist/schema/field.d.ts +71 -0
- package/dist/schema/field.d.ts.map +1 -0
- package/dist/schema/field.js +40 -0
- package/dist/schema/field.js.map +1 -0
- package/dist/typesense.constants.d.ts +9 -0
- package/dist/typesense.constants.d.ts.map +1 -0
- package/dist/typesense.constants.js +12 -0
- package/dist/typesense.constants.js.map +1 -0
- package/dist/typesense.module-options.d.ts +24 -0
- package/dist/typesense.module-options.d.ts.map +1 -0
- package/dist/typesense.module-options.js +3 -0
- package/dist/typesense.module-options.js.map +1 -0
- package/dist/typesense.module.d.ts +13 -0
- package/dist/typesense.module.d.ts.map +1 -0
- package/dist/typesense.module.js +42 -0
- package/dist/typesense.module.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypesenseAuto = exports.TypesenseObject = exports.TypesenseGeopoint = exports.TypesenseBool = exports.TypesenseFloat = exports.TypesenseInt64 = exports.TypesenseInt32 = exports.TypesenseString = void 0;
|
|
4
|
+
exports.TypesenseSchema = TypesenseSchema;
|
|
5
|
+
exports.TypesenseProp = TypesenseProp;
|
|
6
|
+
exports.TypesenseArray = TypesenseArray;
|
|
7
|
+
exports.getTypesenseCollection = getTypesenseCollection;
|
|
8
|
+
exports.resolveCollection = resolveCollection;
|
|
9
|
+
require("reflect-metadata");
|
|
10
|
+
const typesense_constants_js_1 = require("../typesense.constants.js");
|
|
11
|
+
const collection_js_1 = require("./collection.js");
|
|
12
|
+
const field_js_1 = require("./field.js");
|
|
13
|
+
/** Property decorators receive the prototype; the metadata lives on the class itself. */
|
|
14
|
+
function constructorOf(prototype) {
|
|
15
|
+
return prototype.constructor;
|
|
16
|
+
}
|
|
17
|
+
function recordField(target, key, definition) {
|
|
18
|
+
const owner = constructorOf(target);
|
|
19
|
+
// getOwnMetadata, not getMetadata: reflect-metadata resolves through the prototype
|
|
20
|
+
// chain, so a subclass would otherwise mutate its base class's map in place.
|
|
21
|
+
let fields = Reflect.getOwnMetadata(typesense_constants_js_1.TYPESENSE_FIELDS, owner);
|
|
22
|
+
if (!fields) {
|
|
23
|
+
fields = new Map();
|
|
24
|
+
Reflect.defineMetadata(typesense_constants_js_1.TYPESENSE_FIELDS, fields, owner);
|
|
25
|
+
}
|
|
26
|
+
fields.set(key, definition);
|
|
27
|
+
}
|
|
28
|
+
/** Walks base class -> derived so a subclass can override an inherited field. */
|
|
29
|
+
function collectFields(target) {
|
|
30
|
+
const chain = [];
|
|
31
|
+
for (let current = target; typeof current === "function" && current !== Function.prototype; current = Object.getPrototypeOf(current)) {
|
|
32
|
+
chain.unshift(current);
|
|
33
|
+
}
|
|
34
|
+
const fields = {};
|
|
35
|
+
for (const link of chain) {
|
|
36
|
+
const own = Reflect.getOwnMetadata(typesense_constants_js_1.TYPESENSE_FIELDS, link);
|
|
37
|
+
if (!own)
|
|
38
|
+
continue;
|
|
39
|
+
for (const [key, definition] of own)
|
|
40
|
+
fields[key] = definition;
|
|
41
|
+
}
|
|
42
|
+
return fields;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Declares a class as a Typesense collection, using the fields its properties declare.
|
|
46
|
+
*
|
|
47
|
+
* Builds the same object `defineCollection` returns — including the schema hash — so the
|
|
48
|
+
* two declaration styles are interchangeable everywhere downstream.
|
|
49
|
+
*
|
|
50
|
+
* `TSortField` defaults to `never`, which makes the class constraint `Record<never, unknown>`
|
|
51
|
+
* (i.e. no constraint) when `defaultSortingField` is omitted, and requires the named property
|
|
52
|
+
* to exist on the class when it is given.
|
|
53
|
+
*/
|
|
54
|
+
function TypesenseSchema(options) {
|
|
55
|
+
return (target) => {
|
|
56
|
+
const fields = collectFields(target);
|
|
57
|
+
// `id` is always emitted by toSchema, so a decorated `id` would produce a duplicate.
|
|
58
|
+
// Declaring `id: string` on the class is legitimate (it is part of the document), so
|
|
59
|
+
// drop it silently; anything else is a real mismatch and worth failing on.
|
|
60
|
+
const declaredId = fields.id;
|
|
61
|
+
if (declaredId) {
|
|
62
|
+
if (declaredId.type !== "string") {
|
|
63
|
+
throw new Error(`Collection "${options.name}" declares "id" as ${declaredId.type}; ` +
|
|
64
|
+
"Typesense always stores id as a string. Remove the decorator — id is implicit.");
|
|
65
|
+
}
|
|
66
|
+
delete fields.id;
|
|
67
|
+
}
|
|
68
|
+
const collection = (0, collection_js_1.defineCollection)({
|
|
69
|
+
name: options.name,
|
|
70
|
+
fields,
|
|
71
|
+
...(options.defaultSortingField ? { defaultSortingField: options.defaultSortingField } : {}),
|
|
72
|
+
...(options.tokenSeparators ? { tokenSeparators: options.tokenSeparators } : {}),
|
|
73
|
+
...(options.symbolsToIndex ? { symbolsToIndex: options.symbolsToIndex } : {}),
|
|
74
|
+
});
|
|
75
|
+
Reflect.defineMetadata(typesense_constants_js_1.TYPESENSE_COLLECTION, collection, target);
|
|
76
|
+
return target;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Declares a field, naming its Typesense type explicitly.
|
|
81
|
+
*
|
|
82
|
+
* The per-type decorators below are the same thing with the type baked in; use whichever
|
|
83
|
+
* reads better. Both reject a property whose TypeScript type disagrees with the field.
|
|
84
|
+
*/
|
|
85
|
+
function TypesenseProp(options) {
|
|
86
|
+
return (target, key) => {
|
|
87
|
+
recordField(target, key, (0, field_js_1.createField)(options.type, options));
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function makeProp(type) {
|
|
91
|
+
return (options) => (target, key) => {
|
|
92
|
+
recordField(target, key, (0, field_js_1.createField)(type, options));
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
exports.TypesenseString = makeProp("string");
|
|
96
|
+
exports.TypesenseInt32 = makeProp("int32");
|
|
97
|
+
exports.TypesenseInt64 = makeProp("int64");
|
|
98
|
+
exports.TypesenseFloat = makeProp("float");
|
|
99
|
+
exports.TypesenseBool = makeProp("bool");
|
|
100
|
+
exports.TypesenseGeopoint = makeProp("geopoint");
|
|
101
|
+
exports.TypesenseObject = makeProp("object");
|
|
102
|
+
exports.TypesenseAuto = makeProp("auto");
|
|
103
|
+
/** Declares an array field. One decorator covers all seven array types. */
|
|
104
|
+
function TypesenseArray(options) {
|
|
105
|
+
return (target, key) => {
|
|
106
|
+
const type = `${options.type}[]`;
|
|
107
|
+
recordField(target, key, (0, field_js_1.createField)(type, options));
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** The collection built for a decorated class, or undefined if it has no `@TypesenseSchema`. */
|
|
111
|
+
function getTypesenseCollection(target) {
|
|
112
|
+
return Reflect.getOwnMetadata(typesense_constants_js_1.TYPESENSE_COLLECTION, target);
|
|
113
|
+
}
|
|
114
|
+
/** Normalises either declaration style to a collection. */
|
|
115
|
+
function resolveCollection(source) {
|
|
116
|
+
if ((0, collection_js_1.isCollection)(source))
|
|
117
|
+
return source;
|
|
118
|
+
const collection = getTypesenseCollection(source);
|
|
119
|
+
if (!collection) {
|
|
120
|
+
const name = source.name ?? String(source);
|
|
121
|
+
throw new Error(`"${name}" is not a Typesense collection. Decorate the class with @TypesenseSchema(), ` +
|
|
122
|
+
"or pass the result of defineCollection().");
|
|
123
|
+
}
|
|
124
|
+
return collection;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=decorators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/schema/decorators.ts"],"names":[],"mappings":";;;AA4FA,0CAiCC;AAQD,sCASC;AAqCD,wCAWC;AAGD,wDAEC;AAGD,8CAYC;AAlND,4BAA0B;AAC1B,sEAAmF;AACnF,mDAA2F;AAC3F,yCAMoB;AA2BpB,yFAAyF;AACzF,SAAS,aAAa,CAAC,SAAiB;IACtC,OAAQ,SAAqC,CAAC,WAAW,CAAC;AAC5D,CAAC;AAED,SAAS,WAAW,CAAC,MAAc,EAAE,GAAW,EAAE,UAA0B;IAC1E,MAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,mFAAmF;IACnF,6EAA6E;IAC7E,IAAI,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,yCAAgB,EAAE,KAAK,CAAyB,CAAC;IACrF,IAAI,CAAC,MAAM,EAAE,CAAC;Q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AC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typesense field types we support, mapped to the TypeScript value they hold.
|
|
3
|
+
* `object`/`object[]` stay loose on purpose — Typesense does not constrain their shape.
|
|
4
|
+
*/
|
|
5
|
+
export interface TypesenseFieldTypeMap {
|
|
6
|
+
string: string;
|
|
7
|
+
"string[]": string[];
|
|
8
|
+
int32: number;
|
|
9
|
+
"int32[]": number[];
|
|
10
|
+
int64: number;
|
|
11
|
+
"int64[]": number[];
|
|
12
|
+
float: number;
|
|
13
|
+
"float[]": number[];
|
|
14
|
+
bool: boolean;
|
|
15
|
+
"bool[]": boolean[];
|
|
16
|
+
geopoint: [number, number];
|
|
17
|
+
"geopoint[]": [number, number][];
|
|
18
|
+
object: Record<string, unknown>;
|
|
19
|
+
"object[]": Record<string, unknown>[];
|
|
20
|
+
auto: unknown;
|
|
21
|
+
}
|
|
22
|
+
export type TypesenseFieldType = keyof TypesenseFieldTypeMap;
|
|
23
|
+
/**
|
|
24
|
+
* `TOptional` is threaded through as a literal (`true`/`false`) rather than widened to
|
|
25
|
+
* `boolean`, so `InferDocument` can distinguish required fields from optional ones.
|
|
26
|
+
*/
|
|
27
|
+
export interface TypesenseFieldOptions<TOptional extends boolean = boolean> {
|
|
28
|
+
/** Exclude from the search index. Stored and returned, but not queryable. Default true. */
|
|
29
|
+
index?: boolean;
|
|
30
|
+
/** Allow the field to be absent from a document. Default false. */
|
|
31
|
+
optional?: TOptional;
|
|
32
|
+
/** Enable faceting/aggregation on this field. Default false. */
|
|
33
|
+
facet?: boolean;
|
|
34
|
+
/** Enable sorting. Numeric fields are sortable by default; strings are not. */
|
|
35
|
+
sort?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface TypesenseField<TType extends TypesenseFieldType = TypesenseFieldType, TOptional extends boolean = boolean> {
|
|
38
|
+
readonly type: TType;
|
|
39
|
+
readonly index: boolean;
|
|
40
|
+
readonly optional: TOptional;
|
|
41
|
+
readonly facet: boolean;
|
|
42
|
+
readonly sort?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Builds a field descriptor. Shared by the `field.*` builders and the decorator API so
|
|
46
|
+
* both declaration styles produce byte-identical field objects (and therefore hashes).
|
|
47
|
+
*/
|
|
48
|
+
export declare function createField<TType extends TypesenseFieldType, TOptional extends boolean = false>(type: TType, options?: TypesenseFieldOptions<TOptional>): TypesenseField<TType, TOptional>;
|
|
49
|
+
/**
|
|
50
|
+
* Field builders. Use these to declare a collection's fields:
|
|
51
|
+
*
|
|
52
|
+
* fields: { title: field.string({ facet: true }), price: field.float() }
|
|
53
|
+
*/
|
|
54
|
+
export declare const field: {
|
|
55
|
+
readonly string: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"string", TOptional>;
|
|
56
|
+
readonly stringArray: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"string[]", TOptional>;
|
|
57
|
+
readonly int32: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"int32", TOptional>;
|
|
58
|
+
readonly int32Array: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"int32[]", TOptional>;
|
|
59
|
+
readonly int64: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"int64", TOptional>;
|
|
60
|
+
readonly int64Array: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"int64[]", TOptional>;
|
|
61
|
+
readonly float: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"float", TOptional>;
|
|
62
|
+
readonly floatArray: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"float[]", TOptional>;
|
|
63
|
+
readonly bool: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"bool", TOptional>;
|
|
64
|
+
readonly boolArray: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"bool[]", TOptional>;
|
|
65
|
+
readonly geopoint: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"geopoint", TOptional>;
|
|
66
|
+
readonly geopointArray: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"geopoint[]", TOptional>;
|
|
67
|
+
readonly object: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"object", TOptional>;
|
|
68
|
+
readonly objectArray: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"object[]", TOptional>;
|
|
69
|
+
readonly auto: <TOptional extends boolean = false>(o?: TypesenseFieldOptions<TOptional>) => TypesenseField<"auto", TOptional>;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/schema/field.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,UAAU,EAAE,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,CAAC;qBAE5E,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;0BAElE,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;qBAE5E,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;0BAElE,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;oBAE7E,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;yBAElE,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;wBAExE,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;6BAElE,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;sBAE9E,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;2BAElE,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;oBAE9E,SAAS,SAAS,OAAO,cAAc,qBAAqB,CAAC,SAAS,CAAC;CAEtE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.field = void 0;
|
|
4
|
+
exports.createField = createField;
|
|
5
|
+
/**
|
|
6
|
+
* Builds a field descriptor. Shared by the `field.*` builders and the decorator API so
|
|
7
|
+
* both declaration styles produce byte-identical field objects (and therefore hashes).
|
|
8
|
+
*/
|
|
9
|
+
function createField(type, options = {}) {
|
|
10
|
+
return {
|
|
11
|
+
type,
|
|
12
|
+
index: options.index ?? true,
|
|
13
|
+
optional: (options.optional ?? false),
|
|
14
|
+
facet: options.facet ?? false,
|
|
15
|
+
...(options.sort === undefined ? {} : { sort: options.sort }),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Field builders. Use these to declare a collection's fields:
|
|
20
|
+
*
|
|
21
|
+
* fields: { title: field.string({ facet: true }), price: field.float() }
|
|
22
|
+
*/
|
|
23
|
+
exports.field = {
|
|
24
|
+
string: (o) => createField("string", o),
|
|
25
|
+
stringArray: (o) => createField("string[]", o),
|
|
26
|
+
int32: (o) => createField("int32", o),
|
|
27
|
+
int32Array: (o) => createField("int32[]", o),
|
|
28
|
+
int64: (o) => createField("int64", o),
|
|
29
|
+
int64Array: (o) => createField("int64[]", o),
|
|
30
|
+
float: (o) => createField("float", o),
|
|
31
|
+
floatArray: (o) => createField("float[]", o),
|
|
32
|
+
bool: (o) => createField("bool", o),
|
|
33
|
+
boolArray: (o) => createField("bool[]", o),
|
|
34
|
+
geopoint: (o) => createField("geopoint", o),
|
|
35
|
+
geopointArray: (o) => createField("geopoint[]", o),
|
|
36
|
+
object: (o) => createField("object", o),
|
|
37
|
+
objectArray: (o) => createField("object[]", o),
|
|
38
|
+
auto: (o) => createField("auto", o),
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../src/schema/field.ts"],"names":[],"mappings":";;;AAsDA,kCAWC;AAfD;;;GAGG;AACH,SAAgB,WAAW,CACzB,IAAW,EACX,UAA4C,EAAE;IAE9C,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI;QAC5B,QAAQ,EAAE,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAc;QAClD,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;QAC7B,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;KAC9D,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACU,QAAA,KAAK,GAAG;IACnB,MAAM,EAAE,CAAoC,CAAoC,EAAE,EAAE,CAClF,WAAW,CAAC,QAAQ,E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,CAAC,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const TYPESENSE_MODULE_OPTIONS: unique symbol;
|
|
2
|
+
export declare const TYPESENSE_CLIENT: unique symbol;
|
|
3
|
+
export declare const TYPESENSE_COLLECTIONS: unique symbol;
|
|
4
|
+
export declare const TYPESENSE_COLLECTOR = "typesense:collector";
|
|
5
|
+
/** Per-class map of decorated property name -> field descriptor. */
|
|
6
|
+
export declare const TYPESENSE_FIELDS = "typesense:fields";
|
|
7
|
+
/** The collection built from a class decorated with `@TypesenseCollection`. */
|
|
8
|
+
export declare const TYPESENSE_COLLECTION = "typesense:collection";
|
|
9
|
+
//# sourceMappingURL=typesense.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesense.constants.d.ts","sourceRoot":"","sources":["../src/typesense.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAC3E,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAC3D,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AACrE,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,oEAAoE;AACpE,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TYPESENSE_COLLECTION = exports.TYPESENSE_FIELDS = exports.TYPESENSE_COLLECTOR = exports.TYPESENSE_COLLECTIONS = exports.TYPESENSE_CLIENT = exports.TYPESENSE_MODULE_OPTIONS = void 0;
|
|
4
|
+
exports.TYPESENSE_MODULE_OPTIONS = Symbol("TYPESENSE_MODULE_OPTIONS");
|
|
5
|
+
exports.TYPESENSE_CLIENT = Symbol("TYPESENSE_CLIENT");
|
|
6
|
+
exports.TYPESENSE_COLLECTIONS = Symbol("TYPESENSE_COLLECTIONS");
|
|
7
|
+
exports.TYPESENSE_COLLECTOR = "typesense:collector";
|
|
8
|
+
/** Per-class map of decorated property name -> field descriptor. */
|
|
9
|
+
exports.TYPESENSE_FIELDS = "typesense:fields";
|
|
10
|
+
/** The collection built from a class decorated with `@TypesenseCollection`. */
|
|
11
|
+
exports.TYPESENSE_COLLECTION = "typesense:collection";
|
|
12
|
+
//# sourceMappingURL=typesense.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesense.constants.js","sourceRoot":"","sources":["../src/typesense.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAC9D,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAC9C,QAAA,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AACxD,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AACzD,oEAAoE;AACvD,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,+EAA+E;AAClE,QAAA,oBAAoB,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ConfigurationOptions } from "typesense/lib/Typesense/Configuration.js";
|
|
2
|
+
import type { TypesenseCollectionSource } from "./schema/decorators.js";
|
|
3
|
+
/**
|
|
4
|
+
* What to do at bootstrap when a collection's declared schema no longer matches
|
|
5
|
+
* the one Typesense is holding.
|
|
6
|
+
*
|
|
7
|
+
* - `off` never touch the live collection; log the drift only.
|
|
8
|
+
* - `create` create collections that do not exist yet; leave drifted ones alone. (default)
|
|
9
|
+
* - `alter` additionally add new fields and drop removed ones in place.
|
|
10
|
+
* - `recreate` drop and rebuild the collection. Destroys its documents — pair with a reindex.
|
|
11
|
+
*/
|
|
12
|
+
export type TypesenseMigrationStrategy = "off" | "create" | "alter" | "recreate";
|
|
13
|
+
export interface TypesenseModuleOptions extends ConfigurationOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Collections this application owns. Registered and migrated at bootstrap.
|
|
16
|
+
* Accepts `defineCollection()` results and `@TypesenseSchema()` classes alike.
|
|
17
|
+
*/
|
|
18
|
+
collections?: TypesenseCollectionSource[];
|
|
19
|
+
/** Default `create`. */
|
|
20
|
+
migrations?: TypesenseMigrationStrategy;
|
|
21
|
+
/** Called on client transport errors instead of throwing. Useful for OTel/Sentry capture. */
|
|
22
|
+
onError?: (error: unknown) => void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=typesense.module-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesense.module-options.d.ts","sourceRoot":"","sources":["../src/typesense.module-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAEjF,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;IAClE;;;OAGG;IACH,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,wBAAwB;IACxB,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesense.module-options.js","sourceRoot":"","sources":["../src/typesense.module-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type DynamicModule, type Type } from "@nestjs/common";
|
|
2
|
+
import type { TypesenseModuleOptions } from "./typesense.module-options.js";
|
|
3
|
+
export interface TypesenseModuleAsyncOptions {
|
|
4
|
+
imports?: DynamicModule["imports"];
|
|
5
|
+
inject?: (string | symbol | Type<unknown>)[];
|
|
6
|
+
useFactory: (...args: never[]) => Promise<TypesenseModuleOptions> | TypesenseModuleOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare class TypesenseModule {
|
|
9
|
+
static forRoot(options: TypesenseModuleOptions): DynamicModule;
|
|
10
|
+
static forRootAsync(options: TypesenseModuleAsyncOptions): DynamicModule;
|
|
11
|
+
private static build;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=typesense.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesense.module.d.ts","sourceRoot":"","sources":["../src/typesense.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiC,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAK9F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;IAC7C,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,sBAAsB,CAAC,GAAG,sBAAsB,CAAC;CAC5F;AAID,qBAEa,eAAe;IAC1B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,sBAAsB,GAAG,aAAa;IAI9D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,2BAA2B,GAAG,aAAa;IAWxE,OAAO,CAAC,MAAM,CAAC,KAAK;CAWrB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var TypesenseModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TypesenseModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const typesense_client_js_1 = require("./client/typesense.client.js");
|
|
13
|
+
const typesense_collections_js_1 = require("./collections/typesense-collections.js");
|
|
14
|
+
const typesense_indexer_js_1 = require("./collectors/typesense-indexer.js");
|
|
15
|
+
const typesense_constants_js_1 = require("./typesense.constants.js");
|
|
16
|
+
const EXPORTS = [typesense_client_js_1.TypesenseClient, typesense_collections_js_1.TypesenseCollections, typesense_indexer_js_1.TypesenseIndexer];
|
|
17
|
+
let TypesenseModule = TypesenseModule_1 = class TypesenseModule {
|
|
18
|
+
static forRoot(options) {
|
|
19
|
+
return TypesenseModule_1.build({ provide: typesense_constants_js_1.TYPESENSE_MODULE_OPTIONS, useValue: options });
|
|
20
|
+
}
|
|
21
|
+
static forRootAsync(options) {
|
|
22
|
+
return TypesenseModule_1.build({
|
|
23
|
+
provide: typesense_constants_js_1.TYPESENSE_MODULE_OPTIONS,
|
|
24
|
+
useFactory: options.useFactory,
|
|
25
|
+
inject: options.inject ?? [],
|
|
26
|
+
}, options.imports);
|
|
27
|
+
}
|
|
28
|
+
static build(optionsProvider, imports) {
|
|
29
|
+
return {
|
|
30
|
+
module: TypesenseModule_1,
|
|
31
|
+
imports: imports ?? [],
|
|
32
|
+
providers: [optionsProvider, ...EXPORTS],
|
|
33
|
+
exports: EXPORTS,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.TypesenseModule = TypesenseModule;
|
|
38
|
+
exports.TypesenseModule = TypesenseModule = TypesenseModule_1 = __decorate([
|
|
39
|
+
(0, common_1.Global)(),
|
|
40
|
+
(0, common_1.Module)({})
|
|
41
|
+
], TypesenseModule);
|
|
42
|
+
//# sourceMappingURL=typesense.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typesense.module.js","sourceRoot":"","sources":["../src/typesense.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA8F;AAC9F,sEAA+D;AAC/D,qFAA8E;AAC9E,4EAAqE;AACrE,qEAAoE;AASpE,MAAM,OAAO,GAAG,CAAC,qCAAe,EAAE,+CAAoB,EAAE,uCAAgB,CAAC,CAAC;AAInE,IAAM,eAAe,uBAArB,MAAM,eAAe;IAC1B,MAAM,CAAC,OAAO,CAAC,OAA+B;QAC5C,OAAO,iBAAe,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,iDAAwB,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,OAAoC;QACtD,OAAO,iBAAe,CAAC,KAAK,CAC1B;YACE,OAAO,EAAE,iDAAwB;YACjC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;SAC7B,EACD,OAAO,CAAC,OAAO,CAChB,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,KAAK,CAClB,eAAyB,EACzB,OAAkC;QAElC,OAAO;YACL,MAAM,EAAE,iBAAe;YACvB,OAAO,EAAE,OAAO,IAAI,EAAE;YACtB,SAAS,EAAE,CAAC,eAAe,EAAE,GAAG,OAAO,CAAC;YACxC,OAAO,EAAE,OAAO;SACjB,CAAC;IACJ,CAAC;CACF,CAAA;AA3BY,0CAAe;0BAAf,eAAe;IAF3B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,eAAe,CA2B3B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nestjs-typesense",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "An unofficial NestJS module for Typesense: typed collection schemas, declarative collection migrations, and database-agnostic index syncing.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nestjs",
|
|
7
|
+
"typesense",
|
|
8
|
+
"search",
|
|
9
|
+
"nestjs-module",
|
|
10
|
+
"full-text-search",
|
|
11
|
+
"postgres"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Ebenezer Domey <domeyeben4@gmail.com>",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/EbenDomey/nestjs-typesense.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/EbenDomey/nestjs-typesense/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/EbenDomey/nestjs-typesense#readme",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"test:integration": "npm run build && vitest run -c vitest.integration.config.ts",
|
|
41
|
+
"lint": "biome lint --write",
|
|
42
|
+
"format": "biome check --write --linter-enabled=false",
|
|
43
|
+
"prepare": "husky || true",
|
|
44
|
+
"prepublishOnly": "npm run build"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
48
|
+
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
49
|
+
"reflect-metadata": "^0.1.13 || ^0.2.0",
|
|
50
|
+
"typesense": "^1.8.0 || ^2.0.0 || ^3.0.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@biomejs/biome": "^2.0.0",
|
|
54
|
+
"@nestjs/common": "^11.0.1",
|
|
55
|
+
"@nestjs/core": "^11.0.1",
|
|
56
|
+
"@nestjs/testing": "^11.0.1",
|
|
57
|
+
"@types/node": "^22.0.0",
|
|
58
|
+
"husky": "^9.1.7",
|
|
59
|
+
"reflect-metadata": "^0.2.2",
|
|
60
|
+
"typescript": "^5.6.0",
|
|
61
|
+
"typesense": "^3.0.6",
|
|
62
|
+
"vitest": "^2.0.0"
|
|
63
|
+
}
|
|
64
|
+
}
|