@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.
Files changed (152) hide show
  1. package/README.md +6 -6
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/common/EventSet.d.ts.map +1 -1
  4. package/dist/common/EventSet.js.map +1 -1
  5. package/dist/common/JsonGenerator.d.ts +1 -1
  6. package/dist/common/JsonGenerator.d.ts.map +1 -1
  7. package/dist/common/JsonGenerator.js +3 -100
  8. package/dist/common/JsonGenerator.js.map +1 -1
  9. package/dist/common/cache/TimedCache.d.ts.map +1 -1
  10. package/dist/common/cache/TimedCache.js +1 -0
  11. package/dist/common/cache/TimedCache.js.map +1 -1
  12. package/dist/compiler/ISqlHelpers.d.ts.map +1 -1
  13. package/dist/compiler/ISqlHelpers.js.map +1 -1
  14. package/dist/compiler/RawQuery.d.ts.map +1 -1
  15. package/dist/compiler/postgres/PostgreSqlMethodTransformer.d.ts.map +1 -1
  16. package/dist/compiler/postgres/PostgreSqlMethodTransformer.js.map +1 -1
  17. package/dist/decorators/IColumn.d.ts.map +1 -1
  18. package/dist/decorators/IForeignKeyConstraint.d.ts.map +1 -1
  19. package/dist/decorators/Index.d.ts.map +1 -1
  20. package/dist/decorators/Index.js.map +1 -1
  21. package/dist/drivers/base/BaseDriver.d.ts.map +1 -1
  22. package/dist/drivers/base/BaseDriver.js +0 -1
  23. package/dist/drivers/base/BaseDriver.js.map +1 -1
  24. package/dist/drivers/base/ExistingSchema.d.ts.map +1 -1
  25. package/dist/drivers/base/ExistingSchema.js.map +1 -1
  26. package/dist/drivers/postgres/PostgreSqlDriver.d.ts +1 -1
  27. package/dist/drivers/postgres/PostgreSqlDriver.d.ts.map +1 -1
  28. package/dist/drivers/postgres/PostgreSqlDriver.js +0 -1
  29. package/dist/drivers/postgres/PostgreSqlDriver.js.map +1 -1
  30. package/dist/drivers/sql-server/SqlServerDriver.d.ts +0 -1
  31. package/dist/drivers/sql-server/SqlServerDriver.d.ts.map +1 -1
  32. package/dist/drivers/sql-server/SqlServerDriver.js +3 -4
  33. package/dist/drivers/sql-server/SqlServerDriver.js.map +1 -1
  34. package/dist/migrations/Migrations.d.ts.map +1 -1
  35. package/dist/migrations/Migrations.js +4 -7
  36. package/dist/migrations/Migrations.js.map +1 -1
  37. package/dist/migrations/postgres/PostgresAutomaticMigrations.d.ts.map +1 -1
  38. package/dist/migrations/postgres/PostgresAutomaticMigrations.js +0 -2
  39. package/dist/migrations/postgres/PostgresAutomaticMigrations.js.map +1 -1
  40. package/dist/migrations/postgres/PostgresMigrations.d.ts +1 -1
  41. package/dist/migrations/postgres/PostgresMigrations.d.ts.map +1 -1
  42. package/dist/migrations/postgres/PostgresMigrations.js +2 -1
  43. package/dist/migrations/postgres/PostgresMigrations.js.map +1 -1
  44. package/dist/migrations/sql-server/SqlServerAutomaticMigrations.d.ts.map +1 -1
  45. package/dist/migrations/sql-server/SqlServerAutomaticMigrations.js +0 -4
  46. package/dist/migrations/sql-server/SqlServerAutomaticMigrations.js.map +1 -1
  47. package/dist/migrations/sql-server/SqlServerMigrations.d.ts +1 -1
  48. package/dist/migrations/sql-server/SqlServerMigrations.d.ts.map +1 -1
  49. package/dist/migrations/sql-server/SqlServerMigrations.js +1 -0
  50. package/dist/migrations/sql-server/SqlServerMigrations.js.map +1 -1
  51. package/dist/model/EntityContext.d.ts +0 -1
  52. package/dist/model/EntityContext.d.ts.map +1 -1
  53. package/dist/model/EntityContext.js +0 -9
  54. package/dist/model/EntityContext.js.map +1 -1
  55. package/dist/model/EntityModel.d.ts.map +1 -1
  56. package/dist/model/EntityModel.js.map +1 -1
  57. package/dist/model/EntityQuery.d.ts.map +1 -1
  58. package/dist/model/EntityQuery.js +0 -1
  59. package/dist/model/EntityQuery.js.map +1 -1
  60. package/dist/model/EntitySource.d.ts.map +1 -1
  61. package/dist/model/EntitySource.js.map +1 -1
  62. package/dist/model/changes/ChangeEntry.d.ts +0 -1
  63. package/dist/model/changes/ChangeEntry.d.ts.map +1 -1
  64. package/dist/model/changes/ChangeEntry.js +1 -3
  65. package/dist/model/changes/ChangeEntry.js.map +1 -1
  66. package/dist/model/changes/ChangeSet.d.ts +0 -1
  67. package/dist/model/changes/ChangeSet.d.ts.map +1 -1
  68. package/dist/model/changes/ChangeSet.js +0 -1
  69. package/dist/model/changes/ChangeSet.js.map +1 -1
  70. package/dist/model/events/ContextEvents.d.ts.map +1 -1
  71. package/dist/model/events/ContextEvents.js.map +1 -1
  72. package/dist/model/identity/IdentityService.d.ts.map +1 -1
  73. package/dist/model/identity/IdentityService.js.map +1 -1
  74. package/dist/model/identity/RelationMapper.d.ts +0 -1
  75. package/dist/model/identity/RelationMapper.d.ts.map +1 -1
  76. package/dist/model/identity/RelationMapper.js +0 -2
  77. package/dist/model/identity/RelationMapper.js.map +1 -1
  78. package/dist/query/ast/ExpressionToSql.js +1 -1
  79. package/dist/query/ast/ExpressionToSql.js.map +1 -1
  80. package/dist/query/ast/Expressions.d.ts +0 -1
  81. package/dist/query/ast/Expressions.d.ts.map +1 -1
  82. package/dist/query/ast/Expressions.js +17 -18
  83. package/dist/query/ast/Expressions.js.map +1 -1
  84. package/dist/query/ast/Visitor.d.ts.map +1 -1
  85. package/dist/query/ast/Visitor.js +1 -0
  86. package/dist/query/ast/Visitor.js.map +1 -1
  87. package/dist/query/expander/QueryExpander.d.ts +0 -2
  88. package/dist/query/expander/QueryExpander.d.ts.map +1 -1
  89. package/dist/query/expander/QueryExpander.js +0 -5
  90. package/dist/query/expander/QueryExpander.js.map +1 -1
  91. package/dist/query/parser/ArrowToExpression.d.ts.map +1 -1
  92. package/dist/query/parser/ArrowToExpression.js +0 -1
  93. package/dist/query/parser/ArrowToExpression.js.map +1 -1
  94. package/dist/query/parser/BabelVisitor.d.ts.map +1 -1
  95. package/dist/query/parser/BabelVisitor.js.map +1 -1
  96. package/dist/query/parser/Restructure.d.ts.map +1 -1
  97. package/dist/query/parser/Restructure.js.map +1 -1
  98. package/dist/sql/ISql.d.ts.map +1 -1
  99. package/dist/types/TimeSpan.d.ts +1 -1
  100. package/dist/types/TimeSpan.d.ts.map +1 -1
  101. package/dist/types/TimeSpan.js +9 -6
  102. package/dist/types/TimeSpan.js.map +1 -1
  103. package/dist/workflows/WorkflowContext.js +1 -1
  104. package/dist/workflows/WorkflowContext.js.map +1 -1
  105. package/dist/workflows/WorkflowStorage.d.ts.map +1 -1
  106. package/dist/workflows/WorkflowStorage.js +2 -2
  107. package/dist/workflows/WorkflowStorage.js.map +1 -1
  108. package/package.json +1 -1
  109. package/src/common/EventSet.ts +0 -1
  110. package/src/common/JsonGenerator.ts +4 -124
  111. package/src/common/cache/TimedCache.ts +0 -1
  112. package/src/compiler/ISqlHelpers.ts +0 -2
  113. package/src/compiler/RawQuery.ts +1 -1
  114. package/src/compiler/postgres/PostgreSqlMethodTransformer.ts +0 -1
  115. package/src/decorators/IColumn.ts +1 -1
  116. package/src/decorators/IForeignKeyConstraint.ts +1 -1
  117. package/src/decorators/Index.ts +0 -2
  118. package/src/drivers/base/BaseDriver.ts +0 -3
  119. package/src/drivers/base/ExistingSchema.ts +0 -1
  120. package/src/drivers/postgres/PostgreSqlDriver.ts +1 -2
  121. package/src/drivers/sql-server/SqlServerDriver.ts +3 -6
  122. package/src/migrations/Migrations.ts +4 -8
  123. package/src/migrations/postgres/PostgresAutomaticMigrations.ts +0 -5
  124. package/src/migrations/postgres/PostgresMigrations.ts +2 -1
  125. package/src/migrations/sql-server/SqlServerAutomaticMigrations.ts +0 -9
  126. package/src/migrations/sql-server/SqlServerMigrations.ts +1 -0
  127. package/src/model/EntityContext.ts +8 -12
  128. package/src/model/EntityModel.ts +0 -2
  129. package/src/model/EntityQuery.ts +1 -2
  130. package/src/model/EntitySource.ts +1 -2
  131. package/src/model/changes/ChangeEntry.ts +1 -4
  132. package/src/model/changes/ChangeSet.ts +0 -3
  133. package/src/model/events/ContextEvents.ts +0 -3
  134. package/src/model/identity/IdentityService.ts +0 -1
  135. package/src/model/identity/RelationMapper.ts +1 -2
  136. package/src/query/ast/ExpressionToSql.ts +5 -5
  137. package/src/query/ast/Expressions.ts +17 -21
  138. package/src/query/ast/Visitor.ts +1 -0
  139. package/src/query/expander/QueryExpander.ts +3 -9
  140. package/src/query/parser/ArrowToExpression.ts +0 -3
  141. package/src/query/parser/BabelVisitor.ts +0 -1
  142. package/src/query/parser/Restructure.ts +0 -1
  143. package/src/sql/ISql.ts +0 -4
  144. package/src/types/TimeSpan.ts +10 -8
  145. package/src/workflows/WorkflowContext.ts +3 -3
  146. package/src/workflows/WorkflowStorage.ts +2 -4
  147. package/tsconfig.json +1 -0
  148. package/dist/TestRunner.d.ts +0 -2
  149. package/dist/TestRunner.d.ts.map +0 -1
  150. package/dist/TestRunner.js +0 -2
  151. package/dist/TestRunner.js.map +0 -1
  152. 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 {
@@ -142,6 +142,7 @@ export default abstract class SqlServerMigrations extends Migrations {
142
142
  case "Geography":
143
143
  return "geography";
144
144
  }
145
+ // @ts-expect-error unused
145
146
  const a: never = iterator.dataType;
146
147
  throw new Error("Not Defined");
147
148
  }
