@contember/engine-content-api 2.1.0-alpha.26 → 2.1.0-alpha.27
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/development/src/mapper/select/ConditionBuilder.cjs +6 -2
- package/dist/development/src/mapper/select/ConditionBuilder.cjs.map +1 -1
- package/dist/development/src/mapper/select/ConditionBuilder.js +7 -3
- package/dist/development/src/mapper/select/ConditionBuilder.js.map +1 -1
- package/dist/development/src/schema/ConditionTypeProvider.cjs +2 -0
- package/dist/development/src/schema/ConditionTypeProvider.cjs.map +1 -1
- package/dist/development/src/schema/ConditionTypeProvider.js +2 -0
- package/dist/development/src/schema/ConditionTypeProvider.js.map +1 -1
- package/dist/production/src/mapper/select/ConditionBuilder.cjs +6 -2
- package/dist/production/src/mapper/select/ConditionBuilder.cjs.map +1 -1
- package/dist/production/src/mapper/select/ConditionBuilder.js +7 -3
- package/dist/production/src/mapper/select/ConditionBuilder.js.map +1 -1
- package/dist/production/src/schema/ConditionTypeProvider.cjs +2 -0
- package/dist/production/src/schema/ConditionTypeProvider.cjs.map +1 -1
- package/dist/production/src/schema/ConditionTypeProvider.js +2 -0
- package/dist/production/src/schema/ConditionTypeProvider.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/dist/types/mapper/select/ConditionBuilder.d.ts.map +1 -1
- package/dist/types/schema/ConditionTypeProvider.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/mapper/select/ConditionBuilder.ts +10 -4
- package/src/schema/ConditionTypeProvider.ts +3 -0
- package/tests/cases/integration/graphQlSchema/schema-column-types.gql +1 -0
package/package.json
CHANGED
|
@@ -50,11 +50,17 @@ export class ConditionBuilder {
|
|
|
50
50
|
gte: (builder, value) => builder.compare(columnIdentifier, Operator.gte, value),
|
|
51
51
|
|
|
52
52
|
includes: (builder, value) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
if (columnType.type === Model.ColumnType.Json) {
|
|
54
|
+
// For JSON columns, use @> operator to check if JSON contains the value
|
|
55
|
+
return builder.raw(`${formatColumnIdentifier(columnIdentifier)} @> ?::jsonb`, JSON.stringify(value))
|
|
56
|
+
} else {
|
|
57
|
+
// For array columns, use @> operator with array casting
|
|
58
|
+
const cast = columnType.type === Model.ColumnType.Enum
|
|
59
|
+
? `${Compiler.SCHEMA_PLACEHOLDER}."${columnType.columnType}"`
|
|
60
|
+
: columnType.columnType
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
return builder.raw(`${formatColumnIdentifier(columnIdentifier)} @> ARRAY[?]::${cast}[]`, value)
|
|
63
|
+
}
|
|
58
64
|
},
|
|
59
65
|
maxLength: (builder, value) => builder.raw(`array_length(${formatColumnIdentifier(columnIdentifier)}, 1) <= ?`, value),
|
|
60
66
|
minLength: (builder, value) => builder.raw(`array_length(${formatColumnIdentifier(columnIdentifier)}, 1) >= ?`, value),
|
|
@@ -60,6 +60,9 @@ export class ConditionTypeProvider {
|
|
|
60
60
|
conditions.lte = { type: type }
|
|
61
61
|
conditions.gt = { type: type }
|
|
62
62
|
conditions.gte = { type: type }
|
|
63
|
+
} else {
|
|
64
|
+
// For JSON columns, add the includes operator
|
|
65
|
+
conditions.includes = { type: type }
|
|
63
66
|
}
|
|
64
67
|
if (column.type === Model.ColumnType.String) {
|
|
65
68
|
conditions.contains = { type: GraphQLString }
|