Merge branch 'dev' into auth
This commit is contained in:
commit
f23cf396a7
|
|
@ -1868,7 +1868,10 @@ var CascadeStore = /** @class */ (function (_super) {
|
||||||
* @param context
|
* @param context
|
||||||
*/
|
*/
|
||||||
CascadeStore.prototype.addToResultSelections = function (entity, rows, context) {
|
CascadeStore.prototype.addToResultSelections = function (entity, rows, context) {
|
||||||
|
var e_12, _a;
|
||||||
if (this.supportManyToOneJoin()) {
|
if (this.supportManyToOneJoin()) {
|
||||||
|
// 这里的外键连接有可能为空,需要使用所有的行的attr的并集来测试
|
||||||
|
var attrs = (0, lodash_1.uniq)(rows.map(function (ele) { return Object.keys(ele); }).flat());
|
||||||
var attrsToPick_1 = [];
|
var attrsToPick_1 = [];
|
||||||
var _loop_3 = function (attr) {
|
var _loop_3 = function (attr) {
|
||||||
var data = {};
|
var data = {};
|
||||||
|
|
@ -1887,8 +1890,18 @@ var CascadeStore = /** @class */ (function (_super) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var this_3 = this;
|
var this_3 = this;
|
||||||
for (var attr in rows[0]) {
|
try {
|
||||||
_loop_3(attr);
|
for (var attrs_1 = tslib_1.__values(attrs), attrs_1_1 = attrs_1.next(); !attrs_1_1.done; attrs_1_1 = attrs_1.next()) {
|
||||||
|
var attr = attrs_1_1.value;
|
||||||
|
_loop_3(attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (attrs_1_1 && !attrs_1_1.done && (_a = attrs_1.return)) _a.call(attrs_1);
|
||||||
|
}
|
||||||
|
finally { if (e_12) throw e_12.error; }
|
||||||
}
|
}
|
||||||
var originRows = rows.map(function (ele) { return (0, lodash_1.pick)(ele, attrsToPick_1); });
|
var originRows = rows.map(function (ele) { return (0, lodash_1.pick)(ele, attrsToPick_1); });
|
||||||
this.addSingleRowToResultSelections(entity, originRows, context);
|
this.addSingleRowToResultSelections(entity, originRows, context);
|
||||||
|
|
@ -1967,7 +1980,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
||||||
if (!(cascadeSelectionFns.length > 0)) return [3 /*break*/, 3];
|
if (!(cascadeSelectionFns.length > 0)) return [3 /*break*/, 3];
|
||||||
ruException_2 = [];
|
ruException_2 = [];
|
||||||
return [4 /*yield*/, Promise.all(cascadeSelectionFns.map(function (ele) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
return [4 /*yield*/, Promise.all(cascadeSelectionFns.map(function (ele) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
||||||
var e_12, rows_2;
|
var e_13, rows_2;
|
||||||
return tslib_1.__generator(this, function (_a) {
|
return tslib_1.__generator(this, function (_a) {
|
||||||
switch (_a.label) {
|
switch (_a.label) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -1977,13 +1990,13 @@ var CascadeStore = /** @class */ (function (_super) {
|
||||||
_a.sent();
|
_a.sent();
|
||||||
return [3 /*break*/, 3];
|
return [3 /*break*/, 3];
|
||||||
case 2:
|
case 2:
|
||||||
e_12 = _a.sent();
|
e_13 = _a.sent();
|
||||||
if (e_12 instanceof types_1.OakRowUnexistedException) {
|
if (e_13 instanceof types_1.OakRowUnexistedException) {
|
||||||
rows_2 = e_12.getRows();
|
rows_2 = e_13.getRows();
|
||||||
ruException_2.push.apply(ruException_2, tslib_1.__spreadArray([], tslib_1.__read(rows_2), false));
|
ruException_2.push.apply(ruException_2, tslib_1.__spreadArray([], tslib_1.__read(rows_2), false));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw e_12;
|
throw e_13;
|
||||||
}
|
}
|
||||||
return [3 /*break*/, 3];
|
return [3 /*break*/, 3];
|
||||||
case 3: return [2 /*return*/];
|
case 3: return [2 /*return*/];
|
||||||
|
|
|
||||||
|
|
@ -53,34 +53,48 @@ function makeIntrinsicWatchers(schema) {
|
||||||
return watchers;
|
return watchers;
|
||||||
}
|
}
|
||||||
function checkUniqueBetweenRows(rows, uniqAttrs) {
|
function checkUniqueBetweenRows(rows, uniqAttrs) {
|
||||||
|
var e_1, _a, e_2, _b;
|
||||||
// 先检查这些行本身之间有无unique冲突
|
// 先检查这些行本身之间有无unique冲突
|
||||||
var uniqRows = (0, lodash_1.uniqBy)(rows, function (d) {
|
var dict = {};
|
||||||
var e_1, _a;
|
try {
|
||||||
var s = '';
|
for (var rows_1 = tslib_1.__values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
|
||||||
try {
|
var row = rows_1_1.value;
|
||||||
for (var uniqAttrs_1 = tslib_1.__values(uniqAttrs), uniqAttrs_1_1 = uniqAttrs_1.next(); !uniqAttrs_1_1.done; uniqAttrs_1_1 = uniqAttrs_1.next()) {
|
var s = '';
|
||||||
var a = uniqAttrs_1_1.value;
|
|
||||||
if (d[a] === null || d[a] === undefined) {
|
|
||||||
s + d.id;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
s + "-".concat(d[a]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
||||||
finally {
|
|
||||||
try {
|
try {
|
||||||
if (uniqAttrs_1_1 && !uniqAttrs_1_1.done && (_a = uniqAttrs_1.return)) _a.call(uniqAttrs_1);
|
for (var uniqAttrs_1 = (e_2 = void 0, tslib_1.__values(uniqAttrs)), uniqAttrs_1_1 = uniqAttrs_1.next(); !uniqAttrs_1_1.done; uniqAttrs_1_1 = uniqAttrs_1.next()) {
|
||||||
|
var a = uniqAttrs_1_1.value;
|
||||||
|
if (row[a] === null || row[a] === undefined) {
|
||||||
|
s + row.id;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s + "-".concat(row[a]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
if (uniqAttrs_1_1 && !uniqAttrs_1_1.done && (_b = uniqAttrs_1.return)) _b.call(uniqAttrs_1);
|
||||||
|
}
|
||||||
|
finally { if (e_2) throw e_2.error; }
|
||||||
|
}
|
||||||
|
if (dict[s]) {
|
||||||
|
throw new types_1.OakUniqueViolationException([{
|
||||||
|
id: row.id,
|
||||||
|
attrs: uniqAttrs,
|
||||||
|
}]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dict[s] = 1;
|
||||||
}
|
}
|
||||||
finally { if (e_1) throw e_1.error; }
|
|
||||||
}
|
}
|
||||||
return s;
|
}
|
||||||
});
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
if (uniqRows.length < rows.length) {
|
finally {
|
||||||
throw new types_1.OakUniqueViolationException([{
|
try {
|
||||||
attrs: uniqAttrs,
|
if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
|
||||||
}]);
|
}
|
||||||
|
finally { if (e_1) throw e_1.error; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function checkCountLessThan(count, uniqAttrs, than, id) {
|
function checkCountLessThan(count, uniqAttrs, than, id) {
|
||||||
|
|
@ -193,7 +207,7 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var _loop_2 = function (entity) {
|
var _loop_2 = function (entity) {
|
||||||
var e_2, _e;
|
var e_3, _e;
|
||||||
var indexes = schema[entity].indexes;
|
var indexes = schema[entity].indexes;
|
||||||
if (indexes) {
|
if (indexes) {
|
||||||
var _loop_4 = function (index) {
|
var _loop_4 = function (index) {
|
||||||
|
|
@ -224,7 +238,7 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
|
||||||
type: 'logical',
|
type: 'logical',
|
||||||
priority: types_1.CHECKER_MAX_PRIORITY,
|
priority: types_1.CHECKER_MAX_PRIORITY,
|
||||||
checker: function (operation, context) {
|
checker: function (operation, context) {
|
||||||
var e_3, _a, e_4, _b, _c;
|
var e_4, _a, e_5, _b, _c;
|
||||||
var _d = operation, data = _d.data, operationFilter = _d.filter;
|
var _d = operation, data = _d.data, operationFilter = _d.filter;
|
||||||
var attrs = Object.keys(data);
|
var attrs = Object.keys(data);
|
||||||
var refAttrs = (0, lodash_1.intersection)(attrs, uniqAttrs_2);
|
var refAttrs = (0, lodash_1.intersection)(attrs, uniqAttrs_2);
|
||||||
|
|
@ -233,7 +247,7 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
for (var refAttrs_1 = (e_3 = void 0, tslib_1.__values(refAttrs)), refAttrs_1_1 = refAttrs_1.next(); !refAttrs_1_1.done; refAttrs_1_1 = refAttrs_1.next()) {
|
for (var refAttrs_1 = (e_4 = void 0, tslib_1.__values(refAttrs)), refAttrs_1_1 = refAttrs_1.next(); !refAttrs_1_1.done; refAttrs_1_1 = refAttrs_1.next()) {
|
||||||
var attr = refAttrs_1_1.value;
|
var attr = refAttrs_1_1.value;
|
||||||
// 如果有更新为null值,不用再检查约束
|
// 如果有更新为null值,不用再检查约束
|
||||||
if (data[attr] === null || data[attr] === undefined) {
|
if (data[attr] === null || data[attr] === undefined) {
|
||||||
|
|
@ -241,12 +255,12 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
if (refAttrs_1_1 && !refAttrs_1_1.done && (_a = refAttrs_1.return)) _a.call(refAttrs_1);
|
if (refAttrs_1_1 && !refAttrs_1_1.done && (_a = refAttrs_1.return)) _a.call(refAttrs_1);
|
||||||
}
|
}
|
||||||
finally { if (e_3) throw e_3.error; }
|
finally { if (e_4) throw e_4.error; }
|
||||||
}
|
}
|
||||||
if (refAttrs.length === uniqAttrs_2.length) {
|
if (refAttrs.length === uniqAttrs_2.length) {
|
||||||
// 如果更新了全部属性,直接检查
|
// 如果更新了全部属性,直接检查
|
||||||
|
|
@ -257,12 +271,12 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
|
||||||
$not: operationFilter,
|
$not: operationFilter,
|
||||||
}]),
|
}]),
|
||||||
}, { dontCollect: true });
|
}, { dontCollect: true });
|
||||||
var checkCount = checkCountLessThan(count, uniqAttrs_2);
|
var checkCount = checkCountLessThan(count, uniqAttrs_2, 0, operationFilter === null || operationFilter === void 0 ? void 0 : operationFilter.id);
|
||||||
// 更新的行只能有一行
|
// 更新的行只能有一行
|
||||||
var rowCount = context.count(entity, {
|
var rowCount = context.count(entity, {
|
||||||
filter: operationFilter,
|
filter: operationFilter,
|
||||||
}, { dontCollect: true });
|
}, { dontCollect: true });
|
||||||
var checkRowCount = checkCountLessThan(rowCount, uniqAttrs_2, 1);
|
var checkRowCount = checkCountLessThan(rowCount, uniqAttrs_2, 1, operationFilter === null || operationFilter === void 0 ? void 0 : operationFilter.id);
|
||||||
// 如果更新的行数为零似乎也可以,但这应该不可能出现吧,by Xc 20230131
|
// 如果更新的行数为零似乎也可以,但这应该不可能出现吧,by Xc 20230131
|
||||||
if (checkRowCount instanceof Promise) {
|
if (checkRowCount instanceof Promise) {
|
||||||
return Promise.all([checkCount, checkRowCount]).then(function () { return undefined; });
|
return Promise.all([checkCount, checkRowCount]).then(function () { return undefined; });
|
||||||
|
|
@ -271,19 +285,19 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
|
||||||
// 否则需要结合本行现有的属性来进行检查
|
// 否则需要结合本行现有的属性来进行检查
|
||||||
var projection = { id: 1 };
|
var projection = { id: 1 };
|
||||||
try {
|
try {
|
||||||
for (var uniqAttrs_3 = (e_4 = void 0, tslib_1.__values(uniqAttrs_2)), uniqAttrs_3_1 = uniqAttrs_3.next(); !uniqAttrs_3_1.done; uniqAttrs_3_1 = uniqAttrs_3.next()) {
|
for (var uniqAttrs_3 = (e_5 = void 0, tslib_1.__values(uniqAttrs_2)), uniqAttrs_3_1 = uniqAttrs_3.next(); !uniqAttrs_3_1.done; uniqAttrs_3_1 = uniqAttrs_3.next()) {
|
||||||
var attr = uniqAttrs_3_1.value;
|
var attr = uniqAttrs_3_1.value;
|
||||||
Object.assign(projection, (_c = {},
|
Object.assign(projection, (_c = {},
|
||||||
_c[attr] = 1,
|
_c[attr] = 1,
|
||||||
_c));
|
_c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
if (uniqAttrs_3_1 && !uniqAttrs_3_1.done && (_b = uniqAttrs_3.return)) _b.call(uniqAttrs_3);
|
if (uniqAttrs_3_1 && !uniqAttrs_3_1.done && (_b = uniqAttrs_3.return)) _b.call(uniqAttrs_3);
|
||||||
}
|
}
|
||||||
finally { if (e_4) throw e_4.error; }
|
finally { if (e_5) throw e_5.error; }
|
||||||
}
|
}
|
||||||
var checkWithRows = function (rows2) {
|
var checkWithRows = function (rows2) {
|
||||||
var rows22 = rows2.map(function (ele) { return Object.assign(ele, data); });
|
var rows22 = rows2.map(function (ele) { return Object.assign(ele, data); });
|
||||||
|
|
@ -309,17 +323,17 @@ function makeIntrinsicCTWs(schema, actionDefDict) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
for (var indexes_1 = (e_2 = void 0, tslib_1.__values(indexes)), indexes_1_1 = indexes_1.next(); !indexes_1_1.done; indexes_1_1 = indexes_1.next()) {
|
for (var indexes_1 = (e_3 = void 0, tslib_1.__values(indexes)), indexes_1_1 = indexes_1.next(); !indexes_1_1.done; indexes_1_1 = indexes_1.next()) {
|
||||||
var index = indexes_1_1.value;
|
var index = indexes_1_1.value;
|
||||||
_loop_4(index);
|
_loop_4(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
if (indexes_1_1 && !indexes_1_1.done && (_e = indexes_1.return)) _e.call(indexes_1);
|
if (indexes_1_1 && !indexes_1_1.done && (_e = indexes_1.return)) _e.call(indexes_1);
|
||||||
}
|
}
|
||||||
finally { if (e_2) throw e_2.error; }
|
finally { if (e_3) throw e_3.error; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,9 @@ export declare type Exportation<ED extends EntityDict, T extends keyof ED, K ext
|
||||||
id: string;
|
id: string;
|
||||||
entity: T;
|
entity: T;
|
||||||
projection: ED[T]['Selection']['data'];
|
projection: ED[T]['Selection']['data'];
|
||||||
headers: K[];
|
headers?: K[];
|
||||||
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
|
makeHeaders?: (dataList: Partial<ED[T]['Schema']>[]) => string[];
|
||||||
|
fn: (data: ED[T]['Schema'], context?: AsyncContext<ED>, properties?: Record<string, any>) => Promise<Partial<Record<string, string | number | boolean | null>>> | Partial<Record<string, string | number | boolean | null>>;
|
||||||
};
|
};
|
||||||
export declare type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
export declare type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ var ThousandCont = function (value) {
|
||||||
if (value1) {
|
if (value1) {
|
||||||
result = value1 + result;
|
result = value1 + result;
|
||||||
}
|
}
|
||||||
result = result + '.' + numArr[1];
|
result = numArr[1] ? result + '.' + numArr[1] : result;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
exports.ThousandCont = ThousandCont;
|
exports.ThousandCont = ThousandCont;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "oak-domain",
|
"name": "oak-domain",
|
||||||
"version": "2.6.10",
|
"version": "2.6.11",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "XuChang"
|
"name": "XuChang"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1899,8 +1899,13 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
|
||||||
*/
|
*/
|
||||||
private addToResultSelections<T extends keyof ED, Cxt extends AsyncContext<ED>>(entity: T, rows: Partial<ED[T]['Schema']>[], context: Cxt) {
|
private addToResultSelections<T extends keyof ED, Cxt extends AsyncContext<ED>>(entity: T, rows: Partial<ED[T]['Schema']>[], context: Cxt) {
|
||||||
if (this.supportManyToOneJoin()) {
|
if (this.supportManyToOneJoin()) {
|
||||||
|
// 这里的外键连接有可能为空,需要使用所有的行的attr的并集来测试
|
||||||
|
const attrs = uniq(rows.map(
|
||||||
|
ele => Object.keys(ele)
|
||||||
|
).flat());
|
||||||
const attrsToPick: string[] = [];
|
const attrsToPick: string[] = [];
|
||||||
for (const attr in rows[0]) {
|
|
||||||
|
for (const attr of attrs) {
|
||||||
const data: Partial<ED[T]['Schema']> = {}
|
const data: Partial<ED[T]['Schema']> = {}
|
||||||
const rel = this.judgeRelation(entity, attr);
|
const rel = this.judgeRelation(entity, attr);
|
||||||
if (rel === 2) {
|
if (rel === 2) {
|
||||||
|
|
|
||||||
|
|
@ -57,22 +57,26 @@ function makeIntrinsicWatchers<ED extends EntityDict & BaseEntityDict>(schema: S
|
||||||
|
|
||||||
function checkUniqueBetweenRows(rows: Record<string, any>[], uniqAttrs: string[]) {
|
function checkUniqueBetweenRows(rows: Record<string, any>[], uniqAttrs: string[]) {
|
||||||
// 先检查这些行本身之间有无unique冲突
|
// 先检查这些行本身之间有无unique冲突
|
||||||
const uniqRows = uniqBy(rows, (d) => {
|
const dict: Record<string, 1> = {};
|
||||||
|
for (const row of rows) {
|
||||||
let s = '';
|
let s = '';
|
||||||
for (const a of uniqAttrs) {
|
for (const a of uniqAttrs) {
|
||||||
if (d[a as string] === null || d[a as string] === undefined) {
|
if (row[a] === null || row[a] === undefined) {
|
||||||
s + d.id;
|
s + row.id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s + `-${d[a as string]}`;
|
s + `-${row[a]}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s;
|
if (dict[s]) {
|
||||||
});
|
throw new OakUniqueViolationException([{
|
||||||
if (uniqRows.length < rows.length) {
|
id: row.id,
|
||||||
throw new OakUniqueViolationException([{
|
attrs: uniqAttrs,
|
||||||
attrs: uniqAttrs,
|
}]);
|
||||||
}]);
|
}
|
||||||
|
else {
|
||||||
|
dict[s] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,13 +254,13 @@ export function makeIntrinsicCTWs<ED extends EntityDict & BaseEntityDict, Cxt ex
|
||||||
$not: operationFilter,
|
$not: operationFilter,
|
||||||
}]),
|
}]),
|
||||||
}, { dontCollect: true });
|
}, { dontCollect: true });
|
||||||
const checkCount = checkCountLessThan(count, uniqAttrs);
|
const checkCount = checkCountLessThan(count, uniqAttrs, 0, operationFilter?.id);
|
||||||
|
|
||||||
// 更新的行只能有一行
|
// 更新的行只能有一行
|
||||||
const rowCount = context.count(entity, {
|
const rowCount = context.count(entity, {
|
||||||
filter: operationFilter,
|
filter: operationFilter,
|
||||||
}, { dontCollect: true });
|
}, { dontCollect: true });
|
||||||
const checkRowCount = checkCountLessThan(rowCount, uniqAttrs, 1);
|
const checkRowCount = checkCountLessThan(rowCount, uniqAttrs, 1, operationFilter?.id);
|
||||||
|
|
||||||
// 如果更新的行数为零似乎也可以,但这应该不可能出现吧,by Xc 20230131
|
// 如果更新的行数为零似乎也可以,但这应该不可能出现吧,by Xc 20230131
|
||||||
if (checkRowCount instanceof Promise) {
|
if (checkRowCount instanceof Promise) {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@ export type Exportation<ED extends EntityDict, T extends keyof ED, K extends str
|
||||||
id: string;
|
id: string;
|
||||||
entity: T;
|
entity: T;
|
||||||
projection: ED[T]['Selection']['data'];
|
projection: ED[T]['Selection']['data'];
|
||||||
headers: K[];
|
headers?: K[];
|
||||||
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
|
makeHeaders?: (dataList: Partial<ED[T]['Schema']>[]) => string[];
|
||||||
|
fn: (data: ED[T]['Schema'], context?: AsyncContext<ED>, properties?: Record<string, any>) => Promise<Partial<Record<string, string | number | boolean | null>>> | Partial<Record<string, string | number | boolean | null>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
export type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
|
||||||
|
|
@ -17,5 +18,5 @@ export type Importation<ED extends EntityDict, T extends keyof ED, K extends str
|
||||||
entity: T;
|
entity: T;
|
||||||
headers: K[];
|
headers: K[];
|
||||||
// 解析过程中如果出错,请抛出OakImportDataParseException异常
|
// 解析过程中如果出错,请抛出OakImportDataParseException异常
|
||||||
fn: (data: Partial<Record<K, string | number | boolean>>[], context: AsyncContext<ED>, option?: Record<string, any> ) => Promise<ED[T]['CreateMulti']['data']>;
|
fn: (data: Partial<Record<K, string | number | boolean>>[], context: AsyncContext<ED>, option?: Record<string, any>) => Promise<ED[T]['CreateMulti']['data']>;
|
||||||
};
|
};
|
||||||
|
|
@ -34,7 +34,7 @@ const ThousandCont: (value: number) => string | undefined = (value) => {
|
||||||
if (value1) {
|
if (value1) {
|
||||||
result = value1 + result;
|
result = value1 + result;
|
||||||
}
|
}
|
||||||
result = result + '.' + numArr[1];
|
result = numArr[1] ? result + '.' + numArr[1] : result;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue