Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/1859 re-retrieve dataExtract after deploy to include created and modified dates #1962

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions @types/lib/metadataTypes/DataExtract.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/DataExtract.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions lib/metadataTypes/DataExtract.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,23 @@ class DataExtract extends MetadataType {
delete metadata.r__dataExtractType_name;
return metadata;
}
/**
* Gets executed after deployment of metadata type
*
* @param {MetadataTypeMap} upsertResults metadata mapped by their keyField as returned by update/create
* @returns {Promise.<void>} -
*/
static async postDeployTasks(upsertResults) {
// re-retrieve all upserted items to ensure we have all fields (createdDate and modifiedDate are otherwise not present)
Util.logger.debug('Retrieving all dataExtracts post-deploy to ensure we have all fields');
const typeCache = await this.retrieveForCache();
// update values in upsertResults with retrieved values before saving to disk
for (const key of Object.keys(upsertResults)) {
if (typeCache.metadata[key]) {
upsertResults[key] = typeCache.metadata[key];
}
}
}

/**
* manages post retrieve steps
Expand Down
2 changes: 1 addition & 1 deletion test/general.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ describe('GENERAL', () => {
assert.equal(deployedTypes[0], 'dataExtract', 'deploy should have returned 1 type');
assert.equal(
testUtils.getAPIHistoryLength(),
8,
10,
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
);
});
Expand Down
4 changes: 3 additions & 1 deletion test/resources/9999999/dataExtract/patch-expected.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"createdBy": "Jörn Berkefeld",
"createdDate": "2022-11-09T05:31:21.667",
"dataFields": [
{
"name": "ColumnDelimiter",
Expand Down Expand Up @@ -27,11 +28,12 @@
"value": "False"
}
],
"description": "created via deploy",
"description": "blabla",
"fileSpec": "testExisting-%%Year%%-%%Month%%-%%Day%%",
"intervalType": 0,
"key": "testExisting_dataExtract",
"modifiedBy": "Jörn Berkefeld",
"modifiedDate": "2022-11-17T07:13:36.9",
"name": "testExisting_dataExtract",
"r__dataExtractType_name": "Data Extension Extract"
}
2 changes: 1 addition & 1 deletion test/type.dataExtract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('type: dataExtract', () => {
// check number of API calls
assert.equal(
testUtils.getAPIHistoryLength(),
8,
10,
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
);
return;
Expand Down
Loading