@opra/elastic 1.13.0 → 1.15.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.
@@ -287,10 +287,12 @@ class ElasticEntityService extends elastic_service_js_1.ElasticService {
287
287
  const inputKeysLen = Object.keys(input).length;
288
288
  (0, valgen_1.isNotNullish)(inputKeysLen || script, { label: 'input' });
289
289
  if (requestScript) {
290
- script =
291
- typeof requestScript === 'string'
292
- ? { source: requestScript }
293
- : { ...requestScript };
290
+ if (typeof requestScript === 'string')
291
+ script = { source: requestScript };
292
+ else if (requestScript.source || requestScript.id)
293
+ script = { ...requestScript };
294
+ else
295
+ script = { source: requestScript };
294
296
  script.lang = script.lang || 'painless';
295
297
  if (inputKeysLen > 0 && script.lang !== 'painless') {
296
298
  throw new TypeError(`You cannot provide 'input' and 'script' arguments at the same time unless the script lang is 'painless'`);
@@ -284,10 +284,12 @@ export class ElasticEntityService extends ElasticService {
284
284
  const inputKeysLen = Object.keys(input).length;
285
285
  isNotNullish(inputKeysLen || script, { label: 'input' });
286
286
  if (requestScript) {
287
- script =
288
- typeof requestScript === 'string'
289
- ? { source: requestScript }
290
- : { ...requestScript };
287
+ if (typeof requestScript === 'string')
288
+ script = { source: requestScript };
289
+ else if (requestScript.source || requestScript.id)
290
+ script = { ...requestScript };
291
+ else
292
+ script = { source: requestScript };
291
293
  script.lang = script.lang || 'painless';
292
294
  if (inputKeysLen > 0 && script.lang !== 'painless') {
293
295
  throw new TypeError(`You cannot provide 'input' and 'script' arguments at the same time unless the script lang is 'painless'`);
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@opra/elastic",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "Opra Elastic Search adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
8
8
  "@jsopen/objects": "^1.5.2",
9
9
  "tslib": "^2.8.1",
10
- "valgen": "^5.14.0"
10
+ "valgen": "^5.15.0"
11
11
  },
12
12
  "peerDependencies": {
13
- "@elastic/elasticsearch": ">=8.7.0 <9",
14
- "@opra/common": "^1.13.0",
15
- "@opra/core": "^1.13.0"
13
+ "@elastic/elasticsearch": ">=8.7.0 <10",
14
+ "@opra/common": "^1.15.0",
15
+ "@opra/core": "^1.15.0"
16
16
  },
17
17
  "type": "module",
18
18
  "exports": {
@@ -34,7 +34,7 @@
34
34
  "types": "./types/index.d.ts",
35
35
  "repository": {
36
36
  "type": "git",
37
- "url": "https://github.com/panates/opra.git",
37
+ "url": "git+https://github.com/panates/opra.git",
38
38
  "directory": "packages/elastic"
39
39
  },
40
40
  "engines": {
@@ -53,5 +53,8 @@
53
53
  "elastic",
54
54
  "elasticsearch",
55
55
  "adapter"
56
- ]
56
+ ],
57
+ "publishConfig": {
58
+ "access": "public"
59
+ }
57
60
  }
@@ -164,6 +164,7 @@ export declare namespace ElasticEntityService {
164
164
  type UpdateByQueryResponse = estypes.UpdateByQueryResponse;
165
165
  type QueryDslQueryContainer = estypes.QueryDslQueryContainer;
166
166
  type Script = estypes.Script;
167
+ type ScriptSource = estypes.ScriptSource;
167
168
  }
168
169
  /**
169
170
  * @class ElasticEntityService