Member Junction
    Preparing search index...

    This class is responsible for generating the GraphQL Server resolvers and types for the entities, you can sub-class this class to extend/modify the logic, make sure to use @memberjunction/global RegisterClass decorator so that your class is used.

    Index

    Constructors

    Properties

    _graphQLTypeSuffix: string = '_'

    Accessors

    Methods

    • Generates import statements for entity classes, grouping by package when entityPackageName is a schema-to-package map.

      Parameters

      • entities: EntityInfo[]
      • defaultLibrary: string
      • isInternal: boolean

      Returns string

    • Parameters

      • entities: EntityInfo[]
      • outputDirectory: string
      • generatedEntitiesImportLibrary: string
      • excludeRelatedEntitiesExternalToSchema: boolean

      Returns boolean

    • Generates the base GraphQL type name for an entity using SchemaBaseTable pattern. Preserves original capitalization. Special case: MJ core schema uses "MJ" prefix. This ensures unique type names across different schemas.

      Parameters

      • entity: EntityInfo

        The entity to generate the type name for

      Returns string

      The base GraphQL type name (without suffix)

    • Maps a column's SQL type to the TypeGraphQL @Field(...) type-fn argument.

      Categories that emit an empty string fall through to TypeGraphQL's automatic inference based on the field's TypeScript type — appropriate for string, Date, and binary-as-string columns. Boolean / Float require an explicit type fn, and anything else defaults to Int.

      The category checks come from @memberjunction/sql-dialect so that the list of recognized type names lives in exactly one place per category.

      Parameters

      Returns string

    • True when the related entity's GraphQL ObjectType will NOT be declared in the file being generated, so emitting a @Field/@FieldResolver that names it would not compile (TS2304).

      When availability is supplied (every in-tree caller supplies it), the decision is made against the ACTUAL set of entities being generated into this file rather than inferred from schema or package heuristics. That set is ground truth: a bare-name reference compiles iff the class is emitted here, and the class is emitted here iff the entity was in the array handed to the generator. Heuristics can only approximate that set — runCodeGen narrows the generated entities by BOTH the entityPackageName schema→package map AND the excludeSchemas/inclusion filters, so a predicate that models only the package map still emits uncompilable references for anything dropped by the other filter (the linked-Open-App break: a base app generated alongside a dependent app that foreign-keys into it).

      The one exception is a CORE (__mj) related entity in a NON-core file: it is absent from the generated set but resolves through the mj_core_schema_server_object_types namespace import, so it is always in scope. In the core file itself there is no such import (that file is the module), so core related entities must satisfy set membership like everything else.

      excludeRelatedEntitiesExternalToSchema is honored first and unchanged: it asks for a schema-scoped file, which is a narrower request than type availability.

      Parameters

      • entity: EntityInfo
      • relatedEntity: EntityInfo
      • excludeRelatedEntitiesExternalToSchema: boolean
      • Optionalavailability: GeneratedTypeAvailability

        the types resolvable in this file; when omitted, falls back to the legacy entityPackageName schema→package heuristic so that existing subclasses and callers using the pre-availability signature keep their previous behavior.

      Returns boolean

    • Returns a JavaScript expression string (for use in generated code) that resolves to the schema name at runtime. Core schema uses the dynamic config lookup; non-core schemas use a literal string.

      Parameters

      Returns string