oak-domain 5.1.4 → 5.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -588,9 +588,17 @@ function outputFeatureIndex(dependencies, briefNames, sourceFile, printer, filen
|
|
|
588
588
|
importStatements.push(factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([factory.createImportSpecifier(false, factory.createIdentifier("FeatureDict"), factory.createIdentifier(fdName))])), factory.createStringLiteral(dep), undefined));
|
|
589
589
|
fdNames.push(fdName);
|
|
590
590
|
});
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
591
|
+
let i = 0;
|
|
592
|
+
while (true) {
|
|
593
|
+
const stmt = statements[i];
|
|
594
|
+
if (ts.isFunctionDeclaration(stmt)) {
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
i++;
|
|
598
|
+
}
|
|
599
|
+
const stmt3 = statements[i - 1], stmt4 = statements[i];
|
|
600
|
+
(0, assert_1.default)(ts.isImportDeclaration(stmt3) && ts.isFunctionDeclaration(stmt4));
|
|
601
|
+
const { name, parameters } = stmt4;
|
|
594
602
|
(0, assert_1.default)(ts.isIdentifier(name) && name.text === 'create' && parameters.length === 1);
|
|
595
603
|
const [param] = parameters;
|
|
596
604
|
const { name: paramName, type } = param;
|
|
@@ -604,9 +612,9 @@ function outputFeatureIndex(dependencies, briefNames, sourceFile, printer, filen
|
|
|
604
612
|
])
|
|
605
613
|
});
|
|
606
614
|
statements2 = [
|
|
607
|
-
...statements.slice(0,
|
|
615
|
+
...statements.slice(0, i),
|
|
608
616
|
...importStatements,
|
|
609
|
-
...statements.slice(
|
|
617
|
+
...statements.slice(i)
|
|
610
618
|
];
|
|
611
619
|
if (isModule) {
|
|
612
620
|
statements2.push(factory.createFunctionDeclaration([
|
|
@@ -756,7 +764,7 @@ function tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer) {
|
|
|
756
764
|
const moduleTemplateDir = join(moduleDir, 'template');
|
|
757
765
|
if ((0, fs_1.existsSync)(moduleTemplateDir)) {
|
|
758
766
|
// data.ts中规定的初始化数据,拷贝到data目录下,并注入到data/index.ts
|
|
759
|
-
const dataFile = join(moduleTemplateDir, 'data
|
|
767
|
+
const dataFile = join(moduleTemplateDir, 'data.ts');
|
|
760
768
|
if ((0, fs_1.existsSync)(dataFile)) {
|
|
761
769
|
const prjDataFile = join(cwd, 'src', 'data', `${briefNames[idx]}Data.ts`);
|
|
762
770
|
if (!(0, fs_1.existsSync)(prjDataFile)) {
|
|
@@ -148,7 +148,7 @@ class RelationAuth {
|
|
|
148
148
|
if (!entity2) {
|
|
149
149
|
entity2 = relations[0]?.entity;
|
|
150
150
|
}
|
|
151
|
-
else {
|
|
151
|
+
else if (relations.length) {
|
|
152
152
|
(0, assert_1.default)(entity2 === relations[0]?.entity);
|
|
153
153
|
}
|
|
154
154
|
return relations.map(ele => ele.id);
|
|
@@ -156,6 +156,7 @@ class RelationAuth {
|
|
|
156
156
|
const relationIds = getRelationIds();
|
|
157
157
|
if (relationIds instanceof Promise) {
|
|
158
158
|
return relationIds.then((ids) => {
|
|
159
|
+
(0, assert_1.default)(ids.length > 0);
|
|
159
160
|
return Promise.all(ids.map(ele => checkOnRelationId(entity2, ele, entityFilter))).then((value) => {
|
|
160
161
|
if (intersection) {
|
|
161
162
|
return !(value.includes(false));
|
|
@@ -164,6 +165,10 @@ class RelationAuth {
|
|
|
164
165
|
});
|
|
165
166
|
});
|
|
166
167
|
}
|
|
168
|
+
if (relationIds.length === 0) {
|
|
169
|
+
// 如果没有relationId(前端cache中),直接返回false
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
167
172
|
const value = relationIds.map(ele => checkOnRelationId(entity2, ele, entityFilter));
|
|
168
173
|
if (intersection) {
|
|
169
174
|
return !(value.includes(false));
|