@contember/engine-content-api 1.1.0-rc.1 → 1.1.0

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-content-api",
3
- "version": "1.1.0-rc.1",
3
+ "version": "1.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/src/index.js",
6
6
  "typings": "dist/src/index.d.ts",
@@ -10,19 +10,19 @@
10
10
  "test": "vitest --no-threads"
11
11
  },
12
12
  "dependencies": {
13
- "@contember/database": "^1.1.0-rc.1",
14
- "@contember/dic": "^1.1.0-rc.1",
15
- "@contember/engine-common": "^1.1.0-rc.1",
16
- "@contember/graphql-utils": "^1.1.0-rc.1",
17
- "@contember/schema": "^1.1.0-rc.1",
18
- "@contember/schema-utils": "^1.1.0-rc.1",
13
+ "@contember/database": "^1.1.0",
14
+ "@contember/dic": "^1.1.0",
15
+ "@contember/engine-common": "^1.1.0",
16
+ "@contember/graphql-utils": "^1.1.0",
17
+ "@contember/schema": "^1.1.0",
18
+ "@contember/schema-utils": "^1.1.0",
19
19
  "@graphql-tools/schema": "^8.3.5",
20
20
  "graphql-tag": "^2.12.5"
21
21
  },
22
22
  "devDependencies": {
23
- "@contember/database-tester": "^1.1.0-rc.1",
24
- "@contember/engine-api-tester": "^1.1.0-rc.1",
25
- "@contember/schema-definition": "^1.1.0-rc.1",
23
+ "@contember/database-tester": "^1.1.0",
24
+ "@contember/engine-api-tester": "^1.1.0",
25
+ "@contember/schema-definition": "^1.1.0",
26
26
  "@graphql-codegen/cli": "^1.15.2",
27
27
  "@graphql-codegen/typescript": "^1.15.2",
28
28
  "@graphql-codegen/typescript-operations": "^1.15.2",
@@ -105,8 +105,8 @@ export class InputPreValidator {
105
105
  return data[column.name] as Input.ColumnValue | undefined
106
106
  },
107
107
  visitHasOne: (entity, relation) => {
108
- const value = data[relation.name] as Input.CreateOneRelationInput | Input.UpdateOneRelationInput | undefined
109
- if (value === undefined) {
108
+ const value = data[relation.name] as Input.CreateOneRelationInput | Input.UpdateOneRelationInput | undefined | null
109
+ if (value === undefined || value === null) {
110
110
  return undefined
111
111
  }
112
112
  if ('disconnect' in value) {
@@ -10,11 +10,14 @@ export class ConditionBuilder {
10
10
  columnType: string,
11
11
  condition: Input.Condition<any>,
12
12
  ): SqlConditionBuilder {
13
- const keys = Object.keys(condition) as (keyof Required<Input.Condition<any>>)[]
14
- if (keys.length === 0) {
13
+ const entries = Object.entries(condition)
14
+ .filter(<T extends keyof Input.Condition>(it: [string, any]): it is [T, Input.Condition[T]] =>
15
+ it[1] !== null,
16
+ )
17
+ if (entries.length === 0) {
15
18
  return builder
16
19
  }
17
- if (keys.length > 1) {
20
+ if (entries.length > 1) {
18
21
  throw new UserError(
19
22
  'Only single field is allowed. If you want to combine multiple conditions, use "and" or "or". Got: ' +
20
23
  JSON.stringify(condition),
@@ -53,6 +56,6 @@ export class ConditionBuilder {
53
56
  null: (builder, value) => value ? builder.isNull(columnIdentifier) : builder.not(clause => clause.isNull(columnIdentifier)),
54
57
  }
55
58
 
56
- return handler[keys[0]](builder, condition[keys[0]])
59
+ return handler[entries[0][0]](builder, entries[0][1])
57
60
  }
58
61
  }