@entity-access/entity-access 1.2.11 → 1.2.12
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.
- package/README.md +6 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/common/EventSet.d.ts.map +1 -1
- package/dist/common/EventSet.js.map +1 -1
- package/dist/common/JsonGenerator.d.ts +1 -1
- package/dist/common/JsonGenerator.d.ts.map +1 -1
- package/dist/common/JsonGenerator.js +3 -100
- package/dist/common/JsonGenerator.js.map +1 -1
- package/dist/common/cache/TimedCache.d.ts.map +1 -1
- package/dist/common/cache/TimedCache.js +1 -0
- package/dist/common/cache/TimedCache.js.map +1 -1
- package/dist/compiler/ISqlHelpers.d.ts.map +1 -1
- package/dist/compiler/ISqlHelpers.js.map +1 -1
- package/dist/compiler/RawQuery.d.ts.map +1 -1
- package/dist/compiler/postgres/PostgreSqlMethodTransformer.d.ts.map +1 -1
- package/dist/compiler/postgres/PostgreSqlMethodTransformer.js.map +1 -1
- package/dist/decorators/IColumn.d.ts.map +1 -1
- package/dist/decorators/IForeignKeyConstraint.d.ts.map +1 -1
- package/dist/decorators/Index.d.ts.map +1 -1
- package/dist/decorators/Index.js.map +1 -1
- package/dist/drivers/base/BaseDriver.d.ts.map +1 -1
- package/dist/drivers/base/BaseDriver.js +0 -1
- package/dist/drivers/base/BaseDriver.js.map +1 -1
- package/dist/drivers/base/ExistingSchema.d.ts.map +1 -1
- package/dist/drivers/base/ExistingSchema.js.map +1 -1
- package/dist/drivers/postgres/PostgreSqlDriver.d.ts +1 -1
- package/dist/drivers/postgres/PostgreSqlDriver.d.ts.map +1 -1
- package/dist/drivers/postgres/PostgreSqlDriver.js +0 -1
- package/dist/drivers/postgres/PostgreSqlDriver.js.map +1 -1
- package/dist/drivers/sql-server/SqlServerDriver.d.ts +0 -1
- package/dist/drivers/sql-server/SqlServerDriver.d.ts.map +1 -1
- package/dist/drivers/sql-server/SqlServerDriver.js +3 -4
- package/dist/drivers/sql-server/SqlServerDriver.js.map +1 -1
- package/dist/migrations/Migrations.d.ts.map +1 -1
- package/dist/migrations/Migrations.js +4 -7
- package/dist/migrations/Migrations.js.map +1 -1
- package/dist/migrations/postgres/PostgresAutomaticMigrations.d.ts.map +1 -1
- package/dist/migrations/postgres/PostgresAutomaticMigrations.js +0 -2
- package/dist/migrations/postgres/PostgresAutomaticMigrations.js.map +1 -1
- package/dist/migrations/postgres/PostgresMigrations.d.ts +1 -1
- package/dist/migrations/postgres/PostgresMigrations.d.ts.map +1 -1
- package/dist/migrations/postgres/PostgresMigrations.js +2 -1
- package/dist/migrations/postgres/PostgresMigrations.js.map +1 -1
- package/dist/migrations/sql-server/SqlServerAutomaticMigrations.d.ts.map +1 -1
- package/dist/migrations/sql-server/SqlServerAutomaticMigrations.js +0 -4
- package/dist/migrations/sql-server/SqlServerAutomaticMigrations.js.map +1 -1
- package/dist/migrations/sql-server/SqlServerMigrations.d.ts +1 -1
- package/dist/migrations/sql-server/SqlServerMigrations.d.ts.map +1 -1
- package/dist/migrations/sql-server/SqlServerMigrations.js +1 -0
- package/dist/migrations/sql-server/SqlServerMigrations.js.map +1 -1
- package/dist/model/EntityContext.d.ts +0 -1
- package/dist/model/EntityContext.d.ts.map +1 -1
- package/dist/model/EntityContext.js +0 -9
- package/dist/model/EntityContext.js.map +1 -1
- package/dist/model/EntityModel.d.ts.map +1 -1
- package/dist/model/EntityModel.js.map +1 -1
- package/dist/model/EntityQuery.d.ts.map +1 -1
- package/dist/model/EntityQuery.js +0 -1
- package/dist/model/EntityQuery.js.map +1 -1
- package/dist/model/EntitySource.d.ts.map +1 -1
- package/dist/model/EntitySource.js.map +1 -1
- package/dist/model/changes/ChangeEntry.d.ts +0 -1
- package/dist/model/changes/ChangeEntry.d.ts.map +1 -1
- package/dist/model/changes/ChangeEntry.js +1 -3
- package/dist/model/changes/ChangeEntry.js.map +1 -1
- package/dist/model/changes/ChangeSet.d.ts +0 -1
- package/dist/model/changes/ChangeSet.d.ts.map +1 -1
- package/dist/model/changes/ChangeSet.js +0 -1
- package/dist/model/changes/ChangeSet.js.map +1 -1
- package/dist/model/events/ContextEvents.d.ts.map +1 -1
- package/dist/model/events/ContextEvents.js.map +1 -1
- package/dist/model/identity/IdentityService.d.ts.map +1 -1
- package/dist/model/identity/IdentityService.js.map +1 -1
- package/dist/model/identity/RelationMapper.d.ts +0 -1
- package/dist/model/identity/RelationMapper.d.ts.map +1 -1
- package/dist/model/identity/RelationMapper.js +0 -2
- package/dist/model/identity/RelationMapper.js.map +1 -1
- package/dist/query/ast/ExpressionToSql.js +1 -1
- package/dist/query/ast/ExpressionToSql.js.map +1 -1
- package/dist/query/ast/Expressions.d.ts +0 -1
- package/dist/query/ast/Expressions.d.ts.map +1 -1
- package/dist/query/ast/Expressions.js +17 -18
- package/dist/query/ast/Expressions.js.map +1 -1
- package/dist/query/ast/Visitor.d.ts.map +1 -1
- package/dist/query/ast/Visitor.js +1 -0
- package/dist/query/ast/Visitor.js.map +1 -1
- package/dist/query/expander/QueryExpander.d.ts +0 -2
- package/dist/query/expander/QueryExpander.d.ts.map +1 -1
- package/dist/query/expander/QueryExpander.js +0 -5
- package/dist/query/expander/QueryExpander.js.map +1 -1
- package/dist/query/parser/ArrowToExpression.d.ts.map +1 -1
- package/dist/query/parser/ArrowToExpression.js +0 -1
- package/dist/query/parser/ArrowToExpression.js.map +1 -1
- package/dist/query/parser/BabelVisitor.d.ts.map +1 -1
- package/dist/query/parser/BabelVisitor.js.map +1 -1
- package/dist/query/parser/Restructure.d.ts.map +1 -1
- package/dist/query/parser/Restructure.js.map +1 -1
- package/dist/sql/ISql.d.ts.map +1 -1
- package/dist/types/TimeSpan.d.ts +1 -1
- package/dist/types/TimeSpan.d.ts.map +1 -1
- package/dist/types/TimeSpan.js +9 -6
- package/dist/types/TimeSpan.js.map +1 -1
- package/dist/workflows/WorkflowContext.js +1 -1
- package/dist/workflows/WorkflowContext.js.map +1 -1
- package/dist/workflows/WorkflowStorage.d.ts.map +1 -1
- package/dist/workflows/WorkflowStorage.js +2 -2
- package/dist/workflows/WorkflowStorage.js.map +1 -1
- package/package.json +1 -1
- package/src/common/EventSet.ts +0 -1
- package/src/common/JsonGenerator.ts +4 -124
- package/src/common/cache/TimedCache.ts +0 -1
- package/src/compiler/ISqlHelpers.ts +0 -2
- package/src/compiler/RawQuery.ts +1 -1
- package/src/compiler/postgres/PostgreSqlMethodTransformer.ts +0 -1
- package/src/decorators/IColumn.ts +1 -1
- package/src/decorators/IForeignKeyConstraint.ts +1 -1
- package/src/decorators/Index.ts +0 -2
- package/src/drivers/base/BaseDriver.ts +0 -3
- package/src/drivers/base/ExistingSchema.ts +0 -1
- package/src/drivers/postgres/PostgreSqlDriver.ts +1 -2
- package/src/drivers/sql-server/SqlServerDriver.ts +3 -6
- package/src/migrations/Migrations.ts +4 -8
- package/src/migrations/postgres/PostgresAutomaticMigrations.ts +0 -5
- package/src/migrations/postgres/PostgresMigrations.ts +2 -1
- package/src/migrations/sql-server/SqlServerAutomaticMigrations.ts +0 -9
- package/src/migrations/sql-server/SqlServerMigrations.ts +1 -0
- package/src/model/EntityContext.ts +8 -12
- package/src/model/EntityModel.ts +0 -2
- package/src/model/EntityQuery.ts +1 -2
- package/src/model/EntitySource.ts +1 -2
- package/src/model/changes/ChangeEntry.ts +1 -4
- package/src/model/changes/ChangeSet.ts +0 -3
- package/src/model/events/ContextEvents.ts +0 -3
- package/src/model/identity/IdentityService.ts +0 -1
- package/src/model/identity/RelationMapper.ts +1 -2
- package/src/query/ast/ExpressionToSql.ts +5 -5
- package/src/query/ast/Expressions.ts +17 -21
- package/src/query/ast/Visitor.ts +1 -0
- package/src/query/expander/QueryExpander.ts +3 -9
- package/src/query/parser/ArrowToExpression.ts +0 -3
- package/src/query/parser/BabelVisitor.ts +0 -1
- package/src/query/parser/Restructure.ts +0 -1
- package/src/sql/ISql.ts +0 -4
- package/src/types/TimeSpan.ts +10 -8
- package/src/workflows/WorkflowContext.ts +3 -3
- package/src/workflows/WorkflowStorage.ts +2 -4
- package/tsconfig.json +1 -0
- package/dist/TestRunner.d.ts +0 -2
- package/dist/TestRunner.d.ts.map +0 -1
- package/dist/TestRunner.js +0 -2
- package/dist/TestRunner.js.map +0 -1
- package/src/TestRunner.ts +0 -2
|
@@ -4,8 +4,6 @@ import { IColumn } from "../../decorators/IColumn.js";
|
|
|
4
4
|
import { IForeignKeyConstraint } from "../../decorators/IForeignKeyConstraint.js";
|
|
5
5
|
import { IIndex } from "../../decorators/IIndex.js";
|
|
6
6
|
import { isSpatialType } from "../../decorators/ISqlType.js";
|
|
7
|
-
import { BaseConnection } from "../../drivers/base/BaseDriver.js";
|
|
8
|
-
import ExistingSchema from "../../drivers/base/ExistingSchema.js";
|
|
9
7
|
import { SqlServerLiteral } from "../../drivers/sql-server/SqlServerLiteral.js";
|
|
10
8
|
import EntityType from "../../entity-query/EntityType.js";
|
|
11
9
|
import type EntityContext from "../../model/EntityContext.js";
|
|
@@ -117,7 +115,6 @@ export default class SqlServerAutomaticMigrations extends SqlServerMigrations {
|
|
|
117
115
|
|
|
118
116
|
async migrateIndex(context: EntityContext, index: IIndex, type: EntityType) {
|
|
119
117
|
|
|
120
|
-
const driver = context.connection;
|
|
121
118
|
const name = type.schema
|
|
122
119
|
? type.schema + "." + type.name
|
|
123
120
|
: type.name;
|
|
@@ -171,8 +168,6 @@ export default class SqlServerAutomaticMigrations extends SqlServerMigrations {
|
|
|
171
168
|
text += ` and schema_name = ${schema}`;
|
|
172
169
|
}
|
|
173
170
|
|
|
174
|
-
const driver = context.connection;
|
|
175
|
-
|
|
176
171
|
const r = await this.executeQuery(text);
|
|
177
172
|
if (r.rows?.length === 0) {
|
|
178
173
|
if (r.rows["c1"] > 0) {
|
|
@@ -192,8 +187,6 @@ export default class SqlServerAutomaticMigrations extends SqlServerMigrations {
|
|
|
192
187
|
return;
|
|
193
188
|
}
|
|
194
189
|
|
|
195
|
-
const driver = context.connection;
|
|
196
|
-
|
|
197
190
|
// sql server does not allow self referencing FK
|
|
198
191
|
// so we will not create it
|
|
199
192
|
|
|
@@ -242,8 +235,6 @@ export default class SqlServerAutomaticMigrations extends SqlServerMigrations {
|
|
|
242
235
|
: type.name;
|
|
243
236
|
|
|
244
237
|
|
|
245
|
-
const driver = context.connection;
|
|
246
|
-
|
|
247
238
|
const text = `ALTER TABLE ${name} ADD CONSTRAINT ${constraint.name} CHECK (${constraint.filter})`;
|
|
248
239
|
|
|
249
240
|
try {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { BaseConnection, BaseDriver } from "../drivers/base/BaseDriver.js";
|
|
2
2
|
import ChangeSet from "./changes/ChangeSet.js";
|
|
3
3
|
import EntityModel from "./EntityModel.js";
|
|
4
|
-
import { Expression } from "../query/ast/Expressions.js";
|
|
5
4
|
import { IClassOf } from "../decorators/IClassOf.js";
|
|
6
5
|
import VerificationSession from "./verification/VerificationSession.js";
|
|
7
|
-
import EntityType from "../entity-query/EntityType.js";
|
|
8
6
|
import EntityEvents from "./events/EntityEvents.js";
|
|
9
7
|
import ChangeEntry from "./changes/ChangeEntry.js";
|
|
10
8
|
import ContextEvents from "./events/ContextEvents.js";
|
|
@@ -16,8 +14,6 @@ import { traceSymbol } from "../common/symbols/symbols.js";
|
|
|
16
14
|
|
|
17
15
|
const isChanging = Symbol("isChanging");
|
|
18
16
|
|
|
19
|
-
const empty = {};
|
|
20
|
-
|
|
21
17
|
export interface ISaveOptions {
|
|
22
18
|
trace?: (text: string) => void;
|
|
23
19
|
signal?: AbortSignal;
|
|
@@ -274,13 +270,13 @@ export default class EntityContext {
|
|
|
274
270
|
}
|
|
275
271
|
}
|
|
276
272
|
|
|
277
|
-
private async executeExpression(expression: Expression, { signal , trace }: ISaveOptions = empty) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
273
|
+
// private async executeExpression(expression: Expression, { signal , trace }: ISaveOptions = empty) {
|
|
274
|
+
// const { text, values } = this.driver.compiler.compileExpression(null, expression);
|
|
275
|
+
// if (trace) {
|
|
276
|
+
// trace(text);
|
|
277
|
+
// }
|
|
278
|
+
// const r = await this.connection.executeQuery({ text, values }, signal);
|
|
279
|
+
// return r.rows?.[0];
|
|
280
|
+
// }
|
|
285
281
|
|
|
286
282
|
}
|
package/src/model/EntityModel.ts
CHANGED
|
@@ -2,9 +2,7 @@ import type EntityContext from "./EntityContext.js";
|
|
|
2
2
|
import { IClassOf } from "../decorators/IClassOf.js";
|
|
3
3
|
import SchemaRegistry from "../decorators/SchemaRegistry.js";
|
|
4
4
|
import { EntitySource } from "./EntitySource.js";
|
|
5
|
-
import { BaseDriver } from "../drivers/base/BaseDriver.js";
|
|
6
5
|
import EntityType from "../entity-query/EntityType.js";
|
|
7
|
-
import { IStringTransformer } from "../query/ast/IStringTransformer.js";
|
|
8
6
|
import { IEntityRelation } from "../decorators/IColumn.js";
|
|
9
7
|
import type QueryCompiler from "../compiler/QueryCompiler.js";
|
|
10
8
|
import { Expression } from "../query/ast/Expressions.js";
|
package/src/model/EntityQuery.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { modelSymbol } from "../common/symbols/symbols.js";
|
|
|
4
4
|
import { AsyncDisposableScope } from "../common/usingAsync.js";
|
|
5
5
|
import { IDbReader } from "../drivers/base/BaseDriver.js";
|
|
6
6
|
import EntityType from "../entity-query/EntityType.js";
|
|
7
|
-
import { BinaryExpression, CallExpression, DeleteStatement, ExistsExpression, Expression, ExpressionAs, Identifier,
|
|
7
|
+
import { BinaryExpression, CallExpression, DeleteStatement, ExistsExpression, Expression, ExpressionAs, Identifier, JoinExpression, MemberExpression, NewObjectExpression, NumberLiteral, OrderByExpression, ParameterExpression, SelectStatement, UpdateStatement } from "../query/ast/Expressions.js";
|
|
8
8
|
import { QueryExpander } from "../query/expander/QueryExpander.js";
|
|
9
9
|
import EntityContext from "./EntityContext.js";
|
|
10
10
|
import type { EntitySource } from "./EntitySource.js";
|
|
@@ -38,7 +38,6 @@ export default class EntityQuery<T = any>
|
|
|
38
38
|
|
|
39
39
|
insertInTo(es: EntitySource) {
|
|
40
40
|
const model = es[modelSymbol] as EntityType;
|
|
41
|
-
const table = model.fullyQualifiedName as TableLiteral;
|
|
42
41
|
const fields = [] as string[];
|
|
43
42
|
for (const iterator of this.selectStatement.fields) {
|
|
44
43
|
if (iterator.type !== "ExpressionAs") {
|
|
@@ -2,8 +2,7 @@ import type EntityContext from "./EntityContext.js";
|
|
|
2
2
|
import type EntityType from "../entity-query/EntityType.js";
|
|
3
3
|
import type { IEntityQuery } from "./IFilterWithParameter.js";
|
|
4
4
|
import { contextSymbol, modelSymbol, traceSymbol } from "../common/symbols/symbols.js";
|
|
5
|
-
import { Expression,
|
|
6
|
-
import { DirectSaveType } from "../drivers/base/BaseDriver.js";
|
|
5
|
+
import { Expression, Identifier } from "../query/ast/Expressions.js";
|
|
7
6
|
import IdentityService from "./identity/IdentityService.js";
|
|
8
7
|
import sleep from "../common/sleep.js";
|
|
9
8
|
import EntityAccessError from "../common/EntityAccessError.js";
|
|
@@ -38,14 +38,11 @@ export default class ChangeEntry<T = any> implements IChanges {
|
|
|
38
38
|
|
|
39
39
|
private pending: (() => void)[];
|
|
40
40
|
|
|
41
|
-
private dependents: Set<ChangeEntry>;
|
|
42
|
-
|
|
43
41
|
constructor(p: IChanges, changeSet: ChangeSet) {
|
|
44
42
|
Object.setPrototypeOf(p, ChangeEntry.prototype);
|
|
45
43
|
const ce = p as ChangeEntry;
|
|
46
44
|
ce.changeSet = changeSet;
|
|
47
45
|
ce.pending = [];
|
|
48
|
-
ce.dependents = new Set();
|
|
49
46
|
ce.modified = new Map();
|
|
50
47
|
ce.order = 1;
|
|
51
48
|
return ce;
|
|
@@ -239,7 +236,7 @@ export default class ChangeEntry<T = any> implements IChanges {
|
|
|
239
236
|
|
|
240
237
|
// we will only apply the columns defined
|
|
241
238
|
if (dbValues !== void 0) {
|
|
242
|
-
const { entity
|
|
239
|
+
const { entity } = this;
|
|
243
240
|
for (const key in dbValues) {
|
|
244
241
|
if (Object.hasOwn(dbValues, key)) {
|
|
245
242
|
const element = dbValues[key];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import EntityAccessError from "../../common/EntityAccessError.js";
|
|
2
|
-
import EventSet from "../../common/EventSet.js";
|
|
3
2
|
import { identityMapSymbol } from "../../common/symbols/symbols.js";
|
|
4
3
|
import EntityContext from "../EntityContext.js";
|
|
5
4
|
import IdentityMap from "../identity/IdentityMap.js";
|
|
@@ -28,8 +27,6 @@ export default class ChangeSet {
|
|
|
28
27
|
*/
|
|
29
28
|
private readonly identityMap = new IdentityMap();
|
|
30
29
|
|
|
31
|
-
private nextId = 1;
|
|
32
|
-
|
|
33
30
|
private pending = void 0 as ChangeEntry[];
|
|
34
31
|
|
|
35
32
|
constructor(private context: EntityContext) {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import EntityAccessError from "../../common/EntityAccessError.js";
|
|
2
2
|
import { IClassOf } from "../../decorators/IClassOf.js";
|
|
3
|
-
import { ServiceProvider } from "../../di/di.js";
|
|
4
|
-
import { NotSupportedError } from "../../query/parser/NotSupportedError.js";
|
|
5
|
-
import type EntityContext from "../EntityContext.js";
|
|
6
3
|
import type EntityEvents from "./EntityEvents.js";
|
|
7
4
|
import { entityNameSymbol } from "./EntityEvents.js";
|
|
8
5
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import EventEmitter from "events";
|
|
2
1
|
import type ChangeEntry from "../changes/ChangeEntry.js";
|
|
3
2
|
import type ChangeSet from "../changes/ChangeSet.js";
|
|
4
3
|
import { IColumn } from "../../decorators/IColumn.js";
|
|
@@ -17,7 +16,7 @@ export default class RelationMapper {
|
|
|
17
16
|
private events: Map<string, Function[]> = new Map();
|
|
18
17
|
|
|
19
18
|
constructor(
|
|
20
|
-
|
|
19
|
+
changeSet: ChangeSet,
|
|
21
20
|
private identityMap = changeSet[identityMapSymbol]
|
|
22
21
|
) {
|
|
23
22
|
}
|
|
@@ -15,10 +15,10 @@ interface IPropertyChain {
|
|
|
15
15
|
chain: { member: string, args?: Expression[], isCollectionMethod?: boolean }[]
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
interface IPropertyMethods {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
18
|
+
// interface IPropertyMethods {
|
|
19
|
+
// identifier?: Identifier;
|
|
20
|
+
// parameter?: ParameterExpression;
|
|
21
|
+
// }
|
|
22
22
|
|
|
23
23
|
export interface IMappingModel {
|
|
24
24
|
parameter: ParameterExpression;
|
|
@@ -386,7 +386,7 @@ export default class ExpressionToSql extends Visitor<ITextQuery> {
|
|
|
386
386
|
visitMemberExpression(me: MemberExpression): ITextQuery {
|
|
387
387
|
const propertyChain = this.getPropertyChain(me);
|
|
388
388
|
if (propertyChain) {
|
|
389
|
-
const { parameter,
|
|
389
|
+
const { parameter, chain } = propertyChain;
|
|
390
390
|
if (parameter) {
|
|
391
391
|
if (parameter === this.root) {
|
|
392
392
|
// we have a parameter...
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { IClassOf } from "../../decorators/IClassOf.js";
|
|
2
|
-
import { ITextQuery } from "./IStringTransformer.js";
|
|
3
2
|
import type EntityType from "../../entity-query/EntityType.js";
|
|
4
3
|
import DebugStringVisitor from "./DebugStringVisitor.js";
|
|
5
|
-
import { IEntityRelation } from "../../decorators/IColumn.js";
|
|
6
|
-
|
|
7
|
-
const flattenedSelf = Symbol("flattenedSelf");
|
|
8
4
|
|
|
9
5
|
/**
|
|
10
6
|
* The reason we are using our own Expression type is to keep
|
|
@@ -146,23 +142,23 @@ export abstract class Expression {
|
|
|
146
142
|
return r as T;
|
|
147
143
|
}
|
|
148
144
|
|
|
149
|
-
private static shallowCopy(expression, constants: Expression[]) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
145
|
+
// private static shallowCopy(expression, constants: Expression[]) {
|
|
146
|
+
// const copy = {} as any;
|
|
147
|
+
// for (const key in expression) {
|
|
148
|
+
// if (Object.hasOwn(expression, key)) {
|
|
149
|
+
// const element = expression[key];
|
|
150
|
+
// if (key === "type" || key === "is") {
|
|
151
|
+
// continue;
|
|
152
|
+
// }
|
|
153
|
+
// if (element instanceof Constant) {
|
|
154
|
+
// constants.push(element);
|
|
155
|
+
// }
|
|
156
|
+
// copy[key] = element;
|
|
157
|
+
// }
|
|
158
|
+
// }
|
|
159
|
+
// Object.setPrototypeOf(copy, Object.getPrototypeOf(expression));
|
|
160
|
+
// return copy;
|
|
161
|
+
// }
|
|
166
162
|
|
|
167
163
|
readonly type: ExpressionType["type"];
|
|
168
164
|
|
package/src/query/ast/Visitor.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { cloner } from "../../common/cloner.js";
|
|
2
|
-
import { IEntityRelation } from "../../decorators/IColumn.js";
|
|
3
2
|
import EntityType from "../../entity-query/EntityType.js";
|
|
4
3
|
import EntityContext from "../../model/EntityContext.js";
|
|
5
4
|
import EntityQuery from "../../model/EntityQuery.js";
|
|
6
|
-
import
|
|
7
|
-
import { ArrowFunctionExpression, ExistsExpression, Expression, ExpressionType, JoinExpression, NumberLiteral, ParameterExpression, SelectStatement, TableSource } from "../ast/Expressions.js";
|
|
8
|
-
import ReplaceParameter from "../ast/ReplaceParameter.js";
|
|
9
|
-
import ArrowToExpression from "../parser/ArrowToExpression.js";
|
|
5
|
+
import { ArrowFunctionExpression, Expression, ExpressionType, JoinExpression, SelectStatement } from "../ast/Expressions.js";
|
|
10
6
|
import { NotSupportedError } from "../parser/NotSupportedError.js";
|
|
11
7
|
|
|
12
8
|
export class QueryExpander {
|
|
@@ -23,8 +19,8 @@ export class QueryExpander {
|
|
|
23
19
|
|
|
24
20
|
constructor(
|
|
25
21
|
private context: EntityContext,
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
select: SelectStatement,
|
|
23
|
+
filter: boolean
|
|
28
24
|
) {
|
|
29
25
|
|
|
30
26
|
}
|
|
@@ -98,8 +94,6 @@ export class QueryExpander {
|
|
|
98
94
|
// let where: Expression;
|
|
99
95
|
// let joinWhere: Expression;
|
|
100
96
|
|
|
101
|
-
const fk = relation.fkMap ?? relation.relatedRelation.fkMap;
|
|
102
|
-
|
|
103
97
|
key += "." + relation.name;
|
|
104
98
|
|
|
105
99
|
let relationSet = this.included.get(key);
|
|
@@ -5,9 +5,6 @@ import * as bpe from "@babel/types";
|
|
|
5
5
|
import Restructure from "./Restructure.js";
|
|
6
6
|
import { NotSupportedError } from "./NotSupportedError.js";
|
|
7
7
|
|
|
8
|
-
type IQueryFragment = string | { name?: string, value?: any };
|
|
9
|
-
|
|
10
|
-
const defaultObject = {};
|
|
11
8
|
|
|
12
9
|
export default class ArrowToExpression extends BabelVisitor<Expression> {
|
|
13
10
|
|
package/src/sql/ISql.ts
CHANGED
package/src/types/TimeSpan.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function isEmpty(n: number): boolean {
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
// function isEmpty(n: number): boolean {
|
|
2
|
+
// return n === undefined || n === null || n === 0 || isNaN(n);
|
|
3
|
+
// }
|
|
4
4
|
|
|
5
5
|
export const msMinutes = 60000;
|
|
6
6
|
|
|
@@ -52,8 +52,11 @@ export default class TimeSpan {
|
|
|
52
52
|
throw new Error("Invalid time format");
|
|
53
53
|
}
|
|
54
54
|
let isPM: boolean = false;
|
|
55
|
-
|
|
56
|
-
let
|
|
55
|
+
let d: number;
|
|
56
|
+
let h: number;
|
|
57
|
+
let m: number;
|
|
58
|
+
let s: number;
|
|
59
|
+
let ms: number;
|
|
57
60
|
const tokens = text.split(/:/);
|
|
58
61
|
// split last...
|
|
59
62
|
const last = tokens[tokens.length - 1];
|
|
@@ -94,8 +97,6 @@ export default class TimeSpan {
|
|
|
94
97
|
return new TimeSpan(d, isPM ? h + 12 : h, m, s, ms);
|
|
95
98
|
}
|
|
96
99
|
|
|
97
|
-
private msSinceEpoch: number;
|
|
98
|
-
|
|
99
100
|
public get totalSeconds(): number {
|
|
100
101
|
return this.msSinceEpoch * secondsPerMS;
|
|
101
102
|
}
|
|
@@ -151,9 +152,10 @@ export default class TimeSpan {
|
|
|
151
152
|
return new TimeSpan(Math.ceil(this.msSinceEpoch % msDays));
|
|
152
153
|
}
|
|
153
154
|
|
|
155
|
+
private msSinceEpoch: number;
|
|
154
156
|
constructor(ms: number);
|
|
155
157
|
// tslint:disable-next-line: unified-signatures
|
|
156
|
-
constructor(days: number, hours: number, minutes?: number, seconds?: number, milliseconds?: number)
|
|
158
|
+
constructor(days: number, hours: number, minutes?: number, seconds?: number, milliseconds?: number);
|
|
157
159
|
constructor(days: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number) {
|
|
158
160
|
if (arguments.length === 1) {
|
|
159
161
|
this.msSinceEpoch = days;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { randomBytes
|
|
2
|
+
import { randomBytes } from "crypto";
|
|
3
3
|
import EntityAccessError from "../common/EntityAccessError.js";
|
|
4
4
|
import { IClassOf } from "../decorators/IClassOf.js";
|
|
5
|
-
import Inject, {
|
|
5
|
+
import Inject, { ServiceProvider, injectServiceKeysSymbol } from "../di/di.js";
|
|
6
6
|
import DateTime from "../types/DateTime.js";
|
|
7
7
|
import type Workflow from "./Workflow.js";
|
|
8
8
|
import { ActivitySuspendedError } from "./ActivitySuspendedError.js";
|
|
@@ -332,7 +332,7 @@ export default class WorkflowContext {
|
|
|
332
332
|
// run...
|
|
333
333
|
for (const iterator of pending) {
|
|
334
334
|
try {
|
|
335
|
-
using
|
|
335
|
+
using _l = iterator;
|
|
336
336
|
await this.run(iterator.item, iterator.signal);
|
|
337
337
|
} catch (error) {
|
|
338
338
|
EALogger.error(error);
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import Inject, { RegisterSingleton } from "../di/di.js";
|
|
4
4
|
import { BaseDriver } from "../drivers/base/BaseDriver.js";
|
|
5
|
-
import { CallExpression, Expression, NullExpression, NumberLiteral, UpdateStatement } from "../query/ast/Expressions.js";
|
|
6
5
|
import DateTime from "../types/DateTime.js";
|
|
7
6
|
import WorkflowClock from "./WorkflowClock.js";
|
|
8
|
-
import RawQuery from "../compiler/RawQuery.js";
|
|
9
7
|
import { loadedFromDb, WorkflowDbContext, WorkflowItem } from "./WorkflowDbContext.js";
|
|
10
8
|
import WorkflowTask from "./WorkflowTask.js";
|
|
11
9
|
import Sql from "../sql/Sql.js";
|
|
@@ -261,8 +259,8 @@ export default class WorkflowStorage {
|
|
|
261
259
|
)
|
|
262
260
|
&& x.isWorkflow === true
|
|
263
261
|
&& x.taskGroup === p.taskGroup)
|
|
264
|
-
.orderBy(
|
|
265
|
-
.thenBy(
|
|
262
|
+
.orderBy((x) => x.eta)
|
|
263
|
+
.thenBy((x) => x.priority)
|
|
266
264
|
.limit(20)
|
|
267
265
|
.withSignal(signal)
|
|
268
266
|
.updateSelect({ uuid}, (x, p) => ({
|
package/tsconfig.json
CHANGED
package/dist/TestRunner.d.ts
DELETED
package/dist/TestRunner.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TestRunner.d.ts","sourceRoot":"","sources":["../src/TestRunner.ts"],"names":[],"mappings":""}
|
package/dist/TestRunner.js
DELETED
package/dist/TestRunner.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TestRunner.js","sourceRoot":"","sources":["../src/TestRunner.ts"],"names":[],"mappings":""}
|
package/src/TestRunner.ts
DELETED