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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vital-ai/haley-group-instance

v1.0.15

Published

## develop install npx: npm install -g npx

Downloads

20

Readme

haley-group-instance-js

develop

install npx: npm install -g npx

unit test set up

should copy all the domains file into vitalservice/domains, domains files are only use for testing. will not be compiled and published to npm. use command: npm run test

build

use command: npm run build

publish to npm // should update the package version every time we publish a package.

use command: npm publish

install

    npm install @vital-ai/haley-group-instance

Assumptions

  • under all sections (not insider row), there could only be one answer with answerType.
  • under one row, answer with a specific answerType is uniq.
  • under a group, there could only be one Row with a specific rowType.

GroupAPI

    // creating instances objects
    signature: createQaInstanceObjects(qaObjects: GraphObject[], withRow=false, option: CreateQaInstancesOption={});
    withRow = false, means the created Instances will not includes rowInstance and any questionInstance under it.
    option = { groupInstance } will passed in the groupInstance and it will stop the method from creating a new one.

    const groupAPI = new GroupAPI(vitaljs, logger);
    const qaInstanceObjects = groupAPI.createQaInstanceObjects(qaObjects);

    // setting value by answerType
    const answerType = 'http://vital.ai/haley.ai/harbor-saas/HaleyAnswerType/NamedInsured_Contact_PrimaryEmailAddress';
    groupAPI.setValueByAnswerType(qaObjects, qaInstanceObjects, answerType, '[email protected]');


    // getting value by answerType
    const answerType = 'http://vital.ai/haley.ai/harbor-saas/HaleyAnswerType/NamedInsured_Contact_PrimaryEmailAddress';
    const value = groupAPI.getValueByAnswerType(qaObjects, qaInstanceObjects, answerType);

    // setValueByAnswerTypeInsideRow
    const rowTypeURI = 'http://vital.ai/ontology/haley-ai-question#RowType_Harbor_Policy';
    const answerType = 'http://vital.ai/haley.ai/harbor-saas/HaleyAnswerType/NamedInsured_Contact_PrimaryEmailAddress';
    const rowInstanceCounter = 'AB'; // the second instance of rowType
    const value = '[email protected]';
    groupAPI.setValueByAnswerTypeInsideRow(qaObjects, qaInstanceObjects, rowInstanceCounter, rowType, answerType, value)

    // getValueByAnswerTypeInsideRow
    const value = groupAPI.setValueByAnswerTypeInsideRow(qaObjects, qaInstanceObjects, rowInstanceCounter, rowType, answerType, value);

    // setValueByAnswerTypeInsideRowRow 
    const rowTypeURI = 'http://vital.ai/ontology/haley-ai-question#RowType_Harbor_Policy';
    const rowRowTypeURI = 'http://vital.ai/ontology/haley-ai-question#RowType_Harbor_Location';
    const answerType = 'http://vital.ai/haley.ai/harbor-saas/HaleyAnswerType/NamedInsured_Street_1';
    const rowInstanceCounter = 'AB'; // the second instance of rowType
    const rowRowInstanceCounter = 'AA';
    const value = '540 Grand street';
    groupAPI.setValueByAnswerTypeInsideRowRow(qaObjects, qaInstanceObjects, rowInstanceCounter, rowType, rowRowInstanceCounter, rowRowType, answerType, value)

    // getValueByAnswerTypeInsideRowRow
    const value = groupAPI.setValueByAnswerTypeInsideRowRow(qaObjects, qaInstanceObjects, rowInstanceCounter, rowType, rowRowInstanceCounter, rowRowType, answerType);

    // getRowInstanceCountersByRowType
    const rowTypeURI = 'http://vital.ai/ontology/haley-ai-question#RowType_Harbor_Policy';
    const counters = groupAPI.getRowInstanceCountersByRowType(qaObjects, qaInstanceObjects, rowTypeURI); // ['AA', 'AB', 'AC', ...];

    // getRowRowInstanceCountersByRowRowType
    const rowTypeURI = 'http://vital.ai/ontology/haley-ai-question#RowType_Harbor_Policy';
    const rowRowTypeURI = 'http://vital.ai/ontology/haley-ai-question#RowType_Harbor_Location';
    const rowInstanceCounter = 'AB'; // the second instance of rowType
    const counters = groupAPI.getRowRowInstanceCountersByRowRowType(qaObjects, qaInstanceObjects, rowTypeURI, rowInstanceCounter, rowRowTypeURI); // ['AA', 'AB', 'AC', ...];

    // created Row instance qa objects
    // argument rowInstanceCounter will be optional, if not provided, it will incremented as 'AA', 'AB', .... 'ZZ'.
    const createdInstances = groupAPI.createRowQaInstancesByRowType(qaObjects, qaInstanceObjects, rowTypeURI, rowInstanceCounter);
    qaInstanceObjects = [...qaInstanceObjects, ...createdInstances];

    // addRowQaInstancesByRowType directly update to qaInstanceObjects;
    // argument rowInstanceCounter will be optional, if not provided, it will incremented as 'AA', 'AB', .... 'ZZ'.
    groupAPI.addRowQaInstancesByRowType(qaObjects, qaInstanceObjects, rowTypeURI, rowInstanceCounter);

    // removeRowQaInstancesByRowTypeAndInstanceCounter
    const updatedQaInstanceObjects = groupAPI.removeRowQaInstancesByRowTypeAndInstanceCounter(qaObjects, qaInstanceObjects, rowTypeURI, rowInstanceCounter);

    // addRowRowQaInstancesByRowType directly update to qaInstanceObjects;
    // argument rowRowInstanceCounter will be optional, if not provided, it will incremented as 'AA', 'AB', .... 'ZZ'.
    groupAPI.addRowRowQaInstancesByRowType(qaObjects, qaInstanceObjects, rowTypeURI, rowInstanceCounter, rowRowTypeURI, rowRowInstanceCounter);

    const updatedQaInstanceObjects = groupAPI.removeRowRowQaInstancesByRowTypeAndInstanceCounter(qaObjects, qaInstanceObjects, rowTypeURI, rowInstanceCounter, rowRowTypeURI, rowRowInstanceCounter);

    // get all rowTypes under sections.
    const rowTypes: string[] = groupAPI.getRowTypes(qaObjects);

    // get all rowTypes under row (with rowType).
    const rowTypes: string[] = groupAPI. getRowTypesInRow(qaObjects, rowType);

