@cumulus/message 13.3.3-alpha.1 → 14.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/Granules.d.ts +1 -2
- package/Granules.d.ts.map +1 -1
- package/Granules.js +23 -9
- package/Granules.js.map +1 -1
- package/package.json +7 -7
- package/src/Granules.ts +22 -11
- package/tsconfig.tsbuildinfo +1 -1
package/Granules.d.ts
CHANGED
|
@@ -101,12 +101,11 @@ export declare const getGranuleCmrTemporalInfo: ({ granule, cmrTemporalInfo, cmr
|
|
|
101
101
|
*
|
|
102
102
|
* @alias module:Granules
|
|
103
103
|
*/
|
|
104
|
-
export declare const generateGranuleApiRecord: ({ granule, executionUrl, collectionId, provider,
|
|
104
|
+
export declare const generateGranuleApiRecord: ({ granule, executionUrl, collectionId, provider, error, pdrName, status, queryFields, updatedAt, files, processingTimeInfo, cmrUtils, timestamp, duration, productVolume, timeToPreprocess, timeToArchive, cmrTemporalInfo, }: {
|
|
105
105
|
granule: MessageGranule;
|
|
106
106
|
executionUrl?: string | undefined;
|
|
107
107
|
collectionId: string;
|
|
108
108
|
provider?: string | undefined;
|
|
109
|
-
workflowStartTime: number;
|
|
110
109
|
error?: Object | undefined;
|
|
111
110
|
pdrName?: string | undefined;
|
|
112
111
|
status: GranuleStatus;
|
package/Granules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Granules.d.ts","sourceRoot":"","sources":["src/Granules.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;A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TemporalInfo = exports.g
|
|
|
12
12
|
* const Granules = require('@cumulus/message/Granules');
|
|
13
13
|
*/
|
|
14
14
|
const isInteger_1 = __importDefault(require("lodash/isInteger"));
|
|
15
|
-
const
|
|
15
|
+
const isUndefined_1 = __importDefault(require("lodash/isUndefined"));
|
|
16
16
|
const mapValues_1 = __importDefault(require("lodash/mapValues"));
|
|
17
17
|
const omitBy_1 = __importDefault(require("lodash/omitBy"));
|
|
18
18
|
const errors_1 = require("@cumulus/errors");
|
|
@@ -90,6 +90,18 @@ function isProcessingTimeInfo(info = {}) {
|
|
|
90
90
|
return (info === null || info === void 0 ? void 0 : info.processingStartDateTime) !== undefined
|
|
91
91
|
&& (info === null || info === void 0 ? void 0 : info.processingEndDateTime) !== undefined;
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* ** Private **
|
|
95
|
+
* Convert date string to standard ISO format, retaining null values if they exist
|
|
96
|
+
*
|
|
97
|
+
* @param {string} date - Date string, possibly in multiple formats
|
|
98
|
+
* @returns {string} Standardized ISO date string
|
|
99
|
+
*/
|
|
100
|
+
const convertDateToISOStringPreservingNull = (date) => {
|
|
101
|
+
if (date === null)
|
|
102
|
+
return null;
|
|
103
|
+
return convertDateToISOString(date);
|
|
104
|
+
};
|
|
93
105
|
/**
|
|
94
106
|
* Convert granule processing timestamps to a standardized ISO string
|
|
95
107
|
* format for compatibility across database systems.
|
|
@@ -102,7 +114,7 @@ const getGranuleProcessingTimeInfo = (processingTimeInfo) => {
|
|
|
102
114
|
const updatedProcessingTimeInfo = isProcessingTimeInfo(processingTimeInfo)
|
|
103
115
|
? { ...processingTimeInfo }
|
|
104
116
|
: {};
|
|
105
|
-
return (0, mapValues_1.default)(updatedProcessingTimeInfo,
|
|
117
|
+
return (0, mapValues_1.default)(updatedProcessingTimeInfo, convertDateToISOStringPreservingNull);
|
|
106
118
|
};
|
|
107
119
|
exports.getGranuleProcessingTimeInfo = getGranuleProcessingTimeInfo;
|
|
108
120
|
function isGranuleTemporalInfo(info = {}) {
|
|
@@ -129,7 +141,7 @@ const getGranuleCmrTemporalInfo = async ({ granule, cmrTemporalInfo, cmrUtils, }
|
|
|
129
141
|
const temporalInfo = isGranuleTemporalInfo(cmrTemporalInfo)
|
|
130
142
|
? { ...cmrTemporalInfo }
|
|
131
143
|
: await cmrUtils.getGranuleTemporalInfo(granule);
|
|
132
|
-
return (0, mapValues_1.default)(temporalInfo,
|
|
144
|
+
return (0, mapValues_1.default)(temporalInfo, convertDateToISOStringPreservingNull);
|
|
133
145
|
};
|
|
134
146
|
exports.getGranuleCmrTemporalInfo = getGranuleCmrTemporalInfo;
|
|
135
147
|
/**
|
|
@@ -140,18 +152,20 @@ exports.getGranuleCmrTemporalInfo = getGranuleCmrTemporalInfo;
|
|
|
140
152
|
*
|
|
141
153
|
* @alias module:Granules
|
|
142
154
|
*/
|
|
143
|
-
const generateGranuleApiRecord = async ({ granule, executionUrl, collectionId, provider,
|
|
155
|
+
const generateGranuleApiRecord = async ({ granule, executionUrl, collectionId, provider, error, pdrName, status, queryFields, updatedAt, files, processingTimeInfo, cmrUtils, timestamp, duration, productVolume, timeToPreprocess, timeToArchive, cmrTemporalInfo, }) => {
|
|
144
156
|
if (!granule.granuleId)
|
|
145
157
|
throw new errors_1.CumulusMessageError(`Could not create granule record, invalid granuleId: ${granule.granuleId}`);
|
|
146
158
|
if (!collectionId) {
|
|
147
159
|
throw new errors_1.CumulusMessageError('collectionId required to generate a granule record');
|
|
148
160
|
}
|
|
149
|
-
//
|
|
150
|
-
// RDS Phase 3 should revise logic to accept an explict null value
|
|
161
|
+
// null should not be supported in generated API records
|
|
151
162
|
if (files === null) {
|
|
152
163
|
throw new errors_1.CumulusMessageError('granule.files must not be null');
|
|
153
164
|
}
|
|
154
|
-
|
|
165
|
+
if (error === null) {
|
|
166
|
+
throw new errors_1.CumulusMessageError('granule.error must not be null');
|
|
167
|
+
}
|
|
168
|
+
const { granuleId, cmrLink, published, createdAt, } = granule;
|
|
155
169
|
const now = Date.now();
|
|
156
170
|
const recordUpdatedAt = updatedAt !== null && updatedAt !== void 0 ? updatedAt : now;
|
|
157
171
|
const recordTimestamp = timestamp !== null && timestamp !== void 0 ? timestamp : now;
|
|
@@ -173,7 +187,7 @@ const generateGranuleApiRecord = async ({ granule, executionUrl, collectionId, p
|
|
|
173
187
|
files,
|
|
174
188
|
error,
|
|
175
189
|
published,
|
|
176
|
-
createdAt
|
|
190
|
+
createdAt,
|
|
177
191
|
timestamp: recordTimestamp,
|
|
178
192
|
updatedAt: recordUpdatedAt,
|
|
179
193
|
duration,
|
|
@@ -184,7 +198,7 @@ const generateGranuleApiRecord = async ({ granule, executionUrl, collectionId, p
|
|
|
184
198
|
...temporalInfo,
|
|
185
199
|
queryFields,
|
|
186
200
|
};
|
|
187
|
-
return (0, omitBy_1.default)(record,
|
|
201
|
+
return (0, omitBy_1.default)(record, isUndefined_1.default);
|
|
188
202
|
};
|
|
189
203
|
exports.generateGranuleApiRecord = generateGranuleApiRecord;
|
|
190
204
|
//# sourceMappingURL=Granules.js.map
|
package/Granules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Granules.js","sourceRoot":"","sources":["src/Granules.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAEb;;;;;;GAMG;AAEH,iEAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"Granules.js","sourceRoot":"","sources":["src/Granules.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAEb;;;;;;GAMG;AAEH,iEAAyC;AACzC,qEAA6C;AAC7C,iEAAyC;AACzC,2DAAmC;AAEnC,4CAAsD;AA0BtD;;;;;;;;GAQG;AACI,MAAM,kBAAkB,GAAG,CAChC,OAA4B,EACjB,EAAE,eAAC,OAAA,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,QAAQ,mCAAI,EAAE,CAAA,EAAA,CAAC;AAFnC,QAAA,kBAAkB,sBAEiB;AAEhD;;;;;;;GAOG;AACI,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AC;IAEZ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,eAAe,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CAAC;IACzC,MAAM,eAAe,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CAAC;IAEzC,uBAAuB;IACvB,MAAM,YAAY,GAAG,MAAM,IAAA,iCAAyB,EAAC;QACnD,OAAO;QACP,eAAe;QACf,QAAQ;KACT,CAAC,CAAC;IACH,MAAM,yBAAyB,GAAG,IAAA,oCAA4B,EAAC,kBAAkB,CAAC,CAAC;IAEnF,MAAM,MAAM,GAAG;QACb,SAAS;QACT,OAAO;QACP,YAAY;QACZ,MAAM;QACN,QAAQ;QACR,SAAS,EAAE,YAAY;QACvB,OAAO;QACP,KAAK;QACL,KAAK;QACL,SAAS;QACT,SAAS;QACT,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,eAAe;QAC1B,QAAQ;QACR,aAAa;QACb,gBAAgB;QAChB,aAAa;QACb,GAAG,yBAAyB;QAC5B,GAAG,YAAY;QACf,WAAW;KACZ,CAAC;IAEF,OAAmB,IAAA,gBAAM,EAAC,MAAM,EAAE,qBAAW,CAAC,CAAC;AACjD,CAAC,CAAC;AA/FW,QAAA,wBAAwB,4BA+FnC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cumulus/message",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0",
|
|
4
4
|
"description": "Utilities for building and parsing Cumulus messages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"GIBS",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"author": "Cumulus Authors",
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cumulus/aws-client": "
|
|
42
|
-
"@cumulus/common": "
|
|
43
|
-
"@cumulus/errors": "
|
|
44
|
-
"@cumulus/logger": "
|
|
45
|
-
"@cumulus/types": "
|
|
41
|
+
"@cumulus/aws-client": "14.0.0",
|
|
42
|
+
"@cumulus/common": "14.0.0",
|
|
43
|
+
"@cumulus/errors": "14.0.0",
|
|
44
|
+
"@cumulus/logger": "14.0.0",
|
|
45
|
+
"@cumulus/types": "14.0.0",
|
|
46
46
|
"jsonpath-plus": "^3.0.0",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
48
|
"uuid": "^8.2.0"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/uuid": "^8.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "bc0cd0857e007b64e4e8809f7de16a4aeb1e6840"
|
|
54
54
|
}
|
package/src/Granules.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import isInteger from 'lodash/isInteger';
|
|
12
|
-
import
|
|
12
|
+
import isUndefined from 'lodash/isUndefined';
|
|
13
13
|
import mapValues from 'lodash/mapValues';
|
|
14
14
|
import omitBy from 'lodash/omitBy';
|
|
15
15
|
|
|
@@ -129,6 +129,18 @@ function isProcessingTimeInfo(
|
|
|
129
129
|
&& (info as ExecutionProcessingTimes)?.processingEndDateTime !== undefined;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* ** Private **
|
|
134
|
+
* Convert date string to standard ISO format, retaining null values if they exist
|
|
135
|
+
*
|
|
136
|
+
* @param {string} date - Date string, possibly in multiple formats
|
|
137
|
+
* @returns {string} Standardized ISO date string
|
|
138
|
+
*/
|
|
139
|
+
const convertDateToISOStringPreservingNull = (date: string | null) => {
|
|
140
|
+
if (date === null) return null;
|
|
141
|
+
return convertDateToISOString(date);
|
|
142
|
+
};
|
|
143
|
+
|
|
132
144
|
/**
|
|
133
145
|
* Convert granule processing timestamps to a standardized ISO string
|
|
134
146
|
* format for compatibility across database systems.
|
|
@@ -145,7 +157,7 @@ export const getGranuleProcessingTimeInfo = (
|
|
|
145
157
|
: {};
|
|
146
158
|
return mapValues(
|
|
147
159
|
updatedProcessingTimeInfo,
|
|
148
|
-
|
|
160
|
+
convertDateToISOStringPreservingNull
|
|
149
161
|
);
|
|
150
162
|
};
|
|
151
163
|
|
|
@@ -186,7 +198,7 @@ export const getGranuleCmrTemporalInfo = async ({
|
|
|
186
198
|
: await cmrUtils.getGranuleTemporalInfo(granule);
|
|
187
199
|
return mapValues(
|
|
188
200
|
temporalInfo,
|
|
189
|
-
|
|
201
|
+
convertDateToISOStringPreservingNull
|
|
190
202
|
);
|
|
191
203
|
};
|
|
192
204
|
|
|
@@ -203,7 +215,6 @@ export const generateGranuleApiRecord = async ({
|
|
|
203
215
|
executionUrl,
|
|
204
216
|
collectionId,
|
|
205
217
|
provider,
|
|
206
|
-
workflowStartTime,
|
|
207
218
|
error,
|
|
208
219
|
pdrName,
|
|
209
220
|
status,
|
|
@@ -223,7 +234,6 @@ export const generateGranuleApiRecord = async ({
|
|
|
223
234
|
executionUrl?: string,
|
|
224
235
|
collectionId: string,
|
|
225
236
|
provider?: string,
|
|
226
|
-
workflowStartTime: number,
|
|
227
237
|
error?: Object,
|
|
228
238
|
pdrName?: string,
|
|
229
239
|
status: GranuleStatus,
|
|
@@ -240,21 +250,22 @@ export const generateGranuleApiRecord = async ({
|
|
|
240
250
|
timeToArchive: number,
|
|
241
251
|
}): Promise<ApiGranule> => {
|
|
242
252
|
if (!granule.granuleId) throw new CumulusMessageError(`Could not create granule record, invalid granuleId: ${granule.granuleId}`);
|
|
243
|
-
|
|
244
253
|
if (!collectionId) {
|
|
245
254
|
throw new CumulusMessageError('collectionId required to generate a granule record');
|
|
246
255
|
}
|
|
247
256
|
|
|
248
|
-
//
|
|
249
|
-
// RDS Phase 3 should revise logic to accept an explict null value
|
|
257
|
+
// null should not be supported in generated API records
|
|
250
258
|
if (files === null) {
|
|
251
259
|
throw new CumulusMessageError('granule.files must not be null');
|
|
252
260
|
}
|
|
261
|
+
if (error === null) {
|
|
262
|
+
throw new CumulusMessageError('granule.error must not be null');
|
|
263
|
+
}
|
|
253
264
|
|
|
254
265
|
const {
|
|
255
266
|
granuleId,
|
|
256
267
|
cmrLink,
|
|
257
|
-
published
|
|
268
|
+
published,
|
|
258
269
|
createdAt,
|
|
259
270
|
} = granule;
|
|
260
271
|
|
|
@@ -281,7 +292,7 @@ export const generateGranuleApiRecord = async ({
|
|
|
281
292
|
files,
|
|
282
293
|
error,
|
|
283
294
|
published,
|
|
284
|
-
createdAt
|
|
295
|
+
createdAt,
|
|
285
296
|
timestamp: recordTimestamp,
|
|
286
297
|
updatedAt: recordUpdatedAt,
|
|
287
298
|
duration,
|
|
@@ -293,5 +304,5 @@ export const generateGranuleApiRecord = async ({
|
|
|
293
304
|
queryFields,
|
|
294
305
|
};
|
|
295
306
|
|
|
296
|
-
return <ApiGranule>omitBy(record,
|
|
307
|
+
return <ApiGranule>omitBy(record, isUndefined);
|
|
297
308
|
};
|