@opra/elastic 1.0.0-alpha.32 → 1.0.0-beta.1
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/cjs/adapter-utils/prepare-filter.js +88 -80
- package/cjs/adapter-utils/prepare-patch.js +35 -0
- package/cjs/adapter-utils/prepare-projection.js +65 -108
- package/cjs/adapter-utils/prepare-sort.js +5 -6
- package/cjs/elastic-adapter.js +4 -7
- package/cjs/elastic-collection-service.js +365 -0
- package/cjs/elastic-entity-service.js +392 -0
- package/cjs/elastic-service.js +20 -103
- package/cjs/index.js +3 -0
- package/esm/adapter-utils/prepare-filter.js +88 -80
- package/esm/adapter-utils/prepare-patch.js +32 -0
- package/esm/adapter-utils/prepare-projection.js +62 -109
- package/esm/adapter-utils/prepare-sort.js +5 -6
- package/esm/elastic-adapter.js +4 -7
- package/esm/elastic-collection-service.js +361 -0
- package/esm/elastic-entity-service.js +388 -0
- package/esm/elastic-service.js +20 -103
- package/esm/index.js +3 -0
- package/esm/package.json +3 -0
- package/package.json +27 -35
- package/types/adapter-utils/prepare-filter.d.ts +3 -2
- package/types/adapter-utils/prepare-patch.d.ts +2 -0
- package/types/adapter-utils/prepare-projection.d.ts +7 -0
- package/types/elastic-adapter.d.ts +7 -2
- package/types/elastic-collection-service.d.ts +217 -0
- package/types/elastic-entity-service.d.ts +262 -0
- package/types/elastic-service.d.ts +20 -99
- package/types/index.d.cts +4 -0
- package/types/index.d.ts +3 -0
- package/cjs/adapter-utils/prepare-key-values.js +0 -22
- package/esm/adapter-utils/prepare-key-values.js +0 -18
- package/types/adapter-utils/prepare-key-values.d.ts +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import isPlainObject from 'putil-isplainobject';
|
|
2
|
-
const defaultPrimaryKey = ['_id'];
|
|
3
|
-
export default function prepareKeyValues(keyValue, primaryKey) {
|
|
4
|
-
primaryKey = primaryKey || defaultPrimaryKey;
|
|
5
|
-
const b = isPlainObject(keyValue);
|
|
6
|
-
if (primaryKey.length > 1 && !b) {
|
|
7
|
-
throw new TypeError(`Argument "keyValue" must be an object that contains all key values`);
|
|
8
|
-
}
|
|
9
|
-
if (primaryKey.length > 1 || b) {
|
|
10
|
-
return primaryKey.reduce((o, k) => {
|
|
11
|
-
o[k] = keyValue[k];
|
|
12
|
-
if (o[k] == null)
|
|
13
|
-
throw new Error(`Value of key "${k}" is required`);
|
|
14
|
-
return o;
|
|
15
|
-
}, {});
|
|
16
|
-
}
|
|
17
|
-
return { [primaryKey[0]]: keyValue };
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function prepareKeyValues(keyValue: any, primaryKey?: string[]): Record<string, any>;
|