@cumulus/db 10.1.0 → 10.1.1-alpha.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 (62) hide show
  1. package/dist/config.d.ts +0 -1
  2. package/dist/config.js +2 -4
  3. package/dist/connection.js +8 -29
  4. package/dist/index.d.ts +13 -8
  5. package/dist/index.js +28 -11
  6. package/dist/lib/QuerySearchClient.d.ts +36 -0
  7. package/dist/lib/QuerySearchClient.js +51 -0
  8. package/dist/lib/collection.d.ts +10 -0
  9. package/dist/lib/collection.js +21 -0
  10. package/dist/lib/errors.d.ts +6 -0
  11. package/dist/lib/errors.js +8 -0
  12. package/dist/lib/execution.d.ts +21 -0
  13. package/dist/lib/execution.js +28 -1
  14. package/dist/lib/file.d.ts +33 -0
  15. package/dist/lib/file.js +61 -0
  16. package/dist/lib/granule.d.ts +35 -3
  17. package/dist/lib/granule.js +104 -8
  18. package/dist/migrations/{20220126172008_files_granule_id_index.d.ts → 20210914051414_add_type_to_files.d.ts} +1 -1
  19. package/dist/migrations/{20220126172008_files_granule_id_index.js → 20210914051414_add_type_to_files.js} +5 -3
  20. package/dist/models/base.d.ts +49 -9
  21. package/dist/models/base.js +75 -7
  22. package/dist/models/collection.d.ts +4 -3
  23. package/dist/models/collection.js +4 -1
  24. package/dist/models/execution.d.ts +1 -0
  25. package/dist/models/execution.js +5 -2
  26. package/dist/models/file.d.ts +2 -2
  27. package/dist/models/file.js +2 -1
  28. package/dist/models/granule.d.ts +2 -0
  29. package/dist/models/granule.js +8 -2
  30. package/dist/models/pdr.js +2 -2
  31. package/dist/test-utils.js +3 -0
  32. package/dist/translate/async_operations.d.ts +13 -0
  33. package/dist/translate/async_operations.js +56 -2
  34. package/dist/translate/collections.d.ts +13 -2
  35. package/dist/translate/collections.js +31 -2
  36. package/dist/translate/executions.js +2 -2
  37. package/dist/translate/file.js +3 -1
  38. package/dist/translate/granules.d.ts +15 -4
  39. package/dist/translate/granules.js +38 -14
  40. package/dist/translate/pdr.d.ts +29 -0
  41. package/dist/translate/pdr.js +82 -0
  42. package/dist/translate/providers.d.ts +2 -1
  43. package/dist/translate/providers.js +24 -1
  44. package/dist/translate/rules.d.ts +2 -1
  45. package/dist/translate/rules.js +36 -2
  46. package/dist/types/base.d.ts +5 -0
  47. package/dist/types/base.js +3 -0
  48. package/dist/types/collection.d.ts +6 -4
  49. package/dist/types/file.d.ts +3 -1
  50. package/dist/types/granule.d.ts +2 -1
  51. package/dist/types/pdr.d.ts +2 -1
  52. package/dist/types/provider.d.ts +1 -1
  53. package/dist/types/provider.js +6 -0
  54. package/dist/types/query.d.ts +10 -0
  55. package/dist/types/query.js +3 -0
  56. package/dist/types/record.d.ts +5 -0
  57. package/dist/types/record.js +3 -0
  58. package/dist/types/rule.d.ts +3 -2
  59. package/package.json +8 -9
  60. package/LICENSE +0 -60
  61. package/dist/translate/pdrs.d.ts +0 -19
  62. package/dist/translate/pdrs.js +0 -44
package/dist/config.d.ts CHANGED
@@ -8,7 +8,6 @@ export declare const localStackConnectionEnv: {
8
8
  PG_DATABASE: string;
9
9
  PG_PORT: string;
10
10
  };
11
- export declare const isKnexDebugEnabled: (env?: NodeJS.ProcessEnv) => boolean;
12
11
  export declare const getSecretConnectionConfig: (SecretId: string, secretsManager: AWS.SecretsManager) => Promise<Knex.PgConnectionConfig>;
13
12
  export declare const getConnectionConfigEnv: (env: NodeJS.ProcessEnv) => Knex.PgConnectionConfig;
14
13
  /**
package/dist/config.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getKnexConfig = exports.getConnectionConfig = exports.getConnectionConfigEnv = exports.getSecretConnectionConfig = exports.isKnexDebugEnabled = exports.localStackConnectionEnv = void 0;
6
+ exports.getKnexConfig = exports.getConnectionConfig = exports.getConnectionConfigEnv = exports.getSecretConnectionConfig = exports.localStackConnectionEnv = void 0;
7
7
  const aws_sdk_1 = __importDefault(require("aws-sdk"));
8
8
  const common_1 = require("@cumulus/common");
9
9
  exports.localStackConnectionEnv = {
@@ -13,8 +13,6 @@ exports.localStackConnectionEnv = {
13
13
  PG_DATABASE: 'postgres',
14
14
  PG_PORT: '5432',
15
15
  };
16
- const isKnexDebugEnabled = (env = {}) => env.KNEX_DEBUG === 'true';
17
- exports.isKnexDebugEnabled = isKnexDebugEnabled;
18
16
  const getSecretConnectionConfig = async (SecretId, secretsManager) => {
19
17
  var _a;
20
18
  const response = await secretsManager.getSecretValue({ SecretId }).promise();
@@ -112,7 +110,7 @@ const getKnexConfig = async ({ env = process.env, secretsManager = new aws_sdk_1
112
110
  const knexConfig = {
113
111
  client: 'pg',
114
112
  connection: await (0, exports.getConnectionConfig)({ env, secretsManager }),
115
- debug: (0, exports.isKnexDebugEnabled)(env),
113
+ debug: env.KNEX_DEBUG === 'true',
116
114
  asyncStackTraces: env.KNEX_ASYNC_STACK_TRACES === 'true',
117
115
  pool: {
118
116
  min: 0,
@@ -44,37 +44,16 @@ const log = new logger_1.default({ sender: '@cumulus/db/connection' });
44
44
  * @returns {Promise<Knex>} a Knex configuration object that has returned at least one query
45
45
  */
