@cumulus/db 9.4.1-alpha.0 → 9.4.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.
Files changed (32) hide show
  1. package/LICENSE +60 -0
  2. package/dist/index.d.ts +1 -2
  3. package/dist/index.js +0 -23
  4. package/dist/models/granule.d.ts +0 -21
  5. package/dist/models/granule.js +0 -40
  6. package/dist/models/granules-executions.d.ts +0 -1
  7. package/dist/models/granules-executions.js +0 -5
  8. package/dist/test-utils.js +1 -2
  9. package/dist/translate/executions.js +1 -1
  10. package/package.json +9 -9
  11. package/dist/migrations/20201014104958_create_collections_table.d.ts +0 -4
  12. package/dist/migrations/20201014104958_create_collections_table.js +0 -60
  13. package/dist/migrations/20201014105016_create_providers_table.d.ts +0 -4
  14. package/dist/migrations/20201014105016_create_providers_table.js +0 -52
  15. package/dist/migrations/20201014105024_create_rules_table.d.ts +0 -4
  16. package/dist/migrations/20201014105024_create_rules_table.js +0 -65
  17. package/dist/migrations/20201014105030_create_async_operations_table.d.ts +0 -4
  18. package/dist/migrations/20201014105030_create_async_operations_table.js +0 -46
  19. package/dist/migrations/20201014105045_create_executions_table.d.ts +0 -4
  20. package/dist/migrations/20201014105045_create_executions_table.js +0 -62
  21. package/dist/migrations/20201014105054_create_pdrs_table.d.ts +0 -4
  22. package/dist/migrations/20201014105054_create_pdrs_table.js +0 -58
  23. package/dist/migrations/20201014105058_create_granules_table.d.ts +0 -4
  24. package/dist/migrations/20201014105058_create_granules_table.js +0 -80
  25. package/dist/migrations/20201014105102_create_files_table.d.ts +0 -4
  26. package/dist/migrations/20201014105102_create_files_table.js +0 -51
  27. package/dist/migrations/20210211172119_create_granules_executions_table.d.ts +0 -4
  28. package/dist/migrations/20210211172119_create_granules_executions_table.js +0 -24
  29. package/dist/migrations/20210715171725_provider_add_allowed_redirects.d.ts +0 -4
  30. package/dist/migrations/20210715171725_provider_add_allowed_redirects.js +0 -16
  31. package/dist/migrations/20210727104740_alter_async_operations_table_operation_type.d.ts +0 -4
  32. package/dist/migrations/20210727104740_alter_async_operations_table_operation_type.js +0 -39
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/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  export { default as 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, fakeCollectionRecordFactory, fakeExecutionRecordFactory, fakeFileRecordFactory, fakeGranuleRecordFactory, fakePdrRecordFactory, fakeProviderRecordFactory, fakeRuleRecordFactory, generateLocalTestDb, } from './test-utils';
3
3
  export { getKnexClient } from './connection';
4
4
  export { getKnexConfig, localStackConnectionEnv } from './config';
5
5
  export { tableNames } from './tables';
6
- export declare const migrationDir: string;
7
6
  export { validateProviderHost, nullifyUndefinedProviderValues, } from './provider';
8
7
  export { PostgresAsyncOperation, PostgresAsyncOperationRecord, } from './types/async_operation';
9
8
  export { PostgresCollection, PostgresCollectionRecord, } from './types/collection';
package/dist/index.js CHANGED
@@ -1,33 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
2
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.migrationDir = void 0;
23
- const path = __importStar(require("path"));
24
3
  var knex_1 = require("knex");
25
4
  Object.defineProperty(exports, "Knex", { enumerable: true, get: function () { return knex_1.default; } });
26
5
  var test_utils_1 = require("./test-utils");
27
6
  Object.defineProperty(exports, "createTestDatabase", { enumerable: true, get: function () { return test_utils_1.createTestDatabase; } });
28
7
  Object.defineProperty(exports, "deleteTestDatabase", { enumerable: true, get: function () { return test_utils_1.deleteTestDatabase; } });
29
8
  Object.defineProperty(exports, "destroyLocalTestDb", { enumerable: true, get: function () { return test_utils_1.destroyLocalTestDb; } });
