升级ts到5版本

This commit is contained in:
Xu Chang 2023-09-14 17:41:27 +08:00
parent 1aed7e5c65
commit e4b0e8bb08
17 changed files with 106 additions and 182 deletions

View File

@ -31,12 +31,12 @@ exports.desc = {
name: 'index_entity_relation',
attributes: [
{
name: 'destEntity'
name: 'destEntity',
},
{
name: "relationId"
name: "relationId",
},
]
],
}
]
};

View File

@ -1,9 +1,9 @@
export declare const ActionDefDict: {
modi: {
iState: import("../index").ActionDef<string, string>;
iState: import("..").ActionDef<string, string>;
};
user: {
userState: import("../index").ActionDef<string, string>;
userState: import("..").ActionDef<string, string>;
};
userEntityGrant: {};
};

View File

@ -45,15 +45,15 @@ exports.desc = {
name: 'namespace_language',
attributes: [
{
name: 'namespace'
name: 'namespace',
},
{
name: 'language'
name: 'language',
}
],
config: {
unique: true
}
unique: true,
},
}
]
};

View File

@ -4,9 +4,9 @@ exports.ActionDefDict = exports.actions = void 0;
const IActionDef = {
stm: {
apply: ['active', 'applied'],
abandon: ['active', 'abandoned']
abandon: ['active', 'abandoned'],
},
is: 'active'
is: 'active',
};
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "apply", "abandon"];
exports.ActionDefDict = {

View File

@ -55,9 +55,9 @@ exports.desc = {
attributes: [
{
name: 'iState',
direction: 'ASC'
direction: 'ASC',
}
]
],
}
]
};

View File

@ -37,18 +37,18 @@ exports.desc = {
name: 'index_targetEntity_entityId_name',
attributes: [
{
name: 'entity'
name: 'entity',
},
{
name: 'entityId'
name: 'entityId',
},
{
name: 'name'
name: 'name',
}
],
config: {
unique: true
}
unique: true,
},
}
]
};

View File

@ -29,18 +29,18 @@ exports.desc = {
name: 'index_entity_relation_path',
attributes: [
{
name: "sourceRelationId"
name: "sourceRelationId",
},
{
name: 'path'
name: 'path',
},
{
name: "destRelationId"
name: "destRelationId",
},
],
config: {
unique: true
}
unique: true,
},
}
]
};

View File

@ -4,8 +4,8 @@ exports.ActionDefDict = exports.actions = void 0;
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "grant", "revoke", "mergeTo"];
const UserActionDef = {
stm: {
mergeTo: ['normal', 'merged']
}
mergeTo: ['normal', 'merged'],
},
};
exports.ActionDefDict = {
userState: UserActionDef

View File

@ -36,21 +36,21 @@ exports.desc = {
name: 'index_user_entity_entityId_relation',
attributes: [
{
name: "userId"
name: "userId",
},
{
name: 'entity'
name: 'entity',
},
{
name: 'entityId'
name: 'entityId',
},
{
name: "relationId"
name: "relationId",
},
],
config: {
unique: true
}
unique: true,
},
}
]
};

View File

@ -52,10 +52,10 @@ class LocaleBuilder {
*/
outputDataFile() {
const statements = [
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("CreateOperationData"), factory.createIdentifier("I18n"))])), factory.createStringLiteral("../oak-app-domain/I18n/Schema"), undefined)
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("CreateOperationData"), factory.createIdentifier("I18n"))])), factory.createStringLiteral("../oak-app-domain/I18n/Schema"), undefined)
];
if (this.dependencies) {
this.dependencies.forEach((ele, idx) => statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, factory.createIdentifier(`i18ns${idx}`), undefined), factory.createStringLiteral(`${ele}/lib/data/i18n`), undefined)));
this.dependencies.forEach((ele, idx) => statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, factory.createIdentifier(`i18ns${idx}`), undefined), factory.createStringLiteral(`${ele}/lib/data/i18n`), undefined)));
}
statements.push(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([factory.createVariableDeclaration(factory.createIdentifier("i18ns"), undefined, factory.createArrayTypeNode(factory.createTypeReferenceNode(factory.createIdentifier("I18n"), undefined)), factory.createArrayLiteralExpression(Object.keys(this.locales).map((k) => {
const [module, position, language, data] = this.locales[k];
@ -74,10 +74,10 @@ class LocaleBuilder {
], true);
}), true))], ts.NodeFlags.Const)));
if (this.dependencies.length > 0) {
statements.push(factory.createExportAssignment(undefined, undefined, undefined, factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("i18ns"), factory.createIdentifier("concat")), undefined, this.dependencies.map((ele, idx) => factory.createIdentifier(`i18ns${idx}`)))));
statements.push(factory.createExportAssignment(undefined, undefined, factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("i18ns"), factory.createIdentifier("concat")), undefined, this.dependencies.map((ele, idx) => factory.createIdentifier(`i18ns${idx}`)))));
}
else {
statements.push(factory.createExportAssignment(undefined, undefined, undefined, factory.createIdentifier("i18ns")));
statements.push(factory.createExportAssignment(undefined, undefined, factory.createIdentifier("i18ns")));
}
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
const result = printer.printList(ts.ListFormat.SourceFileStatements, factory.createNodeArray(statements), ts.createSourceFile("someFileName.ts", "", ts.ScriptTarget.Latest, false, ts.ScriptKind.TS));

View File

