Add native literal substring query predicates
Implement checked containsInsensitive string predicates in GraphQL, protobuf, native SQL and bounded residual evaluation. ASCII folding is deterministic; SQL pattern characters remain literal. Retain deferred full-text index design. Studio migration awaits a decision on checked native getter forwarding across conformances; do not duplicate titles or bypass private state ownership. Compiler and local full-stack substring-query acceptance pass.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -53,7 +53,7 @@ const pairs = (node: ValueNode): readonly import("graphql").ObjectFieldNode[] =>
|
||||
node.kind === "ObjectValue"
|
||||
? node.fields
|
||||
: fail("QUERY_UNSUPPORTED_FEATURE", "Query structure must be a literal object", node);
|
||||
const ops = new Set(["eq", "in", "isNull", "lt", "lte", "gt", "gte"]);
|
||||
const ops = new Set(["eq", "containsInsensitive", "in", "isNull", "lt", "lte", "gt", "gte"]);
|
||||
const prefix = (a: readonly string[], b: readonly string[]) => a.every((part, i) => part === b[i]);
|
||||
|
||||
export function relationalCompiler(
|
||||
|
||||
@@ -66,6 +66,7 @@ export function relationalWire(
|
||||
value: argument(p.value),
|
||||
operator: {
|
||||
eq: wire.QueryComparisonOperator.EQ,
|
||||
containsInsensitive: wire.QueryComparisonOperator.CONTAINS_INSENSITIVE,
|
||||
in: wire.QueryComparisonOperator.IN,
|
||||
isNull: wire.QueryComparisonOperator.IS_NULL,
|
||||
lt: wire.QueryComparisonOperator.LT,
|
||||
|
||||
@@ -65,7 +65,7 @@ export type QueryPredicate =
|
||||
| {
|
||||
kind: "compare";
|
||||
expression: QueryExpression;
|
||||
operator: "eq" | "in" | "isNull" | "lt" | "lte" | "gt" | "gte";
|
||||
operator: "eq" | "containsInsensitive" | "in" | "isNull" | "lt" | "lte" | "gt" | "gte";
|
||||
value: QueryArgument;
|
||||
}
|
||||
| {
|
||||
@@ -93,7 +93,7 @@ export type QueryAggregatePredicate =
|
||||
| {
|
||||
kind: "compare";
|
||||
expression: QueryExpression | QueryReduction;
|
||||
operator: "eq" | "in" | "isNull" | "lt" | "lte" | "gt" | "gte";
|
||||
operator: "eq" | "containsInsensitive" | "in" | "isNull" | "lt" | "lte" | "gt" | "gte";
|
||||
value: QueryArgument;
|
||||
};
|
||||
export interface QueryKey {
|
||||
|
||||
@@ -139,6 +139,7 @@ export function querySchema(
|
||||
let result = comparisons.get(key);
|
||||
if (!result) {
|
||||
const fields: GraphQLInputFieldConfigMap = { eq: { type: value }, isNull: { type: GraphQLBoolean } };
|
||||
if (base.kind === "scalar" && base.name === "string") fields.containsInsensitive = { type: value };
|
||||
if (base.kind === "scalar" && base.name !== "bytes")
|
||||
fields.in = { type: new GraphQLList(new GraphQLNonNull(value)) };
|
||||
if (base.kind === "scalar" && base.name !== "bool" && base.name !== "bytes")
|
||||
|
||||
Reference in New Issue
Block a user