lemon-model 1.0.4 → 1.0.6
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/README.md +9 -8
- package/dist/types/core-types.d.ts +35 -3
- package/dist/types/core-types.js +2 -0
- package/dist/types/core-types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,30 +4,31 @@ Common shared model definitions for both `backend` and `frontend`.
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
!TIP! to develop `backend` api, use [lemon-core](https://github.com/lemoncloud-io/lemon-core) instead of this.
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
|
|
10
|
+
# install with npm
|
|
11
|
+
npm install --save lemon-model
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
14
|
## Contribution
|
|
15
15
|
|
|
16
|
-
Plz, request PR.
|
|
16
|
+
Plz, request PR.
|
|
17
17
|
|
|
18
18
|
See [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md)
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
## LICENSE
|
|
22
21
|
|
|
23
|
-
[MIT](LICENSE) - (C) 2019 LemonCloud Co Ltd. - All Rights Reserved
|
|
24
|
-
|
|
22
|
+
[MIT](LICENSE) - (C) 2019 LemonCloud Co Ltd. - All Rights Reserved.„
|
|
25
23
|
|
|
26
24
|
----------------
|
|
27
|
-
|
|
25
|
+
|
|
26
|
+
## VERSION INFO
|
|
28
27
|
|
|
29
28
|
| Version | Description
|
|
30
29
|
|-- |--
|
|
30
|
+
| 1.0.6 | optimized `SearchBody` with `knn` support.
|
|
31
|
+
| 1.0.5 | optimized `NextIdentity` with `authorization`.
|
|
31
32
|
| 1.0.4 | optimized `NextIdentity` with `referer` and `origin`.
|
|
32
33
|
| 1.0.3 | optimized `NextIdentityCognito`
|
|
33
34
|
| 1.0.0 | initial types out of the original `lemon-core@3.1.1`
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* @date 2020-01-03 support cognito-identity
|
|
9
9
|
* @date 2021-12-07 support SearchBody
|
|
10
10
|
* @date 2024-12-20 optimized `NextIdentityCognito`
|
|
11
|
+
* @date 2025-05-13 optimized `NextContext` with `Authorization` header
|
|
12
|
+
* @date 2025-06-12 optimized `SearchBody` with `knn` support
|
|
11
13
|
*
|
|
12
14
|
* @copyright (C) lemoncloud.io 2019 - All Rights Reserved.
|
|
13
15
|
*/
|
|
@@ -235,6 +237,10 @@ export interface NextContext<T extends NextIdentity = NextIdentity> {
|
|
|
235
237
|
cookie?: {
|
|
236
238
|
[key: string]: string;
|
|
237
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* (optional) `authorization` in request headers if applicable.
|
|
242
|
+
*/
|
|
243
|
+
authorization?: string;
|
|
238
244
|
/**
|
|
239
245
|
* (optional) `referer` in request headers if applicable.
|
|
240
246
|
*/
|
|
@@ -290,7 +296,9 @@ export interface QueryResult<T> {
|
|
|
290
296
|
last?: any;
|
|
291
297
|
}
|
|
292
298
|
/**
|
|
293
|
-
*
|
|
299
|
+
* type: `QueryTerm`
|
|
300
|
+
* - query term for search.
|
|
301
|
+
* - it should be compartible with elastic-search.
|
|
294
302
|
*/
|
|
295
303
|
export declare type QueryTerm = string | number | string[] | number[] | {
|
|
296
304
|
query: string | number | string[] | number[];
|
|
@@ -305,7 +313,9 @@ export declare type QueryTerm = string | number | string[] | number[] | {
|
|
|
305
313
|
};
|
|
306
314
|
};
|
|
307
315
|
/**
|
|
308
|
-
*
|
|
316
|
+
* type: `SortTerm`
|
|
317
|
+
* - sort term for search.
|
|
318
|
+
* - it should be compartible with elastic-search.
|
|
309
319
|
*/
|
|
310
320
|
export declare type SortTerm = string | {
|
|
311
321
|
[key: string]: 'asc' | 'desc';
|
|
@@ -316,7 +326,9 @@ export declare type SortTerm = string | {
|
|
|
316
326
|
};
|
|
317
327
|
};
|
|
318
328
|
/**
|
|
319
|
-
*
|
|
329
|
+
* type: `SearchQuery`
|
|
330
|
+
* - search query for elastic-search.
|
|
331
|
+
* - it should be compartible with elastic-search.
|
|
320
332
|
*/
|
|
321
333
|
export interface SearchQuery {
|
|
322
334
|
term?: {
|
|
@@ -353,6 +365,26 @@ export interface SearchQuery {
|
|
|
353
365
|
should?: SearchQuery | SearchQuery[];
|
|
354
366
|
minimum_should_match?: number;
|
|
355
367
|
};
|
|
368
|
+
/** required to have mapping type: `knn_vector` */
|
|
369
|
+
knn?: {
|
|
370
|
+
/** field (ex: `vector$.sm3`) to query */
|
|
371
|
+
[field: string]: {
|
|
372
|
+
vector: number[];
|
|
373
|
+
/** The number of nearest neighbors to return */
|
|
374
|
+
k?: number;
|
|
375
|
+
max_distance?: number;
|
|
376
|
+
min_score?: number;
|
|
377
|
+
filter?: SearchQuery;
|
|
378
|
+
method_parameters?: {
|
|
379
|
+
ef_search?: number;
|
|
380
|
+
nprobes?: number;
|
|
381
|
+
};
|
|
382
|
+
rescore?: {
|
|
383
|
+
oversample_factor?: number;
|
|
384
|
+
} | boolean;
|
|
385
|
+
expand_nested_docs?: boolean;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
356
388
|
query_string?: {
|
|
357
389
|
query: string;
|
|
358
390
|
};
|
package/dist/types/core-types.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* @date 2020-01-03 support cognito-identity
|
|
10
10
|
* @date 2021-12-07 support SearchBody
|
|
11
11
|
* @date 2024-12-20 optimized `NextIdentityCognito`
|
|
12
|
+
* @date 2025-05-13 optimized `NextContext` with `Authorization` header
|
|
13
|
+
* @date 2025-06-12 optimized `SearchBody` with `knn` support
|
|
12
14
|
*
|
|
13
15
|
* @copyright (C) lemoncloud.io 2019 - All Rights Reserved.
|
|
14
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-types.js","sourceRoot":"","sources":["../../src/types/core-types.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"core-types.js","sourceRoot":"","sources":["../../src/types/core-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|