@@ -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
- const { text, values } = this.driver.compiler.compileExpression(null, expression);
279
- if (trace) {
280
- trace(text);
281
- }
282
- const r = await this.connection.executeQuery({ text, values }, signal);
283
- return r.rows?.[0];
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
  }
@@ -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";
@@ -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, InsertStatement, JoinExpression, MemberExpression, NewObjectExpression, NumberLiteral, OrderByExpression, ParameterExpression, SelectStatement, TableLiteral, UpdateStatement } from "../query/ast/Expressions.js";
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, ExpressionAs, Identifier, InsertStatement, TableLiteral } from "../query/ast/Expressions.js";
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, type } = this;
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,5 +1,4 @@
1
1
  import { identitySymbol } from "../../common/symbols/symbols.js";
2
- import SchemaRegistry from "../../decorators/SchemaRegistry.js";
3
2
  import type EntityType from "../../entity-query/EntityType.js";
4
3
 
5
4
  export default class IdentityService {
@@ -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
- private changeSet: ChangeSet,
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
- identifier?: Identifier;
20
- parameter?: ParameterExpression;
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, identifier, chain } = propertyChain;
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
- const copy = {} as any;
151
- for (const key in expression) {
152
- if (Object.hasOwn(expression, key)) {
153
- const element = expression[key];
154
- if (key === "type" || key === "is") {
155
- continue;
156
- }
157
- if (element instanceof Constant) {
158
- constants.push(element);
159
- }
160
- copy[key] = element;
161
- }
162
- }
163
- Object.setPrototypeOf(copy, Object.getPrototypeOf(expression));
164
- return copy;
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
 
