@cumulus/db 19.1.0 → 19.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +11 -4
- package/dist/index.js +21 -6
- package/dist/lib/QuerySearchClient.d.ts +0 -2
- package/dist/lib/QuerySearchClient.js +0 -2
- package/dist/lib/collection.d.ts +8 -0
- package/dist/lib/collection.js +36 -1
- package/dist/lib/execution.d.ts +14 -12
- package/dist/lib/execution.js +23 -27
- package/dist/lib/granule.d.ts +13 -17
- package/dist/lib/granule.js +22 -24
- package/dist/migrations/20240814185217_create_reconciliation_reports_table.d.ts +4 -0
- package/dist/migrations/20240814185217_create_reconciliation_reports_table.js +40 -0
- package/dist/models/file.d.ts +4 -0
- package/dist/models/file.js +8 -0
- package/dist/models/reconciliation_report.d.ts +10 -0
- package/dist/models/reconciliation_report.js +25 -0
- package/dist/search/AsyncOperationSearch.d.ts +32 -0
- package/dist/search/AsyncOperationSearch.js +55 -0
- package/dist/search/BaseSearch.d.ts +8 -2
- package/dist/search/BaseSearch.js +40 -13
- package/dist/search/CollectionSearch.d.ts +14 -21
- package/dist/search/CollectionSearch.js +50 -52
- package/dist/search/ExecutionSearch.d.ts +4 -4
- package/dist/search/ExecutionSearch.js +7 -8
- package/dist/search/GranuleSearch.d.ts +14 -6
- package/dist/search/GranuleSearch.js +56 -5
- package/dist/search/PdrSearch.d.ts +50 -0
- package/dist/search/PdrSearch.js +100 -0
- package/dist/search/ProviderSearch.d.ts +32 -0
- package/dist/search/ProviderSearch.js +57 -0
- package/dist/search/ReconciliationReportSearch.d.ts +42 -0
- package/dist/search/ReconciliationReportSearch.js +72 -0
- package/dist/search/RuleSearch.d.ts +49 -0
- package/dist/search/RuleSearch.js +95 -0
- package/dist/search/StatsSearch.d.ts +0 -1
- package/dist/search/StatsSearch.js +3 -3
- package/dist/search/field-mapping.js +105 -1
- package/dist/search/queries.js +4 -2
- package/dist/tables.d.ts +1 -0
- package/dist/tables.js +1 -0
- package/dist/test-utils.d.ts +3 -17
- package/dist/test-utils.js +10 -1
- package/dist/translate/async_operations.js +2 -1
- package/dist/translate/pdr.d.ts +19 -0
- package/dist/translate/pdr.js +36 -19
- package/dist/translate/reconciliation_reports.d.ts +17 -0
- package/dist/translate/reconciliation_reports.js +36 -0
- package/dist/translate/rules.d.ts +3 -0
- package/dist/translate/rules.js +16 -12
- package/dist/types/reconciliation_report.d.ts +29 -0
- package/dist/types/reconciliation_report.js +3 -0
- package/dist/types/search.d.ts +3 -2
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Knex } from 'knex';
|
|
2
|
-
export { createTestDatabase, deleteTestDatabase, destroyLocalTestDb, fakeAsyncOperationRecordFactory, fakeCollectionRecordFactory, fakeExecutionRecordFactory, fakeFileRecordFactory, fakeGranuleRecordFactory, fakePdrRecordFactory, fakeProviderRecordFactory, fakeRuleRecordFactory, generateLocalTestDb, } from './test-utils';
|
|
2
|
+
export { createTestDatabase, deleteTestDatabase, destroyLocalTestDb, fakeAsyncOperationRecordFactory, fakeCollectionRecordFactory, fakeExecutionRecordFactory, fakeFileRecordFactory, fakeGranuleRecordFactory, fakePdrRecordFactory, fakeProviderRecordFactory, fakeReconciliationReportRecordFactory, fakeRuleRecordFactory, generateLocalTestDb, } from './test-utils';
|
|
3
3
|
export { isCollisionError } from './lib/errors';
|
|
4
4
|
export { getKnexClient } from './connection';
|
|
5
5
|
export { getKnexConfig, localStackConnectionEnv } from './config';
|
|
@@ -17,6 +17,7 @@ export { PostgresGranule, PostgresGranuleRecord, } from './types/granule';
|
|
|
17
17
|
export { PostgresPdr, PostgresPdrRecord, } from './types/pdr';
|
|
18
18
|
export { PostgresFile, PostgresFileRecord, } from './types/file';
|
|
19
19
|
export { PostgresGranuleExecution, } from './types/granule-execution';
|
|
20
|
+
export { PostgresReconciliationReport, PostgresReconciliationReportRecord, } from './types/reconciliation_report';
|
|
20
21
|
export { translateApiAsyncOperationToPostgresAsyncOperation, translatePostgresAsyncOperationToApiAsyncOperation, } from './translate/async_operations';
|
|
21
22
|
export { translateApiFiletoPostgresFile, translatePostgresFileToApiFile, } from './translate/file';
|
|
22
23
|
export { translateApiCollectionToPostgresCollection, translatePostgresCollectionToApiCollection, } from './translate/collections';
|
|
@@ -25,16 +26,21 @@ export { translatePostgresRuleToApiRule, translateApiRuleToPostgresRule, transla
|
|
|
25
26
|
export { translateApiExecutionToPostgresExecution, translateApiExecutionToPostgresExecutionWithoutNilsRemoved, translatePostgresExecutionToApiExecution, } from './translate/executions';
|
|
26
27
|
export { translateApiGranuleToPostgresGranule, translateApiGranuleToPostgresGranuleWithoutNilsRemoved, translatePostgresGranuleToApiGranule, translatePostgresGranuleResultToApiGranule, } from './translate/granules';
|
|
27
28
|
export { translateApiPdrToPostgresPdr, translatePostgresPdrToApiPdr, } from './translate/pdr';
|
|
28
|
-
export {
|
|
29
|
+
export { translateApiReconReportToPostgresReconReport, translatePostgresReconReportToApiReconReport, } from './translate/reconciliation_reports';
|
|
30
|
+
export { getCollectionsByGranuleIds, getUniqueCollectionsByGranuleFilter, } from './lib/collection';
|
|
29
31
|
export { batchDeleteExecutionFromDatabaseByCumulusCollectionId, executionArnsFromGranuleIdsAndWorkflowNames, getApiExecutionCumulusIds, getApiGranuleExecutionCumulusIdsByExecution, getExecutionInfoByGranuleCumulusId, getWorkflowNameIntersectFromGranuleIds, newestExecutionArnFromGranuleIdWorkflowName, } from './lib/execution';
|
|
30
32
|
export { getFilesAndGranuleInfoQuery, } from './lib/file';
|
|
31
33
|
export { getApiGranuleCumulusIds, getApiGranuleExecutionCumulusIds, getGranuleCollectionId, getUniqueGranuleByGranuleId, getGranuleByUniqueColumns, upsertGranuleWithExecutionJoinRecord, getGranulesByApiPropertiesQuery, getGranulesByGranuleId, getGranuleAndCollection, } from './lib/granule';
|
|
32
34
|
export { QuerySearchClient, } from './lib/QuerySearchClient';
|
|
33
|
-
export {
|
|
35
|
+
export { AsyncOperationSearch, } from './search/AsyncOperationSearch';
|
|
36
|
+
export { CollectionSearch, } from './search/CollectionSearch';
|
|
34
37
|
export { ExecutionSearch, } from './search/ExecutionSearch';
|
|
35
38
|
export { GranuleSearch, } from './search/GranuleSearch';
|
|
39
|
+
export { PdrSearch, } from './search/PdrSearch';
|
|
40
|
+
export { ProviderSearch, } from './search/ProviderSearch';
|
|
41
|
+
export { RuleSearch, } from './search/RuleSearch';
|
|
36
42
|
export { StatsSearch, } from './search/StatsSearch';
|
|
37
|
-
export {
|
|
43
|
+
export { ReconciliationReportSearch, } from './search/ReconciliationReportSearch';
|
|
38
44
|
export { AsyncOperationPgModel } from './models/async_operation';
|
|
39
45
|
export { BasePgModel } from './models/base';
|
|
40
46
|
export { CollectionPgModel } from './models/collection';
|
|
@@ -44,5 +50,6 @@ export { GranulePgModel } from './models/granule';
|
|
|
44
50
|
export { GranulesExecutionsPgModel } from './models/granules-executions';
|
|
45
51
|
export { PdrPgModel } from './models/pdr';
|
|
46
52
|
export { ProviderPgModel } from './models/provider';
|
|
53
|
+
export { ReconciliationReportPgModel } from './models/reconciliation_report';
|
|
47
54
|
export { RulePgModel } from './models/rule';
|
|
48
55
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.RulePgModel = exports.ProviderPgModel = exports.PdrPgModel = exports.GranulesExecutionsPgModel = exports.GranulePgModel = exports.FilePgModel = exports.ExecutionPgModel = exports.CollectionPgModel = exports.BasePgModel = exports.AsyncOperationPgModel = exports.
|
|
26
|
+
exports.getApiExecutionCumulusIds = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.batchDeleteExecutionFromDatabaseByCumulusCollectionId = exports.getUniqueCollectionsByGranuleFilter = exports.getCollectionsByGranuleIds = exports.translatePostgresReconReportToApiReconReport = exports.translateApiReconReportToPostgresReconReport = exports.translatePostgresPdrToApiPdr = exports.translateApiPdrToPostgresPdr = exports.translatePostgresGranuleResultToApiGranule = exports.translatePostgresGranuleToApiGranule = exports.translateApiGranuleToPostgresGranuleWithoutNilsRemoved = exports.translateApiGranuleToPostgresGranule = exports.translatePostgresExecutionToApiExecution = exports.translateApiExecutionToPostgresExecutionWithoutNilsRemoved = exports.translateApiExecutionToPostgresExecution = exports.translateApiRuleToPostgresRuleRaw = exports.translateApiRuleToPostgresRule = exports.translatePostgresRuleToApiRule = 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.fakeReconciliationReportRecordFactory = 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.ReconciliationReportPgModel = exports.ProviderPgModel = exports.PdrPgModel = exports.GranulesExecutionsPgModel = exports.GranulePgModel = exports.FilePgModel = exports.ExecutionPgModel = exports.CollectionPgModel = exports.BasePgModel = exports.AsyncOperationPgModel = exports.ReconciliationReportSearch = exports.StatsSearch = exports.RuleSearch = exports.ProviderSearch = exports.PdrSearch = exports.GranuleSearch = exports.ExecutionSearch = exports.CollectionSearch = exports.AsyncOperationSearch = exports.QuerySearchClient = exports.getGranuleAndCollection = exports.getGranulesByGranuleId = exports.getGranulesByApiPropertiesQuery = exports.upsertGranuleWithExecutionJoinRecord = exports.getGranuleByUniqueColumns = exports.getUniqueGranuleByGranuleId = exports.getGranuleCollectionId = exports.getApiGranuleExecutionCumulusIds = exports.getApiGranuleCumulusIds = exports.getFilesAndGranuleInfoQuery = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.getWorkflowNameIntersectFromGranuleIds = exports.getExecutionInfoByGranuleCumulusId = exports.getApiGranuleExecutionCumulusIdsByExecution = void 0;
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
29
|
var knex_1 = require("knex");
|
|
30
30
|
Object.defineProperty(exports, "Knex", { enumerable: true, get: function () { return knex_1.Knex; } });
|
|
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "fakeFileRecordFactory", { enumerable: true, get:
|
|
|
39
39
|
Object.defineProperty(exports, "fakeGranuleRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeGranuleRecordFactory; } });
|
|
40
40
|
Object.defineProperty(exports, "fakePdrRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakePdrRecordFactory; } });
|
|
41
41
|
Object.defineProperty(exports, "fakeProviderRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeProviderRecordFactory; } });
|
|
42
|
+
Object.defineProperty(exports, "fakeReconciliationReportRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeReconciliationReportRecordFactory; } });
|
|
42
43
|
Object.defineProperty(exports, "fakeRuleRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeRuleRecordFactory; } });
|
|
43
44
|
Object.defineProperty(exports, "generateLocalTestDb", { enumerable: true, get: function () { return test_utils_1.generateLocalTestDb; } });
|
|
44
45
|
var errors_1 = require("./lib/errors");
|
|
@@ -84,8 +85,12 @@ Object.defineProperty(exports, "translatePostgresGranuleResultToApiGranule", { e
|
|
|
84
85
|
var pdr_1 = require("./translate/pdr");
|
|
85
86
|
Object.defineProperty(exports, "translateApiPdrToPostgresPdr", { enumerable: true, get: function () { return pdr_1.translateApiPdrToPostgresPdr; } });
|
|
86
87
|
Object.defineProperty(exports, "translatePostgresPdrToApiPdr", { enumerable: true, get: function () { return pdr_1.translatePostgresPdrToApiPdr; } });
|
|
88
|
+
var reconciliation_reports_1 = require("./translate/reconciliation_reports");
|
|
89
|
+
Object.defineProperty(exports, "translateApiReconReportToPostgresReconReport", { enumerable: true, get: function () { return reconciliation_reports_1.translateApiReconReportToPostgresReconReport; } });
|
|
90
|
+
Object.defineProperty(exports, "translatePostgresReconReportToApiReconReport", { enumerable: true, get: function () { return reconciliation_reports_1.translatePostgresReconReportToApiReconReport; } });
|
|
87
91
|
var collection_1 = require("./lib/collection");
|
|
88
92
|
Object.defineProperty(exports, "getCollectionsByGranuleIds", { enumerable: true, get: function () { return collection_1.getCollectionsByGranuleIds; } });
|
|
93
|
+
Object.defineProperty(exports, "getUniqueCollectionsByGranuleFilter", { enumerable: true, get: function () { return collection_1.getUniqueCollectionsByGranuleFilter; } });
|
|
89
94
|
var execution_1 = require("./lib/execution");
|
|
90
95
|
Object.defineProperty(exports, "batchDeleteExecutionFromDatabaseByCumulusCollectionId", { enumerable: true, get: function () { return execution_1.batchDeleteExecutionFromDatabaseByCumulusCollectionId; } });
|
|
91
96
|
Object.defineProperty(exports, "executionArnsFromGranuleIdsAndWorkflowNames", { enumerable: true, get: function () { return execution_1.executionArnsFromGranuleIdsAndWorkflowNames; } });
|
|
@@ -108,16 +113,24 @@ Object.defineProperty(exports, "getGranulesByGranuleId", { enumerable: true, get
|
|
|
108
113
|
Object.defineProperty(exports, "getGranuleAndCollection", { enumerable: true, get: function () { return granule_1.getGranuleAndCollection; } });
|
|
109
114
|
var QuerySearchClient_1 = require("./lib/QuerySearchClient");
|
|
110
115
|
Object.defineProperty(exports, "QuerySearchClient", { enumerable: true, get: function () { return QuerySearchClient_1.QuerySearchClient; } });
|
|
111
|
-
var
|
|
112
|
-
Object.defineProperty(exports, "
|
|
116
|
+
var AsyncOperationSearch_1 = require("./search/AsyncOperationSearch");
|
|
117
|
+
Object.defineProperty(exports, "AsyncOperationSearch", { enumerable: true, get: function () { return AsyncOperationSearch_1.AsyncOperationSearch; } });
|
|
118
|
+
var CollectionSearch_1 = require("./search/CollectionSearch");
|
|
119
|
+
Object.defineProperty(exports, "CollectionSearch", { enumerable: true, get: function () { return CollectionSearch_1.CollectionSearch; } });
|
|
113
120
|
var ExecutionSearch_1 = require("./search/ExecutionSearch");
|
|
114
121
|
Object.defineProperty(exports, "ExecutionSearch", { enumerable: true, get: function () { return ExecutionSearch_1.ExecutionSearch; } });
|
|
115
122
|
var GranuleSearch_1 = require("./search/GranuleSearch");
|
|
116
123
|
Object.defineProperty(exports, "GranuleSearch", { enumerable: true, get: function () { return GranuleSearch_1.GranuleSearch; } });
|
|
124
|
+
var PdrSearch_1 = require("./search/PdrSearch");
|
|
125
|
+
Object.defineProperty(exports, "PdrSearch", { enumerable: true, get: function () { return PdrSearch_1.PdrSearch; } });
|
|
126
|
+
var ProviderSearch_1 = require("./search/ProviderSearch");
|
|
127
|
+
Object.defineProperty(exports, "ProviderSearch", { enumerable: true, get: function () { return ProviderSearch_1.ProviderSearch; } });
|
|
128
|
+
var RuleSearch_1 = require("./search/RuleSearch");
|
|
129
|
+
Object.defineProperty(exports, "RuleSearch", { enumerable: true, get: function () { return RuleSearch_1.RuleSearch; } });
|
|
117
130
|
var StatsSearch_1 = require("./search/StatsSearch");
|
|
118
131
|
Object.defineProperty(exports, "StatsSearch", { enumerable: true, get: function () { return StatsSearch_1.StatsSearch; } });
|
|
119
|
-
var
|
|
120
|
-
Object.defineProperty(exports, "
|
|
132
|
+
var ReconciliationReportSearch_1 = require("./search/ReconciliationReportSearch");
|
|
133
|
+
Object.defineProperty(exports, "ReconciliationReportSearch", { enumerable: true, get: function () { return ReconciliationReportSearch_1.ReconciliationReportSearch; } });
|
|
121
134
|
var async_operation_1 = require("./models/async_operation");
|
|
122
135
|
Object.defineProperty(exports, "AsyncOperationPgModel", { enumerable: true, get: function () { return async_operation_1.AsyncOperationPgModel; } });
|
|
123
136
|
var base_1 = require("./models/base");
|
|
@@ -136,6 +149,8 @@ var pdr_2 = require("./models/pdr");
|
|
|
136
149
|
Object.defineProperty(exports, "PdrPgModel", { enumerable: true, get: function () { return pdr_2.PdrPgModel; } });
|
|
137
150
|
var provider_2 = require("./models/provider");
|
|
138
151
|
Object.defineProperty(exports, "ProviderPgModel", { enumerable: true, get: function () { return provider_2.ProviderPgModel; } });
|
|
152
|
+
var reconciliation_report_1 = require("./models/reconciliation_report");
|
|
153
|
+
Object.defineProperty(exports, "ReconciliationReportPgModel", { enumerable: true, get: function () { return reconciliation_report_1.ReconciliationReportPgModel; } });
|
|
139
154
|
var rule_1 = require("./models/rule");
|
|
140
155
|
Object.defineProperty(exports, "RulePgModel", { enumerable: true, get: function () { return rule_1.RulePgModel; } });
|
|
141
156
|
//# sourceMappingURL=index.js.map
|
|
@@ -22,13 +22,11 @@ declare class QuerySearchClient<RecordType extends BaseRecord> {
|
|
|
22
22
|
*
|
|
23
23
|
* This does not remove the object from the queue.
|
|
24
24
|
*
|
|
25
|
-
* @returns {Promise<RecordType>} - record from PostgreSQL table
|
|
26
25
|
*/
|
|
27
26
|
peek(): Promise<RecordType>;
|
|
28
27
|
/**
|
|
29
28
|
* Remove and return the next item in the results
|
|
30
29
|
*
|
|
31
|
-
* @returns {Promise<RecordType>} - record from PostgreSQL table
|
|
32
30
|
*/
|
|
33
31
|
shift(): Promise<RecordType | undefined>;
|
|
34
32
|
}
|
|
@@ -30,7 +30,6 @@ class QuerySearchClient {
|
|
|
30
30
|
*
|
|
31
31
|
* This does not remove the object from the queue.
|
|
32
32
|
*
|
|
33
|
-
* @returns {Promise<RecordType>} - record from PostgreSQL table
|
|
34
33
|
*/
|
|
35
34
|
async peek() {
|
|
36
35
|
if (this.records.length === 0)
|
|
@@ -40,7 +39,6 @@ class QuerySearchClient {
|
|
|
40
39
|
/**
|
|
41
40
|
* Remove and return the next item in the results
|
|
42
41
|
*
|
|
43
|
-
* @returns {Promise<RecordType>} - record from PostgreSQL table
|
|
44
42
|
*/
|
|
45
43
|
async shift() {
|
|
46
44
|
if (this.records.length === 0)
|
package/dist/lib/collection.d.ts
CHANGED
|
@@ -7,4 +7,12 @@ import { Knex } from 'knex';
|
|
|
7
7
|
* @returns {Promise<Array<Object>>} - An array of collection results
|
|
8
8
|
*/
|
|
9
9
|
export declare const getCollectionsByGranuleIds: (knex: Knex, granuleIds: string[]) => Promise<never>;
|
|
10
|
+
export declare const getUniqueCollectionsByGranuleFilter: (params: {
|
|
11
|
+
startTimestamp?: string;
|
|
12
|
+
endTimestamp?: string;
|
|
13
|
+
collectionIds?: string[];
|
|
14
|
+
granuleIds?: string[];
|
|
15
|
+
providers?: string[];
|
|
16
|
+
knex: Knex;
|
|
17
|
+
}) => Promise<any[]>;
|
|
10
18
|
//# sourceMappingURL=collection.d.ts.map
|
package/dist/lib/collection.js
CHANGED
|
@@ -3,8 +3,9 @@ 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.getCollectionsByGranuleIds = void 0;
|
|
6
|
+
exports.getUniqueCollectionsByGranuleFilter = exports.getCollectionsByGranuleIds = void 0;
|
|
7
7
|
const logger_1 = __importDefault(require("@cumulus/logger"));
|
|
8
|
+
const Collections_1 = require("@cumulus/message/Collections");
|
|
8
9
|
const retry_1 = require("./retry");
|
|
9
10
|
const tables_1 = require("../tables");
|
|
10
11
|
/**
|
|
@@ -25,4 +26,38 @@ const getCollectionsByGranuleIds = async (knex, granuleIds) => {
|
|
|
25
26
|
return await (0, retry_1.RetryOnDbConnectionTerminateError)(query, {}, log);
|
|
26
27
|
};
|
|
27
28
|
exports.getCollectionsByGranuleIds = getCollectionsByGranuleIds;
|
|
29
|
+
// TODO - This function is going to be super-non-performant
|
|
30
|
+
// We need to identify the specific need here and see if we can optimize
|
|
31
|
+
const getUniqueCollectionsByGranuleFilter = async (params) => {
|
|
32
|
+
const { knex } = params;
|
|
33
|
+
const collectionsTable = tables_1.TableNames.collections;
|
|
34
|
+
const granulesTable = tables_1.TableNames.granules;
|
|
35
|
+
const providersTable = tables_1.TableNames.providers;
|
|
36
|
+
const query = knex(collectionsTable)
|
|
37
|
+
.distinct(`${collectionsTable}.*`)
|
|
38
|
+
.innerJoin(granulesTable, `${collectionsTable}.cumulus_id`, `${granulesTable}.collection_cumulus_id`);
|
|
39
|
+
if (params.startTimestamp) {
|
|
40
|
+
query.where(`${granulesTable}.updated_at`, '>=', params.startTimestamp);
|
|
41
|
+
}
|
|
42
|
+
if (params.endTimestamp) {
|
|
43
|
+
query.where(`${granulesTable}.updated_at`, '<=', params.endTimestamp);
|
|
44
|
+
}
|
|
45
|
+
// Filter by collectionIds
|
|
46
|
+
if (params.collectionIds && params.collectionIds.length > 0) {
|
|
47
|
+
const collectionNameVersionPairs = params.collectionIds.map((id) => (0, Collections_1.deconstructCollectionId)(id));
|
|
48
|
+
query.whereIn([`${collectionsTable}.name`, `${collectionsTable}.version`], collectionNameVersionPairs.map(({ name, version }) => [name, version]));
|
|
49
|
+
}
|
|
50
|
+
// Filter by granuleIds
|
|
51
|
+
if (params.granuleIds && params.granuleIds.length > 0) {
|
|
52
|
+
query.whereIn(`${granulesTable}.granule_id`, params.granuleIds);
|
|
53
|
+
}
|
|
54
|
+
// Filter by provider names
|
|
55
|
+
if (params.providers && params.providers.length > 0) {
|
|
56
|
+
query.innerJoin(providersTable, `${granulesTable}.provider_cumulus_id`, `${providersTable}.cumulus_id`);
|
|
57
|
+
query.whereIn(`${providersTable}.name`, params.providers);
|
|
58
|
+
}
|
|
59
|
+
query.orderBy([`${collectionsTable}.name`, `${collectionsTable}.version`]);
|
|
60
|
+
return query;
|
|
61
|
+
};
|
|
62
|
+
exports.getUniqueCollectionsByGranuleFilter = getUniqueCollectionsByGranuleFilter;
|
|
28
63
|
//# sourceMappingURL=collection.js.map
|
package/dist/lib/execution.d.ts
CHANGED
|
@@ -6,7 +6,20 @@ export interface ArnRecord {
|
|
|
6
6
|
arn: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Returns execution
|
|
9
|
+
* Returns execution records sorted by most recent first for an input
|
|
10
|
+
* set of Granule Cumulus IDs.
|
|
11
|
+
* @returns Array of arn objects with the most recent first.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getExecutionInfoByGranuleCumulusIds: ({ knexOrTransaction, granuleCumulusIds, limit, }: {
|
|
14
|
+
knexOrTransaction: Knex | Knex.Transaction;
|
|
15
|
+
granuleCumulusIds: number[];
|
|
16
|
+
limit?: number | undefined;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
granule_cumulus_id: number;
|
|
19
|
+
url: string;
|
|
20
|
+
}[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns execution records sorted by most recent first for an input
|
|
10
23
|
* Granule Cumulus ID.
|
|
11
24
|
*
|
|
12
25
|
* @param {Object} params
|
|
@@ -24,17 +37,6 @@ export declare const getExecutionInfoByGranuleCumulusId: ({ knexOrTransaction, g
|
|
|
24
37
|
executionColumns: string[];
|
|
25
38
|
limit?: number | undefined;
|
|
26
39
|
}) => Promise<Partial<PostgresExecutionRecord>[]>;
|
|
27
|
-
/**
|
|
28
|
-
* Returns a list of executionArns sorted by most recent first, for an input
|
|
29
|
-
* Granule Cumulus ID.
|
|
30
|
-
*
|
|
31
|
-
* @param {Knex | Knex.Transaction} knexOrTransaction
|
|
32
|
-
* Knex client for reading from RDS database
|
|
33
|
-
* @param {number} granuleCumulusId - The primary ID for a Granule
|
|
34
|
-
* @param {number} limit - limit to number of executions to query
|
|
35
|
-
* @returns {Promise<ArnRecord[]>} - Array of arn objects with the most recent first.
|
|
36
|
-
*/
|
|
37
|
-
export declare const getExecutionArnsByGranuleCumulusId: (knexOrTransaction: Knex | Knex.Transaction, granuleCumulusId: Number, limit?: number) => Promise<ArnRecord[]>;
|
|
38
40
|
/**
|
|
39
41
|
* Returns a list of executionArns sorted by most recent first, for an input
|
|
40
42
|
* list of granuleIds and workflowNames.
|
package/dist/lib/execution.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.batchDeleteExecutionFromDatabaseByCumulusCollectionId = exports.getApiGranuleExecutionCumulusIdsByExecution = exports.getApiExecutionCumulusIds = exports.getWorkflowNameIntersectFromGranuleIds = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.
|
|
3
|
+
exports.batchDeleteExecutionFromDatabaseByCumulusCollectionId = exports.getApiGranuleExecutionCumulusIdsByExecution = exports.getApiExecutionCumulusIds = exports.getWorkflowNameIntersectFromGranuleIds = exports.newestExecutionArnFromGranuleIdWorkflowName = exports.executionArnsFromGranuleIdsAndWorkflowNames = exports.getExecutionInfoByGranuleCumulusId = exports.getExecutionInfoByGranuleCumulusIds = 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");
|
|
@@ -9,54 +9,50 @@ const Logger = require('@cumulus/logger');
|
|
|
9
9
|
const { getKnexClient } = require('../connection');
|
|
10
10
|
const log = new Logger({ sender: '@cumulus/db/lib/execution' });
|
|
11
11
|
/**
|
|
12
|
-
* Returns execution
|
|
13
|
-
* Granule Cumulus
|
|
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.
|
|
12
|
+
* Returns execution records sorted by most recent first for an input
|
|
13
|
+
* set of Granule Cumulus IDs.
|
|
14
|
+
* @returns Array of arn objects with the most recent first.
|
|
23
15
|
*/
|
|
24
|
-
const
|
|
16
|
+
const getExecutionInfoByGranuleCumulusIds = async ({ knexOrTransaction, granuleCumulusIds, limit, }) => {
|
|
25
17
|
const knexQuery = knexOrTransaction(tables_1.TableNames.executions)
|
|
26
|
-
.column(
|
|
27
|
-
|
|
18
|
+
.column([
|
|
19
|
+
`${tables_1.TableNames.executions}.url`,
|
|
20
|
+
`${tables_1.TableNames.granulesExecutions}.granule_cumulus_id`,
|
|
21
|
+
])
|
|
22
|
+
.whereIn(`${tables_1.TableNames.granulesExecutions}.granule_cumulus_id`, granuleCumulusIds)
|
|
28
23
|
.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
24
|
.orderBy(`${tables_1.TableNames.executions}.timestamp`, 'desc');
|
|
31
25
|
if (limit) {
|
|
32
26
|
knexQuery.limit(limit);
|
|
33
27
|
}
|
|
34
28
|
return await knexQuery;
|
|
35
29
|
};
|
|
36
|
-
exports.
|
|
30
|
+
exports.getExecutionInfoByGranuleCumulusIds = getExecutionInfoByGranuleCumulusIds;
|
|
37
31
|
/**
|
|
38
|
-
* Returns
|
|
32
|
+
* Returns execution records sorted by most recent first for an input
|
|
39
33
|
* Granule Cumulus ID.
|
|
40
34
|
*
|
|
41
|
-
* @param {
|
|
35
|
+
* @param {Object} params
|
|
36
|
+
* @param {Knex | Knex.Transaction} params.knexOrTransaction
|
|
42
37
|
* Knex client for reading from RDS database
|
|
43
|
-
* @param {
|
|
44
|
-
* @param {number}
|
|
45
|
-
* @
|
|
38
|
+
* @param {Array<string>} params.executionColumns - Columns to return from executions table
|
|
39
|
+
* @param {number} params.granuleCumulusId - The primary ID for a Granule
|
|
40
|
+
* @param {number} [params.limit] - limit to number of executions to query
|
|
41
|
+
* @returns {Promise<Partial<PostgresExecutionRecord>[]>}
|
|
42
|
+
* Array of arn objects with the most recent first.
|
|
46
43
|
*/
|
|
47
|
-
const
|
|
44
|
+
const getExecutionInfoByGranuleCumulusId = async ({ knexOrTransaction, granuleCumulusId, executionColumns = ['arn'], limit, }) => {
|
|
48
45
|
const knexQuery = knexOrTransaction(tables_1.TableNames.executions)
|
|
49
|
-
.
|
|
50
|
-
.where(`${tables_1.TableNames.
|
|
46
|
+
.column(executionColumns.map((column) => `${tables_1.TableNames.executions}.${column}`))
|
|
47
|
+
.where(`${tables_1.TableNames.granulesExecutions}.granule_cumulus_id`, granuleCumulusId)
|
|
51
48
|
.join(tables_1.TableNames.granulesExecutions, `${tables_1.TableNames.executions}.cumulus_id`, `${tables_1.TableNames.granulesExecutions}.execution_cumulus_id`)
|
|
52
|
-
.join(tables_1.TableNames.granules, `${tables_1.TableNames.granules}.cumulus_id`, `${tables_1.TableNames.granulesExecutions}.granule_cumulus_id`)
|
|
53
49
|
.orderBy(`${tables_1.TableNames.executions}.timestamp`, 'desc');
|
|
54
50
|
if (limit) {
|
|
55
51
|
knexQuery.limit(limit);
|
|
56
52
|
}
|
|
57
53
|
return await knexQuery;
|
|
58
54
|
};
|
|
59
|
-
exports.
|
|
55
|
+
exports.getExecutionInfoByGranuleCumulusId = getExecutionInfoByGranuleCumulusId;
|
|
60
56
|
/**
|
|
61
57
|
* Returns a list of executionArns sorted by most recent first, for an input
|
|
62
58
|
* list of granuleIds and workflowNames.
|
package/dist/lib/granule.d.ts
CHANGED
|
@@ -79,24 +79,20 @@ export declare const getApiGranuleExecutionCumulusIds: (knexOrTransaction: Knex
|
|
|
79
79
|
}>, collectionPgModel?: CollectionPgModel, granulePgModel?: GranulePgModel, granulesExecutionsPgModel?: GranulesExecutionsPgModel) => Promise<Array<number>>;
|
|
80
80
|
/**
|
|
81
81
|
* Helper to build a query to search granules by various API granule record properties.
|
|
82
|
-
*
|
|
83
|
-
* @param {Knex} knex - DB client
|
|
84
|
-
* @param {Object} searchParams
|
|
85
|
-
* @param {string | Array<string>} [searchParams.collectionIds] - Collection ID
|
|
86
|
-
* @param {string | Array<string>} [searchParams.granuleIds] - array of granule IDs
|
|
87
|
-
* @param {string} [searchParams.providerNames] - Provider names
|
|
88
|
-
* @param {UpdatedAtRange} [searchParams.updatedAtRange] - Date range for updated_at column
|
|
89
|
-
* @param {string} [searchParams.status] - Granule status to search by
|
|
90
|
-
* @param {string | Array<string>} [sortByFields] - Field(s) to sort by
|
|
91
|
-
* @returns {Knex.QueryBuilder}
|
|
92
82
|
*/
|
|
93
|
-
export declare const getGranulesByApiPropertiesQuery: (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
export declare const getGranulesByApiPropertiesQuery: ({ knex, searchParams, sortByFields, temporalBoundByCreatedAt, }: {
|
|
84
|
+
knex: Knex;
|
|
85
|
+
searchParams: {
|
|
86
|
+
collate?: string;
|
|
87
|
+
collectionIds?: string | string[];
|
|
88
|
+
granuleIds?: string | string[];
|
|
89
|
+
providerNames?: string[];
|
|
90
|
+
status?: string;
|
|
91
|
+
updatedAtRange?: UpdatedAtRange;
|
|
92
|
+
};
|
|
93
|
+
sortByFields?: string | string[] | undefined;
|
|
94
|
+
temporalBoundByCreatedAt?: boolean | undefined;
|
|
95
|
+
}) => Knex.QueryBuilder;
|
|
100
96
|
/**
|
|
101
97
|
* Get Postgres Granule and Collection objects for a granuleId + collectionId
|
|
102
98
|
*
|
package/dist/lib/granule.js
CHANGED
|
@@ -138,19 +138,10 @@ const getApiGranuleExecutionCumulusIds = async (knexOrTransaction, granules, col
|
|
|
138
138
|
exports.getApiGranuleExecutionCumulusIds = getApiGranuleExecutionCumulusIds;
|
|
139
139
|
/**
|
|
140
140
|
* Helper to build a query to search granules by various API granule record properties.
|
|
141
|
-
*
|
|
142
|
-
* @param {Knex} knex - DB client
|
|
143
|
-
* @param {Object} searchParams
|
|
144
|
-
* @param {string | Array<string>} [searchParams.collectionIds] - Collection ID
|
|
145
|
-
* @param {string | Array<string>} [searchParams.granuleIds] - array of granule IDs
|
|
146
|
-
* @param {string} [searchParams.providerNames] - Provider names
|
|
147
|
-
* @param {UpdatedAtRange} [searchParams.updatedAtRange] - Date range for updated_at column
|
|
148
|
-
* @param {string} [searchParams.status] - Granule status to search by
|
|
149
|
-
* @param {string | Array<string>} [sortByFields] - Field(s) to sort by
|
|
150
|
-
* @returns {Knex.QueryBuilder}
|
|
151
141
|
*/
|
|
152
|
-
const getGranulesByApiPropertiesQuery = (
|
|
142
|
+
const getGranulesByApiPropertiesQuery = ({ knex, searchParams, sortByFields = [], temporalBoundByCreatedAt = false, }) => {
|
|
153
143
|
const { granules: granulesTable, collections: collectionsTable, providers: providersTable, } = TableNames;
|
|
144
|
+
const temporalColumn = temporalBoundByCreatedAt ? 'created_at' : 'updated_at';
|
|
154
145
|
return knex(granulesTable)
|
|
155
146
|
.select(`${granulesTable}.*`)
|
|
156
147
|
.select({
|
|
@@ -161,34 +152,41 @@ const getGranulesByApiPropertiesQuery = (knex, { collectionIds, granuleIds, prov
|
|
|
161
152
|
.innerJoin(collectionsTable, `${granulesTable}.collection_cumulus_id`, `${collectionsTable}.cumulus_id`)
|
|
162
153
|
.leftJoin(providersTable, `${granulesTable}.provider_cumulus_id`, `${providersTable}.cumulus_id`)
|
|
163
154
|
.modify((queryBuilder) => {
|
|
164
|
-
if (collectionIds) {
|
|
165
|
-
const collectionIdFilters = [collectionIds].flat();
|
|
155
|
+
if (searchParams.collectionIds) {
|
|
156
|
+
const collectionIdFilters = [searchParams.collectionIds].flat();
|
|
166
157
|
const collectionIdConcatField = `(${collectionsTable}.name || '${Collections_1.collectionIdSeparator}' || ${collectionsTable}.version)`;
|
|
167
158
|
const collectionIdInClause = collectionIdFilters.map(() => '?').join(',');
|
|
168
159
|
queryBuilder.whereRaw(`${collectionIdConcatField} IN (${collectionIdInClause})`, collectionIdFilters);
|
|
169
160
|
}
|
|
170
|
-
if (granuleIds) {
|
|
171
|
-
const granuleIdFilters = [granuleIds].flat();
|
|
161
|
+
if (searchParams.granuleIds) {
|
|
162
|
+
const granuleIdFilters = [searchParams.granuleIds].flat();
|
|
172
163
|
queryBuilder.where((nestedQueryBuilder) => {
|
|
173
164
|
granuleIdFilters.forEach((granuleId) => {
|
|
174
165
|
nestedQueryBuilder.orWhere(`${granulesTable}.granule_id`, 'LIKE', `%${granuleId}%`);
|
|
175
166
|
});
|
|
176
167
|
});
|
|
177
168
|
}
|
|
178
|
-
if (providerNames) {
|
|
179
|
-
queryBuilder.whereIn(`${providersTable}.name`, providerNames);
|
|
169
|
+
if (searchParams.providerNames) {
|
|
170
|
+
queryBuilder.whereIn(`${providersTable}.name`, searchParams.providerNames);
|
|
180
171
|
}
|
|
181
|
-
if (updatedAtRange
|
|
182
|
-
queryBuilder.where(`${granulesTable}
|
|
172
|
+
if (searchParams?.updatedAtRange?.updatedAtFrom) {
|
|
173
|
+
queryBuilder.where(`${granulesTable}.${temporalColumn}`, '>=', searchParams.updatedAtRange.updatedAtFrom);
|
|
183
174
|
}
|
|
184
|
-
if (updatedAtRange
|
|
185
|
-
queryBuilder.where(`${granulesTable}
|
|
175
|
+
if (searchParams?.updatedAtRange?.updatedAtTo) {
|
|
176
|
+
queryBuilder.where(`${granulesTable}.${temporalColumn}`, '<=', searchParams.updatedAtRange.updatedAtTo);
|
|
186
177
|
}
|
|
187
|
-
if (status) {
|
|
188
|
-
queryBuilder.where(`${granulesTable}.status`, status);
|
|
178
|
+
if (searchParams.status) {
|
|
179
|
+
queryBuilder.where(`${granulesTable}.status`, searchParams.status);
|
|
189
180
|
}
|
|
190
181
|
if (sortByFields) {
|
|
191
|
-
|
|
182
|
+
if (!searchParams.collate) {
|
|
183
|
+
queryBuilder.orderBy([sortByFields].flat());
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
[sortByFields].flat().forEach((field) => {
|
|
187
|
+
queryBuilder.orderByRaw(`${field} collate \"${searchParams.collate}\"`);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
192
190
|
}
|
|
193
191
|
})
|
|
194
192
|
.groupBy(`${granulesTable}.cumulus_id`)
|
|
@@ -0,0 +1,40 @@
|
|
|
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.schema.createTable('reconciliation_reports', (table) => {
|
|
6
|
+
table
|
|
7
|
+
.increments('cumulus_id')
|
|
8
|
+
.primary();
|
|
9
|
+
table
|
|
10
|
+
.text('name')
|
|
11
|
+
.comment('Reconciliation Report name')
|
|
12
|
+
.notNullable();
|
|
13
|
+
table
|
|
14
|
+
.enum('type', ['Granule Inventory', 'Granule Not Found', 'Internal', 'Inventory', 'ORCA Backup'])
|
|
15
|
+
.comment('Type of Reconciliation Report')
|
|
16
|
+
.notNullable();
|
|
17
|
+
table
|
|
18
|
+
.enum('status', ['Generated', 'Pending', 'Failed'])
|
|
19
|
+
.comment('Status of Reconciliation Report')
|
|
20
|
+
.notNullable();
|
|
21
|
+
table
|
|
22
|
+
.text('location')
|
|
23
|
+
.comment('Location of Reconciliation Report');
|
|
24
|
+
table
|
|
25
|
+
.jsonb('error')
|
|
26
|
+
.comment('Error object');
|
|
27
|
+
// adds "created_at" and "updated_at" columns automatically
|
|
28
|
+
table
|
|
29
|
+
.timestamps(false, true);
|
|
30
|
+
table.index('status');
|
|
31
|
+
table.index('updated_at');
|
|
32
|
+
table.unique(['name']);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.up = up;
|
|
36
|
+
const down = async (knex) => {
|
|
37
|
+
await knex.schema.dropTableIfExists('reconciliation_reports');
|
|
38
|
+
};
|
|
39
|
+
exports.down = down;
|
|
40
|
+
//# sourceMappingURL=20240814185217_create_reconciliation_reports_table.js.map
|
package/dist/models/file.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ declare class FilePgModel extends BasePgModel<PostgresFile, PostgresFileRecord>
|
|
|
12
12
|
_intersectProps: {};
|
|
13
13
|
_unionProps: never;
|
|
14
14
|
}[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves all files for all granules given
|
|
17
|
+
*/
|
|
18
|
+
searchByGranuleCumulusIds(knexOrTrx: Knex | Knex.Transaction, granule_cumulus_ids: number[], columns?: string | string[]): Promise<PostgresFileRecord[]>;
|
|
15
19
|
}
|
|
16
20
|
export { FilePgModel };
|
|
17
21
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/models/file.js
CHANGED
|
@@ -16,6 +16,14 @@ class FilePgModel extends base_1.BasePgModel {
|
|
|
16
16
|
.merge()
|
|
17
17
|
.returning('*');
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves all files for all granules given
|
|
21
|
+
*/
|
|
22
|
+
searchByGranuleCumulusIds(knexOrTrx, granule_cumulus_ids, columns = '*') {
|
|
23
|
+
return knexOrTrx(this.tableName)
|
|
24
|
+
.select(columns)
|
|
25
|
+
.whereIn('granule_cumulus_id', granule_cumulus_ids);
|
|
26
|
+
}
|
|
19
27
|
}
|
|
20
28
|
exports.FilePgModel = FilePgModel;
|
|
21
29
|
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Knex } from 'knex';
|
|
2
|
+
import { BasePgModel } from './base';
|
|
3
|
+
import { PostgresReconciliationReport, PostgresReconciliationReportRecord } from '../types/reconciliation_report';
|
|
4
|
+
declare class ReconciliationReportPgModel extends BasePgModel<PostgresReconciliationReport, PostgresReconciliationReportRecord> {
|
|
5
|
+
constructor();
|
|
6
|
+
create(knexOrTransaction: Knex | Knex.Transaction, item: PostgresReconciliationReport): Promise<PostgresReconciliationReportRecord[]>;
|
|
7
|
+
upsert(knexOrTransaction: Knex | Knex.Transaction, reconciliationReport: PostgresReconciliationReport): Promise<PostgresReconciliationReportRecord[]>;
|
|
8
|
+
}
|
|
9
|
+
export { ReconciliationReportPgModel };
|
|
10
|
+
//# sourceMappingURL=reconciliation_report.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReconciliationReportPgModel = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
const tables_1 = require("../tables");
|
|
6
|
+
// eslint-disable-next-line max-len
|
|
7
|
+
class ReconciliationReportPgModel extends base_1.BasePgModel {
|
|
8
|
+
constructor() {
|
|
9
|
+
super({
|
|
10
|
+
tableName: tables_1.TableNames.reconciliationReports,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
create(knexOrTransaction, item) {
|
|
14
|
+
return super.create(knexOrTransaction, item, '*');
|
|
15
|
+
}
|
|
16
|
+
upsert(knexOrTransaction, reconciliationReport) {
|
|
17
|
+
return knexOrTransaction(this.tableName)
|
|
18
|
+
.insert(reconciliationReport)
|
|
19
|
+
.onConflict('name')
|
|
20
|
+
.merge()
|
|
21
|
+
.returning('*');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ReconciliationReportPgModel = ReconciliationReportPgModel;
|
|
25
|
+
//# sourceMappingURL=reconciliation_report.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Knex } from 'knex';
|
|
2
|
+
import { ApiAsyncOperation } from '@cumulus/types/api/async_operations';
|
|
3
|
+
import { BaseSearch } from './BaseSearch';
|
|
4
|
+
import { DbQueryParameters, QueryEvent } from '../types/search';
|
|
5
|
+
import { PostgresAsyncOperationRecord } from '../types/async_operation';
|
|
6
|
+
/**
|
|
7
|
+
* Class to build and execute db search query for asyncOperation
|
|
8
|
+
*/
|
|
9
|
+
export declare class AsyncOperationSearch extends BaseSearch {
|
|
10
|
+
constructor(event: QueryEvent);
|
|
11
|
+
/**
|
|
12
|
+
* Build queries for infix and prefix
|
|
13
|
+
*
|
|
14
|
+
* @param params
|
|
15
|
+
* @param params.countQuery - query builder for getting count
|
|
16
|
+
* @param params.searchQuery - query builder for search
|
|
17
|
+
* @param [params.dbQueryParameters] - db query parameters
|
|
18
|
+
*/
|
|
19
|
+
protected buildInfixPrefixQuery(params: {
|
|
20
|
+
countQuery: Knex.QueryBuilder;
|
|
21
|
+
searchQuery: Knex.QueryBuilder;
|
|
22
|
+
dbQueryParameters?: DbQueryParameters;
|
|
23
|
+
}): void;
|
|
24
|
+
/**
|
|
25
|
+
* Translate postgres records to api records
|
|
26
|
+
*
|
|
27
|
+
* @param pgRecords - postgres records returned from query
|
|
28
|
+
* @returns translated api records
|
|
29
|
+
*/
|
|
30
|
+
protected translatePostgresRecordsToApiRecords(pgRecords: PostgresAsyncOperationRecord[]): Partial<ApiAsyncOperation>[];
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=AsyncOperationSearch.d.ts.map
|