@cumulus/db 10.1.1-alpha.0 → 10.1.3
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/LICENSE +60 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +4 -2
- package/dist/connection.d.ts +1 -0
- package/dist/connection.js +29 -8
- package/dist/index.d.ts +8 -13
- package/dist/index.js +17 -29
- package/dist/lib/execution.d.ts +1 -22
- package/dist/lib/execution.js +1 -28
- package/dist/lib/granule.d.ts +3 -35
- package/dist/lib/granule.js +8 -104
- package/dist/migrations/{20210914051414_add_type_to_files.d.ts → 20220126172008_files_granule_id_index.d.ts} +1 -1
- package/dist/migrations/{20210914051414_add_type_to_files.js → 20220126172008_files_granule_id_index.js} +3 -5
- package/dist/models/base.d.ts +9 -47
- package/dist/models/base.js +5 -71
- package/dist/models/collection.d.ts +3 -4
- package/dist/models/collection.js +1 -4
- package/dist/models/execution.d.ts +0 -1
- package/dist/models/execution.js +2 -5
- package/dist/models/file.d.ts +2 -2
- package/dist/models/file.js +1 -2
- package/dist/models/granule.d.ts +0 -2
- package/dist/models/granule.js +2 -8
- package/dist/models/pdr.js +2 -2
- package/dist/test-utils.js +0 -3
- package/dist/translate/async_operations.d.ts +0 -13
- package/dist/translate/async_operations.js +2 -56
- package/dist/translate/collections.d.ts +2 -13
- package/dist/translate/collections.js +2 -31
- package/dist/translate/executions.js +2 -2
- package/dist/translate/file.js +1 -3
- package/dist/translate/granules.d.ts +4 -15
- package/dist/translate/granules.js +14 -38
- package/dist/translate/pdrs.d.ts +19 -0
- package/dist/translate/pdrs.js +44 -0
- package/dist/translate/providers.d.ts +1 -2
- package/dist/translate/providers.js +1 -24
- package/dist/translate/rules.d.ts +11 -2
- package/dist/translate/rules.js +30 -52
- package/dist/types/collection.d.ts +4 -6
- package/dist/types/file.d.ts +1 -3
- package/dist/types/granule.d.ts +1 -2
- package/dist/types/pdr.d.ts +1 -2
- package/dist/types/provider.d.ts +1 -1
- package/dist/types/provider.js +0 -6
- package/dist/types/rule.d.ts +2 -3
- package/package.json +10 -9
- package/dist/lib/QuerySearchClient.d.ts +0 -36
- package/dist/lib/QuerySearchClient.js +0 -51
- package/dist/lib/collection.d.ts +0 -10
- package/dist/lib/collection.js +0 -21
- package/dist/lib/errors.d.ts +0 -6
- package/dist/lib/errors.js +0 -8
- package/dist/lib/file.d.ts +0 -33
- package/dist/lib/file.js +0 -61
- package/dist/translate/pdr.d.ts +0 -29
- package/dist/translate/pdr.js +0 -82
- package/dist/types/base.d.ts +0 -5
- package/dist/types/base.js +0 -3
- package/dist/types/query.d.ts +0 -10
- package/dist/types/query.js +0 -3
- package/dist/types/record.d.ts +0 -5
- package/dist/types/record.js +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Copyright © 2020 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
4
|
+
You may obtain a copy of the License at
|
|
5
|
+
|
|
6
|
+
http://www.apache.org/licenses/LICE NSE-2.0
|
|
7
|
+
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
|
|
9
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
14
|
+
|
|
15
|
+
1. Definitions.
|
|
16
|
+
|
|
17
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
18
|
+
|
|
19
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
20
|
+
|
|
21
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
26
|
+
|
|
27
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
28
|
+
|
|
29
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
30
|
+
|
|
31
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
32
|
+
|
|
33
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
34
|
+
|
|
35
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
36
|
+
|
|
37
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
38
|
+
|
|
39
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
40
|
+
|
|
41
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
42
|
+
|
|
43
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
44
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
45
|
+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
46
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
47
|
+
|
|
48
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
49
|
+
|
|
50
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
51
|
+
|
|
52
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
53
|
+
|
|
54
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
55
|
+
|
|
56
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
57
|
+
|
|
58
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
59
|
+
|
|
60
|
+
END OF TERMS AND CONDITIONS
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import AWS from 'aws-sdk';
|
|
3
4
|
import { Knex } from 'knex';
|
|
4
5
|
export declare const localStackConnectionEnv: {
|
|
@@ -8,6 +9,7 @@ export declare const localStackConnectionEnv: {
|
|
|
8
9
|
PG_DATABASE: string;
|
|
9
10
|
PG_PORT: string;
|
|
10
11
|
};
|
|
12
|
+
export declare const isKnexDebugEnabled: (env?: NodeJS.ProcessEnv) => boolean;
|
|
11
13
|
export declare const getSecretConnectionConfig: (SecretId: string, secretsManager: AWS.SecretsManager) => Promise<Knex.PgConnectionConfig>;
|
|
12
14
|
export declare const getConnectionConfigEnv: (env: NodeJS.ProcessEnv) => Knex.PgConnectionConfig;
|
|
13
15
|
/**
|
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.localStackConnectionEnv = void 0;
|
|
6
|
+
exports.getKnexConfig = exports.getConnectionConfig = exports.getConnectionConfigEnv = exports.getSecretConnectionConfig = exports.isKnexDebugEnabled = 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,6 +13,8 @@ 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;
|
|
16
18
|
const getSecretConnectionConfig = async (SecretId, secretsManager) => {
|
|
17
19
|
var _a;
|
|
18
20
|
const response = await secretsManager.getSecretValue({ SecretId }).promise();
|
|
@@ -110,7 +112,7 @@ const getKnexConfig = async ({ env = process.env, secretsManager = new aws_sdk_1
|
|
|
110
112
|
const knexConfig = {
|
|
111
113
|
client: 'pg',
|
|
112
114
|
connection: await (0, exports.getConnectionConfig)({ env, secretsManager }),
|
|
113
|
-
debug: env
|
|
115
|
+
debug: (0, exports.isKnexDebugEnabled)(env),
|
|
114
116
|
asyncStackTraces: env.KNEX_ASYNC_STACK_TRACES === 'true',
|
|
115
117
|
pool: {
|
|
116
118
|
min: 0,
|
package/dist/connection.d.ts
CHANGED
package/dist/connection.js
CHANGED
|
@@ -44,16 +44,37 @@ 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
|
+
}
|
|
47
50
|
const knexConfig = await (0, config_1.getKnexConfig)({ env, secretsManager });
|
|
48
51
|
const knexClient = (0, knex_1.knex)(knexConfig);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
+
}
|
|
57
78
|
return knexClient;
|
|
58
79
|
};
|
|
59
80
|
exports.getKnexClient = getKnexClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
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';
|
|
4
3
|
export { getKnexClient } from './connection';
|
|
5
4
|
export { getKnexConfig, localStackConnectionEnv } from './config';
|
|
6
5
|
export { createRejectableTransaction } from './database';
|
|
7
6
|
export { TableNames } from './tables';
|
|
8
7
|
export declare const migrationDir: string;
|
|
9
8
|
export { validateProviderHost, nullifyUndefinedProviderValues, } from './provider';
|
|
10
|
-
export { BaseRecord, } from './types/base';
|
|
11
9
|
export { PostgresAsyncOperation, PostgresAsyncOperationRecord, } from './types/async_operation';
|
|
12
10
|
export { PostgresCollection, PostgresCollectionRecord, } from './types/collection';
|
|
13
11
|
export { PostgresExecution, PostgresExecutionRecord, } from './types/execution';
|
|
@@ -16,19 +14,16 @@ export { PostgresRule, PostgresRuleRecord, } from './types/rule';
|
|
|
16
14
|
export { PostgresGranule, PostgresGranuleRecord, } from './types/granule';
|
|
17
15
|
export { PostgresPdr, PostgresPdrRecord, } from './types/pdr';
|
|
18
16
|
export { PostgresFile, PostgresFileRecord, } from './types/file';
|
|
19
|
-
export { translateApiAsyncOperationToPostgresAsyncOperation
|
|
17
|
+
export { translateApiAsyncOperationToPostgresAsyncOperation } from './translate/async_operations';
|
|
20
18
|
export { translateApiFiletoPostgresFile, translatePostgresFileToApiFile, } from './translate/file';
|
|
21
|
-
export { translateApiCollectionToPostgresCollection
|
|
22
|
-
export { translateApiProviderToPostgresProvider,
|
|
23
|
-
export { translateApiRuleToPostgresRule,
|
|
19
|
+
export { translateApiCollectionToPostgresCollection } from './translate/collections';
|
|
20
|
+
export { translateApiProviderToPostgresProvider, } from './translate/providers';
|
|
21
|
+
export { translateApiRuleToPostgresRule, translateApiRuleToPostgresRuleRaw, } from './translate/rules';
|
|
24
22
|
export { translateApiExecutionToPostgresExecution, translatePostgresExecutionToApiExecution, } from './translate/executions';
|
|
25
|
-
export { translateApiGranuleToPostgresGranule, translatePostgresGranuleToApiGranule,
|
|
26
|
-
export { translateApiPdrToPostgresPdr
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export { getFilesAndGranuleInfoQuery, } from './lib/file';
|
|
30
|
-
export { getApiGranuleCumulusIds, getApiGranuleExecutionCumulusIds, getGranuleCollectionId, getUniqueGranuleByGranuleId, upsertGranuleWithExecutionJoinRecord, getGranulesByApiPropertiesQuery, } from './lib/granule';
|
|
31
|
-
export { QuerySearchClient, } from './lib/QuerySearchClient';
|
|
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';
|
|
32
27
|
export { AsyncOperationPgModel } from './models/async_operation';
|
|
33
28
|
export { BasePgModel } from './models/base';
|
|
34
29
|
export { CollectionPgModel } from './models/collection';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -19,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
23
|
-
exports.RulePgModel = exports.ProviderPgModel =
|
|
26
|
+
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.translateApiRuleToPostgresRuleRaw = 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;
|
|
27
|
+
exports.RulePgModel = exports.ProviderPgModel = void 0;
|
|
24
28
|
const path = __importStar(require("path"));
|
|
25
29
|
var knex_1 = require("knex");
|
|
26
30
|
Object.defineProperty(exports, "Knex", { enumerable: true, get: function () { return knex_1.Knex; } });
|
|
@@ -37,8 +41,6 @@ Object.defineProperty(exports, "fakePdrRecordFactory", { enumerable: true, get:
|
|
|
37
41
|
Object.defineProperty(exports, "fakeProviderRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeProviderRecordFactory; } });
|
|
38
42
|
Object.defineProperty(exports, "fakeRuleRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeRuleRecordFactory; } });
|
|
39
43
|
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; } });
|
|
42
44
|
var connection_1 = require("./connection");
|
|
43
45
|
Object.defineProperty(exports, "getKnexClient", { enumerable: true, get: function () { return connection_1.getKnexClient; } });
|
|
44
46
|
var config_1 = require("./config");
|
|
@@ -54,65 +56,51 @@ Object.defineProperty(exports, "validateProviderHost", { enumerable: true, get:
|
|
|
54
56
|
Object.defineProperty(exports, "nullifyUndefinedProviderValues", { enumerable: true, get: function () { return provider_1.nullifyUndefinedProviderValues; } });
|
|
55
57
|
var async_operations_1 = require("./translate/async_operations");
|
|
56
58
|
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; } });
|
|
58
59
|
var file_1 = require("./translate/file");
|
|
59
60
|
Object.defineProperty(exports, "translateApiFiletoPostgresFile", { enumerable: true, get: function () { return file_1.translateApiFiletoPostgresFile; } });
|
|
60
61
|
Object.defineProperty(exports, "translatePostgresFileToApiFile", { enumerable: true, get: function () { return file_1.translatePostgresFileToApiFile; } });
|
|
61
62
|
var collections_1 = require("./translate/collections");
|
|
62
63
|
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; } });
|
|
64
64
|
var providers_1 = require("./translate/providers");
|
|
65
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; } });
|
|
67
66
|
var rules_1 = require("./translate/rules");
|
|
68
67
|
Object.defineProperty(exports, "translateApiRuleToPostgresRule", { enumerable: true, get: function () { return rules_1.translateApiRuleToPostgresRule; } });
|
|
69
|
-
Object.defineProperty(exports, "
|
|
68
|
+
Object.defineProperty(exports, "translateApiRuleToPostgresRuleRaw", { enumerable: true, get: function () { return rules_1.translateApiRuleToPostgresRuleRaw; } });
|
|
70
69
|
var executions_1 = require("./translate/executions");
|
|
71
70
|
Object.defineProperty(exports, "translateApiExecutionToPostgresExecution", { enumerable: true, get: function () { return executions_1.translateApiExecutionToPostgresExecution; } });
|
|
72
71
|
Object.defineProperty(exports, "translatePostgresExecutionToApiExecution", { enumerable: true, get: function () { return executions_1.translatePostgresExecutionToApiExecution; } });
|
|
73
72
|
var granules_1 = require("./translate/granules");
|
|
74
73
|
Object.defineProperty(exports, "translateApiGranuleToPostgresGranule", { enumerable: true, get: function () { return granules_1.translateApiGranuleToPostgresGranule; } });
|
|
75
74
|
Object.defineProperty(exports, "translatePostgresGranuleToApiGranule", { enumerable: true, get: function () { return granules_1.translatePostgresGranuleToApiGranule; } });
|
|
76
|
-
|
|
77
|
-
|
|
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; } });
|
|
75
|
+
var pdrs_1 = require("./translate/pdrs");
|
|
76
|
+
Object.defineProperty(exports, "translateApiPdrToPostgresPdr", { enumerable: true, get: function () { return pdrs_1.translateApiPdrToPostgresPdr; } });
|
|
82
77
|
var execution_1 = require("./lib/execution");
|
|
83
78
|
Object.defineProperty(exports, "executionArnsFromGranuleIdsAndWorkflowNames", { enumerable: true, get: function () { return execution_1.executionArnsFromGranuleIdsAndWorkflowNames; } });
|
|
84
79
|
Object.defineProperty(exports, "newestExecutionArnFromGranuleIdWorkflowName", { enumerable: true, get: function () { return execution_1.newestExecutionArnFromGranuleIdWorkflowName; } });
|
|
85
80
|
Object.defineProperty(exports, "getWorkflowNameIntersectFromGranuleIds", { enumerable: true, get: function () { return execution_1.getWorkflowNameIntersectFromGranuleIds; } });
|
|
86
81
|
Object.defineProperty(exports, "getApiExecutionCumulusIds", { enumerable: true, get: function () { return execution_1.getApiExecutionCumulusIds; } });
|
|
87
82
|
Object.defineProperty(exports, "getApiGranuleExecutionCumulusIdsByExecution", { enumerable: true, get: function () { return execution_1.getApiGranuleExecutionCumulusIdsByExecution; } });
|
|
88
|
-
Object.defineProperty(exports, "
|
|
89
|
-
var file_2 = require("./lib/file");
|
|
90
|
-
Object.defineProperty(exports, "getFilesAndGranuleInfoQuery", { enumerable: true, get: function () { return file_2.getFilesAndGranuleInfoQuery; } });
|
|
83
|
+
Object.defineProperty(exports, "getExecutionArnsByGranuleCumulusId", { enumerable: true, get: function () { return execution_1.getExecutionArnsByGranuleCumulusId; } });
|
|
91
84
|
var granule_1 = require("./lib/granule");
|
|
92
85
|
Object.defineProperty(exports, "getApiGranuleCumulusIds", { enumerable: true, get: function () { return granule_1.getApiGranuleCumulusIds; } });
|
|
93
86
|
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; } });
|
|
96
87
|
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; } });
|
|
100
88
|
var async_operation_1 = require("./models/async_operation");
|
|
101
89
|
Object.defineProperty(exports, "AsyncOperationPgModel", { enumerable: true, get: function () { return async_operation_1.AsyncOperationPgModel; } });
|
|
102
90
|
var base_1 = require("./models/base");
|
|
103
91
|
Object.defineProperty(exports, "BasePgModel", { enumerable: true, get: function () { return base_1.BasePgModel; } });
|
|
104
|
-
var
|
|
105
|
-
Object.defineProperty(exports, "CollectionPgModel", { enumerable: true, get: function () { return
|
|
92
|
+
var collection_1 = require("./models/collection");
|
|
93
|
+
Object.defineProperty(exports, "CollectionPgModel", { enumerable: true, get: function () { return collection_1.CollectionPgModel; } });
|
|
106
94
|
var execution_2 = require("./models/execution");
|
|
107
95
|
Object.defineProperty(exports, "ExecutionPgModel", { enumerable: true, get: function () { return execution_2.ExecutionPgModel; } });
|
|
108
|
-
var
|
|
109
|
-
Object.defineProperty(exports, "FilePgModel", { enumerable: true, get: function () { return
|
|
96
|
+
var file_2 = require("./models/file");
|
|
97
|
+
Object.defineProperty(exports, "FilePgModel", { enumerable: true, get: function () { return file_2.FilePgModel; } });
|
|
110
98
|
var granule_2 = require("./models/granule");
|
|
111
99
|
Object.defineProperty(exports, "GranulePgModel", { enumerable: true, get: function () { return granule_2.GranulePgModel; } });
|
|
112
100
|
var granules_executions_1 = require("./models/granules-executions");
|
|
113
101
|
Object.defineProperty(exports, "GranulesExecutionsPgModel", { enumerable: true, get: function () { return granules_executions_1.GranulesExecutionsPgModel; } });
|
|
114
|
-
var
|
|
115
|
-
Object.defineProperty(exports, "PdrPgModel", { enumerable: true, get: function () { return
|
|
102
|
+
var pdr_1 = require("./models/pdr");
|
|
103
|
+
Object.defineProperty(exports, "PdrPgModel", { enumerable: true, get: function () { return pdr_1.PdrPgModel; } });
|
|
116
104
|
var provider_2 = require("./models/provider");
|
|
117
105
|
Object.defineProperty(exports, "ProviderPgModel", { enumerable: true, get: function () { return provider_2.ProviderPgModel; } });
|
|
118
106
|
var rule_1 = require("./models/rule");
|
package/dist/lib/execution.d.ts
CHANGED
|
@@ -1,29 +1,9 @@
|
|
|
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';
|
|
5
4
|
export interface ArnRecord {
|
|
6
5
|
arn: string;
|
|
7
6
|
}
|
|
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>[]>;
|
|
27
7
|
/**
|
|
28
8
|
* Returns a list of executionArns sorted by most recent first, for an input
|
|
29
9
|
* Granule Cumulus ID.
|
|
@@ -34,7 +14,7 @@ export declare const getExecutionInfoByGranuleCumulusId: ({ knexOrTransaction, g
|
|
|
34
14
|
* @param {number} limit - limit to number of executions to query
|
|
35
15
|
* @returns {Promise<ArnRecord[]>} - Array of arn objects with the most recent first.
|
|
36
16
|
*/
|
|
37
|
-
export declare const getExecutionArnsByGranuleCumulusId: (knexOrTransaction: Knex | Knex.Transaction, granuleCumulusId: Number, limit?: number
|
|
17
|
+
export declare const getExecutionArnsByGranuleCumulusId: (knexOrTransaction: Knex | Knex.Transaction, granuleCumulusId: Number, limit?: number) => Promise<ArnRecord[]>;
|
|
38
18
|
/**
|
|
39
19
|
* Returns a list of executionArns sorted by most recent first, for an input
|
|
40
20
|
* list of granuleIds and workflowNames.
|
|
@@ -51,7 +31,6 @@ export declare const executionArnsFromGranuleIdsAndWorkflowNames: (knex: Knex, g
|
|
|
51
31
|
*
|
|
52
32
|
* @param {string} granuleId - granuleIds
|
|
53
33
|
* @param {string} workflowName - workflow name
|
|
54
|
-
* @param {Knex} testKnex - knex for testing
|
|
55
34
|
* @returns {Promise<string>} - most recent exectutionArn for input parameters.
|
|
56
35
|
* @throws {RecordNotFound}
|
|
57
36
|
*/
|
package/dist/lib/execution.js
CHANGED
|
@@ -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 =
|
|
3
|
+
exports.getApiGranuleExecutionCumulusIdsByExecution = exports.getApiExecutionCumulusIds = exports.getWorkflowNameIntersectFromGranuleIds = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.getExecutionArnsByGranuleCumulusId = 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,32 +8,6 @@ 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;
|
|
37
11
|
/**
|
|
38
12
|
* Returns a list of executionArns sorted by most recent first, for an input
|
|
39
13
|
* Granule Cumulus ID.
|
|
@@ -81,7 +55,6 @@ exports.executionArnsFromGranuleIdsAndWorkflowNames = executionArnsFromGranuleId
|
|
|
81
55
|
*
|
|
82
56
|
* @param {string} granuleId - granuleIds
|
|
83
57
|
* @param {string} workflowName - workflow name
|
|
84
|
-
* @param {Knex} testKnex - knex for testing
|
|
85
58
|
* @returns {Promise<string>} - most recent exectutionArn for input parameters.
|
|
86
59
|
* @throws {RecordNotFound}
|
|
87
60
|
*/
|
package/dist/lib/granule.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Knex } from 'knex';
|
|
2
|
+
import { PostgresGranule } from '../types/granule';
|
|
2
3
|
import { CollectionPgModel } from '../models/collection';
|
|
3
4
|
import { GranulePgModel } from '../models/granule';
|
|
4
5
|
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>;
|
|
8
6
|
/**
|
|
9
7
|
* Upsert a granule and a record in the granules/executions join table.
|
|
10
8
|
*
|
|
@@ -14,9 +12,9 @@ export declare const getGranuleCollectionId: (knexOrTransaction: Knex | Knex.Tra
|
|
|
14
12
|
* @param {Object} [granulePgModel] - Granule PG model class instance
|
|
15
13
|
* @param {Object} [granulesExecutionsPgModel]
|
|
16
14
|
* Granules/executions PG model class instance
|
|
17
|
-
* @returns {Promise<
|
|
15
|
+
* @returns {Promise<number[]>}
|
|
18
16
|
*/
|
|
19
|
-
export declare const upsertGranuleWithExecutionJoinRecord: (knexTransaction: Knex.Transaction, granule: PostgresGranule, executionCumulusId?: number
|
|
17
|
+
export declare const upsertGranuleWithExecutionJoinRecord: (knexTransaction: Knex.Transaction, granule: PostgresGranule, executionCumulusId?: number, granulePgModel?: GranulePgModel, granulesExecutionsPgModel?: GranulesExecutionsPgModel) => Promise<number[]>;
|
|
20
18
|
/**
|
|
21
19
|
* Get cumulus IDs for list of granules
|
|
22
20
|
*
|
|
@@ -31,16 +29,6 @@ export declare const getApiGranuleCumulusIds: (knexOrTransaction: Knex | Knex.Tr
|
|
|
31
29
|
collectionId: string;
|
|
32
30
|
granuleId: string;
|
|
33
31
|
}>, 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>;
|
|
44
32
|
/**
|
|
45
33
|
* Get cumulus IDs for all executions associated to a set of granules
|
|
46
34
|
*
|
|
@@ -57,24 +45,4 @@ export declare const getApiGranuleExecutionCumulusIds: (knexOrTransaction: Knex
|
|
|
57
45
|
collectionId: string;
|
|
58
46
|
granuleId: string;
|
|
59
47
|
}>, 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;
|
|
80
48
|
//# sourceMappingURL=granule.d.ts.map
|