fng-audit 0.12.0-beta.176 → 0.12.0-beta.179
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/client/fng-audit.min.js +1 -1
- package/dist/server/fng-audit.js +2 -2
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,s,l){return new(s=s||Promise)(function(r,t){function n(e){try{a(l.next(e))}catch(e){t(e)}}function i(e){try{a(l.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,i)}a((l=l.apply(e,o||[])).next())})},__generator=this&&this.__generator||function(
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,s,l){return new(s=s||Promise)(function(r,t){function n(e){try{a(l.next(e))}catch(e){t(e)}}function i(e){try{a(l.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,i)}a((l=l.apply(e,o||[])).next())})},__generator=this&&this.__generator||function(n,i){var a,o,s,l={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(r){return function(e){var t=[r,e];if(a)throw new TypeError("Generator is already executing.");for(;l;)try{if(a=1,o&&(s=2&t[0]?o.return:t[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,t[1])).done)return s;switch(o=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return l.label++,{value:t[1],done:!1};case 5:l.label++,o=t[1],t=[0];continue;case 7:t=l.ops.pop(),l.trys.pop();continue;default:if(!(s=0<(s=l.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){l=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){l.label=t[1];break}if(6===t[0]&&l.label<s[1]){l.label=s[1],s=t;break}if(s&&l.label<s[2]){l.label=s[2],l.ops.push(t);break}s[2]&&l.ops.pop(),l.trys.pop();continue}t=i.call(n,l)}catch(e){t=[6,e],o=0}finally{a=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}};!function(){"use strict";angular.module("fngAuditModule",["formsAngular"]).config(["routingServiceProvider",function(e){e.addRoutes(null,[{route:"/:model/:id/history",state:"model::history",templateUrl:"templates/base-history.html"},{route:"/:model/:form/:id/history",state:"model::history",templateUrl:"templates/base-history.html"},{route:"/:model/:id/changes",state:"model::history",templateUrl:"templates/base-history.html"},{route:"/:model/:form/:id/changes",state:"model::history",templateUrl:"templates/base-history.html"},{route:"/:model/:id/version/:version",state:"model::version",templateUrl:"templates/base-version.html"},{route:"/:model/:form/:id/version/:version",state:"model::version",templateUrl:"templates/base-version.html"}]),e.registerAction("history"),e.registerAction("changes"),e.registerAction("version")}]).controller("FngAuditHistCtrl",["$rootScope","$scope","$location","routingService","fngAuditServ",function(n,i,e,t,a){i.changes=[];var e=e.path(),r=(angular.extend(i,t.parsePathFunc()(e)),"".concat(i.modelName).concat(i.formName?"/".concat(i.formName):""));i.createDate=new Date(1e3*parseInt(i.id.toString().substring(0,8),16)),a.getHist(i.modelName,i.id,e.split("/").slice(-1)[0]).then(function(e){i.changes=e.data;var t,r={};i.changes.forEach(function(e){e.user&&(r[e.user]=null)}),null!=n&&n.describeUsers(r).then(function(t){i.changes.forEach(function(e){e.user&&(e.userDesc=t[e.user])})}),0<i.changes.length?("create"!==i.changes[i.changes.length-1].operation&&(i.inferCreate=!0),t="view",i.changes.forEach(function(e){e.url=t,void 0!==e.oldVersion&&(t="version/"+e.oldVersion)})):a.checkValidItem(i.modelName,i.id).then(function(){i.inferCreate=!0})},function(e){i.errorVisible=!0,i.alertTitle=e.statusText,i.errorMessage=e.data}),i.buildHistUrl=function(e){return t.buildUrl("".concat(r,"/").concat(i.id,"/").concat(e))}}]).controller("FngAuditVerCtrl",["$scope","$location","routingService","fngAuditServ",function(t,e,r,n){t.record=[],angular.extend(t,r.parsePathFunc()(e.$$path)),n.getVersion(t.modelName,t.id,t.tab).then(function(e){"0"===t.tab&&1===Object.keys(e.data).length?(t.errorVisible=!0,t.alertTitle="Error",t.errorMessage="No such ".concat(t.modelName," as ").concat(t.id)):t.version=e.data},function(e){t.errorVisible=!0,t.alertTitle=e.statusText,t.errorMessage=e.data}),t.buildHistUrl=function(e){return r.buildUrl(t.modelName+"/"+t.id+"/version/"+e.oldVersion)}}]).service("fngAuditServ",["$http",function(i){return{getHist:function(t,r,n){return void 0===n&&(n="history"),__awaiter(this,void 0,void 0,function(){return __generator(this,function(e){return[2,i.get("/api/".concat(t,"/").concat(r,"/").concat(n))]})})},getVersion:function(e,t,r){return i.get("/api/".concat(e,"/").concat(t,"/version/").concat(r))},checkValidItem:function(e,t){return i.get("/api/".concat(e,"/").concat(t))}}}])}(),angular.module("fngAuditModule").run(["$templateCache",function(e){"use strict";e.put("templates/base-history.html","<div ng-controller=FngAuditHistCtrl><div ng-class=\"css('rowFluid')\" class=\"page-header list-header\"><div class=header-lhs><h1>History for {{modelName}} {{id}}</h1></div></div><div class=\"page-body list-body\"><error-display></error-display><div ng-class=\"css('rowFluid')\"><a ng-repeat=\"change in changes\" ng-href={{buildHistUrl(change.url)}}><div class=list-item><div ng-class=\"css('span',12)\">{{ change.changedAt | date : 'yy-MM-dd HH:mm:ss' }} UTC <span ng-if=change.chg title=\"{{ change.chg | json}}\"><changes> </span> {{ change.comment }} {{ change.userDesc || (change.user ? (' User: ' + change.user) : '' ) }}</div></div></a></div><div ng-class=\"css('rowFluid')\" ng-show=inferCreate><a ng-href=\"{{buildHistUrl('version/0')}}\"><div class=list-item><div ng-class=\"css('span',12)\">{{ createDate | date : 'yy-MM-dd HH:mm:ss' }} UTC created</div></div></a></div></div></div>"),e.put("templates/base-version.html",'<div ng-controller=FngAuditVerCtrl><div ng-class="css(\'rowFluid\')" class="page-header list-header"><div class=header-lhs><h1>Version {{ tab }} for {{modelName}} {{id}}</h1></div></div><div class="page-body list-body"><error-display></error-display><div ng-class="css(\'rowFluid\')"><pre>\n{{ version | json }}\n</pre></div></div></div>')}]);
|
package/dist/server/fng-audit.js
CHANGED
|
@@ -172,7 +172,7 @@ function getRevision(model, id, revisionCrit, doCleaning, callback) {
|
|
|
172
172
|
console.error(err);
|
|
173
173
|
return callback(err, null);
|
|
174
174
|
}
|
|
175
|
-
var object = latest ? latest.toObject() : { _id: Mongoose.Types.ObjectId(id) };
|
|
175
|
+
var object = latest ? latest.toObject() : { _id: new Mongoose.Types.ObjectId(id) };
|
|
176
176
|
async.each(histories, function (history, eachCallback) {
|
|
177
177
|
jsondiffpatch.unpatch(object, history.chg);
|
|
178
178
|
eachCallback();
|
|
@@ -195,7 +195,7 @@ function getVersion(model, id, version, doCleaning, callback) {
|
|
|
195
195
|
}
|
|
196
196
|
exports.getVersion = getVersion;
|
|
197
197
|
function getSnapshot(model, id, snapshotDt, doCleaning, callback) {
|
|
198
|
-
var dateAsObjectId = Mongoose.Types.ObjectId(Math.floor(snapshotDt.getTime() / 1000).toString(16) + "0000000000000000");
|
|
198
|
+
var dateAsObjectId = new Mongoose.Types.ObjectId(Math.floor(snapshotDt.getTime() / 1000).toString(16) + "0000000000000000");
|
|
199
199
|
getRevision(model, id, { _id: { $gte: dateAsObjectId } }, doCleaning, callback);
|
|
200
200
|
}
|
|
201
201
|
exports.getSnapshot = getSnapshot;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fng-audit",
|
|
3
|
-
"version": "0.12.0-beta.
|
|
3
|
+
"version": "0.12.0-beta.179",
|
|
4
4
|
"description": "Client part of forms-angular audit plugin",
|
|
5
5
|
"homepage": "https://www.forms-angular.org/#/plugins",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"async": "3.2.
|
|
10
|
+
"async": "3.2.3",
|
|
11
11
|
"colors": "1.4.0",
|
|
12
12
|
"jsondiffpatch": "0.4.1",
|
|
13
13
|
"lodash": "4.17.21",
|
|
@@ -19,22 +19,22 @@
|
|
|
19
19
|
},
|
|
20
20
|
"main": "./dist/server/fng-audit.js",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/angular": "1.8.
|
|
23
|
-
"@types/async": "3.2.
|
|
24
|
-
"@types/chai": "4.
|
|
22
|
+
"@types/angular": "1.8.4",
|
|
23
|
+
"@types/async": "3.2.12",
|
|
24
|
+
"@types/chai": "4.3.0",
|
|
25
25
|
"@types/express": "4.17.13",
|
|
26
|
-
"@types/mocha": "9.
|
|
27
|
-
"angular": "^1.8.
|
|
28
|
-
"chai": "4.3.
|
|
29
|
-
"forms-angular": "0.12.0-beta.
|
|
30
|
-
"grunt": "^1.
|
|
26
|
+
"@types/mocha": "9.1.0",
|
|
27
|
+
"angular": "^1.8.3",
|
|
28
|
+
"chai": "4.3.6",
|
|
29
|
+
"forms-angular": "0.12.0-beta.179",
|
|
30
|
+
"grunt": "^1.5.2",
|
|
31
31
|
"grunt-angular-templates": "^1.2.0",
|
|
32
|
-
"grunt-contrib-concat": "2.
|
|
32
|
+
"grunt-contrib-concat": "2.1.0",
|
|
33
33
|
"grunt-contrib-copy": "1.0.0",
|
|
34
|
-
"grunt-contrib-uglify": "5.0
|
|
34
|
+
"grunt-contrib-uglify": "5.1.0",
|
|
35
35
|
"grunt-legacy-log": "3.0.0",
|
|
36
|
-
"mocha": "^9.
|
|
37
|
-
"mongoose": "6.
|
|
36
|
+
"mocha": "^9.2.2",
|
|
37
|
+
"mongoose": "6.2.10"
|
|
38
38
|
},
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"authors": [
|