UNPKG

business-as-code

Version:

Primitives for expressing business logic and processes as code

323 lines 24.7 kB
/** * Asset & Inventory Entities * Asset, Inventory, Equipment, Facility, Software, DataAsset */ export const Asset = { singular: 'asset', plural: 'assets', description: 'A business asset (physical or digital)', properties: { name: { type: 'string', description: 'Asset name' }, description: { type: 'string', description: 'Asset description' }, type: { type: 'string', description: 'Type of asset', examples: ['hardware', 'software', 'furniture', 'vehicle', 'equipment', 'real-estate', 'digital', 'IP', 'financial'] }, category: { type: 'string', description: 'Asset category' }, status: { type: 'string', description: 'Asset status', examples: ['active', 'inactive', 'maintenance', 'retired', 'disposed', 'lost', 'stolen', 'reserved'] }, assetTag: { type: 'string', description: 'Asset tag or identifier' }, serialNumber: { type: 'string', description: 'Serial number' }, barcode: { type: 'string', description: 'Barcode', optional: true }, manufacturer: { type: 'string', description: 'Manufacturer' }, model: { type: 'string', description: 'Model' }, version: { type: 'string', description: 'Version', optional: true }, condition: { type: 'string', description: 'Condition', examples: ['new', 'excellent', 'good', 'fair', 'poor', 'damaged'] }, location: { type: 'string', description: 'Physical location' }, building: { type: 'string', description: 'Building', optional: true }, floor: { type: 'string', description: 'Floor', optional: true }, room: { type: 'string', description: 'Room', optional: true }, assignedTo: { type: 'string', description: 'Assigned user' }, department: { type: 'string', description: 'Owning department' }, custodian: { type: 'string', description: 'Asset custodian' }, purchaseDate: { type: 'date', description: 'Purchase date' }, purchasePrice: { type: 'number', description: 'Purchase price' }, vendor: { type: 'string', description: 'Vendor/supplier' }, poNumber: { type: 'string', description: 'Purchase order number', optional: true }, invoiceNumber: { type: 'string', description: 'Invoice number', optional: true }, currentValue: { type: 'number', description: 'Current book value' }, depreciationMethod: { type: 'string', description: 'Depreciation method', examples: ['straight-line', 'declining-balance', 'units-of-production', 'none'] }, depreciationRate: { type: 'number', description: 'Annual depreciation rate' }, salvageValue: { type: 'number', description: 'Salvage value' }, usefulLife: { type: 'number', description: 'Useful life in years' }, warrantyExpiry: { type: 'date', description: 'Warranty expiration', optional: true }, warrantyProvider: { type: 'string', description: 'Warranty provider', optional: true }, maintenanceSchedule: { type: 'string', description: 'Maintenance schedule', examples: ['monthly', 'quarterly', 'semi-annual', 'annual', 'as-needed'] }, lastMaintenanceDate: { type: 'date', description: 'Last maintenance date', optional: true }, nextMaintenanceDate: { type: 'date', description: 'Next maintenance date', optional: true }, disposalDate: { type: 'date', description: 'Disposal date', optional: true }, disposalMethod: { type: 'string', description: 'Disposal method', examples: ['sold', 'donated', 'recycled', 'scrapped'], optional: true }, disposalValue: { type: 'number', description: 'Disposal value', optional: true }, insured: { type: 'boolean', description: 'Is insured' }, insurancePolicy: { type: 'string', description: 'Insurance policy number', optional: true }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Asset tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { facility: { type: 'facility', description: 'Located at facility', backref: 'assets' }, worker: { type: 'worker', description: 'Assigned worker', backref: 'assets' }, department: { type: 'department', description: 'Owning department', backref: 'assets' }, vendor: { type: 'vendor', description: 'Asset vendor', backref: 'assets' }, parentAsset: { type: 'asset', description: 'Parent asset', backref: 'childAssets' }, childAssets: { type: 'asset[]', description: 'Child assets', backref: 'parentAsset' }, maintenanceRecords: { type: 'maintenanceRecord[]', description: 'Maintenance history', backref: 'asset' }, }, actions: ['create', 'update', 'assign', 'unassign', 'transfer', 'maintain', 'repair', 'retire', 'dispose', 'audit', 'reserve', 'check-in', 'check-out'], events: ['created', 'updated', 'assigned', 'unassigned', 'transferred', 'maintained', 'repaired', 'retired', 'disposed', 'audited', 'reserved', 'checkedIn', 'checkedOut'], }; export const Inventory = { singular: 'inventory', plural: 'inventories', description: 'Inventory or stock item', properties: { name: { type: 'string', description: 'Item name' }, description: { type: 'string', description: 'Item description' }, sku: { type: 'string', description: 'Stock keeping unit' }, barcode: { type: 'string', description: 'Barcode' }, type: { type: 'string', description: 'Type of inventory', examples: ['raw-material', 'work-in-progress', 'finished-goods', 'supplies', 'spare-parts', 'consumables'] }, category: { type: 'string', description: 'Item category' }, status: { type: 'string', description: 'Item status', examples: ['active', 'inactive', 'discontinued', 'on-hold', 'backordered'] }, unitOfMeasure: { type: 'string', description: 'Unit of measure', examples: ['each', 'box', 'case', 'pallet', 'kg', 'liter', 'meter'] }, quantityOnHand: { type: 'number', description: 'Current quantity' }, quantityReserved: { type: 'number', description: 'Reserved quantity' }, quantityAvailable: { type: 'number', description: 'Available quantity' }, quantityOnOrder: { type: 'number', description: 'On order quantity' }, quantityInTransit: { type: 'number', description: 'In transit quantity' }, reorderPoint: { type: 'number', description: 'Reorder point' }, reorderQuantity: { type: 'number', description: 'Reorder quantity' }, minQuantity: { type: 'number', description: 'Minimum quantity' }, maxQuantity: { type: 'number', description: 'Maximum quantity' }, leadTimeDays: { type: 'number', description: 'Lead time in days' }, unitCost: { type: 'number', description: 'Unit cost' }, avgCost: { type: 'number', description: 'Average cost' }, lastCost: { type: 'number', description: 'Last purchase cost' }, standardCost: { type: 'number', description: 'Standard cost' }, sellingPrice: { type: 'number', description: 'Selling price' }, margin: { type: 'number', description: 'Margin percentage' }, totalValue: { type: 'number', description: 'Total inventory value' }, location: { type: 'string', description: 'Primary location' }, warehouse: { type: 'string', description: 'Warehouse' }, zone: { type: 'string', description: 'Zone', optional: true }, bin: { type: 'string', description: 'Bin location', optional: true }, lotTracking: { type: 'boolean', description: 'Lot tracking enabled' }, serialTracking: { type: 'boolean', description: 'Serial tracking enabled' }, expirationTracking: { type: 'boolean', description: 'Expiration tracking enabled' }, lastCountDate: { type: 'date', description: 'Last physical count date' }, lastReceiveDate: { type: 'date', description: 'Last receive date' }, lastSoldDate: { type: 'date', description: 'Last sold date' }, abcClass: { type: 'string', description: 'ABC classification', examples: ['A', 'B', 'C'] }, hazardous: { type: 'boolean', description: 'Is hazardous' }, perishable: { type: 'boolean', description: 'Is perishable' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Item tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { product: { type: 'product', description: 'Related product', backref: 'inventory' }, vendor: { type: 'vendor', description: 'Primary vendor', backref: 'inventory' }, facility: { type: 'facility', description: 'Storage facility', backref: 'inventory' }, movements: { type: 'inventoryMovement[]', description: 'Movement history', backref: 'inventory' }, lots: { type: 'lot[]', description: 'Lot records', backref: 'inventory' }, }, actions: ['create', 'update', 'receive', 'ship', 'transfer', 'adjust', 'count', 'reserve', 'unreserve', 'reorder', 'discontinue'], events: ['created', 'updated', 'received', 'shipped', 'transferred', 'adjusted', 'counted', 'reserved', 'unreserved', 'reordered', 'discontinued'], }; export const Equipment = { singular: 'equipment', plural: 'equipment', description: 'Business equipment or machinery', properties: { name: { type: 'string', description: 'Equipment name' }, description: { type: 'string', description: 'Equipment description' }, type: { type: 'string', description: 'Type of equipment', examples: ['computer', 'server', 'network', 'printer', 'phone', 'machinery', 'vehicle', 'tool', 'AV', 'safety'] }, status: { type: 'string', description: 'Equipment status', examples: ['available', 'in-use', 'maintenance', 'repair', 'retired', 'disposed'] }, assetTag: { type: 'string', description: 'Asset tag' }, serialNumber: { type: 'string', description: 'Serial number' }, manufacturer: { type: 'string', description: 'Manufacturer' }, model: { type: 'string', description: 'Model' }, specifications: { type: 'object', description: 'Technical specifications', optional: true }, condition: { type: 'string', description: 'Condition', examples: ['new', 'excellent', 'good', 'fair', 'poor'] }, location: { type: 'string', description: 'Current location' }, assignedTo: { type: 'string', description: 'Assigned user' }, department: { type: 'string', description: 'Department' }, purchaseDate: { type: 'date', description: 'Purchase date' }, purchasePrice: { type: 'number', description: 'Purchase price' }, currentValue: { type: 'number', description: 'Current value' }, warrantyExpiry: { type: 'date', description: 'Warranty expiration' }, serviceContract: { type: 'boolean', description: 'Has service contract' }, serviceProvider: { type: 'string', description: 'Service provider', optional: true }, lastServiceDate: { type: 'date', description: 'Last service date', optional: true }, nextServiceDate: { type: 'date', description: 'Next service date', optional: true }, operatingHours: { type: 'number', description: 'Operating hours', optional: true }, utilizationRate: { type: 'number', description: 'Utilization rate', optional: true }, criticality: { type: 'string', description: 'Criticality level', examples: ['critical', 'high', 'medium', 'low'] }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Equipment tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { asset: { type: 'asset', description: 'Parent asset record', backref: 'equipment' }, facility: { type: 'facility', description: 'Located at facility', backref: 'equipment' }, worker: { type: 'worker', description: 'Assigned worker', backref: 'equipment' }, maintenanceRecords: { type: 'maintenanceRecord[]', description: 'Maintenance history', backref: 'equipment' }, }, actions: ['create', 'update', 'assign', 'unassign', 'service', 'repair', 'calibrate', 'retire', 'dispose', 'reserve', 'return'], events: ['created', 'updated', 'assigned', 'unassigned', 'serviced', 'repaired', 'calibrated', 'retired', 'disposed', 'reserved', 'returned'], }; export const Facility = { singular: 'facility', plural: 'facilities', description: 'A physical facility or location', properties: { name: { type: 'string', description: 'Facility name' }, description: { type: 'string', description: 'Facility description' }, type: { type: 'string', description: 'Type of facility', examples: ['office', 'warehouse', 'factory', 'datacenter', 'retail', 'lab', 'headquarters', 'branch', 'remote'] }, status: { type: 'string', description: 'Facility status', examples: ['active', 'inactive', 'construction', 'renovation', 'closing', 'closed'] }, code: { type: 'string', description: 'Facility code' }, address: { type: 'string', description: 'Street address' }, city: { type: 'string', description: 'City' }, state: { type: 'string', description: 'State/Province' }, postalCode: { type: 'string', description: 'Postal code' }, country: { type: 'string', description: 'Country' }, region: { type: 'string', description: 'Region' }, timezone: { type: 'string', description: 'Timezone' }, coordinates: { type: 'object', description: 'GPS coordinates', optional: true }, squareFootage: { type: 'number', description: 'Square footage/meters' }, floors: { type: 'number', description: 'Number of floors' }, capacity: { type: 'number', description: 'Person capacity' }, currentOccupancy: { type: 'number', description: 'Current occupancy' }, owner: { type: 'string', description: 'Property owner' }, ownership: { type: 'string', description: 'Ownership type', examples: ['owned', 'leased', 'subleased', 'coworking'] }, landlord: { type: 'string', description: 'Landlord name', optional: true }, leaseStart: { type: 'date', description: 'Lease start date', optional: true }, leaseEnd: { type: 'date', description: 'Lease end date', optional: true }, monthlyRent: { type: 'number', description: 'Monthly rent', optional: true }, operatingCost: { type: 'number', description: 'Monthly operating cost' }, manager: { type: 'string', description: 'Facility manager' }, emergencyContact: { type: 'string', description: 'Emergency contact' }, phone: { type: 'string', description: 'Main phone number' }, amenities: { type: 'string[]', description: 'Available amenities' }, certifications: { type: 'string[]', description: 'Facility certifications', examples: ['LEED', 'ISO14001', 'WELL'] }, securityLevel: { type: 'string', description: 'Security level', examples: ['standard', 'enhanced', 'high-security', 'restricted'] }, accessControl: { type: 'string', description: 'Access control system' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Facility tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { assets: { type: 'asset[]', description: 'Facility assets', backref: 'facility' }, equipment: { type: 'equipment[]', description: 'Facility equipment', backref: 'facility' }, inventory: { type: 'inventory[]', description: 'Facility inventory', backref: 'facility' }, workers: { type: 'worker[]', description: 'Workers at facility', backref: 'facility' }, departments: { type: 'department[]', description: 'Departments at facility', backref: 'facilities' }, parentFacility: { type: 'facility', description: 'Parent facility', backref: 'childFacilities' }, childFacilities: { type: 'facility[]', description: 'Child facilities', backref: 'parentFacility' }, }, actions: ['create', 'update', 'open', 'close', 'renovate', 'expand', 'consolidate', 'audit', 'inspect'], events: ['created', 'updated', 'opened', 'closed', 'renovated', 'expanded', 'consolidated', 'audited', 'inspected'], }; export const Software = { singular: 'software', plural: 'software', description: 'Software application or system', properties: { name: { type: 'string', description: 'Software name' }, description: { type: 'string', description: 'Software description' }, type: { type: 'string', description: 'Type of software', examples: ['SaaS', 'on-premise', 'desktop', 'mobile', 'embedded', 'open-source', 'custom'] }, category: { type: 'string', description: 'Software category', examples: ['productivity', 'communication', 'development', 'security', 'analytics', 'CRM', 'ERP', 'HR'] }, status: { type: 'string', description: 'Software status', examples: ['active', 'evaluating', 'deprecated', 'retired', 'blocked'] }, vendor: { type: 'string', description: 'Software vendor' }, version: { type: 'string', description: 'Current version' }, latestVersion: { type: 'string', description: 'Latest available version' }, edition: { type: 'string', description: 'Edition/tier' }, licenseType: { type: 'string', description: 'License type', examples: ['subscription', 'perpetual', 'open-source', 'freemium', 'site', 'user'] }, licensedUsers: { type: 'number', description: 'Licensed user count' }, activeUsers: { type: 'number', description: 'Active user count' }, deploymentType: { type: 'string', description: 'Deployment type', examples: ['cloud', 'on-premise', 'hybrid', 'edge'] }, url: { type: 'string', description: 'Application URL' }, ssoEnabled: { type: 'boolean', description: 'SSO enabled' }, ssoProvider: { type: 'string', description: 'SSO provider', optional: true }, dataClassification: { type: 'string', description: 'Data classification', examples: ['public', 'internal', 'confidential', 'restricted'] }, businessCriticality: { type: 'string', description: 'Business criticality', examples: ['mission-critical', 'business-critical', 'important', 'operational'] }, owner: { type: 'string', description: 'Application owner' }, technicalOwner: { type: 'string', description: 'Technical owner' }, supportContact: { type: 'string', description: 'Support contact' }, contractStart: { type: 'date', description: 'Contract start date' }, contractEnd: { type: 'date', description: 'Contract end date' }, renewalDate: { type: 'date', description: 'Renewal date' }, annualCost: { type: 'number', description: 'Annual cost' }, monthlyCost: { type: 'number', description: 'Monthly cost' }, costPerUser: { type: 'number', description: 'Cost per user' }, securityReview: { type: 'boolean', description: 'Security review completed' }, lastSecurityReview: { type: 'date', description: 'Last security review date', optional: true }, complianceStatus: { type: 'string', description: 'Compliance status', examples: ['compliant', 'pending', 'non-compliant', 'exempt'] }, integrations: { type: 'string[]', description: 'Integrated systems' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Software tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { asset: { type: 'asset', description: 'Parent asset record', backref: 'software' }, license: { type: 'license', description: 'Software license', backref: 'software' }, vendor: { type: 'vendor', description: 'Software vendor', backref: 'software' }, integrations: { type: 'integration[]', description: 'Integrations', backref: 'software' }, users: { type: 'worker[]', description: 'Software users', backref: 'software' }, }, actions: ['create', 'update', 'deploy', 'upgrade', 'downgrade', 'renew', 'deprecate', 'retire', 'review', 'integrate'], events: ['created', 'updated', 'deployed', 'upgraded', 'downgraded', 'renewed', 'deprecated', 'retired', 'reviewed', 'integrated'], }; export const DataAsset = { singular: 'dataAsset', plural: 'dataAssets', description: 'A data asset or dataset', properties: { name: { type: 'string', description: 'Data asset name' }, description: { type: 'string', description: 'Data asset description' }, type: { type: 'string', description: 'Type of data asset', examples: ['database', 'data-lake', 'file', 'API', 'report', 'model', 'dataset', 'stream'] }, category: { type: 'string', description: 'Data category', examples: ['customer', 'financial', 'operational', 'product', 'HR', 'marketing', 'analytics'] }, status: { type: 'string', description: 'Data asset status', examples: ['active', 'deprecated', 'archived', 'draft', 'under-review'] }, classification: { type: 'string', description: 'Data classification', examples: ['public', 'internal', 'confidential', 'restricted', 'PII', 'PHI', 'financial'] }, format: { type: 'string', description: 'Data format', examples: ['SQL', 'JSON', 'CSV', 'Parquet', 'Avro', 'XML', 'binary'] }, schema: { type: 'object', description: 'Data schema', optional: true }, size: { type: 'string', description: 'Data size' }, recordCount: { type: 'number', description: 'Record count' }, location: { type: 'string', description: 'Storage location' }, source: { type: 'string', description: 'Data source' }, sourceSystem: { type: 'string', description: 'Source system' }, refreshFrequency: { type: 'string', description: 'Refresh frequency', examples: ['real-time', 'hourly', 'daily', 'weekly', 'monthly', 'on-demand'] }, lastRefresh: { type: 'date', description: 'Last refresh date' }, nextRefresh: { type: 'date', description: 'Next scheduled refresh' }, retentionPeriod: { type: 'string', description: 'Data retention period' }, retentionPolicy: { type: 'string', description: 'Retention policy' }, owner: { type: 'string', description: 'Data owner' }, steward: { type: 'string', description: 'Data steward' }, qualityScore: { type: 'number', description: 'Data quality score' }, qualityIssues: { type: 'string[]', description: 'Known quality issues' }, lineage: { type: 'string', description: 'Data lineage documentation' }, documentation: { type: 'string', description: 'Documentation URL' }, accessControl: { type: 'string', description: 'Access control policy' }, encryptionStatus: { type: 'string', description: 'Encryption status', examples: ['encrypted-at-rest', 'encrypted-in-transit', 'fully-encrypted', 'not-encrypted'] }, complianceRequirements: { type: 'string[]', description: 'Compliance requirements', examples: ['GDPR', 'CCPA', 'HIPAA', 'PCI'] }, createdDate: { type: 'date', description: 'Creation date' }, notes: { type: 'string', description: 'Internal notes', optional: true }, tags: { type: 'string[]', description: 'Data asset tags' }, metadata: { type: 'object', description: 'Additional metadata', optional: true }, }, relationships: { asset: { type: 'asset', description: 'Parent asset record', backref: 'dataAssets' }, sourceAssets: { type: 'dataAsset[]', description: 'Source data assets', backref: 'derivedAssets' }, derivedAssets: { type: 'dataAsset[]', description: 'Derived data assets', backref: 'sourceAssets' }, consumers: { type: 'software[]', description: 'Consuming applications', backref: 'dataAssets' }, compliance: { type: 'compliance[]', description: 'Related compliance', backref: 'dataAssets' }, }, actions: ['create', 'update', 'refresh', 'archive', 'delete', 'share', 'restrict', 'classify', 'audit', 'document'], events: ['created', 'updated', 'refreshed', 'archived', 'deleted', 'shared', 'restricted', 'classified', 'audited', 'documented'], }; // Export all asset entities export const AssetEntities = { Asset, Inventory, Equipment, Facility, Software, DataAsset, }; export default AssetEntities; //# sourceMappingURL=assets.js.map