@cumulus/es-client 14.0.0 → 15.0.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.
Files changed (2) hide show
  1. package/indexer.js +12 -8
  2. package/package.json +9 -9
package/indexer.js CHANGED
@@ -1,3 +1,5 @@
1
+ // @ts-check
2
+
1
3
  /* functions for transforming and indexing Cumulus Payloads
2
4
  * in Elasticsearch. These functions are specifically designed
3
5
  * to transform data for use in cumulus api
@@ -299,12 +301,13 @@ const granuleInvalidNullFields = [
299
301
  * Upserts a granule in Elasticsearch
300
302
  *
301
303
  * @param {Object} params
302
- * @param {Object} params.esClient - Elasticsearch Connection object
303
- * @param {Object} params.updates - Updates to make
304
- * @param {string} params.index - Elasticsearch index alias (default defined in search.js)
305
- * @param {string} params.type - Elasticsearch type (default: granule)
306
- * @param {string} [params.refresh] - whether to refresh the index on update or not
307
- * @param {boolean} writeConstraints - boolean toggle restricting if conditionals should
304
+ * @param {Object} params.esClient - Elasticsearch Connection object
305
+ * @param {Object} params.updates - Updates to make
306
+ * @param {string | undefined} params.index - Elasticsearch index alias
307
+ * (default defined in search.js)
308
+ * @param {string} [params.type] - Elasticsearch type (default: granule)
309
+ * @param {string} [params.refresh] - whether to refresh the index on update or not
310
+ * @param {boolean} writeConstraints - boolean toggle restricting if conditionals should
308
311
  * be used to determine write eligibility
309
312
  * @returns {Promise} Elasticsearch response
310
313
  */
@@ -340,6 +343,7 @@ async function upsertGranule({
340
343
  // File removal is a special case as null gets set to []
341
344
  if (fieldName === 'files' && isEqual(value, [])) {
342
345
  removeString += `ctx._source.remove('${fieldName}'); `;
346
+ delete upsertDoc.files; // Remove files in case this is not a scripted upsert
343
347
  }
344
348
  if (value === null) {
345
349
  removeString += `ctx._source.remove('${fieldName}'); `;
@@ -358,7 +362,7 @@ async function upsertGranule({
358
362
  // undesired behavior via business logic on the message write logic
359
363
  inline = `
360
364
  if ((ctx._source.createdAt === null || params.doc.createdAt >= ctx._source.createdAt)
361
- && (params.doc.status != 'running' || (params.doc.status == 'running' && params.doc.execution != ctx._source.execution))) {
365
+ && ((params.doc.status != 'running' && params.doc.status != 'queued') || ((params.doc.status == 'running' || params.doc.status == 'queued') && params.doc.execution != ctx._source.execution))) {
362
366
  ${inlineDocWriteString}
363
367
  } else {
364
368
  ctx.op = 'none';
@@ -366,7 +370,7 @@ async function upsertGranule({
366
370
  `;
367
371
  if (!updates.createdAt) {
368
372
  inline = `
369
- if (params.doc.status != 'running' || (params.doc.status == 'running' && params.doc.execution != ctx._source.execution)) {
373
+ if ((params.doc.status != 'running' && params.doc.status != 'queued') || ((params.doc.status == 'running' || params.doc.status == 'queued') && params.doc.execution != ctx._source.execution)) {
370
374
  ${inlineDocWriteString}
371
375
  } else {
372
376
  ctx.op = 'none';
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@cumulus/es-client",
3
- "version": "14.0.0",
3
+ "version": "15.0.0",
4
4
  "description": "Utilities for working with Elasticsearch",
5
5
  "keywords": [
6
6
  "CUMULUS",
7
7
  "NASA"
8
8
  ],
9
9
  "engines": {
10
- "node": ">=14.19.1"
10
+ "node": ">=16.19.0"
11
11
  },
12
12
  "publishConfig": {
13
13
  "access": "public"
@@ -30,10 +30,10 @@
30
30
  "author": "Cumulus Authors",
31
31
  "license": "Apache-2.0",
32
32
  "dependencies": {
33
- "@cumulus/common": "14.0.0",
34
- "@cumulus/errors": "14.0.0",
35
- "@cumulus/logger": "14.0.0",
36
- "@cumulus/message": "14.0.0",
33
+ "@cumulus/common": "15.0.0",
34
+ "@cumulus/errors": "15.0.0",
35
+ "@cumulus/logger": "15.0.0",
36
+ "@cumulus/message": "15.0.0",
37
37
  "@elastic/elasticsearch": "^5.6.20",
38
38
  "aws-elasticsearch-connector": "8.2.0",
39
39
  "aws-sdk": "^2.585.0",
@@ -42,9 +42,9 @@
42
42
  "p-limit": "^1.2.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@cumulus/aws-client": "14.0.0",
46
- "@cumulus/test-data": "14.0.0",
45
+ "@cumulus/aws-client": "15.0.0",
46
+ "@cumulus/test-data": "15.0.0",
47
47
  "p-each-series": "^2.1.0"
48
48
  },
49
- "gitHead": "bc0cd0857e007b64e4e8809f7de16a4aeb1e6840"
49
+ "gitHead": "15986abef3ef23dc9ccefd31f219f78203dcd8db"
50
50
  }