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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@digitregroup/cornerstone-client

v0.1.1

Published

Client for Cornerstone api

Downloads

94

Readme

Cornerstone client API

Description

It's an api client to request Cornerstone REST Services and Reporting Services.

  • Documentation apiexplorer.csod.com
  • There are several examples in repository test/
  • Be careful, userid, id and many more have different value in Reporting and REST for the same user and same key

Reporting API

The Reporting API is a public facing web service that allows clients programmatic read-only access to their Cornerstone data via the Realtime Data Warehouse. It adheres to the OData protocol (http://www.odata.org/)

There are some use cases in tests repository.

  • tests/reporting-api.test.js
  • tests/rest-api.test.js

How to use

const params = {
    apiId:          Api Id, can be retrieved within the Manage API tab in Integration Center.
    apiSecret:      Api Secret, can be retrieved within the Manage API tab in Integration Center.
    corpname:       Client assigned hostname for CSOD application
    region:         Aws-region,
    dynamodbName:   Aws dynamodb,
};

const cornerstone = new Cornerstone(params);

const user = await cornerstone.getReportingUserByEmail({email: reporting_user_email});

Queries

URL Option | Syntax | Description ----------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- Get Available Resources | {baseURL}/views | This call returns a list of available resources (views). Get Metadata | {baseURL}/views/$metadata | This call returns a list of resources and their meta-data. This call returns XML instead of JSON**** Get Specific Resource | {baseURL}/views/vw_rpt_user | Returns detail payload for specific resource. Select | {baseURL}/views/vw_rpt_user?$select={comma separated field list} | Returns detail payload for specific selected fields for resource. Filter | {baseURL}/views/vw_rpt_user?$filter={query filter} | Returns specific data as per filter value for resource. Odata standards should be followed for operator types Top | {baseURL}/views/vw_rpt_user?$top={max records} | Limits the number of records returned by the query.

Filter Supported Operators

URL Option | Syntax --------------------- | ---------------------------------------------------------------------------------------------------------------------- Equals | {baseURL}/views/vw_rpt_user?$filter=user_id eq 78 Not Equals | {baseURL}/views/vw_rpt_user?$filter=user_id ne 78 Greater Than | {baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt gt cast('2016-08-16', Edm.DateTimeOffset) Greater Than or Equal | {baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt ge cast('2016-08-16', Edm.DateTimeOffset) Less Than | {baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt lt cast('2016-08-16', Edm.DateTimeOffset) Less Than or Equal | {baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt le cast('2016-08-16', Edm.DateTimeOffset) Logical 'AND' | {baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt le cast('2016-08-16', Edm.DateTimeOffset) and user_id eq 78 Logical 'OR' | {baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt le cast('2016-08-16', Edm.DateTimeOffset) or user_id eq 78 Logical 'NOT' | {baseURL}/views/vw_rpt_user?$filter=not (user_id eq 78)

REST API

The REST API allows programmatic access to the REST record within the Cornerstone application. This service enables clients to create, update, and read REST data.

How to use

const params = {
apiId:     Api Id, can be retrieved within the Manage API tab in Integration Center.
apiSecret: Api Secret, can be retrieved within the Manage API tab in Integration Center.
username: A valid username in the portal.
alias: An arbitrary title for your session.
corpname: Client assigned hostname for CSOD application
};

const cornerstone = new Cornerstone(params);

const user = await cornerstone.updateEmployeeByUserId({
    id: rest_id,
    data: {"personalEmail": rest_email}
});

const user = await cornerstone.getEmployeeByUserId({userId: rest_userId});

Set Active or inactive

const user = await cornerstone.updateEmployeeByUserId({
    id:   2328,
    data : {"workerStatus":{active: true}}
});

active = user_status_id = 1 inActive = user_status_id = 2