@@ -16,7 +16,7 @@ define([
1616 const nodeId = this . core . getPath ( job ) ;
1717 this . lastAppliedCmd [ nodeId ] = 0 ;
1818 const metadata = await this . getMetadataNodes ( job ) ;
19- await Promise . all ( metadata . map ( node => this . resetMetadataNode ( node ) ) ) ;
19+ await Promise . all ( metadata . map ( node => this . resetMetadataNode ( node , job ) ) ) ;
2020 } ;
2121
2222 ExecuteJob . prototype . clearOldMetadata = async function ( job ) {
@@ -39,13 +39,16 @@ define([
3939 }
4040 } ;
4141
42- ExecuteJob . prototype . resetMetadataNode = async function ( node ) {
42+ ExecuteJob . prototype . resetMetadataNode = async function ( node , job ) {
4343 const children = await this . core . loadChildren ( node ) ;
4444 children . forEach ( child => this . core . deleteNode ( child ) ) ;
4545
4646 const attributes = this . core . getAttributeNames ( node )
4747 . filter ( attr => attr !== 'id' ) ;
4848 attributes . forEach ( attr => this . core . delAttribute ( node , attr ) ) ;
49+
50+ const op = await this . getOperation ( job ) ;
51+ await this . recordProvenance ( node , op ) ;
4952 } ;
5053
5154 ExecuteJob . prototype . getMetadataNodes = async function ( job ) {
@@ -100,13 +103,14 @@ define([
100103 const MetadataClass = Metadata . getClassForCommand ( cmd ) ;
101104 const metadata = await this . getMetadataNodes ( job ) ;
102105 const node = metadata . find ( node => this . core . getAttribute ( node , 'id' ) ) ||
103- this . createNodeForMetadata ( MetadataClass , job , id ) ;
106+ await this . createNodeForMetadata ( MetadataClass , job , id ) ;
104107
105108 const md = new MetadataClass ( node , this . core , this . META ) ;
106109 await md . update ( content ) ;
107110 } ;
108111
109- ExecuteJob . prototype . createNodeForMetadata = function ( MetadataClass , job , id ) {
112+ ExecuteJob . prototype . createNodeForMetadata = async function ( MetadataClass , job , id ) {
113+ const op = await this . getOperation ( job ) ;
110114 const base = this . META [ MetadataClass . getMetaType ( ) ] ;
111115 const msg = `Metadata type not found for ${ MetadataClass . name } : ` +
112116 `${ MetadataClass . getMetaType ( ) } ` ;
@@ -115,6 +119,7 @@ define([
115119
116120 const node = this . core . createNode ( { base, parent : job } ) ;
117121 this . core . setAttribute ( node , 'id' , id ) ;
122+ await this . recordProvenance ( node , op ) ;
118123 return node ;
119124 } ;
120125
0 commit comments