@contember/engine-system-api 1.0.0-alpha.8 → 1.0.0-rc.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contember/engine-system-api",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0-rc.10",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/src/index.js",
6
6
  "typings": "dist/src/index.d.ts",
@@ -9,23 +9,23 @@
9
9
  "test": "uvu dist/tests/cases/ \\.js$ && uvu migrations \\.test\\.js"
10
10
  },
11
11
  "dependencies": {
12
- "@contember/authorization": "^1.0.0-alpha.8",
13
- "@contember/database": "^1.0.0-alpha.8",
14
- "@contember/database-migrations": "^1.0.0-alpha.8",
15
- "@contember/dic": "^1.0.0-alpha.8",
16
- "@contember/engine-common": "^1.0.0-alpha.8",
17
- "@contember/graphql-utils": "^1.0.0-alpha.8",
18
- "@contember/queryable": "^1.0.0-alpha.8",
19
- "@contember/schema": "^1.0.0-alpha.8",
20
- "@contember/schema-migrations": "^1.0.0-alpha.8",
21
- "@contember/schema-utils": "^1.0.0-alpha.8",
12
+ "@contember/authorization": "^1.0.0-rc.10",
13
+ "@contember/database": "^1.0.0-rc.10",
14
+ "@contember/database-migrations": "^1.0.0-rc.10",
15
+ "@contember/dic": "^1.0.0-rc.10",
16
+ "@contember/engine-common": "^1.0.0-rc.10",
17
+ "@contember/graphql-utils": "^1.0.0-rc.10",
18
+ "@contember/queryable": "^1.0.0-rc.10",
19
+ "@contember/schema": "^1.0.0-rc.10",
20
+ "@contember/schema-migrations": "^1.0.0-rc.10",
21
+ "@contember/schema-utils": "^1.0.0-rc.10",
22
22
  "@graphql-tools/utils": "^7.10.0",
23
23
  "apollo-server-errors": "^2.4.0",
24
24
  "graphql-tag": "^2.12.5"
25
25
  },
26
26
  "devDependencies": {
27
- "@contember/engine-api-tester": "^1.0.0-alpha.8",
28
- "@contember/schema-definition": "^1.0.0-alpha.8",
27
+ "@contember/engine-api-tester": "^1.0.0-rc.10",
28
+ "@contember/schema-definition": "^1.0.0-rc.10",
29
29
  "@graphql-codegen/cli": "^1.15.2",
30
30
  "@graphql-codegen/typescript": "^1.15.2",
31
31
  "@graphql-codegen/typescript-operations": "^1.15.2",
@@ -7,7 +7,7 @@ import { SystemDbMigrationsRunnerFactory } from '../SystemContainer'
7
7
  import {
8
8
  Connection,
9
9
  DatabaseCredentials,
10
- EventManagerImpl,
10
+ EventManager,
11
11
  retryTransaction,
12
12
  SingleConnection,
13
13
  } from '@contember/database'
@@ -36,7 +36,7 @@ export class ProjectInitializer {
36
36
  await createDatabaseIfNotExists(project.db, logger.write.bind(logger))
37
37
  const pgClient = await createPgClient(project.db)
38
38
  await pgClient.connect()
39
- const singleConnection = new SingleConnection(pgClient, {}, new EventManagerImpl(), true)
39
+ const singleConnection = new SingleConnection(pgClient, {}, new EventManager(), true)
40
40
  const dbContextMigrations = databaseContextFactory
41
41
  .withClient(singleConnection.createClient('system', { module: 'system' }))
42
42
  .create(unnamedIdentity)
@@ -1,6 +1,6 @@
1
1
  import { DatabaseContext } from './database'
2
2
  import { ProjectConfig } from '../types'
3
- import { TruncateEventsCommand, TruncateStagesCommand } from './commands'
3
+ import { TruncateEventsCommand } from './commands'
4
4
  import { formatSchemaName, getJunctionTables } from './helpers'
5
5
  import { Schema } from '@contember/schema'
6
6
  import { wrapIdentifier } from '@contember/database'
@@ -9,7 +9,7 @@ export class ProjectTruncateExecutor {
9
9
  public async truncateProject(db: DatabaseContext, project: ProjectConfig, schema: Schema) {
10
10
  await db.transaction(async trx => {
11
11
  await trx.client.query('SET CONSTRAINTS ALL DEFERRED')
12
- const tableNames = Object.values(schema.model.entities).map(it => it.tableName)
12
+ const tableNames = Object.values(schema.model.entities).filter(it => !it.view).map(it => it.tableName)
13
13
  const junctionTableNames = getJunctionTables(schema.model).map(it => it.tableName)
14
14
  const allTableNames = [...tableNames, ...junctionTableNames]
15
15
  for (const stage of project.stages) {
@@ -18,7 +18,6 @@ export class ProjectTruncateExecutor {
18
18
  await trx.client.query(`TRUNCATE ${wrappedNames}`)
19
19
  }
20
20
  await trx.client.query('SET CONSTRAINTS ALL IMMEDIATE')
21
- await trx.commandBus.execute(new TruncateStagesCommand())
22
21
  await trx.commandBus.execute(new TruncateEventsCommand())
23
22
  })
24
23
  }
@@ -14,7 +14,7 @@ export class StagePermissionsFactory {
14
14
  const rolePermissions = this.createRolePermissions(filteredSchema.acl)
15
15
  Object.entries(rolePermissions).forEach(([role, value]) => {
16
16
  // history
17
- if (value.history === Acl.SystemPermissionsLevel.any) {
17
+ if (value.history === Acl.SystemPermissionsLevel.any || value.history === true) {
18
18
  permissions.allow(role, AuthorizationActions.PROJECT_HISTORY_ANY)
19
19
  }
20
20
 
@@ -26,7 +26,7 @@ export class SchemaVersionBuilder {
26
26
  ...this.schemaMigrator.applyModifications(schema, migration.modifications, migration.formatVersion),
27
27
  version: migration.version,
28
28
  }),
29
- after?.notNormalized ?? emptyVersionedSchema,
29
+ after?.notNormalized ?? emptyVersionedSchema.notNormalized,
30
30
  )
31
31
  const normalized = normalizeSchema(schema)
32
32
  return {