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.11-201812171730 to 0.0.11-201901021930

64

bundles/index.umd.js

@@ -661,5 +661,13 @@ (function (global, factory) {

* @todo:临时支持子表,应该支持无限层级
* fixed by justin: 每级属性名都去掉s
*/
BefRestService.prototype.convertPathToUrl = function (path) {
return path.substring(0, path.length - 1);
// return path.substring(0, path.length - 1);
var subPaths = path.split('/');
for (var i = subPaths.length - 1; i > 0; i--) {
if (subPaths[i] && subPaths[i].endsWith('s')) {
subPaths[i] = subPaths[i].substr(0, subPaths[i].length - 1);
}
}
return subPaths.join('/');
};

@@ -933,8 +941,33 @@ BefRestService = __decorate$2([

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别path
*/
BefRepository.prototype.appendEntityByPath = function (fpath, childData) {
var _a = fpath.split('/'), fid = _a[1], propName = _a[2];
var parentEntity = this.entityCollection.getEntityById(fid);
var childEntityList = parentEntity[propName];
var propInfo = EntityUtil.getPropInfo(this.entityType, propName);
// const [ , fid, propName ] = fpath.split('/');
// const parentEntity = this.entityCollection.getEntityById(fid);
// const childEntityList = parentEntity[propName];
// const propInfo = EntityUtil.getPropInfo(this.entityType, propName);
// const childEntity = EntityFactory<Entity>(propInfo.propEntityType, childData);
// childEntityList.appendNew(childEntity);
// return childEntity;
var subPaths = fpath.split('/');
if (subPaths.length < 3) {
throw Error("\u6839\u636Epath\u5220\u9664\u5B9E\u4F53\u6570\u636E\u51FA\u9519\u4E86\u3002\u4F20\u5165\u7684path[" + fpath + "]\u683C\u5F0F\u4E0D\u5BF9");
// return;
}
var childEntityList;
var propInfo;
var propName;
for (var i = 2; i < subPaths.length; i = i + 2) {
var fid = subPaths[i - 1];
propName = subPaths[i];
// todo: EntityCollection重构之后这里无需差异处理
var parentEntity = childEntityList ? childEntityList.get(fid) : this.entityCollection.getEntityById(fid);
childEntityList = parentEntity[propName];
var entityType = propInfo ? propInfo.propEntityType : this.entityType;
propInfo = EntityUtil.getPropInfo(entityType, propName);
if (!childEntityList) {
throw Error("fpath\u53C2\u6570\u9519\u8BEF\uFF0C\u65E0\u6CD5\u627E\u5230" + propName + "\u5BF9\u5E94\u7684\u5B50\u8868\u3002fpath\u4E3A\uFF1A" + fpath);
}
}
// const propInfo = EntityUtil.getPropInfo(this.entityType, propName);
var childEntity = devkit.EntityFactory(propInfo.propEntityType, childData);

@@ -992,7 +1025,22 @@ childEntityList.appendNew(childEntity);

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别路径,支持多级
*/
BefRepository.prototype.removeEntityByPath = function (fpath, id) {
var _a = fpath.split('/'), fid = _a[1], propName = _a[2];
var parentEntity = this.entityCollection.getEntityById(fid);
var childEntityList = parentEntity[propName];
// const [ , fid, propName ] = fpath.split('/');
// const parentEntity = this.entityCollection.getEntityById(fid);
// const childEntityList: EntityList<Entity> = parentEntity[propName];
var subPaths = fpath.split('/');
if (subPaths.length < 3) {
throw Error("\u6839\u636Epath\u5220\u9664\u5B9E\u4F53\u6570\u636E\u51FA\u9519\u4E86\u3002\u4F20\u5165\u7684path[" + fpath + "]\u683C\u5F0F\u4E0D\u5BF9");
}
var childEntityList;
for (var i = 2; i < subPaths.length; i = i + 2) {
var fid = subPaths[i - 1];
var propName = subPaths[i];
var parentEntity = childEntityList ? childEntityList.get(fid) : this.entityCollection.getEntityById(fid);
childEntityList = parentEntity[propName];
if (!childEntityList) {
throw Error("fpath\u53C2\u6570\u9519\u8BEF\uFF0C\u65E0\u6CD5\u627E\u5230" + propName + "\u5BF9\u5E94\u7684\u5B50\u8868\u3002fpath\u4E3A\uFF1A" + fpath);
}
}
childEntityList.remove(id);

@@ -999,0 +1047,0 @@ // 清空实体中

@@ -648,5 +648,13 @@ import { InjectionToken, Injectable, Injector } from '@angular/core';

* @todo:临时支持子表,应该支持无限层级
* fixed by justin: 每级属性名都去掉s
*/
convertPathToUrl(path) {
return path.substring(0, path.length - 1);
// return path.substring(0, path.length - 1);
const subPaths = path.split('/');
for (let i = subPaths.length - 1; i > 0; i--) {
if (subPaths[i] && subPaths[i].endsWith('s')) {
subPaths[i] = subPaths[i].substr(0, subPaths[i].length - 1);
}
}
return subPaths.join('/');
}

@@ -895,8 +903,33 @@ };

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别path
*/
appendEntityByPath(fpath, childData) {
const [, fid, propName] = fpath.split('/');
const parentEntity = this.entityCollection.getEntityById(fid);
const childEntityList = parentEntity[propName];
const propInfo = EntityUtil.getPropInfo(this.entityType, propName);
// const [ , fid, propName ] = fpath.split('/');
// const parentEntity = this.entityCollection.getEntityById(fid);
// const childEntityList = parentEntity[propName];
// const propInfo = EntityUtil.getPropInfo(this.entityType, propName);
// const childEntity = EntityFactory<Entity>(propInfo.propEntityType, childData);
// childEntityList.appendNew(childEntity);
// return childEntity;
const subPaths = fpath.split('/');
if (subPaths.length < 3) {
throw Error(`根据path删除实体数据出错了。传入的path[${fpath}]格式不对`);
// return;
}
let childEntityList;
let propInfo;
let propName;
for (let i = 2; i < subPaths.length; i = i + 2) {
const fid = subPaths[i - 1];
propName = subPaths[i];
// todo: EntityCollection重构之后这里无需差异处理
const parentEntity = childEntityList ? childEntityList.get(fid) : this.entityCollection.getEntityById(fid);
childEntityList = parentEntity[propName];
const entityType = propInfo ? propInfo.propEntityType : this.entityType;
propInfo = EntityUtil.getPropInfo(entityType, propName);
if (!childEntityList) {
throw Error(`fpath参数错误,无法找到${propName}对应的子表。fpath为:${fpath}`);
}
}
// const propInfo = EntityUtil.getPropInfo(this.entityType, propName);
const childEntity = EntityFactory(propInfo.propEntityType, childData);

@@ -952,7 +985,22 @@ childEntityList.appendNew(childEntity);

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别路径,支持多级
*/
removeEntityByPath(fpath, id) {
const [, fid, propName] = fpath.split('/');
const parentEntity = this.entityCollection.getEntityById(fid);
const childEntityList = parentEntity[propName];
// const [ , fid, propName ] = fpath.split('/');
// const parentEntity = this.entityCollection.getEntityById(fid);
// const childEntityList: EntityList<Entity> = parentEntity[propName];
const subPaths = fpath.split('/');
if (subPaths.length < 3) {
throw Error(`根据path删除实体数据出错了。传入的path[${fpath}]格式不对`);
}
let childEntityList;
for (let i = 2; i < subPaths.length; i = i + 2) {
const fid = subPaths[i - 1];
const propName = subPaths[i];
const parentEntity = childEntityList ? childEntityList.get(fid) : this.entityCollection.getEntityById(fid);
childEntityList = parentEntity[propName];
if (!childEntityList) {
throw Error(`fpath参数错误,无法找到${propName}对应的子表。fpath为:${fpath}`);
}
}
childEntityList.remove(id);

@@ -959,0 +1007,0 @@ // 清空实体中

@@ -665,5 +665,13 @@ import { InjectionToken, Injectable, Injector } from '@angular/core';

* @todo:临时支持子表,应该支持无限层级
* fixed by justin: 每级属性名都去掉s
*/
BefRestService.prototype.convertPathToUrl = function (path) {
return path.substring(0, path.length - 1);
// return path.substring(0, path.length - 1);
var subPaths = path.split('/');
for (var i = subPaths.length - 1; i > 0; i--) {
if (subPaths[i] && subPaths[i].endsWith('s')) {
subPaths[i] = subPaths[i].substr(0, subPaths[i].length - 1);
}
}
return subPaths.join('/');
};

@@ -937,8 +945,33 @@ BefRestService = __decorate$2([

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别path
*/
BefRepository.prototype.appendEntityByPath = function (fpath, childData) {
var _a = fpath.split('/'), fid = _a[1], propName = _a[2];
var parentEntity = this.entityCollection.getEntityById(fid);
var childEntityList = parentEntity[propName];
var propInfo = EntityUtil.getPropInfo(this.entityType, propName);
// const [ , fid, propName ] = fpath.split('/');
// const parentEntity = this.entityCollection.getEntityById(fid);
// const childEntityList = parentEntity[propName];
// const propInfo = EntityUtil.getPropInfo(this.entityType, propName);
// const childEntity = EntityFactory<Entity>(propInfo.propEntityType, childData);
// childEntityList.appendNew(childEntity);
// return childEntity;
var subPaths = fpath.split('/');
if (subPaths.length < 3) {
throw Error("\u6839\u636Epath\u5220\u9664\u5B9E\u4F53\u6570\u636E\u51FA\u9519\u4E86\u3002\u4F20\u5165\u7684path[" + fpath + "]\u683C\u5F0F\u4E0D\u5BF9");
// return;
}
var childEntityList;
var propInfo;
var propName;
for (var i = 2; i < subPaths.length; i = i + 2) {
var fid = subPaths[i - 1];
propName = subPaths[i];
// todo: EntityCollection重构之后这里无需差异处理
var parentEntity = childEntityList ? childEntityList.get(fid) : this.entityCollection.getEntityById(fid);
childEntityList = parentEntity[propName];
var entityType = propInfo ? propInfo.propEntityType : this.entityType;
propInfo = EntityUtil.getPropInfo(entityType, propName);
if (!childEntityList) {
throw Error("fpath\u53C2\u6570\u9519\u8BEF\uFF0C\u65E0\u6CD5\u627E\u5230" + propName + "\u5BF9\u5E94\u7684\u5B50\u8868\u3002fpath\u4E3A\uFF1A" + fpath);
}
}
// const propInfo = EntityUtil.getPropInfo(this.entityType, propName);
var childEntity = EntityFactory(propInfo.propEntityType, childData);

@@ -996,7 +1029,22 @@ childEntityList.appendNew(childEntity);

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别路径,支持多级
*/
BefRepository.prototype.removeEntityByPath = function (fpath, id) {
var _a = fpath.split('/'), fid = _a[1], propName = _a[2];
var parentEntity = this.entityCollection.getEntityById(fid);
var childEntityList = parentEntity[propName];
// const [ , fid, propName ] = fpath.split('/');
// const parentEntity = this.entityCollection.getEntityById(fid);
// const childEntityList: EntityList<Entity> = parentEntity[propName];
var subPaths = fpath.split('/');
if (subPaths.length < 3) {
throw Error("\u6839\u636Epath\u5220\u9664\u5B9E\u4F53\u6570\u636E\u51FA\u9519\u4E86\u3002\u4F20\u5165\u7684path[" + fpath + "]\u683C\u5F0F\u4E0D\u5BF9");
}
var childEntityList;
for (var i = 2; i < subPaths.length; i = i + 2) {
var fid = subPaths[i - 1];
var propName = subPaths[i];
var parentEntity = childEntityList ? childEntityList.get(fid) : this.entityCollection.getEntityById(fid);
childEntityList = parentEntity[propName];
if (!childEntityList) {
throw Error("fpath\u53C2\u6570\u9519\u8BEF\uFF0C\u65E0\u6CD5\u627E\u5230" + propName + "\u5BF9\u5E94\u7684\u5B50\u8868\u3002fpath\u4E3A\uFF1A" + fpath);
}
}
childEntityList.remove(id);

@@ -1003,0 +1051,0 @@ // 清空实体中

2

package.json
{
"name": "@farris/bef",
"version": "0.0.11-201812171730",
"version": "0.0.11-201901021930",
"description": "Farris Bef",

@@ -5,0 +5,0 @@ "main": "./bundles/index.umd.js",

@@ -76,2 +76,3 @@ import { Injector } from '@angular/core';

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别path
*/

@@ -99,2 +100,3 @@ private appendEntityByPath;

* @todo:临时模拟,强识别2级路径
* fixed by justin: 循环识别路径,支持多级
*/

@@ -101,0 +103,0 @@ private removeEntityByPath;

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

* @todo:临时支持子表,应该支持无限层级
* fixed by justin: 每级属性名都去掉s
*/

@@ -112,0 +113,0 @@ private convertPathToUrl;

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