@cyphra/graphql 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/README.md +37 -2
- package/dist/index.d.ts +339 -0
- package/dist/index.js +4292 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/v7/index.ts","../src/import/convert.ts","../src/import/mappings.ts","../src/import/print.ts","../src/v7/cypher/select.ts","../src/v7/errors.ts","../src/v7/model.ts","../src/v7/naming.ts","../src/v7/cypher/context.ts","../src/v7/cypher/where.ts","../src/v7/cypher/mutate.ts","../src/v7/execute.ts","../src/v7/sdl.ts","../src/v7/scalars.ts","../src/index.ts"],"sourcesContent":["/**\n * `@neo4j/graphql` v7 compatible API: the same generated schema, served on the Cyphra runtime.\n *\n * @packageDocumentation\n */\n\nimport {\n isObjectType,\n type GraphQLFieldResolver,\n type GraphQLResolveInfo,\n type GraphQLSchema,\n} from \"graphql\";\nimport { resolveSchema, type SchemaDocument, type SchemaModel } from \"@cyphra/schema\";\nimport { convertGraphQLTypeDefs, type ImportIssue } from \"../import/index.js\";\nimport { SelectionCompiler } from \"./cypher/select.js\";\nimport { MutationCompiler } from \"./cypher/mutate.js\";\nimport {\n createExecutors,\n type Executors,\n type ExecutorOptions,\n type ReadExecutor,\n type WriteExecutor,\n} from \"./execute.js\";\nimport { readTypeDefs, type V7Model } from \"./model.js\";\nimport { buildV7Schema } from \"./sdl.js\";\n\nexport type MakeSchemaOptions = ExecutorOptions & {\n /** v7 type definitions (`@node`, `@relationship`, …). */\n typeDefs: string;\n};\n\ntype AnyRecord = Record<string, unknown>;\n\n/** Reads values by response key, so aliases (`paged: actorsConnection(...)`) resolve. */\nconst byResponseKey: GraphQLFieldResolver<unknown, unknown> = (source, _args, _ctx, info) =>\n source && typeof source === \"object\" ? (source as AnyRecord)[info.path.key as string] : undefined;\n\nfunction rootReadResolver(\n model: V7Model,\n execute: ReadExecutor,\n nodeName: string,\n kind: \"list\" | \"connection\",\n): GraphQLFieldResolver<unknown, unknown> {\n return async (_source, args, _ctx, info: GraphQLResolveInfo) => {\n const node = model.node(nodeName);\n const compiler = new SelectionCompiler(model, info);\n const compiled =\n kind === \"list\"\n ? compiler.rootList(node, args as AnyRecord, info.fieldNodes)\n : compiler.rootConnection(node, args as AnyRecord, info.fieldNodes);\n return compiled.decode(await execute(compiled.cypher, compiled.params));\n };\n}\n\nfunction rootMutationResolver(\n model: V7Model,\n execute: WriteExecutor,\n nodeName: string,\n kind: \"create\" | \"update\" | \"delete\",\n): GraphQLFieldResolver<unknown, unknown> {\n return async (_source, args, _ctx, info: GraphQLResolveInfo) => {\n const node = model.node(nodeName);\n const compiler = new MutationCompiler(model, info);\n const a = args as AnyRecord;\n const compiled =\n kind === \"create\"\n ? compiler.rootCreate(node, a, info.fieldNodes)\n : kind === \"update\"\n ? compiler.rootUpdate(node, a, info.fieldNodes)\n : compiler.rootDelete(node, a, info.fieldNodes);\n return execute(compiled.cypher, compiled.params, compiled.decode);\n };\n}\n\n/** Attaches resolvers: one Cypher statement (and transaction) per root field. */\nfunction attachResolvers(schema: GraphQLSchema, model: V7Model, executors: Executors): void {\n const execute = executors.read;\n for (const type of Object.values(schema.getTypeMap())) {\n if (!isObjectType(type) || type.name.startsWith(\"__\")) continue;\n if (type === schema.getQueryType() || type === schema.getMutationType()) continue;\n for (const field of Object.values(type.getFields())) field.resolve = byResponseKey;\n }\n const query = schema.getQueryType()!.getFields();\n for (const node of model.nodes) {\n query[node.plural]!.resolve = rootReadResolver(model, execute, node.name, \"list\");\n query[`${node.plural}Connection`]!.resolve = rootReadResolver(\n model,\n execute,\n node.name,\n \"connection\",\n );\n }\n const mutation = schema.getMutationType()!.getFields();\n for (const node of model.nodes) {\n for (const kind of [\"create\", \"update\", \"delete\"] as const) {\n mutation[`${kind}${node.pascalPlural}`]!.resolve = rootMutationResolver(\n model,\n executors.write,\n node.name,\n kind,\n );\n }\n }\n}\n\n/**\n * Build the GraphQL schema `@neo4j/graphql` v7 generates for `typeDefs`, with resolvers that run on\n * Neo4j through `driver` or `client`. Drop-in for `new Neo4jGraphQL({ typeDefs, driver }).getSchema()`.\n *\n * Today: the full v7 schema (SDL identical to v7), the read API (list and connection queries,\n * filters, sorting, offset and cursor pagination, nested relationships and connections with edge\n * properties, connection `aggregate` selections and aggregation filters) and mutations (create,\n * update, delete with every nested operation and `info` counters). Authorization (#74) and\n * `@cypher` fields (#75) are in the schema but answer with a \"Not implemented yet\" error.\n *\n * @example\n * ```ts\n * import { compat } from \"@cyphra/graphql\";\n * const schema = compat.v7.makeSchema({ typeDefs, driver });\n * ```\n */\nexport function makeSchema(options: MakeSchemaOptions): GraphQLSchema {\n const model = readTypeDefs(options.typeDefs);\n const schema = buildV7Schema(model);\n attachResolvers(schema, model, createExecutors(options));\n return schema;\n}\n\n/**\n * The GraphQL `contextValue` for a request. v7 reads the decoded JWT from `context.jwt`; it is\n * accepted for compatibility (authorization itself is #74).\n */\nexport function contextFor(opts: { jwt?: Record<string, unknown> } = {}): Record<string, unknown> {\n return opts.jwt ? { jwt: opts.jwt } : {};\n}\n\n/**\n * The Cyphra schema for the same type definitions (through `convertGraphQLTypeDefs`, the converter\n * behind `cyphra import graphql`): use it with `createOrm` to work on the graph the GraphQL API\n * serves. `issues` lists what Cyphra models differently (e.g. `@cypher` fields are not converted).\n */\nexport function cyphraSchema(typeDefs: string): {\n document: SchemaDocument;\n model: SchemaModel;\n issues: readonly ImportIssue[];\n} {\n const { document, issues } = convertGraphQLTypeDefs([\n { name: \"typeDefs.graphql\", body: typeDefs },\n ]);\n return { document, model: resolveSchema(document), issues };\n}\n\nexport { readTypeDefs, UnsupportedTypeDefsError, type V7Model } from \"./model.js\";\nexport { buildV7Schema } from \"./sdl.js\";\nexport { cursorToOffset, offsetToCursor } from \"./cypher/select.js\";\n","/**\n * Convert `@neo4j/graphql` v7 type definitions (SDL) to a Cyphra {@link SchemaDocument}.\n *\n * Pure: no file system, no printing. Rules for each scalar and directive live in `mappings.ts`;\n * this module walks the SDL, applies them and links relationships.\n *\n * @packageDocumentation\n */\n\nimport {\n GraphQLError,\n Kind,\n parse,\n print,\n type ConstDirectiveNode,\n type DefinitionNode,\n type FieldDefinitionNode,\n type TypeNode,\n} from \"graphql\";\nimport type {\n Decorator,\n NodeDeclaration,\n NodeField,\n RelationshipDeclaration,\n ScalarNodeField,\n SchemaDocument,\n} from \"@cyphra/schema\";\nimport {\n CUSTOM_SCALAR_FIELD,\n ENUM_FIELD,\n FIELD_DIRECTIVES,\n RELATIONSHIP_API_ARGS,\n SCALARS,\n TYPE_DIRECTIVES,\n enumListArg,\n stringArg,\n type ImportIssue,\n type IssueDraft,\n type ScalarMapping,\n} from \"./mappings.js\";\n\n/** One type definitions file. */\nexport type GraphQLSource = { readonly name: string; readonly body: string };\n\nexport type GraphQLImportResult = {\n readonly document: SchemaDocument;\n /** Everything that was not converted or behaves differently, in source order. */\n readonly issues: readonly ImportIssue[];\n /**\n * Comment lines to print inside a declaration (keyed by Cyphra declaration name), one per\n * field that was not converted.\n */\n readonly notes: ReadonlyMap<string, readonly string[]>;\n};\n\n/** The type definitions are not valid GraphQL (syntax error, unknown type, duplicate type). */\nexport class GraphQLImportError extends Error {\n override name = \"GraphQLImportError\";\n}\n\ntype TypeKind = \"object\" | \"interface\" | \"union\" | \"enum\" | \"scalar\" | \"input\";\n\ntype TypeInfo = {\n readonly name: string;\n readonly kind: TypeKind;\n readonly directives: ConstDirectiveNode[];\n readonly fields: FieldDefinitionNode[];\n readonly source: string;\n};\n\ntype Unwrapped = { named: string; list: boolean; nonNull: boolean; nested: boolean };\n\nconst ROOT_TYPES = new Set([\"Query\", \"Mutation\", \"Subscription\"]);\n\nfunction unwrap(t: TypeNode): Unwrapped {\n let nonNull = false;\n let list = false;\n let nested = false;\n let cur = t;\n if (cur.kind === Kind.NON_NULL_TYPE) {\n nonNull = true;\n cur = cur.type;\n }\n if (cur.kind === Kind.LIST_TYPE) {\n list = true;\n cur = cur.type.kind === Kind.NON_NULL_TYPE ? cur.type.type : cur.type;\n if (cur.kind === Kind.LIST_TYPE) nested = true;\n }\n while (cur.kind !== Kind.NAMED_TYPE) cur = cur.type;\n return { named: cur.name.value, list, nonNull, nested };\n}\n\nfunction directive(\n dirs: readonly ConstDirectiveNode[] | undefined,\n name: string,\n): ConstDirectiveNode | undefined {\n return dirs?.find((d) => d.name.value === name);\n}\n\nfunction kindOf(def: DefinitionNode): { kind: TypeKind; extension: boolean } | undefined {\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n return { kind: \"object\", extension: false };\n case Kind.OBJECT_TYPE_EXTENSION:\n return { kind: \"object\", extension: true };\n case Kind.INTERFACE_TYPE_DEFINITION:\n return { kind: \"interface\", extension: false };\n case Kind.INTERFACE_TYPE_EXTENSION:\n return { kind: \"interface\", extension: true };\n case Kind.UNION_TYPE_DEFINITION:\n return { kind: \"union\", extension: false };\n case Kind.UNION_TYPE_EXTENSION:\n return { kind: \"union\", extension: true };\n case Kind.ENUM_TYPE_DEFINITION:\n return { kind: \"enum\", extension: false };\n case Kind.ENUM_TYPE_EXTENSION:\n return { kind: \"enum\", extension: true };\n case Kind.SCALAR_TYPE_DEFINITION:\n return { kind: \"scalar\", extension: false };\n case Kind.SCALAR_TYPE_EXTENSION:\n return { kind: \"scalar\", extension: true };\n case Kind.INPUT_OBJECT_TYPE_DEFINITION:\n return { kind: \"input\", extension: false };\n case Kind.INPUT_OBJECT_TYPE_EXTENSION:\n return { kind: \"input\", extension: true };\n default:\n return undefined;\n }\n}\n\n/** Directives of a type system definition (they are always constant there). */\nfunction directivesOf(def: DefinitionNode): readonly ConstDirectiveNode[] {\n return (\"directives\" in def && (def.directives as readonly ConstDirectiveNode[])) || [];\n}\n\n/** Parse every source and merge `extend type` blocks into their definitions. */\nfunction collectTypes(sources: readonly GraphQLSource[]): Map<string, TypeInfo> {\n const types = new Map<string, TypeInfo>();\n const extensions: { name: string; def: DefinitionNode; source: string }[] = [];\n for (const src of sources) {\n let doc;\n try {\n doc = parse(src.body);\n } catch (err) {\n if (err instanceof GraphQLError) {\n const loc = err.locations?.[0];\n const where = loc ? `${src.name}:${loc.line}:${loc.column}` : src.name;\n throw new GraphQLImportError(`${where}: ${err.message}`);\n }\n throw err;\n }\n for (const def of doc.definitions) {\n const k = kindOf(def);\n if (!k || !(\"name\" in def) || !def.name) continue;\n const name = def.name.value;\n if (k.extension) {\n extensions.push({ name, def, source: src.name });\n continue;\n }\n // Redeclaring a built-in scalar (`scalar DateTime`) is harmless.\n if (k.kind === \"scalar\" && SCALARS[name]) continue;\n if (types.has(name) || SCALARS[name]) {\n throw new GraphQLImportError(`${src.name}: type \"${name}\" is defined more than once.`);\n }\n types.set(name, {\n name,\n kind: k.kind,\n directives: [...directivesOf(def)],\n fields: [\n ...((def.kind === Kind.OBJECT_TYPE_DEFINITION ||\n def.kind === Kind.INTERFACE_TYPE_DEFINITION\n ? def.fields\n : undefined) ?? []),\n ],\n source: src.name,\n });\n }\n }\n for (const ext of extensions) {\n const base = types.get(ext.name);\n if (!base) {\n throw new GraphQLImportError(`${ext.source}: cannot extend unknown type \"${ext.name}\".`);\n }\n const def = ext.def;\n base.directives.push(...directivesOf(def));\n if (\n (def.kind === Kind.OBJECT_TYPE_EXTENSION || def.kind === Kind.INTERFACE_TYPE_EXTENSION) &&\n def.fields\n ) {\n base.fields.push(...def.fields);\n }\n }\n return types;\n}\n\n/** Every field must reference a type that exists (built-in, `@neo4j/graphql` or declared). */\nfunction checkReferences(types: Map<string, TypeInfo>): void {\n for (const t of types.values()) {\n if (t.kind !== \"object\" && t.kind !== \"interface\") continue;\n for (const f of t.fields) {\n const { named } = unwrap(f.type);\n if (!types.has(named) && !SCALARS[named]) {\n throw new GraphQLImportError(\n `${t.source}: field \"${t.name}.${f.name.value}\" has unknown type \"${named}\".`,\n );\n }\n }\n }\n}\n\ntype RelUsage = {\n readonly propsType: string;\n readonly relType: string;\n readonly start: string;\n readonly end: string;\n readonly at: string;\n};\n\n/**\n * Convert type definitions to a Cyphra schema document plus a report of what was not\n * converted. Never throws for unsupported features; only for invalid SDL.\n *\n * @param input - SDL text, or several named sources (merged like one document).\n * @throws {GraphQLImportError} On a syntax error, an unknown type or a duplicate type.\n */\nexport function convertGraphQLTypeDefs(\n input: string | readonly GraphQLSource[],\n): GraphQLImportResult {\n const sources = typeof input === \"string\" ? [{ name: \"typeDefs\", body: input }] : input;\n const types = collectTypes(sources);\n checkReferences(types);\n\n const issues: ImportIssue[] = [];\n const report = (at: string, d: IssueDraft) => issues.push({ at, ...d });\n const notes = new Map<string, string[]>();\n const note = (decl: string, line: string) => {\n const list = notes.get(decl) ?? [];\n list.push(line);\n notes.set(decl, list);\n };\n\n // Pass 1: classify types and pick Cyphra node names.\n const nodeTypes: TypeInfo[] = [];\n const propsTypes = new Map<string, TypeInfo>();\n const nodeName = new Map<string, string>();\n for (const t of types.values()) {\n if (t.kind === \"object\" && directive(t.directives, \"node\")) {\n nodeTypes.push(t);\n continue;\n }\n if (t.kind === \"object\" && directive(t.directives, \"relationshipProperties\")) {\n propsTypes.set(t.name, t);\n continue;\n }\n switch (t.kind) {\n case \"enum\":\n if (\"unsupported\" in ENUM_FIELD) {\n report(t.name, {\n severity: \"unsupported\",\n feature: \"enum\",\n message: ENUM_FIELD.unsupported,\n });\n } else if (ENUM_FIELD.note) {\n report(t.name, { severity: \"changed\", feature: \"enum\", message: ENUM_FIELD.note });\n }\n break;\n case \"interface\":\n report(t.name, {\n severity: \"unsupported\",\n feature: \"interface\",\n message:\n \"interfaces are not supported by Cyphra yet: implementing @node types are converted with their own fields; relationships to the interface are not\",\n });\n break;\n case \"union\":\n report(t.name, {\n severity: \"unsupported\",\n feature: \"union\",\n message:\n \"unions are not supported by Cyphra yet: relationships to the union are not converted\",\n });\n break;\n case \"scalar\":\n report(t.name, {\n severity: \"unsupported\",\n feature: \"scalar\",\n message:\n \"custom scalars are not supported by Cyphra: fields of this type are not converted\",\n });\n break;\n case \"input\":\n report(t.name, {\n severity: \"ignored\",\n feature: \"input\",\n message: \"input types are part of the GraphQL API, not the data model\",\n });\n break;\n case \"object\":\n if (ROOT_TYPES.has(t.name)) {\n report(t.name, {\n severity: \"unsupported\",\n feature: t.name,\n message: `custom ${t.name} fields (@cypher, resolvers) are not converted: write them as Cyphra queries`,\n });\n } else if (directive(t.directives, \"jwt\")) {\n report(t.name, {\n severity: \"ignored\",\n feature: \"@jwt\",\n message: \"JWT payload type, used by authorization rules only\",\n });\n } else {\n report(t.name, {\n severity: \"unsupported\",\n feature: \"@node\",\n message:\n \"object type without @node is not a node in v7 (e.g. a @cypher result type): not converted\",\n });\n }\n break;\n }\n }\n\n const usedNames = new Set<string>(types.keys());\n for (const t of nodeTypes) {\n let name = t.name;\n for (const d of t.directives) {\n const n = d.name.value;\n if (n === \"relationshipProperties\") {\n report(t.name, {\n severity: \"unsupported\",\n feature: \"@relationshipProperties\",\n message: \"a type cannot be both @node and @relationshipProperties: kept as a node\",\n });\n continue;\n }\n const rule = TYPE_DIRECTIVES[n];\n if (!rule) {\n report(t.name, {\n severity: \"unsupported\",\n feature: `@${n}`,\n message: `unknown directive @${n}: not converted`,\n });\n continue;\n }\n const effect = rule(d, t.name);\n for (const i of effect.issues ?? []) report(t.name, i);\n if (effect.rename && effect.rename !== name) {\n if (usedNames.has(effect.rename) || [...nodeName.values()].includes(effect.rename)) {\n report(t.name, {\n severity: \"unsupported\",\n feature: \"@node(labels)\",\n message: `cannot rename to \"${effect.rename}\": the name is taken; kept \"${t.name}\"`,\n });\n } else {\n name = effect.rename;\n }\n }\n }\n nodeName.set(t.name, name);\n }\n\n // Pass 2: fields.\n const usages: RelUsage[] = [];\n const declarations: NodeDeclaration[] = [];\n for (const t of nodeTypes) {\n const declName = nodeName.get(t.name)!;\n const fields: NodeField[] = [];\n let hasId = false;\n for (const f of t.fields) {\n const at = `${t.name}.${f.name.value}`;\n const u = unwrap(f.type);\n const target = types.get(u.named);\n const isRelation =\n Boolean(directive(f.directives, \"relationship\")) ||\n (target !== undefined &&\n (target.kind === \"object\" || target.kind === \"interface\" || target.kind === \"union\"));\n if (dropComputed(f, at, report)) {\n note(declName, skippedLine(f, \"computed field\"));\n continue;\n }\n if (isRelation) {\n const rel = convertRelation(f, u, at, t.name, types, nodeName, report);\n if (!rel) {\n note(declName, skippedLine(f, \"relationship not converted\"));\n continue;\n }\n fields.push(rel.field);\n if (rel.usage) usages.push(rel.usage);\n continue;\n }\n const scalar = convertScalar(f, u, at, \"node\", hasId, types, report);\n if (!scalar) {\n note(declName, skippedLine(f, \"type not supported\"));\n continue;\n }\n if (scalar.takesId) hasId = true;\n fields.push(scalar.field);\n }\n declarations.push({\n kind: \"Node\",\n name: declName,\n fields: dedupeNames(fields, t.name, report),\n });\n }\n\n // Relationship models: one per (props type, relType, start, end).\n const relationships: RelationshipDeclaration[] = [];\n const takenTriples = new Map<string, string>();\n const allNames = new Set<string>(declarations.map((d) => d.name));\n for (const props of propsTypes.values()) {\n const triples: RelUsage[] = [];\n for (const u of usages.filter((x) => x.propsType === props.name)) {\n const key = `${u.relType}|${u.start}|${u.end}`;\n const owner = takenTriples.get(key);\n if (owner && owner !== props.name) {\n report(u.at, {\n severity: \"unsupported\",\n feature: \"@relationship(properties)\",\n message: `${u.relType} from ${u.start} to ${u.end} already has properties \"${owner}\": \"${props.name}\" not attached`,\n });\n continue;\n }\n if (!owner) {\n takenTriples.set(key, props.name);\n triples.push(u);\n }\n }\n if (triples.length === 0) {\n report(props.name, {\n severity: \"ignored\",\n feature: \"@relationshipProperties\",\n message: \"not used by any converted @relationship: not converted\",\n });\n continue;\n }\n const scalarFields: ScalarNodeField[] = [];\n const propNotes: string[] = [];\n for (const f of props.fields) {\n const at = `${props.name}.${f.name.value}`;\n if (dropComputed(f, at, report)) {\n propNotes.push(skippedLine(f, \"computed field\"));\n continue;\n }\n const u = unwrap(f.type);\n const target = types.get(u.named);\n if (\n directive(f.directives, \"relationship\") ||\n (target &&\n (target.kind === \"object\" || target.kind === \"interface\" || target.kind === \"union\"))\n ) {\n report(at, {\n severity: \"unsupported\",\n feature: \"relationship properties\",\n message: \"relationship properties can only be scalars: not converted\",\n });\n propNotes.push(skippedLine(f, \"not a scalar\"));\n continue;\n }\n const scalar = convertScalar(f, u, at, \"relationship\", false, types, report);\n if (!scalar) {\n propNotes.push(skippedLine(f, \"type not supported\"));\n continue;\n }\n scalarFields.push(scalar.field);\n }\n const unique = dedupeNames(scalarFields, props.name, report) as ScalarNodeField[];\n for (const u of triples) {\n let name = props.name;\n if (triples.length > 1) {\n name = `${props.name}${u.start}${u.end}`;\n report(props.name, {\n severity: \"changed\",\n feature: \"@relationshipProperties\",\n message: `used by several node pairs: written as relationship \"${name}\" for ${u.relType} from ${u.start} to ${u.end}`,\n });\n }\n let n = 2;\n const base = name;\n while (allNames.has(name)) name = `${base}${n++}`;\n allNames.add(name);\n relationships.push({\n kind: \"Relationship\",\n name,\n relType: u.relType,\n from: u.start,\n to: u.end,\n fields: unique,\n });\n if (propNotes.length) notes.set(name, [...propNotes]);\n }\n }\n\n return {\n document: { kind: \"Document\", declarations: [...declarations, ...relationships] },\n issues,\n notes,\n };\n}\n\nfunction skippedLine(f: FieldDefinitionNode, why: string): string {\n return `${f.name.value}: ${print(f.type)} (not converted: ${why})`;\n}\n\n/** Drop `@cypher` / `@customResolver` fields; returns `true` when the field was dropped. */\nfunction dropComputed(\n f: FieldDefinitionNode,\n at: string,\n report: (at: string, d: IssueDraft) => void,\n): boolean {\n for (const d of f.directives ?? []) {\n const rule = FIELD_DIRECTIVES[d.name.value];\n if (rule?.kind === \"drop\") {\n report(at, { severity: \"unsupported\", feature: `@${d.name.value}`, message: rule.message });\n return true;\n }\n }\n return false;\n}\n\n/** Remove fields whose (possibly renamed) name repeats an earlier one. */\nfunction dedupeNames(\n fields: NodeField[],\n typeName: string,\n report: (at: string, d: IssueDraft) => void,\n): NodeField[] {\n const seen = new Set<string>();\n const out: NodeField[] = [];\n for (const f of fields) {\n if (seen.has(f.name)) {\n report(`${typeName}.${f.name}`, {\n severity: \"unsupported\",\n feature: \"field name\",\n message: `two fields map to the property \"${f.name}\": kept the first`,\n });\n continue;\n }\n seen.add(f.name);\n out.push(f);\n }\n return out;\n}\n\nfunction scalarMapping(\n named: string,\n types: Map<string, TypeInfo>,\n): ScalarMapping & { isEnum?: boolean } {\n const builtin = SCALARS[named];\n if (builtin) return builtin;\n const t = types.get(named);\n if (t?.kind === \"enum\") return { ...ENUM_FIELD, isEnum: true };\n return CUSTOM_SCALAR_FIELD;\n}\n\nconst DECORATOR_ORDER = [\"id\", \"unique\", \"index\", \"default\"];\n\nfunction convertScalar(\n f: FieldDefinitionNode,\n u: Unwrapped,\n at: string,\n owner: \"node\" | \"relationship\",\n nodeHasId: boolean,\n types: Map<string, TypeInfo>,\n report: (at: string, d: IssueDraft) => void,\n): { field: ScalarNodeField; takesId: boolean } | undefined {\n if (u.nested) {\n report(at, {\n severity: \"unsupported\",\n feature: \"nested list\",\n message: \"lists of lists are not supported: not converted\",\n });\n return undefined;\n }\n const mapping = scalarMapping(u.named, types);\n if (\"unsupported\" in mapping) {\n report(at, {\n severity: \"unsupported\",\n feature: u.named,\n message: `${mapping.unsupported}: not converted`,\n });\n return undefined;\n }\n let name = f.name.value;\n let optional = !u.nonNull;\n let takesId = false;\n const decorators: Decorator[] = [];\n for (const d of f.directives ?? []) {\n const n = d.name.value;\n if (n === \"relationship\") continue; // only reaches here on a scalar target: reported below\n const rule = FIELD_DIRECTIVES[n];\n if (!rule) {\n report(at, {\n severity: \"unsupported\",\n feature: `@${n}`,\n message: `unknown directive @${n}: not converted`,\n });\n continue;\n }\n if (rule.kind === \"report\") {\n report(at, { severity: rule.severity, feature: `@${n}`, message: rule.message });\n continue;\n }\n if (rule.kind !== \"scalar\") continue;\n const effect = rule.apply(d, {\n owner,\n graphqlType: u.named,\n type: mapping.type,\n list: u.list,\n isEnum: Boolean(mapping.isEnum),\n nodeHasId: nodeHasId || takesId,\n });\n for (const i of effect.issues ?? []) report(at, i);\n for (const dec of effect.decorators ?? []) {\n if (decorators.some((x) => x.name === dec.name)) {\n report(at, {\n severity: \"unsupported\",\n feature: `@${n}`,\n message: `conflicts with another directive setting @${dec.name}: kept the first`,\n });\n continue;\n }\n decorators.push(dec);\n }\n if (effect.rename) name = effect.rename;\n if (effect.required !== undefined) optional = !effect.required;\n if (effect.takesId) takesId = true;\n }\n decorators.sort((a, b) => DECORATOR_ORDER.indexOf(a.name) - DECORATOR_ORDER.indexOf(b.name));\n return {\n field: {\n kind: \"Scalar\",\n name,\n type: u.list\n ? { name: mapping.type, optional: false, list: true }\n : { name: mapping.type, optional },\n decorators,\n },\n takesId,\n };\n}\n\nfunction convertRelation(\n f: FieldDefinitionNode,\n u: Unwrapped,\n at: string,\n ownerType: string,\n types: Map<string, TypeInfo>,\n nodeName: Map<string, string>,\n report: (at: string, d: IssueDraft) => void,\n): { field: NodeField; usage?: RelUsage } | undefined {\n const rel = directive(f.directives, \"relationship\");\n const target = types.get(u.named);\n if (!rel) {\n report(at, {\n severity: \"unsupported\",\n feature: \"@relationship\",\n message: \"object field without @relationship (or @cypher): not converted\",\n });\n return undefined;\n }\n if (!target || target.kind !== \"object\" || !nodeName.has(u.named)) {\n const what = target?.kind === \"interface\" || target?.kind === \"union\" ? target.kind : \"type\";\n report(at, {\n severity: \"unsupported\",\n feature: \"@relationship\",\n message: `relationships to ${what === \"type\" ? `\"${u.named}\" (not a @node type)` : `an ${what}`} are not supported yet: not converted`,\n });\n return undefined;\n }\n if (u.nested) {\n report(at, {\n severity: \"unsupported\",\n feature: \"nested list\",\n message: \"lists of lists are not supported: not converted\",\n });\n return undefined;\n }\n const relType = stringArg(rel, \"type\");\n const direction = enumListArg(rel, \"direction\")?.[0];\n if (!relType || (direction !== \"IN\" && direction !== \"OUT\")) {\n report(at, {\n severity: \"unsupported\",\n feature: \"@relationship\",\n message: \"@relationship needs type and direction: IN | OUT; not converted\",\n });\n return undefined;\n }\n const queryDirection = enumListArg(rel, \"queryDirection\")?.[0];\n if (queryDirection && queryDirection !== \"DIRECTED\") {\n report(at, {\n severity: \"changed\",\n feature: \"@relationship(queryDirection)\",\n message: `queryDirection ${queryDirection} is not supported: Cyphra follows direction ${direction}`,\n });\n }\n for (const a of RELATIONSHIP_API_ARGS) {\n if (rel.arguments?.some((x) => x.name.value === a)) {\n report(at, {\n severity: \"ignored\",\n feature: `@relationship(${a})`,\n message: \"API setting of @neo4j/graphql, no effect on the data model\",\n });\n }\n }\n for (const d of f.directives ?? []) {\n const n = d.name.value;\n if (n === \"relationship\") continue;\n const rule = FIELD_DIRECTIVES[n];\n if (rule?.kind === \"report\") {\n report(at, { severity: rule.severity, feature: `@${n}`, message: rule.message });\n } else {\n report(at, {\n severity: \"unsupported\",\n feature: `@${n}`,\n message: `@${n} is not supported on relationship fields: not converted`,\n });\n }\n }\n const self = nodeName.get(ownerType)!;\n const other = nodeName.get(u.named)!;\n const field: NodeField = {\n kind: \"Relational\",\n name: f.name.value,\n target: other,\n cardinality: u.list ? \"many\" : \"one\",\n optional: u.list ? false : !u.nonNull,\n decorators: [\n {\n name: \"relationship\",\n args: [\n { key: \"type\", value: { kind: \"string\", value: relType } },\n { key: \"direction\", value: { kind: \"identifier\", value: direction } },\n ],\n },\n ],\n };\n const propsType = stringArg(rel, \"properties\");\n if (!propsType) return { field };\n const props = types.get(propsType);\n if (!props || !directive(props.directives, \"relationshipProperties\")) {\n report(at, {\n severity: \"unsupported\",\n feature: \"@relationship(properties)\",\n message: `\"${propsType}\" is not a @relationshipProperties type: properties not converted`,\n });\n return { field };\n }\n const [start, end] = direction === \"OUT\" ? [self, other] : [other, self];\n return { field, usage: { propsType, relType, start, end, at } };\n}\n","/**\n * The mapping from `@neo4j/graphql` v7 type definitions to Cyphra, in one place.\n *\n * Each GraphQL scalar, type-level directive and field-level directive has one entry here. When\n * Cyphra gains a feature (enums, `BigInt`, `Point`, …), supporting it in the importer means\n * changing that entry: the converter in `convert.ts` only walks the SDL and applies these rules.\n *\n * Semantics follow `@neo4j/graphql` 7.x (checked against 7.6.8):\n * - only object types with `@node` are nodes; `@node(labels)` sets the Neo4j labels;\n * - `@id` takes no arguments, is only valid on `ID` fields, autogenerates a UUID and does not\n * create a uniqueness constraint;\n * - `@unique` no longer exists (removed in v7);\n * - `@timestamp(operations)` defaults to `[CREATE, UPDATE]`;\n * - `@relationship(type, direction)` requires both; `properties` names a `@relationshipProperties`\n * object type.\n *\n * @packageDocumentation\n */\n\nimport type { ConstDirectiveNode, ConstValueNode } from \"graphql\";\nimport { Kind } from \"graphql\";\nimport type { Decorator, ScalarTypeName } from \"@cyphra/schema\";\n\n/** How serious a report entry is. */\nexport type ImportSeverity =\n /** Not converted: the type, field or directive is missing from the Cyphra schema. */\n | \"unsupported\"\n /** Converted, but it behaves differently in Cyphra: review it. */\n | \"changed\"\n /** API-level setting of `@neo4j/graphql` with no effect on the data model. */\n | \"ignored\";\n\n/** One line of the import report. */\nexport type ImportIssue = {\n readonly severity: ImportSeverity;\n /** GraphQL location: `Type` or `Type.field`. */\n readonly at: string;\n /** What it is about, e.g. `@cypher`, `Duration`, `enum`. */\n readonly feature: string;\n readonly message: string;\n};\n\n/** An issue before its location is attached. */\nexport type IssueDraft = Omit<ImportIssue, \"at\">;\n\n// ---------------------------------------------------------------------------------------------\n// Scalars\n// ---------------------------------------------------------------------------------------------\n\n/** What a GraphQL scalar (or enum) becomes. */\nexport type ScalarMapping =\n { readonly type: ScalarTypeName; readonly note?: string } | { readonly unsupported: string };\n\nconst NOT_YET = \"is not supported by Cyphra yet\";\n\n/** Built-in GraphQL scalars and the scalars and types `@neo4j/graphql` v7 adds. */\nexport const SCALARS: Readonly<Record<string, ScalarMapping>> = {\n ID: { type: \"String\" },\n String: { type: \"String\" },\n Int: { type: \"Int\" },\n Float: { type: \"Float\" },\n Boolean: { type: \"Boolean\" },\n DateTime: { type: \"DateTime\" },\n Date: { type: \"Date\" },\n BigInt: { unsupported: `BigInt ${NOT_YET}` },\n Time: { unsupported: `Time ${NOT_YET}` },\n LocalTime: { unsupported: `LocalTime ${NOT_YET}` },\n LocalDateTime: { unsupported: `LocalDateTime ${NOT_YET}` },\n Duration: { unsupported: `Duration ${NOT_YET}` },\n Point: { unsupported: `Point ${NOT_YET}` },\n CartesianPoint: { unsupported: `CartesianPoint ${NOT_YET}` },\n};\n\n/** Fields typed with a GraphQL enum. */\nexport const ENUM_FIELD: ScalarMapping = {\n type: \"String\",\n note: \"enums are not supported by Cyphra yet: mapped to String, allowed values are not enforced\",\n};\n\n/** Fields typed with a user-declared `scalar X`. */\nexport const CUSTOM_SCALAR_FIELD: ScalarMapping = {\n unsupported: \"custom scalars are not supported by Cyphra\",\n};\n\n// ---------------------------------------------------------------------------------------------\n// Decorator helpers\n// ---------------------------------------------------------------------------------------------\n\nexport const ID: Decorator = { name: \"id\", args: [] };\nexport const UNIQUE: Decorator = { name: \"unique\", args: [] };\n\nexport function defaultFn(fn: \"uuid\" | \"now\" | \"cuid\"): Decorator {\n return { name: \"default\", args: [{ key: \"fn\", value: { kind: \"identifier\", value: fn } }] };\n}\n\nexport function defaultLiteral(value: string | number | boolean): Decorator {\n const v =\n typeof value === \"string\"\n ? ({ kind: \"string\", value } as const)\n : typeof value === \"number\"\n ? ({ kind: \"number\", value } as const)\n : ({ kind: \"boolean\", value } as const);\n return { name: \"default\", args: [{ key: \"value\", value: v }] };\n}\n\n/** A directive argument, if present. */\nexport function arg(d: ConstDirectiveNode, name: string): ConstValueNode | undefined {\n return d.arguments?.find((a) => a.name.value === name)?.value;\n}\n\n/** A string argument, or `undefined` when absent or not a string. */\nexport function stringArg(d: ConstDirectiveNode, name: string): string | undefined {\n const v = arg(d, name);\n return v?.kind === Kind.STRING ? v.value : undefined;\n}\n\n/** A list-of-enums (or single enum) argument as strings. */\nexport function enumListArg(d: ConstDirectiveNode, name: string): string[] | undefined {\n const v = arg(d, name);\n if (!v) return undefined;\n const items = v.kind === Kind.LIST ? v.values : [v];\n return items.flatMap((i) => (i.kind === Kind.ENUM || i.kind === Kind.STRING ? [i.value] : []));\n}\n\n// ---------------------------------------------------------------------------------------------\n// Field directives\n// ---------------------------------------------------------------------------------------------\n\n/** What the converter knows about a scalar field when it applies a field directive. */\nexport type FieldContext = {\n /** Whether the field belongs to a node or to a `@relationshipProperties` type. */\n readonly owner: \"node\" | \"relationship\";\n /** GraphQL name of the field's named type (`ID`, `String`, an enum name, …). */\n readonly graphqlType: string;\n /** Cyphra scalar the field maps to. */\n readonly type: ScalarTypeName;\n readonly list: boolean;\n /** `true` when the field is a GraphQL enum mapped to `String`. */\n readonly isEnum: boolean;\n /** `true` once another field of the same node took `@id`. */\n readonly nodeHasId: boolean;\n};\n\n/** What a field directive does to the Cyphra field. */\nexport type FieldEffect = {\n readonly decorators?: readonly Decorator[];\n /** Rename the Cyphra field (e.g. `@alias`: the Neo4j property name). */\n readonly rename?: string;\n /** Force the field required (`true`) or optional (`false`). */\n readonly required?: boolean;\n /** This field took the node's `@id`. */\n readonly takesId?: boolean;\n readonly issues?: readonly IssueDraft[];\n};\n\n/** Field directive handler; `drop` handlers remove the whole field (computed fields). */\nexport type FieldDirectiveRule =\n | {\n readonly kind: \"scalar\";\n readonly apply: (d: ConstDirectiveNode, ctx: FieldContext) => FieldEffect;\n }\n /** Removes the field: it is computed, not stored. */\n | { readonly kind: \"drop\"; readonly message: string }\n /** Kept as is, reported once per use. */\n | { readonly kind: \"report\"; readonly severity: ImportSeverity; readonly message: string };\n\nconst API_ONLY = \"API setting of @neo4j/graphql, no effect on the data model\";\nconst AUTH =\n \"authorization rules are not part of a Cyphra schema: enforce them in your resolvers or services\";\n\nfunction issue(severity: ImportSeverity, feature: string, message: string): IssueDraft {\n return { severity, feature, message };\n}\n\n/** Convert a GraphQL `@default(value:)` to a Cyphra default for the field's type. */\nfunction defaultFromValue(\n v: ConstValueNode,\n ctx: FieldContext,\n): string | number | boolean | { error: string } {\n if (ctx.list) return { error: \"Cyphra has no defaults for list fields\" };\n switch (ctx.type) {\n case \"String\":\n if (v.kind === Kind.STRING) return v.value;\n if (ctx.isEnum && v.kind === Kind.ENUM) return v.value;\n break;\n case \"Int\":\n if (v.kind === Kind.INT) return Number(v.value);\n break;\n case \"Float\":\n if (v.kind === Kind.INT || v.kind === Kind.FLOAT) return Number(v.value);\n break;\n case \"Boolean\":\n if (v.kind === Kind.BOOLEAN) return v.value;\n break;\n case \"DateTime\":\n case \"Date\":\n return { error: `Cyphra only supports @default(now()) on ${ctx.type} fields` };\n }\n return { error: `the default does not match type ${ctx.graphqlType}` };\n}\n\n/**\n * Field-level directives of `@neo4j/graphql` v7 (plus `@unique` and `@private` from older\n * versions, which teams often still have). `@relationship` is handled by the converter.\n */\nexport const FIELD_DIRECTIVES: Readonly<Record<string, FieldDirectiveRule>> = {\n id: {\n kind: \"scalar\",\n apply: (_d, ctx) => {\n if (ctx.graphqlType !== \"ID\" || ctx.list) {\n return {\n issues: [\n issue(\"unsupported\", \"@id\", \"@id is only valid on ID fields in v7; not converted\"),\n ],\n };\n }\n if (ctx.owner === \"relationship\") {\n return {\n decorators: [defaultFn(\"uuid\")],\n required: true,\n issues: [\n issue(\n \"changed\",\n \"@id\",\n \"Cyphra has no @id on relationship properties: kept as @default(uuid())\",\n ),\n ],\n };\n }\n if (ctx.nodeHasId) {\n return {\n decorators: [UNIQUE, defaultFn(\"uuid\")],\n required: true,\n issues: [\n issue(\n \"changed\",\n \"@id\",\n \"a Cyphra node has one @id: this one became @unique @default(uuid())\",\n ),\n ],\n };\n }\n return {\n decorators: [ID, defaultFn(\"uuid\")],\n required: true,\n takesId: true,\n issues: [\n issue(\n \"changed\",\n \"@id\",\n \"became @id @default(uuid()); Cyphra also adds a uniqueness constraint, which v7 @id does not\",\n ),\n ],\n };\n },\n },\n timestamp: {\n kind: \"scalar\",\n apply: (d, ctx) => {\n const ops = enumListArg(d, \"operations\") ?? [\"CREATE\", \"UPDATE\"];\n if (ctx.type !== \"DateTime\" || ctx.list) {\n return {\n issues: [issue(\"unsupported\", \"@timestamp\", \"@timestamp is only converted on DateTime\")],\n };\n }\n if (!ops.includes(\"CREATE\")) {\n return {\n required: false,\n issues: [\n issue(\n \"unsupported\",\n \"@timestamp\",\n \"update timestamps are not set automatically by Cyphra: field made optional, set it when you update\",\n ),\n ],\n };\n }\n const issues = ops.includes(\"UPDATE\")\n ? [\n issue(\n \"changed\",\n \"@timestamp\",\n \"became @default(now()) (set on create); Cyphra does not refresh it on update, set it when you update\",\n ),\n ]\n : [];\n return { decorators: [defaultFn(\"now\")], issues };\n },\n },\n default: {\n kind: \"scalar\",\n apply: (d, ctx) => {\n const v = arg(d, \"value\");\n const value = v ? defaultFromValue(v, ctx) : { error: \"missing value\" };\n if (typeof value === \"object\") {\n return { issues: [issue(\"unsupported\", \"@default\", `${value.error}; not converted`)] };\n }\n return { decorators: [defaultLiteral(value)] };\n },\n },\n unique: {\n kind: \"scalar\",\n apply: () => ({\n decorators: [UNIQUE],\n issues: [\n issue(\n \"changed\",\n \"@unique\",\n \"@unique was removed in @neo4j/graphql v7; Cyphra keeps it and creates the uniqueness constraint\",\n ),\n ],\n }),\n },\n relayId: {\n kind: \"scalar\",\n apply: () => ({\n decorators: [UNIQUE],\n issues: [\n issue(\n \"changed\",\n \"@relayId\",\n \"became @unique; Cyphra has no Relay global IDs (the field keeps its plain value)\",\n ),\n ],\n }),\n },\n alias: {\n kind: \"scalar\",\n apply: (d) => {\n const property = stringArg(d, \"property\");\n if (!property || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(property)) {\n return {\n issues: [\n issue(\"unsupported\", \"@alias\", \"the property name is not an identifier; not renamed\"),\n ],\n };\n }\n return {\n rename: property,\n issues: [\n issue(\n \"changed\",\n \"@alias\",\n `Cyphra field names are the Neo4j property names: renamed to \"${property}\"`,\n ),\n ],\n };\n },\n },\n cypher: {\n kind: \"drop\",\n message: \"@cypher fields are computed by a Cypher query: not converted, write it as a query\",\n },\n customResolver: {\n kind: \"drop\",\n message: \"@customResolver fields are computed in code: not converted\",\n },\n populatedBy: {\n kind: \"report\",\n severity: \"unsupported\",\n message: \"@populatedBy callbacks are not supported: set the value in your code\",\n },\n coalesce: {\n kind: \"report\",\n severity: \"unsupported\",\n message: \"@coalesce read fallbacks are not supported\",\n },\n authentication: { kind: \"report\", severity: \"unsupported\", message: AUTH },\n authorization: { kind: \"report\", severity: \"unsupported\", message: AUTH },\n subscriptionsAuthorization: { kind: \"report\", severity: \"unsupported\", message: AUTH },\n selectable: { kind: \"report\", severity: \"ignored\", message: API_ONLY },\n settable: { kind: \"report\", severity: \"ignored\", message: API_ONLY },\n filterable: { kind: \"report\", severity: \"ignored\", message: API_ONLY },\n sortable: { kind: \"report\", severity: \"ignored\", message: API_ONLY },\n private: { kind: \"report\", severity: \"ignored\", message: API_ONLY },\n jwtClaim: { kind: \"report\", severity: \"ignored\", message: API_ONLY },\n deprecated: { kind: \"report\", severity: \"ignored\", message: \"GraphQL deprecation, no effect\" },\n};\n\n// ---------------------------------------------------------------------------------------------\n// Type directives\n// ---------------------------------------------------------------------------------------------\n\n/** What a type-level directive does to the Cyphra node. */\nexport type TypeEffect = {\n /** Rename the Cyphra node (its name is its Neo4j label). */\n readonly rename?: string;\n readonly issues?: readonly IssueDraft[];\n};\n\nexport type TypeDirectiveRule = (d: ConstDirectiveNode, typeName: string) => TypeEffect;\n\nfunction reportType(severity: ImportSeverity, message: string): TypeDirectiveRule {\n return (d) => ({ issues: [issue(severity, `@${d.name.value}`, message)] });\n}\n\n/** Type-level directives on `@node` types. */\nexport const TYPE_DIRECTIVES: Readonly<Record<string, TypeDirectiveRule>> = {\n node: (d, typeName) => {\n const labels = enumListArg(d, \"labels\");\n if (!labels || labels.length === 0) return {};\n const [first, ...rest] = labels as [string, ...string[]];\n const issues: IssueDraft[] = [];\n let rename: string | undefined;\n if (first !== typeName) {\n if (/^[A-Za-z_][A-Za-z0-9_]*$/.test(first)) {\n rename = first;\n issues.push(\n issue(\n \"changed\",\n \"@node(labels)\",\n `a Cyphra node's name is its label: renamed to \"${first}\"`,\n ),\n );\n } else {\n issues.push(\n issue(\n \"unsupported\",\n \"@node(labels)\",\n `label \"${first}\" is not an identifier (dynamic labels are not supported); kept \"${typeName}\"`,\n ),\n );\n }\n }\n if (rest.length > 0) {\n issues.push(\n issue(\n \"unsupported\",\n \"@node(labels)\",\n `extra labels ${rest.map((l) => `\"${l}\"`).join(\", \")} are not supported: Cyphra nodes have one label`,\n ),\n );\n }\n return rename ? { rename, issues } : { issues };\n },\n fulltext: reportType(\n \"unsupported\",\n \"fulltext indexes are not supported: create them in a migration\",\n ),\n vector: reportType(\"unsupported\", \"vector indexes are not supported: create them in a migration\"),\n authentication: reportType(\"unsupported\", AUTH),\n authorization: reportType(\"unsupported\", AUTH),\n subscriptionsAuthorization: reportType(\"unsupported\", AUTH),\n plural: reportType(\"ignored\", API_ONLY),\n query: reportType(\"ignored\", API_ONLY),\n mutation: reportType(\"ignored\", API_ONLY),\n subscription: reportType(\"ignored\", API_ONLY),\n limit: reportType(\"ignored\", API_ONLY),\n groupBy: reportType(\"ignored\", API_ONLY),\n deprecated: reportType(\"ignored\", \"GraphQL deprecation, no effect\"),\n};\n\n/** `@relationship` arguments that only shape the GraphQL API. */\nexport const RELATIONSHIP_API_ARGS: readonly string[] = [\"nestedOperations\", \"aggregate\"];\n","/**\n * Print a {@link GraphQLImportResult} as `.cyphra` source, merge it into an existing schema, and\n * format the import report.\n *\n * @packageDocumentation\n */\n\nimport {\n parseSchema,\n printSchemaDocument,\n resolveSchema,\n type Declaration,\n type NodeDeclaration,\n type NodeField,\n type SchemaDocument,\n} from \"@cyphra/schema\";\nimport type { GraphQLImportResult } from \"./convert.js\";\nimport type { ImportIssue, ImportSeverity } from \"./mappings.js\";\n\nconst HEADER = \"// Imported from @neo4j/graphql type definitions with `cyphra import graphql`.\";\n\n/** One declaration as `.cyphra` text, with `// …` notes for fields that were not converted. */\nfunction printDeclaration(decl: Declaration, notes: readonly string[] | undefined): string {\n const text = printSchemaDocument({ kind: \"Document\", declarations: [decl] }).trimEnd();\n if (!notes?.length) return text;\n const lines = text.split(\"\\n\");\n lines.splice(lines.length - 1, 0, ...notes.map((n) => ` // ${n}`));\n return lines.join(\"\\n\");\n}\n\nfunction printDeclarations(result: GraphQLImportResult, decls: readonly Declaration[]): string {\n return decls.map((d) => printDeclaration(d, result.notes.get(d.name))).join(\"\\n\\n\");\n}\n\n/** Header comment listing what to review (unsupported and changed entries). */\nfunction reviewComment(issues: readonly ImportIssue[]): string[] {\n const review = issues.filter((i) => i.severity !== \"ignored\");\n if (review.length === 0) return [];\n return [\n \"// Review before use (run the import again to see the full report):\",\n ...review.map((i) => `// - ${i.at}: ${i.message}`),\n ];\n}\n\n/**\n * The imported schema as a new `.cyphra` file.\n *\n * @param result - Output of {@link convertGraphQLTypeDefs}.\n */\nexport function printImportedSchema(result: GraphQLImportResult): string {\n const head = [HEADER, ...reviewComment(result.issues)].join(\"\\n\");\n const body = printDeclarations(result, result.document.declarations);\n return body ? `${head}\\n\\n${body}\\n` : `${head}\\n`;\n}\n\n/** One field formatted as a `.cyphra` line (without indentation). */\nfunction formatField(field: NodeField): string {\n const text = printSchemaDocument({\n kind: \"Document\",\n declarations: [{ kind: \"Node\", name: \"X\", fields: [field] }],\n });\n return text.split(\"\\n\")[1]!.trim();\n}\n\n/** Offset of the closing brace of top-level `node <name> { … }`, skipping comments and strings. */\nfunction nodeCloseBrace(source: string, name: string): number {\n let depth = 0;\n let inTarget = false;\n for (let i = 0; i < source.length; i++) {\n const c = source[i]!;\n if (c === \"/\" && source[i + 1] === \"/\") {\n while (i < source.length && source[i] !== \"\\n\") i++;\n continue;\n }\n if (c === '\"') {\n for (i++; i < source.length && source[i] !== '\"'; i++) if (source[i] === \"\\\\\") i++;\n continue;\n }\n if (depth === 0 && /[A-Za-z_]/.test(c) && (i === 0 || !/[A-Za-z0-9_]/.test(source[i - 1]!))) {\n const m = /^(node|relationship)\\s+([A-Za-z_][A-Za-z0-9_]*)/.exec(source.slice(i));\n if (m) {\n inTarget = m[1] === \"node\" && m[2] === name;\n i += m[0].length - 1;\n continue;\n }\n }\n if (c === \"{\") depth++;\n else if (c === \"}\") {\n depth--;\n if (depth === 0 && inTarget) return i;\n }\n }\n return -1;\n}\n\n/**\n * Merge the imported schema into an existing `.cyphra` source.\n *\n * Existing declarations, fields and comments are kept as written. Fields the existing nodes lack\n * are added at the end of their block; new nodes and relationships are appended. When a field or\n * relationship exists on both sides with a different definition, the existing one wins and an\n * issue says so.\n *\n * @returns The merged source and the extra issues the merge produced.\n * @throws When the existing source does not parse, or the merged schema does not resolve.\n */\nexport function mergeImportedSchema(\n existing: string,\n result: GraphQLImportResult,\n): { source: string; issues: ImportIssue[] } {\n const doc: SchemaDocument = parseSchema(existing);\n const issues: ImportIssue[] = [];\n const kept = (at: string, what: string) =>\n issues.push({\n severity: \"changed\",\n at,\n feature: \"--merge\",\n message: `${what} already exists with a different definition: kept yours`,\n });\n let out = existing;\n const appended: Declaration[] = [];\n\n for (const decl of result.document.declarations) {\n const current = doc.declarations.find((d) => d.name === decl.name);\n if (!current) {\n appended.push(decl);\n continue;\n }\n if (decl.kind !== \"Node\" || current.kind !== \"Node\") {\n const same =\n decl.kind === current.kind &&\n printSchemaDocument({ kind: \"Document\", declarations: [decl] }) ===\n printSchemaDocument({ kind: \"Document\", declarations: [current] });\n if (!same)\n kept(decl.name, `${current.kind === \"Node\" ? \"node\" : \"relationship\"} ${decl.name}`);\n continue;\n }\n const missing: NodeField[] = [];\n for (const f of decl.fields) {\n const mine = (current as NodeDeclaration).fields.find((x) => x.name === f.name);\n if (!mine) missing.push(f);\n else if (formatField(mine) !== formatField(f))\n kept(`${decl.name}.${f.name}`, `field ${f.name}`);\n }\n // Skip notes already in the file (importing the same type definitions again).\n const notes = (result.notes.get(decl.name) ?? []).filter((n) => !out.includes(`// ${n}`));\n if (missing.length === 0 && notes.length === 0) continue;\n const close = nodeCloseBrace(out, decl.name);\n if (close < 0) throw new Error(`Could not find the block of node \"${decl.name}\".`);\n const lineStart = out.lastIndexOf(\"\\n\", close - 1) + 1;\n const onOwnLine = out.slice(lineStart, close).trim() === \"\";\n const added = [...missing.map(formatField), ...notes.map((n) => `// ${n}`)]\n .map((l) => ` ${l}\\n`)\n .join(\"\");\n out = onOwnLine\n ? out.slice(0, lineStart) + added + out.slice(lineStart)\n : `${out.slice(0, close).trimEnd()}\\n${added}${out.slice(close)}`;\n }\n\n if (appended.length) {\n out = `${out.trimEnd()}\\n\\n${HEADER}\\n\\n${printDeclarations(result, appended)}\\n`;\n }\n try {\n resolveSchema(parseSchema(out));\n } catch (cause) {\n throw new Error(\n `Merging the imported models into the existing schema produced an invalid schema: ${\n cause instanceof Error ? cause.message : String(cause)\n }`,\n { cause },\n );\n }\n return { source: out, issues };\n}\n\nconst SECTIONS: readonly { severity: ImportSeverity; title: string }[] = [\n { severity: \"unsupported\", title: \"Not converted\" },\n { severity: \"changed\", title: \"Converted with differences\" },\n { severity: \"ignored\", title: \"Ignored (GraphQL API only)\" },\n];\n\n/**\n * The import report as plain text, grouped by severity. Empty string when there is nothing to\n * report.\n */\nexport function formatImportReport(issues: readonly ImportIssue[]): string {\n const blocks: string[] = [];\n for (const s of SECTIONS) {\n const items = issues.filter((i) => i.severity === s.severity);\n if (items.length === 0) continue;\n const width = Math.min(32, Math.max(...items.map((i) => i.at.length)));\n blocks.push(\n [\n `${s.title} (${items.length}):`,\n ...items.map((i) => ` ${i.at.padEnd(width)} ${i.feature}: ${i.message}`),\n ].join(\"\\n\"),\n );\n }\n return blocks.join(\"\\n\\n\");\n}\n","/**\n * Compiles one v7 root query field (`movies`, `moviesConnection`) with its whole selection set into a\n * single Cypher statement, plus a decoder that turns the returned value into the GraphQL result.\n *\n * Nested relationship fields become `COLLECT { … }` subqueries, connections become a `COUNT { … }`\n * (for `totalCount` / `pageInfo`) and a `COLLECT { … }` of edges. Cursors are v7 offset cursors:\n * `base64(\"arrayconnection:<offset>\")`.\n *\n * Connection `aggregate` selections follow v7 7.6: `count.nodes` / `count.edges` count distinct\n * nodes / relationships; each `node.<field>` / `edge.<field>` aggregate runs over the distinct nodes\n * (relationships) matching the connection `where` (not `first` / `after`); `shortest` / `longest` are\n * the last / first values ordered by `size(…)` descending; `sum` of an empty set is `0`, the other\n * aggregates are `null`. Int `average` is a Float, BigInt values (including `average`) are strings.\n *\n * @packageDocumentation\n */\n\nimport {\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n Kind,\n getArgumentValues,\n getDirectiveValues,\n type FieldNode,\n type FragmentDefinitionNode,\n type GraphQLField,\n type GraphQLObjectType,\n type GraphQLSchema,\n type SelectionSetNode,\n} from \"graphql\";\nimport neo4j, { isInt } from \"neo4j-driver\";\nimport { FOLLOW_UP, notImplemented } from \"../errors.js\";\nimport {\n readNeedsAuth,\n type Attribute,\n type NodeType,\n type PropertiesType,\n type Relationship,\n type V7Model,\n} from \"../model.js\";\nimport {\n CypherContext,\n labels,\n listAggregate,\n q,\n withList,\n type ListAggregate,\n} from \"./context.js\";\nimport { WhereCompiler, relationshipPattern } from \"./where.js\";\n\ntype AnyRecord = Record<string, unknown>;\nexport type Decoder = (raw: unknown) => unknown;\n\n/** What the compiler needs from `GraphQLResolveInfo`. */\nexport type SelectionInfo = {\n readonly schema: GraphQLSchema;\n readonly fragments: Record<string, FragmentDefinitionNode>;\n readonly variableValues: Record<string, unknown>;\n};\n\nexport type CompiledQuery = {\n readonly cypher: string;\n readonly params: Record<string, unknown>;\n /** Turns the returned records (`this` column) into the field's GraphQL value. */\n readonly decode: (rows: readonly unknown[]) => unknown;\n};\n\nconst CURSOR_PREFIX = \"arrayconnection:\";\n\nexport function offsetToCursor(offset: number): string {\n return Buffer.from(`${CURSOR_PREFIX}${offset}`, \"utf8\").toString(\"base64\");\n}\n\n/** Offset of the cursor, or `undefined` when it is not a valid v7 cursor (first page then). */\nexport function cursorToOffset(cursor: unknown): number | undefined {\n if (typeof cursor !== \"string\") return undefined;\n const decoded = Buffer.from(cursor, \"base64\").toString(\"utf8\");\n if (!decoded.startsWith(CURSOR_PREFIX)) return undefined;\n const n = Number(decoded.slice(CURSOR_PREFIX.length));\n return Number.isInteger(n) && n >= 0 ? n : undefined;\n}\n\n/** Fields of a selection set, merged by response key (aliases), fragments and @skip/@include applied. */\nexport function collectFields(\n info: SelectionInfo,\n sets: readonly (SelectionSetNode | undefined)[],\n out = new Map<string, FieldNode[]>(),\n): Map<string, FieldNode[]> {\n for (const set of sets) {\n for (const sel of set?.selections ?? []) {\n const skip = getDirectiveValues(GraphQLSkipDirective, sel, info.variableValues);\n if (skip?.if === true) continue;\n const include = getDirectiveValues(GraphQLIncludeDirective, sel, info.variableValues);\n if (include?.if === false) continue;\n if (sel.kind === Kind.FIELD) {\n const key = sel.alias?.value ?? sel.name.value;\n const list = out.get(key) ?? [];\n list.push(sel);\n out.set(key, list);\n } else if (sel.kind === Kind.INLINE_FRAGMENT) {\n collectFields(info, [sel.selectionSet], out);\n } else {\n const frag = info.fragments[sel.name.value];\n if (frag) collectFields(info, [frag.selectionSet], out);\n }\n }\n }\n return out;\n}\n\nexport function subSelections(nodes: readonly FieldNode[]): (SelectionSetNode | undefined)[] {\n return nodes.map((n) => n.selectionSet);\n}\n\nfunction objectType(info: SelectionInfo, name: string): GraphQLObjectType {\n return info.schema.getType(name) as GraphQLObjectType;\n}\n\nfunction fieldArgs(\n field: GraphQLField<unknown, unknown>,\n node: FieldNode,\n info: SelectionInfo,\n): AnyRecord {\n return getArgumentValues(field, node, info.variableValues);\n}\n\nfunction mapValue(v: unknown, f: (x: unknown) => unknown): unknown {\n if (v === null || v === undefined) return null;\n return Array.isArray(v) ? v.map(f) : f(v);\n}\n\nfunction integerToNumber(x: unknown): unknown {\n return isInt(x) ? x.toNumber() : x;\n}\n\nfunction attributeDecoder(a: Attribute): Decoder {\n if (a.kind === \"scalar\" && a.type.name === \"BigInt\") {\n return (v) => mapValue(v, (x) => (isInt(x) ? x.toString() : x));\n }\n if (a.kind === \"scalar\" && (a.type.name === \"Int\" || a.type.name === \"Float\")) {\n return (v) => mapValue(v, integerToNumber);\n }\n return (v) => v ?? null;\n}\n\nfunction toNumber(v: unknown): number {\n return isInt(v) ? v.toNumber() : Number(v);\n}\n\nfunction intParam(ctx: CypherContext, value: unknown): string | undefined {\n if (typeof value !== \"number\") return undefined;\n return ctx.param(neo4j.int(Math.max(0, Math.trunc(value))));\n}\n\nfunction paging(ctx: CypherContext, offset: unknown, limit: unknown): string {\n const parts: string[] = [];\n const o = intParam(ctx, offset);\n if (o) parts.push(`SKIP ${o}`);\n const l = intParam(ctx, limit);\n if (l) parts.push(`LIMIT ${l}`);\n return parts.join(\" \");\n}\n\n/** `WITH vars ORDER BY … SKIP … LIMIT …`, or nothing when there is no order and no paging. */\nfunction withClause(vars: string, order: string, page: string): string {\n if (!order && !page) return \"\";\n return [\"WITH\", vars, order, page].filter(Boolean).join(\" \");\n}\n\nconst AGGREGATE_FUNCTIONS: Record<string, ListAggregate> = {\n min: \"min\",\n max: \"max\",\n average: \"avg\",\n sum: \"sum\",\n};\n\n/**\n * Result of one aggregate (`IntAggregateSelection.average`, …): Int min / max / sum are Int and\n * `average` a Float; BigInt values are strings (the `BigInt` scalar serializes an `average` float).\n */\nfunction aggregateValueDecoder(type: string): Decoder {\n if (type === \"Int\" || type === \"Float\") return (v) => mapValue(v, integerToNumber);\n if (type === \"BigInt\") return (v) => mapValue(v, (x) => (isInt(x) ? x.toString() : x));\n return (v) => v ?? null;\n}\n\nfunction mapDecoder(decoders: readonly [string, Decoder][]): Decoder {\n return (raw) => {\n const r = (raw ?? {}) as AnyRecord;\n const out: AnyRecord = {};\n for (const [key, dec] of decoders) out[key] = dec(r[key]);\n return out;\n };\n}\n\nexport class SelectionCompiler {\n readonly ctx = new CypherContext();\n private readonly where: WhereCompiler;\n\n constructor(\n private readonly model: V7Model,\n private readonly info: SelectionInfo,\n ) {\n this.where = new WhereCompiler(model, this.ctx, (n) => this.assertReadable(n));\n }\n\n assertReadable(node: NodeType): void {\n if (readNeedsAuth(node)) {\n throw notImplemented(\n `reading ${node.name}, which has @authentication / @authorization rules`,\n FOLLOW_UP.authorization,\n );\n }\n }\n\n private sortItems(\n variable: string,\n attributes: readonly Attribute[],\n sort: unknown,\n owner: string,\n ): string[] {\n const items: string[] = [];\n if (sort === null || typeof sort !== \"object\") return items;\n for (const [field, dir] of Object.entries(sort as AnyRecord)) {\n if (dir !== \"ASC\" && dir !== \"DESC\") continue;\n const a = attributes.find((x) => x.name === field);\n if (!a) throw new Error(`Unknown sort field ${owner}.${field}`);\n if (a.cypher)\n throw notImplemented(`sorting on @cypher field ${owner}.${field}`, FOLLOW_UP.cypher);\n items.push(`${variable}.${q(a.property)} ${dir}`);\n }\n return items;\n }\n\n private nodeOrder(variable: string, node: NodeType, sort: unknown): string {\n const items = (Array.isArray(sort) ? sort : []).flatMap((s) =>\n this.sortItems(variable, node.attributes, s, node.name),\n );\n return items.length ? `ORDER BY ${items.join(\", \")}` : \"\";\n }\n\n private connectionOrder(\n relVar: string,\n nodeVar: string,\n rel: Relationship,\n sort: unknown,\n ): string {\n const target = this.model.node(rel.target);\n const props = this.props(rel);\n const items: string[] = [];\n for (const s of Array.isArray(sort) ? sort : []) {\n if (s === null || typeof s !== \"object\") continue;\n for (const [k, v] of Object.entries(s as AnyRecord)) {\n if (k === \"node\") items.push(...this.sortItems(nodeVar, target.attributes, v, target.name));\n else if (k === \"edge\" && props)\n items.push(...this.sortItems(relVar, props.attributes, v, props.name));\n }\n }\n return items.length ? `ORDER BY ${items.join(\", \")}` : \"\";\n }\n\n private props(rel: Relationship): PropertiesType | undefined {\n return rel.properties ? this.model.properties.get(rel.properties) : undefined;\n }\n\n /** `{ key: expr, … }` for a selection on a node variable, and its decoder. */\n projectNode(\n variable: string,\n node: NodeType,\n fieldNodes: readonly FieldNode[],\n ): { expr: string; decode: Decoder } {\n this.assertReadable(node);\n const type = objectType(this.info, node.name);\n const gqlFields = type.getFields();\n const entries: string[] = [];\n const decoders: [string, Decoder][] = [];\n for (const [key, nodes] of collectFields(this.info, subSelections(fieldNodes))) {\n const name = nodes[0]!.name.value;\n if (name === \"__typename\") continue;\n const attr = node.attributes.find((a) => a.name === name);\n if (attr) {\n if (attr.cypher)\n throw notImplemented(`@cypher field ${node.name}.${name}`, FOLLOW_UP.cypher);\n entries.push(`${q(key)}: ${variable}.${q(attr.property)}`);\n decoders.push([key, attributeDecoder(attr)]);\n continue;\n }\n const gqlField = gqlFields[name];\n if (!gqlField) throw new Error(`Unknown field ${node.name}.${name}`);\n const args = fieldArgs(gqlField, nodes[0]!, this.info);\n const rel = node.relationships.find((r) => r.name === name);\n if (rel) {\n const p = this.relationshipList(variable, rel, args, nodes);\n entries.push(`${q(key)}: ${p.expr}`);\n decoders.push([key, p.decode]);\n continue;\n }\n const connRel = name.endsWith(\"Connection\")\n ? node.relationships.find((r) => `${r.name}Connection` === name)\n : undefined;\n if (connRel) {\n const p = this.relationshipConnection(variable, connRel, args, nodes);\n entries.push(`${q(key)}: ${p.expr}`);\n decoders.push([key, p.decode]);\n continue;\n }\n throw new Error(`Unknown field ${node.name}.${name}`);\n }\n return {\n expr: `{ ${entries.join(\", \")} }`,\n decode: (raw) => {\n const r = (raw ?? {}) as AnyRecord;\n const out: AnyRecord = {};\n for (const [key, dec] of decoders) out[key] = dec(r[key]);\n return out;\n },\n };\n }\n\n private projectProperties(\n relVar: string,\n props: PropertiesType,\n fieldNodes: readonly FieldNode[],\n ): { expr: string; decode: Decoder } {\n const entries: string[] = [];\n const decoders: [string, Decoder][] = [];\n for (const [key, nodes] of collectFields(this.info, subSelections(fieldNodes))) {\n const name = nodes[0]!.name.value;\n if (name === \"__typename\") continue;\n const attr = props.attributes.find((a) => a.name === name);\n if (!attr) throw new Error(`Unknown field ${props.name}.${name}`);\n entries.push(`${q(key)}: ${relVar}.${q(attr.property)}`);\n decoders.push([key, attributeDecoder(attr)]);\n }\n return {\n expr: `{ ${entries.join(\", \")} }`,\n decode: (raw) => {\n const r = (raw ?? {}) as AnyRecord;\n const out: AnyRecord = {};\n for (const [key, dec] of decoders) out[key] = dec(r[key]);\n return out;\n },\n };\n }\n\n private relationshipList(\n variable: string,\n rel: Relationship,\n args: AnyRecord,\n fieldNodes: readonly FieldNode[],\n ): { expr: string; decode: Decoder } {\n const target = this.model.node(rel.target);\n const m = this.ctx.variable(\"this\");\n const pattern = relationshipPattern(this.model, variable, rel, m);\n const pred = this.where.node(m, target, args.where);\n const order = this.nodeOrder(m, target, args.sort);\n const page = paging(this.ctx, args.offset, args.limit);\n const inner = this.projectNode(m, target, fieldNodes);\n const body = [\n `MATCH ${pattern}`,\n pred ? `WHERE ${pred}` : \"\",\n withClause(m, order, page),\n `RETURN ${inner.expr}`,\n ]\n .filter(Boolean)\n .join(\" \");\n return {\n expr: `COLLECT { ${body} }`,\n decode: (raw) => (Array.isArray(raw) ? raw.map(inner.decode) : []),\n };\n }\n\n /**\n * A connection over `match` (a pattern binding `nodeVar` and, for relationships, `relVar`):\n * `{ total: COUNT { … }, edges: COLLECT { … } }` and the decoder that builds edges, cursors and\n * `pageInfo` from the selection.\n */\n private connection(opts: {\n match: string;\n predicate?: string;\n order: string;\n nodeVar: string;\n relVar?: string;\n projectNode: (fieldNodes: readonly FieldNode[]) => { expr: string; decode: Decoder };\n projectProperties?: (fieldNodes: readonly FieldNode[]) => { expr: string; decode: Decoder };\n /** Node type and relationship properties the `aggregate` selection aggregates over. */\n node: NodeType;\n props?: PropertiesType;\n args: AnyRecord;\n fieldNodes: readonly FieldNode[];\n owner: string;\n }): { expr: string; decode: Decoder } {\n const afterOffset = cursorToOffset(opts.args.after);\n const offset = afterOffset === undefined ? 0 : afterOffset + 1;\n const conn = collectFields(this.info, subSelections(opts.fieldNodes));\n\n const edgeEntries: string[] = [];\n const edgeDecoders: [string, (raw: AnyRecord, index: number) => unknown][] = [];\n const edgeFieldNodes: FieldNode[] = [];\n const aggregates: [string, Decoder][] = [];\n const aggregateEntries: string[] = [];\n let needsTotal = false;\n let needsEdges = false;\n const where = opts.predicate ? ` WHERE ${opts.predicate}` : \"\";\n for (const [key, nodes] of conn) {\n const name = nodes[0]!.name.value;\n if (name === \"aggregate\") {\n const p = this.aggregate(\n {\n base: `MATCH ${opts.match}${where}`,\n nodeVar: opts.nodeVar,\n relVar: opts.relVar,\n node: opts.node,\n props: opts.props,\n owner: opts.owner,\n },\n nodes,\n );\n aggregateEntries.push(`${q(key)}: ${p.expr}`);\n aggregates.push([key, p.decode]);\n }\n if (name === \"edges\") edgeFieldNodes.push(...nodes);\n if (name === \"edges\" || name === \"pageInfo\") needsEdges = true;\n if (name === \"totalCount\" || name === \"pageInfo\") needsTotal = true;\n }\n for (const [key, nodes] of collectFields(this.info, subSelections(edgeFieldNodes))) {\n const name = nodes[0]!.name.value;\n if (name === \"cursor\") {\n edgeDecoders.push([key, (_raw, i) => offsetToCursor(offset + i)]);\n } else if (name === \"node\") {\n const p = opts.projectNode(nodes);\n edgeEntries.push(`${q(key)}: ${p.expr}`);\n edgeDecoders.push([key, (raw) => p.decode(raw[key])]);\n } else if (name === \"properties\" && opts.projectProperties) {\n const p = opts.projectProperties(nodes);\n edgeEntries.push(`${q(key)}: ${p.expr}`);\n edgeDecoders.push([key, (raw) => p.decode(raw[key])]);\n }\n }\n\n const withVars = opts.relVar ? `${opts.relVar}, ${opts.nodeVar}` : opts.nodeVar;\n const page = paging(this.ctx, offset || undefined, opts.args.first);\n const edgesBody = [\n `MATCH ${opts.match}${where}`,\n withClause(withVars, opts.order, page),\n `RETURN { ${edgeEntries.join(\", \")} }`,\n ]\n .filter(Boolean)\n .join(\" \");\n const parts: string[] = [];\n if (needsTotal) parts.push(`total: COUNT { MATCH ${opts.match}${where} }`);\n if (needsEdges) parts.push(`edges: COLLECT { ${edgesBody} }`);\n if (aggregateEntries.length) parts.push(`aggregate: { ${aggregateEntries.join(\", \")} }`);\n const expr = `{ ${parts.join(\", \")} }`;\n\n return {\n expr,\n decode: (raw) => {\n const r = (raw ?? {}) as AnyRecord;\n const total = toNumber(r.total ?? 0);\n const rawEdges = (Array.isArray(r.edges) ? r.edges : []) as AnyRecord[];\n const edges = rawEdges.map((e, i) => {\n const out: AnyRecord = {};\n for (const [key, dec] of edgeDecoders) out[key] = dec(e ?? {}, i);\n return out;\n });\n const out: AnyRecord = {};\n for (const [key, nodes] of conn) {\n const name = nodes[0]!.name.value;\n if (name === \"totalCount\") out[key] = total;\n else if (name === \"edges\") out[key] = edges;\n else if (name === \"aggregate\") {\n const agg = (r.aggregate ?? {}) as AnyRecord;\n out[key] = aggregates.find(([k]) => k === key);\n } else if (name === \"pageInfo\") {\n const info: AnyRecord = {};\n for (const [pk, pn] of collectFields(this.info, subSelections(nodes))) {\n switch (pn[0]!.name.value) {\n case \"hasNextPage\":\n info[pk] = offset + edges.length < total;\n break;\n case \"hasPreviousPage\":\n info[pk] = offset > 0;\n break;\n case \"startCursor\":\n info[pk] = edges.length ? offsetToCursor(offset) : null;\n break;\n case \"endCursor\":\n info[pk] = edges.length ? offsetToCursor(offset + edges.length - 1) : null;\n break;\n }\n }\n out[key] = info;\n }\n }\n return out;\n },\n };\n }\n\n /**\n * `{ count: …, node: { field: … }, edge: { field: … } }` for a connection `aggregate` selection:\n * one `COUNT { … }` per count and one `COLLECT { … }` of the values per field (reduced with list\n * expressions, see `listAggregate`), like v7's one subquery per field.\n */\n private aggregate(\n scope: {\n /** `MATCH <pattern> [WHERE <connection where>]`. */\n base: string;\n nodeVar: string;\n relVar?: string;\n node: NodeType;\n props?: PropertiesType;\n owner: string;\n },\n fieldNodes: readonly FieldNode[],\n ): { expr: string; decode: Decoder } {\n const entries: string[] = [];\n const decoders: [string, Decoder][] = [];\n for (const [key, nodes] of collectFields(this.info, subSelections(fieldNodes))) {\n const name = nodes[0]!.name.value;\n if (name === \"__typename\") continue;\n if (name === \"count\") {\n const counts: string[] = [];\n const keys: string[] = [];\n for (const [ck, cn] of collectFields(this.info, subSelections(nodes))) {\n const what = cn[0]!.name.value;\n const v = what === \"nodes\" ? scope.nodeVar : what === \"edges\" ? scope.relVar : undefined;\n if (!v) continue;\n counts.push(`${q(ck)}: COUNT { ${scope.base} WITH DISTINCT ${v} RETURN ${v} }`);\n keys.push(ck);\n }\n entries.push(`${q(key)}: { ${counts.join(\", \")} }`);\n decoders.push([\n key,\n (raw) => {\n const r = (raw ?? {}) as AnyRecord;\n return Object.fromEntries(keys.map((k) => [k, toNumber(r[k] ?? 0)]));\n },\n ]);\n continue;\n }\n const isEdge = name === \"edge\";\n if (name !== \"node\" && !isEdge)\n throw new Error(`Unknown field ${scope.owner}.aggregate.${name}`);\n const variable = isEdge ? scope.relVar : scope.nodeVar;\n const attributes = isEdge ? scope.props?.attributes : scope.node.attributes;\n if (!variable || !attributes)\n throw new Error(`Unknown field ${scope.owner}.aggregate.${name}`);\n this.assertReadable(scope.node);\n const fieldEntries: string[] = [];\n const fieldDecoders: [string, Decoder][] = [];\n for (const [fk, fn] of collectFields(this.info, subSelections(nodes))) {\n const field = fn[0]!.name.value;\n if (field === \"__typename\") continue;\n const attr = attributes.find((a) => a.name === field);\n if (!attr) throw new Error(`Unknown field ${scope.owner}.aggregate.${name}.${field}`);\n const p = this.aggregateAttribute(scope.base, variable, attr, fn);\n fieldEntries.push(`${q(fk)}: ${p.expr}`);\n fieldDecoders.push([fk, p.decode]);\n }\n entries.push(`${q(key)}: { ${fieldEntries.join(\", \")} }`);\n decoders.push([key, mapDecoder(fieldDecoders)]);\n }\n return { expr: `{ ${entries.join(\", \")} }`, decode: mapDecoder(decoders) };\n }\n\n /** `min` / `max` / `average` / `sum` / `shortest` / `longest` of one attribute, v7 semantics. */\n private aggregateAttribute(\n base: string,\n variable: string,\n attr: Attribute,\n fieldNodes: readonly FieldNode[],\n ): { expr: string; decode: Decoder } {\n const prop = `${variable}.${q(attr.property)}`;\n const type = attr.type.name;\n const ops: [string, string][] = [];\n for (const [k, n] of collectFields(this.info, subSelections(fieldNodes))) {\n const op = n[0]!.name.value;\n if (op !== \"__typename\") ops.push([k, op]);\n }\n if (ops.length === 0) return { expr: \"{}\", decode: () => ({}) };\n const decoders: [string, Decoder][] = ops.map(([k]) => [k, aggregateValueDecoder(type)]);\n const l = this.ctx.variable(\"list\");\n const values = `${base} WITH DISTINCT ${variable} WHERE ${prop} IS NOT NULL`;\n if (type === \"String\") {\n // v7: ordered by size descending, `longest` is the first value and `shortest` the last.\n const list = `COLLECT { ${values} WITH ${variable} ORDER BY size(${prop}) DESC RETURN ${prop} }`;\n const items = ops.map(\n ([k, op]) =>\n `${q(k)}: ${op === \"longest\" ? `head(${l})` : op === \"shortest\" ? `last(${l})` : \"null\"}`,\n );\n return {\n expr: withList(list, l, () => `{ ${items.join(\", \")} }`),\n decode: mapDecoder(decoders),\n };\n }\n const list = `COLLECT { ${values} RETURN ${prop} }`;\n const items = ops.map(([k, op]) => {\n const fn = AGGREGATE_FUNCTIONS[op];\n return `${q(k)}: ${fn ? listAggregate(fn, l) : \"null\"}`;\n });\n return {\n expr: withList(list, l, () => `{ ${items.join(\", \")} }`),\n decode: mapDecoder(decoders),\n };\n }\n\n private relationshipConnection(\n variable: string,\n rel: Relationship,\n args: AnyRecord,\n fieldNodes: readonly FieldNode[],\n ): { expr: string; decode: Decoder } {\n const target = this.model.node(rel.target);\n this.assertReadable(target);\n const m = this.ctx.variable(\"this\");\n const r = this.ctx.variable(\"edge\");\n const props = this.props(rel);\n return this.connection({\n match: relationshipPattern(this.model, variable, rel, m, r),\n predicate: this.where.connection(r, m, rel, args.where),\n order: this.connectionOrder(r, m, rel, args.sort),\n nodeVar: m,\n relVar: r,\n projectNode: (nodes) => this.projectNode(m, target, nodes),\n projectProperties: props ? (nodes) => this.projectProperties(r, props, nodes) : undefined,\n node: target,\n props,\n args,\n fieldNodes,\n owner: `${rel.source}.${rel.name}Connection`,\n });\n }\n\n /** `movies(where, sort, limit, offset)`. */\n rootList(node: NodeType, args: AnyRecord, fieldNodes: readonly FieldNode[]): CompiledQuery {\n this.assertReadable(node);\n const v = this.ctx.variable(\"this\");\n const pred = this.where.node(v, node, args.where);\n const order = this.nodeOrder(v, node, args.sort);\n const page = paging(this.ctx, args.offset, args.limit);\n const proj = this.projectNode(v, node, fieldNodes);\n const cypher = [\n `MATCH (${v}${labels(node.labels)})`,\n pred ? `WHERE ${pred}` : \"\",\n withClause(v, order, page),\n `RETURN ${proj.expr} AS this`,\n ]\n .filter(Boolean)\n .join(\"\\n\");\n return { cypher, params: this.ctx.params, decode: (rows) => rows.map(proj.decode) };\n }\n\n /** `moviesConnection(where, sort, first, after)`. */\n rootConnection(node: NodeType, args: AnyRecord, fieldNodes: readonly FieldNode[]): CompiledQuery {\n this.assertReadable(node);\n const v = this.ctx.variable(\"this\");\n const c = this.connection({\n match: `(${v}${labels(node.labels)})`,\n predicate: this.where.node(v, node, args.where),\n order: this.nodeOrder(v, node, args.sort),\n nodeVar: v,\n projectNode: (nodes) => this.projectNode(v, node, nodes),\n node,\n args,\n fieldNodes,\n owner: `${node.plural}Connection`,\n });\n return {\n cypher: `RETURN ${c.expr} AS this`,\n params: this.ctx.params,\n decode: (rows) => c.decode(rows[0]),\n };\n }\n}\n","import { GraphQLError } from \"graphql\";\n\n/** Issues tracking the parts of the v7 API that are generated but not served yet. */\nexport const FOLLOW_UP = {\n authorization: 74,\n cypher: 75,\n} as const;\n\n/** The operation is part of the v7 API but `@cyphra/graphql` does not execute it yet. */\nexport function notImplemented(what: string, issue: number): GraphQLError {\n return new GraphQLError(`Not implemented yet in @cyphra/graphql (see #${issue}): ${what}`, {\n extensions: { code: \"NOT_IMPLEMENTED\" },\n });\n}\n","/**\n * The `@neo4j/graphql` v7 type definitions, read into the model the v7 API is generated from.\n *\n * Unlike `convertGraphQLTypeDefs` (which maps to a Cyphra schema and drops what Cyphra cannot\n * express), this keeps every detail that changes the generated API: `ID` vs `String`, list element\n * nullability, `@cypher` fields, `@timestamp`, `@default`, relationship property types.\n *\n * @packageDocumentation\n */\n\nimport {\n Kind,\n parse,\n valueFromASTUntyped,\n type ConstDirectiveNode,\n type ConstValueNode,\n type FieldDefinitionNode,\n type ObjectTypeDefinitionNode,\n type TypeNode,\n} from \"graphql\";\nimport { entityPlural, upperFirst } from \"./naming.js\";\n\n/** Scalar types supported by `@cyphra/graphql` today. */\nexport const SUPPORTED_SCALARS = [\n \"ID\",\n \"String\",\n \"Int\",\n \"Float\",\n \"Boolean\",\n \"BigInt\",\n \"Date\",\n \"DateTime\",\n] as const;\nexport type ScalarName = (typeof SUPPORTED_SCALARS)[number];\n\n/** v7 scalars `@cyphra/graphql` does not support yet. */\nconst UNSUPPORTED_SCALARS = new Set([\n \"LocalDateTime\",\n \"Time\",\n \"LocalTime\",\n \"Duration\",\n \"Point\",\n \"CartesianPoint\",\n]);\n\nexport type TypeRef = {\n /** Named type: a scalar or an enum. */\n readonly name: string;\n readonly list: boolean;\n /** Outer `!`. */\n readonly required: boolean;\n /** `[T!]` (only for lists). */\n readonly elementRequired: boolean;\n};\n\nexport type CypherAnnotation = { readonly statement: string; readonly columnName: string };\n\nexport type Attribute = {\n readonly name: string;\n /** Property key in Neo4j (`@alias(property)`), defaults to the field name. */\n readonly property: string;\n readonly type: TypeRef;\n readonly kind: \"scalar\" | \"enum\";\n readonly description?: string;\n /** `@id`: generated, not in create/update inputs. */\n readonly id: boolean;\n /** `@default(value)` as a JS value. */\n readonly defaultValue?: unknown;\n /** The raw `@default(value: …)` AST, printed as the input default. */\n readonly defaultAst?: ConstValueNode;\n /** `@timestamp(operations)`. */\n readonly timestamp?: readonly (\"CREATE\" | \"UPDATE\")[];\n readonly cypher?: CypherAnnotation;\n /** User `@deprecated(reason)` on the field. */\n readonly deprecated?: string;\n};\n\nexport type Relationship = {\n readonly name: string;\n readonly source: string;\n readonly target: string;\n readonly type: string;\n readonly direction: \"IN\" | \"OUT\";\n /** Name of the `@relationshipProperties` type, if any. */\n readonly properties?: string;\n readonly list: boolean;\n readonly required: boolean;\n readonly elementRequired: boolean;\n readonly description?: string;\n readonly deprecated?: string;\n};\n\nexport type AuthRules = {\n /** Operations covered by `@authentication` (all operations when the directive has no args). */\n readonly authentication?: readonly string[];\n /** `@authorization` present on the type. */\n readonly authorization: boolean;\n};\n\nexport type NodeType = {\n readonly name: string;\n readonly description?: string;\n /** Neo4j labels; the first is the main label. */\n readonly labels: readonly string[];\n /** Root list field, e.g. `movies`. */\n readonly plural: string;\n /** `Movies`. */\n readonly pascalPlural: string;\n readonly attributes: readonly Attribute[];\n readonly relationships: readonly Relationship[];\n readonly auth: AuthRules;\n};\n\nexport type PropertiesType = {\n readonly name: string;\n readonly attributes: readonly Attribute[];\n};\n\nexport type EnumType = {\n readonly name: string;\n readonly description?: string;\n readonly values: readonly { name: string; description?: string; deprecated?: string }[];\n};\n\nexport type V7Model = {\n readonly nodes: readonly NodeType[];\n readonly properties: ReadonlyMap<string, PropertiesType>;\n readonly enums: ReadonlyMap<string, EnumType>;\n node(name: string): NodeType;\n};\n\n/** The type definitions use a feature `@cyphra/graphql` cannot serve yet. */\nexport class UnsupportedTypeDefsError extends Error {\n override name = \"UnsupportedTypeDefsError\";\n}\n\nfunction directive(\n dirs: readonly ConstDirectiveNode[] | undefined,\n name: string,\n): ConstDirectiveNode | undefined {\n return dirs?.find((d) => d.name.value === name);\n}\n\nfunction arg(d: ConstDirectiveNode | undefined, name: string): ConstValueNode | undefined {\n return d?.arguments?.find((a) => a.name.value === name)?.value;\n}\n\nfunction stringArg(d: ConstDirectiveNode | undefined, name: string): string | undefined {\n const v = arg(d, name);\n return v && (v.kind === Kind.STRING || v.kind === Kind.ENUM) ? v.value : undefined;\n}\n\nfunction listArg(d: ConstDirectiveNode | undefined, name: string): string[] | undefined {\n const v = arg(d, name);\n if (!v) return undefined;\n if (v.kind === Kind.LIST) {\n return v.values.flatMap((x) =>\n x.kind === Kind.STRING || x.kind === Kind.ENUM ? [x.value] : [],\n );\n }\n if (v.kind === Kind.STRING || v.kind === Kind.ENUM) return [v.value];\n return undefined;\n}\n\nfunction typeRef(t: TypeNode): TypeRef {\n let cur = t;\n let required = false;\n if (cur.kind === Kind.NON_NULL_TYPE) {\n required = true;\n cur = cur.type;\n }\n if (cur.kind === Kind.LIST_TYPE) {\n let inner = cur.type;\n let elementRequired = false;\n if (inner.kind === Kind.NON_NULL_TYPE) {\n elementRequired = true;\n inner = inner.type;\n }\n if (inner.kind !== Kind.NAMED_TYPE)\n throw new UnsupportedTypeDefsError(\"Nested lists are not supported.\");\n return { name: inner.name.value, list: true, required, elementRequired };\n }\n return {\n name: (cur as { name: { value: string } }).name.value,\n list: false,\n required,\n elementRequired: false,\n };\n}\n\n/** Directives without an effect on the read API that are accepted as-is. */\nconst ACCEPTED_FIELD_DIRECTIVES = new Set([\n \"id\",\n \"default\",\n \"timestamp\",\n \"cypher\",\n \"relationship\",\n \"alias\",\n \"deprecated\",\n \"coalesce\",\n \"unique\",\n]);\nconst ACCEPTED_TYPE_DIRECTIVES = new Set([\n \"node\",\n \"plural\",\n \"authentication\",\n \"authorization\",\n \"relationshipProperties\",\n \"jwt\",\n]);\n\nfunction deprecationReason(dirs: readonly ConstDirectiveNode[] | undefined): string | undefined {\n const d = directive(dirs, \"deprecated\");\n if (!d) return undefined;\n return stringArg(d, \"reason\") ?? \"No longer supported\";\n}\n\nfunction readAttribute(\n owner: string,\n f: FieldDefinitionNode,\n enums: ReadonlySet<string>,\n): Attribute {\n for (const d of f.directives ?? []) {\n if (!ACCEPTED_FIELD_DIRECTIVES.has(d.name.value)) {\n throw new UnsupportedTypeDefsError(\n `${owner}.${f.name.value}: @${d.name.value} is not supported by @cyphra/graphql yet.`,\n );\n }\n }\n if (f.arguments?.length) {\n throw new UnsupportedTypeDefsError(\n `${owner}.${f.name.value}: field arguments are not supported by @cyphra/graphql yet.`,\n );\n }\n const type = typeRef(f.type);\n const isEnum = enums.has(type.name);\n if (!isEnum && !(SUPPORTED_SCALARS as readonly string[]).includes(type.name)) {\n if (UNSUPPORTED_SCALARS.has(type.name)) {\n throw new UnsupportedTypeDefsError(\n `${owner}.${f.name.value}: ${type.name} is not supported by @cyphra/graphql yet.`,\n );\n }\n throw new UnsupportedTypeDefsError(\n `${owner}.${f.name.value}: type ${type.name} is not a supported scalar or enum (fields returning objects need @relationship).`,\n );\n }\n const dirs = f.directives;\n const def = directive(dirs, \"default\");\n const defaultAst = arg(def, \"value\");\n const ts = directive(dirs, \"timestamp\");\n const cypher = directive(dirs, \"cypher\");\n const alias = directive(dirs, \"alias\");\n return {\n name: f.name.value,\n property: stringArg(alias, \"property\") ?? f.name.value,\n type,\n kind: isEnum ? \"enum\" : \"scalar\",\n description: f.description?.value,\n id: !!directive(dirs, \"id\"),\n defaultAst,\n defaultValue: defaultAst ? valueFromASTUntyped(defaultAst) : undefined,\n timestamp: ts\n ? ((listArg(ts, \"operations\") ?? [\"CREATE\", \"UPDATE\"]) as (\"CREATE\" | \"UPDATE\")[])\n : undefined,\n cypher: cypher\n ? {\n statement: stringArg(cypher, \"statement\") ?? \"\",\n columnName: stringArg(cypher, \"columnName\") ?? \"\",\n }\n : undefined,\n deprecated: deprecationReason(dirs),\n };\n}\n\nconst ALL_OPERATIONS = [\n \"READ\",\n \"AGGREGATE\",\n \"CREATE\",\n \"UPDATE\",\n \"DELETE\",\n \"CREATE_RELATIONSHIP\",\n \"DELETE_RELATIONSHIP\",\n \"SUBSCRIBE\",\n];\n\n/**\n * Read v7 type definitions. Throws {@link UnsupportedTypeDefsError} for features `@cyphra/graphql`\n * does not serve yet (interfaces, unions, spatial and some temporal types, …), so the generated\n * API never silently differs from v7.\n */\nexport function readTypeDefs(typeDefs: string): V7Model {\n const doc = parse(typeDefs);\n const objects: ObjectTypeDefinitionNode[] = [];\n const enums = new Map<string, EnumType>();\n for (const def of doc.definitions) {\n switch (def.kind) {\n case Kind.OBJECT_TYPE_DEFINITION:\n objects.push(def);\n break;\n case Kind.ENUM_TYPE_DEFINITION:\n enums.set(def.name.value, {\n name: def.name.value,\n description: def.description?.value,\n values: (def.values ?? []).map((v) => ({\n name: v.name.value,\n description: v.description?.value,\n deprecated: deprecationReason(v.directives),\n })),\n });\n break;\n case Kind.SCALAR_TYPE_DEFINITION:\n if (!(SUPPORTED_SCALARS as readonly string[]).includes(def.name.value)) {\n throw new UnsupportedTypeDefsError(\n `scalar ${def.name.value}: custom scalars are not supported by @cyphra/graphql yet.`,\n );\n }\n break;\n case Kind.DIRECTIVE_DEFINITION:\n break;\n default:\n throw new UnsupportedTypeDefsError(\n `${def.kind}${\"name\" in def && def.name ? ` ${def.name.value}` : \"\"}: not supported by @cyphra/graphql yet (only object types, enums and relationship properties).`,\n );\n }\n }\n const enumNames = new Set(enums.keys());\n\n const properties = new Map<string, PropertiesType>();\n const nodeDefs: ObjectTypeDefinitionNode[] = [];\n for (const o of objects) {\n const name = o.name.value;\n if ([\"Query\", \"Mutation\", \"Subscription\"].includes(name)) {\n throw new UnsupportedTypeDefsError(\n `type ${name}: custom root fields are not supported by @cyphra/graphql yet.`,\n );\n }\n if (o.interfaces?.length) {\n throw new UnsupportedTypeDefsError(\n `type ${name}: interfaces are not supported by @cyphra/graphql yet.`,\n );\n }\n for (const d of o.directives ?? []) {\n if (!ACCEPTED_TYPE_DIRECTIVES.has(d.name.value)) {\n throw new UnsupportedTypeDefsError(\n `type ${name}: @${d.name.value} is not supported by @cyphra/graphql yet.`,\n );\n }\n }\n if (directive(o.directives, \"jwt\")) continue;\n if (directive(o.directives, \"relationshipProperties\")) {\n properties.set(name, {\n name,\n attributes: (o.fields ?? []).map((f) => readAttribute(name, f, enumNames)),\n });\n continue;\n }\n if (!directive(o.directives, \"node\")) {\n throw new UnsupportedTypeDefsError(\n `type ${name}: object types without @node are not supported by @cyphra/graphql yet.`,\n );\n }\n nodeDefs.push(o);\n }\n const nodeNames = new Set(nodeDefs.map((o) => o.name.value));\n\n const nodes: NodeType[] = nodeDefs.map((o) => {\n const name = o.name.value;\n const attributes: Attribute[] = [];\n const relationships: Relationship[] = [];\n for (const f of o.fields ?? []) {\n const rel = directive(f.directives, \"relationship\");\n if (!rel) {\n attributes.push(readAttribute(name, f, enumNames));\n continue;\n }\n const t = typeRef(f.type);\n if (!nodeNames.has(t.name)) {\n throw new UnsupportedTypeDefsError(\n `${name}.${f.name.value}: relationships to ${t.name} are not supported by @cyphra/graphql yet (target must be a @node type).`,\n );\n }\n for (const a of rel.arguments ?? []) {\n if (![\"type\", \"direction\", \"properties\"].includes(a.name.value)) {\n throw new UnsupportedTypeDefsError(\n `${name}.${f.name.value}: @relationship(${a.name.value}) is not supported by @cyphra/graphql yet.`,\n );\n }\n }\n const props = stringArg(rel, \"properties\");\n if (props && !properties.has(props)) {\n throw new UnsupportedTypeDefsError(\n `${name}.${f.name.value}: properties type ${props} must be a @relationshipProperties type.`,\n );\n }\n relationships.push({\n name: f.name.value,\n source: name,\n target: t.name,\n type: stringArg(rel, \"type\") ?? \"\",\n direction: stringArg(rel, \"direction\") === \"IN\" ? \"IN\" : \"OUT\",\n properties: props,\n list: t.list,\n required: t.required,\n elementRequired: t.elementRequired,\n description: f.description?.value,\n deprecated: deprecationReason(f.directives),\n });\n }\n const nodeDir = directive(o.directives, \"node\");\n const labels = listArg(nodeDir, \"labels\") ?? [name];\n const pluralDir = directive(o.directives, \"plural\");\n const plural = entityPlural(name, stringArg(pluralDir, \"value\"));\n const authn = directive(o.directives, \"authentication\");\n return {\n name,\n description: o.description?.value,\n labels,\n plural,\n pascalPlural: upperFirst(plural),\n attributes,\n relationships,\n auth: {\n authentication: authn ? (listArg(authn, \"operations\") ?? ALL_OPERATIONS) : undefined,\n authorization: !!directive(o.directives, \"authorization\"),\n },\n };\n });\n\n const byName = new Map(nodes.map((n) => [n.name, n]));\n return {\n nodes,\n properties,\n enums,\n node(name: string): NodeType {\n const n = byName.get(name);\n if (!n) throw new Error(`Unknown node type ${name}`);\n return n;\n },\n };\n}\n\n/** Whether READ on this type needs authentication or authorization (#74, not implemented yet). */\nexport function readNeedsAuth(node: NodeType): boolean {\n return node.auth.authorization || (node.auth.authentication?.includes(\"READ\") ?? false);\n}\n","/**\n * Type and field names generated by `@neo4j/graphql` v7, derived from the type definitions.\n *\n * @packageDocumentation\n */\n\nimport pluralizeLib from \"pluralize\";\n\nexport function upperFirst(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n/**\n * `camelcase` as used by v7 for entity names: `Movie` → `movie`, `OrderLine` → `orderLine`,\n * `HTTPServer` → `httpServer`, `my_type` → `myType`. Leading underscores are kept by the callers.\n */\nexport function camelCase(input: string): string {\n const s = input.replace(/^_+/, \"\");\n const words = s\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/([A-Z]+)([A-Z][a-z])/g, \"$1 $2\")\n .split(/[\\s_\\-.]+/)\n .filter(Boolean);\n return words.map((w, i) => (i === 0 ? w.toLowerCase() : upperFirst(w.toLowerCase()))).join(\"\");\n}\n\nfunction leadingUnderscores(name: string): string {\n return /^_+/.exec(name)?.[0] ?? \"\";\n}\n\n/** `pluralize` (the npm package v7 uses), exposed for descriptions such as \"related People\". */\nexport function pluralize(word: string): string {\n return pluralizeLib(word);\n}\n\n/** Root field plural: `Movie` → `movies`, `Person` → `people`. `@plural(value)` wins. */\nexport function entityPlural(name: string, pluralOverride?: string): string {\n if (pluralOverride !== undefined)\n return `${leadingUnderscores(pluralOverride)}${camelCase(pluralOverride)}`;\n return `${leadingUnderscores(name)}${pluralizeLib(camelCase(name))}`;\n}\n","/** Parameters and fresh variable names for one Cypher statement. */\nexport class CypherContext {\n readonly params: Record<string, unknown> = {};\n private paramCount = 0;\n private varCount = 0;\n\n /** Bind a value and return its `$placeholder`. */\n param(value: unknown): string {\n const key = `p${this.paramCount++}`;\n this.params[key] = value;\n return `$${key}`;\n }\n\n /** Fresh variable name, e.g. `this0`. */\n variable(prefix = \"this\"): string {\n return `${prefix}${this.varCount++}`;\n }\n}\n\n/** Quote an identifier (label, property key, relationship type, map key) for Cypher. */\nexport function q(id: string): string {\n return \"`\" + id.replace(/`/g, \"``\") + \"`\";\n}\n\n/** `:`A`:`B`` for a list of labels. */\nexport function labels(ls: readonly string[]): string {\n return ls.map((l) => `:${q(l)}`).join(\"\");\n}\n\nexport type ListAggregate = \"min\" | \"max\" | \"sum\" | \"avg\";\n\n/**\n * `min` / `max` / `sum` / `avg` of the list `l` as a plain expression. Aggregating functions cannot\n * be used inside a correlated `COLLECT { … }` of a projection (Neo4j reports implicit grouping keys),\n * so aggregates collect the values and reduce the list. Like the Cypher aggregates: `sum([])` is 0,\n * the others are `null`; `avg` is a Float (`toFloat(sum) / size`).\n */\nexport function listAggregate(fn: ListAggregate, l: string): string {\n const sum = `reduce(acc = 0, x IN ${l} | acc + x)`;\n switch (fn) {\n case \"min\":\n return `reduce(acc = null, x IN ${l} | CASE WHEN acc IS NULL OR x < acc THEN x ELSE acc END)`;\n case \"max\":\n return `reduce(acc = null, x IN ${l} | CASE WHEN acc IS NULL OR x > acc THEN x ELSE acc END)`;\n case \"sum\":\n return sum;\n case \"avg\":\n return `CASE size(${l}) WHEN 0 THEN null ELSE toFloat(${sum}) / size(${l}) END`;\n }\n}\n\n/** `[l IN [<list>] | <body(l)>][0]`: binds `list` once to use it in several expressions. */\nexport function withList(list: string, l: string, body: (l: string) => string): string {\n return `[${l} IN [${list}] | ${body(l)}][0]`;\n}\n","/**\n * Compiles v7 `where` inputs to Cypher predicates.\n *\n * Semantics follow `@neo4j/graphql` 7.6 (checked by the compatibility suite):\n * - several keys in one object are combined with `AND`; `AND` / `OR` / `NOT` nest;\n * - `{ eq: null }` matches a missing property (`IS NULL`);\n * - relationship quantifiers: `some`, `none` and `single` with an empty filter (`{}`) are ignored\n * (they match every node); `all` requires at least one related node and is not vacuously true;\n * - deprecated `field_OPERATOR` keys (`title_CONTAINS`, `actors_SOME`, …) behave like the generic form;\n * - aggregation filters (`actorsConnection: { aggregate: … }` and the deprecated `actorsAggregate`):\n * each comparison aggregates the related nodes / relationships in its own subquery and compares\n * the result (an empty set gives `count` 0, `sum` 0 and `null` for the other aggregates, which\n * matches nothing, even under `NOT`). In the connection form, `count.nodes` and `node` aggregates\n * run over distinct nodes; `count.edges`, `edge` and the deprecated form do not deduplicate.\n *\n * Every value becomes a parameter; every identifier comes from the type definitions and is quoted.\n *\n * @packageDocumentation\n */\n\nimport neo4j from \"neo4j-driver\";\nimport { FOLLOW_UP, notImplemented } from \"../errors.js\";\nimport type { Attribute, NodeType, PropertiesType, Relationship, V7Model } from \"../model.js\";\nimport {\n type CypherContext,\n labels,\n listAggregate,\n q,\n withList,\n type ListAggregate,\n} from \"./context.js\";\n\ntype AnyRecord = Record<string, unknown>;\n\nconst LEGACY_OPERATORS: Record<string, string> = {\n EQ: \"eq\",\n IN: \"in\",\n INCLUDES: \"includes\",\n CONTAINS: \"contains\",\n STARTS_WITH: \"startsWith\",\n ENDS_WITH: \"endsWith\",\n LT: \"lt\",\n LTE: \"lte\",\n GT: \"gt\",\n GTE: \"gte\",\n};\n\nconst QUANTIFIER_KEYS: Record<string, Quantifier> = {\n ALL: \"all\",\n NONE: \"none\",\n SINGLE: \"single\",\n SOME: \"some\",\n};\n\ntype Quantifier = \"all\" | \"none\" | \"single\" | \"some\";\n\nfunction isPlainObject(v: unknown): v is AnyRecord {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\nfunction and(parts: (string | undefined)[]): string | undefined {\n const ps = parts.filter((p): p is string => p !== undefined);\n if (ps.length === 0) return undefined;\n if (ps.length === 1) return ps[0];\n return ps.map((p) => `(${p})`).join(\" AND \");\n}\n\n/** Encode one input value for the attribute's type (Int → driver integer, …). */\nexport function encodeValue(attr: Attribute, value: unknown): unknown {\n if (value === null || value === undefined) return null;\n if (Array.isArray(value)) return value.map((v) => encodeValue(attr, v));\n if (attr.kind === \"scalar\" && attr.type.name === \"Int\" && typeof value === \"number\") {\n return neo4j.int(value);\n }\n return value;\n}\n\n/** `expr`, or `datetime(expr)` / `[x IN expr | datetime(x)]` for DateTime values (passed as strings). */\nexport function castValue(attr: Attribute, expr: string, isList: boolean): string {\n if (attr.kind === \"scalar\" && attr.type.name === \"DateTime\") {\n return isList ? `[x IN ${expr} | datetime(x)]` : `datetime(${expr})`;\n }\n return expr;\n}\n\n/** The value as a parameter, cast for its type (see {@link castValue}). */\nexport function valueExpr(\n ctx: CypherContext,\n attr: Attribute,\n value: unknown,\n isList: boolean,\n): string {\n return castValue(attr, ctx.param(encodeValue(attr, value)), isList);\n}\n\nfunction attributePredicate(\n ctx: CypherContext,\n expr: string,\n attr: Attribute,\n op: string,\n value: unknown,\n): string | undefined {\n if (value === undefined) return undefined;\n if (op === \"eq\" && value === null) return `${expr} IS NULL`;\n if (value === null) return undefined;\n if (attr.type.list) {\n switch (op) {\n case \"eq\":\n return `${expr} = ${valueExpr(ctx, attr, value, true)}`;\n case \"includes\":\n return `${valueExpr(ctx, attr, value, false)} IN ${expr}`;\n }\n throw new Error(`Unsupported list filter operator ${op}`);\n }\n switch (op) {\n case \"eq\":\n return `${expr} = ${valueExpr(ctx, attr, value, false)}`;\n case \"in\":\n return `${expr} IN ${valueExpr(ctx, attr, value, true)}`;\n case \"contains\":\n return `${expr} CONTAINS ${valueExpr(ctx, attr, value, false)}`;\n case \"startsWith\":\n return `${expr} STARTS WITH ${valueExpr(ctx, attr, value, false)}`;\n case \"endsWith\":\n return `${expr} ENDS WITH ${valueExpr(ctx, attr, value, false)}`;\n case \"lt\":\n return `${expr} < ${valueExpr(ctx, attr, value, false)}`;\n case \"lte\":\n return `${expr} <= ${valueExpr(ctx, attr, value, false)}`;\n case \"gt\":\n return `${expr} > ${valueExpr(ctx, attr, value, false)}`;\n case \"gte\":\n return `${expr} >= ${valueExpr(ctx, attr, value, false)}`;\n }\n throw new Error(`Unsupported filter operator ${op}`);\n}\n\n/** Predicates on the attributes of a node or relationship (`variable.property`). */\nfunction attributeFilter(\n ctx: CypherContext,\n variable: string,\n attributes: readonly Attribute[],\n key: string,\n value: unknown,\n): { handled: boolean; predicate?: string } {\n const direct = attributes.find((a) => a.name === key);\n if (direct) {\n if (value === null || value === undefined) return { handled: true };\n if (direct.cypher) throw notImplemented(`filtering on @cypher field ${key}`, FOLLOW_UP.cypher);\n const expr = `${variable}.${q(direct.property)}`;\n const preds = Object.entries(value as AnyRecord).map(([op, v]) =>\n attributePredicate(ctx, expr, direct, op, v),\n );\n return { handled: true, predicate: and(preds) };\n }\n const m = /^(.+)_([A-Z_]+)$/.exec(key);\n if (m) {\n const attr = attributes.find((a) => a.name === m[1]);\n const op = LEGACY_OPERATORS[m[2]!];\n if (attr && op) {\n if (attr.cypher)\n throw notImplemented(`filtering on @cypher field ${attr.name}`, FOLLOW_UP.cypher);\n return {\n handled: true,\n predicate: attributePredicate(ctx, `${variable}.${q(attr.property)}`, attr, op, value),\n };\n }\n }\n return { handled: false };\n}\n\nfunction logical(\n where: AnyRecord,\n key: string,\n compile: (w: AnyRecord) => string | undefined,\n): { handled: boolean; predicate?: string } {\n const value = where[key];\n if (key === \"AND\" || key === \"OR\") {\n if (!Array.isArray(value)) return { handled: true };\n const parts = value.filter(isPlainObject).map(compile);\n if (key === \"AND\") return { handled: true, predicate: and(parts) };\n // An empty member of OR matches everything.\n if (parts.length === 0) return { handled: true };\n if (parts.some((p) => p === undefined)) return { handled: true, predicate: \"true\" };\n return {\n handled: true,\n predicate: parts.length === 1 ? parts[0] : parts.map((p) => `(${p})`).join(\" OR \"),\n };\n }\n if (key === \"NOT\") {\n if (!isPlainObject(value)) return { handled: true };\n const inner = compile(value);\n return { handled: true, predicate: inner === undefined ? undefined : `NOT (${inner})` };\n }\n return { handled: false };\n}\n\n/** Pattern from `from` along relationship `rel` to `(to:Target)`, binding the edge to `relVar`. */\nexport function relationshipPattern(\n model: V7Model,\n from: string,\n rel: Relationship,\n to: string,\n relVar = \"\",\n): string {\n const target = model.node(rel.target);\n const edge = `[${relVar}:${q(rel.type)}]`;\n const end = `(${to}${labels(target.labels)})`;\n return rel.direction === \"OUT\" ? `(${from})-${edge}->${end}` : `(${from})<-${edge}-${end}`;\n}\n\nfunction quantified(\n pattern: string,\n quantifier: Quantifier,\n predicate: string | undefined,\n): string | undefined {\n // `{}` inside some / none / single / all: the filter is ignored (v7 behaviour).\n if (predicate === undefined) return undefined;\n switch (quantifier) {\n case \"some\":\n return `EXISTS { MATCH ${pattern} WHERE ${predicate} }`;\n case \"none\":\n return `NOT EXISTS { MATCH ${pattern} WHERE ${predicate} }`;\n case \"single\":\n return `COUNT { MATCH ${pattern} WHERE ${predicate} } = 1`;\n case \"all\":\n return `EXISTS { MATCH ${pattern} } AND NOT EXISTS { MATCH ${pattern} WHERE NOT (${predicate}) }`;\n }\n}\n\ntype AggregateScope = { pattern: string; nodeVar: string; relVar: string };\n\n/** Comparison keys of aggregation filters, generic and deprecated (`_EQUAL`, `count_EQ`). */\nconst AGGREGATION_COMPARISON: Record<string, string> = {\n EQ: \"eq\",\n EQUAL: \"eq\",\n GT: \"gt\",\n GTE: \"gte\",\n LT: \"lt\",\n LTE: \"lte\",\n};\n\nconst GENERIC_AGGREGATES: Record<string, ListAggregate> = {\n average: \"avg\",\n averageLength: \"avg\",\n min: \"min\",\n shortest: \"min\",\n shortestLength: \"min\",\n max: \"max\",\n longest: \"max\",\n longestLength: \"max\",\n sum: \"sum\",\n};\n\nconst LEGACY_AGGREGATES: Record<string, ListAggregate> = {\n AVERAGE: \"avg\",\n MIN: \"min\",\n SHORTEST: \"min\",\n MAX: \"max\",\n LONGEST: \"max\",\n SUM: \"sum\",\n};\n\nconst COMPARISON_OPERATORS: Record<string, string> = {\n eq: \"=\",\n gt: \">\",\n gte: \">=\",\n lt: \"<\",\n lte: \"<=\",\n};\n\n/**\n * `expr <op> $p` for an aggregation filter. Numbers are passed as they come (an `average` filter\n * on an Int field takes a Float); DateTime values go through `datetime()`.\n */\nfunction comparison(\n ctx: CypherContext,\n expr: string,\n op: string,\n value: unknown,\n attr: Attribute | undefined,\n): string | undefined {\n if (value === undefined || value === null) return undefined;\n const cmp = COMPARISON_OPERATORS[op];\n if (!cmp) throw new Error(`Invalid aggregation filter operator ${op}`);\n const p = ctx.param(value);\n const isDateTime = attr?.kind === \"scalar\" && attr.type.name === \"DateTime\";\n return `${expr} ${cmp} ${isDateTime ? `datetime(${p})` : p}`;\n}\n\nexport class WhereCompiler {\n constructor(\n private readonly model: V7Model,\n private readonly ctx: CypherContext,\n /** Called for every node type a filter traverses (authorization is not implemented yet). */\n private readonly onTraverse: (node: NodeType) => void = () => {},\n ) {}\n\n /** Predicate for a `${Node}Where` input on `variable`, or `undefined` when it filters nothing. */\n node(variable: string, node: NodeType, where: unknown): string | undefined {\n if (!isPlainObject(where)) return undefined;\n const parts: (string | undefined)[] = [];\n for (const [key, value] of Object.entries(where)) {\n if (value === undefined) continue;\n const l = logical(where, key, (w) => this.node(variable, node, w));\n if (l.handled) {\n parts.push(l.predicate);\n continue;\n }\n const a = attributeFilter(this.ctx, variable, node.attributes, key, value);\n if (a.handled) {\n parts.push(a.predicate);\n continue;\n }\n parts.push(this.relationshipFilter(variable, node, key, value));\n }\n return and(parts);\n }\n\n private relationshipFilter(\n variable: string,\n node: NodeType,\n key: string,\n value: unknown,\n ): string | undefined {\n const find = (name: string) => node.relationships.find((r) => r.name === name);\n // `actors: { some: … }`\n let rel = find(key);\n if (rel) {\n if (!isPlainObject(value)) return undefined;\n return and(\n Object.entries(value).map(([q, w]) => this.related(variable, rel!, q as Quantifier, w)),\n );\n }\n // `actorsConnection: { some: … , aggregate: … }`\n if (key.endsWith(\"Connection\") && (rel = find(key.slice(0, -\"Connection\".length)))) {\n if (!isPlainObject(value)) return undefined;\n return and(\n Object.entries(value).map(([q, w]) => {\n if (q === \"aggregate\") return this.aggregate(variable, rel!, w, false);\n return this.relatedConnection(variable, rel!, q as Quantifier, w);\n }),\n );\n }\n if (key.endsWith(\"Aggregate\") && (rel = find(key.slice(0, -\"Aggregate\".length)))) {\n return this.aggregate(variable, rel, value, true);\n }\n // Deprecated `actors_SOME` / `actorsConnection_SOME`.\n const m = /^(.+)_(ALL|NONE|SINGLE|SOME)$/.exec(key);\n if (m) {\n const quantifier = QUANTIFIER_KEYS[m[2]!]!;\n if ((rel = find(m[1]!))) return this.related(variable, rel, quantifier, value);\n if (m[1]!.endsWith(\"Connection\") && (rel = find(m[1]!.slice(0, -\"Connection\".length)))) {\n return this.relatedConnection(variable, rel, quantifier, value);\n }\n }\n throw new Error(`Unknown filter ${node.name}Where.${key}`);\n }\n\n private related(\n variable: string,\n rel: Relationship,\n quantifier: Quantifier,\n where: unknown,\n ): string | undefined {\n if (!isPlainObject(where)) return undefined;\n const m = this.ctx.variable(\"n\");\n const target = this.model.node(rel.target);\n this.onTraverse(target);\n return quantified(\n relationshipPattern(this.model, variable, rel, m),\n quantifier,\n this.node(m, target, where),\n );\n }\n\n private relatedConnection(\n variable: string,\n rel: Relationship,\n quantifier: Quantifier,\n where: unknown,\n ): string | undefined {\n if (!isPlainObject(where)) return undefined;\n const m = this.ctx.variable(\"n\");\n const r = this.ctx.variable(\"r\");\n this.onTraverse(this.model.node(rel.target));\n return quantified(\n relationshipPattern(this.model, variable, rel, m, r),\n quantifier,\n this.connection(r, m, rel, where),\n );\n }\n\n /**\n * Predicate for a `${Source}${Rel}ConnectionAggregateInput` (`deprecated`: `${…}AggregateInput`,\n * the `actorsAggregate` form): `count`, `node`, `edge`, combined with AND / OR / NOT.\n */\n private aggregate(\n variable: string,\n rel: Relationship,\n where: unknown,\n deprecated: boolean,\n ): string | undefined {\n if (!isPlainObject(where)) return undefined;\n const target = this.model.node(rel.target);\n this.onTraverse(target);\n const m = this.ctx.variable(\"n\");\n const r = this.ctx.variable(\"r\");\n const pattern = relationshipPattern(this.model, variable, rel, m, r);\n const scope: AggregateScope = { pattern, nodeVar: m, relVar: r };\n const compile = (w: AnyRecord): string | undefined => {\n const parts: (string | undefined)[] = [];\n for (const [key, value] of Object.entries(w)) {\n if (value === undefined || value === null) continue;\n const l = logical(w, key, compile);\n if (l.handled) {\n parts.push(l.predicate);\n continue;\n }\n if (key === \"count\") {\n if (!isPlainObject(value)) continue;\n if (deprecated) {\n parts.push(this.countFilter(scope, false, value));\n continue;\n }\n for (const [what, filters] of Object.entries(value)) {\n if (!isPlainObject(filters)) continue;\n if (what === \"nodes\") parts.push(this.countFilter(scope, true, filters));\n else if (what === \"edges\") parts.push(this.countFilter(scope, false, filters));\n else throw new Error(`Unknown aggregation count filter ${what}`);\n }\n continue;\n }\n const legacyCount = /^count_(EQ|GT|GTE|LT|LTE)$/.exec(key);\n if (legacyCount) {\n parts.push(\n this.countFilter(scope, false, {\n [AGGREGATION_COMPARISON[legacyCount[1]!]!]: value,\n }),\n );\n continue;\n }\n if (key === \"node\") {\n parts.push(this.aggregationWhere(scope, target.attributes, \"node\", !deprecated, value));\n continue;\n }\n if (key === \"edge\") {\n const props = this.model.properties.get(rel.properties ?? \"\");\n if (!props) throw new Error(`Unknown aggregation filter ${key}`);\n parts.push(this.aggregationWhere(scope, props.attributes, \"edge\", false, value));\n continue;\n }\n throw new Error(`Unknown aggregation filter ${key}`);\n }\n return and(parts);\n };\n return compile(where);\n }\n\n /** `count` filters: `COUNT { … } >= $p` (one row per relationship, or per distinct node). */\n private countFilter(\n scope: AggregateScope,\n distinct: boolean,\n filters: AnyRecord,\n ): string | undefined {\n const count = distinct\n ? `COUNT { MATCH ${scope.pattern} WITH DISTINCT ${scope.nodeVar} RETURN ${scope.nodeVar} }`\n : `COUNT { MATCH ${scope.pattern} }`;\n return and(\n Object.entries(filters).map(([op, v]) => comparison(this.ctx, count, op, v, undefined)),\n );\n }\n\n /** `${…}NodeAggregationWhereInput` / `${Properties}AggregationWhereInput`. */\n private aggregationWhere(\n scope: AggregateScope,\n attributes: readonly Attribute[],\n on: \"node\" | \"edge\",\n distinct: boolean,\n where: unknown,\n ): string | undefined {\n if (!isPlainObject(where)) return undefined;\n const parts: (string | undefined)[] = [];\n for (const [key, value] of Object.entries(where)) {\n if (value === undefined || value === null) continue;\n const l = logical(where, key, (w) =>\n this.aggregationWhere(scope, attributes, on, distinct, w),\n );\n if (l.handled) {\n parts.push(l.predicate);\n continue;\n }\n const direct = attributes.find((a) => a.name === key);\n if (direct) {\n if (!isPlainObject(value)) continue;\n for (const [aggOp, filters] of Object.entries(value)) {\n if (!isPlainObject(filters)) continue;\n const fn = GENERIC_AGGREGATES[aggOp];\n if (!fn) throw new Error(`Invalid aggregation operator ${aggOp}`);\n const agg = this.aggregated(scope, direct, on, distinct, fn);\n for (const [op, v] of Object.entries(filters)) {\n parts.push(comparison(this.ctx, agg, op, v, direct));\n }\n }\n continue;\n }\n const m =\n /^(.+?)_(AVERAGE|MAX|MIN|SUM|SHORTEST|LONGEST)(?:_LENGTH)?_(EQUAL|GT|GTE|LT|LTE)$/.exec(\n key,\n );\n const attr = m && attributes.find((a) => a.name === m[1]);\n if (!m || !attr) throw new Error(`Unknown aggregation filter ${key}`);\n const agg = this.aggregated(scope, attr, on, distinct, LEGACY_AGGREGATES[m[2]!]!);\n parts.push(comparison(this.ctx, agg, AGGREGATION_COMPARISON[m[3]!]!, value, attr));\n }\n return and(parts);\n }\n\n /** `min` / `max` / … of the related values (`COLLECT { MATCH … RETURN n.born }`); strings: `size()`. */\n private aggregated(\n scope: AggregateScope,\n attr: Attribute,\n on: \"node\" | \"edge\",\n distinct: boolean,\n fn: ListAggregate,\n ): string {\n const v = on === \"node\" ? scope.nodeVar : scope.relVar;\n const prop = `${v}.${q(attr.property)}`;\n const expr = attr.kind === \"scalar\" && attr.type.name === \"String\" ? `size(${prop})` : prop;\n const dedupe = distinct ? ` WITH DISTINCT ${v}` : \"\";\n const list = `COLLECT { MATCH ${scope.pattern}${dedupe} WITH ${v} WHERE ${prop} IS NOT NULL RETURN ${expr} }`;\n return withList(list, this.ctx.variable(\"list\"), (l) => listAggregate(fn, l));\n }\n\n /** Predicate for a `${Source}${Rel}ConnectionWhere` input (`node` / `edge`, AND / OR / NOT). */\n connection(\n relVar: string,\n nodeVar: string,\n rel: Relationship,\n where: unknown,\n ): string | undefined {\n if (!isPlainObject(where)) return undefined;\n const parts: (string | undefined)[] = [];\n for (const [key, value] of Object.entries(where)) {\n if (value === undefined) continue;\n const l = logical(where, key, (w) => this.connection(relVar, nodeVar, rel, w));\n if (l.handled) {\n parts.push(l.predicate);\n continue;\n }\n if (key === \"node\") {\n parts.push(this.node(nodeVar, this.model.node(rel.target), value));\n continue;\n }\n if (key === \"edge\") {\n const props = this.model.properties.get(rel.properties ?? \"\");\n if (props) parts.push(this.edge(relVar, props, value));\n continue;\n }\n throw new Error(`Unknown connection filter ${key}`);\n }\n return and(parts);\n }\n\n /** Predicate for a `${Properties}Where` input on a relationship variable. */\n edge(relVar: string, props: PropertiesType, where: unknown): string | undefined {\n if (!isPlainObject(where)) return undefined;\n const parts: (string | undefined)[] = [];\n for (const [key, value] of Object.entries(where)) {\n if (value === undefined) continue;\n const l = logical(where, key, (w) => this.edge(relVar, props, w));\n if (l.handled) {\n parts.push(l.predicate);\n continue;\n }\n const a = attributeFilter(this.ctx, relVar, props.attributes, key, value);\n if (!a.handled) throw new Error(`Unknown filter ${props.name}Where.${key}`);\n parts.push(a.predicate);\n }\n return and(parts);\n }\n}\n","/**\n * Compiles v7 root mutation fields (`createMovies`, `updateMovies`, `deleteMovies`) with their\n * nested writes and the response selection into one Cypher statement each.\n *\n * Semantics follow `@neo4j/graphql` 7.6 (checked by the compatibility suite):\n * - `create`: every input becomes a node (`@id` fields get `randomUUID()`, `@timestamp` fields with\n * the CREATE operation `datetime()`; `@default` values come from the input defaults); nested\n * `create` runs before nested `connect`;\n * - `update`: scalar operators (`set`, `add`, `subtract`, `multiply`, `divide`, `push`, `pop` and the\n * deprecated `field_SET`, `field_INCREMENT`, …) are applied first, with UPDATE `@timestamp`\n * fields; then each relationship field, element by element, in the v7 order `update`, `create`,\n * `connect`, `delete`, `disconnect`. Nested `update` also refreshes the UPDATE timestamps of the\n * related node and of the edge;\n * - `connect` creates a relationship to every node matching `where` (like v7 it is a `CREATE`, not a\n * `MERGE`: connecting an already connected pair adds a second relationship), and does not fill\n * `@id` / `@timestamp` edge properties (v7 only does on nested `create`);\n * - `disconnect` deletes the matching relationships; `delete` deletes the matching nodes and,\n * through nested `delete`, nodes related to them (all matched before anything is deleted);\n * - `info` counters are computed in the statement: nodes and relationships created by `CREATE`,\n * relationships removed by `disconnect`, and the distinct nodes deleted with every relationship\n * attached to them.\n *\n * The response (`movies { … }`) is projected with the read compiler after every write of the\n * statement (the `collect` before the projection waits for all of them).\n *\n * @packageDocumentation\n */\n\nimport { GraphQLError, type FieldNode } from \"graphql\";\nimport { isInt } from \"neo4j-driver\";\nimport { FOLLOW_UP, notImplemented } from \"../errors.js\";\nimport type { Attribute, NodeType, PropertiesType, Relationship, V7Model } from \"../model.js\";\nimport { labels, q, type CypherContext } from \"./context.js\";\nimport { collectFields, subSelections, SelectionCompiler, type SelectionInfo } from \"./select.js\";\nimport { castValue, encodeValue, relationshipPattern, valueExpr, WhereCompiler } from \"./where.js\";\n\ntype AnyRecord = Record<string, unknown>;\n\nexport type CompiledMutation = {\n readonly cypher: string;\n readonly params: Record<string, unknown>;\n /**\n * Turns the returned records (`this` column) into the field's GraphQL value. Runs inside the\n * transaction: it throws (and the transaction is rolled back) when a v7 check failed.\n */\n readonly decode: (rows: readonly unknown[]) => unknown;\n};\n\ntype Counter = \"nc\" | \"nd\" | \"rc\" | \"rd\";\nconst COUNTER_KEYS: Record<string, Counter> = {\n nodesCreated: \"nc\",\n nodesDeleted: \"nd\",\n relationshipsCreated: \"rc\",\n relationshipsDeleted: \"rd\",\n};\nconst ALL_COUNTERS: readonly Counter[] = [\"nc\", \"nd\", \"rc\", \"rd\"];\n\n/** Order v7 applies the operations of one `${Source}${Rel}UpdateFieldInput` element in. */\nconst ELEMENT_OPERATIONS = [\"update\", \"create\", \"connect\", \"delete\", \"disconnect\"] as const;\n\nconst LEGACY_UPDATE_OPERATORS: Record<string, string> = {\n SET: \"set\",\n PUSH: \"push\",\n POP: \"pop\",\n INCREMENT: \"add\",\n DECREMENT: \"subtract\",\n ADD: \"add\",\n SUBTRACT: \"subtract\",\n MULTIPLY: \"multiply\",\n DIVIDE: \"divide\",\n};\n\nfunction isPlainObject(v: unknown): v is AnyRecord {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\nfunction asList(v: unknown): unknown[] {\n if (v === null || v === undefined) return [];\n return Array.isArray(v) ? v : [v];\n}\n\n/**\n * The clauses of one (sub)query and, per counter, the expressions each of its rows adds. A block\n * becomes `CALL (imports) { <clauses> RETURN {nc: sum(…), …} AS count }`: the aggregation keeps\n * exactly one row per outer row, whatever the block matched.\n */\nclass Block {\n readonly clauses: string[] = [];\n readonly terms: Record<Counter, string[]> = { nc: [], nd: [], rc: [], rd: [] };\n /** Per row: lists of the error messages of failed checks (see `checkExpr`). */\n readonly errors: string[] = [];\n\n add(clause: string): void {\n this.clauses.push(clause);\n }\n\n count(counter: Counter, term: string): void {\n this.terms[counter].push(term);\n }\n\n /** Checks evaluated on each row after the writes: `CASE WHEN … THEN <message> END`. */\n check(checks: readonly string[]): void {\n if (checks.length) this.errors.push(`[x IN [${checks.join(\", \")}] WHERE x IS NOT NULL]`);\n }\n\n hasCounts(): boolean {\n return this.errors.length > 0 || ALL_COUNTERS.some((k) => this.terms[k].length > 0);\n }\n\n /** `{ nc: sum(…), …, errors: … }` over the rows of the block (`aggregate`), or of its one row. */\n aggregate(aggregate = true): string {\n const total = (k: Counter) => this.terms[k].join(\" + \") || \"0\";\n const items = ALL_COUNTERS.map((k) => `${k}: ${aggregate ? `sum(${total(k)})` : total(k)}`);\n if (this.errors.length) {\n const errors = this.errors.join(\" + \");\n items.push(\n `errors: ${aggregate ? `reduce(acc = [], l IN collect(${errors}) | acc + l)` : errors}`,\n );\n }\n return `{ ${items.join(\", \")} }`;\n }\n}\n\nfunction indent(lines: readonly string[]): string {\n return lines\n .join(\"\\n\")\n .split(\"\\n\")\n .map((l) => ` ${l}`)\n .join(\"\\n\");\n}\n\n/** `(from)<-[r:TYPE]-(to)` between bound variables. */\nfunction edgePattern(from: string, rel: Relationship, relVar: string, to: string): string {\n const edge = `[${relVar}:${q(rel.type)}]`;\n return rel.direction === \"OUT\" ? `(${from})-${edge}->(${to})` : `(${from})<-${edge}-(${to})`;\n}\n\n/** Value of a generated property (`@id`, `@timestamp`). */\nfunction generatedValue(a: Attribute): string {\n if (a.id) return \"randomUUID()\";\n return a.type.name === \"Date\" ? \"date()\" : \"datetime()\";\n}\n\nfunction onCreateGenerated(variable: string, attributes: readonly Attribute[]): string[] {\n return attributes\n .filter((a) => !a.cypher && (a.id || a.timestamp?.includes(\"CREATE\")))\n .map((a) => `${variable}.${q(a.property)} = ${generatedValue(a)}`);\n}\n\nfunction onUpdateGenerated(variable: string, attributes: readonly Attribute[]): string[] {\n return attributes\n .filter((a) => !a.cypher && !a.id && a.timestamp?.includes(\"UPDATE\"))\n .map((a) => `${variable}.${q(a.property)} = ${generatedValue(a)}`);\n}\n\n/** `{ <response key>: count }` for the selected `info` / `DeleteInfo` fields. */\nfunction decodeCounts(\n fields: readonly (readonly [key: string, field: string])[],\n counts: AnyRecord,\n): AnyRecord {\n return Object.fromEntries(\n fields\n .filter(([, f]) => f in COUNTER_KEYS)\n .map(([k, f]) => {\n const v = counts[COUNTER_KEYS[f]!] ?? 0;\n return [k, isInt(v) ? v.toNumber() : Number(v)];\n }),\n );\n}\n\nexport class MutationCompiler {\n private readonly select: SelectionCompiler;\n private readonly where: WhereCompiler;\n private readonly ctx: CypherContext;\n\n constructor(\n private readonly model: V7Model,\n private readonly info: SelectionInfo,\n ) {\n this.select = new SelectionCompiler(model, info);\n this.ctx = this.select.ctx;\n this.where = new WhereCompiler(model, this.ctx, (n) => this.select.assertReadable(n));\n }\n\n private assertWritable(node: NodeType): void {\n if (node.auth.authorization || node.auth.authentication?.length) {\n throw notImplemented(\n `writing ${node.name}, which has @authentication / @authorization rules`,\n FOLLOW_UP.authorization,\n );\n }\n }\n\n private props(rel: Relationship): PropertiesType | undefined {\n return rel.properties ? this.model.properties.get(rel.properties) : undefined;\n }\n\n private relationship(node: NodeType, name: string): Relationship {\n const rel = node.relationships.find((r) => r.name === name);\n if (!rel) throw new Error(`Unknown relationship ${node.name}.${name}`);\n return rel;\n }\n\n /** Runs `inner` once per row of `outer` (`CALL (imports) { … }`) and adds its counts. */\n private call(outer: Block, imports: readonly string[], inner: Block): void {\n if (outer.clauses.length) outer.add(\"WITH *\");\n if (!inner.hasCounts()) {\n // Unit subquery: no counts to return, and it keeps the outer rows as they are.\n outer.add(`CALL (${imports.join(\", \")}) {\\n${indent(inner.clauses)}\\n}`);\n return;\n }\n const c = this.ctx.variable(\"count\");\n outer.add(\n `CALL (${imports.join(\", \")}) {\\n${indent(inner.clauses)}\\n RETURN ${inner.aggregate()} AS ${c}\\n}`,\n );\n for (const k of ALL_COUNTERS) if (inner.terms[k].length) outer.count(k, `${c}.${k}`);\n if (inner.errors.length) outer.errors.push(`${c}.errors`);\n }\n\n /** `SET` items for the attribute keys of a create input. */\n private createAssignments(\n variable: string,\n attributes: readonly Attribute[],\n input: unknown,\n owner: string,\n relationships: readonly Relationship[] = [],\n ): string[] {\n const sets: string[] = [];\n if (!isPlainObject(input)) return sets;\n for (const [key, value] of Object.entries(input)) {\n if (value === undefined || relationships.some((r) => r.name === key)) continue;\n const a = attributes.find((x) => x.name === key);\n if (!a) throw new Error(`Unknown field ${owner}CreateInput.${key}`);\n sets.push(`${variable}.${q(a.property)} = ${valueExpr(this.ctx, a, value, a.type.list)}`);\n }\n return sets;\n }\n\n /** `SET` items for the scalar operators of an update input (`{ set }`, `{ add }`, `title_SET`, …). */\n private updateAssignments(\n variable: string,\n attributes: readonly Attribute[],\n input: unknown,\n owner: string,\n checks: string[],\n relationships: readonly Relationship[] = [],\n ): string[] {\n if (!isPlainObject(input)) return [];\n const byAttribute = new Map<\n Attribute,\n { keys: string[]; ops: [op: string, label: string, value: unknown][] }\n >();\n for (const [key, value] of Object.entries(input)) {\n if (value === undefined || relationships.some((r) => r.name === key)) continue;\n let attr = attributes.find((a) => a.name === key);\n let ops: [string, string, unknown][];\n if (attr) {\n if (!isPlainObject(value)) continue;\n ops = Object.entries(value)\n .filter(([, v]) => v !== undefined)\n .map(([op, v]) => [op, op, v]);\n } else {\n const m = /^(.+)_([A-Z]+)$/.exec(key);\n attr = m ? attributes.find((a) => a.name === m[1]) : undefined;\n const op = m ? LEGACY_UPDATE_OPERATORS[m[2]!] : undefined;\n if (!attr || !op) throw new Error(`Unknown field ${owner}UpdateInput.${key}`);\n ops = [[op, m![2]!.toLowerCase(), value]];\n }\n const entry = byAttribute.get(attr) ?? { keys: [], ops: [] };\n entry.keys.push(key);\n entry.ops.push(...ops);\n byAttribute.set(attr, entry);\n }\n const sets: string[] = [];\n for (const [attr, { keys, ops }] of byAttribute) {\n if (keys.length > 1) {\n throw new GraphQLError(\n `Conflicting modification of ${keys.map((k) => `[[${k}]]`).join(\", \")} on type ${owner}`,\n );\n }\n const prop = `${variable}.${q(attr.property)}`;\n for (const [op, label, value] of ops) {\n sets.push(`${prop} = ${this.updateExpr(prop, attr, op, value)}`);\n const check = this.checkExpr(prop, attr, op, label, value);\n if (check) checks.push(check);\n }\n }\n return sets;\n }\n\n /**\n * The v7 checks of an operator, evaluated on the written value (v7 runs them with APOC; here the\n * statement returns the messages and the transaction is rolled back): arithmetic on a missing\n * value, Int results beyond 32 bits, `push` / `pop` on a missing list.\n */\n private checkExpr(\n prop: string,\n attr: Attribute,\n op: string,\n label: string,\n value: unknown,\n ): string | undefined {\n const type = attr.type.name;\n if (op === \"push\" || op === \"pop\") {\n return `CASE WHEN ${prop} IS NULL THEN ${this.ctx.param(`Property ${attr.name} cannot be NULL`)} END`;\n }\n if (![\"add\", \"subtract\", \"multiply\", \"divide\"].includes(op)) return undefined;\n const shown = isInt(value)\n ? value.toString()\n : type === \"Float\" && typeof value === \"number\" && Number.isInteger(value)\n ? `${value}.0`\n : String(value);\n const whens = [\n `WHEN ${prop} IS NULL THEN ${this.ctx.param(`Cannot ${label} ${shown} to Nan`)}`,\n ];\n if (type === \"Int\") {\n whens.push(\n `WHEN ${prop} > 2147483647 THEN ${this.ctx.param(`Overflow: Value returned from operator ${label} is larger than 32 bit`)}`,\n );\n }\n return `CASE ${whens.join(\" \")} END`;\n }\n\n private updateExpr(prop: string, attr: Attribute, op: string, value: unknown): string {\n switch (op) {\n case \"set\":\n return valueExpr(this.ctx, attr, value, attr.type.list);\n case \"push\":\n return `${prop} + ${valueExpr(this.ctx, attr, asList(value), true)}`;\n case \"pop\":\n return `${prop}[0..-${this.ctx.param(encodeValue(intAttribute, value))}]`;\n case \"add\":\n return `(${prop} + ${valueExpr(this.ctx, attr, value, false)})`;\n case \"subtract\":\n return `(${prop} - ${valueExpr(this.ctx, attr, value, false)})`;\n case \"multiply\":\n return `(${prop} * ${valueExpr(this.ctx, attr, value, false)})`;\n case \"divide\":\n return `(${prop} / ${valueExpr(this.ctx, attr, value, false)})`;\n }\n throw new Error(`Unsupported update operator ${op}`);\n }\n\n // ---------------------------------------------------------------------------------------------\n // Create\n // ---------------------------------------------------------------------------------------------\n\n /** `CREATE (v:Label) SET …` and the nested writes of a `${Node}CreateInput`. */\n private createNode(\n block: Block,\n v: string,\n node: NodeType,\n input: unknown,\n afterCreate?: () => void,\n ): void {\n this.assertWritable(node);\n block.add(`CREATE (${v}${labels(node.labels)})`);\n const sets = [\n ...onCreateGenerated(v, node.attributes),\n ...this.createAssignments(v, node.attributes, input, node.name, node.relationships),\n ];\n if (sets.length) block.add(`SET ${sets.join(\", \")}`);\n block.count(\"nc\", \"1\");\n afterCreate?.();\n if (!isPlainObject(input)) return;\n for (const rel of node.relationships) {\n const field = input[rel.name];\n if (!isPlainObject(field)) continue;\n for (const el of asList(field.create)) this.nestedCreate(block, v, rel, el);\n for (const el of asList(field.connect)) this.connect(block, v, rel, el);\n }\n }\n\n /** `{ node, edge }` of a relationship `create`: a new related node and the edge to it. */\n private nestedCreate(block: Block, from: string, rel: Relationship, el: unknown): void {\n if (!isPlainObject(el)) return;\n const target = this.model.node(rel.target);\n const inner = new Block();\n const t = this.ctx.variable(\"this\");\n const r = this.ctx.variable(\"edge\");\n this.createNode(inner, t, target, el.node, () => {\n inner.add(`CREATE ${edgePattern(from, rel, r, t)}`);\n const props = this.props(rel);\n if (props) {\n const sets = [\n ...onCreateGenerated(r, props.attributes),\n ...this.createAssignments(r, props.attributes, el.edge, props.name),\n ];\n if (sets.length) inner.add(`SET ${sets.join(\", \")}`);\n }\n inner.count(\"rc\", \"1\");\n });\n this.call(block, [from], inner);\n }\n\n /** `{ where, edge, connect }`: an edge to every node matching `where` (then nested connects). */\n private connect(block: Block, from: string, rel: Relationship, el: unknown): void {\n if (!isPlainObject(el)) return;\n const target = this.model.node(rel.target);\n this.assertWritable(target);\n const inner = new Block();\n const t = this.ctx.variable(\"this\");\n const where = isPlainObject(el.where) ? el.where.node : undefined;\n const pred = this.where.node(t, target, where);\n inner.add(`MATCH (${t}${labels(target.labels)})${pred ? ` WHERE ${pred}` : \"\"}`);\n for (const nested of asList(el.connect)) {\n if (!isPlainObject(nested)) continue;\n for (const [name, els] of Object.entries(nested)) {\n const rel2 = this.relationship(target, name);\n for (const e of asList(els)) this.connect(inner, t, rel2, e);\n }\n }\n const r = this.ctx.variable(\"edge\");\n inner.add(`CREATE ${edgePattern(from, rel, r, t)}`);\n const props = this.props(rel);\n if (props) {\n const sets = this.createAssignments(r, props.attributes, el.edge, props.name);\n if (sets.length) inner.add(`SET ${sets.join(\", \")}`);\n }\n inner.count(\"rc\", \"1\");\n this.call(block, [from], inner);\n }\n\n // ---------------------------------------------------------------------------------------------\n // Update\n // ---------------------------------------------------------------------------------------------\n\n /** The relationship operations of a `${Node}UpdateInput` on `v`. */\n private updateRelationships(block: Block, v: string, node: NodeType, input: unknown): void {\n if (!isPlainObject(input)) return;\n for (const [key, value] of Object.entries(input)) {\n const rel = node.relationships.find((r) => r.name === key);\n if (!rel || value === null || value === undefined) continue;\n for (const el of asList(value)) {\n if (!isPlainObject(el)) continue;\n for (const op of ELEMENT_OPERATIONS) {\n const arg = el[op];\n if (arg === null || arg === undefined) continue;\n switch (op) {\n case \"update\":\n this.nestedUpdate(block, v, rel, arg);\n break;\n case \"create\":\n for (const e of asList(arg)) this.nestedCreate(block, v, rel, e);\n break;\n case \"connect\":\n for (const e of asList(arg)) this.connect(block, v, rel, e);\n break;\n case \"delete\":\n for (const e of asList(arg)) this.nestedDelete(block, v, rel, e);\n break;\n case \"disconnect\":\n for (const e of asList(arg)) this.disconnect(block, v, rel, e);\n break;\n }\n }\n }\n }\n }\n\n /** `{ where, node, edge }`: updates the related nodes (and edges) matching `where`. */\n private nestedUpdate(block: Block, from: string, rel: Relationship, el: unknown): void {\n if (!isPlainObject(el)) return;\n const target = this.model.node(rel.target);\n this.assertWritable(target);\n const props = this.props(rel);\n const inner = new Block();\n const t = this.ctx.variable(\"this\");\n const r = this.ctx.variable(\"edge\");\n const pred = this.where.connection(r, t, rel, el.where);\n inner.add(\n `MATCH ${relationshipPattern(this.model, from, rel, t, r)}${pred ? ` WHERE ${pred}` : \"\"}`,\n );\n const checks: string[] = [];\n const sets = [\n ...onUpdateGenerated(t, target.attributes),\n ...(props ? onUpdateGenerated(r, props.attributes) : []),\n ...this.updateAssignments(\n t,\n target.attributes,\n el.node,\n target.name,\n checks,\n target.relationships,\n ),\n ...(props ? this.updateAssignments(r, props.attributes, el.edge, props.name, checks) : []),\n ];\n if (sets.length) inner.add(`SET ${sets.join(\", \")}`);\n inner.check(checks);\n this.updateRelationships(inner, t, target, el.node);\n if (!inner.hasCounts() && inner.clauses.length === 1) return;\n this.call(block, [from], inner);\n }\n\n /** `{ where, disconnect }`: deletes the matching relationships (then nested disconnects). */\n private disconnect(block: Block, from: string, rel: Relationship, el: unknown): void {\n if (!isPlainObject(el)) return;\n const target = this.model.node(rel.target);\n this.assertWritable(target);\n const inner = new Block();\n const t = this.ctx.variable(\"this\");\n const r = this.ctx.variable(\"edge\");\n const pred = this.where.connection(r, t, rel, el.where);\n inner.add(\n `MATCH ${relationshipPattern(this.model, from, rel, t, r)}${pred ? ` WHERE ${pred}` : \"\"}`,\n );\n if (isPlainObject(el.disconnect)) {\n for (const [name, els] of Object.entries(el.disconnect)) {\n const rel2 = this.relationship(target, name);\n for (const e of asList(els)) this.disconnect(inner, t, rel2, e);\n }\n }\n if (inner.clauses.length > 1) inner.add(\"WITH *\");\n inner.add(`DELETE ${r}`);\n inner.count(\"rd\", \"1\");\n this.call(block, [from], inner);\n }\n\n // ---------------------------------------------------------------------------------------------\n // Delete\n // ---------------------------------------------------------------------------------------------\n\n /**\n * `COLLECT { … }` lists of the nodes a `{ where, delete }` element deletes: the related nodes\n * matching `where` and, through nested `delete`, nodes related to them. `match` is the chain of\n * `MATCH … WHERE …` that binds `t`.\n */\n private deleteLists(match: string, t: string, node: NodeType, del: unknown): string[] {\n this.assertWritable(node);\n const lists = [`COLLECT { ${match} RETURN DISTINCT ${t} }`];\n if (!isPlainObject(del)) return lists;\n for (const [name, els] of Object.entries(del)) {\n const rel = this.relationship(node, name);\n const target = this.model.node(rel.target);\n for (const el of asList(els)) {\n if (!isPlainObject(el)) continue;\n const u = this.ctx.variable(\"this\");\n const r = this.ctx.variable(\"edge\");\n const pred = this.where.connection(r, u, rel, el.where);\n const chain = `${match} MATCH ${relationshipPattern(this.model, t, rel, u, r)}${pred ? ` WHERE ${pred}` : \"\"}`;\n lists.push(...this.deleteLists(chain, u, target, el.delete));\n }\n }\n return lists;\n }\n\n /**\n * Deletes the distinct nodes of `list` with their relationships, counting both\n * (`WITH … AS deleted, COUNT { … } AS …`, then `FOREACH … DETACH DELETE`).\n */\n private deleteNodes(block: Block, list: string, keep: readonly string[]): void {\n const d = this.ctx.variable(\"deleted\");\n const x = this.ctx.variable(\"node\");\n const e = this.ctx.variable(\"rel\");\n const n = this.ctx.variable(\"relCount\");\n const kept = keep.length ? `${keep.join(\", \")}, ` : \"\";\n block.add(`WITH ${kept}COLLECT { UNWIND ${list} AS ${x} RETURN DISTINCT ${x} } AS ${d}`);\n block.add(\n `WITH ${kept}${d}, COUNT { UNWIND ${d} AS ${x} MATCH (${x})-[${e}]-() RETURN DISTINCT ${e} } AS ${n}`,\n );\n block.add(`FOREACH (${x} IN ${d} | DETACH DELETE ${x})`);\n block.count(\"nd\", `size(${d})`);\n block.count(\"rd\", n);\n }\n\n /** `{ where, delete }` inside an update: deletes the matching related nodes. */\n private nestedDelete(block: Block, from: string, rel: Relationship, el: unknown): void {\n if (!isPlainObject(el)) return;\n const target = this.model.node(rel.target);\n const t = this.ctx.variable(\"this\");\n const r = this.ctx.variable(\"edge\");\n const pred = this.where.connection(r, t, rel, el.where);\n const match = `MATCH ${relationshipPattern(this.model, from, rel, t, r)}${pred ? ` WHERE ${pred}` : \"\"}`;\n const lists = this.deleteLists(match, t, target, el.delete);\n const inner = new Block();\n this.deleteNodes(inner, `(${lists.join(\" + \")})`, []);\n this.call(block, [from], inner);\n }\n\n // ---------------------------------------------------------------------------------------------\n // Root fields\n // ---------------------------------------------------------------------------------------------\n\n /**\n * `WITH <nodes> AS nodes, <info>`, the projections of the response's node list (one per response\n * key) and the decoder of the `{ info, <plural> }` response.\n */\n private response(\n block: Block,\n nodes: string,\n info: string,\n node: NodeType,\n fieldNodes: readonly FieldNode[],\n ): CompiledMutation {\n const list = this.ctx.variable(\"nodes\");\n block.add(`WITH ${nodes} AS ${list}, ${info} AS info`);\n const entries: string[] = [];\n const decoders: [string, (raw: AnyRecord) => unknown][] = [];\n for (const [key, nodesOfKey] of collectFields(this.info, subSelections(fieldNodes))) {\n const name = nodesOfKey[0]!.name.value;\n if (name === \"info\") {\n const fields = [...collectFields(this.info, subSelections(nodesOfKey))].map(\n ([k, n]) => [k, n[0]!.name.value] as const,\n );\n decoders.push([\n key,\n (raw) => {\n const counts = (raw.info ?? {}) as AnyRecord;\n return decodeCounts(fields, counts);\n },\n ]);\n } else if (name === node.plural) {\n const v = this.ctx.variable(\"this\");\n const d = this.ctx.variable(\"data\");\n const proj = this.select.projectNode(v, node, nodesOfKey);\n block.add(\n `CALL (${list}) {\\n UNWIND ${list} AS ${v}\\n RETURN collect(${proj.expr}) AS ${d}\\n}`,\n );\n entries.push(`${q(key)}: ${d}`);\n decoders.push([\n key,\n (raw) => {\n const data = ((raw.data ?? {}) as AnyRecord)[key];\n return Array.isArray(data) ? data.map(proj.decode) : [];\n },\n ]);\n }\n }\n const data = entries.length ? `{ ${entries.join(\", \")} }` : \"{}\";\n block.add(`RETURN { info: info, data: ${data} } AS this`);\n return {\n cypher: block.clauses.join(\"\\n\"),\n params: this.ctx.params,\n decode: (rows) => {\n const raw = (rows[0] ?? {}) as AnyRecord;\n const errors = ((raw.info ?? {}) as AnyRecord).errors;\n if (Array.isArray(errors) && errors.length) throw new GraphQLError(String(errors[0]));\n return Object.fromEntries(decoders.map(([k, dec]) => [k, dec(raw)]));\n },\n };\n }\n\n /** `createMovies(input: [...])`. */\n rootCreate(node: NodeType, args: AnyRecord, fieldNodes: readonly FieldNode[]): CompiledMutation {\n this.assertWritable(node);\n const block = new Block();\n const groups: string[] = [];\n const inputs = asList(args.input);\n let i = 0;\n while (i < inputs.length) {\n // Consecutive inputs without relationship fields share one `UNWIND`.\n let j = i;\n while (j < inputs.length && !this.hasRelationshipInput(node, inputs[j])) j++;\n if (j > i) {\n groups.push(this.createFlat(block, node, inputs.slice(i, j)));\n i = j;\n continue;\n }\n const inner = new Block();\n const v = this.ctx.variable(\"this\");\n this.createNode(inner, v, node, inputs[i]);\n const g = this.ctx.variable(\"created\");\n const c = this.ctx.variable(\"count\");\n block.add(\n `CALL () {\\n${indent(inner.clauses)}\\n RETURN collect(${v}) AS ${g}, ${inner.aggregate()} AS ${c}\\n}`,\n );\n for (const k of ALL_COUNTERS) if (inner.terms[k].length) block.count(k, `${c}.${k}`);\n if (inner.errors.length) block.errors.push(`${c}.errors`);\n groups.push(g);\n i++;\n }\n return this.response(\n block,\n groups.length ? groups.join(\" + \") : \"[]\",\n block.aggregate(false),\n node,\n fieldNodes,\n );\n }\n\n private hasRelationshipInput(node: NodeType, input: unknown): boolean {\n return (\n isPlainObject(input) &&\n node.relationships.some((r) => input[r.name] !== undefined && input[r.name] !== null)\n );\n }\n\n /** `UNWIND $rows AS row CREATE (n:Label) SET n.p = row.p, …` for inputs without relationships. */\n private createFlat(block: Block, node: NodeType, inputs: readonly unknown[]): string {\n const keys = new Set<string>();\n for (const input of inputs) {\n if (!isPlainObject(input)) continue;\n for (const [k, v] of Object.entries(input)) if (v !== undefined) keys.add(k);\n }\n const attrs = [...keys].map((k) => {\n const a = node.attributes.find((x) => x.name === k);\n if (!a) throw new Error(`Unknown field ${node.name}CreateInput.${k}`);\n return a;\n });\n const rows = inputs.map((input) => {\n const r = isPlainObject(input) ? input : {};\n return Object.fromEntries(attrs.map((a) => [a.name, encodeValue(a, r[a.name])]));\n });\n const row = this.ctx.variable(\"row\");\n const v = this.ctx.variable(\"this\");\n const g = this.ctx.variable(\"created\");\n const sets = [\n ...onCreateGenerated(v, node.attributes),\n ...attrs.map(\n (a) => `${v}.${q(a.property)} = ${castValue(a, `${row}.${q(a.name)}`, a.type.list)}`,\n ),\n ];\n const lines = [\n `UNWIND ${this.ctx.param(rows)} AS ${row}`,\n `CREATE (${v}${labels(node.labels)})`,\n ...(sets.length ? [`SET ${sets.join(\", \")}`] : []),\n `RETURN collect(${v}) AS ${g}`,\n ];\n block.add(`CALL () {\\n${indent(lines)}\\n}`);\n block.count(\"nc\", `size(${g})`);\n return g;\n }\n\n /** `updateMovies(where, update)`; without `update` it only reads (and refreshes UPDATE timestamps). */\n rootUpdate(node: NodeType, args: AnyRecord, fieldNodes: readonly FieldNode[]): CompiledMutation {\n this.assertWritable(node);\n const block = new Block();\n const v = this.ctx.variable(\"this\");\n const pred = this.where.node(v, node, args.where);\n block.add(`MATCH (${v}${labels(node.labels)})${pred ? `\\nWHERE ${pred}` : \"\"}`);\n // v7 refreshes UPDATE timestamps even without an `update` argument.\n const checks: string[] = [];\n const sets = [\n ...onUpdateGenerated(v, node.attributes),\n ...this.updateAssignments(\n v,\n node.attributes,\n args.update,\n node.name,\n checks,\n node.relationships,\n ),\n ];\n if (sets.length) block.add(`SET ${sets.join(\", \")}`);\n block.check(checks);\n this.updateRelationships(block, v, node, args.update);\n return this.response(block, `collect(${v})`, block.aggregate(), node, fieldNodes);\n }\n\n /** `deleteMovies(where, delete)`: one `DeleteInfo`. */\n rootDelete(node: NodeType, args: AnyRecord, fieldNodes: readonly FieldNode[]): CompiledMutation {\n this.assertWritable(node);\n const block = new Block();\n const v = this.ctx.variable(\"this\");\n const pred = this.where.node(v, node, args.where);\n block.add(`MATCH (${v}${labels(node.labels)})${pred ? `\\nWHERE ${pred}` : \"\"}`);\n const roots = this.ctx.variable(\"roots\");\n const nested: string[] = [];\n if (isPlainObject(args.delete)) {\n for (const [name, els] of Object.entries(args.delete)) {\n const rel = this.relationship(node, name);\n const target = this.model.node(rel.target);\n for (const el of asList(els)) {\n if (!isPlainObject(el)) continue;\n const t = this.ctx.variable(\"this\");\n const r = this.ctx.variable(\"edge\");\n const p = this.where.connection(r, t, rel, el.where);\n const match = `MATCH ${relationshipPattern(this.model, v, rel, t, r)}${p ? ` WHERE ${p}` : \"\"}`;\n nested.push(...this.deleteLists(match, t, target, el.delete));\n }\n }\n }\n let list: string;\n if (nested.length) {\n const related = this.ctx.variable(\"related\");\n block.add(`WITH collect(${v}) AS ${roots}, collect(${nested.join(\" + \")}) AS ${related}`);\n list = `(${roots} + reduce(acc = [], l IN ${related} | acc + l))`;\n } else {\n block.add(`WITH collect(${v}) AS ${roots}`);\n list = roots;\n }\n this.deleteNodes(block, list, []);\n const fields = [...collectFields(this.info, subSelections(fieldNodes))].map(\n ([k, n]) => [k, n[0]!.name.value] as const,\n );\n block.add(`RETURN ${block.aggregate(false)} AS this`);\n return {\n cypher: block.clauses.join(\"\\n\"),\n params: this.ctx.params,\n decode: (rows) => {\n const counts = (rows[0] ?? {}) as AnyRecord;\n return decodeCounts(fields, counts);\n },\n };\n }\n}\n\n/** The `pop` count is an Int. */\nconst intAttribute: Attribute = {\n name: \"pop\",\n property: \"pop\",\n type: { name: \"Int\", list: false, required: true, elementRequired: false },\n kind: \"scalar\",\n id: false,\n};\n","import type { CyphraClient } from \"@cyphra/runtime\";\nimport neo4j, { type Driver, type ManagedTransaction, type Session } from \"neo4j-driver\";\n\n/** Runs one statement and returns the values of its `this` column. */\nexport type ReadExecutor = (cypher: string, params: Record<string, unknown>) => Promise<unknown[]>;\n\n/**\n * Runs one statement in a write transaction and passes the values of its `this` column to\n * `consume` inside it: when `consume` throws, the transaction is rolled back.\n */\nexport type WriteExecutor = <T>(\n cypher: string,\n params: Record<string, unknown>,\n consume: (rows: unknown[]) => T,\n) => Promise<T>;\n\n/** Read statements run in read transactions, writes in write transactions (one per statement). */\nexport type Executors = { read: ReadExecutor; write: WriteExecutor };\n\nexport type ExecutorOptions = {\n /** A `neo4j-driver` driver. */\n driver?: Driver;\n /** Or a Cyphra client (`new CyphraClient(...)`). */\n client?: CyphraClient;\n /** Database name for `driver` (default database when omitted). */\n database?: string;\n /** Log each generated statement and its parameter keys (never values). */\n debug?: boolean;\n};\n\nexport function createReadExecutor(opts: ExecutorOptions): ReadExecutor {\n return createExecutors(opts).read;\n}\n\nexport function createExecutors(opts: ExecutorOptions): Executors {\n const log = (cypher: string, params: Record<string, unknown>) => {\n if (opts.debug)\n console.debug(\"[cyphra/graphql] cypher:\", cypher, \"param keys:\", Object.keys(params));\n };\n type Tx = Pick<ManagedTransaction, \"run\">;\n const rows = async (tx: Tx, cypher: string, params: Record<string, unknown>) =>\n (await tx.run(cypher, params)).records.map((r) => r.get(\"this\") as unknown);\n if (opts.client) {\n const client = opts.client;\n return {\n read: async (cypher, params) => {\n log(cypher, params);\n return client.withReadTransaction((tx) => rows(tx, cypher, params));\n },\n write: async (cypher, params, consume) => {\n log(cypher, params);\n return client.withWriteTransaction(async (tx) => consume(await rows(tx, cypher, params)));\n },\n };\n }\n if (opts.driver) {\n const driver = opts.driver;\n const withSession = async <T>(mode: \"READ\" | \"WRITE\", fn: (s: Session) => Promise<T>) => {\n const session = driver.session({\n database: opts.database,\n defaultAccessMode: neo4j.session[mode],\n });\n try {\n return await fn(session);\n } finally {\n await session.close();\n }\n };\n return {\n read: async (cypher, params) => {\n log(cypher, params);\n return withSession(\"READ\", (s) => s.executeRead((tx) => rows(tx, cypher, params)));\n },\n write: async (cypher, params, consume) => {\n log(cypher, params);\n return withSession(\"WRITE\", (s) =>\n s.executeWrite(async (tx) => consume(await rows(tx, cypher, params))),\n );\n },\n };\n }\n throw new TypeError(\"@cyphra/graphql: pass `driver` (neo4j-driver) or `client` (CyphraClient).\");\n}\n","/**\n * Generates the GraphQL schema `@neo4j/graphql` v7 builds from type definitions: root queries and\n * mutations, connection and edge types, every `where` / `sort` / `create` / `update` / `connect` /\n * `disconnect` / `delete` input, aggregate selection types, and the deprecated `field_OPERATOR`\n * fields v7 still prints. Names, descriptions and deprecation reasons are the v7 ones, so the\n * printed SDL is identical.\n *\n * Only types reachable from `Query` / `Mutation` end up in the schema (as with v7).\n *\n * @packageDocumentation\n */\n\nimport {\n GraphQLBoolean,\n GraphQLEnumType,\n GraphQLFloat,\n GraphQLID,\n GraphQLInputObjectType,\n GraphQLInt,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLSchema,\n GraphQLString,\n valueFromAST,\n type GraphQLFieldConfig,\n type GraphQLFieldConfigArgumentMap,\n type GraphQLFieldConfigMap,\n type GraphQLInputFieldConfig,\n type GraphQLInputFieldConfigMap,\n type GraphQLInputType,\n type GraphQLNamedType,\n type GraphQLOutputType,\n type GraphQLScalarType,\n type GraphQLType,\n} from \"graphql\";\nimport type {\n Attribute,\n NodeType,\n PropertiesType,\n Relationship,\n TypeRef,\n V7Model,\n} from \"./model.js\";\nimport { pluralize, upperFirst } from \"./naming.js\";\nimport { GraphQLBigInt, GraphQLDate, GraphQLDateTime } from \"./scalars.js\";\n\nconst SCALARS: Record<string, GraphQLScalarType> = {\n ID: GraphQLID,\n String: GraphQLString,\n Int: GraphQLInt,\n Float: GraphQLFloat,\n Boolean: GraphQLBoolean,\n BigInt: GraphQLBigInt,\n Date: GraphQLDate,\n DateTime: GraphQLDateTime,\n};\n\nconst NUMERIC_OR_TEMPORAL = new Set([\"Int\", \"Float\", \"BigInt\", \"Date\", \"DateTime\"]);\n/** Scalars that get an aggregate selection (`min` / `max` / …) and aggregation filters. */\nconst AGGREGABLE = new Set([\"String\", \"Int\", \"Float\", \"BigInt\", \"DateTime\"]);\n\nconst nn = <T extends GraphQLType>(t: T) => new GraphQLNonNull(t);\nconst list = <T extends GraphQLType>(t: T) => new GraphQLList(t);\n\ntype Quantifier = \"all\" | \"none\" | \"single\" | \"some\";\nconst QUANTIFIERS: Quantifier[] = [\"all\", \"none\", \"single\", \"some\"];\nconst QUANTIFIER_WORD: Record<Quantifier, string> = {\n all: \"all\",\n none: \"none\",\n single: \"one\",\n some: \"some\",\n};\n\nexport function isAggregable(a: Attribute): boolean {\n return !a.type.list && !a.cypher && a.kind === \"scalar\" && AGGREGABLE.has(a.type.name);\n}\n\n/** Builds (once) and caches every named type of the generated schema. */\nclass TypeRegistry {\n private readonly types = new Map<string, GraphQLNamedType>();\n\n constructor(readonly model: V7Model) {}\n\n get<T extends GraphQLNamedType>(name: string, create: () => T): T {\n let t = this.types.get(name);\n if (!t) {\n t = create();\n this.types.set(name, t);\n }\n return t as T;\n }\n\n input(\n name: string,\n fields: () => GraphQLInputFieldConfigMap,\n description?: string,\n ): GraphQLInputObjectType {\n return this.get(name, () => new GraphQLInputObjectType({ name, description, fields }));\n }\n\n object(\n name: string,\n fields: () => GraphQLFieldConfigMap<unknown, unknown>,\n description?: string,\n ): GraphQLObjectType {\n return this.get(name, () => new GraphQLObjectType({ name, description, fields }));\n }\n\n // -------------------------------------------------------------------------\n // Shared types\n // -------------------------------------------------------------------------\n\n namedType(name: string): GraphQLScalarType | GraphQLEnumType {\n const scalar = SCALARS[name];\n if (scalar) return scalar;\n const e = this.model.enums.get(name);\n if (!e) throw new Error(`Unknown type ${name}`);\n return this.get(\n name,\n () =>\n new GraphQLEnumType({\n name,\n description: e.description,\n values: Object.fromEntries(\n e.values.map((v) => [\n v.name,\n { value: v.name, description: v.description, deprecationReason: v.deprecated },\n ]),\n ),\n }),\n );\n }\n\n /** The declared output type of an attribute, e.g. `[String!]!`. */\n attributeType(t: TypeRef): GraphQLOutputType & GraphQLInputType {\n const named = this.namedType(t.name);\n if (t.list) {\n const inner = list(t.elementRequired ? nn(named) : named);\n return t.required ? nn(inner) : inner;\n }\n return t.required ? nn(named) : named;\n }\n\n sortDirection(): GraphQLEnumType {\n return this.get(\n \"SortDirection\",\n () =>\n new GraphQLEnumType({\n name: \"SortDirection\",\n description: \"An enum for sorting in either ascending or descending order.\",\n values: {\n ASC: { value: \"ASC\", description: \"Sort by field values in ascending order.\" },\n DESC: { value: \"DESC\", description: \"Sort by field values in descending order.\" },\n },\n }),\n );\n }\n\n pageInfo(): GraphQLObjectType {\n return this.object(\n \"PageInfo\",\n () => ({\n hasNextPage: { type: nn(GraphQLBoolean) },\n hasPreviousPage: { type: nn(GraphQLBoolean) },\n startCursor: { type: GraphQLString },\n endCursor: { type: GraphQLString },\n }),\n \"Pagination information (Relay)\",\n );\n }\n\n createInfo(): GraphQLObjectType {\n return this.object(\n \"CreateInfo\",\n () => ({\n nodesCreated: { type: nn(GraphQLInt) },\n relationshipsCreated: { type: nn(GraphQLInt) },\n }),\n \"Information about the number of nodes and relationships created during a create mutation\",\n );\n }\n\n deleteInfo(): GraphQLObjectType {\n return this.object(\n \"DeleteInfo\",\n () => ({\n nodesDeleted: { type: nn(GraphQLInt) },\n relationshipsDeleted: { type: nn(GraphQLInt) },\n }),\n \"Information about the number of nodes and relationships deleted during a delete mutation\",\n );\n }\n\n updateInfo(): GraphQLObjectType {\n return this.object(\n \"UpdateInfo\",\n () => ({\n nodesCreated: { type: nn(GraphQLInt) },\n nodesDeleted: { type: nn(GraphQLInt) },\n relationshipsCreated: { type: nn(GraphQLInt) },\n relationshipsDeleted: { type: nn(GraphQLInt) },\n }),\n \"Information about the number of nodes and relationships created and deleted during an update mutation\",\n );\n }\n\n count(): GraphQLObjectType {\n return this.object(\"Count\", () => ({ nodes: { type: nn(GraphQLInt) } }));\n }\n\n countConnection(): GraphQLObjectType {\n return this.object(\"CountConnection\", () => ({\n edges: { type: nn(GraphQLInt) },\n nodes: { type: nn(GraphQLInt) },\n }));\n }\n\n /** `IntScalarFilters`, `StringListFilters`, `OrderStatusEnumScalarFilters`, … */\n scalarFilters(a: { type: TypeRef; kind: \"scalar\" | \"enum\" }): GraphQLInputObjectType {\n const t = a.type.name;\n const named = this.namedType(t);\n if (a.kind === \"enum\") {\n if (a.type.list) {\n return this.input(\n `${t}ListEnumScalarFilters`,\n () => ({ eq: { type: list(nn(named)) }, includes: { type: named } }),\n `${t} filters`,\n );\n }\n return this.input(\n `${t}EnumScalarFilters`,\n () => ({ eq: { type: named }, in: { type: list(nn(named)) } }),\n `${t} filters`,\n );\n }\n if (a.type.list) {\n if (t === \"Boolean\") {\n return this.input(\n \"BooleanListFilters\",\n () => ({ eq: { type: list(nn(named)) } }),\n \"Boolean list filters\",\n );\n }\n return this.input(\n `${t}ListFilters`,\n () => ({ eq: { type: list(nn(named)) }, includes: { type: named } }),\n `${t} list filters`,\n );\n }\n if (t === \"Boolean\") {\n return this.input(\"BooleanScalarFilters\", () => ({ eq: { type: named } }), \"Boolean filters\");\n }\n if (t === \"String\" || t === \"ID\") {\n return this.input(\n `${t}ScalarFilters`,\n () => ({\n contains: { type: named },\n endsWith: { type: named },\n eq: { type: named },\n in: { type: list(nn(named)) },\n startsWith: { type: named },\n }),\n `${t} filters`,\n );\n }\n return this.input(\n `${t}ScalarFilters`,\n () => ({\n eq: { type: named },\n gt: { type: named },\n gte: { type: named },\n in: { type: list(nn(named)) },\n lt: { type: named },\n lte: { type: named },\n }),\n `${t} filters`,\n );\n }\n\n intFilters(): GraphQLInputObjectType {\n return this.scalarFilters({ type: scalarRef(\"Int\"), kind: \"scalar\" });\n }\n\n floatFilters(): GraphQLInputObjectType {\n return this.scalarFilters({ type: scalarRef(\"Float\"), kind: \"scalar\" });\n }\n\n /** `IntScalarMutations`, `ListStringMutations`, `OrderStatusEnumScalarMutations`, … */\n scalarMutations(a: Attribute): GraphQLInputObjectType {\n const t = a.type.name;\n const named = this.namedType(t);\n if (a.type.list) {\n return this.input(\n a.kind === \"enum\" ? `List${t}EnumScalarMutations` : `List${t}Mutations`,\n () => ({\n pop: { type: GraphQLInt },\n push: { type: list(nn(named)) },\n set: { type: list(nn(named)) },\n }),\n `Mutations for a list for ${t}`,\n );\n }\n if (a.kind === \"enum\") {\n return this.input(\n `${t}EnumScalarMutations`,\n () => ({ set: { type: named } }),\n `${t} mutations`,\n );\n }\n switch (t) {\n case \"Int\":\n case \"BigInt\":\n return this.input(\n `${t}ScalarMutations`,\n () => ({ add: { type: named }, set: { type: named }, subtract: { type: named } }),\n `${t} mutations`,\n );\n case \"Float\":\n return this.input(\n \"FloatScalarMutations\",\n () => ({\n add: { type: named },\n divide: { type: named },\n multiply: { type: named },\n set: { type: named },\n subtract: { type: named },\n }),\n \"Float mutations\",\n );\n default:\n return this.input(\n `${t}ScalarMutations`,\n () => ({ set: { type: named } }),\n `${t} mutations`,\n );\n }\n }\n\n /** `IntAggregateSelection`, `StringAggregateSelection`, … */\n aggregateSelection(t: string): GraphQLObjectType {\n const named = this.namedType(t);\n switch (t) {\n case \"String\":\n return this.object(\"StringAggregateSelection\", () => ({\n longest: { type: GraphQLString },\n shortest: { type: GraphQLString },\n }));\n case \"Int\":\n return this.object(\"IntAggregateSelection\", () => ({\n average: { type: GraphQLFloat },\n max: { type: GraphQLInt },\n min: { type: GraphQLInt },\n sum: { type: GraphQLInt },\n }));\n case \"Float\":\n case \"BigInt\":\n return this.object(`${t}AggregateSelection`, () => ({\n average: { type: named },\n max: { type: named },\n min: { type: named },\n sum: { type: named },\n }));\n default:\n return this.object(`${t}AggregateSelection`, () => ({\n max: { type: named },\n min: { type: named },\n }));\n }\n }\n\n /** `IntScalarAggregationFilters`, … */\n aggregationFilters(t: string): GraphQLInputObjectType {\n switch (t) {\n case \"String\":\n return this.input(\n \"StringScalarAggregationFilters\",\n () => ({\n averageLength: { type: this.floatFilters() },\n longestLength: { type: this.intFilters() },\n shortestLength: { type: this.intFilters() },\n }),\n \"Filters for an aggregation of a string field\",\n );\n case \"Int\":\n return this.input(\n \"IntScalarAggregationFilters\",\n () => ({\n average: { type: this.floatFilters() },\n max: { type: this.intFilters() },\n min: { type: this.intFilters() },\n sum: { type: this.intFilters() },\n }),\n \"Filters for an aggregation of an int field\",\n );\n case \"Float\":\n return this.input(\n \"FloatScalarAggregationFilters\",\n () => ({\n average: { type: this.floatFilters() },\n max: { type: this.floatFilters() },\n min: { type: this.floatFilters() },\n sum: { type: this.floatFilters() },\n }),\n \"Filters for an aggregation of a float field\",\n );\n case \"BigInt\": {\n const f = () => this.scalarFilters({ type: scalarRef(\"BigInt\"), kind: \"scalar\" });\n return this.input(\n \"BigIntScalarAggregationFilters\",\n () => ({\n average: { type: f() },\n max: { type: f() },\n min: { type: f() },\n sum: { type: f() },\n }),\n \"Filters for an aggregation of an BigInt field\",\n );\n }\n default: {\n const f = () => this.scalarFilters({ type: scalarRef(t), kind: \"scalar\" });\n return this.input(\n `${t}ScalarAggregationFilters`,\n () => ({ max: { type: f() }, min: { type: f() } }),\n `Filters for an aggregation of an ${t} input field`,\n );\n }\n }\n }\n\n connectionAggregationCountFilter(): GraphQLInputObjectType {\n return this.input(\"ConnectionAggregationCountFilterInput\", () => ({\n edges: { type: this.intFilters() },\n nodes: { type: this.intFilters() },\n }));\n }\n\n // -------------------------------------------------------------------------\n // Attribute-level field maps (shared by nodes and relationship properties)\n // -------------------------------------------------------------------------\n\n /** `where` fields of attributes, with the deprecated `field_OPERATOR` variants. */\n attributeWhereFields(attributes: readonly Attribute[]): GraphQLInputFieldConfigMap {\n const out: GraphQLInputFieldConfigMap = {};\n for (const a of attributes) {\n if (a.cypher && a.type.list) continue;\n out[a.name] = { type: this.scalarFilters(a), deprecationReason: a.deprecated };\n const named = this.namedType(a.type.name);\n const dep = (op: string) =>\n a.deprecated ?? `Please use the relevant generic filter ${a.name}: { ${op}: ... }`;\n out[`${a.name}_EQ`] = {\n type: a.type.list ? list(a.type.elementRequired ? nn(named) : named) : named,\n deprecationReason: dep(\"eq\"),\n };\n if (a.kind === \"scalar\" && a.type.name === \"Boolean\") continue;\n if (a.type.list) {\n out[`${a.name}_INCLUDES`] = { type: named, deprecationReason: dep(\"includes\") };\n continue;\n }\n out[`${a.name}_IN`] = {\n type: list(a.type.required ? nn(named) : named),\n deprecationReason: dep(\"in\"),\n };\n if (a.kind === \"scalar\" && NUMERIC_OR_TEMPORAL.has(a.type.name)) {\n for (const op of [\"LT\", \"LTE\", \"GT\", \"GTE\"]) {\n out[`${a.name}_${op}`] = { type: named, deprecationReason: dep(op.toLowerCase()) };\n }\n continue;\n }\n if (a.kind === \"scalar\" && (a.type.name === \"String\" || a.type.name === \"ID\")) {\n out[`${a.name}_CONTAINS`] = { type: named, deprecationReason: dep(\"contains\") };\n out[`${a.name}_STARTS_WITH`] = { type: named, deprecationReason: dep(\"startsWith\") };\n out[`${a.name}_ENDS_WITH`] = { type: named, deprecationReason: dep(\"endsWith\") };\n }\n }\n return out;\n }\n\n /** Aggregation `where` fields (`name: StringScalarAggregationFilters`, `name_AVERAGE_LENGTH_GT`…). */\n aggregationWhereFields(\n self: () => GraphQLInputObjectType,\n attributes: readonly Attribute[],\n ): GraphQLInputFieldConfigMap {\n const out: GraphQLInputFieldConfigMap = {\n AND: { type: list(nn(self())) },\n NOT: { type: self() },\n OR: { type: list(nn(self())) },\n };\n for (const a of attributes) {\n if (!isAggregable(a)) continue;\n const t = a.type.name;\n out[a.name] = { type: this.aggregationFilters(t) };\n const named = this.namedType(t);\n const ops: [string, string, GraphQLInputType][] =\n t === \"String\"\n ? [\n [\"AVERAGE_LENGTH\", \"averageLength\", GraphQLFloat],\n [\"LONGEST_LENGTH\", \"longestLength\", GraphQLInt],\n [\"SHORTEST_LENGTH\", \"shortestLength\", GraphQLInt],\n ]\n : t === \"Int\"\n ? [\n [\"AVERAGE\", \"average\", GraphQLFloat],\n [\"MAX\", \"max\", GraphQLInt],\n [\"MIN\", \"min\", GraphQLInt],\n [\"SUM\", \"sum\", GraphQLInt],\n ]\n : t === \"Float\" || t === \"BigInt\"\n ? [\n [\"AVERAGE\", \"average\", named],\n [\"MAX\", \"max\", named],\n [\"MIN\", \"min\", named],\n [\"SUM\", \"sum\", named],\n ]\n : [\n [\"MAX\", \"max\", named],\n [\"MIN\", \"min\", named],\n ];\n for (const [legacy, generic, type] of ops) {\n for (const [cmp, op] of [\n [\"EQUAL\", \"eq\"],\n [\"GT\", \"gt\"],\n [\"GTE\", \"gte\"],\n [\"LT\", \"lt\"],\n [\"LTE\", \"lte\"],\n ] as const) {\n out[`${a.name}_${legacy}_${cmp}`] = {\n type,\n deprecationReason: `Please use the relevant generic filter '${a.name}: { ${generic}: { ${op}: ... } } }' instead.`,\n };\n }\n }\n }\n return out;\n }\n\n /** Create input fields of attributes (`@id`, `@cypher` and `@timestamp(CREATE)` excluded). */\n attributeCreateFields(attributes: readonly Attribute[]): GraphQLInputFieldConfigMap {\n const out: GraphQLInputFieldConfigMap = {};\n for (const a of attributes) {\n if (a.id || a.cypher || a.timestamp?.includes(\"CREATE\")) continue;\n const type = this.attributeType(a.type);\n const field: GraphQLInputFieldConfig = { type, deprecationReason: a.deprecated };\n if (a.defaultAst) field.defaultValue = valueFromAST(a.defaultAst, type);\n out[a.name] = field;\n }\n return out;\n }\n\n /** Update input fields of attributes, with the deprecated `field_SET` / `_INCREMENT` / … */\n attributeUpdateFields(attributes: readonly Attribute[]): GraphQLInputFieldConfigMap {\n const out: GraphQLInputFieldConfigMap = {};\n for (const a of attributes) {\n if (a.id || a.cypher || a.timestamp?.includes(\"UPDATE\")) continue;\n const named = this.namedType(a.type.name);\n out[a.name] = { type: this.scalarMutations(a), deprecationReason: a.deprecated };\n const generic = (op: string) =>\n a.deprecated ?? `Please use the generic mutation '${a.name}: { ${op}: ... } }' instead.`;\n const relevant = (op: string) =>\n a.deprecated ??\n `Please use the relevant generic mutation '${a.name}: { ${op}: ... } }' instead.`;\n if (a.type.list) {\n out[`${a.name}_POP`] = { type: GraphQLInt, deprecationReason: generic(\"pop\") };\n out[`${a.name}_PUSH`] = { type: list(nn(named)), deprecationReason: generic(\"push\") };\n out[`${a.name}_SET`] = { type: list(nn(named)), deprecationReason: generic(\"set\") };\n continue;\n }\n out[`${a.name}_SET`] = { type: named, deprecationReason: generic(\"set\") };\n if (a.kind !== \"scalar\") continue;\n if (a.type.name === \"Int\" || a.type.name === \"BigInt\") {\n out[`${a.name}_INCREMENT`] = { type: named, deprecationReason: relevant(\"increment\") };\n out[`${a.name}_DECREMENT`] = { type: named, deprecationReason: relevant(\"decrement\") };\n } else if (a.type.name === \"Float\") {\n for (const op of [\"add\", \"subtract\", \"multiply\", \"divide\"]) {\n out[`${a.name}_${op.toUpperCase()}`] = { type: named, deprecationReason: relevant(op) };\n }\n }\n }\n return out;\n }\n\n // -------------------------------------------------------------------------\n // Relationship properties\n // -------------------------------------------------------------------------\n\n propertiesObject(p: PropertiesType): GraphQLObjectType {\n const users = this.model.nodes.flatMap((n) =>\n n.relationships.filter((r) => r.properties === p.name).map((r) => `* ${n.name}.${r.name}`),\n );\n return this.object(\n p.name,\n () => attributeOutputFields(this, p.attributes),\n `The edge properties for the following fields:\\n${users.join(\"\\n\")}`,\n );\n }\n\n propertiesWhere(p: PropertiesType): GraphQLInputObjectType {\n const self = (): GraphQLInputObjectType => this.propertiesWhere(p);\n return this.input(`${p.name}Where`, () => ({\n AND: { type: list(nn(self())) },\n NOT: { type: self() },\n OR: { type: list(nn(self())) },\n ...this.attributeWhereFields(p.attributes),\n }));\n }\n\n propertiesSort(p: PropertiesType): GraphQLInputObjectType {\n return this.input(`${p.name}Sort`, () =>\n Object.fromEntries(p.attributes.map((a) => [a.name, { type: this.sortDirection() }])),\n );\n }\n\n propertiesCreate(p: PropertiesType): GraphQLInputObjectType {\n return this.input(`${p.name}CreateInput`, () => this.attributeCreateFields(p.attributes));\n }\n\n /** `ActedInCreateInput!` when some property is required on create. */\n propertiesCreateRef(p: PropertiesType): GraphQLInputType {\n const t = this.propertiesCreate(p);\n const required = p.attributes.some(\n (a) =>\n !a.id &&\n !a.cypher &&\n !a.timestamp?.includes(\"CREATE\") &&\n a.type.required &&\n a.defaultAst === undefined,\n );\n return required ? nn(t) : t;\n }\n\n propertiesUpdate(p: PropertiesType): GraphQLInputObjectType {\n return this.input(`${p.name}UpdateInput`, () => this.attributeUpdateFields(p.attributes));\n }\n\n propertiesAggregationWhere(p: PropertiesType): GraphQLInputObjectType {\n const self = (): GraphQLInputObjectType => this.propertiesAggregationWhere(p);\n return this.input(`${p.name}AggregationWhereInput`, () =>\n this.aggregationWhereFields(self, p.attributes),\n );\n }\n\n // -------------------------------------------------------------------------\n // Nodes\n // -------------------------------------------------------------------------\n\n node(n: NodeType): GraphQLObjectType {\n return this.object(\n n.name,\n () => {\n const fields = attributeOutputFields(this, n.attributes);\n for (const r of n.relationships) {\n const target = this.model.node(r.target);\n fields[r.name] = {\n type: relationshipType(this, r),\n description: r.description,\n deprecationReason: r.deprecated,\n args: {\n limit: { type: GraphQLInt },\n offset: { type: GraphQLInt },\n sort: { type: list(nn(this.nodeSort(target))) },\n where: { type: this.nodeWhere(target) },\n },\n };\n fields[`${r.name}Connection`] = {\n type: nn(this.relConnection(r)),\n deprecationReason: r.deprecated,\n args: {\n after: { type: GraphQLString },\n first: { type: GraphQLInt },\n sort: { type: list(nn(this.relConnectionSort(r))) },\n where: { type: this.relConnectionWhere(r) },\n },\n };\n }\n return fields;\n },\n n.description,\n );\n }\n\n nodeSort(n: NodeType): GraphQLInputObjectType {\n return this.input(\n `${n.name}Sort`,\n () =>\n Object.fromEntries(\n n.attributes\n .filter((a) => !a.type.list)\n .map((a) => [a.name, { type: this.sortDirection() }]),\n ),\n `Fields to sort ${n.pascalPlural} by. The order in which sorts are applied is not guaranteed when specifying many fields in one ${n.name}Sort object.`,\n );\n }\n\n nodeWhere(n: NodeType): GraphQLInputObjectType {\n return this.input(`${n.name}Where`, () => {\n const self = this.nodeWhere(n);\n const out: GraphQLInputFieldConfigMap = {\n AND: { type: list(nn(self)) },\n NOT: { type: self },\n OR: { type: list(nn(self)) },\n ...this.attributeWhereFields(n.attributes),\n };\n const sourcePlural = pluralize(n.name);\n for (const r of n.relationships) {\n const target = this.model.node(r.target);\n const targetWhere = this.nodeWhere(target);\n const connWhere = this.relConnectionWhere(r);\n const connPlural = pluralize(relConnectionName(r));\n out[r.name] = { type: this.relationshipFilters(target) };\n out[`${r.name}Aggregate`] = {\n type: this.relAggregateInput(r),\n deprecationReason: `Aggregate filters are moved inside the ${r.name}Connection filter, please use { ${r.name}Connection: { aggregate: {...} } } instead`,\n };\n out[`${r.name}Connection`] = { type: this.relConnectionFilters(r) };\n for (const q of QUANTIFIERS) {\n out[`${r.name}Connection_${q.toUpperCase()}`] = {\n type: connWhere,\n description: `Return ${sourcePlural} where ${QUANTIFIER_WORD[q]} of the related ${connPlural} match this filter`,\n deprecationReason: `Please use the relevant generic filter '${r.name}Connection: { ${q}: { node: ... } } }' instead.`,\n };\n const spacing = q === \"single\" || q === \"some\" ? \" \" : \" \";\n out[`${r.name}_${q.toUpperCase()}`] = {\n type: targetWhere,\n description: `Return ${sourcePlural} where ${QUANTIFIER_WORD[q]} of the related ${pluralize(target.name)} match this filter`,\n deprecationReason: `Please use the relevant generic filter '${r.name}: {${spacing}${q}: ... }' instead.`,\n };\n }\n }\n return out;\n });\n }\n\n relationshipFilters(target: NodeType): GraphQLInputObjectType {\n return this.input(`${target.name}RelationshipFilters`, () => {\n const where = this.nodeWhere(target);\n return Object.fromEntries(\n QUANTIFIERS.map((q) => [\n q,\n {\n type: where,\n description: `Filter type where ${QUANTIFIER_WORD[q]} of the related ${pluralize(target.name)} match this filter`,\n },\n ]),\n );\n });\n }\n\n nodeAggregate(n: NodeType): GraphQLObjectType {\n return this.object(`${n.name}Aggregate`, () => {\n const fields: GraphQLFieldConfigMap<unknown, unknown> = { count: { type: nn(this.count()) } };\n if (n.attributes.some(isAggregable)) fields.node = { type: nn(this.nodeAggregateNode(n)) };\n return fields;\n });\n }\n\n nodeAggregateNode(n: NodeType): GraphQLObjectType {\n return this.object(`${n.name}AggregateNode`, () =>\n aggregateSelectionFields(this, n.attributes),\n );\n }\n\n nodeEdge(n: NodeType): GraphQLObjectType {\n return this.object(`${n.name}Edge`, () => ({\n cursor: { type: nn(GraphQLString) },\n node: { type: nn(this.node(n)) },\n }));\n }\n\n rootConnection(n: NodeType): GraphQLObjectType {\n return this.object(`${n.pascalPlural}Connection`, () => ({\n aggregate: { type: nn(this.nodeAggregate(n)) },\n edges: { type: nn(list(nn(this.nodeEdge(n)))) },\n pageInfo: { type: nn(this.pageInfo()) },\n totalCount: { type: nn(GraphQLInt) },\n }));\n }\n\n nodeCreate(n: NodeType): GraphQLInputObjectType {\n return this.input(`${n.name}CreateInput`, () => {\n const out = this.attributeCreateFields(n.attributes);\n for (const r of n.relationships) out[r.name] = { type: this.relFieldInput(r) };\n return out;\n });\n }\n\n nodeUpdate(n: NodeType): GraphQLInputObjectType {\n return this.input(`${n.name}UpdateInput`, () => {\n const out = this.attributeUpdateFields(n.attributes);\n for (const r of n.relationships)\n out[r.name] = { type: list(nn(this.relUpdateFieldInput(r))) };\n return out;\n });\n }\n\n nodeConnectWhere(n: NodeType): GraphQLInputObjectType {\n return this.input(`${n.name}ConnectWhere`, () => ({ node: { type: nn(this.nodeWhere(n)) } }));\n }\n\n nodeConnect(n: NodeType): GraphQLInputObjectType | undefined {\n if (!n.relationships.length) return undefined;\n return this.input(`${n.name}ConnectInput`, () =>\n Object.fromEntries(\n n.relationships.map((r) => [r.name, { type: list(nn(this.relConnectFieldInput(r))) }]),\n ),\n );\n }\n\n nodeDisconnect(n: NodeType): GraphQLInputObjectType | undefined {\n if (!n.relationships.length) return undefined;\n return this.input(`${n.name}DisconnectInput`, () =>\n Object.fromEntries(\n n.relationships.map((r) => [r.name, { type: list(nn(this.relDisconnectFieldInput(r))) }]),\n ),\n );\n }\n\n nodeDelete(n: NodeType): GraphQLInputObjectType | undefined {\n if (!n.relationships.length) return undefined;\n return this.input(`${n.name}DeleteInput`, () =>\n Object.fromEntries(\n n.relationships.map((r) => [r.name, { type: list(nn(this.relDeleteFieldInput(r))) }]),\n ),\n );\n }\n\n mutationResponse(n: NodeType, kind: \"Create\" | \"Update\"): GraphQLObjectType {\n return this.object(`${kind}${n.pascalPlural}MutationResponse`, () => ({\n info: { type: nn(kind === \"Create\" ? this.createInfo() : this.updateInfo()) },\n [n.plural]: { type: nn(list(nn(this.node(n)))) },\n }));\n }\n\n // -------------------------------------------------------------------------\n // Relationships (`${Source}${Field}…` types)\n // -------------------------------------------------------------------------\n\n private props(r: Relationship): PropertiesType | undefined {\n return r.properties ? this.model.properties.get(r.properties) : undefined;\n }\n\n relConnection(r: Relationship): GraphQLObjectType {\n return this.object(relConnectionName(r), () => ({\n aggregate: { type: nn(this.relAggregateSelection(r)) },\n edges: { type: nn(list(nn(this.relRelationship(r)))) },\n pageInfo: { type: nn(this.pageInfo()) },\n totalCount: { type: nn(GraphQLInt) },\n }));\n }\n\n relRelationship(r: Relationship): GraphQLObjectType {\n return this.object(`${prefix(r)}Relationship`, () => {\n const fields: GraphQLFieldConfigMap<unknown, unknown> = {\n cursor: { type: nn(GraphQLString) },\n node: { type: nn(this.node(this.model.node(r.target))) },\n };\n const p = this.props(r);\n if (p) fields.properties = { type: nn(this.propertiesObject(p)) };\n return fields;\n });\n }\n\n relAggregateSelection(r: Relationship): GraphQLObjectType {\n const base = `${r.source}${r.target}${upperFirst(r.name)}`;\n return this.object(`${base}AggregateSelection`, () => {\n const fields: GraphQLFieldConfigMap<unknown, unknown> = {\n count: { type: nn(this.countConnection()) },\n };\n const p = this.props(r);\n if (p && p.attributes.some(isAggregable)) {\n fields.edge = {\n type: this.object(`${base}EdgeAggregateSelection`, () =>\n aggregateSelectionFields(this, p.attributes),\n ),\n };\n }\n const target = this.model.node(r.target);\n if (target.attributes.some(isAggregable)) {\n fields.node = {\n type: this.object(`${base}NodeAggregateSelection`, () =>\n aggregateSelectionFields(this, target.attributes),\n ),\n };\n }\n return fields;\n });\n }\n\n relConnectionSort(r: Relationship): GraphQLInputObjectType {\n return this.input(`${relConnectionName(r)}Sort`, () => {\n const out: GraphQLInputFieldConfigMap = {};\n const p = this.props(r);\n if (p) out.edge = { type: this.propertiesSort(p) };\n out.node = { type: this.nodeSort(this.model.node(r.target)) };\n return out;\n });\n }\n\n relConnectionWhere(r: Relationship): GraphQLInputObjectType {\n return this.input(`${relConnectionName(r)}Where`, () => {\n const self = this.relConnectionWhere(r);\n const out: GraphQLInputFieldConfigMap = {\n AND: { type: list(nn(self)) },\n NOT: { type: self },\n OR: { type: list(nn(self)) },\n };\n const p = this.props(r);\n if (p) out.edge = { type: this.propertiesWhere(p) };\n out.node = { type: this.nodeWhere(this.model.node(r.target)) };\n return out;\n });\n }\n\n relConnectionFilters(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}ConnectionFilters`, () => {\n const where = this.relConnectionWhere(r);\n const sourcePlural = pluralize(r.source);\n const connPlural = pluralize(relConnectionName(r));\n const out: GraphQLInputFieldConfigMap = {\n aggregate: {\n type: this.relConnectionAggregateInput(r),\n description: `Filter ${sourcePlural} by aggregating results on related ${connPlural}`,\n },\n };\n for (const q of QUANTIFIERS) {\n out[q] = {\n type: where,\n description: `Return ${sourcePlural} where ${QUANTIFIER_WORD[q]} of the related ${connPlural} match this filter`,\n };\n }\n return out;\n });\n }\n\n relNodeAggregationWhere(r: Relationship): GraphQLInputObjectType {\n const self = (): GraphQLInputObjectType => this.relNodeAggregationWhere(r);\n return this.input(`${prefix(r)}NodeAggregationWhereInput`, () =>\n this.aggregationWhereFields(self, this.model.node(r.target).attributes),\n );\n }\n\n private aggregateInputEdgeNode(r: Relationship): GraphQLInputFieldConfigMap {\n const out: GraphQLInputFieldConfigMap = {};\n const p = this.props(r);\n if (p && p.attributes.some(isAggregable))\n out.edge = { type: this.propertiesAggregationWhere(p) };\n if (this.model.node(r.target).attributes.some(isAggregable)) {\n out.node = { type: this.relNodeAggregationWhere(r) };\n }\n return out;\n }\n\n relAggregateInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}AggregateInput`, () => {\n const self = this.relAggregateInput(r);\n const out: GraphQLInputFieldConfigMap = {\n AND: { type: list(nn(self)) },\n NOT: { type: self },\n OR: { type: list(nn(self)) },\n count: { type: this.intFilters() },\n };\n for (const op of [\"eq\", \"gt\", \"gte\", \"lt\", \"lte\"]) {\n out[`count_${op.toUpperCase()}`] = {\n type: GraphQLInt,\n deprecationReason: `Please use the relevant generic filter '{ count: { ${op}: ... } } }' instead.`,\n };\n }\n return { ...out, ...this.aggregateInputEdgeNode(r) };\n });\n }\n\n relConnectionAggregateInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}ConnectionAggregateInput`, () => {\n const self = this.relConnectionAggregateInput(r);\n return {\n AND: { type: list(nn(self)) },\n NOT: { type: self },\n OR: { type: list(nn(self)) },\n count: { type: this.connectionAggregationCountFilter() },\n ...this.aggregateInputEdgeNode(r),\n };\n });\n }\n\n relFieldInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}FieldInput`, () => ({\n connect: { type: list(nn(this.relConnectFieldInput(r))) },\n create: { type: list(nn(this.relCreateFieldInput(r))) },\n }));\n }\n\n relConnectFieldInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}ConnectFieldInput`, () => {\n const target = this.model.node(r.target);\n const out: GraphQLInputFieldConfigMap = {};\n const connect = this.nodeConnect(target);\n if (connect) out.connect = { type: list(nn(connect)) };\n const p = this.props(r);\n if (p) out.edge = { type: this.propertiesCreateRef(p) };\n out.where = { type: this.nodeConnectWhere(target) };\n return out;\n });\n }\n\n relCreateFieldInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}CreateFieldInput`, () => {\n const out: GraphQLInputFieldConfigMap = {};\n const p = this.props(r);\n if (p) out.edge = { type: this.propertiesCreateRef(p) };\n out.node = { type: nn(this.nodeCreate(this.model.node(r.target))) };\n return out;\n });\n }\n\n relDeleteFieldInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}DeleteFieldInput`, () => {\n const out: GraphQLInputFieldConfigMap = {};\n const del = this.nodeDelete(this.model.node(r.target));\n if (del) out.delete = { type: del };\n out.where = { type: this.relConnectionWhere(r) };\n return out;\n });\n }\n\n relDisconnectFieldInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}DisconnectFieldInput`, () => {\n const out: GraphQLInputFieldConfigMap = {};\n const dis = this.nodeDisconnect(this.model.node(r.target));\n if (dis) out.disconnect = { type: dis };\n out.where = { type: this.relConnectionWhere(r) };\n return out;\n });\n }\n\n relUpdateConnectionInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}UpdateConnectionInput`, () => {\n const out: GraphQLInputFieldConfigMap = {};\n const p = this.props(r);\n if (p) out.edge = { type: this.propertiesUpdate(p) };\n out.node = { type: this.nodeUpdate(this.model.node(r.target)) };\n out.where = { type: this.relConnectionWhere(r) };\n return out;\n });\n }\n\n relUpdateFieldInput(r: Relationship): GraphQLInputObjectType {\n return this.input(`${prefix(r)}UpdateFieldInput`, () => ({\n connect: { type: list(nn(this.relConnectFieldInput(r))) },\n create: { type: list(nn(this.relCreateFieldInput(r))) },\n delete: { type: list(nn(this.relDeleteFieldInput(r))) },\n disconnect: { type: list(nn(this.relDisconnectFieldInput(r))) },\n update: { type: this.relUpdateConnectionInput(r) },\n }));\n }\n}\n\nfunction scalarRef(name: string): TypeRef {\n return { name, list: false, required: false, elementRequired: false };\n}\n\n/** `MovieActors`: prefix of every type generated for the `Movie.actors` relationship. */\nexport function prefix(r: Relationship): string {\n return `${r.source}${upperFirst(r.name)}`;\n}\n\n/** `MovieActorsConnection`. */\nexport function relConnectionName(r: Relationship): string {\n return `${prefix(r)}Connection`;\n}\n\nfunction relationshipType(reg: TypeRegistry, r: Relationship): GraphQLOutputType {\n const target = reg.node(reg.model.node(r.target));\n if (r.list) {\n const inner = list(r.elementRequired ? nn(target) : target);\n return r.required ? nn(inner) : inner;\n }\n return r.required ? nn(target) : target;\n}\n\nfunction attributeOutputFields(\n reg: TypeRegistry,\n attributes: readonly Attribute[],\n): GraphQLFieldConfigMap<unknown, unknown> {\n const out: GraphQLFieldConfigMap<unknown, unknown> = {};\n for (const a of attributes) {\n const field: GraphQLFieldConfig<unknown, unknown> = {\n type: reg.attributeType(a.type),\n description: a.description,\n deprecationReason: a.deprecated,\n };\n out[a.name] = field;\n }\n return out;\n}\n\nfunction aggregateSelectionFields(\n reg: TypeRegistry,\n attributes: readonly Attribute[],\n): GraphQLFieldConfigMap<unknown, unknown> {\n return Object.fromEntries(\n attributes\n .filter(isAggregable)\n .map((a) => [a.name, { type: nn(reg.aggregateSelection(a.type.name)) }]),\n );\n}\n\n/** Builds the v7 schema (without resolvers) for a model. */\nexport function buildV7Schema(model: V7Model): GraphQLSchema {\n const reg = new TypeRegistry(model);\n for (const n of model.nodes) {\n for (const r of n.relationships) {\n if (!r.list) {\n throw new Error(\n `${n.name}.${r.name}: non-list relationships are not supported by @cyphra/graphql yet.`,\n );\n }\n }\n }\n const query = new GraphQLObjectType({\n name: \"Query\",\n fields: () => {\n const fields: GraphQLFieldConfigMap<unknown, unknown> = {};\n for (const n of model.nodes) {\n const listArgs: GraphQLFieldConfigArgumentMap = {\n limit: { type: GraphQLInt },\n offset: { type: GraphQLInt },\n sort: { type: list(nn(reg.nodeSort(n))) },\n where: { type: reg.nodeWhere(n) },\n };\n fields[n.plural] = { type: nn(list(nn(reg.node(n)))), args: listArgs };\n fields[`${n.plural}Connection`] = {\n type: nn(reg.rootConnection(n)),\n args: {\n after: { type: GraphQLString },\n first: { type: GraphQLInt },\n sort: { type: list(nn(reg.nodeSort(n))) },\n where: { type: reg.nodeWhere(n) },\n },\n };\n }\n return fields;\n },\n });\n const mutation = new GraphQLObjectType({\n name: \"Mutation\",\n fields: () => {\n const fields: GraphQLFieldConfigMap<unknown, unknown> = {};\n for (const n of model.nodes) {\n fields[`create${n.pascalPlural}`] = {\n type: nn(reg.mutationResponse(n, \"Create\")),\n args: { input: { type: nn(list(nn(reg.nodeCreate(n)))) } },\n };\n const del = reg.nodeDelete(n);\n fields[`delete${n.pascalPlural}`] = {\n type: nn(reg.deleteInfo()),\n args: {\n ...(del ? { delete: { type: del } } : {}),\n where: { type: reg.nodeWhere(n) },\n },\n };\n fields[`update${n.pascalPlural}`] = {\n type: nn(reg.mutationResponse(n, \"Update\")),\n args: {\n update: { type: reg.nodeUpdate(n) },\n where: { type: reg.nodeWhere(n) },\n },\n };\n }\n return fields;\n },\n });\n return new GraphQLSchema({ query, mutation });\n}\n","/**\n * Scalars of the v7 API. Same names, descriptions and input/output formats as `@neo4j/graphql`:\n * `BigInt` is returned as a string, `Date` as `yyyy-mm-dd`, `DateTime` as an ISO-8601 string.\n *\n * @packageDocumentation\n */\n\nimport { GraphQLError, GraphQLScalarType, Kind } from \"graphql\";\nimport neo4j, { isDate, isDateTime, isInt } from \"neo4j-driver\";\n\nexport const GraphQLBigInt = new GraphQLScalarType({\n name: \"BigInt\",\n description:\n \"A BigInt value up to 64 bits in size, which can be a number or a string if used inline, or a string only if used as a variable. Always returned as a string.\",\n serialize(value) {\n if (isInt(value)) return value.toString(10);\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\" || typeof value === \"bigint\") return value.toString(10);\n throw new GraphQLError(`BigInt cannot represent value: ${String(value)}`);\n },\n parseValue(value) {\n if (typeof value !== \"string\") {\n throw new GraphQLError(\n \"BigInt values are not JSON serializable. Please pass as a string in variables, or inline in the GraphQL query.\",\n );\n }\n try {\n return neo4j.int(value, { strictStringValidation: true });\n } catch {\n throw new GraphQLError(\n \"Value must be either a BigInt, or a string representing a BigInt value.\",\n );\n }\n },\n parseLiteral(ast) {\n if (ast.kind === Kind.INT || ast.kind === Kind.STRING) {\n try {\n return neo4j.int(ast.value, { strictStringValidation: true });\n } catch {\n // fall through\n }\n }\n throw new GraphQLError(\n \"Value must be either a BigInt, or a string representing a BigInt value.\",\n );\n },\n});\n\nconst formatDate = (s: string): string => new Date(s).toISOString().split(\"T\")[0]!;\n\nexport const GraphQLDate = new GraphQLScalarType({\n name: \"Date\",\n description: \"A date, represented as a 'yyyy-mm-dd' string\",\n serialize(value) {\n if (typeof value === \"string\") return formatDate(value);\n if (isDate(value as object)) return formatDate(String(value));\n throw new GraphQLError(`Date cannot represent value: ${String(value)}`);\n },\n parseValue(value) {\n if (typeof value === \"string\") {\n const d = new Date(value);\n if (Number.isNaN(d.getTime())) {\n throw new GraphQLError(`Date cannot represent non temporal value: ${value}`);\n }\n return neo4j.types.Date.fromStandardDate(d);\n }\n if (isDate(value as object)) return value;\n throw new GraphQLError(`Date cannot represent non string value: ${String(value)}`);\n },\n parseLiteral(ast) {\n if (ast.kind !== Kind.STRING) throw new GraphQLError(\"Date cannot represent non string value.\");\n return neo4j.types.Date.fromStandardDate(new Date(ast.value));\n },\n});\n\nexport const GraphQLDateTime = new GraphQLScalarType({\n name: \"DateTime\",\n description: \"A date and time, represented as an ISO-8601 string\",\n serialize(value) {\n if (typeof value === \"string\") return new Date(value).toISOString();\n if (isDateTime(value as object)) return new Date(String(value)).toISOString();\n if (value instanceof Date) return value.toISOString();\n throw new GraphQLError(`DateTime cannot represent value: ${String(value)}`);\n },\n parseValue(value) {\n if (typeof value === \"string\") {\n if (Number.isNaN(new Date(value).getTime())) {\n throw new GraphQLError(`DateTime cannot represent non temporal value: ${value}`);\n }\n return value;\n }\n throw new GraphQLError(`DateTime cannot represent non string value: ${String(value)}`);\n },\n parseLiteral(ast) {\n if (ast.kind !== Kind.STRING)\n throw new GraphQLError(\"DateTime cannot represent non string value.\");\n return ast.value;\n },\n});\n","/**\n * GraphQL for Neo4j on the Cyphra runtime.\n *\n * `compat.v7` serves the API `@neo4j/graphql` v7 generates from the same type definitions, so\n * frontends can switch without changing their queries.\n *\n * @packageDocumentation\n */\n\nimport * as v7 from \"./v7/index.js\";\n\nexport const compat = { v7 } as const;\n\nexport type { MakeSchemaOptions } from \"./v7/index.js\";\nexport { UnsupportedTypeDefsError } from \"./v7/model.js\";\n\nexport {\n GraphQLImportError,\n convertGraphQLTypeDefs,\n formatImportReport,\n mergeImportedSchema,\n printImportedSchema,\n type GraphQLImportResult,\n type GraphQLSource,\n type ImportIssue,\n type ImportSeverity,\n} from \"./import/index.js\";\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAAA,EACE;AAAA,OAIK;AACP,SAAS,iBAAAA,sBAA4D;;;ACHrE;AAAA,EACE;AAAA,EACA,QAAAC;AAAA,EACA;AAAA,EACA;AAAA,OAKK;;;ACEP,SAAS,YAAY;AAiCrB,IAAM,UAAU;AAGT,IAAM,UAAmD;AAAA,EAC9D,IAAI,EAAE,MAAM,SAAS;AAAA,EACrB,QAAQ,EAAE,MAAM,SAAS;AAAA,EACzB,KAAK,EAAE,MAAM,MAAM;AAAA,EACnB,OAAO,EAAE,MAAM,QAAQ;AAAA,EACvB,SAAS,EAAE,MAAM,UAAU;AAAA,EAC3B,UAAU,EAAE,MAAM,WAAW;AAAA,EAC7B,MAAM,EAAE,MAAM,OAAO;AAAA,EACrB,QAAQ,EAAE,aAAa,UAAU,OAAO,GAAG;AAAA,EAC3C,MAAM,EAAE,aAAa,QAAQ,OAAO,GAAG;AAAA,EACvC,WAAW,EAAE,aAAa,aAAa,OAAO,GAAG;AAAA,EACjD,eAAe,EAAE,aAAa,iBAAiB,OAAO,GAAG;AAAA,EACzD,UAAU,EAAE,aAAa,YAAY,OAAO,GAAG;AAAA,EAC/C,OAAO,EAAE,aAAa,SAAS,OAAO,GAAG;AAAA,EACzC,gBAAgB,EAAE,aAAa,k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AK,MAAM,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC;AACzC;AAOO,SAAS,aAAa,UAI3B;AACA,QAAM,EAAE,UAAU,OAAO,IAAI,uBAAuB;AAAA,IAClD,EAAE,MAAM,oBAAoB,MAAM,SAAS;AAAA,EAC7C,CAAC;AACD,SAAO,EAAE,UAAU,OAAOC,eAAc,QAAQ,GAAG,OAAO;AAC5D;;;Ac3IO,IAAM,SAAS,EAAE,eAAG;","names":["resolveSchema","Kind","labels","list","Kind","Kind","neo4j","GraphQLError","issue","Kind","parse","directive","arg","stringArg","Kind","parse","labels","prefix","list","isDateTime","q","agg","list","Kind","list","neo4j","out","items","GraphQLError","isInt","isPlainObject","isInt","GraphQLError","arg","list","data","v","neo4j","neo4j","GraphQLError","Kind","neo4j","isInt","SCALARS","q","resolveSchema"]}
|