Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@farris/bef

Package Overview
Dependencies
Maintainers
10
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@farris/bef - npm Package Compare versions

Comparing version 0.0.8-201810281602 to 0.0.8-201810310900

4

package.json
{
"version": "0.0.8-201810281602",
"version": "0.0.8-201810310900",
"license": "MIT",
"author": {
"name": "疯狂秀才 && 平台季维涛"
"name": "Witt, Lucus"
},

@@ -7,0 +7,0 @@ "name": "@farris/bef",

@@ -6,3 +6,3 @@ "use strict";

* @Last Modified by: Witt
* @Last Modified time: 2018-10-23 10:20:43
* @Last Modified time: 2018-10-31 08:38:55
*/

@@ -26,9 +26,2 @@ Object.defineProperty(exports, "__esModule", { value: true });

this.entityType = entityType;
// 根节点肯定是Modify,因为就算是新增,也是先在服务器端先创建一条。
this.changeDetail = {
ChangeType: types_1.ChangeDetailType.Modify,
ChangeInfo: {
DataId: ''
}
};
}

@@ -49,5 +42,13 @@ /**

var _this = this;
// 重置changeDetail
this.changeDetail = {
ChangeType: types_1.ChangeDetailType.Modify,
ChangeInfo: {
DataId: ''
}
};
modifications.forEach(function (modification) {
_this.buildChangeDetail(modification);
});
console.log(this.changeDetail);
return this.changeDetail;

@@ -186,2 +187,9 @@ };

delete entityDataCopy[primaryKey];
// @todo:临时删除关联对象的变更,关联对象变更需要完整对象,待重构
Object.keys(entityDataCopy).forEach(function (propName) {
var isObjectProp = entity_util_1.EntityUtil.isObjectProp(entityType, propName);
if (isObjectProp === true) {
delete entityDataCopy[propName];
}
});
changeDetail.ChangeInfo = Object.assign({}, changeDetail.ChangeInfo, entityDataCopy);

@@ -188,0 +196,0 @@ };

@@ -91,6 +91,3 @@ import { HttpClient } from '@angular/common/http';

/**
* 提交根实体变更
* 1、将变更提交到服务器端;
* 2、本地变更丢弃;
* 3、如果取消:通过本地原始数据来恢复,而不是通过变更集来恢复;
* 将id对应的实体的变更提交的服务器端
*/

@@ -111,2 +108,6 @@ updateChangesById(id: string): Observable<boolean>;

/**
* 应用id对应数据的变更
*/
applyChangesById(id: string): Observable<boolean>;
/**
* 取消变更

@@ -113,0 +114,0 @@ */

@@ -13,3 +13,3 @@ "use strict";

/*
* @Author: Sagi, Lucas, Witt
* @Author: Witt
* @Date: 2018-10-11 17:34:26

@@ -137,12 +137,15 @@ * @Last Modified by: Witt

function (id) {
var entity = this.entityCollection.getEntityById(id);
// 组织一个空变更
var changeDetail = this.changeBuilder.build([]);
changeDetail.ChangeInfo.DataId = id;
// 提交变更
var update$ = this.restService.update(changeDetail);
var result$ = update$.pipe(map_1.map(function () {
return true;
}));
return result$;
// const entity = this.entityCollection.getEntityById(id);
// // 组织一个空变更
// const changeDetail = this.changeBuilder.build([]);
// changeDetail.ChangeInfo.DataId = id;
// // 提交变更
// const update$ = this.restService.update(changeDetail);
// const result$ = update$.pipe(
// map(() => {
// return true;
// })
// );
// return result$;
return of_1.of(true);
};

@@ -262,3 +265,3 @@ /**

return delete$.pipe(switchMap_1.switchMap(function () {
return _this.applyChanges();
return _this.applyChangesById(id);
}));

@@ -326,20 +329,12 @@ };

childEntityList.remove(id);
// 清空实体中
};
/**
* 提交根实体变更
* 1、将变更提交到服务器端;
* 2、本地变更丢弃;
* 3、如果取消:通过本地原始数据来恢复,而不是通过变更集来恢复;
* 将id对应的实体的变更提交的服务器端
*/
/**
* 提交根实体变更
* 1、将变更提交到服务器端;
* 2、本地变更丢弃;
* 3、如果取消:通过本地原始数据来恢复,而不是通过变更集来恢复;
* 将id对应的实体的变更提交的服务器端
*/
BefRepository.prototype.updateChangesById = /**
* 提交根实体变更
* 1、将变更提交到服务器端;
* 2、本地变更丢弃;
* 3、如果取消:通过本地原始数据来恢复,而不是通过变更集来恢复;
* 将id对应的实体的变更提交的服务器端
*/

