sasat 0.18.2 → 0.18.3
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.
|
@@ -12,20 +12,22 @@ export class RelationMapGenerator {
|
|
|
12
12
|
.export();
|
|
13
13
|
}
|
|
14
14
|
referencedRelationType(node) {
|
|
15
|
-
const type = tsg.
|
|
16
|
-
node.parent.entityName.
|
|
17
|
-
|
|
15
|
+
const type = tsg.typeRef('EntityResult', [
|
|
16
|
+
tsg.typeRef(node.parent.entityName.entityWithRelationTypeName()),
|
|
17
|
+
node.parent.entityName.identifiableTypeReference(Directory.paths.generated),
|
|
18
|
+
]).importFrom('sasat');
|
|
18
19
|
return tsg.propertySignature(node.referencedByPropertyName(), node.relation === 'Many' ? tsg.arrayType(type) : type);
|
|
19
20
|
}
|
|
20
21
|
entityRelationType(node) {
|
|
21
|
-
const importEntity = (entity) => Directory.entityPath(Directory.paths.generated, entity);
|
|
22
22
|
const typeProperties = [
|
|
23
|
-
...node.relations.map(it =>
|
|
24
|
-
tsg.
|
|
25
|
-
.
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
...node.relations.map(it => {
|
|
24
|
+
const type = tsg.typeRef('EntityResult', [
|
|
25
|
+
tsg.typeRef(it.to.entityName.entityWithRelationTypeName()),
|
|
26
|
+
tsg.typeRef(it.to.entityName.relationTypeName()),
|
|
27
|
+
])
|
|
28
|
+
.importFrom('sasat');
|
|
29
|
+
return tsg.propertySignature(it.refPropertyName(), type);
|
|
30
|
+
}),
|
|
29
31
|
...node
|
|
30
32
|
.findReferencedRelations()
|
|
31
33
|
.map(it => this.referencedRelationType(it)),
|
|
@@ -69,7 +71,7 @@ export class RelationMapGenerator {
|
|
|
69
71
|
tableInfo(root) {
|
|
70
72
|
const columnMap = (entity) => tsg.propertyAssign('columnMap', tsg.object(...entity.fields.map(field => tsg.propertyAssign(field.fieldName, tsg.string(field.columnName)))));
|
|
71
73
|
return tsg
|
|
72
|
-
.variable('const', 'tableInfo', tsg.object(...root.repositories.map(repo => tsg.propertyAssign(repo.tableName, tsg.object(tsg.propertyAssign('identifiableKeys', tsg.array(repo.primaryKeys.map(tsg.string))), columnMap(repo.entity))))))
|
|
74
|
+
.variable('const', 'tableInfo', tsg.object(...root.repositories.map(repo => tsg.propertyAssign(repo.tableName, tsg.object(tsg.propertyAssign('identifiableKeys', tsg.array(repo.primaryKeys.map(tsg.string))), columnMap(repo.entity))))), tsg.typeRef('TableInfo').importFrom('sasat'))
|
|
73
75
|
.export();
|
|
74
76
|
}
|
|
75
77
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
export { BooleanValueExpression, Query, LockMode, } from './runtime/dsl/query/query.js';
|
|
2
|
-
export { Relation } from './migration/data/relation.js';
|
|
1
|
+
export type { BooleanValueExpression, Query, LockMode, } from './runtime/dsl/query/query.js';
|
|
2
|
+
export type { Relation } from './migration/data/relation.js';
|
|
3
|
+
export type { RelationMap } from './runtime/dsl/query/createQueryResolveInfo.js';
|
|
4
|
+
export type { TableInfo } from "./runtime/dsl/query/createQueryResolveInfo.js";
|
|
5
|
+
export type { Fields } from './runtime/field.js';
|
|
6
|
+
export type { ComparisonOperators } from './db/sql/expression/comparison.js';
|
|
7
|
+
export type { MigrationStore } from './migration/front/storeMigrator.js';
|
|
8
|
+
export type { SasatMigration } from './migration/front/migration.js';
|
|
9
|
+
export type { CommandResponse, QueryResponse } from './db/connectors/dbClient.js';
|
|
3
10
|
export { QExpr } from './runtime/dsl/factory.js';
|
|
4
|
-
export { RelationMap } from './runtime/dsl/query/createQueryResolveInfo.js';
|
|
5
|
-
export { Fields } from './runtime/field.js';
|
|
6
11
|
export { gqlResolveInfoToField } from './runtime/gqlResolveInfoToField.js';
|
|
7
|
-
export { ComparisonOperators } from './db/sql/expression/comparison.js';
|
|
8
|
-
export { MigrationStore } from './migration/front/storeMigrator.js';
|
|
9
|
-
export { SasatMigration } from './migration/front/migration.js';
|
|
10
12
|
export { SasatDBDatasource, EntityResult, EntityType, ListQueryOption, QueryOptions, } from './runtime/sasatDBDatasource.js';
|
|
11
13
|
export { getCurrentDateTimeString } from './util/dateUtil.js';
|
|
12
14
|
export { getDbClient } from './db/getDbClient.js';
|
|
13
15
|
export { assignDeep } from './util/assignDeep.js';
|
|
14
16
|
export { createTypeDef } from './runtime/createTypeDef.js';
|
|
15
17
|
export { CompositeCondition } from './db/sql/expression/compositeCondition.js';
|
|
16
|
-
export { CommandResponse, QueryResponse } from './db/connectors/dbClient.js';
|
|
17
18
|
export { pick } from './runtime/util.js';
|