@sebspark/opensearch 0.3.0 → 0.3.2

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/dist/index.d.mts CHANGED
@@ -195,6 +195,9 @@ type OpenSearchQueryBody<T extends {
195
195
  id: string;
196
196
  }, K = T> = K extends DeepPartial<T> ? {
197
197
  query: {
198
+ ids?: {
199
+ values: string[];
200
+ };
198
201
  filter?: OpenSearchFilter<T>;
199
202
  match?: Match<T>;
200
203
  match_all?: {
package/dist/index.d.ts CHANGED
@@ -195,6 +195,9 @@ type OpenSearchQueryBody<T extends {
195
195
  id: string;
196
196
  }, K = T> = K extends DeepPartial<T> ? {
197
197
  query: {
198
+ ids?: {
199
+ values: string[];
200
+ };
198
201
  filter?: OpenSearchFilter<T>;
199
202
  match?: Match<T>;
200
203
  match_all?: {
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ __export(src_exports, {
35
35
  module.exports = __toCommonJS(src_exports);
36
36
 
37
37
  // src/openSearchHelper.ts
38
- var import_assert = __toESM(require("assert"));
38
+ var import_node_assert = __toESM(require("assert"));
39
39
 
40
40
  // src/fixIds.ts
41
41
  var import_omit = __toESM(require("omit"));
@@ -44,6 +44,7 @@ var fixIds = (searchQuery) => {
44
44
  const { query: q, _source, from, size, sort } = searchQuery.body;
45
45
  const body = {
46
46
  query: {
47
+ ids: q.ids,
47
48
  bool: q.bool ? fixBool(q.bool) : void 0,
48
49
  match: q.match ? fixId(q.match) : void 0,
49
50
  collapse: q.collapse,
@@ -110,8 +111,7 @@ var fixExists = (exists) => ({
110
111
  });
111
112
  var fixId = (old) => {
112
113
  const fixed = omitId(old);
113
- if (old.id)
114
- fixed._id = old.id;
114
+ if (old.id) fixed._id = old.id;
115
115
  return fixed;
116
116
  };
117
117
  var fixIdValue = (val) => val === "id" ? "_id" : val;
@@ -174,13 +174,12 @@ var typedBulkUpsert = async (client, index, items) => {
174
174
  return response;
175
175
  };
176
176
  var isLeafNode = (obj) => {
177
- if (Object.values(obj).some((value) => value === "nested"))
178
- return true;
177
+ if (Object.values(obj).some((value) => value === "nested")) return true;
179
178
  return !Object.values(obj).some(
180
179
  (value) => typeof value === "object" && value !== null && !Array.isArray(value)
181
180
  );
182
181
  };
183
- (0, import_assert.default)(
182
+ (0, import_node_assert.default)(
184
183
  isLeafNode({
185
184
  type: "nested",
186
185
  properties: { name: { type: "keyword" }, type: { type: "keyword" } }
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/openSearchHelper.ts
2
- import assert from "assert";
2
+ import assert from "node:assert";
3
3
 
4
4
  // src/fixIds.ts
5
5
  import omit from "omit";
@@ -8,6 +8,7 @@ var fixIds = (searchQuery) => {
8
8
  const { query: q, _source, from, size, sort } = searchQuery.body;
9
9
  const body = {
10
10
  query: {
11
+ ids: q.ids,
11
12
  bool: q.bool ? fixBool(q.bool) : void 0,
12
13
  match: q.match ? fixId(q.match) : void 0,
13
14
  collapse: q.collapse,
@@ -74,8 +75,7 @@ var fixExists = (exists) => ({
74
75
  });
75
76
  var fixId = (old) => {
76
77
  const fixed = omitId(old);
77
- if (old.id)
78
- fixed._id = old.id;
78
+ if (old.id) fixed._id = old.id;
79
79
  return fixed;
80
80
  };
81
81
  var fixIdValue = (val) => val === "id" ? "_id" : val;
@@ -138,8 +138,7 @@ var typedBulkUpsert = async (client, index, items) => {
138
138
  return response;
139
139
  };
140
140
  var isLeafNode = (obj) => {
141
- if (Object.values(obj).some((value) => value === "nested"))
142
- return true;
141
+ if (Object.values(obj).some((value) => value === "nested")) return true;
143
142
  return !Object.values(obj).some(
144
143
  (value) => typeof value === "object" && value !== null && !Array.isArray(value)
145
144
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebspark/opensearch",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -12,7 +12,7 @@
12
12
  "build": "tsup-node src/index.ts --format esm,cjs --dts",
13
13
  "dev": "tsc --watch --noEmit",
14
14
  "lint": "biome check .",
15
- "test": "vitest --passWithNoTests --coverage",
15
+ "test": "vitest run --passWithNoTests --coverage",
16
16
  "typecheck": "vitest --typecheck.only --passWithNoTests"
17
17
  },
18
18
  "devDependencies": {
@@ -20,7 +20,7 @@
20
20
  "tsconfig": "*"
21
21
  },
22
22
  "dependencies": {
23
- "@opensearch-project/opensearch": "2.6.0",
23
+ "@opensearch-project/opensearch": "2.9.0",
24
24
  "omit": "1.0.1"
25
25
  }
26
26
  }