@contember/engine-system-api 1.1.2 → 1.1.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.
- package/dist/src/model/queries/events/LatestTransactionIdByStageQuery.d.ts +2 -2
- package/dist/src/model/queries/events/LatestTransactionIdByStageQuery.d.ts.map +1 -1
- package/dist/src/model/queries/events/LatestTransactionIdByStageQuery.js +9 -14
- package/dist/src/model/queries/events/LatestTransactionIdByStageQuery.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/src/model/queries/events/LatestTransactionIdByStageQuery.ts +10 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/engine-system-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"typings": "dist/src/index.d.ts",
|
|
@@ -9,22 +9,22 @@
|
|
|
9
9
|
"test": "vitest"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@contember/authorization": "^1.1.
|
|
13
|
-
"@contember/database": "^1.1.
|
|
14
|
-
"@contember/database-migrations": "^1.1.
|
|
15
|
-
"@contember/dic": "^1.1.
|
|
16
|
-
"@contember/engine-common": "^1.1.
|
|
17
|
-
"@contember/graphql-utils": "^1.1.
|
|
18
|
-
"@contember/queryable": "^1.1.
|
|
19
|
-
"@contember/schema": "^1.1.
|
|
20
|
-
"@contember/schema-migrations": "^1.1.
|
|
21
|
-
"@contember/schema-utils": "^1.1.
|
|
12
|
+
"@contember/authorization": "^1.1.3",
|
|
13
|
+
"@contember/database": "^1.1.3",
|
|
14
|
+
"@contember/database-migrations": "^1.1.3",
|
|
15
|
+
"@contember/dic": "^1.1.3",
|
|
16
|
+
"@contember/engine-common": "^1.1.3",
|
|
17
|
+
"@contember/graphql-utils": "^1.1.3",
|
|
18
|
+
"@contember/queryable": "^1.1.3",
|
|
19
|
+
"@contember/schema": "^1.1.3",
|
|
20
|
+
"@contember/schema-migrations": "^1.1.3",
|
|
21
|
+
"@contember/schema-utils": "^1.1.3",
|
|
22
22
|
"@graphql-tools/utils": "^7.10.0",
|
|
23
23
|
"graphql-tag": "^2.12.5"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@contember/engine-api-tester": "^1.1.
|
|
27
|
-
"@contember/schema-definition": "^1.1.
|
|
26
|
+
"@contember/engine-api-tester": "^1.1.3",
|
|
27
|
+
"@contember/schema-definition": "^1.1.3",
|
|
28
28
|
"@graphql-codegen/cli": "^1.15.2",
|
|
29
29
|
"@graphql-codegen/typescript": "^1.15.2",
|
|
30
30
|
"@graphql-codegen/typescript-operations": "^1.15.2",
|
|
@@ -1,34 +1,20 @@
|
|
|
1
|
-
import { DatabaseQuery, DatabaseQueryable } from '@contember/database'
|
|
1
|
+
import { DatabaseQuery, DatabaseQueryable, SelectBuilder } from '@contember/database'
|
|
2
2
|
import { ImplementationException } from '../../../utils'
|
|
3
3
|
|
|
4
4
|
export class LatestTransactionIdByStageQuery extends DatabaseQuery<string> {
|
|
5
|
-
constructor(private readonly
|
|
5
|
+
constructor(private readonly stageId: string) {
|
|
6
6
|
super()
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
async fetch(queryable: DatabaseQueryable): Promise<string> {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
19
|
-
).rows[0].id
|
|
20
|
-
const rows = (
|
|
21
|
-
await queryable.db.query<{ transaction_id: string }>(
|
|
22
|
-
`
|
|
23
|
-
SELECT transaction_id
|
|
24
|
-
FROM system.stage_transaction
|
|
25
|
-
WHERE stage_id = ?
|
|
26
|
-
ORDER BY applied_at DESC
|
|
27
|
-
LIMIT 1
|
|
28
|
-
`,
|
|
29
|
-
[stageId],
|
|
30
|
-
)
|
|
31
|
-
).rows
|
|
10
|
+
const rows = await SelectBuilder.create<{ transaction_id: string }>()
|
|
11
|
+
.from('stage_transaction')
|
|
12
|
+
.select('transaction_id')
|
|
13
|
+
.where({ stage_id: this.stageId })
|
|
14
|
+
.orderBy('applied_at', 'desc')
|
|
15
|
+
.limit(1)
|
|
16
|
+
.getResult(queryable.db)
|
|
17
|
+
|
|
32
18
|
if (rows.length !== 1) {
|
|
33
19
|
throw new ImplementationException()
|
|
34
20
|
}
|