46
46
  const getKnexClient = async ({ env = process.env, secretsManager = new aws_sdk_1.default.SecretsManager(), knexLogger = log, } = {}) => {
47
- if ((0, config_1.isKnexDebugEnabled)(env)) {
48
- knexLogger.info('Initializing connection pool...');
49
- }
50
47
  const knexConfig = await (0, config_1.getKnexConfig)({ env, secretsManager });
51
48
  const knexClient = (0, knex_1.knex)(knexConfig);
52
- if ((0, config_1.isKnexDebugEnabled)(env)) {
53
- //@ts-ignore
54
- // context is an internal object that isn't typed
55
- // this is needed to force tarn to log per-retry failures
56
- // and allow propagateCreateError to be set `false`
57
- knexClient.context.client.pool.on('createFail', (_, error) => {
58
- knexLogger.warn('knex failed on attempted connection', error);
59
- throw error;
60
- });
61
- //@ts-ignore
62
- knexClient.context.client.pool.on('createSuccess', (_, resource) => {
63
- knexLogger.info(`added connection to pool: ${JSON.stringify(resource)}`);
64
- });
65
- //@ts-ignore
66
- knexClient.context.client.pool.on('acquireSuccess', (_, resource) => {
67
- knexLogger.info(`acquired connection from pool: ${JSON.stringify(resource)}`);
68
- });
69
- //@ts-ignore
70
- knexClient.context.client.pool.on('release', (resource) => {
71
- knexLogger.info(`released connection from pool: ${JSON.stringify(resource)}`);
72
- });
73
- //@ts-ignore
74
- knexClient.context.client.pool.on('poolDestroySuccess', () => {
75
- knexLogger.info('pool is destroyed');
76
- });
77
- }
49
+ //@ts-ignore
50
+ // context is an internal object that isn't typed
51
+ // this is needed to force tarn to log per-retry failures
52
+ // and allow propagateCreateError to be set `false`
53
+ knexClient.context.client.pool.on('createFail', (_, error) => {
54
+ knexLogger.warn('knex failed on attempted connection', error);
55
+ throw error;
56
+ });
78
57
  return knexClient;
79
58
  };
80
59
  exports.getKnexClient = getKnexClient;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  export { Knex } from 'knex';
2
2
  export { createTestDatabase, deleteTestDatabase, destroyLocalTestDb, fakeAsyncOperationRecordFactory, fakeCollectionRecordFactory, fakeExecutionRecordFactory, fakeFileRecordFactory, fakeGranuleRecordFactory, fakePdrRecordFactory, fakeProviderRecordFactory, fakeRuleRecordFactory, generateLocalTestDb, } from './test-utils';
3
+ export { isCollisionError } from './lib/errors';
3
4
  export { getKnexClient } from './connection';
4
5
  export { getKnexConfig, localStackConnectionEnv } from './config';
5
6
  export { createRejectableTransaction } from './database';
6
7
  export { TableNames } from './tables';
7
8
  export declare const migrationDir: string;
8
9
  export { validateProviderHost, nullifyUndefinedProviderValues, } from './provider';
10
+ export { BaseRecord, } from './types/base';
9
11
  export { PostgresAsyncOperation, PostgresAsyncOperationRecord, } from './types/async_operation';
10
12
  export { PostgresCollection, PostgresCollectionRecord, } from './types/collection';
11
13
  export { PostgresExecution, PostgresExecutionRecord, } from './types/execution';
@@ -14,16 +16,19 @@ export { PostgresRule, PostgresRuleRecord, } from './types/rule';
14
16
  export { PostgresGranule, PostgresGranuleRecord, } from './types/granule';
15
17
  export { PostgresPdr, PostgresPdrRecord, } from './types/pdr';
16
18
  export { PostgresFile, PostgresFileRecord, } from './types/file';
17
- export { translateApiAsyncOperationToPostgresAsyncOperation } from './translate/async_operations';
19
+ export { translateApiAsyncOperationToPostgresAsyncOperation, translatePostgresAsyncOperationToApiAsyncOperation, } from './translate/async_operations';
18
20
  export { translateApiFiletoPostgresFile, translatePostgresFileToApiFile, } from './translate/file';
19
- export { translateApiCollectionToPostgresCollection } from './translate/collections';
20
- export { translateApiProviderToPostgresProvider, } from './translate/providers';
21
- export { translateApiRuleToPostgresRule } from './translate/rules';
21
+ export { translateApiCollectionToPostgresCollection, translatePostgresCollectionToApiCollection, } from './translate/collections';
22
+ export { translateApiProviderToPostgresProvider, translatePostgresProviderToApiProvider, } from './translate/providers';
23
+ export { translateApiRuleToPostgresRule, translatePostgresRuleToApiRule, } from './translate/rules';
22
24
  export { translateApiExecutionToPostgresExecution, translatePostgresExecutionToApiExecution, } from './translate/executions';
23
- export { translateApiGranuleToPostgresGranule, translatePostgresGranuleToApiGranule, } from './translate/granules';
24
- export { translateApiPdrToPostgresPdr } from './translate/pdrs';
25
- export { executionArnsFromGranuleIdsAndWorkflowNames, newestExecutionArnFromGranuleIdWorkflowName, getWorkflowNameIntersectFromGranuleIds, getApiExecutionCumulusIds, getApiGranuleExecutionCumulusIdsByExecution, getExecutionArnsByGranuleCumulusId, } from './lib/execution';
26
- export { getApiGranuleCumulusIds, getApiGranuleExecutionCumulusIds, upsertGranuleWithExecutionJoinRecord, } from './lib/granule';
25
+ export { translateApiGranuleToPostgresGranule, translatePostgresGranuleToApiGranule, translatePostgresGranuleResultToApiGranule, } from './translate/granules';
26
+ export { translateApiPdrToPostgresPdr, translatePostgresPdrToApiPdr, } from './translate/pdr';
27
+ export { getCollectionsByGranuleIds, } from './lib/collection';
28
+ export { executionArnsFromGranuleIdsAndWorkflowNames, newestExecutionArnFromGranuleIdWorkflowName, getWorkflowNameIntersectFromGranuleIds, getApiExecutionCumulusIds, getApiGranuleExecutionCumulusIdsByExecution, getExecutionInfoByGranuleCumulusId, } from './lib/execution';
29
+ export { getFilesAndGranuleInfoQuery, } from './lib/file';
30
+ export { getApiGranuleCumulusIds, getApiGranuleExecutionCumulusIds, getGranuleCollectionId, getUniqueGranuleByGranuleId, upsertGranuleWithExecutionJoinRecord, getGranulesByApiPropertiesQuery, } from './lib/granule';
31
+ export { QuerySearchClient, } from './lib/QuerySearchClient';
27
32
  export { AsyncOperationPgModel } from './models/async_operation';