@@ -352,7 +347,8 @@ function (id) {

var changeDetail = this.changeBuilder.build(entity.changes);
var result$ = this.restService.update(changeDetail);
result$.pipe(tap_1.tap(function () {
// 删除该实体的变更
// @todo: 考虑调整Entity或者ChangeSet的api,对外暴露清空方法
var update$ = this.restService.update(changeDetail);
var result$ = update$.pipe(tap_1.tap(function () {
// 清空变更集
entity.changes.splice(0, entity.changes.length);
}), map_1.map(function () {
return true;
}));

@@ -393,6 +389,2 @@ return result$;

var result$ = zip_1.zip.apply(void 0, updateResults).pipe(map_1.map(function (results) {
// 所有更新都成功,返回ture,否则返回false
// return results.every((result) => {
// return result === true;
// });
return true;

@@ -413,15 +405,4 @@ }));

var _this = this;
var update$ = this.updateAllChanges();
var save$ = this.restService.save();
var result$ = update$.pipe(
// 转换为保存流
// 转换为保存流
switchMap_1.switchMap(function (updateResult) {
if (updateResult === false) {
return of_1.of(false);
}
else {
return save$;
}
}),
var result$ = save$.pipe(
// 更新本地数据

@@ -434,2 +415,4 @@ // 更新本地数据

// 当前数据 => 原始数据
// 清空变更集
entity.changes.splice(0, entity.changes.length);
});

@@ -451,2 +434,37 @@ }

/**
* 应用id对应数据的变更
*/
/**
* 应用id对应数据的变更
*/
BefRepository.prototype.applyChangesById = /**
* 应用id对应数据的变更
*/
function (id) {
var _this = this;
var save$ = this.restService.save();
var result$ = save$.pipe(
// 更新本地数据
// 更新本地数据
tap_1.tap(function (saveResult) {
if (saveResult) {
var entity = _this.entityCollection.getEntityById(id);
// 当前数据 => 原始数据
// 清空变更集
entity.changes.splice(0, entity.changes.length);
}
}),
// 转换为保存结果流(boolean流)
// 转换为保存结果流(boolean流)
map_1.map(function (saveResult) {
if (saveResult === false) {
return false;
}
else {
return true;
}
}));
return result$;
};
/**
* 取消变更

@@ -469,3 +487,5 @@ */

entities.forEach(function (entity) {
// 原始数据 => 当前数据
// 当前数据 => 原始数据
// 清空变更集
entity.changes.splice(0, entity.changes.length);
});

@@ -472,0 +492,0 @@ }),

@@ -1,1 +0,1 @@

[{"__symbolic":"module","version":4,"metadata":{"BefRepository":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@farris/devkit","name":"Repository","line":35,"character":55},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":34,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":58,"character":5},"arguments":[{"__symbolic":"reference","module":"./tokens","name":"BE_SERVER_URI_TOKEN","line":58,"character":12}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":57,"character":16},{"__symbolic":"reference","name":"string"}]}],"createRestService":[{"__symbolic":"method"}],"getList":[{"__symbolic":"method"}],"getById":[{"__symbolic":"method"}],"updateById":[{"__symbolic":"method"}],"lockById":[{"__symbolic":"method"}],"create":[{"__symbolic":"method"}],"createByPath":[{"__symbolic":"method"}],"append":[{"__symbolic":"method"}],"appendByPath":[{"__symbolic":"method"}],"appendEntityByPath":[{"__symbolic":"method"}],"removeById":[{"__symbolic":"method"}],"removeByIds":[{"__symbolic":"method"}],"removeByPath":[{"__symbolic":"method"}],"removeEntityByPath":[{"__symbolic":"method"}],"updateChangesById":[{"__symbolic":"method"}],"updateChangesByPath":[{"__symbolic":"method"}],"updateAllChanges":[{"__symbolic":"method"}],"applyChanges":[{"__symbolic":"method"}],"cancelChanges":[{"__symbolic":"method"}]}}}}]
[{"__symbolic":"module","version":4,"metadata":{"BefRepository":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@farris/devkit","name":"Repository","line":35,"character":55},"arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":34,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":58,"character":5},"arguments":[{"__symbolic":"reference","module":"./tokens","name":"BE_SERVER_URI_TOKEN","line":58,"character":12}]}]],"parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":57,"character":16},{"__symbolic":"reference","name":"string"}]}],"createRestService":[{"__symbolic":"method"}],"getList":[{"__symbolic":"method"}],"getById":[{"__symbolic":"method"}],"updateById":[{"__symbolic":"method"}],"lockById":[{"__symbolic":"method"}],"create":[{"__symbolic":"method"}],"createByPath":[{"__symbolic":"method"}],"append":[{"__symbolic":"method"}],"appendByPath":[{"__symbolic":"method"}],"appendEntityByPath":[{"__symbolic":"method"}],"removeById":[{"__symbolic":"method"}],"removeByIds":[{"__symbolic":"method"}],"removeByPath":[{"__symbolic":"method"}],"removeEntityByPath":[{"__symbolic":"method"}],"updateChangesById":[{"__symbolic":"method"}],"updateChangesByPath":[{"__symbolic":"method"}],"updateAllChanges":[{"__symbolic":"method"}],"applyChanges":[{"__symbolic":"method"}],"applyChangesById":[{"__symbolic":"method"}],"cancelChanges":[{"__symbolic":"method"}]}}}}]

