@cumulus/db 21.1.0 → 21.3.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.
@@ -0,0 +1,4 @@
1
+ import { Knex } from 'knex';
2
+ export declare const up: (knex: Knex) => Promise<void>;
3
+ export declare const down: (knex: Knex) => Promise<void>;
4
+ //# sourceMappingURL=20260112224950_add_granules_collection_updated_idx.d.ts.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.down = exports.up = void 0;
4
+ const up = async (knex) => {
5
+ await knex.raw('CREATE INDEX CONCURRENTLY IF NOT EXISTS granules_collection_updated_idx ON granules (collection_cumulus_id, updated_at)');
6
+ };
7
+ exports.up = up;
8
+ const down = async (knex) => {
9
+ await knex.raw('DROP INDEX CONCURRENTLY IF EXISTS granules_collection_updated_idx');
10
+ };
11
+ exports.down = down;
12
+ exports.config = {
13
+ transaction: false,
14
+ };
15
+ //# sourceMappingURL=20260112224950_add_granules_collection_updated_idx.js.map
@@ -3,15 +3,7 @@ import { BasePgModel } from './base';
3
3
  import { PostgresFile, PostgresFileRecord } from '../types/file';
4
4
  declare class FilePgModel extends BasePgModel<PostgresFile, PostgresFileRecord> {
5
5
  constructor();
6
- upsert(knexOrTrx: Knex | Knex.Transaction, file: PostgresFile): Knex.QueryBuilder<any, {
7
- _base: any;
8
- _hasSelection: false;
9
- _keys: never;
10
- _aliases: {};
11
- _single: false;
12
- _intersectProps: {};
13
- _unionProps: never;
14
- }[]>;
6
+ upsert(knexOrTrx: Knex | Knex.Transaction, input: PostgresFile | PostgresFile[]): Promise<PostgresFileRecord[]>;
15
7
  /**
16
8
  * Retrieves all files for all granules given
17
9
  */
@@ -9,9 +9,12 @@ class FilePgModel extends base_1.BasePgModel {
9
9
  tableName: tables_1.TableNames.files,
10
10
  });
11
11
  }
12
- upsert(knexOrTrx, file) {
12
+ upsert(knexOrTrx, input) {
13
+ const files = Array.isArray(input) ? input : [input];
14
+ if (files.length === 0)
15
+ return Promise.resolve([]);
13
16
  return knexOrTrx(this.tableName)
14
- .insert(file)
17
+ .insert(files)
15
18
  .onConflict(['bucket', 'key'])
16
19
  .merge()
17
20
  .returning('*');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulus/db",
3
- "version": "21.1.0",
3
+ "version": "21.3.0",
4
4
  "description": "Utilities for working with the Cumulus DB",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -29,16 +29,16 @@
29
29
  "failFast": true
30
30
  },
31
31
  "engines": {
32
- "node": ">=20.12.2"
32
+ "node": ">=22.21.1"
33
33
  },
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-secrets-manager": "^3.621.0",
36
- "@cumulus/aws-client": "21.1.0",
37
- "@cumulus/common": "21.1.0",
38
- "@cumulus/errors": "21.1.0",
39
- "@cumulus/logger": "21.1.0",
40
- "@cumulus/message": "21.1.0",
41
- "@cumulus/types": "21.1.0",
36
+ "@cumulus/aws-client": "21.3.0",
37
+ "@cumulus/common": "21.3.0",
38
+ "@cumulus/errors": "21.3.0",
39
+ "@cumulus/logger": "21.3.0",
40
+ "@cumulus/message": "21.3.0",
41
+ "@cumulus/types": "21.3.0",
42
42
  "crypto-random-string": "^3.2.0",
43
43
  "is-valid-hostname": "1.0.2",
44
44
  "knex": "2.4.1",
@@ -50,5 +50,5 @@
50
50
  "devDependencies": {
51
51
  "@types/uuid": "^8.0.0"
52
52
  },
53
- "gitHead": "5d443a04647ed537903c85b48992d08ce3c3cd1d"
53
+ "gitHead": "9dd4a7d4b888ea713efa87d6086a762262d46dd2"
54
54
  }