@@ -80,6 +80,7 @@ export default abstract class Visitor<T = any> {
80
80
  case "NegateExpression":
81
81
  return this.visitNegateExpression(e);
82
82
  }
83
+ // @ts-expect-error unused
83
84
  const c: never = e;
84
85
  throw new Error(`${e1.type} Not implemented`);
85
86
  }
@@ -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 DebugStringVisitor from "../ast/DebugStringVisitor.js";
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
- private select: SelectStatement,
27
- private filter: boolean
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
 
@@ -1,4 +1,3 @@
1
- import * as bp from "@babel/parser";
2
1
  import * as bpe from "@babel/types";
3
2
 
4
3
  export abstract class BabelVisitor<T> {
@@ -1,5 +1,4 @@
1
1
  import * as bpe from "@babel/types";
2
- import { BabelVisitor } from "./BabelVisitor.js";
3
2
  import { NotSupportedError } from "./NotSupportedError.js";
4
3
  import TransformVisitor from "./TransformVisitor.js";
5
4
 
package/src/sql/ISql.ts CHANGED
@@ -8,10 +8,6 @@ interface IGeometry {
8
8
  srid: number;
9
9
  }
10
10
 
11
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
12
- interface IGeography extends IGeometry {
13
- }
14
-
15
11
  export interface ISql {
16
12
 
17
13
  in<T>(a: T, array: T[]): boolean;
@@ -1,6 +1,6 @@
1
- function isEmpty(n: number): boolean {
2
- return n === undefined || n === null || n === 0 || isNaN(n);
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
- // tslint:disable-next-line: one-variable-per-declaration
56
- let d: number, h: number, m: number, s: number, ms: number;
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, randomUUID } from "crypto";
2
+ import { randomBytes } from "crypto";
3
3
  import EntityAccessError from "../common/EntityAccessError.js";
4
4
  import { IClassOf } from "../decorators/IClassOf.js";
5
- import Inject, { RegisterSingleton, ServiceProvider, injectServiceKeysSymbol } from "../di/di.js";
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 l = iterator;
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({}, (x, p) => x.eta)
265
- .thenBy({}, (x, p) => x.priority)
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
@@ -15,6 +15,7 @@
15
15
  "skipLibCheck": true,
16
16
  "experimentalDecorators": true,
17
17
  "emitDecoratorMetadata": true,
18
+ "noUnusedLocals": true,
18
19
  "lib": [
19
20
  "ES2022",
20
21
  "ESNext.Disposable",
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=TestRunner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestRunner.d.ts","sourceRoot":"","sources":["../src/TestRunner.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=TestRunner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestRunner.js","sourceRoot":"","sources":["../src/TestRunner.ts"],"names":[],"mappings":""}
package/src/TestRunner.ts DELETED
@@ -1,2 +0,0 @@
1
- import { readdir } from "fs/promises";
2
- import PostgreSqlDriver from "./drivers/postgres/PostgreSqlDriver.js";