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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@veeyaainnovatives/attendance-sync-core

v1.0.0

Published

Core attendance sync functions for syncing biometric attendance data from local database to online API

Downloads

75

Readme

@veeyaainnovatives/attendance-sync-core

Core attendance sync functions for syncing biometric attendance data from local database to online API.

Installation

npm install

Usage

Basic Usage

const { syncAttendance, syncDateRange } = require('@saleem-group/attendance-sync-core');
require('dotenv').config();

// Sync single date
await syncAttendance('2025-01-15');

// Sync date range
const result = await syncDateRange('2025-01-01', '2025-01-31', {}, syncAttendance);

With Custom Configuration

Single Table Mode

const config = {
  mssql: {
    user: 'username',
    password: 'password',
    server: 'server',
    database: 'database',
    options: {
      encrypt: true,
      trustServerCertificate: true
    }
  },
  externalApiUrl: 'https://api.example.com/sync',
  apiSecretToken: 'your-token',
  mode: 'single', // Single table mode
  tableName: 'Attendance_All', // Single table for all attendance
  empIdCol: 'EmployeeID',
  dateTimeCol: 'DateTime',
  logPayload: true,
  logResponse: true,
  logNoData: true
};

await syncAttendance('2025-01-15', config);

ESSL/Dynamic Mode (Monthly Tables)

const config = {
  mssql: { /* ... */ },
  externalApiUrl: 'https://api.example.com/sync',
  apiSecretToken: 'your-token',
  mode: 'essl', // or 'dynamic' - Dynamic table name based on month/year
  attendanceTableAlias: 'Attendance_', // Will generate: Attendance_1_2025, Attendance_2_2025, etc.
  empIdCol: 'EmployeeID',
  dateTimeCol: 'DateTime'
};

await syncAttendance('2025-01-15', config);
// Uses table: Attendance_1_2025 (January 2025)

Table Name Modes

The package supports two modes for table name handling:

  1. Single Table Mode (mode: 'single'):

    • Uses a single table for all attendance data
    • Requires tableName to be provided
    • Example: tableName: 'Attendance_All'
  2. ESSL/Dynamic Mode (mode: 'essl' or mode: 'dynamic'):

    • Dynamically constructs table name based on month and year
    • Requires attendanceTableAlias to be provided
    • Automatically generates: {alias}{month}_{year} (e.g., Attendance_1_2025)
    • Can use custom pattern or function for advanced scenarios

API

syncAttendance(inputDate, config)

Syncs attendance data for a single date.

  • inputDate (string, optional): Date in YYYY-MM-DD format. Defaults to today.
  • config (object, optional): Configuration object
    • mode (string): Table mode - 'single' or 'essl'/'dynamic' (default: 'essl')
    • tableName (string, required for 'single' mode): Direct table name (e.g., 'Attendance_All')
    • attendanceTableAlias (string, required for 'essl' mode): Table prefix for monthly tables (e.g., 'Attendance_')
    • empIdCol (string): Employee ID column name
    • dateTimeCol (string): DateTime column name
    • Other config options (see above)

syncDateRange(fromDate, toDate, options, syncAttendanceFn, config)

Syncs attendance data for a date range.

  • fromDate (string): Start date in YYYY-MM-DD format
  • toDate (string): End date in YYYY-MM-DD format
  • options (object, optional): Options object
    • maxDays (number): Maximum days allowed (default: 90)
    • logProgress (boolean): Log progress (default: true)
  • syncAttendanceFn (function): The syncAttendance function to use
  • config (object, optional): Configuration object

Returns a promise that resolves to:

{
  success: boolean,
  totalDays: number,
  successCount: number,
  failCount: number,
  failedDates: string[]
}

Environment Variables

The package uses environment variables if config is not provided:

  • MSSQL_SERVER
  • MSSQL_USER
  • MSSQL_PASSWORD
  • MSSQL_DATABASE
  • EXTERNAL_API_URL
  • API_SECRET_TOKEN
  • ATTENDANCE_TABLE_ALIAS_NAME - Table name prefix/alias
  • EMP_ID_COL_NAME - Employee ID column name
  • TRAN_DATE_TIME_COL_NAME - DateTime column name
  • MAX_SYNC_DAYS - Maximum days for date range sync

Table Name Configuration

Mode: 'single' - Single table for all attendance:

config.mode = 'single';
config.tableName = 'Attendance_All'; // Required

Mode: 'essl' or 'dynamic' - Dynamic table based on month/year:

config.mode = 'essl'; // or 'dynamic'
config.attendanceTableAlias = 'Attendance_'; // Required
// Automatically generates: Attendance_1_2025, Attendance_2_2025, etc.

Advanced: Custom function for dynamic table name generation (ESSL mode):

config.mode = 'essl';
config.getTableName = (dateMoment, { month, year, date }) => {
  return `CustomTable_${year}_${String(month).padStart(2, '0')}`;
};

License

ISC