Split api

    const graph: SplitGraph = groupAPI.splitGroupAndInstances(mixGroupGraphAndGroupInstanceGraphObjects GraphObject[]);

    interface SplitGraph {
        groupGraphContainerList: GroupGraphContainer[],
        instanceGraphContainerList: GroupInstanceGraphContainer[],
        generalGraphObjects: GeneralGraphContainer,
    }

    interface GroupGraphContainer {
        type: 'GroupGraph'
        isCompete: boolean                            // indicating the graph is complete or not
        incompleteMessages: string[]                  // indicating what objects are missing in the graph
        all: obj[]                                    // all objects
        group: obj                                    // the group object
        groupURI: string                              // the uri of the group object
        getObjectByURI: (uri: string) => obj | null   // method to get the obj by uri;
        getObjectsByType: (type: string) => obj[]     // method to get all the objects with provided type in the container
        has: (uri: string) => boolean                 // method to detect whether the container has the obj with uri
    }

    interface GroupInstanceGraphContainer {
        type: 'GroupInstanceGraph'
        isCompete: boolean                            // indicating the graph is complete or not
        incompleteMessages: string[]                  // indicating what objects are missing in the graph
        all: obj[]                                    // all objects
        groupInstance: obj                            // the groupInstance object
        groupInstanceURI: string                      // the uri of the groupInstance object
        groupURI: string                              // the uri of the group object
        getObjectByURI: (uri: string) => obj | null   // method to get the obj by uri;
        getObjectsByType: (type: string) => obj[]     // method to get all the objects with provided type in the container
        has: (uri: string) => boolean                 // method to detect whether the container has the obj with uri
    }

    interface GeneralGraphContainer {
        type: 'GeneralGraph'
        all: obj[]                                    // all objects
        getObjectByURI: (uri: string) => obj | null   // method to get the obj by uri;
        getObjectsByType: (type: string) => obj[]     // method to get all the objects with provided type in the container
        has: (uri: string) => boolean                 // method to detect whether the container has the obj with uri
    }