@ -17,8 +17,8 @@ const ManyToOne = {};
const ReversePointerEntities = {};
const ReversePointerRelations = {};
const ActionImportStatements = () => [
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("ActionDef"))])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)()}Action`), undefined),
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("ActionDef"))])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)()}Action`), undefined),
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier("GenericAction")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("AppendOnlyAction")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("ReadOnlyAction")),
@ -392,7 +392,7 @@ function analyzeEntity(filename, path, program, relativePath) {
const moduleSpecifier2Text = text.startsWith('.') ? (relativePath
? path_1.default.join(relativePath, text).replace(/\\/g, '/')
: path_1.default.join('..', text).replace(/\\/g, '/')) : text;
additionalImports.push(factory.updateImportDeclaration(node, undefined, undefined, importClause, factory.createStringLiteral(moduleSpecifier2Text), undefined));
additionalImports.push(factory.updateImportDeclaration(node, undefined, importClause, factory.createStringLiteral(moduleSpecifier2Text), undefined));
}
else {
(0, assert_1.default)(false, '未处理的import方式');
@ -556,7 +556,7 @@ function analyzeEntity(filename, path, program, relativePath) {
(0, assert_1.default)(!localeDef, `${filename}】locale定义须在Action之后`);
hasActionDef = true;
const modifiers = [factory.createModifier(ts.SyntaxKind.ExportKeyword)];
pushStatementIntoActionAst(moduleName, factory.updateTypeAliasDeclaration(node, node.decorators, modifiers, factory.createIdentifier('ParticularAction'), node.typeParameters, node.type), sourceFile);
pushStatementIntoActionAst(moduleName, factory.updateTypeAliasDeclaration(node, modifiers, factory.createIdentifier('ParticularAction'), node.typeParameters, node.type), sourceFile);
dealWithActions(moduleName, filename, node.type, program, sourceFile);
}
else if (node.name.text === 'Relation') {
@ -615,14 +615,14 @@ function analyzeEntity(filename, path, program, relativePath) {
hasActionOrStateDef = true;
const { type } = node;
if (ts.isUnionTypeNode(type)) {
pushStatementIntoActionAst(moduleName, factory.updateTypeAliasDeclaration(node, node.decorators, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], node.name, node.typeParameters, process.env.COMPLING_AS_LIB ? factory.createUnionTypeNode([
pushStatementIntoActionAst(moduleName, factory.updateTypeAliasDeclaration(node, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], node.name, node.typeParameters, process.env.COMPLING_AS_LIB ? factory.createUnionTypeNode([
...type.types,
factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
]) : type), sourceFile);
}
else {
(0, assert_1.default)(ts.isLiteralTypeNode(type) || ts.isTypeReferenceNode(type), `${moduleName} - ${node.name}`);
pushStatementIntoActionAst(moduleName, factory.updateTypeAliasDeclaration(node, node.decorators, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], node.name, node.typeParameters, process.env.COMPLING_AS_LIB ? factory.createUnionTypeNode([
pushStatementIntoActionAst(moduleName, factory.updateTypeAliasDeclaration(node, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], node.name, node.typeParameters, process.env.COMPLING_AS_LIB ? factory.createUnionTypeNode([
type,
factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
]) : type), sourceFile);
@ -891,7 +891,7 @@ function analyzeEntity(filename, path, program, relativePath) {
if (process.env.COMPLING_AS_LIB) {
actionDefNodes.push(factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword));
}
pushStatementIntoActionAst(moduleName, factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Action"), undefined, factory.createUnionTypeNode(actionDefNodes)), sourceFile);
pushStatementIntoActionAst(moduleName, factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Action"), undefined, factory.createUnionTypeNode(actionDefNodes)), sourceFile);
}
if (!hasActionDef && hasActionOrStateDef) {
throw new Error(`${filename}中有Action或State定义但没有定义完整的Action类型`);
@ -1058,20 +1058,20 @@ function constructSchema(statements, entity) {
}
(0, lodash_1.uniq)(referenceEntities).forEach((ele) => {
if (ele !== entity) {
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(factory.createIdentifier(ele))), factory.createStringLiteral(`../${ele}/Schema`)));
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(factory.createIdentifier(ele))), factory.createStringLiteral(`../${ele}/Schema`)));
}
});
// 在这里把需要直接拷贝过来的语句写入
if (SchemaAsts[entity]) {
statements.push(...SchemaAsts[entity].statements);
}
statements.push(factory.createTypeAliasDeclaration(undefined, [
statements.push(factory.createTypeAliasDeclaration([
factory.createModifier(ts.SyntaxKind.ExportKeyword)
], factory.createIdentifier('OpSchema'), undefined, factory.createIntersectionTypeNode([
factory.createTypeReferenceNode('EntityShape'),
factory.createTypeLiteralNode(members)
])), factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("OpAttr"), undefined, factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeReferenceNode(factory.createIdentifier("OpSchema"), undefined))));
statements.push(factory.createTypeAliasDeclaration(undefined, [
])), factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("OpAttr"), undefined, factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeReferenceNode(factory.createIdentifier("OpSchema"), undefined))));
statements.push(factory.createTypeAliasDeclaration([
factory.createModifier(ts.SyntaxKind.ExportKeyword)
], factory.createIdentifier('Schema'), undefined, factory.createIntersectionTypeNode([
factory.createTypeReferenceNode('EntityShape'),
@ -1228,7 +1228,7 @@ function constructFilter(statements, entity) {
});
}
}
statements.push(factory.createTypeAliasDeclaration(undefined, undefined, factory.createIdentifier('AttrFilter'), undefined, factory.createTypeLiteralNode(members)));
statements.push(factory.createTypeAliasDeclaration(undefined, factory.createIdentifier('AttrFilter'), undefined, factory.createTypeLiteralNode(members)));
/**
*
export type Filter = AttrFilter | Partial<ExprOp<OpSchema> | {
@ -1253,7 +1253,7 @@ function constructFilter(statements, entity) {
if (fulltextIndex) {
types.push(factory.createTypeReferenceNode('FulltextFilter'));
}
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Filter"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("MakeFilter"), [factory.createIntersectionTypeNode(types)])));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Filter"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("MakeFilter"), [factory.createIntersectionTypeNode(types)])));
}
/**
* 构造Projection和OneAttrProjection
@ -1437,10 +1437,10 @@ function constructProjection(statements, entity) {
factory.createPropertySignature(undefined, factory.createStringLiteral("#id"), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createTypeReferenceNode('NodeId'))
];
if (process.env.COMPLING_AS_LIB) {
MetaPropertySignatures.push(factory.createIndexSignature(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword)));
MetaPropertySignatures.push(factory.createIndexSignature(undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword)));
}
// Projection正常查询的投影
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Projection"), undefined, factory.createIntersectionTypeNode([
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Projection"), undefined, factory.createIntersectionTypeNode([
factory.createTypeLiteralNode(MetaPropertySignatures.concat(properties.map(([n, q, v]) => {
return factory.createPropertySignature(undefined, n, q ? undefined : factory.createToken(ts.SyntaxKind.QuestionToken), v || factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword));
}))),
@ -1476,7 +1476,7 @@ function constructProjection(statements, entity) {
// ${Entity}Projection外键查询的专用投影
for (const foreignKey in foreignKeyProperties) {
const identifier = `${foreignKey}IdProjection`;
statements.push(factory.createTypeAliasDeclaration(undefined, undefined, factory.createIdentifier(identifier), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OneOf"), [
statements.push(factory.createTypeAliasDeclaration(undefined, factory.createIdentifier(identifier), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OneOf"), [
factory.createTypeLiteralNode(foreignKeyProperties[foreignKey].map((attr) => factory.createPropertySignature(undefined, attr ? factory.createIdentifier(`${attr}Id`) : 'id', undefined, factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword))))
])));
}
@ -1593,7 +1593,7 @@ function constructQuery(statements, entity) {
let manyToSelf = false;
if (manyToOneSet) {
(0, lodash_1.uniqBy)(manyToOneSet, ([a]) => a).forEach(([oneEntity, foreignKey]) => {
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(`${oneEntity}IdSubQuery`), undefined, factory.createTypeReferenceNode(factory.createIdentifier("Selection"), [factory.createTypeReferenceNode(factory.createIdentifier(`${oneEntity}IdProjection`), undefined)])));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(`${oneEntity}IdSubQuery`), undefined, factory.createTypeReferenceNode(factory.createIdentifier("Selection"), [factory.createTypeReferenceNode(factory.createIdentifier(`${oneEntity}IdProjection`), undefined)])));
if (oneEntity === entity) {
manyToSelf = true;
}
@ -1601,7 +1601,7 @@ function constructQuery(statements, entity) {
}
// 主键可能产生的子查询
if (!manyToSelf) {
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(`${entity}IdSubQuery`), undefined, factory.createTypeReferenceNode(factory.createIdentifier("Selection"), [factory.createTypeReferenceNode(factory.createIdentifier(`${entity}IdProjection`), undefined)])));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(`${entity}IdSubQuery`), undefined, factory.createTypeReferenceNode(factory.createIdentifier("Selection"), [factory.createTypeReferenceNode(factory.createIdentifier(`${entity}IdProjection`), undefined)])));
}
}
/**
@ -1674,7 +1674,7 @@ function constructSorter(statements, entity) {
});
}
if (process.env.COMPLING_AS_LIB) {
members.push(factory.createTypeLiteralNode([factory.createIndexSignature(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword))]));
members.push(factory.createTypeLiteralNode([factory.createIndexSignature(undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword))]));
}
members.push(factory.createTypeReferenceNode(factory.createIdentifier("OneOf"), [factory.createTypeReferenceNode(factory.createIdentifier("ExprOp"), [
process.env.COMPLING_AS_LIB ?
@ -1700,14 +1700,14 @@ function constructSorter(statements, entity) {
[k: string]: any;
} | OneOf<ExprOp<OpAttr>>
*/
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("SortAttr"), undefined, factory.createUnionTypeNode(members)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("SortAttr"), undefined, factory.createUnionTypeNode(members)));
/**
* export type SortNode = {
$attr: SortAttr;
$direction?: 'asc' | 'desc';
};
*/
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("SortNode"), undefined, factory.createTypeLiteralNode([
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("SortNode"), undefined, factory.createTypeLiteralNode([
factory.createPropertySignature(undefined, factory.createIdentifier("$attr"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("SortAttr"), undefined)),
factory.createPropertySignature(undefined, factory.createIdentifier("$direction"), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createUnionTypeNode([
factory.createLiteralTypeNode(factory.createStringLiteral("asc")),
@ -1717,7 +1717,7 @@ function constructSorter(statements, entity) {
/**
* export type Sorter = SortNode[];
*/
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Sorter"), undefined, factory.createArrayTypeNode(factory.createTypeReferenceNode(factory.createIdentifier("SortNode"), undefined))));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Sorter"), undefined, factory.createArrayTypeNode(factory.createTypeReferenceNode(factory.createIdentifier("SortNode"), undefined))));
}
function constructFullAttrs(statements, entity) {
const { [entity]: manyToOneSet } = ManyToOne;
@ -1735,13 +1735,13 @@ function constructFullAttrs(statements, entity) {
]));
}
}
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("NativeAttr"), undefined, factory.createUnionTypeNode([
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("NativeAttr"), undefined, factory.createUnionTypeNode([
factory.createTypeReferenceNode(factory.createIdentifier("OpAttr"), undefined),
...mtoAttrs
])));
}
else {
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("NativeAttr"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OpAttr"), undefined)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("NativeAttr"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OpAttr"), undefined)));
}
const foreignKeySet = {};
if (oneToManySet && oneToManySet.length > 0) {
@ -1777,29 +1777,29 @@ function constructFullAttrs(statements, entity) {
]));
}
}
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("FullAttr"), undefined, factory.createUnionTypeNode([
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("FullAttr"), undefined, factory.createUnionTypeNode([
factory.createTypeReferenceNode(factory.createIdentifier("NativeAttr"), undefined),
...otmAttrs
])));
}
else {
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("FullAttr"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("NativeAttr"), undefined)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("FullAttr"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("NativeAttr"), undefined)));
}
}
function constructOperations(statements, entity) {
// Selection
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("SelectOperation"), [
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("SelectOperation"), [
factory.createTypeParameterDeclaration(undefined, factory.createIdentifier("P"), factory.createTypeReferenceNode(factory.createIdentifier("Object"), undefined), factory.createTypeReferenceNode(factory.createIdentifier("Projection"), undefined))
], factory.createTypeReferenceNode(factory.createIdentifier("OakSelection"), [
factory.createLiteralTypeNode(factory.createStringLiteral("select")),
factory.createTypeReferenceNode(factory.createIdentifier("P"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("Filter"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("Sorter"), undefined)
])), factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Selection"), [
])), factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Selection"), [
factory.createTypeParameterDeclaration(undefined, factory.createIdentifier("P"), factory.createTypeReferenceNode(factory.createIdentifier("Object"), undefined), factory.createTypeReferenceNode(factory.createIdentifier("Projection"), undefined))
], factory.createTypeReferenceNode(factory.createIdentifier("SelectOperation"), [
factory.createTypeReferenceNode(factory.createIdentifier("P"), undefined)
])), factory.createTypeAliasDeclaration(undefined, [factory.createToken(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Aggregation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("DeduceAggregation"), [
])), factory.createTypeAliasDeclaration([factory.createToken(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Aggregation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("DeduceAggregation"), [
factory.createTypeReferenceNode(factory.createIdentifier("Projection"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("Filter"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("Sorter"), undefined)
@ -1981,7 +1981,7 @@ function constructOperations(statements, entity) {
reverseOneNodes.push(factory.createTypeLiteralNode([
factory.createPropertySignature(undefined, factory.createIdentifier('entity'), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)),
factory.createPropertySignature(undefined, factory.createIdentifier('entityId'), factory.createToken(ts.SyntaxKind.QuestionToken), factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)),
factory.createIndexSignature(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, factory.createIdentifier("K"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword))
factory.createIndexSignature(undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("K"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword))
]));
}
if (reverseOneNodes.length > 0) {
@ -2071,15 +2071,15 @@ function constructOperations(statements, entity) {
if (propertySignatures.length > 0) {
adNodes.push(factory.createTypeLiteralNode(propertySignatures));
}
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateOperationData"), undefined, factory.createIntersectionTypeNode(adNodes)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateOperationData"), undefined, factory.createIntersectionTypeNode(adNodes)));
// CreateOperation
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateSingleOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateSingleOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
factory.createLiteralTypeNode(factory.createStringLiteral("create")),
factory.createTypeReferenceNode(factory.createIdentifier("CreateOperationData"))
])), factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateMultipleOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
])), factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateMultipleOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
factory.createLiteralTypeNode(factory.createStringLiteral("create")),
factory.createTypeReferenceNode(factory.createIdentifier("Array"), [factory.createTypeReferenceNode(factory.createIdentifier("CreateOperationData"))])
])), factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateOperation"), undefined, factory.createUnionTypeNode([
])), factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("CreateOperation"), undefined, factory.createUnionTypeNode([
factory.createTypeReferenceNode(factory.createIdentifier("CreateSingleOperation")),
factory.createTypeReferenceNode(factory.createIdentifier("CreateMultipleOperation"))
])));
@ -2228,7 +2228,7 @@ function constructOperations(statements, entity) {
}
const propertySignatures2 = [];
if (process.env.COMPLING_AS_LIB) {
propertySignatures2.push(factory.createIndexSignature(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword)));
propertySignatures2.push(factory.createIndexSignature(undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword)));
}
if (oneToManySet) {
for (const entityName in foreignKeySet) {
@ -2359,7 +2359,7 @@ function constructOperations(statements, entity) {
if (propertySignatures2.length > 0) {
adNodes.push(factory.createTypeLiteralNode(propertySignatures2));
}
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("UpdateOperationData"), undefined, factory.createIntersectionTypeNode(adNodes)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("UpdateOperationData"), undefined, factory.createIntersectionTypeNode(adNodes)));
// UpdateOperation
const actionTypeNodes = [factory.createLiteralTypeNode(factory.createStringLiteral("update"))];
if (ActionAsts[entity]) {
@ -2371,7 +2371,7 @@ function constructOperations(statements, entity) {
if (process.env.COMPLING_AS_LIB) {
actionTypeNodes.push(factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword));
}
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("UpdateOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("UpdateOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
factory.createUnionTypeNode(actionTypeNodes),
factory.createTypeReferenceNode(factory.createIdentifier("UpdateOperationData")),
factory.createTypeReferenceNode(factory.createIdentifier("Filter"), undefined),
@ -2470,7 +2470,7 @@ function constructOperations(statements, entity) {
}
if (process.env.COMPLING_AS_LIB) {
reverseOneNodes.push(factory.createTypeLiteralNode([
factory.createIndexSignature(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword))
factory.createIndexSignature(undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("k"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword))
]));
}
}
@ -2551,15 +2551,15 @@ function constructOperations(statements, entity) {
)
);
} */
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("RemoveOperationData"), undefined, factory.createIntersectionTypeNode(adNodes)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("RemoveOperationData"), undefined, factory.createIntersectionTypeNode(adNodes)));
// RemoveOperation
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("RemoveOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("RemoveOperation"), undefined, factory.createTypeReferenceNode(factory.createIdentifier("OakOperation"), [
factory.createLiteralTypeNode(factory.createStringLiteral("remove")),
factory.createTypeReferenceNode(factory.createIdentifier("RemoveOperationData"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("Filter"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("Sorter"), undefined)
])));
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Operation"), undefined, factory.createUnionTypeNode([
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("Operation"), undefined, factory.createUnionTypeNode([
factory.createTypeReferenceNode(factory.createIdentifier("CreateOperation"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("UpdateOperation"), undefined),
factory.createTypeReferenceNode(factory.createIdentifier("RemoveOperation"), undefined)
@ -2567,7 +2567,7 @@ function constructOperations(statements, entity) {
}
const initialStatements = () => [
// import { String, Text, Int, SpecificKey } from 'oak-domain/types/DataType';
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier('PrimaryKey')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('ForeignKey')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('JsonProjection'))
@ -2577,7 +2577,7 @@ const initialStatements = () => [
Q_StringValue, Q_FullTextKey, Q_FullTextValue, FnCallValueAs,
Q_BooleanValue,
} from 'oak-domain/types/Demand'; */
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier('Q_DateValue')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('Q_BooleanValue')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('Q_NumberValue')),
@ -2591,7 +2591,7 @@ const initialStatements = () => [
factory.createImportSpecifier(false, undefined, factory.createIdentifier('JsonFilter')),
factory.createImportSpecifier(false, undefined, factory.createIdentifier('SubQueryPredicateMetadata')),
])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)()}Demand`)),
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier("OneOf")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("ValueOf"))
])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)()}Polyfill`)),
@ -2607,7 +2607,7 @@ const initialStatements = () => [
factory.createStringLiteral("../_SubQuery")
), */
// import { Filter as OakFilter } from 'oak-domain/src/types/Entity';
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier("FormCreateData")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("FormUpdateData")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("DeduceAggregation")),
@ -2623,7 +2623,7 @@ function outputSubQuery(outputDir, printer) {
}
for (const entity in Schema) {
// import * as User from '../User/Schema';
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(factory.createIdentifier(entity))), factory.createStringLiteral(`./${entity}/Schema`)));
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(factory.createIdentifier(entity))), factory.createStringLiteral(`./${entity}/Schema`)));
}
const entities = (0, lodash_1.keys)(Schema);
// 每个有manyToOne的Entity都会输出${One}IdSubQuery
@ -2642,7 +2642,7 @@ function outputSubQuery(outputDir, printer) {
// 如果是建立 base这里要加上额外可能的对象信息
inUnionTypeNode.push(factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword));
}
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(identifier), undefined, factory.createMappedTypeNode(undefined, factory.createTypeParameterDeclaration(undefined, factory.createIdentifier("K"), factory.createUnionTypeNode([
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(identifier), undefined, factory.createMappedTypeNode(undefined, factory.createTypeParameterDeclaration(undefined, factory.createIdentifier("K"), factory.createUnionTypeNode([
factory.createLiteralTypeNode(factory.createStringLiteral("$in")),
factory.createLiteralTypeNode(factory.createStringLiteral("$nin"))
]), undefined), undefined, factory.createToken(ts.SyntaxKind.QuestionToken), factory.createUnionTypeNode(inUnionTypeNode), undefined)));
@ -2657,20 +2657,20 @@ function outputEntityDict(outputDir, printer) {
const propertySignatures = [];
for (const entity in Schema) {
// import * as User from '../User/Schema';
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("EntityDef"), factory.createIdentifier(entity))])), factory.createStringLiteral(`./${entity}/Schema`)));
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("EntityDef"), factory.createIdentifier(entity))])), factory.createStringLiteral(`./${entity}/Schema`)));
const entityLc = (0, string_1.firstLetterLowerCase)(entity);
propertySignatures.push(factory.createPropertySignature(undefined, factory.createIdentifier(entityLc), undefined, factory.createTypeReferenceNode(entity)));
}
if ( /* process.env.COMPLING_AS_LIB */false) {
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("EntityDef"))])), factory.createStringLiteral("../types/Entity"), undefined), factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("EntityDict"), undefined, factory.createIntersectionTypeNode([
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("EntityDef"))])), factory.createStringLiteral("../types/Entity"), undefined), factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("EntityDict"), undefined, factory.createIntersectionTypeNode([
factory.createTypeLiteralNode(propertySignatures),
factory.createTypeLiteralNode([
factory.createIndexSignature(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, undefined, factory.createIdentifier("E"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createTypeReferenceNode(factory.createIdentifier("EntityDef"), undefined))
factory.createIndexSignature(undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("E"), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined)], factory.createTypeReferenceNode(factory.createIdentifier("EntityDef"), undefined))
])
])));
}
else {
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("EntityDict"), undefined, factory.createTypeLiteralNode(propertySignatures)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("EntityDict"), undefined, factory.createTypeLiteralNode(propertySignatures)));
}
const resultFile = ts.createSourceFile("someFileName.ts", "", ts.ScriptTarget.Latest, /*setParentNodes*/ false, ts.ScriptKind.TS);
const result = printer.printNode(ts.EmitHint.Unspecified, factory.createSourceFile(statements, factory.createToken(ts.SyntaxKind.EndOfFileToken), ts.NodeFlags.None), resultFile);
@ -2715,12 +2715,12 @@ function outputSchema(outputDir, printer) {
// );
}
}
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports(localActions.map(ele => factory.createImportSpecifier(false, undefined, factory.createIdentifier(ele))))), factory.createStringLiteral('./Action'), undefined), factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports(localActions.map(ele => factory.createImportSpecifier(false, undefined, factory.createIdentifier(ele))))), factory.createStringLiteral('./Action'), undefined), factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier("RelationAction")),
])), factory.createStringLiteral((0, env_1.ACTION_CONSTANT_IN_OAK_DOMAIN)()), undefined));
}
else {
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier("GenericAction")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("AppendOnlyAction")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("ReadOnlyAction")),
@ -2799,7 +2799,7 @@ function outputSchema(outputDir, printer) {
)
);
} */
statements.push(factory.createTypeAliasDeclaration(undefined, [factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("EntityDef"), undefined, factory.createTypeLiteralNode(EntityDefAttrs)));
statements.push(factory.createTypeAliasDeclaration([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier("EntityDef"), undefined, factory.createTypeLiteralNode(EntityDefAttrs)));
const result = printer.printList(ts.ListFormat.SourceFileStatements, factory.createNodeArray(statements), Schema[entity].sourceFile);
const fileName = path_1.default.join(outputDir, entity, 'Schema.ts');
(0, fs_1.writeFileSync)(fileName, result, { flag: 'w' });
@ -2833,7 +2833,7 @@ function outputAction(outputDir, printer) {
const result = printer.printList(ts.ListFormat.SourceFileStatements, factory.createNodeArray(importStatements.concat(statements)), sourceFile);
const filename = path_1.default.join(outputDir, entity, 'Action.ts');
(0, fs_1.writeFileSync)(filename, result, { flag: 'w' });
actionDictStatements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("ActionDefDict"), factory.createIdentifier(entity))])), factory.createStringLiteral(`./${entity}/Action`)));
actionDictStatements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("ActionDefDict"), factory.createIdentifier(entity))])), factory.createStringLiteral(`./${entity}/Action`)));
propertyAssignments.push(factory.createPropertyAssignment(factory.createIdentifier((0, string_1.firstLetterLowerCase)(entity)), factory.createIdentifier(entity)));
}
actionDictStatements.push(factory.createVariableStatement([factory.createModifier(ts.SyntaxKind.ExportKeyword)], factory.createVariableDeclarationList([factory.createVariableDeclaration(factory.createIdentifier("ActionDefDict"), undefined, undefined, factory.createObjectLiteralExpression(propertyAssignments, true))], ts.NodeFlags.Const)));
@ -3059,8 +3059,8 @@ function outputLocale(outputDir, printer) {
}
function outputStorage(outputDir, printer) {
const importStatements = [
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("StorageSchema"))])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)(1)}Storage`), undefined),
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("EntityDict"))])), factory.createStringLiteral("./EntityDict"), undefined)
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("StorageSchema"))])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)(1)}Storage`), undefined),
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("EntityDict"))])), factory.createStringLiteral("./EntityDict"), undefined)
];
const entityAssignments = [];
for (const entity in Schema) {
@ -3079,8 +3079,8 @@ function outputStorage(outputDir, printer) {
);
} */
const statements = [
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("StorageDesc"))])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)()}Storage`), undefined),
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports(fromSchemaSpecifiers)), factory.createStringLiteral("./Schema"), undefined)
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("StorageDesc"))])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)()}Storage`), undefined),
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports(fromSchemaSpecifiers)), factory.createStringLiteral("./Schema"), undefined)
];
const needImportActions = [];
switch (actionType) {
@ -3098,7 +3098,7 @@ function outputStorage(outputDir, printer) {
}
default: {
if (ActionAsts[entity]) {
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("actions"))])), factory.createStringLiteral("./Action"), undefined));
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("actions"))])), factory.createStringLiteral("./Action"), undefined));
}
else {
needImportActions.push(factory.createImportSpecifier(false, factory.createIdentifier("genericActions"), factory.createIdentifier("actions")));
@ -3109,7 +3109,7 @@ function outputStorage(outputDir, printer) {
needImportActions.push(factory.createImportSpecifier(false, undefined, factory.createIdentifier("relationActions")));
}
if (needImportActions.length > 0) {
statements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports(needImportActions)), factory.createStringLiteral((0, env_1.ACTION_CONSTANT_IN_OAK_DOMAIN)()), undefined));
statements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports(needImportActions)), factory.createStringLiteral((0, env_1.ACTION_CONSTANT_IN_OAK_DOMAIN)()), undefined));
}
const propertyAssignments = [];
const attributes = constructAttributes(entity);
@ -3172,7 +3172,7 @@ function outputStorage(outputDir, printer) {
const result = printer.printList(ts.ListFormat.SourceFileStatements, factory.createNodeArray(statements), sourceFile);
const filename = path_1.default.join(outputDir, entity, 'Storage.ts');
(0, fs_1.writeFileSync)(filename, result, { flag: 'w' });
importStatements.push(factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
importStatements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, factory.createIdentifier("desc"), factory.createIdentifier(`${(0, string_1.firstLetterLowerCase)(entity)}Desc`))
])), factory.createStringLiteral(`./${entity}/Storage`), undefined));
entityAssignments.push(factory.createPropertyAssignment((0, string_1.firstLetterLowerCase)(entity), factory.createIdentifier(`${(0, string_1.firstLetterLowerCase)(entity)}Desc`)));
@ -3422,12 +3422,12 @@ function outputRelation(outputDir, printer) {
}
}
const stmts = [
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
factory.createImportSpecifier(false, undefined, factory.createIdentifier("AuthCascadePath")),
factory.createImportSpecifier(false, undefined, factory.createIdentifier("AuthDeduceRelationMap"))
])), factory.createStringLiteral(`${(0, env_1.TYPE_PATH_IN_OAK_DOMAIN)(1)}Entity`), undefined),
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("EntityDict"))])), factory.createStringLiteral("./EntityDict"), undefined),
factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("CreateOperationData"), factory.createIdentifier("Relation"))])), factory.createStringLiteral("./Relation/Schema"), undefined),
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, undefined, factory.createIdentifier("EntityDict"))])), factory.createStringLiteral("./EntityDict"), undefined),
factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("CreateOperationData"), factory.createIdentifier("Relation"))])), factory.createStringLiteral("./Relation/Schema"), undefined),
factory.createVariableStatement([factory.createToken(ts.SyntaxKind.ExportKeyword)], factory.createVariableDeclarationList([factory.createVariableDeclaration(factory.createIdentifier("ActionCascadePathGraph"), undefined, factory.createArrayTypeNode(factory.createTypeReferenceNode(factory.createIdentifier("AuthCascadePath"), [factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined)])), factory.createArrayLiteralExpression(actionPath.map(([entity, path, root, isRelation]) => factory.createArrayLiteralExpression([
factory.createStringLiteral(entity),
factory.createStringLiteral(path),

View File

@ -138,7 +138,7 @@ interface AggrAvgExpression<A> {
$$avg: RefOrExpression<A>;
}
export type AggrExpression<A> = AggrAvgExpression<A> | AggrCountExpression<A> | AggrSumExpression<A> | AggrMaxExpression<A> | AggrMinExpression<A>;
export type Expression<A> = GeoExpression<A> | DateExpression<A> | LogicExpression<A> | BoolExpression<A> | CompareExpression<A> | MathExpression<A> | StringExpression<A> | AggrExpression<A>;
export type Expression<A> = GeoExpression<A> | DateExpression<A> | LogicExpression<A> | BoolExpression<A> | CompareExpression<A> | MathExpression<A> | StringExpression<A>;
export type ExpressionConstant = Geo | number | Date | string | boolean;
export declare function isGeoExpression<A>(expression: any): expression is GeoExpression<A>;
export declare function isDateExpression<A>(expression: any): expression is DateExpression<A>;

View File

@ -26,7 +26,7 @@
"@types/fs-extra": "^9.0.13",
"@types/lodash": "^4.14.182",
"@types/mocha": "^8.2.0",
"@types/node": "^14.18.48",
"@types/node": "^20.6.0",
"@types/node-schedule": "^2.1.0",
"@types/react": "^17.0.2",
"@types/uuid": "^8.3.0",
@ -39,7 +39,7 @@
"mocha": "^8.2.1",
"ts-node": "~10.9.1",
"tslib": "^2.4.0",
"typescript": "^4.7.4"
"typescript": "^5.2.2"
},
"dependencies": {
"dayjs": "^1.11.9",

View File

@ -65,7 +65,6 @@ export default class LocaleBuilder {
private outputDataFile() {
const statements: ts.Statement[] = [
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -85,7 +84,6 @@ export default class LocaleBuilder {
this.dependencies.forEach(
(ele, idx) => statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -164,7 +162,6 @@ export default class LocaleBuilder {
if (this.dependencies.length > 0) {
statements.push(
factory.createExportAssignment(
undefined,
undefined,
undefined,
factory.createCallExpression(
@ -183,7 +180,6 @@ export default class LocaleBuilder {
else {
statements.push(
factory.createExportAssignment(
undefined,
undefined,
undefined,
factory.createIdentifier("i18ns")

View File

@ -41,7 +41,6 @@ const ReversePointerRelations: Record<string, string[]> = {};
const ActionImportStatements = () => [
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -56,7 +55,6 @@ const ActionImportStatements = () => [
undefined
),
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -579,7 +577,6 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
factory.updateImportDeclaration(
node,
undefined,
undefined,
importClause,
factory.createStringLiteral(moduleSpecifier2Text),
undefined
@ -768,7 +765,6 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
moduleName,
factory.updateTypeAliasDeclaration(
node,
node.decorators,
modifiers,
factory.createIdentifier('ParticularAction'),
node.typeParameters,
@ -844,7 +840,6 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
pushStatementIntoActionAst(moduleName,
factory.updateTypeAliasDeclaration(
node,
node.decorators,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
node.name,
node.typeParameters,
@ -860,7 +855,6 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
pushStatementIntoActionAst(moduleName,
factory.updateTypeAliasDeclaration(
node,
node.decorators,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
node.name,
node.typeParameters,
@ -1214,7 +1208,6 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
pushStatementIntoActionAst(
moduleName,
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("Action"),
undefined,
@ -1500,7 +1493,6 @@ function constructSchema(statements: Array<ts.Statement>, entity: string) {
(ele) => {
if (ele !== entity) {
statements.push(factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -1523,7 +1515,6 @@ function constructSchema(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[
factory.createModifier(ts.SyntaxKind.ExportKeyword)
],
@ -1535,7 +1526,6 @@ function constructSchema(statements: Array<ts.Statement>, entity: string) {
])
),
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("OpAttr"),
undefined,
@ -1551,7 +1541,6 @@ function constructSchema(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[
factory.createModifier(ts.SyntaxKind.ExportKeyword)
],
@ -1869,7 +1858,6 @@ function constructFilter(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
undefined,
factory.createIdentifier('AttrFilter'),
undefined,
@ -1916,7 +1904,6 @@ function constructFilter(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("Filter"),
undefined,
@ -2192,10 +2179,8 @@ function constructProjection(statements: Array<ts.Statement>, entity: string) {
if (process.env.COMPLING_AS_LIB) {
MetaPropertySignatures.push(
factory.createIndexSignature(
undefined,
undefined,
[factory.createParameterDeclaration(
undefined,
undefined,
undefined,
factory.createIdentifier("k"),
@ -2210,7 +2195,6 @@ function constructProjection(statements: Array<ts.Statement>, entity: string) {
// Projection正常查询的投影
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("Projection"),
undefined,
@ -2267,7 +2251,6 @@ function constructProjection(statements: Array<ts.Statement>, entity: string) {
const identifier = `${foreignKey}IdProjection`;
statements.push(
factory.createTypeAliasDeclaration(
undefined,
undefined,
factory.createIdentifier(identifier),
undefined,
@ -2409,7 +2392,6 @@ function constructQuery(statements: Array<ts.Statement>, entity: string) {
([oneEntity, foreignKey]) => {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier(`${oneEntity}IdSubQuery`),
undefined,
@ -2434,7 +2416,6 @@ function constructQuery(statements: Array<ts.Statement>, entity: string) {
if (!manyToSelf) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier(`${entity}IdSubQuery`),
undefined,
@ -2599,10 +2580,8 @@ function constructSorter(statements: Array<ts.Statement>, entity: string) {
if (process.env.COMPLING_AS_LIB) {
members.push(
factory.createTypeLiteralNode([factory.createIndexSignature(
undefined,
undefined,
[factory.createParameterDeclaration(
undefined,
undefined,
undefined,
factory.createIdentifier("k"),
@ -2653,7 +2632,6 @@ function constructSorter(statements: Array<ts.Statement>, entity: string) {
*/
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("SortAttr"),
undefined,
@ -2669,7 +2647,6 @@ function constructSorter(statements: Array<ts.Statement>, entity: string) {
*/
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("SortNode"),
undefined,
@ -2701,7 +2678,6 @@ function constructSorter(statements: Array<ts.Statement>, entity: string) {
*/
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("Sorter"),
undefined,
@ -2801,7 +2777,6 @@ function constructFullAttrs(statements: Array<ts.Statement>, entity: string) {
}
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("NativeAttr"),
undefined,
@ -2820,7 +2795,6 @@ function constructFullAttrs(statements: Array<ts.Statement>, entity: string) {
}
else {
statements.push(factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("NativeAttr"),
undefined,
@ -2922,7 +2896,6 @@ function constructFullAttrs(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("FullAttr"),
undefined,
@ -2938,7 +2911,6 @@ function constructFullAttrs(statements: Array<ts.Statement>, entity: string) {
}
else {
statements.push(factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("FullAttr"),
undefined,
@ -2955,7 +2927,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
// Selection
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("SelectOperation"),
[
@ -2992,7 +2963,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
)
),
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("Selection"),
[
@ -3020,7 +2990,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
)
),
factory.createTypeAliasDeclaration(
undefined,
[factory.createToken(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("Aggregation"),
undefined,
@ -3365,10 +3334,8 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword)
),
factory.createIndexSignature(
undefined,
undefined,
[factory.createParameterDeclaration(
undefined,
undefined,
undefined,
factory.createIdentifier("K"),
@ -3540,7 +3507,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
}
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("CreateOperationData"),
undefined,
@ -3551,7 +3517,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
// CreateOperation
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("CreateSingleOperation"),
undefined,
@ -3566,7 +3531,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
)
),
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("CreateMultipleOperation"),
undefined,
@ -3584,7 +3548,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
)
),
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("CreateOperation"),
undefined,
@ -3920,10 +3883,8 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
if (process.env.COMPLING_AS_LIB) {
propertySignatures2.push(
factory.createIndexSignature(
undefined,
undefined,
[factory.createParameterDeclaration(
undefined,
undefined,
undefined,
factory.createIdentifier("k"),
@ -4169,7 +4130,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
}
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("UpdateOperationData"),
undefined,
@ -4198,7 +4158,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("UpdateOperation"),
undefined,
@ -4396,10 +4355,8 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
factory.createTypeLiteralNode(
[
factory.createIndexSignature(
undefined,
undefined,
[factory.createParameterDeclaration(
undefined,
undefined,
undefined,
factory.createIdentifier("k"),
@ -4505,7 +4462,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("RemoveOperationData"),
undefined,
@ -4516,7 +4472,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
// RemoveOperation
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("RemoveOperation"),
undefined,
@ -4543,7 +4498,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("Operation"),
undefined,
@ -4568,7 +4522,6 @@ function constructOperations(statements: Array<ts.Statement>, entity: string) {
const initialStatements = () => [
// import { String, Text, Int, SpecificKey } from 'oak-domain/types/DataType';
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -4602,7 +4555,6 @@ const initialStatements = () => [
Q_BooleanValue,
} from 'oak-domain/types/Demand'; */
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -4675,7 +4627,6 @@ const initialStatements = () => [
factory.createStringLiteral(`${TYPE_PATH_IN_OAK_DOMAIN()}Demand`)
),
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -4708,7 +4659,6 @@ const initialStatements = () => [
), */
// import { Filter as OakFilter } from 'oak-domain/src/types/Entity';
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -4764,7 +4714,6 @@ function outputSubQuery(outputDir: string, printer: ts.Printer) {
// import * as User from '../User/Schema';
statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -4816,7 +4765,6 @@ function outputSubQuery(outputDir: string, printer: ts.Printer) {
}
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier(identifier),
undefined,
@ -4862,7 +4810,6 @@ function outputEntityDict(outputDir: string, printer: ts.Printer) {
// import * as User from '../User/Schema';
statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -4891,7 +4838,6 @@ function outputEntityDict(outputDir: string, printer: ts.Printer) {
if (/* process.env.COMPLING_AS_LIB */false) {
statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -4906,7 +4852,6 @@ function outputEntityDict(outputDir: string, printer: ts.Printer) {
undefined
),
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("EntityDict"),
undefined,
@ -4916,10 +4861,8 @@ function outputEntityDict(outputDir: string, printer: ts.Printer) {
),
factory.createTypeLiteralNode([
factory.createIndexSignature(
undefined,
undefined,
[factory.createParameterDeclaration(
undefined,
undefined,
undefined,
factory.createIdentifier("E"),
@ -4940,7 +4883,6 @@ function outputEntityDict(outputDir: string, printer: ts.Printer) {
else {
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("EntityDict"),
undefined,
@ -5003,7 +4945,6 @@ function outputSchema(outputDir: string, printer: ts.Printer) {
}
statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5020,7 +4961,6 @@ function outputSchema(outputDir: string, printer: ts.Printer) {
undefined
),
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5041,7 +4981,6 @@ function outputSchema(outputDir: string, printer: ts.Printer) {
else {
statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5265,7 +5204,6 @@ function outputSchema(outputDir: string, printer: ts.Printer) {
} */
statements.push(
factory.createTypeAliasDeclaration(
undefined,
[factory.createModifier(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier("EntityDef"),
undefined,
@ -5336,7 +5274,6 @@ function outputAction(outputDir: string, printer: ts.Printer) {
actionDictStatements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5835,7 +5772,6 @@ function outputLocale(outputDir: string, printer: ts.Printer) {
function outputStorage(outputDir: string, printer: ts.Printer) {
const importStatements: ts.Statement[] = [
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5850,7 +5786,6 @@ function outputStorage(outputDir: string, printer: ts.Printer) {
undefined
),
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5888,7 +5823,6 @@ function outputStorage(outputDir: string, printer: ts.Printer) {
} */
const statements: ts.Statement[] = [
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5903,7 +5837,6 @@ function outputStorage(outputDir: string, printer: ts.Printer) {
undefined
),
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5951,7 +5884,6 @@ function outputStorage(outputDir: string, printer: ts.Printer) {
if (ActionAsts[entity]) {
statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -5991,7 +5923,6 @@ function outputStorage(outputDir: string, printer: ts.Printer) {
if (needImportActions.length > 0) {
statements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -6157,7 +6088,6 @@ function outputStorage(outputDir: string, printer: ts.Printer) {
importStatements.push(
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -6504,7 +6434,6 @@ function outputRelation(outputDir: string, printer: ts.Printer) {
const stmts: ts.Statement[] = [
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -6526,7 +6455,6 @@ function outputRelation(outputDir: string, printer: ts.Printer) {
undefined
),
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,
@ -6541,7 +6469,6 @@ function outputRelation(outputDir: string, printer: ts.Printer) {
undefined
),
factory.createImportDeclaration(
undefined,
undefined,
factory.createImportClause(
false,

View File

@ -177,8 +177,9 @@ interface AggrAvgExpression<A> {
export type AggrExpression<A> = AggrAvgExpression<A> | AggrCountExpression<A> | AggrSumExpression<A> | AggrMaxExpression<A> | AggrMinExpression<A>;
// 这里expression声明太复杂会导致上层库编译内存堆栈溢出尚未找到好的解决方案 by Xc 20230914
export type Expression<A> = GeoExpression<A> | DateExpression<A> | LogicExpression<A>
| BoolExpression<A> | CompareExpression<A> | MathExpression<A> | StringExpression<A> | AggrExpression<A>;
| BoolExpression<A> | CompareExpression<A> | MathExpression<A> | StringExpression<A>/* | AggrExpression<A> */;
export type ExpressionConstant = Geo | number | Date | string | boolean;

View File

@ -44,7 +44,7 @@
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node16", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "moduleResolution": "classic", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */