npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sparklink-pro/apant

v2.0.1

Published

Apollo & Antd tools

Readme

apant

Apollo & Antd tools

Table of Contents

Usage

import { TypesContext, TypesRegistry, useTypeList } from "apant";

import client from "./apollo";
import operations from "./gql";
import types from "./types";

const typesRegistry = new TypesRegistry({ types, operations, apollo: client });

const Root = () => (
  <TypesContext.Provider value={typesRegistry}>
    <YourApp />
  </TypesContext.Provider>
);

TypesRegistryConfiguration

| Property | Description | Type | Default | | :-----------: | :-----------------------------: | :----------------------------------------------------------------: | :-----: | | apollo | Apollo client instance | ApolloClient<NormalizedCacheObject> | - | | configuration | GraphQL Operation configuration | Partial<TypeOperationConfiguration> | - | | operations | GraphQL Operation file | { [name: string]: any }; | - | | types | List of types configuration | { [type: string]: TypeConfiguration } | - |

example type

//types/index.ts
import { Foo } from "./Foo";

export default {
  foo
};

// example/src/types/Book.ts
import { TypeConfiguration } from 'apant';

const Book: TypeConfiguration = {
    label: 'title',
    search: 'title',
    admin: {
        route: 'admin/Book',
        searchable: true,
        selectable: true,
        filter(pattern: any) {
            return pattern.rank >= 9;
        },
        columns: () => [
            {
                title: 'Title',
                dataIndex: 'title',
                link: true,
            },
            {
                title: 'Description',
                dataIndex: 'description',
            },
            {
                title: 'Price',
                dataIndex: 'price',
                sorter: {
                    compare: (a: any, b: any) => a.price - b.price,
                },
            },
        ],
    },
    forms: {
        default: {
            props: {
                layout: 'vertical',
            },
            fields: [
                { name: 'title', label: 'Title' },
                { name: 'description', label: 'Description' },
                { name: 'price', label: 'Price', widget:'number' },
                { name: 'rank', label: 'Rank' },
                { name: 'author', label: 'Author',widget: {widget:'select_type', expand:true , type: 'Author'}},
                { name: 'genres', label: 'Genre', widget: {widget:'select_types', expand:true, type: 'Genre'}},
            ],
        },
    },
};
export default Book;

TypeOperationConfiguration

| Property | Description | Type | Default | | :--------: | :---------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------: | | admin | admin configuration | TypeConfigurationAdmin | - | | forms | A list of configured forms for this types | { [formName: string]: <FormConfigurationType } | - | | id | What is the id property for this type? | string | id | | label | For selectType | string|() =>string|React.ReactNode) | '_name' property | | metadata | Additional configuration for this type | { [key: string]: any } | - | | operations | Operation configuration for given type | Partial<TypeOperationConfiguration> | - | | order | For SelectType | order:string| {[field:string]:'asc'|'desc'} | 'asc' | | search | search in type | string|string[] | ((object:GraphQLObject,context?:any)=>string)|{custom:(object:GraphQLObject,search:string,context?:any)=>boolean} | - | | select | Select type widget configuration | { label: any; fragment: any }; | - |

TypeConfigurationAdmin

| Property | Description | Type | Default | | :-------------: | :--------------------------: | :--------------------------------------------------------------------------: | :-----: | | columns | the configColumns | ()=>Promise|ColumnsType(see AntDesign) | - | | creatable | allows to create new items | bool | true | | filter | Filter items | (item:object)=>boolean | - | | footerComponent | Custom footer | React.ComponentType<AdminHeaderType> | - | | headerComponent | Custom header | React.ComponentType<AdminHeaderType> | - | | route | | string | - | | searchable | Allow to search in this type | bool | true | | selectable | Allow to select | bool | true | | props | | TableProps<GraphQLObject> | - |

FormConfigurationType

| Property | Description | Type | Default | | :------: | :---------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----: | | fields | the fields | FormEntryType[] | ((context: FormContextType) => FormEntryType[]); | - | | props | | props?: Omit<FormProps, 'onFinish'> | ((context: FormContextType) => Omit<FormProps, 'onFinish'>); | - | | mappers | | FormFieldMapperType[] | ((context: FormContextType) => FormFieldMapperType[]) | - |

FormFieldExtraType

| Property | Description | Type | Default | | :----------: | :---------------------------------------------------------------------------: | :-------------------------------------------------------------------------------: | :-----: | | auto | Should this field be display when the related form is diplayed automatically? | bool | false | | group | Is the field parts of a group ? | bool | false | | initialValue | What is the initial/default value of the field? | ((context:FormContextType) => any) |any; | - | | list | Is this field a list (ie. Form.List from antd) | bool | false | | mapped | Should this field be removed before submitting? | boolean | ((context: FormContextType) => boolean | Promise); | true | | auto | Should this field be display when the related form is diplayed automatically? | boolean | ((context: FormContextType) => boolean | ); | true |

Use AdminType

<AdminType
  key={type}
  type={type}
  heights={{ offset: 16 }}
  {...getDefaultTableProps()}
  />

Use Form

Basic use, if you want further customization, see our demo.


const formConfig = {
  props: { layout: "vertical" },
  fields: [
    {
      name: "name",
      label: "Nom",
      required: true,
      rules: [{ required: true }],
      initialValue: "Ode"
    },
    { name: "firstname", label: "Prénom", initialValue: "Jack" },
    { name: ['position','name'], label: 'Position'},
  ]
};

const object = {
    name: 'Doe',
    city: 'Paris',
    position:{
        name: 'Software Engineer',
        company: 'Google'
    },
};

  //...
  <Form
    config={formConfig}
    onFinish={values => console.log(values)}
    context={{ object }}
    footer={
      <div className="text-center">
        <Button type="primary" htmlType="submit">
          Sauvegarder
        </Button>
      </div>
    }
  />
);

| Property | Description | Type | Default | | :--------------------------------------: | :-----------------------------------: | :-----------------------------------------------------------------------------------------------------: | :-----: | | children | | React.ReactNode |((fields: FormEntryResolvedType[], form: FormInstance) => React ReactNode) | - | | config | Configuration of the form | FormConfigurationType | - | | context | Context of the form | Omit<FormContextType, 'form'> | - | | formProps | Additional form Props | Partial<FormAntProps> | - | | footer | the footer | React.ReactNode | - | | header | the header | React.ReactNode | - | | onValue | Process form values before submitting | (values: object, context: FormContextType) => Promise<object>; | | | & Omit<FormAntProps, 'children'> | | | |

Working locally with apant

Working locally with apant relies on yalc and yarn.

First, you neeed to compile the project.

$ cd apant
$ yarn
$ yarn build

Then, you'll need to publish the project with yalc.

$ yalc publish
apant@xxx published in store.

The project is now in the yalc store and is available to use for other project.

Use the apant in your project

To use the library in your local project, you need to link it with yalc.

$ cd myproject/
$ yalc link apant

apant is now linked to the project.

Work in realtime

To work and use apant in realtime, we must watch apant for change, compile it and publish it the yalc store.
To do so, we use the npm command defined in the package.json by

"watch-publish": "tsc-watch --onSuccess \"yalc push\""
$ cd apant/
$ yarn watch-publish

Test