Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / mailTransferReport / mailTransferReport.controller.js
index f78d215..f749cd7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0xb37061,_0x44f8ab){var _0x2cd124=function(_0x1b1ce6){while(--_0x1b1ce6){_0xb37061['push'](_0xb37061['shift']());}};_0x2cd124(++_0x44f8ab);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['MailTransferReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]));if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));};
\ No newline at end of file
+var _0xbbf9=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','index','MailTransferReport','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create'];(function(_0x393d22,_0x44385a){var _0x11f436=function(_0x2b3d37){while(--_0x2b3d37){_0x393d22['push'](_0x393d22['shift']());}};_0x11f436(++_0x44385a);}(_0xbbf9,0x1b2));var _0x9bbf=function(_0x31922d,_0x35f27b){_0x31922d=_0x31922d-0x0;var _0x255700=_0xbbf9[_0x31922d];return _0x255700;};'use strict';var emlformat=require(_0x9bbf('0x0'));var rimraf=require(_0x9bbf('0x1'));var zipdir=require(_0x9bbf('0x2'));var jsonpatch=require(_0x9bbf('0x3'));var rp=require('request-promise');var moment=require(_0x9bbf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9bbf('0x5'));var util=require(_0x9bbf('0x6'));var path=require('path');var sox=require(_0x9bbf('0x7'));var csv=require(_0x9bbf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9bbf('0x9'));var _=require(_0x9bbf('0xa'));var squel=require(_0x9bbf('0xb'));var crypto=require('crypto');var jsforce=require(_0x9bbf('0xc'));var deskjs=require(_0x9bbf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9bbf('0xe'));var Papa=require(_0x9bbf('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9bbf('0x10'));var hardwareService=require(_0x9bbf('0x11'));var logger=require(_0x9bbf('0x12'))(_0x9bbf('0x13'));var utils=require(_0x9bbf('0x14'));var config=require(_0x9bbf('0x15'));var licenseUtil=require(_0x9bbf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35836b,_0x565345){_0x565345=_0x565345||0xcc;return function(_0x180dbd){if(_0x180dbd){return _0x35836b['sendStatus'](_0x565345);}return _0x35836b[_0x9bbf('0x17')](_0x565345)['end']();};}function respondWithResult(_0x4ace3b,_0xab4321){_0xab4321=_0xab4321||0xc8;return function(_0x2dfbf8){if(_0x2dfbf8){return _0x4ace3b[_0x9bbf('0x17')](_0xab4321)['json'](_0x2dfbf8);}};}function respondWithFilteredResult(_0x258308,_0x142eb5){return function(_0x5743b0){if(_0x5743b0){var _0x3cad83=typeof _0x142eb5[_0x9bbf('0x18')]===_0x9bbf('0x19')&&typeof _0x142eb5['limit']===_0x9bbf('0x19');var _0x40b9ed=_0x5743b0[_0x9bbf('0x1a')];var _0x5d443d=_0x3cad83?0x0:_0x142eb5[_0x9bbf('0x18')];var _0x137817=_0x3cad83?_0x5743b0['count']:_0x142eb5[_0x9bbf('0x18')]+_0x142eb5[_0x9bbf('0x1b')];var _0x1cc877;if(_0x137817>=_0x40b9ed){_0x137817=_0x40b9ed;_0x1cc877=0xc8;}else{_0x1cc877=0xce;}_0x258308['status'](_0x1cc877);return _0x258308[_0x9bbf('0x1c')]('Content-Range',_0x5d443d+'-'+_0x137817+'/'+_0x40b9ed)['json'](_0x5743b0);}return null;};}function patchUpdates(_0x323edf){return function(_0x47e6b9){try{jsonpatch[_0x9bbf('0x1d')](_0x47e6b9,_0x323edf,!![]);}catch(_0x468963){return BPromise[_0x9bbf('0x1e')](_0x468963);}return _0x47e6b9[_0x9bbf('0x1f')]();};}function saveUpdates(_0x4f886d,_0x44316e){return function(_0x4688e6){if(_0x4688e6){return _0x4688e6[_0x9bbf('0x20')](_0x4f886d)[_0x9bbf('0x21')](function(_0x1190a4){return _0x1190a4;});}return null;};}function removeEntity(_0x4c2e87,_0x3a8ce5){return function(_0x519a1f){if(_0x519a1f){return _0x519a1f[_0x9bbf('0x22')]()[_0x9bbf('0x21')](function(){_0x4c2e87[_0x9bbf('0x17')](0xcc)[_0x9bbf('0x23')]();});}};}function handleEntityNotFound(_0x42e711,_0xf7b0eb){return function(_0x43618b){if(!_0x43618b){_0x42e711['sendStatus'](0x194);}return _0x43618b;};}function handleError(_0x258622,_0x41c328){_0x41c328=_0x41c328||0x1f4;return function(_0x50f10a){logger[_0x9bbf('0x24')](_0x50f10a[_0x9bbf('0x25')]);if(_0x50f10a['name']){delete _0x50f10a['name'];}_0x258622[_0x9bbf('0x17')](_0x41c328)['send'](_0x50f10a);};}exports[_0x9bbf('0x26')]=function(_0x341a29,_0x738ccc){var _0x32d12e={},_0x5e19c5={},_0x50f187={'count':0x0,'rows':[]};var _0x11e045=_['map'](db[_0x9bbf('0x27')]['rawAttributes'],function(_0x1baa27){return{'name':_0x1baa27[_0x9bbf('0x28')],'type':_0x1baa27['type']['key']};});_0x5e19c5['model']=_[_0x9bbf('0x29')](_0x11e045,'name');_0x5e19c5[_0x9bbf('0x2a')]=_[_0x9bbf('0x2b')](_0x341a29[_0x9bbf('0x2a')]);_0x5e19c5[_0x9bbf('0x2c')]=_[_0x9bbf('0x2d')](_0x5e19c5[_0x9bbf('0x2e')],_0x5e19c5[_0x9bbf('0x2a')]);_0x32d12e[_0x9bbf('0x2f')]=_[_0x9bbf('0x2d')](_0x5e19c5[_0x9bbf('0x2e')],qs[_0x9bbf('0x30')](_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x30')]));_0x32d12e[_0x9bbf('0x2f')]=_0x32d12e[_0x9bbf('0x2f')][_0x9bbf('0x31')]?_0x32d12e[_0x9bbf('0x2f')]:_0x5e19c5[_0x9bbf('0x2e')];if(!_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x32')](_0x9bbf('0x33'))){_0x32d12e['limit']=qs[_0x9bbf('0x1b')](_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x1b')]);_0x32d12e['offset']=qs[_0x9bbf('0x18')](_0x341a29[_0x9bbf('0x2a')]['offset']);}_0x32d12e[_0x9bbf('0x34')]=qs[_0x9bbf('0x35')](_0x341a29[_0x9bbf('0x2a')]['sort']);_0x32d12e[_0x9bbf('0x36')]=qs[_0x9bbf('0x2c')](_[_0x9bbf('0x37')](_0x341a29[_0x9bbf('0x2a')],_0x5e19c5[_0x9bbf('0x2c')]),_0x11e045);if(_0x341a29[_0x9bbf('0x2a')]['filter']){_0x32d12e[_0x9bbf('0x36')]=_[_0x9bbf('0x38')](_0x32d12e[_0x9bbf('0x36')],{'$or':_['map'](_0x11e045,function(_0x4f19e1){if(_0x4f19e1['type']!==_0x9bbf('0x39')){var _0xd8ecc={};_0xd8ecc[_0x4f19e1['name']]={'$like':'%'+_0x341a29[_0x9bbf('0x2a')][_0x9bbf('0x3a')]+'%'};return _0xd8ecc;}})});}_0x32d12e=_[_0x9bbf('0x38')]({},_0x32d12e,_0x341a29['options']);var _0x2fdb9a={'where':_0x32d12e[_0x9bbf('0x36')]};return db[_0x9bbf('0x27')][_0x9bbf('0x1a')](_0x2fdb9a)[_0x9bbf('0x21')](function(_0x3b3ca5){_0x50f187['count']=_0x3b3ca5;if(_0x341a29['query']['includeAll']){_0x32d12e[_0x9bbf('0x3b')]=[{'all':!![]}];}return db[_0x9bbf('0x27')][_0x9bbf('0x3c')](_0x32d12e);})['then'](function(_0x4b9abf){_0x50f187[_0x9bbf('0x3d')]=_0x4b9abf;return _0x50f187;})[_0x9bbf('0x21')](respondWithFilteredResult(_0x738ccc,_0x32d12e))['catch'](handleError(_0x738ccc,null));};exports[_0x9bbf('0x3e')]=function(_0x3bb27e,_0x5bbdc4){var _0x3378c0={'raw':!![],'where':{'id':_0x3bb27e[_0x9bbf('0x3f')]['id']}},_0x1c92fa={};_0x1c92fa[_0x9bbf('0x2e')]=_['keys'](db[_0x9bbf('0x27')][_0x9bbf('0x40')]);_0x1c92fa['query']=_[_0x9bbf('0x2b')](_0x3bb27e[_0x9bbf('0x2a')]);_0x1c92fa['filters']=_[_0x9bbf('0x2d')](_0x1c92fa[_0x9bbf('0x2e')],_0x1c92fa[_0x9bbf('0x2a')]);_0x3378c0[_0x9bbf('0x2f')]=_[_0x9bbf('0x2d')](_0x1c92fa['model'],qs['fields'](_0x3bb27e[_0x9bbf('0x2a')][_0x9bbf('0x30')]));_0x3378c0[_0x9bbf('0x2f')]=_0x3378c0[_0x9bbf('0x2f')]['length']?_0x3378c0[_0x9bbf('0x2f')]:_0x1c92fa[_0x9bbf('0x2e')];if(_0x3bb27e[_0x9bbf('0x2a')][_0x9bbf('0x41')]){_0x3378c0['include']=[{'all':!![]}];}_0x3378c0=_[_0x9bbf('0x38')]({},_0x3378c0,_0x3bb27e[_0x9bbf('0x42')]);return db[_0x9bbf('0x27')][_0x9bbf('0x43')](_0x3378c0)[_0x9bbf('0x21')](handleEntityNotFound(_0x5bbdc4,null))[_0x9bbf('0x21')](respondWithResult(_0x5bbdc4,null))[_0x9bbf('0x44')](handleError(_0x5bbdc4,null));};exports[_0x9bbf('0x45')]=function(_0x4283da,_0x58c5b4){return db[_0x9bbf('0x27')][_0x9bbf('0x45')](_0x4283da[_0x9bbf('0x46')],{})['then'](respondWithResult(_0x58c5b4,0xc9))[_0x9bbf('0x44')](handleError(_0x58c5b4,null));};exports[_0x9bbf('0x20')]=function(_0x3b6822,_0x15062b){if(_0x3b6822[_0x9bbf('0x46')]['id']){delete _0x3b6822['body']['id'];}return db[_0x9bbf('0x27')][_0x9bbf('0x43')]({'where':{'id':_0x3b6822[_0x9bbf('0x3f')]['id']}})[_0x9bbf('0x21')](handleEntityNotFound(_0x15062b,null))[_0x9bbf('0x21')](saveUpdates(_0x3b6822[_0x9bbf('0x46')],null))['then'](respondWithResult(_0x15062b,null))[_0x9bbf('0x44')](handleError(_0x15062b,null));};exports[_0x9bbf('0x22')]=function(_0x1146e4,_0x104a09){return db[_0x9bbf('0x27')][_0x9bbf('0x43')]({'where':{'id':_0x1146e4[_0x9bbf('0x3f')]['id']}})[_0x9bbf('0x21')](handleEntityNotFound(_0x104a09,null))[_0x9bbf('0x21')](removeEntity(_0x104a09,null))[_0x9bbf('0x44')](handleError(_0x104a09,null));};exports[_0x9bbf('0x47')]=function(_0x44e3d8,_0x3ec4cc){return db[_0x9bbf('0x27')]['describe']()[_0x9bbf('0x21')](respondWithResult(_0x3ec4cc,null))['catch'](handleError(_0x3ec4cc,null));};
\ No newline at end of file