@@ -6,3 +6,3 @@ "use strict";

* @Last Modified by: Witt
* @Last Modified time: 2018-10-22 14:57:31
* @Last Modified time: 2018-10-30 14:29:52
* @todo 待重构

@@ -52,5 +52,5 @@ */

function () {
debugger;
console.log('----------createFrmSession----------');
var body = {
UserName: 'jiwt',
UserName: 'admin',
PassWord: 'aaaaaa',

@@ -92,3 +92,3 @@ Language: 'zh-CHS',

var _this = this;
debugger;
console.log('----------createBeSession----------');
return this.getFrmSessionId().pipe(switchMap_1.switchMap(function (frmSessionId) {

@@ -95,0 +95,0 @@ return _this.httpClient.post(_this.beSessionUri, null, {

@@ -17,3 +17,7 @@ declare class EntityUtil {

static getPrimaryKey(entityType: any): string;
/**
* 是否为对象属性
*/
static isObjectProp(entityType: any, targetPropName: string): boolean;
}
export { EntityUtil };

@@ -70,2 +70,21 @@ "use strict";

};
/**
* 是否为对象属性
*/
/**
* 是否为对象属性
*/
EntityUtil.isObjectProp = /**
* 是否为对象属性
*/
function (entityType, targetPropName) {
var isObjectProp = false;
var ngObjectProperties = devkit_1.FieldMetadataUtil.getNgObjects(entityType);
Object.keys(ngObjectProperties).forEach(function (propName) {
if (propName === targetPropName) {
isObjectProp = true;
}
});
return isObjectProp;
};
return EntityUtil;

@@ -72,0 +91,0 @@ }());

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc