Home / Function/ createCollectionType() — supabase Function Reference

createCollectionType() — supabase Function Reference

Architecture documentation for the createCollectionType() function in connections.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  142dc086_6deb_1447_62a9_58b1521311df["createCollectionType()"]
  1b2b73ba_8c31_fa3f_0d0c_c864516123ad["extractNodeTypeName()"]
  142dc086_6deb_1447_62a9_58b1521311df -->|calls| 1b2b73ba_8c31_fa3f_0d0c_c864516123ad
  a2c6c6c2_a03f_fbd8_01d2_1110ce962f66["createEdgeType()"]
  142dc086_6deb_1447_62a9_58b1521311df -->|calls| a2c6c6c2_a03f_fbd8_01d2_1110ce962f66
  style 142dc086_6deb_1447_62a9_58b1521311df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/resources/utils/connections.ts lines 134–185

export function createCollectionType(
  nodeType: GraphQLOutputType,
  {
    name,
    description,
    skipPageInfo = false,
  }: {
    /**
     * The name of the generated collection.
     *
     * If omitted, defaults to NameOfInnerNodeCollection.
     */
    name?: string
    /**
     * A description of the collection that will be outputted in the generated
     * schema as documentation.
     */
    description?: string
    /**
     * Whether to skip the pageInfo field.
     */
    skipPageInfo?: boolean
  } = {}
): GraphQLObjectType {
  const collectionName = name || `${extractNodeTypeName(nodeType)}Collection`
  const edgeType = createEdgeType(nodeType, { skipCursor: skipPageInfo })

  return new GraphQLObjectType({
    name: collectionName,
    description: description || `A collection of ${extractNodeTypeName(nodeType)}s`,
    fields: {
      edges: {
        type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(edgeType))),
        description: 'A list of edges containing nodes in this collection',
      },
      nodes: {
        type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(nodeType))),
        description: 'The nodes in this collection, directly accessible',
      },
      ...(!skipPageInfo && {
        pageInfo: {
          type: new GraphQLNonNull(PageInfoType),
          description: 'Pagination information',
        },
      }),
      totalCount: {
        type: new GraphQLNonNull(GraphQLInt),
        description: 'The total count of items available in this collection',
      },
    },
  })
}

Subdomains

Frequently Asked Questions

What does createCollectionType() do?
createCollectionType() is a function in the supabase codebase.
What does createCollectionType() call?
createCollectionType() calls 2 function(s): createEdgeType, extractNodeTypeName.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free