@opra/elastic 1.19.5 → 1.20.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.
@@ -13,15 +13,15 @@ var ElasticAdapter;
13
13
  ElasticAdapter.prepareProjection = prepare_projection_js_1.default;
14
14
  ElasticAdapter.prepareSort = prepare_sort_js_1.default;
15
15
  async function parseRequest(context) {
16
- if (context.protocol !== 'http') {
16
+ if (context.transport !== 'http') {
17
17
  throw new TypeError('ElasticAdapter can parse only HttpContext');
18
18
  }
19
19
  const ctx = context;
20
- const { operation } = ctx;
21
- if (operation?.composition?.startsWith('Entity.') &&
22
- operation.compositionOptions?.type) {
23
- const controller = operation.owner;
24
- switch (operation.composition) {
20
+ const { __oprDef } = ctx;
21
+ if (__oprDef?.composition?.startsWith('Entity.') &&
22
+ __oprDef.compositionOptions?.type) {
23
+ const controller = __oprDef.owner;
24
+ switch (__oprDef.composition) {
25
25
  case 'Entity.Create': {
26
26
  const data = await ctx.getBody();
27
27
  const options = {
@@ -34,7 +34,7 @@ var ElasticAdapter;
34
34
  };
35
35
  }
36
36
  case 'Entity.Delete': {
37
- const keyParam = operation.parameters.find(p => p.keyParam) ||
37
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
38
38
  controller.parameters.find(p => p.keyParam);
39
39
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
40
40
  const options = {
@@ -64,7 +64,7 @@ var ElasticAdapter;
64
64
  return { method: 'findMany', options };
65
65
  }
66
66
  case 'Entity.Get': {
67
- const keyParam = operation.parameters.find(p => p.keyParam) ||
67
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
68
68
  controller.parameters.find(p => p.keyParam);
69
69
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
70
70
  const options = {
@@ -75,7 +75,7 @@ var ElasticAdapter;
75
75
  }
76
76
  case 'Entity.Replace': {
77
77
  const data = await ctx.getBody();
78
- const keyParam = operation.parameters.find(p => p.keyParam) ||
78
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
79
79
  controller.parameters.find(p => p.keyParam);
80
80
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
81
81
  const options = {
@@ -91,7 +91,7 @@ var ElasticAdapter;
91
91
  }
92
92
  case 'Entity.Update': {
93
93
  const data = await ctx.getBody();
94
- const keyParam = operation.parameters.find(p => p.keyParam) ||
94
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
95
95
  controller.parameters.find(p => p.keyParam);
96
96
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
97
97
  const options = {
@@ -75,7 +75,7 @@ class ElasticEntityService extends elastic_service_js_1.ElasticService {
75
75
  if (this._dataType && this._dataTypeScope !== this.scope)
76
76
  this._dataType = undefined;
77
77
  if (!this._dataType)
78
- this._dataType = this.context.documentNode.getComplexType(this._dataType_);
78
+ this._dataType = this.context.__docNode.getComplexType(this._dataType_);
79
79
  this._dataTypeScope = this.scope;
80
80
  return this._dataType;
81
81
  }
@@ -9,15 +9,15 @@ export var ElasticAdapter;
9
9
  ElasticAdapter.prepareProjection = _prepareProjection;
10
10
  ElasticAdapter.prepareSort = _prepareSort;
11
11
  async function parseRequest(context) {
12
- if (context.protocol !== 'http') {
12
+ if (context.transport !== 'http') {
13
13
  throw new TypeError('ElasticAdapter can parse only HttpContext');
14
14
  }
15
15
  const ctx = context;
16
- const { operation } = ctx;
17
- if (operation?.composition?.startsWith('Entity.') &&
18
- operation.compositionOptions?.type) {
19
- const controller = operation.owner;
20
- switch (operation.composition) {
16
+ const { __oprDef } = ctx;
17
+ if (__oprDef?.composition?.startsWith('Entity.') &&
18
+ __oprDef.compositionOptions?.type) {
19
+ const controller = __oprDef.owner;
20
+ switch (__oprDef.composition) {
21
21
  case 'Entity.Create': {
22
22
  const data = await ctx.getBody();
23
23
  const options = {
@@ -30,7 +30,7 @@ export var ElasticAdapter;
30
30
  };
31
31
  }
32
32
  case 'Entity.Delete': {
33
- const keyParam = operation.parameters.find(p => p.keyParam) ||
33
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
34
34
  controller.parameters.find(p => p.keyParam);
35
35
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
36
36
  const options = {
@@ -60,7 +60,7 @@ export var ElasticAdapter;
60
60
  return { method: 'findMany', options };
61
61
  }
62
62
  case 'Entity.Get': {
63
- const keyParam = operation.parameters.find(p => p.keyParam) ||
63
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
64
64
  controller.parameters.find(p => p.keyParam);
65
65
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
66
66
  const options = {
@@ -71,7 +71,7 @@ export var ElasticAdapter;
71
71
  }
72
72
  case 'Entity.Replace': {
73
73
  const data = await ctx.getBody();
74
- const keyParam = operation.parameters.find(p => p.keyParam) ||
74
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
75
75
  controller.parameters.find(p => p.keyParam);
76
76
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
77
77
  const options = {
@@ -87,7 +87,7 @@ export var ElasticAdapter;
87
87
  }
88
88
  case 'Entity.Update': {
89
89
  const data = await ctx.getBody();
90
- const keyParam = operation.parameters.find(p => p.keyParam) ||
90
+ const keyParam = __oprDef.parameters.find(p => p.keyParam) ||
91
91
  controller.parameters.find(p => p.keyParam);
92
92
  const key = keyParam && ctx.pathParams[String(keyParam.name)];
93
93
  const options = {
@@ -72,7 +72,7 @@ export class ElasticEntityService extends ElasticService {
72
72
  if (this._dataType && this._dataTypeScope !== this.scope)
73
73
  this._dataType = undefined;
74
74
  if (!this._dataType)
75
- this._dataType = this.context.documentNode.getComplexType(this._dataType_);
75
+ this._dataType = this.context.__docNode.getComplexType(this._dataType_);
76
76
  this._dataTypeScope = this.scope;
77
77
  return this._dataType;
78
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/elastic",
3
- "version": "1.19.5",
3
+ "version": "1.20.0",
4
4
  "description": "Opra Elastic Search adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@elastic/elasticsearch": ">=8.7.0 <10",
14
- "@opra/common": "^1.19.5",
15
- "@opra/core": "^1.19.5"
14
+ "@opra/common": "^1.20.0",
15
+ "@opra/core": "^1.20.0"
16
16
  },
17
17
  "type": "module",
18
18
  "exports": {