@contember/engine-content-api 1.1.0-beta.3 → 1.2.0-alpha.1
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/input-validation/preValidation/InputPreValidator.js +1 -1
- package/dist/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
- package/dist/src/mapper/select/ConditionBuilder.d.ts.map +1 -1
- package/dist/src/mapper/select/ConditionBuilder.js +5 -4
- package/dist/src/mapper/select/ConditionBuilder.js.map +1 -1
- package/dist/src/schema/CustomTypesProvider.js +1 -1
- package/dist/src/schema/CustomTypesProvider.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/input-validation/preValidation/InputPreValidator.ts +2 -2
- package/src/mapper/select/ConditionBuilder.ts +7 -4
- package/src/schema/CustomTypesProvider.ts +1 -1
- package/jasmine.json +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contember/engine-content-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-alpha.1",
|
|
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.
|
|
14
|
-
"@contember/dic": "^1.
|
|
15
|
-
"@contember/engine-common": "^1.
|
|
16
|
-
"@contember/graphql-utils": "^1.
|
|
17
|
-
"@contember/schema": "^1.
|
|
18
|
-
"@contember/schema-utils": "^1.
|
|
13
|
+
"@contember/database": "^1.2.0-alpha.1",
|
|
14
|
+
"@contember/dic": "^1.2.0-alpha.1",
|
|
15
|
+
"@contember/engine-common": "^1.2.0-alpha.1",
|
|
16
|
+
"@contember/graphql-utils": "^1.2.0-alpha.1",
|
|
17
|
+
"@contember/schema": "^1.2.0-alpha.1",
|
|
18
|
+
"@contember/schema-utils": "^1.2.0-alpha.1",
|
|
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.
|
|
24
|
-
"@contember/engine-api-tester": "^1.
|
|
25
|
-
"@contember/schema-definition": "^1.
|
|
23
|
+
"@contember/database-tester": "^1.2.0-alpha.1",
|
|
24
|
+
"@contember/engine-api-tester": "^1.2.0-alpha.1",
|
|
25
|
+
"@contember/schema-definition": "^1.2.0-alpha.1",
|
|
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
|
|
14
|
-
|
|
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 (
|
|
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[
|
|
59
|
+
return handler[entries[0][0]](builder, entries[0][1])
|
|
57
60
|
}
|
|
58
61
|
}
|
|
@@ -2,7 +2,7 @@ import { GraphQLScalarType, Kind } from 'graphql'
|
|
|
2
2
|
import { JSONType } from '@contember/graphql-utils'
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
const uuidPattern = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[
|
|
5
|
+
const uuidPattern = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i
|
|
6
6
|
/** dashes are optional */
|
|
7
7
|
const isUuid = (value: string): boolean => {
|
|
8
8
|
return (
|