@opra/elastic 1.28.3 → 1.28.5
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 +1 -1
- package/README.md +48 -3
- package/elastic-entity-service.js +1 -0
- package/package.json +5 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,19 +1,64 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<a href="https://oprajs.com">
|
|
4
|
+
<img src="https://oprajs.com/img/opra-header-block.webp" width="880" alt="OPRA — Open Platform for Rich APIs" />
|
|
5
|
+
</a>
|
|
6
|
+
|
|
1
7
|
# @opra/elastic
|
|
2
8
|
|
|
9
|
+
Elasticsearch data service adapter for the OPRA framework
|
|
10
|
+
|
|
3
11
|
[![NPM Version][npm-image]][npm-url]
|
|
4
12
|
[![NPM Downloads][downloads-image]][downloads-url]
|
|
5
13
|
[![CI Tests][ci-test-image]][ci-test-url]
|
|
6
14
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
7
15
|
|
|
16
|
+
[🌐 Documentation](https://oprajs.com) · [🚀 Getting Started](https://oprajs.com/docs/introduction) · [📦 Packages](https://github.com/panates/opra#packages) · [💬 Issues](https://github.com/panates/opra/issues)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
Elasticsearch data service adapter for the [OPRA](https://oprajs.com) framework. Translate OPRA operations directly into Elasticsearch queries — no manual query building required.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **`ElasticService`** — Base service managing Elasticsearch client connection and error handling
|
|
27
|
+
- **`ElasticCollectionService`** — Collection-level CRUD service for Elasticsearch indices
|
|
28
|
+
- **`ElasticEntityService`** — Document-level service for single entity operations
|
|
29
|
+
- **`ElasticAdapter`** — Utility namespace: `prepareFilter()`, `preparePatch()`, `prepareProjection()`, `prepareSort()`, `parseRequest()`
|
|
30
|
+
- Automatic translation of OPRA filter DSL to Elasticsearch query DSL
|
|
31
|
+
- Interceptor pipeline support
|
|
8
32
|
|
|
9
|
-
##
|
|
10
|
-
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @opra/elastic
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { ElasticCollectionService } from '@opra/elastic';
|
|
43
|
+
import { Client } from '@elastic/elasticsearch';
|
|
44
|
+
|
|
45
|
+
@HttpController({ path: 'products' })
|
|
46
|
+
export class ProductsController extends ElasticCollectionService<Product> {
|
|
47
|
+
constructor(client: Client) {
|
|
48
|
+
super(Product, client, 'products');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@HttpOperation.Entity.FindMany({ type: Product })
|
|
52
|
+
findMany() { return super.findMany(); }
|
|
53
|
+
}
|
|
54
|
+
```
|
|
11
55
|
|
|
12
56
|
## Node Compatibility
|
|
13
|
-
- node >= 20.x
|
|
14
57
|
|
|
58
|
+
- node >= 20.x
|
|
15
59
|
|
|
16
60
|
## License
|
|
61
|
+
|
|
17
62
|
Available under [MIT](LICENSE) license.
|
|
18
63
|
|
|
19
64
|
[npm-image]: https://img.shields.io/npm/v/@opra/elastic
|
|
@@ -388,6 +388,7 @@ export class ElasticEntityService extends ElasticService {
|
|
|
388
388
|
if (operation === 'update') {
|
|
389
389
|
options.partial = 'deep';
|
|
390
390
|
options.keepKeyFields = true;
|
|
391
|
+
options.allowNullOptionals = true;
|
|
391
392
|
}
|
|
392
393
|
validator = dataType.generateCodec('decode', options);
|
|
393
394
|
this._inputCodecs[cacheKey] = validator;
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/elastic",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.5",
|
|
4
4
|
"description": "Opra Elastic Search adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"homepage": "https://www.oprajs.com",
|
|
7
8
|
"dependencies": {
|
|
8
|
-
"@jsopen/objects": "^2.2.
|
|
9
|
+
"@jsopen/objects": "^2.2.2",
|
|
9
10
|
"tslib": "^2.8.1",
|
|
10
11
|
"valgen": "^6.2.0"
|
|
11
12
|
},
|
|
12
13
|
"peerDependencies": {
|
|
13
14
|
"@elastic/elasticsearch": ">=8.7.0 <10",
|
|
14
|
-
"@opra/common": "^1.28.
|
|
15
|
-
"@opra/core": "^1.28.
|
|
15
|
+
"@opra/common": "^1.28.5",
|
|
16
|
+
"@opra/core": "^1.28.5"
|
|
16
17
|
},
|
|
17
18
|
"type": "module",
|
|
18
19
|
"module": "./index.js",
|