@cumulus/db 20.1.3-alpha.2 → 20.2.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/search/field-mapping.js +0 -3
- package/dist/test-utils.js +0 -1
- package/dist/translate/granules.js +1 -6
- package/dist/types/granule.d.ts +0 -2
- package/package.json +8 -8
- package/dist/migrations/20250425134823_granules_add_producer_granule_id.d.ts +0 -4
- package/dist/migrations/20250425134823_granules_add_producer_granule_id.js +0 -30
|
@@ -39,9 +39,6 @@ const granuleMapping = {
|
|
|
39
39
|
processingStartDateTime: (value) => ({
|
|
40
40
|
processing_start_date_time: value,
|
|
41
41
|
}),
|
|
42
|
-
producerGranuleId: (value) => ({
|
|
43
|
-
producer_granule_id: value,
|
|
44
|
-
}),
|
|
45
42
|
productionDateTime: (value) => ({
|
|
46
43
|
production_date_time: value,
|
|
47
44
|
}),
|
package/dist/test-utils.js
CHANGED
|
@@ -90,7 +90,6 @@ const fakeProviderRecordFactory = (params) => ({
|
|
|
90
90
|
exports.fakeProviderRecordFactory = fakeProviderRecordFactory;
|
|
91
91
|
const fakeGranuleRecordFactory = (params) => ({
|
|
92
92
|
granule_id: (0, crypto_random_string_1.default)({ length: 5 }),
|
|
93
|
-
producer_granule_id: (0, crypto_random_string_1.default)({ length: 5 }),
|
|
94
93
|
status: 'completed',
|
|
95
94
|
created_at: new Date(),
|
|
96
95
|
...params,
|
|
@@ -43,7 +43,6 @@ const translatePostgresGranuleToApiGranuleWithoutDbQuery = ({ granulePgRecord, c
|
|
|
43
43
|
pdrName: pdr ? pdr.name : undefined,
|
|
44
44
|
processingEndDateTime: granulePgRecord.processing_end_date_time?.toISOString(),
|
|
45
45
|
processingStartDateTime: granulePgRecord.processing_start_date_time?.toISOString(),
|
|
46
|
-
producerGranuleId: granulePgRecord.producer_granule_id,
|
|
47
46
|
productionDateTime: granulePgRecord.production_date_time?.toISOString(),
|
|
48
47
|
productVolume: granulePgRecord.product_volume,
|
|
49
48
|
provider: providerPgRecord ? providerPgRecord.name : undefined,
|
|
@@ -119,11 +118,8 @@ const validateApiToPostgresGranuleObject = (apiGranule) => {
|
|
|
119
118
|
if ((0, isNil_1.default)(apiGranule.granuleId)) {
|
|
120
119
|
throw new errors_1.ValidationError('granuleId cannot be undefined on a granule, granules must have a collection and a granule ID');
|
|
121
120
|
}
|
|
122
|
-
if ((0, isNil_1.default)(apiGranule.producerGranuleId)) {
|
|
123
|
-
throw new errors_1.ValidationError('producerGranuleId cannot be undefined on a granule, granules must have a producerGranuleId');
|
|
124
|
-
}
|
|
125
121
|
if ((0, isNull_1.default)(apiGranule.status)) {
|
|
126
|
-
throw new errors_1.ValidationError('status cannot be null on a granule, granules must have a
|
|
122
|
+
throw new errors_1.ValidationError('status cannot be null on a granule, granules must have a collection and a granule ID');
|
|
127
123
|
}
|
|
128
124
|
};
|
|
129
125
|
/**
|
|
@@ -166,7 +162,6 @@ const translateApiGranuleToPostgresGranuleWithoutNilsRemoved = async ({ dynamoRe
|
|
|
166
162
|
granule_id: dynamoRecord.granuleId,
|
|
167
163
|
status: dynamoRecord.status,
|
|
168
164
|
collection_cumulus_id: await collectionPgModel.getRecordCumulusId(knexOrTransaction, { name, version }),
|
|
169
|
-
producer_granule_id: dynamoRecord.producerGranuleId,
|
|
170
165
|
published: dynamoRecord.published,
|
|
171
166
|
duration: dynamoRecord.duration,
|
|
172
167
|
time_to_archive: dynamoRecord.timeToArchive,
|
package/dist/types/granule.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export interface PostgresGranuleUniqueColumns {
|
|
|
4
4
|
collection_cumulus_id: number;
|
|
5
5
|
}
|
|
6
6
|
export interface PostgresGranule extends PostgresGranuleUniqueColumns {
|
|
7
|
-
producer_granule_id: string;
|
|
8
7
|
status?: GranuleStatus;
|
|
9
8
|
cmr_link?: string | null;
|
|
10
9
|
error?: object | null;
|
|
@@ -28,7 +27,6 @@ export interface PostgresGranule extends PostgresGranuleUniqueColumns {
|
|
|
28
27
|
}
|
|
29
28
|
export interface PostgresGranuleRecord extends Omit<PostgresGranule, 'product_volume'> {
|
|
30
29
|
cumulus_id: number;
|
|
31
|
-
producer_granule_id: string;
|
|
32
30
|
product_volume?: string;
|
|
33
31
|
created_at: Date;
|
|
34
32
|
updated_at: Date;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/db",
|
|
3
|
-
"version": "20.1
|
|
3
|
+
"version": "20.2.1",
|
|
4
4
|
"description": "Utilities for working with the Cumulus DB",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@aws-sdk/client-secrets-manager": "^3.621.0",
|
|
36
|
-
"@cumulus/aws-client": "20.1
|
|
37
|
-
"@cumulus/common": "20.1
|
|
38
|
-
"@cumulus/errors": "20.1
|
|
39
|
-
"@cumulus/logger": "20.1
|
|
40
|
-
"@cumulus/message": "20.1
|
|
41
|
-
"@cumulus/types": "20.1
|
|
36
|
+
"@cumulus/aws-client": "20.2.1",
|
|
37
|
+
"@cumulus/common": "20.2.1",
|
|
38
|
+
"@cumulus/errors": "20.2.1",
|
|
39
|
+
"@cumulus/logger": "20.2.1",
|
|
40
|
+
"@cumulus/message": "20.2.1",
|
|
41
|
+
"@cumulus/types": "20.2.1",
|
|
42
42
|
"crypto-random-string": "^3.2.0",
|
|
43
43
|
"is-valid-hostname": "1.0.2",
|
|
44
44
|
"knex": "2.4.1",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/uuid": "^8.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "8aeab83b5fd9f7e1818d4631e1e36535e443ae90"
|
|
54
54
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.down = exports.up = void 0;
|
|
4
|
-
const up = async (knex) => {
|
|
5
|
-
if (!await knex.schema.hasColumn('granules', 'producer_granule_id')) {
|
|
6
|
-
await knex.schema.table('granules', (table) => {
|
|
7
|
-
table
|
|
8
|
-
.text('producer_granule_id')
|
|
9
|
-
.comment('Producer Granule Id');
|
|
10
|
-
});
|
|
11
|
-
await knex('granules').update('producer_granule_id', knex.raw('granule_id'));
|
|
12
|
-
await knex.schema.table('granules', (table) => {
|
|
13
|
-
table.text('producer_granule_id').notNullable().alter();
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
await knex.raw('CREATE INDEX CONCURRENTLY IF NOT EXISTS granules_producer_granule_id_index ON granules(producer_granule_id)');
|
|
17
|
-
};
|
|
18
|
-
exports.up = up;
|
|
19
|
-
const down = async (knex) => {
|
|
20
|
-
if (await knex.schema.hasColumn('granules', 'producer_granule_id')) {
|
|
21
|
-
await knex.schema.table('granules', (table) => {
|
|
22
|
-
table.dropColumn('producer_granule_id');
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.down = down;
|
|
27
|
-
exports.config = {
|
|
28
|
-
transaction: false,
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=20250425134823_granules_add_producer_granule_id.js.map
|