@opra/elastic 0.33.13 → 1.0.0-alpha.18

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.
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ // import { ApiField, ComplexType, FieldsProjection, omitNullish, parseFieldsProjection } from '@opra/common';
3
+ // import mongodb, { Document } from 'mongodb';
4
+ //
5
+ // export default function prepareProjection(
6
+ // dataType: ComplexType,
7
+ // projection?: string | string[] | Document,
8
+ // ): mongodb.Document | undefined {
9
+ // if (projection && typeof projection === 'object' && !Array.isArray(projection)) return projection;
10
+ // const out: Record<string, boolean> = {};
11
+ // const projection_ =
12
+ // typeof projection === 'string' || Array.isArray(projection) ? parseFieldsProjection(projection) : projection;
13
+ // // const exclusionProjection = !pick && !!omit;
14
+ // prepare(dataType, out, projection_);
15
+ // return Object.keys(out).length ? out : undefined;
16
+ // }
17
+ //
18
+ // export function prepare(dataType: ComplexType, target: mongodb.Document, projection?: FieldsProjection) {
19
+ // const defaultFields = !projection || !Object.values(projection).find(p => !p.sign);
20
+ // const projectionKeys = projection && Object.keys(projection).map(x => x.toLowerCase());
21
+ // const projectionKeysSet = new Set(projectionKeys);
22
+ // let fieldName: string;
23
+ // let field: ApiField;
24
+ // let k: string;
25
+ // /** Add fields from data type */
26
+ // for (field of dataType.fields.values()) {
27
+ // fieldName = field.name;
28
+ // k = fieldName.toLowerCase();
29
+ // projectionKeysSet.delete(k);
30
+ // const p = projection?.[k];
31
+ // if (
32
+ // /** Ignore if field is omitted */
33
+ // p?.sign === '-' ||
34
+ // /** Ignore if default fields and field is not in projection */
35
+ // (!defaultFields && !p) ||
36
+ // /** Ignore if default fields enabled and fields is exclusive */
37
+ // (defaultFields && field.exclusive && !p)
38
+ // ) {
39
+ // continue;
40
+ // }
41
+ //
42
+ // if (field.type instanceof ComplexType && typeof p?.projection === 'object') {
43
+ // target[fieldName] = {};
44
+ // prepare(field.type, target[fieldName], p.projection);
45
+ // continue;
46
+ // }
47
+ // target[fieldName] = 1;
48
+ // }
49
+ // /** Add additional fields */
50
+ // if (dataType.additionalFields) {
51
+ // for (k of projectionKeysSet.values()) {
52
+ // const n = projectionKeysSet[k];
53
+ // if (n?.sign !== '-') target[k] = 1;
54
+ // }
55
+ // }
56
+ // }
57
+ //
58
+ // // function __prepareProjection(
59
+ // // dataType: ComplexType,
60
+ // // args: {
61
+ // // pick?: string[];
62
+ // // omit?: string[];
63
+ // // include?: string[];
64
+ // // },
65
+ // // ): any {
66
+ // // let includes: string[] | undefined;
67
+ // // let excludes: string[] | undefined;
68
+ // //
69
+ // // if (args.include && !args.pick) {
70
+ // // includes = includes || [];
71
+ // // for (const [k, f] of dataType.fields) {
72
+ // // if (f.exclusive) continue;
73
+ // // if (f.type instanceof ComplexType) includes.push(k + '.*');
74
+ // // else includes.push(k);
75
+ // // }
76
+ // // }
77
+ // //
78
+ // // if (args.pick) {
79
+ // // includes = includes || [];
80
+ // // for (const k of args.pick) {
81
+ // // const f = dataType.getField(k);
82
+ // // if (f.type instanceof ComplexType) includes.push(k + '.*');
83
+ // // else includes.push(k);
84
+ // // }
85
+ // // }
86
+ // //
87
+ // // if (args.include) {
88
+ // // includes = includes || [];
89
+ // // for (const k of args.include) {
90
+ // // const f = dataType.getField(k);
91
+ // // if (f.type instanceof ComplexType) includes.push(k + '.*');
92
+ // // else includes.push(k);
93
+ // // }
94
+ // // }
95
+ // //
96
+ // // if (args.omit) {
97
+ // // excludes = excludes || [];
98
+ // // for (const k of args.omit) {
99
+ // // const f = dataType.getField(k);
100
+ // // if (f.type instanceof ComplexType) excludes.push(k + '.*');
101
+ // // else excludes.push(k);
102
+ // // }
103
+ // // }
104
+ // //
105
+ // // return omitNullish({
106
+ // // includes,
107
+ // // excludes,
108
+ // // });
109
+ // // }
@@ -1,4 +1,4 @@
1
- export default function transformSort(sort) {
1
+ export default function prepareSort(sort) {
2
2
  if (!(sort && sort.length))
3
3
  return;
4
4
  const out = [];
@@ -1,47 +1,84 @@
1
- import { Collection, omitNullish, Singleton } from '@opra/common';
2
- import _transformFilter from './transform-filter.js';
3
- import _transformKeyValues from './transform-key-values.js';
4
- import _transformProjection from './transform-projection.js';
5
- import _transformSort from './transform-sort.js';
1
+ // import { SearchRequest } from '@elastic/elasticsearch/lib/api/types';
2
+ // import { TransportRequestOptions } from '@elastic/transport';
3
+ // import { omitNullish } from '@opra/common';
4
+ import _prepareFilter from './adapter-utils/prepare-filter.js';
5
+ import _prepareKeyValues from './adapter-utils/prepare-key-values.js';
6
+ // import _prepareProjection from './adapter-utils/prepare-projection.js';
7
+ import _prepareSort from './adapter-utils/prepare-sort.js';
6
8
  export var ElasticAdapter;
7
9
  (function (ElasticAdapter) {
8
- ElasticAdapter.transformFilter = _transformFilter;
9
- ElasticAdapter.transformKeyValues = _transformKeyValues;
10
- ElasticAdapter.transformProjection = _transformProjection;
11
- ElasticAdapter.transformSort = _transformSort;
12
- function transformRequest(request) {
13
- const { resource } = request;
14
- if (resource instanceof Collection || resource instanceof Singleton) {
15
- const { params, endpoint } = request;
16
- let options = {};
17
- switch (endpoint.name) {
18
- case 'findMany': {
19
- let searchRequest = {};
20
- const filter = ElasticAdapter.transformFilter(params?.filter);
21
- if (filter)
22
- searchRequest.query = filter;
23
- if (params?.limit != null)
24
- searchRequest.size = params.limit;
25
- if (params?.skip != null)
26
- searchRequest.from = params.skip;
27
- if (params?.count)
28
- searchRequest.track_total_hits = true;
29
- if (params?.pick || params?.include || params?.omit)
30
- searchRequest._source = _transformProjection(resource.type, params);
31
- if (params?.sort)
32
- searchRequest.sort = _transformSort(params.sort);
33
- searchRequest = omitNullish(searchRequest);
34
- options = omitNullish(options);
35
- return {
36
- method: 'search',
37
- params: searchRequest,
38
- options,
39
- args: [searchRequest, options]
10
+ ElasticAdapter.prepareFilter = _prepareFilter;
11
+ ElasticAdapter.prepareKeyValues = _prepareKeyValues;
12
+ // export const prepareProjection = _prepareProjection;
13
+ ElasticAdapter.prepareSort = _prepareSort;
14
+ async function parseRequest(context) {
15
+ const { operation } = context;
16
+ if (operation.composition?.startsWith('Entity.') && operation.compositionOptions?.type) {
17
+ const controller = operation.owner;
18
+ switch (operation.composition) {
19
+ case 'Entity.Create': {
20
+ const data = await context.getBody();
21
+ const options = {
22
+ projection: context.queryParams.projection,
40
23
  };
24
+ return { method: 'create', data, options };
41
25
  }
26
+ case 'Entity.Delete': {
27
+ const keyParam = operation.parameters.find(p => p.keyParam) || controller.parameters.find(p => p.keyParam);
28
+ const key = keyParam && context.pathParams[String(keyParam.name)];
29
+ const options = {
30
+ filter: context.queryParams.filter,
31
+ };
32
+ return { method: 'delete', key, options };
33
+ }
34
+ case 'Entity.DeleteMany': {
35
+ const options = {
36
+ filter: context.queryParams.filter,
37
+ };
38
+ return { method: 'deleteMany', options };
39
+ }
40
+ case 'Entity.FindMany': {
41
+ const options = {
42
+ filter: context.queryParams.filter,
43
+ projection: context.queryParams.projection,
44
+ count: context.queryParams.count,
45
+ limit: context.queryParams.limit,
46
+ skip: context.queryParams.skip,
47
+ sort: context.queryParams.sort,
48
+ };
49
+ return { method: 'findMany', options };
50
+ }
51
+ case 'Entity.Get': {
52
+ const keyParam = operation.parameters.find(p => p.keyParam) || controller.parameters.find(p => p.keyParam);
53
+ const key = keyParam && context.pathParams[String(keyParam.name)];
54
+ const options = {
55
+ projection: context.queryParams.projection,
56
+ filter: context.queryParams.filter,
57
+ };
58
+ return { method: 'get', key, options };
59
+ }
60
+ case 'Entity.Update': {
61
+ const data = await context.getBody();
62
+ const keyParam = operation.parameters.find(p => p.keyParam) || controller.parameters.find(p => p.keyParam);
63
+ const key = keyParam && context.pathParams[String(keyParam.name)];
64
+ const options = {
65
+ projection: context.queryParams.projection,
66
+ filter: context.queryParams.filter,
67
+ };
68
+ return { method: 'update', key, data, options };
69
+ }
70
+ case 'Entity.UpdateMany': {
71
+ const data = await context.getBody();
72
+ const options = {
73
+ filter: context.queryParams.filter,
74
+ };
75
+ return { method: 'updateMany', data, options };
76
+ }
77
+ default:
78
+ break;
42
79
  }
43
80
  }
44
- throw new TypeError(`Unimplemented request (${request.resource.kind}.${request.endpoint.name})`);
81
+ throw new Error(`This operation is not compatible to Elastic adapter`);
45
82
  }
46
- ElasticAdapter.transformRequest = transformRequest;
83
+ ElasticAdapter.parseRequest = parseRequest;
47
84
  })(ElasticAdapter || (ElasticAdapter = {}));
@@ -0,0 +1,140 @@
1
+ import { ServiceBase } from '@opra/core';
2
+ /**
3
+ * Class representing a ElasticSearch service for interacting with a collection.
4
+ * @extends ServiceBase
5
+ * @template T - The type of the documents in the collection.
6
+ */
7
+ export class ElasticService extends ServiceBase {
8
+ /**
9
+ * Constructs a new instance
10
+ *
11
+ * @param dataType - The data type of the returning results
12
+ * @param indexName - The name of the index, or a function that returns the index name
13
+ * @param [options] - The options for the service
14
+ * @constructor
15
+ */
16
+ constructor(dataType, indexName, options) {
17
+ super();
18
+ this._inputCodecs = {};
19
+ this._outputCodecs = {};
20
+ this._dataType_ = dataType;
21
+ this.client = options?.client;
22
+ this.$commonFilter = this.$commonFilter || options?.commonFilter;
23
+ this.$interceptor = this.$interceptor || options?.interceptor;
24
+ this.$indexName = indexName;
25
+ this.$resourceName = options?.resourceName;
26
+ this.$idGenerator = options?.idGenerator;
27
+ }
28
+ /**
29
+ * Retrieves the index name.
30
+ *
31
+ * @protected
32
+ * @returns The index name.
33
+ * @throws {Error} If the index name is not defined.
34
+ */
35
+ getIndexName() {
36
+ const out = typeof this.$indexName === 'function' ? this.$indexName(this) : this.$indexName;
37
+ if (out)
38
+ return out;
39
+ throw new Error('indexName is not defined');
40
+ }
41
+ /**
42
+ * Retrieves the resource name.
43
+ *
44
+ * @protected
45
+ * @returns {string} The resource name.
46
+ * @throws {Error} If the resource name is not defined.
47
+ */
48
+ getResourceName() {
49
+ const out = typeof this.$resourceName === 'function' ? this.$resourceName(this) : this.$resourceName || this.getIndexName();
50
+ if (out)
51
+ return out;
52
+ throw new Error('resourceName is not defined');
53
+ }
54
+ /**
55
+ * Retrieves the OPRA data type
56
+ *
57
+ * @throws {NotAcceptableError} If the data type is not a ComplexType.
58
+ */
59
+ get dataType() {
60
+ if (!this._dataType)
61
+ this._dataType = this.context.document.node.getComplexType(this._dataType_);
62
+ return this._dataType;
63
+ }
64
+ /**
65
+ * Retrieves the codec for the specified operation.
66
+ *
67
+ * @param operation - The operation to retrieve the encoder for. Valid values are 'create' and 'update'.
68
+ */
69
+ getInputCodec(operation) {
70
+ let validator = this._inputCodecs[operation];
71
+ if (validator)
72
+ return validator;
73
+ const options = { projection: '*' };
74
+ if (operation === 'update')
75
+ options.partial = 'deep';
76
+ const dataType = this.dataType;
77
+ validator = dataType.generateCodec('decode', options);
78
+ this._inputCodecs[operation] = validator;
79
+ return validator;
80
+ }
81
+ /**
82
+ * Retrieves the codec.
83
+ */
84
+ getOutputCodec(operation) {
85
+ let validator = this._outputCodecs[operation];
86
+ if (validator)
87
+ return validator;
88
+ const options = { projection: '*', partial: 'deep' };
89
+ const dataType = this.dataType;
90
+ validator = dataType.generateCodec('decode', options);
91
+ this._outputCodecs[operation] = validator;
92
+ return validator;
93
+ }
94
+ /**
95
+ * Retrieves the ElasticSearch client.
96
+ *
97
+ * @protected
98
+ *
99
+ * @throws {Error} If the context or client is not set.
100
+ */
101
+ getClient() {
102
+ // @ts-ignore
103
+ const db = typeof this.client === 'function' ? this.client(this) : this.client;
104
+ if (!db)
105
+ throw new Error(`Client not set!`);
106
+ return db;
107
+ }
108
+ /**
109
+ * Generates an ID.
110
+ *
111
+ * @protected
112
+ * @returns The generated ID.
113
+ */
114
+ _generateId() {
115
+ return typeof this.$idGenerator === 'function' ? this.$idGenerator(this) : undefined;
116
+ }
117
+ /**
118
+ * Retrieves the common filter used for querying documents.
119
+ * This method is mostly used for security issues like securing multi-tenant applications.
120
+ *
121
+ * @protected
122
+ * @returns {QueryDslQueryContainer | Promise<QueryDslQueryContainer> | undefined} The common filter or a Promise
123
+ * that resolves to the common filter, or undefined if not available.
124
+ */
125
+ _getCommonFilter(info) {
126
+ return typeof this.$commonFilter === 'function' ? this.$commonFilter(info, this) : this.$commonFilter;
127
+ }
128
+ async _intercept(callback, info) {
129
+ try {
130
+ if (this.$interceptor)
131
+ return this.$interceptor(callback, info, this);
132
+ return callback();
133
+ }
134
+ catch (e) {
135
+ Error.captureStackTrace(e, this._intercept);
136
+ await this.$onError?.(e, this);
137
+ throw e;
138
+ }
139
+ }
140
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/elastic",
3
- "version": "0.33.13",
3
+ "version": "1.0.0-alpha.18",
4
4
  "description": "Opra Elastic Search adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -17,23 +17,28 @@
17
17
  "build:esm": "tsc -b tsconfig-build-esm.json",
18
18
  "postbuild": "cp README.md package.json ../../LICENSE ../../build/elastic && cp ../../package.cjs.json ../../build/elastic/cjs/package.json",
19
19
  "lint": "eslint . --max-warnings=0",
20
- "test": "jest",
21
- "cover": "jest --collect-coverage",
20
+ "lint:fix": "eslint . --max-warnings=0 --fix",
21
+ "format": "prettier . --write --log-level=warn",
22
+ "test": "jest --passWithNoTests",
23
+ "cover": "jest --passWithNoTests --collect-coverage",
22
24
  "clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
23
25
  "clean:src": "ts-cleanup -s src --all",
24
26
  "clean:test": "ts-cleanup -s test --all",
25
27
  "clean:dist": "rimraf ../../build/client",
26
28
  "clean:cover": "rimraf ../../coverage/client"
27
29
  },
30
+ "dependencies": {
31
+ "putil-isplainobject": "^1.1.5"
32
+ },
28
33
  "devDependencies": {
29
- "@elastic/elasticsearch": "^8.11.0",
30
- "@faker-js/faker": "^8.4.0",
31
- "ts-gems": "^3.1.1"
34
+ "@elastic/elasticsearch": "^8.14.0",
35
+ "@faker-js/faker": "^8.4.1",
36
+ "ts-gems": "^3.4.0"
32
37
  },
33
38
  "peerDependencies": {
34
39
  "@elastic/elasticsearch": ">=8.7.0",
35
- "@opra/common": "^0.33.13",
36
- "@opra/core": "^0.33.13"
40
+ "@opra/common": "^1.0.0-alpha.18",
41
+ "@opra/core": "^1.0.0-alpha.18"
37
42
  },
38
43
  "type": "module",
39
44
  "module": "./esm/index.js",
@@ -57,4 +62,4 @@
57
62
  "elasticsearch",
58
63
  "adapter"
59
64
  ]
60
- }
65
+ }
@@ -0,0 +1,3 @@
1
+ import '@opra/core';
2
+ import { OpraFilter } from '@opra/common';
3
+ export default function prepareFilter(ast: OpraFilter.Expression | undefined, negative?: boolean): any;
@@ -0,0 +1 @@
1
+ export default function prepareKeyValues(keyValue: any, primaryKey?: string[]): Record<string, any>;
File without changes
@@ -0,0 +1 @@
1
+ export default function prepareSort(sort?: string[]): any[] | undefined;
@@ -1,12 +1,16 @@
1
- import { Request } from '@opra/core';
2
- import _transformFilter from './transform-filter.js';
3
- import _transformKeyValues from './transform-key-values.js';
4
- import _transformProjection from './transform-projection.js';
5
- import _transformSort from './transform-sort.js';
1
+ import { HttpContext } from '@opra/core';
2
+ import _prepareFilter from './adapter-utils/prepare-filter.js';
3
+ import _prepareKeyValues from './adapter-utils/prepare-key-values.js';
4
+ import _prepareSort from './adapter-utils/prepare-sort.js';
6
5
  export declare namespace ElasticAdapter {
7
- const transformFilter: typeof _transformFilter;
8
- const transformKeyValues: typeof _transformKeyValues;
9
- const transformProjection: typeof _transformProjection;
10
- const transformSort: typeof _transformSort;
11
- function transformRequest(request: Request): any;
6
+ const prepareFilter: typeof _prepareFilter;
7
+ const prepareKeyValues: typeof _prepareKeyValues;
8
+ const prepareSort: typeof _prepareSort;
9
+ interface TransformedRequest {
10
+ method: 'create' | 'delete' | 'deleteMany' | 'get' | 'findMany' | 'update' | 'updateMany';
11
+ key?: any;
12
+ data?: any;
13
+ options: any;
14
+ }
15
+ function parseRequest(context: HttpContext): Promise<TransformedRequest>;
12
16
  }
@@ -0,0 +1,147 @@
1
+ import { Client } from '@elastic/elasticsearch';
2
+ import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types';
3
+ import { ComplexType } from '@opra/common';
4
+ import { ServiceBase } from '@opra/core';
5
+ import { Type } from 'ts-gems';
6
+ import { IsObject } from 'valgen';
7
+ /**
8
+ * The namespace for the ElasticService.
9
+ *
10
+ * @namespace ElasticService
11
+ */
12
+ export declare namespace ElasticService {
13
+ interface Options {
14
+ client?: ElasticService<any>['client'];
15
+ resourceName?: ElasticService<any>['$resourceName'];
16
+ commonFilter?: ElasticService<any>['$commonFilter'];
17
+ interceptor?: ElasticService<any>['$interceptor'];
18
+ idGenerator?: ElasticService<any>['$idGenerator'];
19
+ onError?: ElasticService<any>['$onError'];
20
+ }
21
+ type CrudOp = 'create' | 'read' | 'update' | 'delete';
22
+ interface CommandInfo {
23
+ crud: CrudOp;
24
+ method: string;
25
+ byId: boolean;
26
+ documentId?: any;
27
+ input?: Record<string, any>;
28
+ options?: Record<string, any>;
29
+ }
30
+ }
31
+ /**
32
+ * Class representing a ElasticSearch service for interacting with a collection.
33
+ * @extends ServiceBase
34
+ * @template T - The type of the documents in the collection.
35
+ */
36
+ export declare class ElasticService<T extends object> extends ServiceBase {
37
+ protected _dataType_: Type | string;
38
+ protected _dataType: ComplexType;
39
+ protected _inputCodecs: Record<string, IsObject.Validator<T>>;
40
+ protected _outputCodecs: Record<string, IsObject.Validator<T>>;
41
+ /**
42
+ * Represents the name of a index in ElasticDB
43
+ */
44
+ $indexName: string | ((_this: any) => string);
45
+ /**
46
+ * Represents the name of a resource.
47
+ * @type {string}
48
+ */
49
+ $resourceName?: string | ((_this: any) => string);
50
+ /**
51
+ * Represents a ElasticDB database object.
52
+ */
53
+ client?: Client | ((_this: any) => Client);
54
+ /**
55
+ * Generates a new id for new inserting Document.
56
+ *
57
+ */
58
+ $idGenerator?: (_this: any) => any;
59
+ /**
60
+ * Callback function for handling errors.
61
+ *
62
+ * @param {unknown} error - The error object.
63
+ * @param _this - The context object.
64
+ */
65
+ $onError?: (error: unknown, _this: any) => void | Promise<void>;
66
+ /**
67
+ * Represents a common filter function for a ElasticService.
68
+ *
69
+ * @type {QueryDslQueryContainer | Function}
70
+ */
71
+ $commonFilter?: QueryDslQueryContainer | ((args: ElasticService.CommandInfo, _this: this) => QueryDslQueryContainer | Promise<QueryDslQueryContainer> | undefined);
72
+ /**
73
+ * Interceptor function for handling callback execution with provided arguments.
74
+ *
75
+ * @param callback - The callback function to be intercepted.
76
+ * @param {ElasticService.CommandInfo} info - The arguments object containing the following properties:
77
+ * @param _this - The reference to the current object.
78
+ * @returns - The promise that resolves to the result of the callback execution.
79
+ */
80
+ $interceptor?: (callback: () => any, info: ElasticService.CommandInfo, _this: any) => Promise<any>;
81
+ /**
82
+ * Constructs a new instance
83
+ *
84
+ * @param dataType - The data type of the returning results
85
+ * @param indexName - The name of the index, or a function that returns the index name
86
+ * @param [options] - The options for the service
87
+ * @constructor
88
+ */
89
+ constructor(dataType: Type | string, indexName: string, options?: ElasticService.Options);
90
+ /**
91
+ * Retrieves the index name.
92
+ *
93
+ * @protected
94
+ * @returns The index name.
95
+ * @throws {Error} If the index name is not defined.
96
+ */
97
+ getIndexName(): string;
98
+ /**
99
+ * Retrieves the resource name.
100
+ *
101
+ * @protected
102
+ * @returns {string} The resource name.
103
+ * @throws {Error} If the resource name is not defined.
104
+ */
105
+ getResourceName(): string;
106
+ /**
107
+ * Retrieves the OPRA data type
108
+ *
109
+ * @throws {NotAcceptableError} If the data type is not a ComplexType.
110
+ */
111
+ get dataType(): ComplexType;
112
+ /**
113
+ * Retrieves the codec for the specified operation.
114
+ *
115
+ * @param operation - The operation to retrieve the encoder for. Valid values are 'create' and 'update'.
116
+ */
117
+ getInputCodec(operation: string): IsObject.Validator<T>;
118
+ /**
119
+ * Retrieves the codec.
120
+ */
121
+ getOutputCodec(operation: string): IsObject.Validator<T>;
122
+ /**
123
+ * Retrieves the ElasticSearch client.
124
+ *
125
+ * @protected
126
+ *
127
+ * @throws {Error} If the context or client is not set.
128
+ */
129
+ getClient(): Client;
130
+ /**
131
+ * Generates an ID.
132
+ *
133
+ * @protected
134
+ * @returns The generated ID.
135
+ */
136
+ protected _generateId(): any;
137
+ /**
138
+ * Retrieves the common filter used for querying documents.
139
+ * This method is mostly used for security issues like securing multi-tenant applications.
140
+ *
141
+ * @protected
142
+ * @returns {QueryDslQueryContainer | Promise<QueryDslQueryContainer> | undefined} The common filter or a Promise
143
+ * that resolves to the common filter, or undefined if not available.
144
+ */
145
+ protected _getCommonFilter(info: ElasticService.CommandInfo): QueryDslQueryContainer | Promise<QueryDslQueryContainer> | undefined;
146
+ protected _intercept(callback: (...args: any[]) => any, info: ElasticService.CommandInfo): Promise<any>;
147
+ }