@cumulus/db 14.0.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +15 -20
- package/dist/lib/execution.js +1 -1
- package/dist/lib/granule.d.ts +5 -3
- package/dist/lib/granule.js +1 -1
- package/dist/models/base.d.ts +4 -4
- package/dist/models/base.js +6 -7
- package/dist/models/collection.d.ts +1 -1
- package/dist/models/execution.d.ts +1 -1
- package/dist/models/granule.d.ts +2 -2
- package/dist/models/granule.js +2 -4
- package/dist/models/granules-executions.js +2 -1
- package/dist/models/provider.d.ts +2 -2
- package/dist/models/rule.d.ts +2 -2
- package/dist/test-utils.d.ts +2 -2
- package/dist/translate/executions.js +1 -2
- package/dist/translate/granules.d.ts +1 -1
- package/dist/translate/granules.js +9 -10
- package/package.json +10 -10
package/dist/config.js
CHANGED
|
@@ -16,7 +16,6 @@ exports.localStackConnectionEnv = {
|
|
|
16
16
|
const isKnexDebugEnabled = (env = {}) => env.KNEX_DEBUG === 'true';
|
|
17
17
|
exports.isKnexDebugEnabled = isKnexDebugEnabled;
|
|
18
18
|
const getSecretConnectionConfig = async (SecretId, secretsManager) => {
|
|
19
|
-
var _a;
|
|
20
19
|
const response = await secretsManager.getSecretValue({ SecretId }).promise();
|
|
21
20
|
if (response.SecretString === undefined) {
|
|
22
21
|
throw new Error(`AWS Secret did not contain a stored value: ${SecretId}`);
|
|
@@ -32,20 +31,17 @@ const getSecretConnectionConfig = async (SecretId, secretsManager) => {
|
|
|
32
31
|
user: dbAccessMeta.username,
|
|
33
32
|
password: dbAccessMeta.password,
|
|
34
33
|
database: dbAccessMeta.database,
|
|
35
|
-
port:
|
|
34
|
+
port: dbAccessMeta.port ?? 5432,
|
|
36
35
|
};
|
|
37
36
|
};
|
|
38
37
|
exports.getSecretConnectionConfig = getSecretConnectionConfig;
|
|
39
|
-
const getConnectionConfigEnv = (env) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
port: Number.parseInt((_a = env.PG_PORT) !== null && _a !== void 0 ? _a : '5432', 10),
|
|
47
|
-
});
|
|
48
|
-
};
|
|
38
|
+
const getConnectionConfigEnv = (env) => ({
|
|
39
|
+
host: common_1.envUtils.getRequiredEnvVar('PG_HOST', env),
|
|
40
|
+
user: common_1.envUtils.getRequiredEnvVar('PG_USER', env),
|
|
41
|
+
password: common_1.envUtils.getRequiredEnvVar('PG_PASSWORD', env),
|
|
42
|
+
database: common_1.envUtils.getRequiredEnvVar('PG_DATABASE', env),
|
|
43
|
+
port: Number.parseInt(env.PG_PORT ?? '5432', 10),
|
|
44
|
+
});
|
|
49
45
|
exports.getConnectionConfigEnv = getConnectionConfigEnv;
|
|
50
46
|
/**
|
|
51
47
|
* Return configuration to make a database connection.
|
|
@@ -108,7 +104,6 @@ exports.getConnectionConfig = getConnectionConfig;
|
|
|
108
104
|
* @returns {Promise<Knex.Config>} a Knex configuration object
|
|
109
105
|
*/
|
|
110
106
|
const getKnexConfig = async ({ env = process.env, secretsManager = new aws_sdk_1.default.SecretsManager(), } = {}) => {
|
|
111
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
112
107
|
const knexConfig = {
|
|
113
108
|
client: 'pg',
|
|
114
109
|
connection: await (0, exports.getConnectionConfig)({ env, secretsManager }),
|
|
@@ -116,16 +111,16 @@ const getKnexConfig = async ({ env = process.env, secretsManager = new aws_sdk_1
|
|
|
116
111
|
asyncStackTraces: env.KNEX_ASYNC_STACK_TRACES === 'true',
|
|
117
112
|
pool: {
|
|
118
113
|
min: 0,
|
|
119
|
-
max: Number.parseInt(
|
|
120
|
-
idleTimeoutMillis: Number.parseInt(
|
|
114
|
+
max: Number.parseInt(env.dbMaxPool ?? '2', 10),
|
|
115
|
+
idleTimeoutMillis: Number.parseInt(env.idleTimeoutMillis ?? '1000', 10),
|
|
121
116
|
// ts-ignore as https://github.com/knex/knex/blob/master/types/index.d.ts#L1886
|
|
122
117
|
// is improperly typed.
|
|
123
118
|
//@ts-ignore
|
|
124
|
-
acquireTimeoutMillis: Number.parseInt(
|
|
125
|
-
createRetryIntervalMillis: Number.parseInt(
|
|
126
|
-
createTimeoutMillis: Number.parseInt(
|
|
127
|
-
destroyTimeoutMillis: Number.parseInt(
|
|
128
|
-
reapIntervalMillis: Number.parseInt(
|
|
119
|
+
acquireTimeoutMillis: Number.parseInt(env.acquireTimeoutMillis ?? '90000', 10),
|
|
120
|
+
createRetryIntervalMillis: Number.parseInt(env.createRetryIntervalMillis ?? '30000', 10),
|
|
121
|
+
createTimeoutMillis: Number.parseInt(env.createTimeoutMillis ?? '20000', 10),
|
|
122
|
+
destroyTimeoutMillis: Number.parseInt(env.destroyTimeoutMillis ?? '5000', 10),
|
|
123
|
+
reapIntervalMillis: Number.parseInt(env.reapIntervalMillis ?? '1000', 10),
|
|
129
124
|
propagateCreateError: false,
|
|
130
125
|
},
|
|
131
126
|
};
|
package/dist/lib/execution.js
CHANGED
|
@@ -87,7 +87,7 @@ exports.executionArnsFromGranuleIdsAndWorkflowNames = executionArnsFromGranuleId
|
|
|
87
87
|
*/
|
|
88
88
|
const newestExecutionArnFromGranuleIdWorkflowName = async (granuleId, workflowName, testKnex) => {
|
|
89
89
|
try {
|
|
90
|
-
const knex = testKnex
|
|
90
|
+
const knex = testKnex ?? await getKnexClient({ env: process.env });
|
|
91
91
|
const executions = await (0, exports.executionArnsFromGranuleIdsAndWorkflowNames)(knex, [granuleId], [workflowName]);
|
|
92
92
|
if (executions.length === 0) {
|
|
93
93
|
throw new errors_1.RecordDoesNotExist(`No executionArns found for granuleId:${granuleId} running workflow:${workflowName}`);
|
package/dist/lib/granule.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { GranulePgModel } from '../models/granule';
|
|
|
4
4
|
import { GranulesExecutionsPgModel } from '../models/granules-executions';
|
|
5
5
|
import { PostgresGranule, PostgresGranuleRecord } from '../types/granule';
|
|
6
6
|
import { UpdatedAtRange } from '../types/record';
|
|
7
|
-
export declare const getGranuleCollectionId: (knexOrTransaction: Knex
|
|
7
|
+
export declare const getGranuleCollectionId: (knexOrTransaction: Knex, granule: {
|
|
8
|
+
collection_cumulus_id: number;
|
|
9
|
+
}) => Promise<string>;
|
|
8
10
|
/**
|
|
9
11
|
* Upsert a granule and a record in the granules/executions join table.
|
|
10
12
|
*
|
|
@@ -89,7 +91,7 @@ export declare const getGranulesByApiPropertiesQuery: (knex: Knex, { collectionI
|
|
|
89
91
|
*
|
|
90
92
|
* @param {Knex | Knex.Transaction} knexOrTransaction - DB client or transaction
|
|
91
93
|
* @param {string} granuleId - Granule ID
|
|
92
|
-
* @returns {Promise<
|
|
94
|
+
* @returns {Promise<PostgresGranuleRecord[]>} The returned list of records
|
|
93
95
|
*/
|
|
94
|
-
export declare const getGranulesByGranuleId: (knexOrTransaction: Knex | Knex.Transaction, granuleId: string) => Promise<
|
|
96
|
+
export declare const getGranulesByGranuleId: (knexOrTransaction: Knex | Knex.Transaction, granuleId: string) => Promise<PostgresGranuleRecord[]>;
|
|
95
97
|
//# sourceMappingURL=granule.d.ts.map
|
package/dist/lib/granule.js
CHANGED
|
@@ -187,7 +187,7 @@ exports.getGranulesByApiPropertiesQuery = getGranulesByApiPropertiesQuery;
|
|
|
187
187
|
*
|
|
188
188
|
* @param {Knex | Knex.Transaction} knexOrTransaction - DB client or transaction
|
|
189
189
|
* @param {string} granuleId - Granule ID
|
|
190
|
-
* @returns {Promise<
|
|
190
|
+
* @returns {Promise<PostgresGranuleRecord[]>} The returned list of records
|
|
191
191
|
*/
|
|
192
192
|
const getGranulesByGranuleId = async (knexOrTransaction, granuleId) => {
|
|
193
193
|
const { granules: granulesTable, } = TableNames;
|
package/dist/models/base.d.ts
CHANGED
|
@@ -88,8 +88,8 @@ declare class BasePgModel<ItemType, RecordType extends BaseRecord> {
|
|
|
88
88
|
* @param {ItemType} item - A record to insert into the DB
|
|
89
89
|
* @param {string | Array<string>} returningFields - A string or array of strings
|
|
90
90
|
* of columns to return. Defaults to 'cumulus_id'.
|
|
91
|
-
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
92
|
-
*
|
|
91
|
+
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
92
|
+
* from the specified column(s) from returningFields.
|
|
93
93
|
*/
|
|
94
94
|
create(knexOrTransaction: Knex | Knex.Transaction, item: ItemType, returningFields?: string | string[]): Promise<unknown[] | Object[]>;
|
|
95
95
|
/**
|
|
@@ -99,8 +99,8 @@ declare class BasePgModel<ItemType, RecordType extends BaseRecord> {
|
|
|
99
99
|
* @param {ItemType[]} items - Records to insert into the DB
|
|
100
100
|
* @param {string | Array<string>} returningFields - A string or array of strings
|
|
101
101
|
* of columns to return. Defaults to 'cumulus_id'.
|
|
102
|
-
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
103
|
-
*
|
|
102
|
+
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
103
|
+
* from the specified column(s) from returningFields.
|
|
104
104
|
*/
|
|
105
105
|
insert(knexOrTransaction: Knex | Knex.Transaction, items: ItemType[], returningFields?: string | string[]): Promise<unknown[] | Object[]>;
|
|
106
106
|
/**
|
package/dist/models/base.js
CHANGED
|
@@ -17,12 +17,11 @@ class BasePgModel {
|
|
|
17
17
|
*/
|
|
18
18
|
async searchWithUpdatedAtRange(knexOrTransaction, params, updatedAtParams) {
|
|
19
19
|
const records = await knexOrTransaction(this.tableName).where((builder) => {
|
|
20
|
-
var _a, _b;
|
|
21
20
|
builder.where(params);
|
|
22
21
|
if (updatedAtParams.updatedAtFrom || updatedAtParams.updatedAtTo) {
|
|
23
22
|
builder.whereBetween('updated_at', [
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
updatedAtParams?.updatedAtFrom ?? new Date(0),
|
|
24
|
+
updatedAtParams?.updatedAtTo ?? new Date(),
|
|
26
25
|
]);
|
|
27
26
|
}
|
|
28
27
|
});
|
|
@@ -155,8 +154,8 @@ class BasePgModel {
|
|
|
155
154
|
* @param {ItemType} item - A record to insert into the DB
|
|
156
155
|
* @param {string | Array<string>} returningFields - A string or array of strings
|
|
157
156
|
* of columns to return. Defaults to 'cumulus_id'.
|
|
158
|
-
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
159
|
-
*
|
|
157
|
+
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
158
|
+
* from the specified column(s) from returningFields.
|
|
160
159
|
*/
|
|
161
160
|
async create(knexOrTransaction, item, returningFields = 'cumulus_id') {
|
|
162
161
|
return await knexOrTransaction(this.tableName)
|
|
@@ -170,8 +169,8 @@ class BasePgModel {
|
|
|
170
169
|
* @param {ItemType[]} items - Records to insert into the DB
|
|
171
170
|
* @param {string | Array<string>} returningFields - A string or array of strings
|
|
172
171
|
* of columns to return. Defaults to 'cumulus_id'.
|
|
173
|
-
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
174
|
-
*
|
|
172
|
+
* @returns {Promise<unknown[] | Object[]>} Returns an array of objects
|
|
173
|
+
* from the specified column(s) from returningFields.
|
|
175
174
|
*/
|
|
176
175
|
async insert(knexOrTransaction, items, returningFields = 'cumulus_id') {
|
|
177
176
|
return await knexOrTransaction(this.tableName)
|
|
@@ -3,7 +3,7 @@ import { BasePgModel } from './base';
|
|
|
3
3
|
import { PostgresCollection, PostgresCollectionRecord } from '../types/collection';
|
|
4
4
|
declare class CollectionPgModel extends BasePgModel<PostgresCollection, PostgresCollectionRecord> {
|
|
5
5
|
constructor();
|
|
6
|
-
create(knexOrTransaction: Knex | Knex.Transaction, item: PostgresCollection): Promise<
|
|
6
|
+
create(knexOrTransaction: Knex | Knex.Transaction, item: PostgresCollection): Promise<unknown[] | Object[]>;
|
|
7
7
|
upsert(knexOrTransaction: Knex | Knex.Transaction, collection: PostgresCollection): Knex.QueryBuilder<any, {
|
|
8
8
|
_base: any;
|
|
9
9
|
_hasSelection: false;
|
|
@@ -4,7 +4,7 @@ import { PostgresExecution, PostgresExecutionRecord } from '../types/execution';
|
|
|
4
4
|
declare class ExecutionPgModel extends BasePgModel<PostgresExecution, PostgresExecutionRecord> {
|
|
5
5
|
constructor();
|
|
6
6
|
static nonActiveStatuses: string[];
|
|
7
|
-
create(knexOrTransaction: Knex | Knex.Transaction, item: PostgresExecution): Promise<
|
|
7
|
+
create(knexOrTransaction: Knex | Knex.Transaction, item: PostgresExecution): Promise<unknown[] | Object[]>;
|
|
8
8
|
upsert(knexOrTrx: Knex | Knex.Transaction, execution: PostgresExecution): Promise<any[]>;
|
|
9
9
|
/**
|
|
10
10
|
* Get executions from the execution cumulus_id
|
package/dist/models/granule.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ interface RecordSelect {
|
|
|
7
7
|
}
|
|
8
8
|
export default class GranulePgModel extends BasePgModel<PostgresGranule, PostgresGranuleRecord> {
|
|
9
9
|
constructor();
|
|
10
|
-
create(knexOrTransaction: Knex | Knex.Transaction, item: PostgresGranule): Promise<
|
|
10
|
+
create(knexOrTransaction: Knex | Knex.Transaction, item: PostgresGranule): Promise<unknown[] | Object[]>;
|
|
11
11
|
/**
|
|
12
12
|
* Deletes the item from Postgres
|
|
13
13
|
*
|
|
@@ -52,7 +52,7 @@ export default class GranulePgModel extends BasePgModel<PostgresGranule, Postgre
|
|
|
52
52
|
executionCumulusId?: number;
|
|
53
53
|
executionPgModel?: ExecutionPgModel;
|
|
54
54
|
writeConstraints: boolean;
|
|
55
|
-
}): Promise<
|
|
55
|
+
}): Promise<PostgresGranuleRecord[]>;
|
|
56
56
|
/**
|
|
57
57
|
* Get granules from the granule cumulus_id
|
|
58
58
|
*
|
package/dist/models/granule.js
CHANGED
|
@@ -107,8 +107,7 @@ class GranulePgModel extends base_1.BasePgModel {
|
|
|
107
107
|
// exist at all
|
|
108
108
|
upsertQuery.whereNotExists(exclusionClause);
|
|
109
109
|
}
|
|
110
|
-
upsertQuery.returning('*');
|
|
111
|
-
return await upsertQuery;
|
|
110
|
+
return await upsertQuery.returning('*');
|
|
112
111
|
}
|
|
113
112
|
const upsertQuery = knexOrTrx(this.tableName)
|
|
114
113
|
.insert(granule)
|
|
@@ -120,8 +119,7 @@ class GranulePgModel extends base_1.BasePgModel {
|
|
|
120
119
|
}
|
|
121
120
|
upsertQuery.where(knexOrTrx.raw(`${this.tableName}.created_at <= to_timestamp(${(0, timestamp_1.translateDateToUTC)(granule.created_at)})`));
|
|
122
121
|
}
|
|
123
|
-
upsertQuery.returning('*');
|
|
124
|
-
return await upsertQuery;
|
|
122
|
+
return await upsertQuery.returning('*');
|
|
125
123
|
}
|
|
126
124
|
/**
|
|
127
125
|
* Get granules from the granule cumulus_id
|
|
@@ -19,7 +19,8 @@ class GranulesExecutionsPgModel {
|
|
|
19
19
|
return await knexTransaction(this.tableName)
|
|
20
20
|
.insert(item)
|
|
21
21
|
.onConflict(['granule_cumulus_id', 'execution_cumulus_id'])
|
|
22
|
-
.merge()
|
|
22
|
+
.merge()
|
|
23
|
+
.returning('*');
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Get execution_cumulus_id column values from the granule_cumulus_id
|
|
@@ -6,9 +6,9 @@ declare class ProviderPgModel extends BasePgModel<PostgresProvider, PostgresProv
|
|
|
6
6
|
upsert(knexOrTransaction: Knex | Knex.Transaction, provider: PostgresProvider): Knex.QueryBuilder<any, {
|
|
7
7
|
_base: any;
|
|
8
8
|
_hasSelection: true;
|
|
9
|
-
_keys: "
|
|
9
|
+
_keys: "cumulus_id";
|
|
10
10
|
_aliases: {};
|
|
11
|
-
_single:
|
|
11
|
+
_single: false;
|
|
12
12
|
_intersectProps: {};
|
|
13
13
|
_unionProps: never;
|
|
14
14
|
}[]>;
|
package/dist/models/rule.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ declare class RulePgModel extends BasePgModel<PostgresRule, PostgresRuleRecord>
|
|
|
6
6
|
upsert(knexOrTransaction: Knex | Knex.Transaction, rule: PostgresRule): Knex.QueryBuilder<any, {
|
|
7
7
|
_base: any;
|
|
8
8
|
_hasSelection: true;
|
|
9
|
-
_keys: "
|
|
9
|
+
_keys: "cumulus_id";
|
|
10
10
|
_aliases: {};
|
|
11
|
-
_single:
|
|
11
|
+
_single: false;
|
|
12
12
|
_intersectProps: {};
|
|
13
13
|
_unionProps: never;
|
|
14
14
|
}[]>;
|
package/dist/test-utils.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { PostgresRule } from './types/rule';
|
|
|
10
10
|
export declare const createTestDatabase: (knex: Knex, dbName: string, dbUser: string) => Promise<void>;
|
|
11
11
|
export declare const deleteTestDatabase: (knex: Knex, dbName: string) => Promise<any>;
|
|
12
12
|
export declare const generateLocalTestDb: (testDbName: string, migrationDir: string, envParams: object) => Promise<{
|
|
13
|
-
knex: Knex<any,
|
|
14
|
-
knexAdmin: Knex<any,
|
|
13
|
+
knex: Knex<any, any[]>;
|
|
14
|
+
knexAdmin: Knex<any, any[]>;
|
|
15
15
|
}>;
|
|
16
16
|
export declare const destroyLocalTestDb: ({ knex, knexAdmin, testDbName, }: {
|
|
17
17
|
knex: Knex;
|
|
@@ -12,7 +12,6 @@ const execution_1 = require("../models/execution");
|
|
|
12
12
|
const collection_1 = require("../models/collection");
|
|
13
13
|
const async_operation_1 = require("../models/async_operation");
|
|
14
14
|
const translatePostgresExecutionToApiExecution = async (executionRecord, knex, collectionPgModel = new collection_1.CollectionPgModel(), asyncOperationPgModel = new async_operation_1.AsyncOperationPgModel(), executionPgModel = new execution_1.ExecutionPgModel()) => {
|
|
15
|
-
var _a;
|
|
16
15
|
let parentArn;
|
|
17
16
|
let collectionId;
|
|
18
17
|
let asyncOperationId;
|
|
@@ -55,7 +54,7 @@ const translatePostgresExecutionToApiExecution = async (executionRecord, knex, c
|
|
|
55
54
|
parentArn,
|
|
56
55
|
createdAt: executionRecord.created_at.getTime(),
|
|
57
56
|
updatedAt: executionRecord.updated_at.getTime(),
|
|
58
|
-
timestamp:
|
|
57
|
+
timestamp: executionRecord.timestamp?.getTime(),
|
|
59
58
|
};
|
|
60
59
|
return (0, util_1.removeNilProperties)(translatedRecord);
|
|
61
60
|
};
|
|
@@ -25,7 +25,7 @@ import { PostgresProviderRecord } from '../types/provider';
|
|
|
25
25
|
export declare const translatePostgresGranuleToApiGranule: ({ granulePgRecord, collectionPgRecord, knexOrTransaction, providerPgRecord, collectionPgModel, pdrPgModel, providerPgModel, filePgModel, }: {
|
|
26
26
|
granulePgRecord: PostgresGranuleRecord;
|
|
27
27
|
knexOrTransaction: Knex | Knex.Transaction;
|
|
28
|
-
collectionPgRecord?: Pick<PostgresCollectionRecord, "
|
|
28
|
+
collectionPgRecord?: Pick<PostgresCollectionRecord, "version" | "name" | "cumulus_id"> | undefined;
|
|
29
29
|
providerPgRecord?: Pick<PostgresProviderRecord, "name"> | undefined;
|
|
30
30
|
collectionPgModel?: CollectionPgModel | undefined;
|
|
31
31
|
pdrPgModel?: PdrPgModel | undefined;
|
|
@@ -30,7 +30,6 @@ const file_2 = require("./file");
|
|
|
30
30
|
* @returns {Object} An API Granule with associated Files
|
|
31
31
|
*/
|
|
32
32
|
const translatePostgresGranuleToApiGranule = async ({ granulePgRecord, collectionPgRecord, knexOrTransaction, providerPgRecord, collectionPgModel = new collection_1.CollectionPgModel(), pdrPgModel = new pdr_1.PdrPgModel(), providerPgModel = new provider_1.ProviderPgModel(), filePgModel = new file_1.FilePgModel(), }) => {
|
|
33
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
34
33
|
const collection = collectionPgRecord || await collectionPgModel.get(knexOrTransaction, { cumulus_id: granulePgRecord.collection_cumulus_id });
|
|
35
34
|
if (granulePgRecord.collection_cumulus_id !== collection.cumulus_id) {
|
|
36
35
|
throw new errors_1.ValidationError(`Input collection.cumulus_id: ${collection.cumulus_id} does not match the granule PG record collection_cumulus_id: ${granulePgRecord.collection_cumulus_id}`);
|
|
@@ -54,30 +53,30 @@ const translatePostgresGranuleToApiGranule = async ({ granulePgRecord, collectio
|
|
|
54
53
|
provider = await providerPgModel.get(knexOrTransaction, { cumulus_id: granulePgRecord.provider_cumulus_id });
|
|
55
54
|
}
|
|
56
55
|
const apiGranule = (0, util_1.removeNilProperties)({
|
|
57
|
-
beginningDateTime:
|
|
56
|
+
beginningDateTime: granulePgRecord.beginning_date_time?.toISOString(),
|
|
58
57
|
cmrLink: granulePgRecord.cmr_link,
|
|
59
58
|
collectionId: (0, Collections_1.constructCollectionId)(collection.name, collection.version),
|
|
60
|
-
createdAt:
|
|
59
|
+
createdAt: granulePgRecord.created_at?.getTime(),
|
|
61
60
|
duration: granulePgRecord.duration,
|
|
62
|
-
endingDateTime:
|
|
61
|
+
endingDateTime: granulePgRecord.ending_date_time?.toISOString(),
|
|
63
62
|
error: granulePgRecord.error,
|
|
64
63
|
execution: executionUrls[0] ? executionUrls[0].url : undefined,
|
|
65
64
|
files: files.length > 0 ? files.map((file) => (0, file_2.translatePostgresFileToApiFile)(file)) : [],
|
|
66
65
|
granuleId: granulePgRecord.granule_id,
|
|
67
|
-
lastUpdateDateTime:
|
|
66
|
+
lastUpdateDateTime: granulePgRecord.last_update_date_time?.toISOString(),
|
|
68
67
|
pdrName: pdr ? pdr.name : undefined,
|
|
69
|
-
processingEndDateTime:
|
|
70
|
-
processingStartDateTime:
|
|
71
|
-
productionDateTime:
|
|
68
|
+
processingEndDateTime: granulePgRecord.processing_end_date_time?.toISOString(),
|
|
69
|
+
processingStartDateTime: granulePgRecord.processing_start_date_time?.toISOString(),
|
|
70
|
+
productionDateTime: granulePgRecord.production_date_time?.toISOString(),
|
|
72
71
|
productVolume: granulePgRecord.product_volume,
|
|
73
72
|
provider: provider ? provider.name : undefined,
|
|
74
73
|
published: granulePgRecord.published,
|
|
75
74
|
queryFields: granulePgRecord.query_fields,
|
|
76
75
|
status: granulePgRecord.status,
|
|
77
|
-
timestamp:
|
|
76
|
+
timestamp: granulePgRecord.timestamp?.getTime(),
|
|
78
77
|
timeToArchive: granulePgRecord.time_to_archive,
|
|
79
78
|
timeToPreprocess: granulePgRecord.time_to_process,
|
|
80
|
-
updatedAt:
|
|
79
|
+
updatedAt: granulePgRecord.updated_at?.getTime(),
|
|
81
80
|
});
|
|
82
81
|
return apiGranule;
|
|
83
82
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/db",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "Utilities for working with the Cumulus DB",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"timeout": "5m"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
29
|
+
"node": ">=16.19.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cumulus/aws-client": "
|
|
33
|
-
"@cumulus/common": "
|
|
34
|
-
"@cumulus/errors": "
|
|
35
|
-
"@cumulus/logger": "
|
|
36
|
-
"@cumulus/message": "
|
|
37
|
-
"@cumulus/types": "
|
|
32
|
+
"@cumulus/aws-client": "15.0.0",
|
|
33
|
+
"@cumulus/common": "15.0.0",
|
|
34
|
+
"@cumulus/errors": "15.0.0",
|
|
35
|
+
"@cumulus/logger": "15.0.0",
|
|
36
|
+
"@cumulus/message": "15.0.0",
|
|
37
|
+
"@cumulus/types": "15.0.0",
|
|
38
38
|
"crypto-random-string": "^3.2.0",
|
|
39
39
|
"is-valid-hostname": "1.0.2",
|
|
40
|
-
"knex": "
|
|
40
|
+
"knex": "2.4.1",
|
|
41
41
|
"lodash": "^4.17.21",
|
|
42
42
|
"pg": "^8.3.0",
|
|
43
43
|
"snake-camel": "^1.0.6",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/uuid": "^8.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "15986abef3ef23dc9ccefd31f219f78203dcd8db"
|
|
50
50
|
}
|