28
33
  export { BasePgModel } from './models/base';
29
34
  export { CollectionPgModel } from './models/collection';
package/dist/index.js CHANGED
@@ -19,8 +19,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.ProviderPgModel = exports.PdrPgModel = exports.GranulesExecutionsPgModel = exports.GranulePgModel = exports.FilePgModel = exports.ExecutionPgModel = exports.CollectionPgModel = exports.BasePgModel = exports.AsyncOperationPgModel = exports.upsertGranuleWithExecutionJoinRecord = exports.getApiGranuleExecutionCumulusIds = exports.getApiGranuleCumulusIds = exports.getExecutionArnsByGranuleCumulusId = exports.getApiGranuleExecutionCumulusIdsByExecution = exports.getApiExecutionCumulusIds = exports.getWorkflowNameIntersectFromGranuleIds = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.translateApiPdrToPostgresPdr = exports.translatePostgresGranuleToApiGranule = exports.translateApiGranuleToPostgresGranule = exports.translatePostgresExecutionToApiExecution = exports.translateApiExecutionToPostgresExecution = exports.translateApiRuleToPostgresRule = exports.translateApiProviderToPostgresProvider = exports.translateApiCollectionToPostgresCollection = exports.translatePostgresFileToApiFile = exports.translateApiFiletoPostgresFile = exports.translateApiAsyncOperationToPostgresAsyncOperation = exports.nullifyUndefinedProviderValues = exports.validateProviderHost = exports.migrationDir = exports.TableNames = exports.createRejectableTransaction = exports.localStackConnectionEnv = exports.getKnexConfig = exports.getKnexClient = exports.generateLocalTestDb = exports.fakeRuleRecordFactory = exports.fakeProviderRecordFactory = exports.fakePdrRecordFactory = exports.fakeGranuleRecordFactory = exports.fakeFileRecordFactory = exports.fakeExecutionRecordFactory = exports.fakeCollectionRecordFactory = exports.fakeAsyncOperationRecordFactory = exports.destroyLocalTestDb = exports.deleteTestDatabase = exports.createTestDatabase = exports.Knex = void 0;
23
- exports.RulePgModel = void 0;
22
+ exports.getGranuleCollectionId = exports.getApiGranuleExecutionCumulusIds = exports.getApiGranuleCumulusIds = exports.getFilesAndGranuleInfoQuery = exports.getExecutionInfoByGranuleCumulusId = exports.getApiGranuleExecutionCumulusIdsByExecution = exports.getApiExecutionCumulusIds = exports.getWorkflowNameIntersectFromGranuleIds = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.getCollectionsByGranuleIds = exports.translatePostgresPdrToApiPdr = exports.translateApiPdrToPostgresPdr = exports.translatePostgresGranuleResultToApiGranule = exports.translatePostgresGranuleToApiGranule = exports.translateApiGranuleToPostgresGranule = exports.translatePostgresExecutionToApiExecution = exports.translateApiExecutionToPostgresExecution = exports.translatePostgresRuleToApiRule = exports.translateApiRuleToPostgresRule = exports.translatePostgresProviderToApiProvider = exports.translateApiProviderToPostgresProvider = exports.translatePostgresCollectionToApiCollection = exports.translateApiCollectionToPostgresCollection = exports.translatePostgresFileToApiFile = exports.translateApiFiletoPostgresFile = exports.translatePostgresAsyncOperationToApiAsyncOperation = exports.translateApiAsyncOperationToPostgresAsyncOperation = exports.nullifyUndefinedProviderValues = exports.validateProviderHost = exports.migrationDir = exports.TableNames = exports.createRejectableTransaction = exports.localStackConnectionEnv = exports.getKnexConfig = exports.getKnexClient = exports.isCollisionError = exports.generateLocalTestDb = exports.fakeRuleRecordFactory = exports.fakeProviderRecordFactory = exports.fakePdrRecordFactory = exports.fakeGranuleRecordFactory = exports.fakeFileRecordFactory = exports.fakeExecutionRecordFactory = exports.fakeCollectionRecordFactory = exports.fakeAsyncOperationRecordFactory = exports.destroyLocalTestDb = exports.deleteTestDatabase = exports.createTestDatabase = exports.Knex = void 0;
23
+ exports.RulePgModel = exports.ProviderPgModel = exports.PdrPgModel = exports.GranulesExecutionsPgModel = exports.GranulePgModel = exports.FilePgModel = exports.ExecutionPgModel = exports.CollectionPgModel = exports.BasePgModel = exports.AsyncOperationPgModel = exports.QuerySearchClient = exports.getGranulesByApiPropertiesQuery = exports.upsertGranuleWithExecutionJoinRecord = exports.getUniqueGranuleByGranuleId = void 0;
24
24
  const path = __importStar(require("path"));
25
25
  var knex_1 = require("knex");
26
26
  Object.defineProperty(exports, "Knex", { enumerable: true, get: function () { return knex_1.Knex; } });
