UNPKG

@iota-big3/sdk-gateway

Version:

Universal API Gateway with protocol translation, intelligent routing, rate limiting, health checking, and caching

360 lines 13.4 kB
"use strict"; /** * @fileoverview Comprehensive types for operational systems (HR, Devices, Cafeteria, Facilities) * @module @iota-big3/sdk-types/operational * @description * Provides strictly-typed definitions for operational management including: * - Human Resources (employees, payroll, benefits, performance) * - Device Management (inventory, assignments, maintenance) * - Cafeteria Operations (meals, nutrition, payments) * - Facilities Management (maintenance, space, utilities) * * Designed for AI/debugging friendliness with descriptive names and comprehensive documentation. * * @example * ```typescript * import type { Employee, Device, CafeteriaOrder, MaintenanceRequest } from '@iota-big3/sdk-types'; * * // HR Management * const employee: Employee = { * id: 'emp_123', * personalInfo: { * firstName: 'John', * lastName: 'Doe', * email: 'john.doe@company.com', * phone: '+1-555-0123' * }, * employmentInfo: { * employeeId: 'E12345', * department: 'Engineering', * position: 'Senior Developer', * reportsTo: 'emp_456', * hireDate: '2020-01-15', * employmentType: EmploymentType.FULL_TIME, * status: EmployeeStatus.ACTIVE * }, * compensation: { * salary: 120000n, // Using bigint for precision * currency: 'USD', * payFrequency: PayFrequency.BIWEEKLY, * bonusEligible: true, * equityGrants: [] * } * }; * ``` * * @since 1.0.0 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.operationalTypes = exports.UtilityType = exports.WorkOrderStatus = exports.MaintenancePriority = exports.FacilityType = exports.Allergen = exports.DietaryRestriction = exports.MealType = exports.DeviceCondition = exports.DeviceStatus = exports.DeviceType = exports.PerformanceRating = exports.PayFrequency = exports.LeaveType = exports.EmployeeStatus = exports.EmploymentType = void 0; exports.isEmployeeActive = isEmployeeActive; exports.calculateDeviceDepreciation = calculateDeviceDepreciation; exports.hasMealCredits = hasMealCredits; exports.getMaintenanceResponseTime = getMaintenanceResponseTime; // ============================================================================ // HR Management Types // ============================================================================ /** * Employment types * @description Categories of employment relationships */ var EmploymentType; (function (EmploymentType) { EmploymentType["FULL_TIME"] = "FULL_TIME"; EmploymentType["PART_TIME"] = "PART_TIME"; EmploymentType["CONTRACT"] = "CONTRACT"; EmploymentType["TEMPORARY"] = "TEMPORARY"; EmploymentType["INTERN"] = "INTERN"; EmploymentType["VOLUNTEER"] = "VOLUNTEER"; EmploymentType["CONSULTANT"] = "CONSULTANT"; })(EmploymentType || (exports.EmploymentType = EmploymentType = {})); /** * Employee status * @description Current status of an employee */ var EmployeeStatus; (function (EmployeeStatus) { EmployeeStatus["ACTIVE"] = "ACTIVE"; EmployeeStatus["ON_LEAVE"] = "ON_LEAVE"; EmployeeStatus["SUSPENDED"] = "SUSPENDED"; EmployeeStatus["TERMINATED"] = "TERMINATED"; EmployeeStatus["RETIRED"] = "RETIRED"; EmployeeStatus["DECEASED"] = "DECEASED"; })(EmployeeStatus || (exports.EmployeeStatus = EmployeeStatus = {})); /** * Leave types * @description Types of employee leave */ var LeaveType; (function (LeaveType) { LeaveType["VACATION"] = "VACATION"; LeaveType["SICK"] = "SICK"; LeaveType["PERSONAL"] = "PERSONAL"; LeaveType["MATERNITY"] = "MATERNITY"; LeaveType["PATERNITY"] = "PATERNITY"; LeaveType["BEREAVEMENT"] = "BEREAVEMENT"; LeaveType["SABBATICAL"] = "SABBATICAL"; LeaveType["UNPAID"] = "UNPAID"; LeaveType["MILITARY"] = "MILITARY"; LeaveType["JURY_DUTY"] = "JURY_DUTY"; })(LeaveType || (exports.LeaveType = LeaveType = {})); /** * Pay frequency * @description How often an employee is paid */ var PayFrequency; (function (PayFrequency) { PayFrequency["WEEKLY"] = "WEEKLY"; PayFrequency["BIWEEKLY"] = "BIWEEKLY"; PayFrequency["SEMIMONTHLY"] = "SEMIMONTHLY"; PayFrequency["MONTHLY"] = "MONTHLY"; PayFrequency["QUARTERLY"] = "QUARTERLY"; PayFrequency["ANNUALLY"] = "ANNUALLY"; })(PayFrequency || (exports.PayFrequency = PayFrequency = {})); /** * Performance rating * @description Employee performance evaluation ratings */ var PerformanceRating; (function (PerformanceRating) { PerformanceRating["EXCEPTIONAL"] = "EXCEPTIONAL"; PerformanceRating["EXCEEDS_EXPECTATIONS"] = "EXCEEDS_EXPECTATIONS"; PerformanceRating["MEETS_EXPECTATIONS"] = "MEETS_EXPECTATIONS"; PerformanceRating["NEEDS_IMPROVEMENT"] = "NEEDS_IMPROVEMENT"; PerformanceRating["UNSATISFACTORY"] = "UNSATISFACTORY"; })(PerformanceRating || (exports.PerformanceRating = PerformanceRating = {})); // ============================================================================ // Device Management Types // ============================================================================ /** * Device types * @description Categories of devices in inventory */ var DeviceType; (function (DeviceType) { DeviceType["LAPTOP"] = "LAPTOP"; DeviceType["DESKTOP"] = "DESKTOP"; DeviceType["TABLET"] = "TABLET"; DeviceType["PHONE"] = "PHONE"; DeviceType["PRINTER"] = "PRINTER"; DeviceType["SCANNER"] = "SCANNER"; DeviceType["PROJECTOR"] = "PROJECTOR"; DeviceType["MONITOR"] = "MONITOR"; DeviceType["KEYBOARD"] = "KEYBOARD"; DeviceType["MOUSE"] = "MOUSE"; DeviceType["HEADSET"] = "HEADSET"; DeviceType["CAMERA"] = "CAMERA"; DeviceType["SERVER"] = "SERVER"; DeviceType["NETWORK_DEVICE"] = "NETWORK_DEVICE"; DeviceType["OTHER"] = "OTHER"; })(DeviceType || (exports.DeviceType = DeviceType = {})); /** * Device status * @description Current status of a device */ var DeviceStatus; (function (DeviceStatus) { DeviceStatus["AVAILABLE"] = "AVAILABLE"; DeviceStatus["ASSIGNED"] = "ASSIGNED"; DeviceStatus["IN_REPAIR"] = "IN_REPAIR"; DeviceStatus["LOST"] = "LOST"; DeviceStatus["STOLEN"] = "STOLEN"; DeviceStatus["RETIRED"] = "RETIRED"; DeviceStatus["DISPOSED"] = "DISPOSED"; })(DeviceStatus || (exports.DeviceStatus = DeviceStatus = {})); /** * Device condition * @description Physical condition of a device */ var DeviceCondition; (function (DeviceCondition) { DeviceCondition["NEW"] = "NEW"; DeviceCondition["EXCELLENT"] = "EXCELLENT"; DeviceCondition["GOOD"] = "GOOD"; DeviceCondition["FAIR"] = "FAIR"; DeviceCondition["POOR"] = "POOR"; DeviceCondition["BROKEN"] = "BROKEN"; })(DeviceCondition || (exports.DeviceCondition = DeviceCondition = {})); // ============================================================================ // Cafeteria Management Types // ============================================================================ /** * Meal types * @description Types of meals served */ var MealType; (function (MealType) { MealType["BREAKFAST"] = "BREAKFAST"; MealType["LUNCH"] = "LUNCH"; MealType["DINNER"] = "DINNER"; MealType["SNACK"] = "SNACK"; MealType["BEVERAGE"] = "BEVERAGE"; })(MealType || (exports.MealType = MealType = {})); /** * Dietary restrictions * @description Common dietary restrictions and preferences */ var DietaryRestriction; (function (DietaryRestriction) { DietaryRestriction["VEGETARIAN"] = "VEGETARIAN"; DietaryRestriction["VEGAN"] = "VEGAN"; DietaryRestriction["GLUTEN_FREE"] = "GLUTEN_FREE"; DietaryRestriction["DAIRY_FREE"] = "DAIRY_FREE"; DietaryRestriction["NUT_FREE"] = "NUT_FREE"; DietaryRestriction["KOSHER"] = "KOSHER"; DietaryRestriction["HALAL"] = "HALAL"; DietaryRestriction["LOW_SODIUM"] = "LOW_SODIUM"; DietaryRestriction["DIABETIC"] = "DIABETIC"; DietaryRestriction["KETO"] = "KETO"; })(DietaryRestriction || (exports.DietaryRestriction = DietaryRestriction = {})); /** * Allergen types * @description Common food allergens */ var Allergen; (function (Allergen) { Allergen["MILK"] = "MILK"; Allergen["EGGS"] = "EGGS"; Allergen["FISH"] = "FISH"; Allergen["SHELLFISH"] = "SHELLFISH"; Allergen["TREE_NUTS"] = "TREE_NUTS"; Allergen["PEANUTS"] = "PEANUTS"; Allergen["WHEAT"] = "WHEAT"; Allergen["SOYBEANS"] = "SOYBEANS"; Allergen["SESAME"] = "SESAME"; })(Allergen || (exports.Allergen = Allergen = {})); // ============================================================================ // Facilities Management Types // ============================================================================ /** * Facility types * @description Types of facilities/buildings */ var FacilityType; (function (FacilityType) { FacilityType["OFFICE"] = "OFFICE"; FacilityType["CLASSROOM"] = "CLASSROOM"; FacilityType["LABORATORY"] = "LABORATORY"; FacilityType["CAFETERIA"] = "CAFETERIA"; FacilityType["GYMNASIUM"] = "GYMNASIUM"; FacilityType["AUDITORIUM"] = "AUDITORIUM"; FacilityType["LIBRARY"] = "LIBRARY"; FacilityType["DORMITORY"] = "DORMITORY"; FacilityType["PARKING"] = "PARKING"; FacilityType["WAREHOUSE"] = "WAREHOUSE"; FacilityType["DATA_CENTER"] = "DATA_CENTER"; })(FacilityType || (exports.FacilityType = FacilityType = {})); /** * Maintenance priority * @description Priority levels for maintenance requests */ var MaintenancePriority; (function (MaintenancePriority) { MaintenancePriority["EMERGENCY"] = "EMERGENCY"; MaintenancePriority["HIGH"] = "HIGH"; MaintenancePriority["MEDIUM"] = "MEDIUM"; MaintenancePriority["LOW"] = "LOW"; MaintenancePriority["SCHEDULED"] = "SCHEDULED"; // Planned maintenance })(MaintenancePriority || (exports.MaintenancePriority = MaintenancePriority = {})); /** * Work order status * @description Status of maintenance work orders */ var WorkOrderStatus; (function (WorkOrderStatus) { WorkOrderStatus["DRAFT"] = "DRAFT"; WorkOrderStatus["SUBMITTED"] = "SUBMITTED"; WorkOrderStatus["APPROVED"] = "APPROVED"; WorkOrderStatus["ASSIGNED"] = "ASSIGNED"; WorkOrderStatus["IN_PROGRESS"] = "IN_PROGRESS"; WorkOrderStatus["ON_HOLD"] = "ON_HOLD"; WorkOrderStatus["COMPLETED"] = "COMPLETED"; WorkOrderStatus["CANCELLED"] = "CANCELLED"; WorkOrderStatus["CLOSED"] = "CLOSED"; })(WorkOrderStatus || (exports.WorkOrderStatus = WorkOrderStatus = {})); /** * Utility types * @description Types of utilities monitored */ var UtilityType; (function (UtilityType) { UtilityType["ELECTRICITY"] = "ELECTRICITY"; UtilityType["WATER"] = "WATER"; UtilityType["GAS"] = "GAS"; UtilityType["HEATING"] = "HEATING"; UtilityType["COOLING"] = "COOLING"; UtilityType["INTERNET"] = "INTERNET"; UtilityType["PHONE"] = "PHONE"; })(UtilityType || (exports.UtilityType = UtilityType = {})); // ============================================================================ // Validation Functions // ============================================================================ /** * Check if employee is active * @param employee - Employee to check * @returns True if employee is active */ function isEmployeeActive(employee) { return employee.employmentInfo.status === EmployeeStatus.ACTIVE; } /** * Calculate device depreciation * @param device - Device to calculate depreciation for * @param depreciationYears - Years over which to depreciate (default: 3) * @returns Current value in cents */ function calculateDeviceDepreciation(device, depreciationYears = 3) { const purchaseDate = new Date(device.purchaseInfo.purchaseDate); const now = new Date(); const monthsOwned = (now.getFullYear() - purchaseDate.getFullYear()) * 12 + (now.getMonth() - purchaseDate.getMonth()); const monthlyDepreciation = device.purchaseInfo.purchasePrice / BigInt(depreciationYears * 12); const totalDepreciation = monthlyDepreciation * BigInt(monthsOwned); const currentValue = device.purchaseInfo.purchasePrice - totalDepreciation; return currentValue > 0n ? currentValue : 0n; } /** * Check if meal plan has available credits * @param plan - Meal plan to check * @param mealType - Type of meal * @param creditsUsed - Credits already used * @returns True if credits are available */ function hasMealCredits(plan, mealType, creditsUsed) { const key = mealType.toLowerCase(); const available = plan.mealCredits[key] || plan.mealCredits.flex || 0; const used = creditsUsed[key] || 0; return used < available; } /** * Calculate maintenance response time requirement * @param priority - Maintenance priority * @returns Required response time in hours */ function getMaintenanceResponseTime(priority) { switch (priority) { case MaintenancePriority.EMERGENCY: return 1; // 1 hour case MaintenancePriority.HIGH: return 24; // 24 hours case MaintenancePriority.MEDIUM: return 168; // 1 week case MaintenancePriority.LOW: return 720; // 30 days case MaintenancePriority.SCHEDULED: return Infinity; // No specific requirement } } // Export grouped by domain exports.operationalTypes = { // HR isEmployeeActive, // Devices calculateDeviceDepreciation, // Cafeteria hasMealCredits, // Facilities getMaintenanceResponseTime }; //# sourceMappingURL=operational-types.js.map