0.33.2 • Published 1 year ago

@icapps/wcf-astrum v0.33.2

Weekly downloads
255
License
-
Repository
-
Last release
1 year ago

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.

0.33.2

1 year ago

0.33.1

1 year ago

0.32.5

1 year ago

0.32.4

1 year ago

0.32.3

1 year ago

0.32.2

1 year ago

0.32.1

1 year ago

0.33.0

1 year ago

0.32.0

2 years ago

0.31.4

2 years ago

0.31.3

2 years ago

0.31.2

2 years ago

0.14.1

2 years ago

0.31.1

2 years ago

0.30.0

2 years ago

0.29.0

2 years ago

0.27.0

2 years ago

0.31.0

2 years ago

0.28.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.15.0

2 years ago

0.17.0

2 years ago

0.25.0

2 years ago

0.23.0

2 years ago

0.21.0

2 years ago

0.16.0

2 years ago

0.18.0

2 years ago

0.26.0

2 years ago

0.24.0

2 years ago

0.22.0

2 years ago

0.14.0

2 years ago

0.11.0

2 years ago

0.13.0

2 years ago

0.10.1

2 years ago

0.12.0

2 years ago

0.10.2

2 years ago

0.10.3

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.7.0

2 years ago

0.8.0

2 years ago

0.6.1

2 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.6.0

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.3.10

3 years ago

0.4.0

3 years ago

0.3.9

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago