fix: 修复了在entities中引用项目中其他位置的类型时出现的引用路径问题
This commit is contained in:
parent
77c5dcaeaa
commit
32675a9080
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.analyzeDepedency = void 0;
|
exports.analyzeDepedency = analyzeDepedency;
|
||||||
|
exports.default = buildDependency;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
|
|
@ -87,7 +88,6 @@ function analyzeDepedency(cwd) {
|
||||||
} while (true);
|
} while (true);
|
||||||
return depGraph;
|
return depGraph;
|
||||||
}
|
}
|
||||||
exports.analyzeDepedency = analyzeDepedency;
|
|
||||||
function join(...paths) {
|
function join(...paths) {
|
||||||
const path = (0, path_1.join)(...paths);
|
const path = (0, path_1.join)(...paths);
|
||||||
return path.replaceAll('\\', '/');
|
return path.replaceAll('\\', '/');
|
||||||
|
|
@ -1030,4 +1030,3 @@ function buildDependency(rebuild) {
|
||||||
tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer, rebuild);
|
tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer, rebuild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = buildDependency;
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { Hash } from 'crypto';
|
import { Hash } from 'crypto';
|
||||||
/**
|
/**
|
||||||
* 这个类的作用是把项目和所有相关的模块下的locales编译成为src/data/i18n中的数据
|
* 这个类的作用是把项目和所有相关的模块下的locales编译成为src/data/i18n中的数据
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.buildRouter = void 0;
|
exports.buildRouter = buildRouter;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const path_1 = require("path");
|
const path_1 = require("path");
|
||||||
const fs_extra_1 = require("fs-extra");
|
const fs_extra_1 = require("fs-extra");
|
||||||
|
|
@ -254,4 +254,3 @@ function buildRouter(projectDir, startupDir, watch) {
|
||||||
watchDir(projectDir, startupDir, type);
|
watchDir(projectDir, startupDir, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.buildRouter = buildRouter;
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ declare const Schema: Record<string, {
|
||||||
inModi: boolean;
|
inModi: boolean;
|
||||||
relations: false | string[];
|
relations: false | string[];
|
||||||
extendsFrom: string[];
|
extendsFrom: string[];
|
||||||
importAttrFrom: Record<string, [string, string | undefined]>;
|
importAttrFrom: Record<string, [string, string | undefined, string]>;
|
||||||
}>;
|
}>;
|
||||||
export declare function constructAttributes(entity: string): ts.PropertyAssignment[];
|
export declare function constructAttributes(entity: string): ts.PropertyAssignment[];
|
||||||
export declare function translateLocaleObject(locale: ts.ObjectLiteralExpression): Record<string, any>;
|
export declare function translateLocaleObject(locale: ts.ObjectLiteralExpression): Record<string, any>;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,17 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.buildSchema = exports.getProjectionKeys = exports.buildSchemaBackup = exports.analyzeEntities = exports.getAnalizedSchema = exports.registerDeducedRelationMap = exports.registerFixedDestinationPathMap = exports.registerIgnoredRelationPathMap = exports.registerFreeEntities = exports.registerIgnoredForeignKeyMap = exports.translateLocaleObject = exports.constructAttributes = void 0;
|
exports.getAnalizedSchema = void 0;
|
||||||
|
exports.constructAttributes = constructAttributes;
|
||||||
|
exports.translateLocaleObject = translateLocaleObject;
|
||||||
|
exports.registerIgnoredForeignKeyMap = registerIgnoredForeignKeyMap;
|
||||||
|
exports.registerFreeEntities = registerFreeEntities;
|
||||||
|
exports.registerIgnoredRelationPathMap = registerIgnoredRelationPathMap;
|
||||||
|
exports.registerFixedDestinationPathMap = registerFixedDestinationPathMap;
|
||||||
|
exports.registerDeducedRelationMap = registerDeducedRelationMap;
|
||||||
|
exports.analyzeEntities = analyzeEntities;
|
||||||
|
exports.buildSchemaBackup = buildSchemaBackup;
|
||||||
|
exports.getProjectionKeys = getProjectionKeys;
|
||||||
|
exports.buildSchema = buildSchema;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const path_1 = tslib_1.__importDefault(require("path"));
|
const path_1 = tslib_1.__importDefault(require("path"));
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
|
|
@ -219,6 +230,37 @@ function addImportedFrom(moduleName, name, node) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 计算编译后文件的正确导入路径
|
||||||
|
* @param sourceFilePath 源文件路径(相对于项目根目录),例如: 'src/entities/User.ts'
|
||||||
|
* @param outputFilePath 输出文件路径(相对于项目根目录),例如: 'src/oak-app-domain/User/_baseschema.ts'
|
||||||
|
* @param importPath 原始导入路径,例如: '../types/Config' 或 '@/utils/helper'
|
||||||
|
* @param projectRoot 项目根目录,默认为当前目录
|
||||||
|
* @returns 新的相对导入路径
|
||||||
|
*/
|
||||||
|
function resolveCompiledImportPath(sourceFilePath, outputFilePath, importPath, projectRoot = '.') {
|
||||||
|
// 如果不是相对路径(例如 node_modules 的包或别名路径),直接返回
|
||||||
|
if (!importPath.startsWith('.')) {
|
||||||
|
return importPath;
|
||||||
|
}
|
||||||
|
// 1. 获取源文件所在目录
|
||||||
|
const sourceDir = path_1.default.dirname(sourceFilePath);
|
||||||
|
// 2. 解析原始导入路径,得到目标文件的绝对路径(相对于项目根目录)
|
||||||
|
const targetAbsolutePath = path_1.default.join(projectRoot, sourceDir, importPath);
|
||||||
|
const normalizedTargetPath = path_1.default.normalize(targetAbsolutePath);
|
||||||
|
// 3. 获取输出文件所在目录
|
||||||
|
const outputDir = path_1.default.dirname(outputFilePath);
|
||||||
|
const normalizedOutputDir = path_1.default.normalize(path_1.default.join(projectRoot, outputDir));
|
||||||
|
// 4. 计算从输出目录到目标文件的相对路径
|
||||||
|
let relativePath = path_1.default.relative(normalizedOutputDir, normalizedTargetPath);
|
||||||
|
// 5. 标准化路径分隔符为 '/'
|
||||||
|
relativePath = relativePath.replace(/\\/g, '/');
|
||||||
|
// 6. 确保相对路径以 './' 或 '../' 开头
|
||||||
|
if (!relativePath.startsWith('.')) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
return relativePath;
|
||||||
|
}
|
||||||
function analyzeExternalAttrImport(node, program, importAttrFrom, relativePath) {
|
function analyzeExternalAttrImport(node, program, importAttrFrom, relativePath) {
|
||||||
const checker = program.getTypeChecker();
|
const checker = program.getTypeChecker();
|
||||||
const symbol = checker.getSymbolAtLocation(node.typeName);
|
const symbol = checker.getSymbolAtLocation(node.typeName);
|
||||||
|
|
@ -240,11 +282,19 @@ function analyzeExternalAttrImport(node, program, importAttrFrom, relativePath)
|
||||||
(0, assert_1.default)(importSpecifier, `未找到${name}的importSpecifier`);
|
(0, assert_1.default)(importSpecifier, `未找到${name}的importSpecifier`);
|
||||||
const propertyName = importSpecifier.propertyName && importSpecifier.propertyName.text;
|
const propertyName = importSpecifier.propertyName && importSpecifier.propertyName.text;
|
||||||
const importFrom = moduleSpecifier.text;
|
const importFrom = moduleSpecifier.text;
|
||||||
const importFromRelatively = importFrom.startsWith('.') ? (relativePath
|
// const importFromRelatively = importFrom.startsWith('.') ? (relativePath
|
||||||
? path_1.default.join(relativePath, importFrom).replace(/\\/g, '/')
|
// ? PathLib.join(
|
||||||
: path_1.default.join('..', importFrom).replace(/\\/g, '/')) : importFrom;
|
// relativePath,
|
||||||
|
// importFrom
|
||||||
|
// ).replace(/\\/g, '/')
|
||||||
|
// : PathLib.join(
|
||||||
|
// '..',
|
||||||
|
// importFrom
|
||||||
|
// ).replace(/\\/g, '/')) : importFrom;
|
||||||
|
const sourceFilePath = declaration.getSourceFile().fileName;
|
||||||
(0, lodash_1.assign)(importAttrFrom, {
|
(0, lodash_1.assign)(importAttrFrom, {
|
||||||
[name]: [importFromRelatively, propertyName],
|
// [name]: [importFromRelatively, propertyName],
|
||||||
|
[name]: [importFrom, propertyName, sourceFilePath],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (ts.isTypeAliasDeclaration(declaration)) {
|
else if (ts.isTypeAliasDeclaration(declaration)) {
|
||||||
|
|
@ -3759,12 +3809,30 @@ function _outputBaseSchema(outputDir, printer) {
|
||||||
// 从外部引入的属性
|
// 从外部引入的属性
|
||||||
const fromExternalImportAttrs = {};
|
const fromExternalImportAttrs = {};
|
||||||
for (const attr in importAttrFrom) {
|
for (const attr in importAttrFrom) {
|
||||||
const [from, propertyName] = importAttrFrom[attr];
|
// const [from, propertyName] = importAttrFrom[attr];
|
||||||
if (fromExternalImportAttrs[from]) {
|
// if (fromExternalImportAttrs[from]) {
|
||||||
fromExternalImportAttrs[from].push([attr, propertyName]);
|
// fromExternalImportAttrs[from].push([attr, propertyName]);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// fromExternalImportAttrs[from] = [[attr, propertyName]];
|
||||||
|
// }
|
||||||
|
const [from, propertyName, sourceFilePath] = importAttrFrom[attr];
|
||||||
|
// ===== 在这里进行路径转换 =====
|
||||||
|
const outputFilePath = path_1.default.join(outputDir, entity, '_baseSchema.ts'); // 输出文件路径
|
||||||
|
// 使用路径解析算法计算新的导入路径
|
||||||
|
const newImportPath = resolveCompiledImportPath(path_1.default.relative(process.cwd(), sourceFilePath), path_1.default.relative(process.cwd(), outputFilePath), from, // 原始导入路径
|
||||||
|
".");
|
||||||
|
// console.log('resolve import path:', {
|
||||||
|
// sourceFilePath: PathLib.relative(process.cwd(), sourceFilePath),
|
||||||
|
// outputFilePath: PathLib.relative(process.cwd(), outputFilePath),
|
||||||
|
// from,
|
||||||
|
// newImportPath,
|
||||||
|
// });
|
||||||
|
if (fromExternalImportAttrs[newImportPath]) {
|
||||||
|
fromExternalImportAttrs[newImportPath].push([attr, propertyName]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fromExternalImportAttrs[from] = [[attr, propertyName]];
|
fromExternalImportAttrs[newImportPath] = [[attr, propertyName]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const external in fromExternalImportAttrs) {
|
for (const external in fromExternalImportAttrs) {
|
||||||
|
|
@ -4009,7 +4077,6 @@ function constructAttributes(entity) {
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.constructAttributes = constructAttributes;
|
|
||||||
function translateLocaleObject(locale) {
|
function translateLocaleObject(locale) {
|
||||||
const result = {};
|
const result = {};
|
||||||
locale.properties.forEach((ele) => {
|
locale.properties.forEach((ele) => {
|
||||||
|
|
@ -4028,7 +4095,6 @@ function translateLocaleObject(locale) {
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.translateLocaleObject = translateLocaleObject;
|
|
||||||
function outputLocale(outputDir, printer) {
|
function outputLocale(outputDir, printer) {
|
||||||
const locales = {};
|
const locales = {};
|
||||||
const entities = [];
|
const entities = [];
|
||||||
|
|
@ -4303,7 +4369,6 @@ let FIXED_FOR_ALL_DESTINATION_PATH_ENTITIES = [];
|
||||||
function registerIgnoredForeignKeyMap(map) {
|
function registerIgnoredForeignKeyMap(map) {
|
||||||
IGNORED_FOREIGN_KEY_MAP = map;
|
IGNORED_FOREIGN_KEY_MAP = map;
|
||||||
}
|
}
|
||||||
exports.registerIgnoredForeignKeyMap = registerIgnoredForeignKeyMap;
|
|
||||||
/**
|
/**
|
||||||
* 此函数不再使用
|
* 此函数不再使用
|
||||||
* @param map
|
* @param map
|
||||||
|
|
@ -4313,7 +4378,6 @@ function registerFreeEntities(selectFreeEntities = [], createFreeEntities = [],
|
||||||
CREATE_FREE_ENTITIES = createFreeEntities;
|
CREATE_FREE_ENTITIES = createFreeEntities;
|
||||||
UPDATE_FREE_ENTITIES = updateFreeEntities;
|
UPDATE_FREE_ENTITIES = updateFreeEntities;
|
||||||
}
|
}
|
||||||
exports.registerFreeEntities = registerFreeEntities;
|
|
||||||
/**
|
/**
|
||||||
* 此函数不再使用
|
* 此函数不再使用
|
||||||
* @param map
|
* @param map
|
||||||
|
|
@ -4323,7 +4387,6 @@ function registerIgnoredRelationPathMap(map) {
|
||||||
IGNORED_RELATION_PATH_MAP[(0, string_1.firstLetterUpperCase)(k)] = map[k];
|
IGNORED_RELATION_PATH_MAP[(0, string_1.firstLetterUpperCase)(k)] = map[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.registerIgnoredRelationPathMap = registerIgnoredRelationPathMap;
|
|
||||||
/**
|
/**
|
||||||
* 很多路径虽然最后指向同一对象,但不能封掉,封了会导致查询的时候找不到对应的路径path
|
* 很多路径虽然最后指向同一对象,但不能封掉,封了会导致查询的时候找不到对应的路径path
|
||||||
* @param map
|
* @param map
|
||||||
|
|
@ -4341,7 +4404,6 @@ function registerFixedDestinationPathMap(map) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.registerFixedDestinationPathMap = registerFixedDestinationPathMap;
|
|
||||||
/**
|
/**
|
||||||
* 此函数不再使用
|
* 此函数不再使用
|
||||||
* @param map
|
* @param map
|
||||||
|
|
@ -4360,7 +4422,6 @@ function registerDeducedRelationMap(map) {
|
||||||
DEDUCED_RELATION_MAP[entity] = map[k];
|
DEDUCED_RELATION_MAP[entity] = map[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.registerDeducedRelationMap = registerDeducedRelationMap;
|
|
||||||
/**
|
/**
|
||||||
* 输出所有和User相关的对象的后继
|
* 输出所有和User相关的对象的后继
|
||||||
* 此函数不再使用
|
* 此函数不再使用
|
||||||
|
|
@ -4866,7 +4927,6 @@ function analyzeEntities(inputDir, relativePath) {
|
||||||
analyzeInModi();
|
analyzeInModi();
|
||||||
uniqRelationships();
|
uniqRelationships();
|
||||||
}
|
}
|
||||||
exports.analyzeEntities = analyzeEntities;
|
|
||||||
function buildSchemaBackup(outputDir) {
|
function buildSchemaBackup(outputDir) {
|
||||||
addReverseRelationship();
|
addReverseRelationship();
|
||||||
// setRelationEntities();
|
// setRelationEntities();
|
||||||
|
|
@ -4885,7 +4945,6 @@ function buildSchemaBackup(outputDir) {
|
||||||
outputPackageJson(outputDir);
|
outputPackageJson(outputDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.buildSchemaBackup = buildSchemaBackup;
|
|
||||||
function _getAggrKey(entity, foreignKey) {
|
function _getAggrKey(entity, foreignKey) {
|
||||||
const aggrKey = `${entity}$${foreignKey}`;
|
const aggrKey = `${entity}$${foreignKey}`;
|
||||||
if (process.env.COMPLING_AS_LIB) {
|
if (process.env.COMPLING_AS_LIB) {
|
||||||
|
|
@ -5625,7 +5684,6 @@ function getProjectionKeys(entity) {
|
||||||
}
|
}
|
||||||
return [...new Set([...keys, ...getOpProjectionKeys(entity)])];
|
return [...new Set([...keys, ...getOpProjectionKeys(entity)])];
|
||||||
}
|
}
|
||||||
exports.getProjectionKeys = getProjectionKeys;
|
|
||||||
function _outputSchema(outputDir, printer) {
|
function _outputSchema(outputDir, printer) {
|
||||||
for (const entity in Schema) {
|
for (const entity in Schema) {
|
||||||
const statements = [
|
const statements = [
|
||||||
|
|
@ -5660,4 +5718,3 @@ function buildSchema(outputDir) {
|
||||||
outputStyleDict(outputDir, printer);
|
outputStyleDict(outputDir, printer);
|
||||||
outputIndexTs(outputDir);
|
outputIndexTs(outputDir);
|
||||||
}
|
}
|
||||||
exports.buildSchema = buildSchema;
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo, OakException } from "../types";
|
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo, OakException } from "../types";
|
||||||
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
||||||
import { IncomingHttpHeaders } from "http";
|
import { IncomingHttpHeaders } from "http";
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export declare abstract class CascadeStore<ED extends EntityDict & BaseEntityDic
|
||||||
protected abstract aggregateAbjointRowAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(entity: T, aggregation: ED[T]['Aggregation'], context: Cxt, option: OP): Promise<AggregationResult<ED[T]['Schema']>>;
|
protected abstract aggregateAbjointRowAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(entity: T, aggregation: ED[T]['Aggregation'], context: Cxt, option: OP): Promise<AggregationResult<ED[T]['Schema']>>;
|
||||||
protected destructCascadeSelect<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED> | AsyncContext<ED>>(entity: T, projection2: ED[T]['Projection'], context: Cxt, cascadeSelectFn: <T2 extends keyof ED>(entity2: T2, selection: ED[T2]['Selection'], context: Cxt, op: OP) => Partial<ED[T2]['Schema']>[] | Promise<Partial<ED[T2]['Schema']>[]>, aggregateFn: <T2 extends keyof ED>(entity2: T2, aggregation: ED[T2]['Aggregation'], context: Cxt, op: OP) => AggregationResult<ED[T2]['Schema']> | Promise<AggregationResult<ED[T2]['Schema']>>, option: OP, selectionId?: string): {
|
protected destructCascadeSelect<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED> | AsyncContext<ED>>(entity: T, projection2: ED[T]['Projection'], context: Cxt, cascadeSelectFn: <T2 extends keyof ED>(entity2: T2, selection: ED[T2]['Selection'], context: Cxt, op: OP) => Partial<ED[T2]['Schema']>[] | Promise<Partial<ED[T2]['Schema']>[]>, aggregateFn: <T2 extends keyof ED>(entity2: T2, aggregation: ED[T2]['Aggregation'], context: Cxt, op: OP) => AggregationResult<ED[T2]['Schema']> | Promise<AggregationResult<ED[T2]['Schema']>>, option: OP, selectionId?: string): {
|
||||||
projection: ED[T]["Projection"];
|
projection: ED[T]["Projection"];
|
||||||
cascadeSelectionFns: ((result: Partial<ED[T]['Schema']>[]) => Promise<void> | void)[];
|
cascadeSelectionFns: ((result: Partial<ED[T]["Schema"]>[]) => Promise<void> | void)[];
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 级联更新
|
* 级联更新
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.CascadeStore = exports.polishSelection = void 0;
|
exports.CascadeStore = void 0;
|
||||||
|
exports.polishSelection = polishSelection;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const Entity_1 = require("../types/Entity");
|
const Entity_1 = require("../types/Entity");
|
||||||
|
|
@ -285,7 +286,6 @@ function polishSelection(schema, entity, selection, context, option) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.polishSelection = polishSelection;
|
|
||||||
/**这个用来处理级联的select和update,对不同能力的 */
|
/**这个用来处理级联的select和update,对不同能力的 */
|
||||||
class CascadeStore extends RowStore_1.RowStore {
|
class CascadeStore extends RowStore_1.RowStore {
|
||||||
constructor(storageSchema) {
|
constructor(storageSchema) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.makeIntrinsicCheckers = void 0;
|
exports.makeIntrinsicCheckers = makeIntrinsicCheckers;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const types_1 = require("../types");
|
const types_1 = require("../types");
|
||||||
const lodash_1 = require("../utils/lodash");
|
const lodash_1 = require("../utils/lodash");
|
||||||
|
|
@ -398,4 +398,3 @@ function makeIntrinsicCheckers(schema, actionDefDict, attrUpdateMatrix) {
|
||||||
}
|
}
|
||||||
return checkers;
|
return checkers;
|
||||||
}
|
}
|
||||||
exports.makeIntrinsicCheckers = makeIntrinsicCheckers;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.makeIntrinsicLogics = void 0;
|
exports.makeIntrinsicLogics = makeIntrinsicLogics;
|
||||||
const triggers_1 = require("./triggers");
|
const triggers_1 = require("./triggers");
|
||||||
const modi_1 = require("./modi");
|
const modi_1 = require("./modi");
|
||||||
const IntrinsicCheckers_1 = require("./IntrinsicCheckers");
|
const IntrinsicCheckers_1 = require("./IntrinsicCheckers");
|
||||||
|
|
@ -42,4 +42,3 @@ function makeIntrinsicLogics(schema, actionDefDict, attrUpdateMatrix) {
|
||||||
watchers,
|
watchers,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.makeIntrinsicLogics = makeIntrinsicLogics;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getUserRelationsByActions = exports.RelationAuth = void 0;
|
exports.RelationAuth = void 0;
|
||||||
|
exports.getUserRelationsByActions = getUserRelationsByActions;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const types_1 = require("../types");
|
const types_1 = require("../types");
|
||||||
|
|
@ -1243,4 +1244,3 @@ async function getUserRelationsByActions(params, context) {
|
||||||
userEntities,
|
userEntities,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.getUserRelationsByActions = getUserRelationsByActions;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.createCreateCheckers = exports.createRemoveCheckers = exports.translateCheckerInSyncContext = exports.translateCheckerInAsyncContext = void 0;
|
exports.translateCheckerInAsyncContext = translateCheckerInAsyncContext;
|
||||||
|
exports.translateCheckerInSyncContext = translateCheckerInSyncContext;
|
||||||
|
exports.createRemoveCheckers = createRemoveCheckers;
|
||||||
|
exports.createCreateCheckers = createCreateCheckers;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const filter_1 = require("../store/filter");
|
const filter_1 = require("../store/filter");
|
||||||
|
|
@ -127,7 +130,6 @@ function translateCheckerInAsyncContext(checker, schema) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.translateCheckerInAsyncContext = translateCheckerInAsyncContext;
|
|
||||||
function translateCheckerInSyncContext(checker, schema) {
|
function translateCheckerInSyncContext(checker, schema) {
|
||||||
const { entity, type } = checker;
|
const { entity, type } = checker;
|
||||||
const when = 'before'; // 现在create的relation改成提前的expression检查了,原先是先插入再后检查,性能不行,而且select也需要实现前检查
|
const when = 'before'; // 现在create的relation改成提前的expression检查了,原先是先插入再后检查,性能不行,而且select也需要实现前检查
|
||||||
|
|
@ -186,7 +188,6 @@ function translateCheckerInSyncContext(checker, schema) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.translateCheckerInSyncContext = translateCheckerInSyncContext;
|
|
||||||
/**
|
/**
|
||||||
* 对对象的删除,检查其是否会产生其他行上的空指针,不允许这种情况的出现
|
* 对对象的删除,检查其是否会产生其他行上的空指针,不允许这种情况的出现
|
||||||
* @param schema
|
* @param schema
|
||||||
|
|
@ -331,7 +332,6 @@ function createRemoveCheckers(schema) {
|
||||||
}
|
}
|
||||||
return checkers;
|
return checkers;
|
||||||
}
|
}
|
||||||
exports.createRemoveCheckers = createRemoveCheckers;
|
|
||||||
function checkAttributeLegal(schema, entity, data) {
|
function checkAttributeLegal(schema, entity, data) {
|
||||||
const { attributes } = schema[entity];
|
const { attributes } = schema[entity];
|
||||||
for (const attr in data) {
|
for (const attr in data) {
|
||||||
|
|
@ -478,4 +478,3 @@ function createCreateCheckers(schema) {
|
||||||
}
|
}
|
||||||
return checkers;
|
return checkers;
|
||||||
}
|
}
|
||||||
exports.createCreateCheckers = createCreateCheckers;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,17 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.translateFilterToObjectPredicate = exports.checkFilterRepel = exports.checkFilterContains = exports.makeTreeDescendantFilter = exports.makeTreeAncestorFilter = exports.same = exports.getRelevantIds = exports.contains = exports.analyzeFilterRelation = exports.judgeValueRelation = exports.combineFilters = exports.translateCreateDataToFilter = void 0;
|
exports.translateCreateDataToFilter = translateCreateDataToFilter;
|
||||||
|
exports.combineFilters = combineFilters;
|
||||||
|
exports.judgeValueRelation = judgeValueRelation;
|
||||||
|
exports.analyzeFilterRelation = analyzeFilterRelation;
|
||||||
|
exports.contains = contains;
|
||||||
|
exports.getRelevantIds = getRelevantIds;
|
||||||
|
exports.same = same;
|
||||||
|
exports.makeTreeAncestorFilter = makeTreeAncestorFilter;
|
||||||
|
exports.makeTreeDescendantFilter = makeTreeDescendantFilter;
|
||||||
|
exports.checkFilterContains = checkFilterContains;
|
||||||
|
exports.checkFilterRepel = checkFilterRepel;
|
||||||
|
exports.translateFilterToObjectPredicate = translateFilterToObjectPredicate;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const types_1 = require("../types");
|
const types_1 = require("../types");
|
||||||
|
|
@ -36,7 +47,6 @@ function translateCreateDataToFilter(schema, entity, data, allowUnrecoganized) {
|
||||||
}
|
}
|
||||||
return data2;
|
return data2;
|
||||||
}
|
}
|
||||||
exports.translateCreateDataToFilter = translateCreateDataToFilter;
|
|
||||||
/**
|
/**
|
||||||
* 尽量合并外键的连接,防止在数据库中join的对象过多
|
* 尽量合并外键的连接,防止在数据库中join的对象过多
|
||||||
* @param entity
|
* @param entity
|
||||||
|
|
@ -484,7 +494,6 @@ function combineFilters(entity, schema, filters, union) {
|
||||||
}
|
}
|
||||||
return addFilterSegment(entity, schema, ...filters);
|
return addFilterSegment(entity, schema, ...filters);
|
||||||
}
|
}
|
||||||
exports.combineFilters = combineFilters;
|
|
||||||
/**
|
/**
|
||||||
* 在以下判断相容或相斥的过程中,相容/相斥的事实标准是:满足两个条件的查询集合是否被包容/互斥,但如果两个filter在逻辑上相容或者相斥,在事实上不一定相容或者相斥
|
* 在以下判断相容或相斥的过程中,相容/相斥的事实标准是:满足两个条件的查询集合是否被包容/互斥,但如果两个filter在逻辑上相容或者相斥,在事实上不一定相容或者相斥
|
||||||
* 例如:{ a: 1 } 和 { a: { $ne: 1 } } 是明显不相容的查询,但如果数据为空集,则这两个查询并不能否定其相容
|
* 例如:{ a: 1 } 和 { a: { $ne: 1 } } 是明显不相容的查询,但如果数据为空集,则这两个查询并不能否定其相容
|
||||||
|
|
@ -903,7 +912,6 @@ function judgeValueRelation(value1, value2, contained) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.judgeValueRelation = judgeValueRelation;
|
|
||||||
/**
|
/**
|
||||||
* 判断filter条件对compared条件上的attr键值的条件是否相容或相斥
|
* 判断filter条件对compared条件上的attr键值的条件是否相容或相斥
|
||||||
* @param entity
|
* @param entity
|
||||||
|
|
@ -1292,7 +1300,6 @@ function analyzeFilterRelation(entity, schema, filter, compared, contained) {
|
||||||
sureAttributes,
|
sureAttributes,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.analyzeFilterRelation = analyzeFilterRelation;
|
|
||||||
/** 判断filter条件对compared条件是否相容或相斥
|
/** 判断filter条件对compared条件是否相容或相斥
|
||||||
* @param entity
|
* @param entity
|
||||||
* @param schema
|
* @param schema
|
||||||
|
|
@ -1364,7 +1371,6 @@ function contains(entity, schema, filter, contained) {
|
||||||
return judgeFilterRelation(entity, schema, filter, contained, true);
|
return judgeFilterRelation(entity, schema, filter, contained, true);
|
||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
exports.contains = contains;
|
|
||||||
/**
|
/**
|
||||||
* 判断filter1和filter2是否相斥,即filter1和filter2查询的结果一定没有交集
|
* 判断filter1和filter2是否相斥,即filter1和filter2查询的结果一定没有交集
|
||||||
* filter1 = {
|
* filter1 = {
|
||||||
|
|
@ -1465,7 +1471,6 @@ function getRelevantIds(filter) {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.getRelevantIds = getRelevantIds;
|
|
||||||
/**
|
/**
|
||||||
* 判断两个过滤条件是否完全一致
|
* 判断两个过滤条件是否完全一致
|
||||||
* @param entity
|
* @param entity
|
||||||
|
|
@ -1480,7 +1485,6 @@ function same(entity, schema, filter1, filter2) {
|
||||||
}
|
}
|
||||||
return filter1.id === filter2.id;
|
return filter1.id === filter2.id;
|
||||||
}
|
}
|
||||||
exports.same = same;
|
|
||||||
/**
|
/**
|
||||||
* 寻找在树形结构中满足条件的数据行的上层数据
|
* 寻找在树形结构中满足条件的数据行的上层数据
|
||||||
* 例如在area表中,如果“杭州市”满足这一条件,则希望查到更高层的“浙江省”和“中国”,即可构造出满足条件的filter
|
* 例如在area表中,如果“杭州市”满足这一条件,则希望查到更高层的“浙江省”和“中国”,即可构造出满足条件的filter
|
||||||
|
|
@ -1521,7 +1525,6 @@ function makeTreeAncestorFilter(entity, parentKey, filter, level = 1, includeAll
|
||||||
}
|
}
|
||||||
return currentLevelInFilter;
|
return currentLevelInFilter;
|
||||||
}
|
}
|
||||||
exports.makeTreeAncestorFilter = makeTreeAncestorFilter;
|
|
||||||
/**
|
/**
|
||||||
* 寻找在树形结构中满足条件的数据行的下层数据
|
* 寻找在树形结构中满足条件的数据行的下层数据
|
||||||
* 例如在area表中,如果“杭州市”满足这一条件,则希望查到更低层的“西湖区”,即可构造出满足条件的filter
|
* 例如在area表中,如果“杭州市”满足这一条件,则希望查到更低层的“西湖区”,即可构造出满足条件的filter
|
||||||
|
|
@ -1556,7 +1559,6 @@ function makeTreeDescendantFilter(entity, parentKey, filter, level = 1, includeA
|
||||||
}
|
}
|
||||||
return currentLevelInFilter;
|
return currentLevelInFilter;
|
||||||
}
|
}
|
||||||
exports.makeTreeDescendantFilter = makeTreeDescendantFilter;
|
|
||||||
function checkDeduceFilters(dfc, context) {
|
function checkDeduceFilters(dfc, context) {
|
||||||
const { $and, $or } = dfc;
|
const { $and, $or } = dfc;
|
||||||
if ($and) {
|
if ($and) {
|
||||||
|
|
@ -1642,7 +1644,6 @@ function checkFilterContains(entity, context, contained, filter, dataCompare, wa
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.checkFilterContains = checkFilterContains;
|
|
||||||
function checkFilterRepel(entity, context, filter1, filter2, dataCompare, warningOnDataCompare) {
|
function checkFilterRepel(entity, context, filter1, filter2, dataCompare, warningOnDataCompare) {
|
||||||
(0, assert_1.default)(filter2);
|
(0, assert_1.default)(filter2);
|
||||||
const schema = context.getSchema();
|
const schema = context.getSchema();
|
||||||
|
|
@ -1658,7 +1659,6 @@ function checkFilterRepel(entity, context, filter1, filter2, dataCompare, warnin
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.checkFilterRepel = checkFilterRepel;
|
|
||||||
/**
|
/**
|
||||||
* 有的场景下将filter当成非结构化属性存储,又想支持对其查询,此时必须将查询的filter进行转换,处理其中$开头的escape
|
* 有的场景下将filter当成非结构化属性存储,又想支持对其查询,此时必须将查询的filter进行转换,处理其中$开头的escape
|
||||||
* 只要filter是查询数据的标准子集,查询应当能返回true
|
* 只要filter是查询数据的标准子集,查询应当能返回true
|
||||||
|
|
@ -1682,7 +1682,6 @@ function translateFilterToObjectPredicate(filter) {
|
||||||
copyInner(filter, translated);
|
copyInner(filter, translated);
|
||||||
return translated;
|
return translated;
|
||||||
}
|
}
|
||||||
exports.translateFilterToObjectPredicate = translateFilterToObjectPredicate;
|
|
||||||
/* export function getCascadeEntityFilter<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(
|
/* export function getCascadeEntityFilter<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(
|
||||||
filter: NonNullable<ED[T]['Filter']>,
|
filter: NonNullable<ED[T]['Filter']>,
|
||||||
attr: keyof NonNullable<ED[T]['Filter']>
|
attr: keyof NonNullable<ED[T]['Filter']>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.createModiRelatedTriggers = exports.createModiRelatedCheckers = exports.abandonModis = exports.applyModis = exports.createOperationsFromModies = void 0;
|
exports.createOperationsFromModies = createOperationsFromModies;
|
||||||
|
exports.applyModis = applyModis;
|
||||||
|
exports.abandonModis = abandonModis;
|
||||||
|
exports.createModiRelatedCheckers = createModiRelatedCheckers;
|
||||||
|
exports.createModiRelatedTriggers = createModiRelatedTriggers;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const types_1 = require("../types");
|
const types_1 = require("../types");
|
||||||
const action_1 = require("../actions/action");
|
const action_1 = require("../actions/action");
|
||||||
|
|
@ -20,7 +24,6 @@ function createOperationsFromModies(modies) {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.createOperationsFromModies = createOperationsFromModies;
|
|
||||||
async function applyModis(filter, context, option) {
|
async function applyModis(filter, context, option) {
|
||||||
const closeMode = context.openRootMode();
|
const closeMode = context.openRootMode();
|
||||||
const result = await context.operate('modi', {
|
const result = await context.operate('modi', {
|
||||||
|
|
@ -42,7 +45,6 @@ async function applyModis(filter, context, option) {
|
||||||
closeMode();
|
closeMode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.applyModis = applyModis;
|
|
||||||
async function abandonModis(filter, context, option) {
|
async function abandonModis(filter, context, option) {
|
||||||
const closeMode = context.openRootMode();
|
const closeMode = context.openRootMode();
|
||||||
const result = context.operate('modi', {
|
const result = context.operate('modi', {
|
||||||
|
|
@ -64,7 +66,6 @@ async function abandonModis(filter, context, option) {
|
||||||
closeMode();
|
closeMode();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.abandonModis = abandonModis;
|
|
||||||
function createModiRelatedCheckers(schema) {
|
function createModiRelatedCheckers(schema) {
|
||||||
const checkers = [];
|
const checkers = [];
|
||||||
for (const entity in schema) {
|
for (const entity in schema) {
|
||||||
|
|
@ -169,7 +170,6 @@ function createModiRelatedCheckers(schema) {
|
||||||
}
|
}
|
||||||
return checkers;
|
return checkers;
|
||||||
}
|
}
|
||||||
exports.createModiRelatedCheckers = createModiRelatedCheckers;
|
|
||||||
function createModiRelatedTriggers(schema) {
|
function createModiRelatedTriggers(schema) {
|
||||||
const triggers = [];
|
const triggers = [];
|
||||||
for (const entity in schema) {
|
for (const entity in schema) {
|
||||||
|
|
@ -253,4 +253,3 @@ function createModiRelatedTriggers(schema) {
|
||||||
};
|
};
|
||||||
return triggers.concat([applyTrigger]);
|
return triggers.concat([applyTrigger]);
|
||||||
}
|
}
|
||||||
exports.createModiRelatedTriggers = createModiRelatedTriggers;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.judgeRelation = void 0;
|
exports.judgeRelation = judgeRelation;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const Demand_1 = require("../types/Demand");
|
const Demand_1 = require("../types/Demand");
|
||||||
|
|
@ -71,4 +71,3 @@ function judgeRelation(schema, entity, attr, allowUnrecognized) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.judgeRelation = judgeRelation;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.vaccumOper = void 0;
|
exports.vaccumOper = vaccumOper;
|
||||||
const Entity_1 = require("../types/Entity");
|
const Entity_1 = require("../types/Entity");
|
||||||
const vaccum_1 = require("./vaccum");
|
const vaccum_1 = require("./vaccum");
|
||||||
const filter_1 = require("../store/filter");
|
const filter_1 = require("../store/filter");
|
||||||
|
|
@ -61,4 +61,3 @@ async function vaccumOper(option, context) {
|
||||||
...rest,
|
...rest,
|
||||||
}, context);
|
}, context);
|
||||||
}
|
}
|
||||||
exports.vaccumOper = vaccumOper;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.vaccumEntities = void 0;
|
exports.vaccumEntities = vaccumEntities;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
||||||
const fs_1 = require("fs");
|
const fs_1 = require("fs");
|
||||||
|
|
@ -108,4 +108,3 @@ async function vaccumEntities(option, context) {
|
||||||
}, { deletePhysically: true });
|
}, { deletePhysically: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.vaccumEntities = vaccumEntities;
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { IncomingHttpHeaders } from "http";
|
import { IncomingHttpHeaders } from "http";
|
||||||
import { AsyncContext, AsyncRowStore } from "../store/AsyncRowStore";
|
import { AsyncContext, AsyncRowStore } from "../store/AsyncRowStore";
|
||||||
import { EntityDict, OpRecord } from "./Entity";
|
import { EntityDict, OpRecord } from "./Entity";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { IncomingHttpHeaders } from "http";
|
import { IncomingHttpHeaders } from "http";
|
||||||
import { SyncContext } from "../store/SyncRowStore";
|
import { SyncContext } from "../store/SyncRowStore";
|
||||||
import { EntityDict, OpRecord } from "./Entity";
|
import { EntityDict, OpRecord } from "./Entity";
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.SUB_QUERY_PREDICATE_KEYWORD = exports.isRefAttrNode = exports.EXPRESSION_PREFIX = void 0;
|
exports.SUB_QUERY_PREDICATE_KEYWORD = exports.EXPRESSION_PREFIX = void 0;
|
||||||
|
exports.isRefAttrNode = isRefAttrNode;
|
||||||
exports.EXPRESSION_PREFIX = '$expr';
|
exports.EXPRESSION_PREFIX = '$expr';
|
||||||
function isRefAttrNode(node) {
|
function isRefAttrNode(node) {
|
||||||
return node.hasOwnProperty('#attr') || (node.hasOwnProperty('#refId') && node.hasOwnProperty('#refAttr'));
|
return node.hasOwnProperty('#attr') || (node.hasOwnProperty('#refId') && node.hasOwnProperty('#refAttr'));
|
||||||
}
|
}
|
||||||
exports.isRefAttrNode = isRefAttrNode;
|
|
||||||
;
|
;
|
||||||
exports.SUB_QUERY_PREDICATE_KEYWORD = '#sqp';
|
exports.SUB_QUERY_PREDICATE_KEYWORD = '#sqp';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { IncomingHttpHeaders, IncomingMessage } from "http";
|
import { IncomingHttpHeaders, IncomingMessage } from "http";
|
||||||
import { AsyncContext } from "../store/AsyncRowStore";
|
import { AsyncContext } from "../store/AsyncRowStore";
|
||||||
import { EntityDict } from "./Entity";
|
import { EntityDict } from "./Entity";
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.makeException = exports.OakApplicationHasToUpgrade = exports.OakSocketConnectException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakDataInvisibleException = exports.OakOperationUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakSignatureVerificationException = exports.OakClockDriftException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakDataException = exports.OakPartialSuccess = exports.OakMakeSureByMySelfException = exports.OakRequestTimeoutException = exports.OakException = void 0;
|
exports.OakApplicationHasToUpgrade = exports.OakSocketConnectException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakDataInvisibleException = exports.OakOperationUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakSignatureVerificationException = exports.OakClockDriftException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakDataException = exports.OakPartialSuccess = exports.OakMakeSureByMySelfException = exports.OakRequestTimeoutException = exports.OakException = void 0;
|
||||||
|
exports.makeException = makeException;
|
||||||
const relation_1 = require("../store/relation");
|
const relation_1 = require("../store/relation");
|
||||||
const lodash_1 = require("../utils/lodash");
|
const lodash_1 = require("../utils/lodash");
|
||||||
class OakException extends Error {
|
class OakException extends Error {
|
||||||
|
|
@ -552,4 +553,3 @@ function makeException(data) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.makeException = makeException;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,17 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getAttrRefInExpression = exports.execOp = exports.opMultipleParams = exports.isExpression = exports.isAggrExpression = exports.isStringExpression = exports.isMathExpression = exports.isCompareExpression = exports.isBoolExpression = exports.isLogicExpression = exports.isDateExpression = exports.isGeoExpression = void 0;
|
exports.isGeoExpression = isGeoExpression;
|
||||||
|
exports.isDateExpression = isDateExpression;
|
||||||
|
exports.isLogicExpression = isLogicExpression;
|
||||||
|
exports.isBoolExpression = isBoolExpression;
|
||||||
|
exports.isCompareExpression = isCompareExpression;
|
||||||
|
exports.isMathExpression = isMathExpression;
|
||||||
|
exports.isStringExpression = isStringExpression;
|
||||||
|
exports.isAggrExpression = isAggrExpression;
|
||||||
|
exports.isExpression = isExpression;
|
||||||
|
exports.opMultipleParams = opMultipleParams;
|
||||||
|
exports.execOp = execOp;
|
||||||
|
exports.getAttrRefInExpression = getAttrRefInExpression;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
||||||
|
|
@ -52,7 +63,6 @@ function isGeoExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isGeoExpression = isGeoExpression;
|
|
||||||
function isDateExpression(expression) {
|
function isDateExpression(expression) {
|
||||||
if (Object.keys(expression).length == 1) {
|
if (Object.keys(expression).length == 1) {
|
||||||
const op = Object.keys(expression)[0];
|
const op = Object.keys(expression)[0];
|
||||||
|
|
@ -63,7 +73,6 @@ function isDateExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isDateExpression = isDateExpression;
|
|
||||||
function isLogicExpression(expression) {
|
function isLogicExpression(expression) {
|
||||||
if (Object.keys(expression).length == 1) {
|
if (Object.keys(expression).length == 1) {
|
||||||
const op = Object.keys(expression)[0];
|
const op = Object.keys(expression)[0];
|
||||||
|
|
@ -73,7 +82,6 @@ function isLogicExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isLogicExpression = isLogicExpression;
|
|
||||||
function isBoolExpression(expression) {
|
function isBoolExpression(expression) {
|
||||||
if (Object.keys(expression).length == 1) {
|
if (Object.keys(expression).length == 1) {
|
||||||
const op = Object.keys(expression)[0];
|
const op = Object.keys(expression)[0];
|
||||||
|
|
@ -83,7 +91,6 @@ function isBoolExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isBoolExpression = isBoolExpression;
|
|
||||||
function isCompareExpression(expression) {
|
function isCompareExpression(expression) {
|
||||||
if (Object.keys(expression).length == 1) {
|
if (Object.keys(expression).length == 1) {
|
||||||
const op = Object.keys(expression)[0];
|
const op = Object.keys(expression)[0];
|
||||||
|
|
@ -94,7 +101,6 @@ function isCompareExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isCompareExpression = isCompareExpression;
|
|
||||||
function isMathExpression(expression) {
|
function isMathExpression(expression) {
|
||||||
if (Object.keys(expression).length == 1) {
|
if (Object.keys(expression).length == 1) {
|
||||||
const op = Object.keys(expression)[0];
|
const op = Object.keys(expression)[0];
|
||||||
|
|
@ -105,7 +111,6 @@ function isMathExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isMathExpression = isMathExpression;
|
|
||||||
function isStringExpression(expression) {
|
function isStringExpression(expression) {
|
||||||
if (Object.keys(expression).length == 1) {
|
if (Object.keys(expression).length == 1) {
|
||||||
const op = Object.keys(expression)[0];
|
const op = Object.keys(expression)[0];
|
||||||
|
|
@ -115,7 +120,6 @@ function isStringExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isStringExpression = isStringExpression;
|
|
||||||
function isAggrExpression(expression) {
|
function isAggrExpression(expression) {
|
||||||
if (Object.keys(expression).length == 1) {
|
if (Object.keys(expression).length == 1) {
|
||||||
const op = Object.keys(expression)[0];
|
const op = Object.keys(expression)[0];
|
||||||
|
|
@ -125,17 +129,14 @@ function isAggrExpression(expression) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isAggrExpression = isAggrExpression;
|
|
||||||
function isExpression(expression) {
|
function isExpression(expression) {
|
||||||
return typeof expression === 'object' && Object.keys(expression).length === 1 && Object.keys(expression)[0].startsWith('$');
|
return typeof expression === 'object' && Object.keys(expression).length === 1 && Object.keys(expression)[0].startsWith('$');
|
||||||
}
|
}
|
||||||
exports.isExpression = isExpression;
|
|
||||||
function opMultipleParams(op) {
|
function opMultipleParams(op) {
|
||||||
return !['$year', '$month', '$weekday', '$weekOfYear', '$day', '$dayOfMonth',
|
return !['$year', '$month', '$weekday', '$weekOfYear', '$day', '$dayOfMonth',
|
||||||
'$dayOfWeek', '$dayOfYear', '$not', '$true', '$false', '$abs',
|
'$dayOfWeek', '$dayOfYear', '$not', '$true', '$false', '$abs',
|
||||||
'$round', '$floor', '$ceil', '$$max', '$$min', '$$sum', '$$avg', '$$count'].includes(op);
|
'$round', '$floor', '$ceil', '$$max', '$$min', '$$sum', '$$avg', '$$count'].includes(op);
|
||||||
}
|
}
|
||||||
exports.opMultipleParams = opMultipleParams;
|
|
||||||
function execOp(op, params) {
|
function execOp(op, params) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case '$gt': {
|
case '$gt': {
|
||||||
|
|
@ -350,7 +351,6 @@ function execOp(op, params) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.execOp = execOp;
|
|
||||||
/**
|
/**
|
||||||
* 检查一个表达式,并分析其涉及到的属性
|
* 检查一个表达式,并分析其涉及到的属性
|
||||||
* @param expression
|
* @param expression
|
||||||
|
|
@ -391,4 +391,3 @@ function getAttrRefInExpression(expression) {
|
||||||
check(expression);
|
check(expression);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.getAttrRefInExpression = getAttrRefInExpression;
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { IncomingHttpHeaders } from "http";
|
import { IncomingHttpHeaders } from "http";
|
||||||
import { SyncContext } from '../store/SyncRowStore';
|
import { SyncContext } from '../store/SyncRowStore';
|
||||||
import { Connector, EntityDict, OakException, OpRecord } from "../types";
|
import { Connector, EntityDict, OakException, OpRecord } from "../types";
|
||||||
|
|
@ -36,7 +35,7 @@ export default class SimpleConnector<ED extends EntityDict & BaseEntityDict, Fro
|
||||||
opRecords: any;
|
opRecords: any;
|
||||||
message: string | null;
|
message: string | null;
|
||||||
} | {
|
} | {
|
||||||
result: ReadableStream<Uint8Array> | null;
|
result: ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
||||||
message: string | null;
|
message: string | null;
|
||||||
opRecords?: undefined;
|
opRecords?: undefined;
|
||||||
}>;
|
}>;
|
||||||
|
|
@ -45,7 +44,7 @@ export default class SimpleConnector<ED extends EntityDict & BaseEntityDict, Fro
|
||||||
opRecords: any;
|
opRecords: any;
|
||||||
message: string | null;
|
message: string | null;
|
||||||
} | {
|
} | {
|
||||||
result: ReadableStream<Uint8Array> | null;
|
result: ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
||||||
message: string | null;
|
message: string | null;
|
||||||
opRecords?: undefined;
|
opRecords?: undefined;
|
||||||
}>;
|
}>;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
/**
|
/**
|
||||||
* 防止assert打包体积过大,从这里引用
|
* 防止assert打包体积过大,从这里引用
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.excelStringToDate = void 0;
|
exports.excelStringToDate = excelStringToDate;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
||||||
function excelStringToDate(str) {
|
function excelStringToDate(str) {
|
||||||
|
|
@ -15,4 +15,3 @@ function excelStringToDate(str) {
|
||||||
}
|
}
|
||||||
return Date.parse(str);
|
return Date.parse(str);
|
||||||
}
|
}
|
||||||
exports.excelStringToDate = excelStringToDate;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.composeUrl = void 0;
|
exports.composeUrl = composeUrl;
|
||||||
function composeUrl(url, params) {
|
function composeUrl(url, params) {
|
||||||
const urlSp = new URLSearchParams(params);
|
const urlSp = new URLSearchParams(params);
|
||||||
if (url.includes('?')) {
|
if (url.includes('?')) {
|
||||||
|
|
@ -8,4 +8,3 @@ function composeUrl(url, params) {
|
||||||
}
|
}
|
||||||
return `${url}?${urlSp}`;
|
return `${url}?${urlSp}`;
|
||||||
}
|
}
|
||||||
exports.composeUrl = composeUrl;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.pipeline = void 0;
|
exports.pipeline = pipeline;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param units 各个执行单元,需要流水线执行,可能是同步也可能是异步
|
* @param units 各个执行单元,需要流水线执行,可能是同步也可能是异步
|
||||||
|
|
@ -19,4 +19,3 @@ function pipeline(...units) {
|
||||||
};
|
};
|
||||||
return exec(0);
|
return exec(0);
|
||||||
}
|
}
|
||||||
exports.pipeline = pipeline;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.gcj02towgs84 = exports.wgs84togcj02 = exports.gcj02tobd09 = exports.bd09togcj02 = exports.getDistanceBetweenPoints = void 0;
|
exports.getDistanceBetweenPoints = getDistanceBetweenPoints;
|
||||||
|
exports.bd09togcj02 = bd09togcj02;
|
||||||
|
exports.gcj02tobd09 = gcj02tobd09;
|
||||||
|
exports.wgs84togcj02 = wgs84togcj02;
|
||||||
|
exports.gcj02towgs84 = gcj02towgs84;
|
||||||
/**
|
/**
|
||||||
* 计算地球上两点之间的球面距离
|
* 计算地球上两点之间的球面距离
|
||||||
*/
|
*/
|
||||||
|
|
@ -21,7 +25,6 @@ function getDistanceBetweenPoints(lat1, lon1, lat2, lon2) {
|
||||||
const d = R * c;
|
const d = R * c;
|
||||||
return d * 1000;
|
return d * 1000;
|
||||||
}
|
}
|
||||||
exports.getDistanceBetweenPoints = getDistanceBetweenPoints;
|
|
||||||
//定义一些常量
|
//定义一些常量
|
||||||
const x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
const x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
||||||
const PI = 3.1415926535897932384626;
|
const PI = 3.1415926535897932384626;
|
||||||
|
|
@ -71,7 +74,6 @@ function bd09togcj02(coord) {
|
||||||
const gg_lat = z * Math.sin(theta);
|
const gg_lat = z * Math.sin(theta);
|
||||||
return [gg_lng, gg_lat];
|
return [gg_lng, gg_lat];
|
||||||
}
|
}
|
||||||
exports.bd09togcj02 = bd09togcj02;
|
|
||||||
;
|
;
|
||||||
/**
|
/**
|
||||||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换
|
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换
|
||||||
|
|
@ -88,7 +90,6 @@ function gcj02tobd09(coord) {
|
||||||
const bd_lat = z * Math.sin(theta) + 0.006;
|
const bd_lat = z * Math.sin(theta) + 0.006;
|
||||||
return [bd_lng, bd_lat];
|
return [bd_lng, bd_lat];
|
||||||
}
|
}
|
||||||
exports.gcj02tobd09 = gcj02tobd09;
|
|
||||||
;
|
;
|
||||||
/**
|
/**
|
||||||
* WGS84转GCj02
|
* WGS84转GCj02
|
||||||
|
|
@ -115,7 +116,6 @@ function wgs84togcj02(coord) {
|
||||||
return [mglng, mglat];
|
return [mglng, mglat];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.wgs84togcj02 = wgs84togcj02;
|
|
||||||
;
|
;
|
||||||
/**
|
/**
|
||||||
* GCJ02 转换为 WGS84
|
* GCJ02 转换为 WGS84
|
||||||
|
|
@ -142,5 +142,4 @@ function gcj02towgs84(coord) {
|
||||||
return [lng * 2 - mglng, lat * 2 - mglat];
|
return [lng * 2 - mglng, lat * 2 - mglat];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.gcj02towgs84 = gcj02towgs84;
|
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.pullAll = exports.unionBy = exports.groupBy = exports.differenceBy = exports.difference = exports.union = exports.isEqual = exports.pick = exports.cloneDeep = exports.mergeConcatMany = exports.mergeConcatArray = exports.mergeWith = exports.merge = exports.omit = exports.intersectionBy = exports.intersection = exports.set = exports.get = exports.uniqBy = exports.uniq = exports.pull = exports.unset = void 0;
|
exports.pullAll = exports.unionBy = exports.groupBy = exports.differenceBy = exports.difference = exports.union = exports.isEqual = exports.pick = exports.cloneDeep = exports.mergeWith = exports.merge = exports.omit = exports.intersectionBy = exports.intersection = exports.set = exports.get = exports.uniqBy = exports.uniq = exports.pull = exports.unset = void 0;
|
||||||
|
exports.mergeConcatArray = mergeConcatArray;
|
||||||
|
exports.mergeConcatMany = mergeConcatMany;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
/**
|
/**
|
||||||
* 避免lodash打包体积过大
|
* 避免lodash打包体积过大
|
||||||
|
|
@ -65,11 +67,9 @@ function mergeConcatArray(object, source) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.mergeConcatArray = mergeConcatArray;
|
|
||||||
function mergeConcatMany(array) {
|
function mergeConcatMany(array) {
|
||||||
if (array.length === 0) {
|
if (array.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return array.reduce((prev, current) => mergeConcatArray(prev, current));
|
return array.reduce((prev, current) => mergeConcatArray(prev, current));
|
||||||
}
|
}
|
||||||
exports.mergeConcatMany = mergeConcatMany;
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = combineBaseModules;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const lodash_1 = require("../../utils/lodash");
|
const lodash_1 = require("../../utils/lodash");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
|
|
@ -24,4 +25,3 @@ function combineBaseModules(...modules) {
|
||||||
common: (0, lodash_1.mergeConcatArray)(prev.common, current.common),
|
common: (0, lodash_1.mergeConcatArray)(prev.common, current.common),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
exports.default = combineBaseModules;
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { EntityDict as BaseEntityDict } from '../../base-app-domain';
|
||||||
import { Aspect, Exportation, Importation, Routine, Timer, Trigger, Watcher } from '../../types';
|
import { Aspect, Exportation, Importation, Routine, Timer, Trigger, Watcher } from '../../types';
|
||||||
export default function combineModuleDev<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>>(...modules: string[]): {
|
export default function combineModuleDev<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>>(...modules: string[]): {
|
||||||
aspectDict: Record<string, Aspect<ED, Cxt>>;
|
aspectDict: Record<string, Aspect<ED, Cxt>>;
|
||||||
data: { [T in keyof ED]?: ED[T]["OpSchema"][] | undefined; };
|
data: { [T in keyof ED]?: Array<ED[T]["OpSchema"]>; };
|
||||||
importations: Importation<ED, keyof ED, string, Cxt>;
|
importations: Importation<ED, keyof ED, string, Cxt>;
|
||||||
exportations: Exportation<ED, keyof ED, string, Cxt>;
|
exportations: Exportation<ED, keyof ED, string, Cxt>;
|
||||||
watchers: Watcher<ED, keyof ED, Cxt>[];
|
watchers: Watcher<ED, keyof ED, Cxt>[];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = combineModuleDev;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const combine_common_1 = tslib_1.__importDefault(require("./combine.common"));
|
const combine_common_1 = tslib_1.__importDefault(require("./combine.common"));
|
||||||
const lodash_1 = require("../../utils/lodash");
|
const lodash_1 = require("../../utils/lodash");
|
||||||
|
|
@ -52,4 +53,3 @@ function combineModuleDev(...modules) {
|
||||||
...others,
|
...others,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.default = combineModuleDev;
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = combineModuleDev;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const combine_common_1 = tslib_1.__importDefault(require("./combine.common"));
|
const combine_common_1 = tslib_1.__importDefault(require("./combine.common"));
|
||||||
function combineModuleDev(...modules) {
|
function combineModuleDev(...modules) {
|
||||||
return (0, combine_common_1.default)(...modules);
|
return (0, combine_common_1.default)(...modules);
|
||||||
}
|
}
|
||||||
exports.default = combineModuleDev;
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { EntityDict as BaseEntityDict } from '../../base-app-domain';
|
||||||
import { Aspect, Exportation, Importation, Routine, Timer, Trigger, Watcher } from '../../types';
|
import { Aspect, Exportation, Importation, Routine, Timer, Trigger, Watcher } from '../../types';
|
||||||
export default function combineModuleServer<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>>(...modules: string[]): {
|
export default function combineModuleServer<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>>(...modules: string[]): {
|
||||||
aspectDict: Record<string, Aspect<ED, Cxt>>;
|
aspectDict: Record<string, Aspect<ED, Cxt>>;
|
||||||
data: { [T in keyof ED]?: ED[T]["OpSchema"][] | undefined; };
|
data: { [T in keyof ED]?: Array<ED[T]["OpSchema"]>; };
|
||||||
importations: Importation<ED, keyof ED, string, Cxt>;
|
importations: Importation<ED, keyof ED, string, Cxt>;
|
||||||
exportations: Exportation<ED, keyof ED, string, Cxt>;
|
exportations: Exportation<ED, keyof ED, string, Cxt>;
|
||||||
watchers: Watcher<ED, keyof ED, Cxt>[];
|
watchers: Watcher<ED, keyof ED, Cxt>[];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.default = combineModuleServer;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const combine_common_1 = tslib_1.__importDefault(require("./combine.common"));
|
const combine_common_1 = tslib_1.__importDefault(require("./combine.common"));
|
||||||
const lodash_1 = require("../../utils/lodash");
|
const lodash_1 = require("../../utils/lodash");
|
||||||
|
|
@ -52,4 +53,3 @@ function combineModuleServer(...modules) {
|
||||||
...others,
|
...others,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.default = combineModuleServer;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.mergeOperationResult = void 0;
|
exports.mergeOperationResult = mergeOperationResult;
|
||||||
const lodash_1 = require("../utils/lodash");
|
const lodash_1 = require("../utils/lodash");
|
||||||
function mergeOperationResult(result, toBeMerged) {
|
function mergeOperationResult(result, toBeMerged) {
|
||||||
for (const entity in toBeMerged) {
|
for (const entity in toBeMerged) {
|
||||||
|
|
@ -16,4 +16,3 @@ function mergeOperationResult(result, toBeMerged) {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.mergeOperationResult = mergeOperationResult;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.traverseProjection = exports.makeProjection = void 0;
|
exports.makeProjection = makeProjection;
|
||||||
|
exports.traverseProjection = traverseProjection;
|
||||||
const Entity_1 = require("../types/Entity");
|
const Entity_1 = require("../types/Entity");
|
||||||
const relation_1 = require("../store/relation");
|
const relation_1 = require("../store/relation");
|
||||||
function makeProjection(entity, schema) {
|
function makeProjection(entity, schema) {
|
||||||
|
|
@ -13,7 +14,6 @@ function makeProjection(entity, schema) {
|
||||||
}));
|
}));
|
||||||
return projection;
|
return projection;
|
||||||
}
|
}
|
||||||
exports.makeProjection = makeProjection;
|
|
||||||
function traverseProjection(entity, schema, projection, callback) {
|
function traverseProjection(entity, schema, projection, callback) {
|
||||||
const access = (entity2, proj) => {
|
const access = (entity2, proj) => {
|
||||||
callback(entity2, proj);
|
callback(entity2, proj);
|
||||||
|
|
@ -32,4 +32,3 @@ function traverseProjection(entity, schema, projection, callback) {
|
||||||
};
|
};
|
||||||
access(entity, projection);
|
access(entity, projection);
|
||||||
}
|
}
|
||||||
exports.traverseProjection = traverseProjection;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getRandomValues = void 0;
|
exports.getRandomValues = getRandomValues;
|
||||||
const node_crypto_1 = require("node:crypto");
|
const node_crypto_1 = require("node:crypto");
|
||||||
async function getRandomValues(length) {
|
async function getRandomValues(length) {
|
||||||
if (length > 65536) {
|
if (length > 65536) {
|
||||||
|
|
@ -16,4 +16,3 @@ async function getRandomValues(length) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getRandomValues = getRandomValues;
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
export declare function getRandomValues(length: number): Promise<Uint8Array>;
|
export declare function getRandomValues(length: number): Promise<Uint8Array<ArrayBuffer>>;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
/// <reference types="wechat-miniprogram" />
|
/// <reference types="wechat-miniprogram" />
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getRandomValues = void 0;
|
exports.getRandomValues = getRandomValues;
|
||||||
async function getRandomValues(length) {
|
async function getRandomValues(length) {
|
||||||
if (length > 65536) {
|
if (length > 65536) {
|
||||||
throw new Error('Can only request a maximum of 65536 bytes');
|
throw new Error('Can only request a maximum of 65536 bytes');
|
||||||
|
|
@ -11,4 +11,3 @@ async function getRandomValues(length) {
|
||||||
});
|
});
|
||||||
return new Uint8Array(randomValues);
|
return new Uint8Array(randomValues);
|
||||||
}
|
}
|
||||||
exports.getRandomValues = getRandomValues;
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
export declare function getRandomValues(length: number): Promise<Uint8Array>;
|
export declare function getRandomValues(length: number): Promise<Uint8Array<ArrayBuffer>>;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getRandomValues = void 0;
|
exports.getRandomValues = getRandomValues;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
||||||
async function getRandomValues(length) {
|
async function getRandomValues(length) {
|
||||||
|
|
@ -11,4 +11,3 @@ async function getRandomValues(length) {
|
||||||
return new Uint8Array(randomValues);
|
return new Uint8Array(randomValues);
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
exports.getRandomValues = getRandomValues;
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
export declare function getRandomValues(length: number): Promise<Uint8Array>;
|
export declare function getRandomValues(length: number): Promise<Uint8Array<ArrayBuffer>>;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getRandomValues = void 0;
|
exports.getRandomValues = getRandomValues;
|
||||||
async function getRandomValues(length) {
|
async function getRandomValues(length) {
|
||||||
if (length > 65536) {
|
if (length > 65536) {
|
||||||
throw new Error('Can only request a maximum of 65536 bytes');
|
throw new Error('Can only request a maximum of 65536 bytes');
|
||||||
|
|
@ -8,4 +8,3 @@ async function getRandomValues(length) {
|
||||||
const randomValues = window.crypto.getRandomValues(new Uint8Array(length));
|
const randomValues = window.crypto.getRandomValues(new Uint8Array(length));
|
||||||
return new Uint8Array(randomValues);
|
return new Uint8Array(randomValues);
|
||||||
}
|
}
|
||||||
exports.getRandomValues = getRandomValues;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.destructDirectPath = exports.destructDirectUserPath = exports.destructRelationPath = void 0;
|
exports.destructRelationPath = destructRelationPath;
|
||||||
|
exports.destructDirectUserPath = destructDirectUserPath;
|
||||||
|
exports.destructDirectPath = destructDirectPath;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const relation_1 = require("../store/relation");
|
const relation_1 = require("../store/relation");
|
||||||
|
|
@ -106,7 +108,6 @@ function destructRelationPath(schema, entity, path, relationFilter, recursive) {
|
||||||
};
|
};
|
||||||
return makeIter(entity, 0);
|
return makeIter(entity, 0);
|
||||||
}
|
}
|
||||||
exports.destructRelationPath = destructRelationPath;
|
|
||||||
/**
|
/**
|
||||||
* 根据entity的相对path,找到其根结点以及相应的user对象
|
* 根据entity的相对path,找到其根结点以及相应的user对象
|
||||||
* @param schema
|
* @param schema
|
||||||
|
|
@ -131,7 +132,6 @@ function destructDirectUserPath(schema, entity, path) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.destructDirectUserPath = destructDirectUserPath;
|
|
||||||
/**
|
/**
|
||||||
* 根据entity的相对path,找到对应的根结点对象数据行
|
* 根据entity的相对path,找到对应的根结点对象数据行
|
||||||
* @param schema
|
* @param schema
|
||||||
|
|
@ -270,4 +270,3 @@ function destructDirectPath(schema, entity, path) {
|
||||||
};
|
};
|
||||||
return makeIter(entity, 0);
|
return makeIter(entity, 0);
|
||||||
}
|
}
|
||||||
exports.destructDirectPath = destructDirectPath;
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.compareRows = exports.compareRow = void 0;
|
exports.compareRow = compareRow;
|
||||||
|
exports.compareRows = compareRows;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const lodash_1 = require("./lodash");
|
const lodash_1 = require("./lodash");
|
||||||
const relation_1 = require("../store/relation");
|
const relation_1 = require("../store/relation");
|
||||||
|
|
@ -49,7 +50,6 @@ function compareRow(schema, entity, row1, row2) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
exports.compareRow = compareRow;
|
|
||||||
/**
|
/**
|
||||||
* 比较两行数据是否完全相等
|
* 比较两行数据是否完全相等
|
||||||
* @param entity
|
* @param entity
|
||||||
|
|
@ -72,4 +72,3 @@ function compareRows(schema, entity, rows1, rows2) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
exports.compareRows = compareRows;
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,15 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.unescapeUnicode = exports.randomPrefixedString = exports.random = exports.template = exports.firstLetterUpperCase = exports.firstLetterLowerCase = void 0;
|
exports.randomPrefixedString = exports.random = exports.template = void 0;
|
||||||
|
exports.firstLetterLowerCase = firstLetterLowerCase;
|
||||||
|
exports.firstLetterUpperCase = firstLetterUpperCase;
|
||||||
|
exports.unescapeUnicode = unescapeUnicode;
|
||||||
function firstLetterLowerCase(s) {
|
function firstLetterLowerCase(s) {
|
||||||
return s.slice(0, 1).toLowerCase().concat(s.slice(1));
|
return s.slice(0, 1).toLowerCase().concat(s.slice(1));
|
||||||
}
|
}
|
||||||
exports.firstLetterLowerCase = firstLetterLowerCase;
|
|
||||||
function firstLetterUpperCase(s) {
|
function firstLetterUpperCase(s) {
|
||||||
return s.slice(0, 1).toUpperCase().concat(s.slice(1));
|
return s.slice(0, 1).toUpperCase().concat(s.slice(1));
|
||||||
}
|
}
|
||||||
exports.firstLetterUpperCase = firstLetterUpperCase;
|
|
||||||
/**
|
/**
|
||||||
* 模板字符串 使用 定义const NotFilled = template`${0}未填写`; 调用NotFilled('姓名') 等于姓名未填写
|
* 模板字符串 使用 定义const NotFilled = template`${0}未填写`; 调用NotFilled('姓名') 等于姓名未填写
|
||||||
* @param strings
|
* @param strings
|
||||||
|
|
@ -65,5 +66,4 @@ function unescapeUnicode(str) {
|
||||||
return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
|
return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.unescapeUnicode = unescapeUnicode;
|
|
||||||
;
|
;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { URL, URLSearchParams } from 'node:url';
|
import { URL, URLSearchParams } from 'node:url';
|
||||||
import type { UrlObject } from 'node:url';
|
import type { UrlObject } from 'node:url';
|
||||||
declare const url: typeof URL;
|
declare const url: typeof URL;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
declare const url: {
|
declare const url: {
|
||||||
new (url: string | URL, base?: string | URL | undefined): URL;
|
new (url: string | URL, base?: string | URL): URL;
|
||||||
prototype: URL;
|
prototype: URL;
|
||||||
canParse(url: string | URL, base?: string | undefined): boolean;
|
canParse(url: string | URL, base?: string | URL): boolean;
|
||||||
createObjectURL(obj: Blob | MediaSource): string;
|
createObjectURL(obj: Blob | MediaSource): string;
|
||||||
|
parse(url: string | URL, base?: string | URL): URL | null;
|
||||||
revokeObjectURL(url: string): void;
|
revokeObjectURL(url: string): void;
|
||||||
};
|
};
|
||||||
declare const urlSearchParams: {
|
declare const urlSearchParams: {
|
||||||
new (init?: string | string[][] | Record<string, string> | URLSearchParams | undefined): URLSearchParams;
|
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
||||||
prototype: URLSearchParams;
|
prototype: URLSearchParams;
|
||||||
};
|
};
|
||||||
export { url, urlSearchParams };
|
export { url, urlSearchParams };
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
declare const url: {
|
declare const url: {
|
||||||
new (url: string | URL, base?: string | URL | undefined): URL;
|
new (url: string | URL, base?: string | URL): URL;
|
||||||
prototype: URL;
|
prototype: URL;
|
||||||
canParse(url: string | URL, base?: string | undefined): boolean;
|
canParse(url: string | URL, base?: string | URL): boolean;
|
||||||
createObjectURL(obj: Blob | MediaSource): string;
|
createObjectURL(obj: Blob | MediaSource): string;
|
||||||
|
parse(url: string | URL, base?: string | URL): URL | null;
|
||||||
revokeObjectURL(url: string): void;
|
revokeObjectURL(url: string): void;
|
||||||
};
|
};
|
||||||
declare const urlSearchParams: {
|
declare const urlSearchParams: {
|
||||||
new (init?: string | string[][] | Record<string, string> | URLSearchParams | undefined): URLSearchParams;
|
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
||||||
prototype: URLSearchParams;
|
prototype: URLSearchParams;
|
||||||
};
|
};
|
||||||
export { url, urlSearchParams };
|
export { url, urlSearchParams };
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,25 @@
|
||||||
declare const _default: {
|
declare const _default: {
|
||||||
implementation: {
|
implementation: {
|
||||||
new (globalObject: any, constructorArgs: any): {
|
new (globalObject: any, constructorArgs: any): {
|
||||||
href: string;
|
get href(): string;
|
||||||
readonly origin: any;
|
set href(v: string);
|
||||||
protocol: string;
|
get origin(): any;
|
||||||
|
get protocol(): string;
|
||||||
|
set protocol(v: string);
|
||||||
username: any;
|
username: any;
|
||||||
password: any;
|
password: any;
|
||||||
host: any;
|
get host(): any;
|
||||||
hostname: any;
|
set host(v: any);
|
||||||
port: string;
|
get hostname(): any;
|
||||||
|
set hostname(v: any);
|
||||||
|
get port(): string;
|
||||||
|
set port(v: string);
|
||||||
pathname: any;
|
pathname: any;
|
||||||
search: string;
|
get search(): string;
|
||||||
|
set search(v: string);
|
||||||
readonly searchParams: any;
|
readonly searchParams: any;
|
||||||
hash: string;
|
get hash(): string;
|
||||||
|
set hash(v: string);
|
||||||
toJSON(): string;
|
toJSON(): string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,21 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.isASCIIHex = exports.isASCIIAlphanumeric = exports.isASCIIAlpha = exports.isASCIIDigit = void 0;
|
exports.isASCIIDigit = isASCIIDigit;
|
||||||
|
exports.isASCIIAlpha = isASCIIAlpha;
|
||||||
|
exports.isASCIIAlphanumeric = isASCIIAlphanumeric;
|
||||||
|
exports.isASCIIHex = isASCIIHex;
|
||||||
function isASCIIDigit(c) {
|
function isASCIIDigit(c) {
|
||||||
return c >= 0x30 && c <= 0x39;
|
return c >= 0x30 && c <= 0x39;
|
||||||
}
|
}
|
||||||
exports.isASCIIDigit = isASCIIDigit;
|
|
||||||
function isASCIIAlpha(c) {
|
function isASCIIAlpha(c) {
|
||||||
return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A);
|
return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A);
|
||||||
}
|
}
|
||||||
exports.isASCIIAlpha = isASCIIAlpha;
|
|
||||||
function isASCIIAlphanumeric(c) {
|
function isASCIIAlphanumeric(c) {
|
||||||
return isASCIIAlpha(c) || isASCIIDigit(c);
|
return isASCIIAlpha(c) || isASCIIDigit(c);
|
||||||
}
|
}
|
||||||
exports.isASCIIAlphanumeric = isASCIIAlphanumeric;
|
|
||||||
function isASCIIHex(c) {
|
function isASCIIHex(c) {
|
||||||
return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
|
return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
|
||||||
}
|
}
|
||||||
exports.isASCIIHex = isASCIIHex;
|
|
||||||
exports.default = {
|
exports.default = {
|
||||||
isASCIIDigit,
|
isASCIIDigit,
|
||||||
isASCIIAlpha,
|
isASCIIAlpha,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
/// <reference types="node" />
|
|
||||||
import { Buffer } from 'buffer';
|
import { Buffer } from 'buffer';
|
||||||
declare function percentEncode(c: number): string;
|
declare function percentEncode(c: number): string;
|
||||||
declare function percentDecode(input: Buffer): Buffer;
|
declare function percentDecode(input: Buffer): Buffer<ArrayBuffer>;
|
||||||
declare function serializeUrlencoded(tuples: any[], encodingOverride?: undefined): string;
|
declare function serializeUrlencoded(tuples: any[], encodingOverride?: undefined): string;
|
||||||
declare function parseUrlencoded(input: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>): string[][];
|
declare function parseUrlencoded(input: WithImplicitCoercion<ArrayBuffer | SharedArrayBuffer>): string[][];
|
||||||
declare function ucs2decode(string: string): number[];
|
declare function ucs2decode(string: string): number[];
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
declare function isObject(value: null): boolean;
|
declare function isObject(value: null): value is never;
|
||||||
declare function hasOwn(obj: any, prop: PropertyKey): boolean;
|
declare function hasOwn(obj: any, prop: PropertyKey): boolean;
|
||||||
declare function getSameObject(wrapper: any, prop: string, creator: () => any): any;
|
declare function getSameObject(wrapper: any, prop: string, creator: () => any): any;
|
||||||
declare function wrapperForImpl(impl: any): any;
|
declare function wrapperForImpl(impl: any): any;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.decompressFrom32 = exports.compressTo32 = exports.formUuid = exports.generateNewId = exports.setGenerateIdOption = exports.produceIds = exports.generateNewIdAsync = exports.expandUuidTo36Bytes = exports.shrinkUuidTo32Bytes = exports.sequentialUuid = void 0;
|
exports.sequentialUuid = sequentialUuid;
|
||||||
|
exports.shrinkUuidTo32Bytes = shrinkUuidTo32Bytes;
|
||||||
|
exports.expandUuidTo36Bytes = expandUuidTo36Bytes;
|
||||||
|
exports.generateNewIdAsync = generateNewIdAsync;
|
||||||
|
exports.produceIds = produceIds;
|
||||||
|
exports.setGenerateIdOption = setGenerateIdOption;
|
||||||
|
exports.generateNewId = generateNewId;
|
||||||
|
exports.formUuid = formUuid;
|
||||||
|
exports.compressTo32 = compressTo32;
|
||||||
|
exports.decompressFrom32 = decompressFrom32;
|
||||||
// import { v4 } from 'uuid';
|
// import { v4 } from 'uuid';
|
||||||
const random_1 = require("./random/random");
|
const random_1 = require("./random/random");
|
||||||
let _nodeId;
|
let _nodeId;
|
||||||
|
|
@ -100,15 +109,12 @@ function sequentialUuid({ random }) {
|
||||||
}
|
}
|
||||||
return unsafeStringify(b);
|
return unsafeStringify(b);
|
||||||
}
|
}
|
||||||
exports.sequentialUuid = sequentialUuid;
|
|
||||||
function shrinkUuidTo32Bytes(uuid) {
|
function shrinkUuidTo32Bytes(uuid) {
|
||||||
return uuid.replace(/\-/g, '');
|
return uuid.replace(/\-/g, '');
|
||||||
}
|
}
|
||||||
exports.shrinkUuidTo32Bytes = shrinkUuidTo32Bytes;
|
|
||||||
function expandUuidTo36Bytes(uuidShrinked) {
|
function expandUuidTo36Bytes(uuidShrinked) {
|
||||||
return `${uuidShrinked.slice(0, 8)}-${uuidShrinked.slice(8, 12)}-${uuidShrinked.slice(12, 16)}-${uuidShrinked.slice(16, 20)}-${uuidShrinked.slice(20)}`;
|
return `${uuidShrinked.slice(0, 8)}-${uuidShrinked.slice(8, 12)}-${uuidShrinked.slice(12, 16)}-${uuidShrinked.slice(16, 20)}-${uuidShrinked.slice(20)}`;
|
||||||
}
|
}
|
||||||
exports.expandUuidTo36Bytes = expandUuidTo36Bytes;
|
|
||||||
// 直接生成uuid的接口,为了适配各种环境,写成异步
|
// 直接生成uuid的接口,为了适配各种环境,写成异步
|
||||||
async function generateNewIdAsync(option) {
|
async function generateNewIdAsync(option) {
|
||||||
const option2 = option || ID_OPTION;
|
const option2 = option || ID_OPTION;
|
||||||
|
|
@ -117,7 +123,6 @@ async function generateNewIdAsync(option) {
|
||||||
} */
|
} */
|
||||||
return sequentialUuid({ random: await (0, random_1.getRandomValues)(16) });
|
return sequentialUuid({ random: await (0, random_1.getRandomValues)(16) });
|
||||||
}
|
}
|
||||||
exports.generateNewIdAsync = generateNewIdAsync;
|
|
||||||
// 实现同步的id缓存接口,以便于前台使用
|
// 实现同步的id缓存接口,以便于前台使用
|
||||||
const ID_BUFFER = [];
|
const ID_BUFFER = [];
|
||||||
let ID_OPTION = {};
|
let ID_OPTION = {};
|
||||||
|
|
@ -127,14 +132,12 @@ async function produceIds() {
|
||||||
ID_BUFFER.push(await generateNewIdAsync());
|
ID_BUFFER.push(await generateNewIdAsync());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.produceIds = produceIds;
|
|
||||||
produceIds();
|
produceIds();
|
||||||
function setGenerateIdOption(option) {
|
function setGenerateIdOption(option) {
|
||||||
ID_OPTION = option;
|
ID_OPTION = option;
|
||||||
ID_BUFFER.splice(0, ID_BUFFER.length);
|
ID_BUFFER.splice(0, ID_BUFFER.length);
|
||||||
return produceIds();
|
return produceIds();
|
||||||
}
|
}
|
||||||
exports.setGenerateIdOption = setGenerateIdOption;
|
|
||||||
function generateNewId() {
|
function generateNewId() {
|
||||||
if (ID_BUFFER.length > 0) {
|
if (ID_BUFFER.length > 0) {
|
||||||
const id = ID_BUFFER.pop();
|
const id = ID_BUFFER.pop();
|
||||||
|
|
@ -156,7 +159,6 @@ function generateNewId() {
|
||||||
return sequentialUuid({ random });
|
return sequentialUuid({ random });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.generateNewId = generateNewId;
|
|
||||||
function stringToArrayBuffer(str) {
|
function stringToArrayBuffer(str) {
|
||||||
var bytes = new Array();
|
var bytes = new Array();
|
||||||
var len, c;
|
var len, c;
|
||||||
|
|
@ -215,11 +217,9 @@ function formUuid(...input) {
|
||||||
} while (i < 16);
|
} while (i < 16);
|
||||||
return unsafeStringify(b);
|
return unsafeStringify(b);
|
||||||
}
|
}
|
||||||
exports.formUuid = formUuid;
|
|
||||||
function compressTo32(uuid) {
|
function compressTo32(uuid) {
|
||||||
return uuid.replace(/-/g, '');
|
return uuid.replace(/-/g, '');
|
||||||
}
|
}
|
||||||
exports.compressTo32 = compressTo32;
|
|
||||||
function decompressFrom32(compressed) {
|
function decompressFrom32(compressed) {
|
||||||
return [
|
return [
|
||||||
compressed.slice(0, 8),
|
compressed.slice(0, 8),
|
||||||
|
|
@ -229,4 +229,3 @@ function decompressFrom32(compressed) {
|
||||||
compressed.slice(20)
|
compressed.slice(20)
|
||||||
].join('-');
|
].join('-');
|
||||||
}
|
}
|
||||||
exports.decompressFrom32 = decompressFrom32;
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.isDomain = exports.isIP = exports.isIPV6 = exports.isIPV4 = exports.checkAttributesScope = exports.checkAttributesNotNull = exports.isEmail = exports.isVehicleNumber = exports.isMoney = exports.isNumber = exports.isTel = exports.isPhone = exports.isDigital = exports.isSizedCaptcha = exports.isNickname = exports.isUrl = exports.isSoldierNumber = exports.isBirthNumber = exports.isTwCardNumber = exports.isAmCardNumber = exports.isHkCardNumber = exports.isPassportNumber = exports.isIdCardNumber = exports.isCaptcha = exports.isPassword = exports.isMobile = void 0;
|
exports.isDomain = exports.isIP = exports.isIPV6 = exports.isIPV4 = exports.isEmail = exports.isVehicleNumber = exports.isMoney = exports.isNumber = exports.isTel = exports.isPhone = exports.isDigital = exports.isSizedCaptcha = exports.isNickname = exports.isUrl = exports.isSoldierNumber = exports.isBirthNumber = exports.isTwCardNumber = exports.isAmCardNumber = exports.isHkCardNumber = exports.isPassportNumber = exports.isIdCardNumber = exports.isCaptcha = exports.isPassword = exports.isMobile = void 0;
|
||||||
|
exports.checkAttributesNotNull = checkAttributesNotNull;
|
||||||
|
exports.checkAttributesScope = checkAttributesScope;
|
||||||
const types_1 = require("../types");
|
const types_1 = require("../types");
|
||||||
const isMobile = (text) => {
|
const isMobile = (text) => {
|
||||||
return ((text) && (typeof text === "string") && ((/^1[3|4|5|6|7|8|9]\d{9}$/.test(text))));
|
return ((text) && (typeof text === "string") && ((/^1[3|4|5|6|7|8|9]\d{9}$/.test(text))));
|
||||||
|
|
@ -122,7 +124,6 @@ function checkAttributesNotNull(entity, data, attributes, allowEmpty) {
|
||||||
throw new types_1.OakAttrNotNullException(entity, attrs, 'error::attributesNull');
|
throw new types_1.OakAttrNotNullException(entity, attrs, 'error::attributesNull');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.checkAttributesNotNull = checkAttributesNotNull;
|
|
||||||
;
|
;
|
||||||
function checkAttributesScope(entity, data, attributes) {
|
function checkAttributesScope(entity, data, attributes) {
|
||||||
const attrs = attributes.filter(attr => !data.hasOwnProperty(attr));
|
const attrs = attributes.filter(attr => !data.hasOwnProperty(attr));
|
||||||
|
|
@ -130,7 +131,6 @@ function checkAttributesScope(entity, data, attributes) {
|
||||||
throw new types_1.OakInputIllegalException(entity, attrs, 'error::attributesCantUpdate');
|
throw new types_1.OakInputIllegalException(entity, attrs, 'error::attributesCantUpdate');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.checkAttributesScope = checkAttributesScope;
|
|
||||||
const isIPV4 = (ip) => {
|
const isIPV4 = (ip) => {
|
||||||
// IPv4正则
|
// IPv4正则
|
||||||
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.isVersion = exports.compareVersion = void 0;
|
exports.compareVersion = compareVersion;
|
||||||
|
exports.isVersion = isVersion;
|
||||||
/**
|
/**
|
||||||
* 版本比较
|
* 版本比较
|
||||||
* @param curVersion 当前版本
|
* @param curVersion 当前版本
|
||||||
|
|
@ -18,7 +19,6 @@ function compareVersion(curVersion, reqVersion) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
exports.compareVersion = compareVersion;
|
|
||||||
;
|
;
|
||||||
/**
|
/**
|
||||||
* 是不是一个有效的版本号
|
* 是不是一个有效的版本号
|
||||||
|
|
@ -28,4 +28,3 @@ exports.compareVersion = compareVersion;
|
||||||
function isVersion(version) {
|
function isVersion(version) {
|
||||||
return /([1-9][0-9]*|[0-9])\.([1-9][0-9]*|[0-9])*\.([1-9][0-9]*|[0-9])*(\-[0-9A-Za-z-](\.[0-9A-Za-z-])*)*/g.test(version);
|
return /([1-9][0-9]*|[0-9])\.([1-9][0-9]*|[0-9])*\.([1-9][0-9]*|[0-9])*(\-[0-9A-Za-z-](\.[0-9A-Za-z-])*)*/g.test(version);
|
||||||
}
|
}
|
||||||
exports.isVersion = isVersion;
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ const Schema: Record<string, {
|
||||||
inModi: boolean;
|
inModi: boolean;
|
||||||
relations: false | string[];
|
relations: false | string[];
|
||||||
extendsFrom: string[];
|
extendsFrom: string[];
|
||||||
importAttrFrom: Record<string, [string, string | undefined]>;
|
importAttrFrom: Record<string, [string, string | undefined, string]>;
|
||||||
}> = {};
|
}> = {};
|
||||||
const OneToMany: Record<string, Array<[string, string, boolean]>> = {};
|
const OneToMany: Record<string, Array<[string, string, boolean]>> = {};
|
||||||
const ManyToOne: Record<string, Array<[string, string, boolean]>> = {};
|
const ManyToOne: Record<string, Array<[string, string, boolean]>> = {};
|
||||||
|
|
@ -349,12 +349,55 @@ function addImportedFrom(moduleName: string, name: string, node: ts.ImportDeclar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算编译后文件的正确导入路径
|
||||||
|
* @param sourceFilePath 源文件路径(相对于项目根目录),例如: 'src/entities/User.ts'
|
||||||
|
* @param outputFilePath 输出文件路径(相对于项目根目录),例如: 'src/oak-app-domain/User/_baseschema.ts'
|
||||||
|
* @param importPath 原始导入路径,例如: '../types/Config' 或 '@/utils/helper'
|
||||||
|
* @param projectRoot 项目根目录,默认为当前目录
|
||||||
|
* @returns 新的相对导入路径
|
||||||
|
*/
|
||||||
|
function resolveCompiledImportPath(
|
||||||
|
sourceFilePath: string,
|
||||||
|
outputFilePath: string,
|
||||||
|
importPath: string,
|
||||||
|
projectRoot: string = '.'
|
||||||
|
): string {
|
||||||
|
// 如果不是相对路径(例如 node_modules 的包或别名路径),直接返回
|
||||||
|
if (!importPath.startsWith('.')) {
|
||||||
|
return importPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 获取源文件所在目录
|
||||||
|
const sourceDir = PathLib.dirname(sourceFilePath);
|
||||||
|
|
||||||
|
// 2. 解析原始导入路径,得到目标文件的绝对路径(相对于项目根目录)
|
||||||
|
const targetAbsolutePath = PathLib.join(projectRoot, sourceDir, importPath);
|
||||||
|
const normalizedTargetPath = PathLib.normalize(targetAbsolutePath);
|
||||||
|
|
||||||
|
// 3. 获取输出文件所在目录
|
||||||
|
const outputDir = PathLib.dirname(outputFilePath);
|
||||||
|
const normalizedOutputDir = PathLib.normalize(PathLib.join(projectRoot, outputDir));
|
||||||
|
|
||||||
|
// 4. 计算从输出目录到目标文件的相对路径
|
||||||
|
let relativePath = PathLib.relative(normalizedOutputDir, normalizedTargetPath);
|
||||||
|
|
||||||
|
// 5. 标准化路径分隔符为 '/'
|
||||||
|
relativePath = relativePath.replace(/\\/g, '/');
|
||||||
|
|
||||||
|
// 6. 确保相对路径以 './' 或 '../' 开头
|
||||||
|
if (!relativePath.startsWith('.')) {
|
||||||
|
relativePath = './' + relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return relativePath;
|
||||||
|
}
|
||||||
|
|
||||||
function analyzeExternalAttrImport(
|
function analyzeExternalAttrImport(
|
||||||
node: ts.TypeReferenceNode,
|
node: ts.TypeReferenceNode,
|
||||||
program: ts.Program,
|
program: ts.Program,
|
||||||
importAttrFrom: Record<string, [string, string | undefined]>,
|
importAttrFrom: Record<string, [string, string | undefined, string]>,
|
||||||
relativePath?: string
|
relativePath?: string,
|
||||||
) {
|
) {
|
||||||
const checker = program.getTypeChecker();
|
const checker = program.getTypeChecker();
|
||||||
const symbol = checker.getSymbolAtLocation(node.typeName);
|
const symbol = checker.getSymbolAtLocation(node.typeName);
|
||||||
|
|
@ -379,18 +422,21 @@ function analyzeExternalAttrImport(
|
||||||
const propertyName = importSpecifier.propertyName && importSpecifier.propertyName.text;
|
const propertyName = importSpecifier.propertyName && importSpecifier.propertyName.text;
|
||||||
|
|
||||||
const importFrom = moduleSpecifier.text;
|
const importFrom = moduleSpecifier.text;
|
||||||
const importFromRelatively = importFrom.startsWith('.') ? (relativePath
|
// const importFromRelatively = importFrom.startsWith('.') ? (relativePath
|
||||||
? PathLib.join(
|
// ? PathLib.join(
|
||||||
relativePath,
|
// relativePath,
|
||||||
importFrom
|
// importFrom
|
||||||
).replace(/\\/g, '/')
|
// ).replace(/\\/g, '/')
|
||||||
: PathLib.join(
|
// : PathLib.join(
|
||||||
'..',
|
// '..',
|
||||||
importFrom
|
// importFrom
|
||||||
).replace(/\\/g, '/')) : importFrom;
|
// ).replace(/\\/g, '/')) : importFrom;
|
||||||
|
|
||||||
|
const sourceFilePath = declaration.getSourceFile().fileName;
|
||||||
|
|
||||||
assign(importAttrFrom, {
|
assign(importAttrFrom, {
|
||||||
[name]: [importFromRelatively, propertyName],
|
// [name]: [importFromRelatively, propertyName],
|
||||||
|
[name]: [importFrom, propertyName, sourceFilePath],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (ts.isTypeAliasDeclaration(declaration)) {
|
else if (ts.isTypeAliasDeclaration(declaration)) {
|
||||||
|
|
@ -915,7 +961,7 @@ function analyzeSchemaDefinition(
|
||||||
referencedSchemas: string[],
|
referencedSchemas: string[],
|
||||||
schemaAttrs: ts.TypeElement[],
|
schemaAttrs: ts.TypeElement[],
|
||||||
enumAttributes: Record<string, string[]>,
|
enumAttributes: Record<string, string[]>,
|
||||||
importAttrFrom: Record<string, [string, string | undefined]>,
|
importAttrFrom: Record<string, [string, string | undefined, string]>,
|
||||||
relativePath?: string
|
relativePath?: string
|
||||||
) {
|
) {
|
||||||
let hasEntityAttr = false;
|
let hasEntityAttr = false;
|
||||||
|
|
@ -1145,7 +1191,7 @@ function analyzeReferenceSchemaFile(
|
||||||
referencedSchemas: string[],
|
referencedSchemas: string[],
|
||||||
schemaAttrs: ts.TypeElement[],
|
schemaAttrs: ts.TypeElement[],
|
||||||
enumAttributes: Record<string, string[]>,
|
enumAttributes: Record<string, string[]>,
|
||||||
importAttrFrom: Record<string, [string, string | undefined]>,
|
importAttrFrom: Record<string, [string, string | undefined, string]>,
|
||||||
relativePath: string) {
|
relativePath: string) {
|
||||||
let result: ReturnType<typeof analyzeSchemaDefinition> | undefined;
|
let result: ReturnType<typeof analyzeSchemaDefinition> | undefined;
|
||||||
ts.forEachChild(sourceFile!, (node) => {
|
ts.forEachChild(sourceFile!, (node) => {
|
||||||
|
|
@ -1213,7 +1259,7 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
|
||||||
let actionType = 'crud';
|
let actionType = 'crud';
|
||||||
let _static = false;
|
let _static = false;
|
||||||
const enumAttributes: Record<string, string[]> = {};
|
const enumAttributes: Record<string, string[]> = {};
|
||||||
const importAttrFrom: Record<string, [string, string | undefined]> = {};
|
const importAttrFrom: Record<string, [string, string | undefined, string]> = {};
|
||||||
let localeDef: ts.ObjectLiteralExpression | undefined = undefined;
|
let localeDef: ts.ObjectLiteralExpression | undefined = undefined;
|
||||||
let extendsFrom: string[] | undefined;
|
let extendsFrom: string[] | undefined;
|
||||||
// let relationHierarchy: ts.ObjectLiteralExpression | undefined = undefined;
|
// let relationHierarchy: ts.ObjectLiteralExpression | undefined = undefined;
|
||||||
|
|
@ -6934,12 +6980,38 @@ function _outputBaseSchema(outputDir: string, printer: ts.Printer) {
|
||||||
// 从外部引入的属性
|
// 从外部引入的属性
|
||||||
const fromExternalImportAttrs: Record<string, [string, string | undefined][]> = {};
|
const fromExternalImportAttrs: Record<string, [string, string | undefined][]> = {};
|
||||||
for (const attr in importAttrFrom) {
|
for (const attr in importAttrFrom) {
|
||||||
const [from, propertyName] = importAttrFrom[attr];
|
// const [from, propertyName] = importAttrFrom[attr];
|
||||||
if (fromExternalImportAttrs[from]) {
|
// if (fromExternalImportAttrs[from]) {
|
||||||
fromExternalImportAttrs[from].push([attr, propertyName]);
|
// fromExternalImportAttrs[from].push([attr, propertyName]);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// fromExternalImportAttrs[from] = [[attr, propertyName]];
|
||||||
|
// }
|
||||||
|
const [from, propertyName, sourceFilePath] = importAttrFrom[attr];
|
||||||
|
|
||||||
|
// ===== 在这里进行路径转换 =====
|
||||||
|
const outputFilePath = PathLib.join(outputDir, entity, '_baseSchema.ts'); // 输出文件路径
|
||||||
|
|
||||||
|
// 使用路径解析算法计算新的导入路径
|
||||||
|
const newImportPath = resolveCompiledImportPath(
|
||||||
|
PathLib.relative(process.cwd(), sourceFilePath),
|
||||||
|
PathLib.relative(process.cwd(), outputFilePath),
|
||||||
|
from, // 原始导入路径
|
||||||
|
".",
|
||||||
|
);
|
||||||
|
|
||||||
|
// console.log('resolve import path:', {
|
||||||
|
// sourceFilePath: PathLib.relative(process.cwd(), sourceFilePath),
|
||||||
|
// outputFilePath: PathLib.relative(process.cwd(), outputFilePath),
|
||||||
|
// from,
|
||||||
|
// newImportPath,
|
||||||
|
// });
|
||||||
|
|
||||||
|
if (fromExternalImportAttrs[newImportPath]) {
|
||||||
|
fromExternalImportAttrs[newImportPath].push([attr, propertyName]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fromExternalImportAttrs[from] = [[attr, propertyName]];
|
fromExternalImportAttrs[newImportPath] = [[attr, propertyName]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const external in fromExternalImportAttrs) {
|
for (const external in fromExternalImportAttrs) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue