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

@icapps/wcf-astrum

v0.33.2

Published

API for WFM using WCF protocol

Downloads

319

Readme

WCF Astrum

API for WFM using WCF protocol

Installation

Install via npm

npm install @icapps/wcf-astrum

or via yarn

yarn add @icapps/wcf-astrum

Usage

const wcf = require('@icapps/wcf-astrum');
import * as wcf from '@icapps/wcf-astrum';

Context

This module is Astrum specific and is used to communicate with their API (with WCF). The module is split into seperate modules and modules (objects) are going to be added incrementally. Below each api method with abstract explanation of what they do.

Configuration

Configuration needs to be set globally before trying to call any API functions. It is required to define contracts and schemas. Every api method will throw an error if the correct namespace or contract key was not found.

setConfig({ schemas, contracts })

Sets the global configuration.

setConfig({
  contracts: {
    v1: 'v1 contract',
  },
  schemas: {
    defaultSchema: 'default schema',
  },
});

getConfig()

Returns the globally set configuration.

Available API

All available api methods are nested under an object. For example if you wish to get a session you need to call it under the auth object.

Example:

import { auth } from '@icapps/wcf-astrum';
auth.getSession(...);

Auth

getSession(proxy, username, password)

returns a session with WCF, this session is used to retrieve resources

endSession(proxy, session)

kills the given session

getIdFromName(proxy, session, context, key)

Get the id using a name

Employee

getEmployees(proxy, session)

returns all employees

Schedule

getSchedule(proxy, session, employeeId, fromDate, toDate)

returns the schedule for given employee and date range

getDepartmentSchedule(proxy, session, employeeIds, fromDate, toDate)

Returns the departmentSchedule for given employeeIds

getAvailabilities(proxy, session, employeeId, filters, scheduleLevel)

Returns the availabilities for given employee

writeAvailabilities(proxy, session, departmentId, employeeId, availabilityShiftId, entries, scheduleLevel)

Write an availability

writeAbsence(proxy, session, departmentId, employeeId, shiftId, startDay, endDay, scheduleLevel, operation, schoolShiftId, availabilityShiftId)

Write an absence for a full day

writeAbsenceInterval(proxy, session, departmentId, employeeId,absenceIntervalId, day, from, to, notOverwriteableTimeTypes)

Write an absence for an interval

checkVacationRequestRuleViolation(proxy, session, employeeId, shiftId, fromDate, untilDate)

Check if the vacation request has a rule violation

checkScheduleRuleViolation(proxy, session, employeeId, shifts, date)

Check if there is a rule violation on write schedule

writeShiftOffer(proxy, session, departmentId, employeeId, shifts, date)

Write a shift offer

Time Registration

getCorrections(proxy, session, employeeId, filters)

Get time registrations for an employee id

saveCorrection(proxy, session, employeeId, eventType, timestamp)

Save a time registrations for an employee

Counters

getCounters(proxy: IProxy, session: ISession, employeeId: string, counterIds: string[], startdate: string, endDate: string)

Return all balance valuse for a given employee id and date range

Info

getSpxObject(proxy, session, id, type)

Returns an spx object with more info

getEmployeeIdsInDepartment(proxy, session, departmentId, startDate, endDate)

Returns all the employee ids for given departmentId and date range

Tests

  • You can run npm run test to run all tests
  • You can run npm run test:coverage to run all tests with coverage report

External tests - contract testing

  • You can run npm run test:external to run all test + the external contract tests

These tests will test the actual responses coming back from the WCF application. It will perform real API calls and expect that the response object properties match.

You need to provide all proper environment variables defined in .env.test.example. This has been done for security purposes.