This package has been deprecated

Author message:

Package not maintained anymore. Use @icapps/wcf-astrum instead

wcf-astrum
TypeScript icon, indicating that this package has built-in type declarations

0.0.19 • Public • Published

WCF Astrum

API for WFM using WCF protocol

Installation

Install via npm

npm install wcf-astrum

or via yarn

yarn add wcf-astrum

Usage

const wcf = require('wcf-astrum')
import * as wcf from '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 '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, fromDate, toDate)

Returns the availabilities for given employee

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.

Readme

Keywords

none

Package Sidebar

Install

npm i wcf-astrum

Weekly Downloads

1

Version

0.0.19

License

none

Unpacked Size

72.2 kB

Total Files

76

Last publish

Collaborators

  • benjijanssens
  • samvanhoey
  • jaspervercammen
  • codeinineo
  • ethanfoust
  • jensicapps
  • willemhorsten
  • dgyesbreghs
  • knor-el-snor