@@ -37,6 +37,8 @@ Object.defineProperty(exports, "fakePdrRecordFactory", { enumerable: true, get:
37
37
  Object.defineProperty(exports, "fakeProviderRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeProviderRecordFactory; } });
38
38
  Object.defineProperty(exports, "fakeRuleRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeRuleRecordFactory; } });
39
39
  Object.defineProperty(exports, "generateLocalTestDb", { enumerable: true, get: function () { return test_utils_1.generateLocalTestDb; } });
40
+ var errors_1 = require("./lib/errors");
41
+ Object.defineProperty(exports, "isCollisionError", { enumerable: true, get: function () { return errors_1.isCollisionError; } });
40
42
  var connection_1 = require("./connection");
41
43
  Object.defineProperty(exports, "getKnexClient", { enumerable: true, get: function () { return connection_1.getKnexClient; } });
42
44
  var config_1 = require("./config");
@@ -52,50 +54,65 @@ Object.defineProperty(exports, "validateProviderHost", { enumerable: true, get:
52
54
  Object.defineProperty(exports, "nullifyUndefinedProviderValues", { enumerable: true, get: function () { return provider_1.nullifyUndefinedProviderValues; } });
53
55
  var async_operations_1 = require("./translate/async_operations");
54
56
  Object.defineProperty(exports, "translateApiAsyncOperationToPostgresAsyncOperation", { enumerable: true, get: function () { return async_operations_1.translateApiAsyncOperationToPostgresAsyncOperation; } });
57
+ Object.defineProperty(exports, "translatePostgresAsyncOperationToApiAsyncOperation", { enumerable: true, get: function () { return async_operations_1.translatePostgresAsyncOperationToApiAsyncOperation; } });
55
58
  var file_1 = require("./translate/file");
56
59
  Object.defineProperty(exports, "translateApiFiletoPostgresFile", { enumerable: true, get: function () { return file_1.translateApiFiletoPostgresFile; } });
57
60
  Object.defineProperty(exports, "translatePostgresFileToApiFile", { enumerable: true, get: function () { return file_1.translatePostgresFileToApiFile; } });
58
61
  var collections_1 = require("./translate/collections");
59
62
  Object.defineProperty(exports, "translateApiCollectionToPostgresCollection", { enumerable: true, get: function () { return collections_1.translateApiCollectionToPostgresCollection; } });
63
+ Object.defineProperty(exports, "translatePostgresCollectionToApiCollection", { enumerable: true, get: function () { return collections_1.translatePostgresCollectionToApiCollection; } });
60
64
  var providers_1 = require("./translate/providers");
61
65
  Object.defineProperty(exports, "translateApiProviderToPostgresProvider", { enumerable: true, get: function () { return providers_1.translateApiProviderToPostgresProvider; } });
66
+ Object.defineProperty(exports, "translatePostgresProviderToApiProvider", { enumerable: true, get: function () { return providers_1.translatePostgresProviderToApiProvider; } });
62
67
  var rules_1 = require("./translate/rules");
63
68
  Object.defineProperty(exports, "translateApiRuleToPostgresRule", { enumerable: true, get: function () { return rules_1.translateApiRuleToPostgresRule; } });
69
+ Object.defineProperty(exports, "translatePostgresRuleToApiRule", { enumerable: true, get: function () { return rules_1.translatePostgresRuleToApiRule; } });
64
70
  var executions_1 = require("./translate/executions");
65
71
  Object.defineProperty(exports, "translateApiExecutionToPostgresExecution", { enumerable: true, get: function () { return executions_1.translateApiExecutionToPostgresExecution; } });
66
72
  Object.defineProperty(exports, "translatePostgresExecutionToApiExecution", { enumerable: true, get: function () { return executions_1.translatePostgresExecutionToApiExecution; } });
67
73
  var granules_1 = require("./translate/granules");
68
74
  Object.defineProperty(exports, "translateApiGranuleToPostgresGranule", { enumerable: true, get: function () { return granules_1.translateApiGranuleToPostgresGranule; } });
69
75
  Object.defineProperty(exports, "translatePostgresGranuleToApiGranule", { enumerable: true, get: function () { return granules_1.translatePostgresGranuleToApiGranule; } });
70
- var pdrs_1 = require("./translate/pdrs");
71
- Object.defineProperty(exports, "translateApiPdrToPostgresPdr", { enumerable: true, get: function () { return pdrs_1.translateApiPdrToPostgresPdr; } });
76
+ Object.defineProperty(exports, "translatePostgresGranuleResultToApiGranule", { enumerable: true, get: function () { return granules_1.translatePostgresGranuleResultToApiGranule; } });
77
+ var pdr_1 = require("./translate/pdr");
78
+ Object.defineProperty(exports, "translateApiPdrToPostgresPdr", { enumerable: true, get: function () { return pdr_1.translateApiPdrToPostgresPdr; } });
79
+ Object.defineProperty(exports, "translatePostgresPdrToApiPdr", { enumerable: true, get: function () { return pdr_1.translatePostgresPdrToApiPdr; } });
80
+ var collection_1 = require("./lib/collection");
81
+ Object.defineProperty(exports, "getCollectionsByGranuleIds", { enumerable: true, get: function () { return collection_1.getCollectionsByGranuleIds; } });
72
82
  var execution_1 = require("./lib/execution");
73
83
  Object.defineProperty(exports, "executionArnsFromGranuleIdsAndWorkflowNames", { enumerable: true, get: function () { return execution_1.executionArnsFromGranuleIdsAndWorkflowNames; } });
74
84
  Object.defineProperty(exports, "newestExecutionArnFromGranuleIdWorkflowName", { enumerable: true, get: function () { return execution_1.newestExecutionArnFromGranuleIdWorkflowName; } });
75
85
  Object.defineProperty(exports, "getWorkflowNameIntersectFromGranuleIds", { enumerable: true, get: function () { return execution_1.getWorkflowNameIntersectFromGranuleIds; } });
76
86
  Object.defineProperty(exports, "getApiExecutionCumulusIds", { enumerable: true, get: function () { return execution_1.getApiExecutionCumulusIds; } });
77
87
  Object.defineProperty(exports, "getApiGranuleExecutionCumulusIdsByExecution", { enumerable: true, get: function () { return execution_1.getApiGranuleExecutionCumulusIdsByExecution; } });
78
- Object.defineProperty(exports, "getExecutionArnsByGranuleCumulusId", { enumerable: true, get: function () { return execution_1.getExecutionArnsByGranuleCumulusId; } });
88
+ Object.defineProperty(exports, "getExecutionInfoByGranuleCumulusId", { enumerable: true, get: function () { return execution_1.getExecutionInfoByGranuleCumulusId; } });
89
+ var file_2 = require("./lib/file");
90
+ Object.defineProperty(exports, "getFilesAndGranuleInfoQuery", { enumerable: true, get: function () { return file_2.getFilesAndGranuleInfoQuery; } });
79
91
  var granule_1 = require("./lib/granule");
80
92
  Object.defineProperty(exports, "getApiGranuleCumulusIds", { enumerable: true, get: function () { return granule_1.getApiGranuleCumulusIds; } });
81
93
  Object.defineProperty(exports, "getApiGranuleExecutionCumulusIds", { enumerable: true, get: function () { return granule_1.getApiGranuleExecutionCumulusIds; } });
94
+ Object.defineProperty(exports, "getGranuleCollectionId", { enumerable: true, get: function () { return granule_1.getGranuleCollectionId; } });
95
+ Object.defineProperty(exports, "getUniqueGranuleByGranuleId", { enumerable: true, get: function () { return granule_1.getUniqueGranuleByGranuleId; } });
82
96
  Object.defineProperty(exports, "upsertGranuleWithExecutionJoinRecord", { enumerable: true, get: function () { return granule_1.upsertGranuleWithExecutionJoinRecord; } });
97
+ Object.defineProperty(exports, "getGranulesByApiPropertiesQuery", { enumerable: true, get: function () { return granule_1.getGranulesByApiPropertiesQuery; } });
98
+ var QuerySearchClient_1 = require("./lib/QuerySearchClient");
99
+ Object.defineProperty(exports, "QuerySearchClient", { enumerable: true, get: function () { return QuerySearchClient_1.QuerySearchClient; } });
83
100
  var async_operation_1 = require("./models/async_operation");
84
101
  Object.defineProperty(exports, "AsyncOperationPgModel", { enumerable: true, get: function () { return async_operation_1.AsyncOperationPgModel; } });
85
102
  var base_1 = require("./models/base");
86
103
  Object.defineProperty(exports, "BasePgModel", { enumerable: true, get: function () { return base_1.BasePgModel; } });
87
- var collection_1 = require("./models/collection");
88
- Object.defineProperty(exports, "CollectionPgModel", { enumerable: true, get: function () { return collection_1.CollectionPgModel; } });
104
+ var collection_2 = require("./models/collection");
105
+ Object.defineProperty(exports, "CollectionPgModel", { enumerable: true, get: function () { return collection_2.CollectionPgModel; } });
89
106
  var execution_2 = require("./models/execution");
90
107
  Object.defineProperty(exports, "ExecutionPgModel", { enumerable: true, get: function () { return execution_2.ExecutionPgModel; } });
91
- var file_2 = require("./models/file");
92
- Object.defineProperty(exports, "FilePgModel", { enumerable: true, get: function () { return file_2.FilePgModel; } });
108
+ var file_3 = require("./models/file");
109
+ Object.defineProperty(exports, "FilePgModel", { enumerable: true, get: function () { return file_3.FilePgModel; } });
93
110
  var granule_2 = require("./models/granule");
94
111
  Object.defineProperty(exports, "GranulePgModel", { enumerable: true, get: function () { return granule_2.GranulePgModel; } });
95
112
  var granules_executions_1 = require("./models/granules-executions");
96
113
  Object.defineProperty(exports, "GranulesExecutionsPgModel", { enumerable: true, get: function () { return granules_executions_1.GranulesExecutionsPgModel; } });
97
- var pdr_1 = require("./models/pdr");
98
- Object.defineProperty(exports, "PdrPgModel", { enumerable: true, get: function () { return pdr_1.PdrPgModel; } });
114
+ var pdr_2 = require("./models/pdr");
115
+ Object.defineProperty(exports, "PdrPgModel", { enumerable: true, get: function () { return pdr_2.PdrPgModel; } });
99
116
  var provider_2 = require("./models/provider");
100
117
  Object.defineProperty(exports, "ProviderPgModel", { enumerable: true, get: function () { return provider_2.ProviderPgModel; } });
101
118
  var rule_1 = require("./models/rule");
@@ -0,0 +1,36 @@
1
+ import { Knex } from 'knex';
2
+ import { BaseRecord } from '../types/base';
3
+ /**
4
+ * Class to handle fetching results for an arbitrary PostgreSQL query and
5
+ * paging through them.
6
+ */
7
+ declare class QuerySearchClient<RecordType extends BaseRecord> {
8
+ readonly query: Knex.QueryBuilder;
9
+ readonly limit: number;
10
+ offset: number;
11
+ records: RecordType[];
12
+ constructor(query: Knex.QueryBuilder, limit: number);
13
+ /**
14
+ * Query the PostgreSQL database for the given offset/limit to get a set of results.
15
+ *
16
+ * @returns {Promise<RecordType[]>} - set of records from PostgreSQL table
17
+ * @throws
18
+ */
19
+ private fetchRecords;
20
+ /**
21
+ * View the next item in the results
22
+ *
23
+ * This does not remove the object from the queue.
24
+ *
25
+ * @returns {Promise<RecordType>} - record from PostgreSQL table
26
+ */
27
+ peek(): Promise<RecordType>;
28
+ /**
29
+ * Remove and return the next item in the results
30
+ *
31
+ * @returns {Promise<RecordType>} - record from PostgreSQL table
32
+ */
33
+ shift(): Promise<RecordType | undefined>;
34
+ }
35
+ export { QuerySearchClient };
36
+ //# sourceMappingURL=QuerySearchClient.d.ts.map
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QuerySearchClient = void 0;
4
+ /**
5
+ * Class to handle fetching results for an arbitrary PostgreSQL query and
6
+ * paging through them.
7
+ */
8
+ class QuerySearchClient {
9
+ constructor(query, limit) {
10
+ this.query = query;
11
+ this.limit = limit;
12
+ this.offset = 0;
13
+ this.records = [];
14
+ }
15
+ /**
16
+ * Query the PostgreSQL database for the given offset/limit to get a set of results.
17
+ *
18
+ * @returns {Promise<RecordType[]>} - set of records from PostgreSQL table
19
+ * @throws
20
+ */
21
+ async fetchRecords() {
22
+ this.records = await (this.query
23
+ .offset(this.offset)
24
+ .limit(this.limit));
25
+ this.offset += this.limit;
26
+ }
27
+ /**
28
+ * View the next item in the results
29
+ *
30
+ * This does not remove the object from the queue.
31
+ *
32
+ * @returns {Promise<RecordType>} - record from PostgreSQL table
33
+ */
34
+ async peek() {
35
+ if (this.records.length === 0)
36
+ await this.fetchRecords();
37
+ return this.records[0];
38
+ }
39
+ /**
40
+ * Remove and return the next item in the results
41
+ *
42
+ * @returns {Promise<RecordType>} - record from PostgreSQL table
43
+ */
44
+ async shift() {
45
+ if (this.records.length === 0)
46
+ await this.fetchRecords();
47
+ return this.records.shift();
48
+ }
49
+ }
50
+ exports.QuerySearchClient = QuerySearchClient;
51
+ //# sourceMappingURL=QuerySearchClient.js.map
@@ -0,0 +1,10 @@
1
+ import { Knex } from 'knex';
2
+ /**
3
+ * Get collection results for a given set of granule IDs
4
+ *
5
+ * @param {Knex} knex - Knex databse client
6
+ * @param {Array<string>} granuleIds - Array of granule IDs
7
+ * @returns {Promise<Array<Object>>} - An array of collection results
8
+ */
9
+ export declare const getCollectionsByGranuleIds: (knex: Knex, granuleIds: string[]) => Promise<any[]>;
10
+ //# sourceMappingURL=collection.d.ts.map
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCollectionsByGranuleIds = void 0;
4
+ const tables_1 = require("../tables");
5
+ /**
6
+ * Get collection results for a given set of granule IDs
7
+ *
8
+ * @param {Knex} knex - Knex databse client
9
+ * @param {Array<string>} granuleIds - Array of granule IDs
10
+ * @returns {Promise<Array<Object>>} - An array of collection results
11
+ */
12
+ const getCollectionsByGranuleIds = async (knex, granuleIds) => {
13
+ const { collections: collectionsTable, granules: granulesTable, } = tables_1.TableNames;
14
+ return await knex(collectionsTable)
15
+ .select(`${collectionsTable}.*`)
16
+ .innerJoin(granulesTable, `${collectionsTable}.cumulus_id`, `${granulesTable}.collection_cumulus_id`)
17
+ .whereIn(`${granulesTable}.granule_id`, granuleIds)
18
+ .groupBy(`${collectionsTable}.cumulus_id`);
19
+ };
20
+ exports.getCollectionsByGranuleIds = getCollectionsByGranuleIds;
21
+ //# sourceMappingURL=collection.js.map
@@ -0,0 +1,6 @@
1
+ interface KnexError extends Error {
2
+ code: string;
3
+ }
4
+ export declare const isCollisionError: (error: KnexError) => boolean;
5
+ export {};
6
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCollisionError = void 0;
4
+ // Postgres error codes:
5
+ // https://www.postgresql.org/docs/10/errcodes-appendix.html
6
+ const isCollisionError = (error) => error.code === '23505';
7
+ exports.isCollisionError = isCollisionError;
8
+ //# sourceMappingURL=errors.js.map
@@ -1,9 +1,29 @@
1
1
  import { Knex } from 'knex';
2
2
  import { ExecutionPgModel } from '../models/execution';
3
3
  import { GranulesExecutionsPgModel } from '../models/granules-executions';
4
+ import { PostgresExecutionRecord } from '../types/execution';
4
5
  export interface ArnRecord {
5
6
  arn: string;
6
7
  }
8
+ /**
9
+ * Returns execution info sorted by most recent first for an input
10
+ * Granule Cumulus ID.
11
+ *
12
+ * @param {Object} params
13
+ * @param {Knex | Knex.Transaction} params.knexOrTransaction
14
+ * Knex client for reading from RDS database
15
+ * @param {Array<string>} params.executionColumns - Columns to return from executions table
16
+ * @param {number} params.granuleCumulusId - The primary ID for a Granule
17
+ * @param {number} [params.limit] - limit to number of executions to query
18
+ * @returns {Promise<Partial<PostgresExecutionRecord>[]>}
19
+ * Array of arn objects with the most recent first.
20
+ */
21
+ export declare const getExecutionInfoByGranuleCumulusId: ({ knexOrTransaction, granuleCumulusId, executionColumns, limit, }: {
22
+ knexOrTransaction: Knex | Knex.Transaction;
23
+ granuleCumulusId: number;
24
+ executionColumns: string[];
25
+ limit?: number | undefined;
26
+ }) => Promise<Partial<PostgresExecutionRecord>[]>;
7
27
  /**
8
28
  * Returns a list of executionArns sorted by most recent first, for an input
9
29
  * Granule Cumulus ID.
@@ -31,6 +51,7 @@ export declare const executionArnsFromGranuleIdsAndWorkflowNames: (knex: Knex, g
31
51
  *
32
52
  * @param {string} granuleId - granuleIds
33
53
  * @param {string} workflowName - workflow name
54
+ * @param {Knex} testKnex - knex for testing
34
55
  * @returns {Promise<string>} - most recent exectutionArn for input parameters.
35
56
  * @throws {RecordNotFound}
36
57
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getApiGranuleExecutionCumulusIdsByExecution = exports.getApiExecutionCumulusIds = exports.getWorkflowNameIntersectFromGranuleIds = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.getExecutionArnsByGranuleCumulusId = void 0;
3
+ exports.getApiGranuleExecutionCumulusIdsByExecution = exports.getApiExecutionCumulusIds = exports.getWorkflowNameIntersectFromGranuleIds = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.getExecutionArnsByGranuleCumulusId = exports.getExecutionInfoByGranuleCumulusId = void 0;
4
4
  const errors_1 = require("@cumulus/errors");
5
5
  const execution_1 = require("../models/execution");
6
6
  const granules_executions_1 = require("../models/granules-executions");
@@ -8,6 +8,32 @@ const tables_1 = require("../tables");
8
8
  const Logger = require('@cumulus/logger');
9
9
  const { getKnexClient } = require('../connection');
10
10
  const log = new Logger({ sender: '@cumulus/db/lib/execution' });
11
+ /**
12
+ * Returns execution info sorted by most recent first for an input
13
+ * Granule Cumulus ID.
14
+ *
15
+ * @param {Object} params
16
+ * @param {Knex | Knex.Transaction} params.knexOrTransaction
17
+ * Knex client for reading from RDS database
18
+ * @param {Array<string>} params.executionColumns - Columns to return from executions table
19
+ * @param {number} params.granuleCumulusId - The primary ID for a Granule
20
+ * @param {number} [params.limit] - limit to number of executions to query
21
+ * @returns {Promise<Partial<PostgresExecutionRecord>[]>}
22
+ * Array of arn objects with the most recent first.
23
+ */
24
+ const getExecutionInfoByGranuleCumulusId = async ({ knexOrTransaction, granuleCumulusId, executionColumns = ['arn'], limit, }) => {
25
+ const knexQuery = knexOrTransaction(tables_1.TableNames.executions)
26
+ .column(executionColumns.map((column) => `${tables_1.TableNames.executions}.${column}`))
27
+ .where(`${tables_1.TableNames.granules}.cumulus_id`, granuleCumulusId)
28
+ .join(tables_1.TableNames.granulesExecutions, `${tables_1.TableNames.executions}.cumulus_id`, `${tables_1.TableNames.granulesExecutions}.execution_cumulus_id`)
29
+ .join(tables_1.TableNames.granules, `${tables_1.TableNames.granules}.cumulus_id`, `${tables_1.TableNames.granulesExecutions}.granule_cumulus_id`)
30
+ .orderBy(`${tables_1.TableNames.executions}.timestamp`, 'desc');
31
+ if (limit) {
32
+ knexQuery.limit(limit);
33
+ }
34
+ return await knexQuery;
35
+ };
36
+ exports.getExecutionInfoByGranuleCumulusId = getExecutionInfoByGranuleCumulusId;
11
37
  /**
12
38
  * Returns a list of executionArns sorted by most recent first, for an input
13
39
  * Granule Cumulus ID.
@@ -55,6 +81,7 @@ exports.executionArnsFromGranuleIdsAndWorkflowNames = executionArnsFromGranuleId
55
81
  *
56
82
  * @param {string} granuleId - granuleIds
57
83
  * @param {string} workflowName - workflow name
84
+ * @param {Knex} testKnex - knex for testing
58
85
  * @returns {Promise<string>} - most recent exectutionArn for input parameters.
59
86
  * @throws {RecordNotFound}
60
87
  */
@@ -0,0 +1,33 @@
1
+ import { Knex } from 'knex';
2
+ import { PostgresFileRecord } from '../types/file';
3
+ import { PostgresGranuleRecord } from '../types/granule';
4
+ /**
5
+ * Helper to build a query that returns records from the files table with data
6
+ * joined in from the granules table optionally filtered by collectionIds,
7
+ * granulesIds and providers.
8
+ *
9
+ * @param {Object} params
10
+ * @param {Knex} params.knex - Knex client object
11
+ * @param {Partial<PostgresFileRecord>} params.searchParams
12
+ * Query search parameters for files table
13
+ * @param {Array<string>} params.sortColumns
14
+ * Columns to sort results by
15
+ * @param {Array<string>} [params.granuleColumns]
16
+ * Columns to return from granules table
17
+ * @param {number} [params.limit] - Limit on number of results to return. Optional.
18
+ * @param {Array<string>} [params.collectionIds] - Array of collectionIds to include.
19
+ * @param {Array<string>} [params.granuleIds] - Array of granuleIds to include.
20
+ * @param {Array<string>} [params.providers] - Array of providers to include.
21
+ * @returns {Promise<Object>} - A Knex query builder object
22
+ */
23
+ export declare const getFilesAndGranuleInfoQuery: ({ knex, searchParams, sortColumns, granuleColumns, limit, collectionIds, granuleIds, providers, }: {
24
+ knex: Knex;
25
+ searchParams: Partial<PostgresFileRecord>;
26
+ sortColumns: (keyof PostgresFileRecord)[];
27
+ granuleColumns?: (keyof PostgresGranuleRecord)[] | undefined;
28
+ limit?: number | undefined;
29
+ collectionIds?: string[] | undefined;
30
+ granuleIds?: string[] | undefined;
31
+ providers?: string[] | undefined;
32
+ }) => Knex.QueryBuilder;
33
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFilesAndGranuleInfoQuery = void 0;
4
+ const Collections_1 = require("@cumulus/message/Collections");
5
+ const tables_1 = require("../tables");
6
+ /**
7
+ * Helper to build a query that returns records from the files table with data
8
+ * joined in from the granules table optionally filtered by collectionIds,
9
+ * granulesIds and providers.
10
+ *
11
+ * @param {Object} params
12
+ * @param {Knex} params.knex - Knex client object
13
+ * @param {Partial<PostgresFileRecord>} params.searchParams
14
+ * Query search parameters for files table
15
+ * @param {Array<string>} params.sortColumns
16
+ * Columns to sort results by
17
+ * @param {Array<string>} [params.granuleColumns]
18
+ * Columns to return from granules table
19
+ * @param {number} [params.limit] - Limit on number of results to return. Optional.
20
+ * @param {Array<string>} [params.collectionIds] - Array of collectionIds to include.
21
+ * @param {Array<string>} [params.granuleIds] - Array of granuleIds to include.
22
+ * @param {Array<string>} [params.providers] - Array of providers to include.
23
+ * @returns {Promise<Object>} - A Knex query builder object
24
+ */
25
+ const getFilesAndGranuleInfoQuery = ({ knex, searchParams, sortColumns, granuleColumns = [], limit, collectionIds = [], granuleIds = [], providers = [], }) => {
26
+ const { collections: collectionsTable, files: filesTable, granules: granulesTable, providers: providersTable, } = tables_1.TableNames;
27
+ const query = knex(filesTable)
28
+ .select(`${filesTable}.*`)
29
+ .modify((queryBuilder) => {
30
+ if (granuleColumns.length > 0) {
31
+ queryBuilder.select(granuleColumns.map((column) => `${granulesTable}.${column}`));
32
+ queryBuilder.innerJoin(granulesTable, `${filesTable}.granule_cumulus_id`, `${granulesTable}.cumulus_id`);
33
+ }
34
+ })
35
+ .where(searchParams)
36
+ .orderBy(sortColumns);
37
+ if (limit) {
38
+ query.limit(limit);
39
+ }
40
+ if (collectionIds.length > 0) {
41
+ query.innerJoin(collectionsTable, `${granulesTable}.collection_cumulus_id`, `${collectionsTable}.cumulus_id`);
42
+ const nameVersionPairs = collectionIds.map(Collections_1.deconstructCollectionId);
43
+ const firstPair = nameVersionPairs.pop();
44
+ query.andWhere(function () {
45
+ const innerQuery = this;
46
+ innerQuery.where(firstPair);
47
+ nameVersionPairs.forEach((pair) => innerQuery.orWhere(pair));
48
+ });
49
+ }
50
+ if (granuleIds.length > 0) {
51
+ query.whereIn('granule_id', granuleIds);
52
+ }
53
+ if (providers.length > 0) {
54
+ query
55
+ .innerJoin(providersTable, `${granulesTable}.provider_cumulus_id`, `${providersTable}.cumulus_id`)
56
+ .whereIn(`${providersTable}.name`, providers);
57
+ }
58
+ return query;
59
+ };
60
+ exports.getFilesAndGranuleInfoQuery = getFilesAndGranuleInfoQuery;
61
+ //# sourceMappingURL=file.js.map
@@ -1,8 +1,10 @@
1
1
  import { Knex } from 'knex';
2
- import { PostgresGranule } from '../types/granule';
3
2
  import { CollectionPgModel } from '../models/collection';
4
3
  import { GranulePgModel } from '../models/granule';
5
4
  import { GranulesExecutionsPgModel } from '../models/granules-executions';
5
+ import { PostgresGranule, PostgresGranuleRecord } from '../types/granule';
6
+ import { UpdatedAtRange } from '../types/record';
7
+ export declare const getGranuleCollectionId: (knexOrTransaction: Knex | Knex.Transaction, granule: PostgresGranule) => Promise<string>;
6
8
  /**
7
9
  * Upsert a granule and a record in the granules/executions join table.
8
10
  *
@@ -12,9 +14,9 @@ import { GranulesExecutionsPgModel } from '../models/granules-executions';
12
14
  * @param {Object} [granulePgModel] - Granule PG model class instance
13
15
  * @param {Object} [granulesExecutionsPgModel]
14
16
  * Granules/executions PG model class instance
15
- * @returns {Promise<number[]>}
17
+ * @returns {Promise<PostgresGranuleRecord[]>}
16
18
  */
17
- export declare const upsertGranuleWithExecutionJoinRecord: (knexTransaction: Knex.Transaction, granule: PostgresGranule, executionCumulusId?: number | undefined, granulePgModel?: GranulePgModel, granulesExecutionsPgModel?: GranulesExecutionsPgModel) => Promise<number[]>;
19
+ export declare const upsertGranuleWithExecutionJoinRecord: (knexTransaction: Knex.Transaction, granule: PostgresGranule, executionCumulusId?: number | undefined, granulePgModel?: GranulePgModel, granulesExecutionsPgModel?: GranulesExecutionsPgModel) => Promise<PostgresGranuleRecord[]>;
18
20
  /**
19
21
  * Get cumulus IDs for list of granules
20
22
  *
@@ -29,6 +31,16 @@ export declare const getApiGranuleCumulusIds: (knexOrTransaction: Knex | Knex.Tr
29
31
  collectionId: string;
30
32
  granuleId: string;
31
33
  }>, collectionPgModel?: CollectionPgModel, granulePgModel?: GranulePgModel) => Promise<number[]>;
34
+ /**
35
+ * Get one Granule for a granule_id. If more than one or none are found, throw an error
36
+ *
37
+ * @param {Knex | Knex.Transaction} knexOrTransaction -
38
+ * DB client or transaction
39
+ * @param {string} granuleId - a Granule ID
40
+ * @param {GranulePgModel} granulePgModel - Granule PG model class instance
41
+ * @returns {Promise<PostgresGranuleRecord>}
42
+ */
43
+ export declare const getUniqueGranuleByGranuleId: (knexOrTransaction: Knex | Knex.Transaction, granuleId: string, granulePgModel?: GranulePgModel) => Promise<PostgresGranuleRecord>;
32
44
  /**
33
45
  * Get cumulus IDs for all executions associated to a set of granules
34
46
  *
@@ -45,4 +57,24 @@ export declare const getApiGranuleExecutionCumulusIds: (knexOrTransaction: Knex
45
57
  collectionId: string;
46
58
  granuleId: string;
47
59
  }>, collectionPgModel?: CollectionPgModel, granulePgModel?: GranulePgModel, granulesExecutionsPgModel?: GranulesExecutionsPgModel) => Promise<Array<number>>;
60
+ /**
61
+ * Helper to build a query to search granules by various API granule record properties.
62
+ *
63
+ * @param {Knex} knex - DB client
64
+ * @param {Object} searchParams
65
+ * @param {string | Array<string>} [searchParams.collectionIds] - Collection ID
66
+ * @param {string | Array<string>} [searchParams.granuleIds] - array of granule IDs
67
+ * @param {string} [searchParams.providerName] - Provider name
68
+ * @param {UpdatedAtRange} [searchParams.updatedAtRange] - Date range for updated_at column
69
+ * @param {string} [searchParams.status] - Granule status to search by
70
+ * @param {string | Array<string>} [sortByFields] - Field(s) to sort by
71
+ * @returns {Knex.QueryBuilder}
72
+ */
73
+ export declare const getGranulesByApiPropertiesQuery: (knex: Knex, { collectionIds, granuleIds, providerNames, updatedAtRange, status, }: {
74
+ collectionIds?: string | string[] | undefined;
75
+ granuleIds?: string | string[] | undefined;
76
+ providerNames?: string[] | undefined;
77
+ updatedAtRange?: UpdatedAtRange | undefined;
78
+ status?: string | undefined;
79
+ }, sortByFields?: string | string[] | undefined) => Knex.QueryBuilder;
48
80
  //# sourceMappingURL=granule.d.ts.map