30
- Object.defineProperty(exports, "fakeAsyncOperationRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeAsyncOperationRecordFactory; } });
31
9
  Object.defineProperty(exports, "fakeCollectionRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeCollectionRecordFactory; } });
32
10
  Object.defineProperty(exports, "fakeExecutionRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeExecutionRecordFactory; } });
33
11
  Object.defineProperty(exports, "fakeFileRecordFactory", { enumerable: true, get: function () { return test_utils_1.fakeFileRecordFactory; } });
@@ -43,7 +21,6 @@ Object.defineProperty(exports, "getKnexConfig", { enumerable: true, get: functio
43
21
  Object.defineProperty(exports, "localStackConnectionEnv", { enumerable: true, get: function () { return config_1.localStackConnectionEnv; } });
44
22
  var tables_1 = require("./tables");
45
23
  Object.defineProperty(exports, "tableNames", { enumerable: true, get: function () { return tables_1.tableNames; } });
46
- exports.migrationDir = path.join(__dirname, 'migrations');
47
24
  var provider_1 = require("./provider");
48
25
  Object.defineProperty(exports, "validateProviderHost", { enumerable: true, get: function () { return provider_1.validateProviderHost; } });
49
26
  Object.defineProperty(exports, "nullifyUndefinedProviderValues", { enumerable: true, get: function () { return provider_1.nullifyUndefinedProviderValues; } });
@@ -2,9 +2,6 @@ import Knex from 'knex';
2
2
  import { PostgresGranule, PostgresGranuleRecord, PostgresGranuleUniqueColumns } from '../types/granule';
3
3
  import { BasePgModel } from './base';
4
4
  import { GranulesExecutionsPgModel } from './granules-executions';
5
- interface RecordSelect {
6
- cumulus_id: number;
7
- }
8
5
  export default class GranulePgModel extends BasePgModel<PostgresGranule, PostgresGranuleRecord> {
9
6
  constructor();
10
7
  /**
@@ -17,24 +14,6 @@ export default class GranulePgModel extends BasePgModel<PostgresGranule, Postgre
17
14
  delete(knexOrTransaction: Knex | Knex.Transaction, params: PostgresGranuleUniqueColumns | {
18
15
  cumulus_id: number;
19
16
  }): Promise<number>;
20
- /**
21
- * Checks if a granule is present in PostgreSQL
22
- *
23
- * @param {Knex | Knex.Transaction} knexOrTransaction - DB client or transaction
24
- * @param {PostgresGranuleUniqueColumns | RecordSelect} params - An object
25
- * of PostgresGranuleUniqueColumns or RecordSelect
26
- * @returns {Promise<boolean>} True if the granule exists, false otherwise
27
- */
28
- exists(knexOrTransaction: Knex | Knex.Transaction, params: PostgresGranuleUniqueColumns | RecordSelect): Promise<boolean>;
29
- /**
30
- * Fetches a single granule from PostgreSQL
31
- *
32
- * @param {Knex | Knex.Transaction} knexOrTransaction - DB client or transaction
33
- * @param {PostgresGranuleUniqueColumns | RecordSelect} params - An object
34
- * of PostgresGranuleUniqueColumns or RecordSelect
35
- * @returns {Promise<PostgresGranuleRecord>} The returned record
36
- */
37
- get(knexOrTransaction: Knex | Knex.Transaction, params: PostgresGranuleUniqueColumns | RecordSelect): Promise<PostgresGranuleRecord>;
38
17
  upsert(knexOrTrx: Knex | Knex.Transaction, granule: PostgresGranule, executionCumulusId?: number, granulesExecutionsPgModel?: GranulesExecutionsPgModel): Promise<any[]>;
39
18
  }
40
19
  export { GranulePgModel };
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GranulePgModel = void 0;
4
- const errors_1 = require("@cumulus/errors");
5
4
  const tables_1 = require("../tables");
6
5
  const base_1 = require("./base");
7
6
  const granules_executions_1 = require("./granules-executions");
8
7
  const timestamp_1 = require("../lib/timestamp");
9
- function isRecordSelect(param) {
10
- return param.cumulus_id !== undefined;
11
- }
12
8
  class GranulePgModel extends base_1.BasePgModel {
13
9
  constructor() {
14
10
  super({
@@ -27,42 +23,6 @@ class GranulePgModel extends base_1.BasePgModel {
27
23
  .where(params)
28
24
  .del();
29
25
  }
30
- /**
31
- * Checks if a granule is present in PostgreSQL
32
- *
33
- * @param {Knex | Knex.Transaction} knexOrTransaction - DB client or transaction
34
- * @param {PostgresGranuleUniqueColumns | RecordSelect} params - An object
35
- * of PostgresGranuleUniqueColumns or RecordSelect
36
- * @returns {Promise<boolean>} True if the granule exists, false otherwise
37
- */
38
- async exists(knexOrTransaction, params) {
39
- try {
40
- await this.get(knexOrTransaction, params);
41
- return true;
42
- }
43
- catch (error) {
44
- if (error instanceof errors_1.RecordDoesNotExist) {
45
- return false;
46
- }
47
- throw error;
48
- }
49
- }
50
- /**
51
- * Fetches a single granule from PostgreSQL
52
- *
53
- * @param {Knex | Knex.Transaction} knexOrTransaction - DB client or transaction
54
- * @param {PostgresGranuleUniqueColumns | RecordSelect} params - An object
55
- * of PostgresGranuleUniqueColumns or RecordSelect
56
- * @returns {Promise<PostgresGranuleRecord>} The returned record
57
- */
58
- get(knexOrTransaction, params) {
59
- if (!isRecordSelect(params)) {
60
- if (!(params.granule_id && params.collection_cumulus_id)) {
61
- throw new errors_1.InvalidArgument(`Cannot find granule, must provide either granule_id and collection_cumulus_id or cumulus_id: params(${JSON.stringify(params)})`);
62
- }
63
- }
64
- return super.get(knexOrTransaction, params);
65
- }
66
26
  async upsert(knexOrTrx, granule, executionCumulusId, granulesExecutionsPgModel = new granules_executions_1.GranulesExecutionsPgModel()) {
67
27
  if (!granule.created_at) {
68
28
  throw new Error(`To upsert granule record must have 'created_at' set: ${JSON.stringify(granule)}`);
@@ -17,7 +17,6 @@ export default class GranulesExecutionsPgModel {
17
17
  * @returns {Promise<Array<number>>} An array of execution_cumulus_ids
18
18
  */
19
19
  searchByGranuleCumulusIds(knexOrTransaction: Knex | Knex.Transaction, granuleCumulusIds: Array<number> | number): Promise<Array<number>>;
20
- delete(knexTransaction: Knex.Transaction, params: Partial<PostgresGranuleExecution>): Promise<number>;
21
20
  search(knexTransaction: Knex | Knex.Transaction, query: Partial<PostgresGranuleExecution>): Knex.QueryBuilder<PostgresGranuleExecution, {
22
21
  _base: PostgresGranuleExecution;
23
22
  _hasSelection: false;
@@ -38,11 +38,6 @@ class GranulesExecutionsPgModel {
38
38
  .groupBy('execution_cumulus_id');
39
39
  return granuleExecutions.map((granuleExecution) => granuleExecution.execution_cumulus_id);
40
40
  }
41
- async delete(knexTransaction, params) {
42
- return await knexTransaction(this.tableName)
43
- .where(params)
44
- .del();
45
- }
46
41
  search(knexTransaction, query) {
47
42
  return knexTransaction(this.tableName)
48
43
  .where(query);
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fakePdrRecordFactory = exports.fakeAsyncOperationRecordFactory = exports.fakeFileRecordFactory = exports.fakeGranuleRecordFactory = exports.fakeProviderRecordFactory = exports.fakeExecutionRecordFactory = exports.fakeCollectionRecordFactory = exports.fakeRuleRecordFactory = exports.destroyLocalTestDb = exports.generateLocalTestDb = exports.deleteTestDatabase = exports.createTestDatabase = void 0;
7
7
  const crypto_random_string_1 = __importDefault(require("crypto-random-string"));
8
8
  const uuid_1 = require("uuid");
9
- const p_retry_1 = __importDefault(require("p-retry"));
10
9
  const Executions_1 = require("@cumulus/message/Executions");
11
10
  const connection_1 = require("./connection");
12
11
  const config_1 = require("./config");
@@ -31,7 +30,7 @@ exports.generateLocalTestDb = async (testDbName, migrationDir, envParams) => {
31
30
  };
32
31
  exports.destroyLocalTestDb = async ({ knex, knexAdmin, testDbName, }) => {
33
32
  knex.destroy();
34
- await p_retry_1.default(async () => await exports.deleteTestDatabase(knexAdmin, testDbName));
33
+ await exports.deleteTestDatabase(knexAdmin, testDbName);
35
34
  knexAdmin.destroy();
36
35
  };
37
36
  exports.fakeRuleRecordFactory = (params) => ({
@@ -115,6 +115,6 @@ exports.translateApiExecutionToPostgresExecution = async (dynamoRecord, knex, co
115
115
  }
116
116
  }
117
117
  }
118
- return util_1.removeNilProperties(translatedRecord);
118
+ return translatedRecord;
119
119
  };
120
120
  //# sourceMappingURL=executions.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulus/db",
3
- "version": "9.4.1-alpha.0",
3
+ "version": "9.4.1",
4
4
  "description": "Utilities for working with the Cumulus DB",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -29,13 +29,12 @@
29
29
  "node": ">=12.18.0"
30
30
  },
31
31
  "dependencies": {
32
- "crypto-random-string": "^3.2.0",
33
- "@cumulus/aws-client": "9.4.0",
34
- "@cumulus/common": "9.4.0",
35
- "@cumulus/errors": "9.4.0",
36
- "@cumulus/logger": "9.4.0",
37
- "@cumulus/message": "9.4.0",
38
- "@cumulus/types": "9.4.0",
32
+ "@cumulus/aws-client": "9.4.1",
33
+ "@cumulus/common": "9.4.1",
34
+ "@cumulus/errors": "9.4.1",
35
+ "@cumulus/logger": "9.4.1",
36
+ "@cumulus/message": "9.4.1",
37
+ "@cumulus/types": "9.4.1",
39
38
  "is-valid-hostname": "0.0.1",
40
39
  "knex": "0.21.13",
41
40
  "lodash": "^4.17.20",
@@ -45,5 +44,6 @@
45
44
  },
46
45
  "devDependencies": {
47
46
  "@types/uuid": "^8.0.0"
48
- }
47
+ },
48
+ "gitHead": "fce4415918c43a6a14d46ac7d9572f5a97a98a45"
49
49
  }
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014104958_create_collections_table.d.ts.map
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('collections', (table) => {
5
- table
6
- .increments('cumulus_id').primary();
7
- table
8
- .text('name')
9
- .comment('Collection short_name registered with the CMR')
10
- .notNullable();
11
- table
12
- .text('version')
13
- .comment('The version registered with the CMR')
14
- .notNullable();
15
- table
16
- .text('sample_file_name')
17
- .comment('Example filename for this collection')
18
- .notNullable();
19
- table
20
- .text('granule_id_validation_regex')
21
- .notNullable()
22
- .comment('The regular expression used to validate the granule ID extracted from filenames according to the granuleIdExtraction');
23
- table
24
- .text('granule_id_extraction_regex')
25
- .comment('The regular expression used to extract the granule ID from filenames')
26
- .notNullable();
27
- table
28
- .jsonb('files')
29
- .comment('List of collection file definitions')
30
- .notNullable();
31
- table
32
- .text('process')
33
- .comment('Name of the docker process to be used, e.g. modis, aster');
34
- table
35
- .text('url_path')
36
- .comment('The folder (url) used to save granules on S3 buckets');
37
- table
38
- .enum('duplicate_handling', ['error', 'replace', 'skip', 'version'])
39
- .comment('Duplicate handling behavior for this collection');
40
- table
41
- .boolean('report_to_ems')
42
- .comment('Flag to set if this collection should be reported to EMS');
43
- table
44
- .boolean('ignore_files_config_for_discovery')
45
- .comment('When true, ignore the collection files config list for determining which files to ingest for a granule. When false, ingest only files that match a regex in the colletion files config list');
46
- table
47
- .jsonb('meta')
48
- .comment('Collection meta object');
49
- table
50
- .jsonb('tags')
51
- .comment('JSON encoded array of collection tags');
52
- // adds "created_at" and "updated_at" columns automatically
53
- table
54
- .timestamps(false, true);
55
- // add unique constraints
56
- table
57
- .unique(['name', 'version']);
58
- });
59
- exports.down = async (knex) => await knex.schema.dropTableIfExists('collections');
60
- //# sourceMappingURL=20201014104958_create_collections_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014105016_create_providers_table.d.ts.map
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('providers', (table) => {
5
- table
6
- .increments('cumulus_id')
7
- .primary();
8
- table
9
- .text('name')
10
- .comment('Provider name')
11
- .notNullable();
12
- table
13
- .enum('protocol', ['http', 'https', 'ftp', 'sftp', 's3'])
14
- .comment('Protocol for the provider')
15
- .defaultTo('http')
16
- .notNullable();
17
- table
18
- .text('host')
19
- .comment('Host name for the provider')
20
- .notNullable();
21
- table
22
- .integer('port')
23
- .comment('Port name for accessing the provider');
24
- table
25
- .text('username')
26
- .comment('Username for accessing the provider');
27
- table
28
- .text('password')
29
- .comment('Password for accessing the provider');
30
- table
31
- .integer('global_connection_limit')
32
- .comment('Maximum number of allowed concurrent connections to this provider');
33
- table
34
- .text('private_key')
35
- .comment(`
36
- Private key for accessing the provider, if necessary.
37
- Should specify a filename that is assumed to exist at
38
- s3://<your-internal-bucket>/<stack-name>/crypto
39
- `);
40
- table
41
- .text('cm_key_id')
42
- .comment('AWS KMS Customer Master Key ARN or alias for decrypting credentials');
43
- table
44
- .text('certificate_uri')
45
- .comment('S3 URI (e.g. s3://bucket/key) for custom or self-signed SSL (TLS) certificate to access provider');
46
- table
47
- .timestamps(false, true);
48
- table.unique(['name']);
49
- });
50
- exports.down = async (knex) => await knex.schema
51
- .dropTableIfExists('providers');
52
- //# sourceMappingURL=20201014105016_create_providers_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014105024_create_rules_table.d.ts.map
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('rules', (table) => {
5
- table
6
- .increments('cumulus_id')
7
- .primary();
8
- table
9
- .text('name')
10
- .comment('Rule name')
11
- .notNullable();
12
- table
13
- .text('workflow')
14
- .comment('Workflow name to invoke for this rule')
15
- .notNullable();
16
- table
17
- .integer('collection_cumulus_id')
18
- .references('cumulus_id')
19
- .inTable('collections');
20
- table
21
- .integer('provider_cumulus_id')
22
- .references('cumulus_id')
23
- .inTable('providers');
24
- table
25
- .enum('type', ['onetime', 'scheduled', 'sns', 'kinesis', 'sqs'])
26
- .comment('Specifies how workflows are invoked for this rule')
27
- .notNullable();
28
- table
29
- .boolean('enabled')
30
- .comment('Whether rule is active or not')
31
- .notNullable();
32
- table
33
- .text('value')
34
- .comment(`
35
- Value is multi-use. For a kinesis rule this is the target stream arn,
36
- for a scheduled event it is the schedule pattern (e.g. cron), for a one-time rule.
37
- `);
38
- table
39
- .text('arn')
40
- .comment('For kinesis rules: ARN of event source mapping between Kinesis stream and message consumer Lambda');
41
- table
42
- .text('log_event_arn')
43
- .comment('For kinesis rules: ARN of event source mapping between Kinesis stream and inbound event logger Lambda');
44
- table
45
- .text('execution_name_prefix')
46
- .comment('Optional Execution name prefix');
47
- table
48
- .jsonb('payload')
49
- .comment('Optional input payload to use for onetime and scheduled workflows');
50
- table
51
- .jsonb('meta')
52
- .comment('Optional metadata for the rule. Contents will be automatically added to $.meta on invoked workflows.');
53
- table
54
- .jsonb('tags')
55
- .comment('Optional tags for the rule');
56
- table
57
- .text('queue_url')
58
- .comment('Optional SQS queue URL used to schedule executions for this rule');
59
- table
60
- .timestamps(false, true);
61
- table.unique(['name']);
62
- });
63
- exports.down = async (knex) => await knex.schema
64
- .dropTableIfExists('rules');
65
- //# sourceMappingURL=20201014105024_create_rules_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014105030_create_async_operations_table.d.ts.map
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('async_operations', (table) => {
5
- table
6
- .increments('cumulus_id')
7
- .primary();
8
- table
9
- .uuid('id')
10
- .comment('Unique ID for async operation')
11
- .notNullable();
12
- table
13
- .text('description')
14
- .comment('description for async operation')
15
- .notNullable();
16
- table
17
- .enum('operation_type', [
18
- 'ES Index',
19
- 'Bulk Granules',
20
- 'Bulk Granule Reingest',
21
- 'Bulk Granule Delete',
22
- 'Dead-Letter Processing',
23
- 'Kinesis Replay',
24
- 'Reconciliation Report',
25
- 'Migration Count Report',
26
- 'Data Migration',
27
- ])
28
- .comment('type of async operation')
29
- .notNullable();
30
- table
31
- .jsonb('output')
32
- .comment('output of completed async operation');
33
- table
34
- .enum('status', ['RUNNING', 'SUCCEEDED', 'RUNNER_FAILED', 'TASK_FAILED'])
35
- .comment('async operation status')
36
- .notNullable();
37
- table
38
- .text('task_arn')
39
- .comment('async operation ECS task ARN');
40
- table
41
- .timestamps(false, true);
42
- table.unique(['id']);
43
- });
44
- exports.down = async (knex) => await knex.schema
45
- .dropTableIfExists('async_operations');
46
- //# sourceMappingURL=20201014105030_create_async_operations_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014105045_create_executions_table.d.ts.map
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('executions', (table) => {
5
- table
6
- .increments('cumulus_id')
7
- .primary();
8
- table
9
- .text('arn')
10
- .comment('Execution ARN')
11
- .notNullable();
12
- table
13
- .integer('async_operation_cumulus_id')
14
- .references('cumulus_id')
15
- .inTable('async_operations');
16
- table
17
- .integer('collection_cumulus_id')
18
- .references('cumulus_id')
19
- .inTable('collections');
20
- table
21
- .integer('parent_cumulus_id')
22
- .references('cumulus_id')
23
- .inTable('executions');
24
- table
25
- .text('cumulus_version')
26
- .comment('Cumulus version for the execution');
27
- table
28
- .text('url')
29
- .comment('Execution page url on AWS console');
30
- table
31
- .enum('status', ['running', 'completed', 'failed', 'unknown'])
32
- .comment('Execution status')
33
- .notNullable();
34
- table
35
- .jsonb('tasks')
36
- .comment('List of completed workflow tasks');
37
- table
38
- .jsonb('error')
39
- .comment('Error details in case of a failed execution');
40
- table
41
- .text('workflow_name')
42
- .comment('Name of the Cumulus workflow run in this execution');
43
- table
44
- .float('duration')
45
- .comment('Execution duration');
46
- table
47
- .jsonb('original_payload')
48
- .comment('Original payload of this workflow');
49
- table
50
- .jsonb('final_payload')
51
- .comment('Final payload of this workflow');
52
- table
53
- .timestamp('timestamp')
54
- .comment('Execution timestamp');
55
- table
56
- .timestamps(false, true);
57
- table.unique(['url']);
58
- table.unique(['arn']);
59
- });
60
- exports.down = async (knex) => await knex.schema
61
- .dropTableIfExists('executions');
62
- //# sourceMappingURL=20201014105045_create_executions_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014105054_create_pdrs_table.d.ts.map
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('pdrs', (table) => {
5
- table
6
- .increments('cumulus_id')
7
- .comment('Internal Cumulus ID for a PDR')
8
- .primary();
9
- table
10
- .integer('collection_cumulus_id')
11
- .references('cumulus_id')
12
- .inTable('collections')
13
- .notNullable();
14
- table
15
- .integer('provider_cumulus_id')
16
- .references('cumulus_id')
17
- .inTable('providers')
18
- .notNullable();
19
- table
20
- .integer('execution_cumulus_id')
21
- .references('cumulus_id')
22
- .inTable('executions');
23
- table
24
- .enum('status', ['running', 'failed', 'completed'])
25
- .comment('Status (running, failed, completed) of the PDR')
26
- .notNullable();
27
- table
28
- .text('name')
29
- .comment('PDR name')
30
- .notNullable();
31
- table
32
- .float('progress')
33
- .comment('PDR completion progress percentage');
34
- table
35
- .boolean('pan_sent')
36
- .comment('Boolean defining if a PAN response has been sent for this PDR');
37
- table
38
- .text('pan_message')
39
- .comment('PAN message text');
40
- table
41
- .jsonb('stats')
42
- .comment('PDR stats json object');
43
- table
44
- .text('address');
45
- table
46
- .text('original_url');
47
- table
48
- .float('duration');
49
- table
50
- .timestamp('timestamp')
51
- .comment('PDR timestamp');
52
- table
53
- .timestamps(false, true);
54
- table.unique(['name']);
55
- });
56
- exports.down = async (knex) => await knex.schema
57
- .dropTableIfExists('pdrs');
58
- //# sourceMappingURL=20201014105054_create_pdrs_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014105058_create_granules_table.d.ts.map
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('granules', (table) => {
5
- table
6
- .bigIncrements('cumulus_id')
7
- .comment('Internal Cumulus ID for a granule')
8
- .primary();
9
- table
10
- .text('granule_id')
11
- .comment('Granule ID')
12
- .notNullable();
13
- table
14
- .enum('status', ['running', 'completed', 'failed'])
15
- .comment('Ingest status of the granule')
16
- .notNullable();
17
- table
18
- .integer('collection_cumulus_id')
19
- .references('cumulus_id')
20
- .inTable('collections')
21
- .notNullable();
22
- table
23
- .timestamps(false, true);
24
- table
25
- .boolean('published')
26
- .comment('Flag that shows if the granule has been published in CMR');
27
- table
28
- .float('duration')
29
- .comment('Ingest duration');
30
- table
31
- .float('time_to_archive')
32
- .comment('Number of seconds granule took to archive');
33
- table
34
- .float('time_to_process')
35
- .comment('Number seconds granule took to complete "processing"');
36
- table
37
- .bigInteger('product_volume');
38
- table
39
- .jsonb('error')
40
- .comment('JSON error object');
41
- table
42
- .text('cmr_link')
43
- .comment('Link to granule in the CMR API');
44
- table
45
- .integer('pdr_cumulus_id')
46
- .references('cumulus_id')
47
- .inTable('pdrs');
48
- table
49
- .integer('provider_cumulus_id')
50
- .references('cumulus_id')
51
- .inTable('providers');
52
- table
53
- .timestamp('beginning_date_time')
54
- .comment('Date granule started');
55
- table
56
- .timestamp('ending_date_time')
57
- .comment('Date granule completed');
58
- table
59
- .timestamp('last_update_date_time')
60
- .comment('Timestap for last update');
61
- table
62
- .timestamp('processing_end_date_time')
63
- .comment('Date granule finished processing');
64
- table
65
- .timestamp('processing_start_date_time')
66
- .comment('Date granule started processing');
67
- table
68
- .timestamp('production_date_time')
69
- .comment('Timestamp for granule production date/time');
70
- table
71
- .jsonb('query_fields')
72
- .comment('Arbitrary query fields for the granule');
73
- table
74
- .timestamp('timestamp');
75
- table
76
- .unique(['granule_id', 'collection_cumulus_id']);
77
- });
78
- exports.down = async (knex) => await knex.schema
79
- .dropTableIfExists('granules');
80
- //# sourceMappingURL=20201014105058_create_granules_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20201014105102_create_files_table.d.ts.map
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('files', (table) => {
5
- table
6
- .bigIncrements('cumulus_id')
7
- .comment('Internal Cumulus ID for a file')
8
- .primary();
9
- table
10
- .integer('granule_cumulus_id')
11
- .notNullable();
12
- table.foreign('granule_cumulus_id')
13
- .references('cumulus_id')
14
- .inTable('granules')
15
- // Automatically delete records in this table whenever the
16
- // referenced record in the granules table is deleted
17
- .onDelete('CASCADE');
18
- table
19
- .timestamps(false, true);
20
- table
21
- .bigInteger('file_size')
22
- .comment('Size of file (bytes)');
23
- table
24
- .text('bucket')
25
- .comment('AWS Bucket file is archived in')
26
- .notNullable();
27
- table
28
- .text('checksum_type')
29
- .comment('Type of file checksum (e.g. md5');
30
- table
31
- .text('checksum_value')
32
- .comment('File checksum');
33
- table
34
- .text('file_name')
35
- .comment('Source file name');
36
- table
37
- .text('key')
38
- .comment('AWS S3 key file is archived at')
39
- .notNullable();
40
- table
41
- .text('path')
42
- .comment('Source file path');
43
- table
44
- .text('source')
45
- .comment('Full source path s3/ftp/sftp/http URI to granule');
46
- table
47
- .unique(['bucket', 'key']);
48
- });
49
- exports.down = async (knex) => await knex.schema
50
- .dropTableIfExists('files');
51
- //# sourceMappingURL=20201014105102_create_files_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20210211172119_create_granules_executions_table.d.ts.map
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.createTable('granules_executions', (table) => {
5
- table
6
- .integer('granule_cumulus_id')
7
- .notNullable();
8
- table.foreign('granule_cumulus_id')
9
- .references('cumulus_id')
10
- .inTable('granules')
11
- .onDelete('CASCADE');
12
- table
13
- .integer('execution_cumulus_id')
14
- .notNullable();
15
- table.foreign('execution_cumulus_id')
16
- .references('cumulus_id')
17
- .inTable('executions')
18
- .onDelete('CASCADE');
19
- table
20
- .unique(['granule_cumulus_id', 'execution_cumulus_id']);
21
- });
22
- exports.down = async (knex) => await knex.schema
23
- .dropTableIfExists('granules_executions');
24
- //# sourceMappingURL=20210211172119_create_granules_executions_table.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20210715171725_provider_add_allowed_redirects.d.ts.map
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- exports.up = async (knex) => await knex.schema.table('providers', (table) => {
5
- table
6
- .specificType('allowed_redirects', 'text ARRAY')
7
- .comment('Only hosts in this list will have the provider username/password forwarded for authentication. Entries should be specified as host.com or host.com:7000 if redirect port is different than the provider port.');
8
- });
9
- exports.down = async (knex) => {
10
- if (await knex.schema.hasColumn('providers', 'allowed_redirects')) {
11
- await knex.schema.table('providers', (table) => {
12
- table.dropColumn('allowed_redirects');
13
- });
14
- }
15
- };
16
- //# sourceMappingURL=20210715171725_provider_add_allowed_redirects.js.map
@@ -1,4 +0,0 @@
1
- import * as Knex from 'knex';
2
- export declare const up: (knex: Knex) => Promise<void>;
3
- export declare const down: (knex: Knex) => Promise<void>;
4
- //# sourceMappingURL=20210727104740_alter_async_operations_table_operation_type.d.ts.map
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.down = exports.up = void 0;
4
- const formatAlterTableEnumSql = (tableName, columnName, enums) => {
5
- const constraintName = `${tableName}_${columnName}_check`;
6
- return [
7
- `ALTER TABLE ${tableName}`,
8
- `DROP CONSTRAINT IF EXISTS ${constraintName};`,
9
- `ALTER TABLE ${tableName} ADD CONSTRAINT ${constraintName} CHECK (${columnName} = ANY (ARRAY['${enums.join("'::text, '")}'::text]));`,
10
- ].join('\n');
11
- };
12
- exports.up = async (knex) => {
13
- await knex.raw(formatAlterTableEnumSql('async_operations', 'operation_type', [
14
- 'ES Index',
15
- 'Bulk Granules',
16
- 'Bulk Granule Reingest',
17
- 'Bulk Granule Delete',
18
- 'Dead-Letter Processing',
19
- 'Kinesis Replay',
20
- 'Reconciliation Report',
21
- 'Migration Count Report',
22
- 'Data Migration',
23
- 'SQS Replay',
24
- ]));
25
- };
26
- exports.down = async (knex) => {
27
- await knex.raw(formatAlterTableEnumSql('async_operations', 'operation_type', [
28
- 'ES Index',
29
- 'Bulk Granules',
30
- 'Bulk Granule Reingest',
31
- 'Bulk Granule Delete',
32
- 'Dead-Letter Processing',
33
- 'Kinesis Replay',
34
- 'Reconciliation Report',
35
- 'Migration Count Report',
36
- 'Data Migration',
37
- ]));
38
- };
39
- //# sourceMappingURL=20210727104740_alter_async_operations_table_operation_type.js.map