{"_id":"@damarkuncoro/meta-architecture","_rev":"5-4d7ba7dde51790790bc7a46eb3332413","name":"@damarkuncoro/meta-architecture","dist-tags":{"latest":"2.0.4"},"versions":{"2.0.0":{"name":"@damarkuncoro/meta-architecture","version":"2.0.0","keywords":["contract","architecture","clean-architecture","ddd","enterprise","typescript"],"author":{"name":"DAMAR KUNCORO"},"license":"MIT","_id":"@damarkuncoro/meta-architecture@2.0.0","maintainers":[{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"}],"dist":{"shasum":"79f9188aaebe8f2be43de4d18feedad4c760a491","tarball":"https://registry.npmjs.org/@damarkuncoro/meta-architecture/-/meta-architecture-2.0.0.tgz","fileCount":598,"integrity":"sha512-jOdtzpfliXMhRu+AAWAf9/sGFFeOyQt1bSxt6SRbQPobQr8kmyqsVIFDd+LZHIjfBirB0czhF4KGPQQf/StBGQ==","signatures":[{"sig":"MEUCIQD5OdJZV3x4ptnYdnWtVO29DIuqeZ88Mwi91EsBrc8wKAIgB8smuRjrRMsCzSna+vDou9IH86TfuEnAcmeFXLYRNjY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":568300},"main":"lib/cjs/index.js","types":"lib/esm/index.d.ts","module":"lib/esm/index.js","exports":{".":{"types":"./lib/esm/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js"}},"gitHead":"b6bd0b0f2a6092aa84e1bcab741a80e0259ffd50","scripts":{"lint":"eslint src --ext .ts","test":"vitest run","build":"npm run build:cjs && npm run build:esm","clean":"rm -rf lib","lint:fix":"eslint src --ext .ts --fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","release:ui":"npm run release --prefix examples/react-renderer","test:watch":"vitest","build:watch":"tsc --watch","test:coverage":"vitest --coverage"},"_npmUser":{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"},"_npmVersion":"10.8.2","description":"The Governance Engine for Digital Systems. Enterprise-grade Contract-Driven Meta Design (CDMD) kernel.","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","vitest":"^4.0.17","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/meta-architecture_2.0.0_1769682967603_0.38870868329004526","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@damarkuncoro/meta-architecture","version":"2.0.1","keywords":["contract","architecture","clean-architecture","ddd","enterprise","typescript"],"author":{"name":"DAMAR KUNCORO"},"license":"MIT","_id":"@damarkuncoro/meta-architecture@2.0.1","maintainers":[{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"}],"dist":{"shasum":"4778dea525a1cd59a58f940c9221ef9fca6a6143","tarball":"https://registry.npmjs.org/@damarkuncoro/meta-architecture/-/meta-architecture-2.0.1.tgz","fileCount":599,"integrity":"sha512-hLlwG/T6eKYw0i7EVHIMd4yfKo637Tqgn64J9vyC8rty7Cq6CqZSzNR7J59Dr5D0t6BsWx7cfttH7wypxqKz1g==","signatures":[{"sig":"MEQCIFoPFAsQeKcxVQ7CTIRpLgKWlJE9qZ6sUgQbfbCzKkamAiB8JJ807aNPcUNmeeWLMFw1GOhkixaktxsbckzq9H5ONg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":569445},"main":"lib/cjs/index.js","types":"lib/esm/index.d.ts","module":"lib/esm/index.js","exports":{".":{"types":"./lib/esm/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js"}},"gitHead":"9306bbf856d5088066f17ef04267135ddf91e7eb","scripts":{"lint":"eslint src --ext .ts","test":"vitest run","build":"npm run build:cjs && npm run build:esm","clean":"rm -rf lib","release":"npm run build && npm publish --access public","lint:fix":"eslint src --ext .ts --fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","release:ui":"npm run release --prefix examples/react-renderer","test:watch":"vitest","build:watch":"tsc --watch","test:coverage":"vitest --coverage"},"_npmUser":{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"},"_npmVersion":"10.8.2","description":"The Governance Engine for Digital Systems. Enterprise-grade Contract-Driven Meta Design (CDMD) kernel.","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","vitest":"^4.0.17","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/meta-architecture_2.0.1_1769684468808_0.6463418267903422","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@damarkuncoro/meta-architecture","version":"2.0.2","keywords":["contract","architecture","clean-architecture","ddd","enterprise","typescript"],"author":{"name":"DAMAR KUNCORO"},"license":"MIT","_id":"@damarkuncoro/meta-architecture@2.0.2","maintainers":[{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"}],"homepage":"https://github.com/damarkuncoro/contract-architecture#readme","bugs":{"url":"https://github.com/damarkuncoro/contract-architecture/issues"},"dist":{"shasum":"e4e74871383292de03b3b54aa9a6ea4b9945bb16","tarball":"https://registry.npmjs.org/@damarkuncoro/meta-architecture/-/meta-architecture-2.0.2.tgz","fileCount":599,"integrity":"sha512-SxYtD291kku0rtePiJGbD3HtiBw6dGLbEojZ0EqcHYbRoxYvFgcmO4fYkKiCBc9MfvYuuuStQ8a+gPUiBggJRA==","signatures":[{"sig":"MEYCIQDra6TQi5ug16vzRfn3d81dtGmwSci+NNS7yUYfIn4tvwIhAM6MdF2REdhr7QyNaKFzniciDJWO6i6yv8U10gLobrGz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":569736},"main":"lib/cjs/index.js","types":"lib/esm/index.d.ts","module":"lib/esm/index.js","exports":{".":{"types":"./lib/esm/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js"}},"gitHead":"9306bbf856d5088066f17ef04267135ddf91e7eb","scripts":{"lint":"eslint src --ext .ts","test":"vitest run","build":"npm run build:cjs && npm run build:esm","clean":"rm -rf lib dist","release":"npm run build && npm publish --access public","lint:fix":"eslint src --ext .ts --fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","release:ui":"npm run release --prefix examples/react-renderer","test:watch":"vitest","build:watch":"tsc --watch","test:coverage":"vitest --coverage"},"_npmUser":{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"},"repository":{"url":"git+https://github.com/damarkuncoro/contract-architecture.git","type":"git"},"_npmVersion":"10.8.2","description":"The Governance Engine for Digital Systems. Enterprise-grade Contract-Driven Meta Design (CDMD) kernel.","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","vitest":"^4.0.17","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/meta-architecture_2.0.2_1769686235946_0.2483488193801091","host":"s3://npm-registry-packages-npm-production"}},"2.0.3":{"name":"@damarkuncoro/meta-architecture","version":"2.0.3","keywords":["contract","architecture","clean-architecture","ddd","enterprise","typescript"],"author":{"name":"DAMAR KUNCORO"},"license":"MIT","_id":"@damarkuncoro/meta-architecture@2.0.3","maintainers":[{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"}],"homepage":"https://github.com/damarkuncoro/contract-architecture#readme","bugs":{"url":"https://github.com/damarkuncoro/contract-architecture/issues"},"dist":{"shasum":"38d1e16f1e39a39b34593992cf52a2a86f4f7f98","tarball":"https://registry.npmjs.org/@damarkuncoro/meta-architecture/-/meta-architecture-2.0.3.tgz","fileCount":675,"integrity":"sha512-IBL75F/8VhL6ATf/gtPTvJDgmtdTsFekDsESWHYE5AWefkckWpp2F/EvyjTynG8e6FQDRu1Srebm7tkD11ucUQ==","signatures":[{"sig":"MEUCIDM4H9pe4mTQ40qowmgOjqug+TzapTLt4Tza1W5LDwdYAiEAy2OoSzD+GT1lqY7XDdN3CnKHg8gE0EJoh396jrOj6C4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":692829},"main":"lib/cjs/index.js","types":"lib/esm/index.d.ts","module":"lib/esm/index.js","exports":{".":{"types":"./lib/esm/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js"}},"gitHead":"874e4c2b387e120ac631621a6852ca053e96586a","scripts":{"lint":"eslint src --ext .ts","test":"vitest run","build":"npm run build:cjs && npm run build:esm","clean":"rm -rf lib dist","release":"npm run build && npm publish --access public","lint:fix":"eslint src --ext .ts --fix","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","typecheck":"tsc --noEmit","release:ui":"npm run release --prefix examples/react-renderer","test:watch":"vitest","build:watch":"tsc --watch","test:coverage":"vitest --coverage","prepublishOnly":"npm test && npm run clean && npm run build"},"_npmUser":{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"},"repository":{"url":"git+https://github.com/damarkuncoro/contract-architecture.git","type":"git"},"_npmVersion":"10.8.2","description":"The Governance Engine for Digital Systems. Enterprise-grade Contract-Driven Meta Design (CDMD) kernel.","directories":{},"_nodeVersion":"20.19.4","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","vitest":"^4.0.17","typescript":"^5.0.0","@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18"},"_npmOperationalInternal":{"tmp":"tmp/meta-architecture_2.0.3_1769699586649_0.6389287590123596","host":"s3://npm-registry-packages-npm-production"}},"2.0.4":{"name":"@damarkuncoro/meta-architecture","version":"2.0.4","description":"The Constitutional Layer for Digital Systems. Contracts are law. Everything must obey. Enterprise-grade Contract-Driven Meta Design (CDMD) kernel.","main":"lib/cjs/index.js","module":"lib/esm/index.js","types":"lib/esm/index.d.ts","exports":{".":{"types":"./lib/esm/index.d.ts","import":"./lib/esm/index.js","require":"./lib/cjs/index.js"}},"repository":{"type":"git","url":"git+https://github.com/damarkuncoro/meta-architecture.git"},"bugs":{"url":"https://github.com/damarkuncoro/meta-architecture/issues"},"homepage":"https://github.com/damarkuncoro/meta-architecture#readme","keywords":["contract","architecture","clean-architecture","ddd","enterprise","typescript"],"author":{"name":"DAMAR KUNCORO"},"license":"MIT","devDependencies":{"@types/node":"^20.0.0","@vitest/coverage-v8":"^4.0.18","eslint":"^9.39.2","typescript":"^5.0.0","vitest":"^4.0.17"},"scripts":{"build":"npm run build:cjs && npm run build:esm","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","build:watch":"tsc --watch","clean":"rm -rf lib dist","test":"vitest run","test:watch":"vitest","test:coverage":"vitest --coverage","lint":"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix","typecheck":"tsc --noEmit","release":"npm run build && npm publish --access public"},"_id":"@damarkuncoro/meta-architecture@2.0.4","_integrity":"sha512-/yebY5Mj9FdHmCjGhK3hWzSg1eE8iQzBUgdvPziAL2eJRI5PLrhLEHzNWSMZZqUK6voCI2nthw+YKR2D3z0RcQ==","_resolved":"/private/var/folders/5q/j90n97w16zd2vsdm445cmp680000gp/T/7649dae52062888974875660e395efeb/damarkuncoro-meta-architecture-2.0.4.tgz","_from":"file:damarkuncoro-meta-architecture-2.0.4.tgz","_nodeVersion":"20.19.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-/yebY5Mj9FdHmCjGhK3hWzSg1eE8iQzBUgdvPziAL2eJRI5PLrhLEHzNWSMZZqUK6voCI2nthw+YKR2D3z0RcQ==","shasum":"de10423ece56c7c18de5a473884382ff3d32e31c","tarball":"https://registry.npmjs.org/@damarkuncoro/meta-architecture/-/meta-architecture-2.0.4.tgz","fileCount":678,"unpackedSize":695141,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIE2fJqO6BAoHBI9NfTUu3yEoBqEcTGX3MU328lVZuKUCAiEApQgo8qjiKzFVEPmZSGy9TiRDq/Jkfglk3OgAaSe9K9A="}]},"_npmUser":{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"},"directories":{},"maintainers":[{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/meta-architecture_2.0.4_1770261762762_0.23115739050306194"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-29T10:36:07.453Z","modified":"2026-02-05T03:22:43.050Z","2.0.0":"2026-01-29T10:36:07.758Z","2.0.1":"2026-01-29T11:01:08.960Z","2.0.2":"2026-01-29T11:30:36.091Z","2.0.3":"2026-01-29T15:13:06.845Z","2.0.4":"2026-02-05T03:22:42.926Z"},"bugs":{"url":"https://github.com/damarkuncoro/meta-architecture/issues"},"author":{"name":"DAMAR KUNCORO"},"license":"MIT","homepage":"https://github.com/damarkuncoro/meta-architecture#readme","keywords":["contract","architecture","clean-architecture","ddd","enterprise","typescript"],"repository":{"type":"git","url":"git+https://github.com/damarkuncoro/meta-architecture.git"},"description":"The Constitutional Layer for Digital Systems. Contracts are law. Everything must obey. Enterprise-grade Contract-Driven Meta Design (CDMD) kernel.","maintainers":[{"name":"damarkuncoro","email":"damarkuncoro@gmail.com"}],"readme":"# 🏛️ **@damarkuncoro/meta-architecture**\n\n> **The Constitutional Layer for Digital Systems.**\n>\n> **Contracts are law. Everything must obey.**\n>\n> Enterprise-grade Contract-Driven Meta Design (CDMD) kernel. Not a UI framework. Not a config manager. This is the **Constitutional Layer** for your software ecosystem.\n\n[![Version](https://img.shields.io/npm/v/@damarkuncoro/meta-architecture?color=blue)](https://www.npmjs.com/package/@damarkuncoro/meta-architecture)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/damarkuncoro/contract-architecture/ci.yml?branch=main)](https://github.com/damarkuncoro/contract-architecture/actions)\n\n## 📋 **Table of Contents**\n\n- [Overview](#-overview)\n- [Key Features](#-key-features)\n- [Architecture](#-architecture)\n- [Quick Start](#-quick-start)\n- [Runtime Transaction Validation](#-runtime-transaction-validation)\n- [Ecosystem](#-ecosystem)\n- [Security](#-security)\n- [Contributing](#-contributing)\n- [License](#-license)\n\n## 🎯 **Overview**\n\n### 🏛️ **What is this?**\n\nThis is a **Contract Governance Engine**.\n\nIt sits above your frameworks (React, Vue, Node.js) and below your business requirements. It acts as the **single source of truth** for what is \"legal\" in your system.\n\n-   **For GovTech**: It acts as the digital regulation engine.\n-   **For AI Platforms**: It acts as the safety guardrail (AI generates content, CDMD validates it).\n-   **For Enterprise**: It acts as the architectural compliance layer.\n\n### ⚖️ **Contract as Law (Non-Negotiable)**\n\nIn this architecture, a **Contract** is not a suggestion, a configuration file, or a hint. **It is the law.**\n\n-   **Contract != Config**: Configuration can be changed at runtime; Contracts are immutable laws that govern the system.\n-   **No Bypass**: The Runtime Engine, UI Renderers, and AI Agents **MUST NOT** bypass contract constraints under any circumstances.\n-   **Universal Subjection**: User input, API responses, and AI-generated content are all **subject to the contract**. If they violate the contract, they are rejected immediately.\n\n`@damarkuncoro/meta-architecture` is an enterprise-grade TypeScript package that implements Clean Architecture principles for contract management. It provides a robust foundation for building scalable, maintainable, and secure contract-based systems with domain-driven design.\n\n## 🧠 **Why Not X?**\n\nUnderstanding what `@damarkuncoro/meta-architecture` is NOT helps clarify what it IS.\n\n### Why Not JSON Schema?\n\n| Aspect | JSON Schema | Meta-Architecture |\n|--------|-------------|-------------------|\n| **Purpose** | Validates data shape | Governs behavior & legality |\n| **Scope** | Local (data structure) | Global & systemic (entire system) |\n| **Enforcement** | Optional/Manual | Mandatory/Automatic |\n| **Lifecycle** | No lifecycle awareness | Contract lifecycle (draft → active → deprecated → archived) |\n| **Governance** | None | Constitutional layer |\n| **Audit Trail** | None | Complete traceability |\n\n**Key Difference:**\n- **JSON Schema** validates that data has the right shape (e.g., \"email is a string\")\n- **Meta-Architecture** governs what is legal in the system (e.g., \"email must be validated, encrypted, and logged\")\n\n### Why Not Policy Engines (OPA, Cedar)?\n\n| Aspect | Policy Engines | Meta-Architecture |\n|--------|---------------|-------------------|\n| **Purpose** | Decide yes/no for specific requests | Define what is legal to exist |\n| **Scope** | Request-level decisions | System-level governance |\n| **Focus** | Authorization & access control | Constitutional constraints |\n| **Definition** | Policies (rules) | Contracts (laws) |\n| **Enforcement** | Per-request | System-wide |\n| **Lifecycle** | Policy versioning | Contract lifecycle with formal approval |\n\n**Key Difference:**\n- **Policy Engines** decide whether a specific request is allowed (e.g., \"Can user X access resource Y?\")\n- **Meta-Architecture** defines what is legal to exist in the system (e.g., \"What properties MUST a user have?\")\n\n### Why Not Clean Architecture Only?\n\n| Aspect | Clean Architecture | Meta-Architecture |\n|--------|-------------------|-------------------|\n| **Purpose** | Define structure and dependencies | Define constitutional constraints |\n| **Scope** | Code organization | System governance |\n| **Focus** | Layer separation (Domain, Application, Infrastructure) | Contract enforcement |\n| **Validation** | Compile-time (TypeScript) | Compile-time + Runtime |\n| **Governance** | None | Constitutional layer |\n| **Compliance** | Manual | Automated |\n\n**Key Difference:**\n- **Clean Architecture** defines how code should be organized (e.g., \"Domain layer shouldn't depend on Infrastructure\")\n- **Meta-Architecture** defines what is legal in the system (e.g., \"All user data must be encrypted\")\n\n### Summary: The Constitutional Layer\n\n| Approach | What It Does | What It Doesn't Do |\n|-----------|---------------|---------------------|\n| **JSON Schema** | Validates data shape | Governs behavior, enforces laws |\n| **Policy Engines** | Decides authorization | Defines what can exist |\n| **Clean Architecture** | Organizes code structure | Enforces constitutional constraints |\n| **Meta-Architecture** | **Governs system behavior** | **Replaces all of the above** |\n\n**Meta-Architecture IS:**\n- ✅ A **Constitutional Layer** that sits above all of these\n- ✅ Defines **what is legal** in the system\n- ✅ Enforces **governance** across all layers\n- ✅ Provides **audit trails** for compliance\n- ✅ Ensures **AI safety** through guardrails\n\n## 🚀 **Key Features**\n\n### Core Architecture\n- 🏛️ **Clean Architecture** with proper layer separation\n- 🎯 **Domain-Driven Design** with entities, value objects, and aggregates\n- 📦 **SOLID Principles** implemented throughout\n- 🔄 **Dependency Injection** for testability and flexibility\n\n### Enterprise Features\n- 📊 **Contract Registry** with centralized management and discovery\n- ✅ **Validation Pipeline** with modular architecture (Security, Performance, Rules)\n- 🧩 **Plugin System** for extensible validation (Fraud Detection, Balance Checks)\n- 🛡️ **Complex Validation** support (Regex, Range, Enum, Custom Rules)\n- 📜 **Spec v1.1 Compliance** ensuring strict adherence to the Formal Contract Specification\n- 🚀 **High-Performance Caching** with LRU eviction and intelligent invalidation\n- 🔒 **Security Sandboxing** with code execution safety and input sanitization\n- 🌐 **Browser/Edge Compatible** (ESM & CJS Dual Build)\n\n### 🧬 **Contract-Driven Meta Architecture (CDMA)**\n\nThis project fully implements the CDMA specification, ensuring contracts are the single source of truth for all system behavior.\n\n- **Formal Specification**: Contracts are validated against a strict grammar.\n- **Runtime Validation**: Validate runtime data securely against contracts.\n- **Safe Sandboxing**: Custom validation logic is executed in a secure, isolated sandbox.\n\n## 🏗️ **Architecture**\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    PRESENTATION LAYER                       │\n│  (React/Vue/Angular Components, CLI, HTTP Controllers)     │\n└─────────────────────┬───────────────────────────────────────┘\n                       │\n┌─────────────────────▼───────────────────────────────────────┐\n│                 APPLICATION LAYER                           │\n│  ┌─────────────────────────────────────────────────────┐    │\n│  │ ContractRegistry     │ ValidationPipeline         │    │\n│  │ CachedContractRegistry │ SecuritySandbox          │    │\n│  └─────────────────────────────────────────────────────┘    │\n└─────────────────────┬───────────────────────────────────────┘\n                       │\n┌─────────────────────▼───────────────────────────────────────┐\n│                  DOMAIN LAYER                               │\n│  ┌─────────────────────────────────────────────────────┐    │\n│  │ ContractEntity     │ ContractName VO              │    │\n│  │ ContractVariant    │ ContractCategory VO          │    │\n│  │ ContractProp       │ ContractStatus VO            │    │\n│  │ Domain Events      │ Domain Errors                │    │\n│  └─────────────────────────────────────────────────────┘    │\n└─────────────────────┬───────────────────────────────────────┘\n                       │\n┌─────────────────────▼───────────────────────────────────────┐\n│               INFRASTRUCTURE LAYER                          │\n│  ┌─────────────────────────────────────────────────────┐    │\n│  │ InMemoryContractRepository │ LruCache             │    │\n│  │ InMemoryDomainEventPublisher │ SafeSandbox        │    │\n│  │ ContractDefinitionValidator │ InputSanitizer     │    │\n│  │ HealthChecker              │ SecurityPolicies    │    │\n│  └─────────────────────────────────────────────────────┘    │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## 🏃 **Quick Start**\n\n### Installation\n\n**Node.js (NPM/Yarn/PNPM):**\n\n```bash\nnpm install @damarkuncoro/meta-architecture\n# or\nyarn add @damarkuncoro/meta-architecture\n# or\npnpm add @damarkuncoro/meta-architecture\n```\n\n### Basic Usage\n\n```typescript\nimport {\n  ContractEntity,\n  ContractRegistry,\n  InMemoryContractRepository,\n  InMemoryDomainEventPublisher,\n  ValidationPipeline,\n  ContractCategory\n} from '@damarkuncoro/meta-architecture';\n\n// 1. Define a Contract (The Law)\nconst buttonContract = ContractEntity.create({\n  name: 'Button Component',\n  category: ContractCategory.COMPONENT,\n  variants: [\n    {\n      name: 'variant',\n      type: 'string',\n      values: ['primary', 'secondary'],\n      defaultValue: 'primary'\n    }\n  ],\n  props: [\n    {\n      name: 'label',\n      type: 'string',\n      required: true\n    }\n  ]\n});\n\n// 2. Set up the Registry\nconst repository = new InMemoryContractRepository();\nconst eventPublisher = new InMemoryDomainEventPublisher();\nconst registry = ContractRegistry.getInstance(repository, eventPublisher);\n\n// 3. Validate & Register\nconst validationPipeline = new ValidationPipeline();\nconst validationResult = await validationPipeline.validateContract(buttonContract, {\n  existingContracts: [],\n  environment: 'production',\n  userPermissions: ['admin']\n});\n\nif (validationResult.isSuccess) {\n  await registry.register(buttonContract);\n  console.log('✅ Contract registered successfully!');\n} else {\n  console.error('❌ Validation failed:', validationResult.error.message);\n}\n```\n\n### Advanced Usage with Plugins & Monitoring\n\n```typescript\nimport {\n  ValidationPipeline,\n  ValidationPluginRegistry,\n  ValidationLogger,\n  ContractEntity,\n  ContractCategory\n} from '@damarkuncoro/meta-architecture';\n\n// Custom validation plugin\nconst customPlugin = {\n  metadata: {\n    name: 'enterprise-security-plugin',\n    version: '1.0.0',\n    description: 'Enterprise security validation rules',\n    author: 'Your Company',\n    dependencies: {}\n  },\n  rules: [\n    {\n      name: 'enterprise-security-check',\n      description: 'Check enterprise security compliance',\n      category: 'security',\n      severity: 'error',\n      validate: async (contract, context) => {\n        // Custom security validation logic\n        if (contract.category.value === 'COMPONENT' && !contract.accessibility.supported) {\n          return {\n             valid: false,\n             message: 'Enterprise components must have accessibility support',\n             code: 'ENTERPRISE_SECURITY_VIOLATION'\n          };\n        }\n        return null;\n      }\n    }\n  ],\n  initialize: async (config) => {\n    console.log('Enterprise security plugin initialized');\n  },\n  destroy: async () => {\n    console.log('Enterprise security plugin destroyed');\n  },\n  getHealth: async () => ({ status: 'healthy' })\n};\n\n// Monitoring hooks\nconst monitoringHooks = {\n  onValidationStart: (context) => {\n    console.log(`Starting validation: ${context.operation}`);\n  },\n  onValidationComplete: (context) => {\n    console.log(`Validation completed in ${context.duration}ms`);\n  },\n  onPerformanceThresholdExceeded: (context) => {\n    console.warn(`Performance threshold exceeded: ${context.metric} = ${context.value}`);\n  }\n};\n\n// Set up enhanced pipeline\nconst logger = new ValidationLogger();\nconst pluginRegistry = new ValidationPluginRegistry();\n\nconst pipeline = new ValidationPipeline({\n  logger,\n  pluginRegistry,\n  monitoringHooks\n});\n\n// Register plugin\nawait pipeline.registerPlugin(customPlugin, {\n  enabled: true,\n  priority: 10\n});\n```\n\n## 🛡️ **Runtime Transaction Validation**\n\nBeyond validating contract definitions, this package provides a robust engine for validating **runtime transactions** against those contracts.\n\n### Complex Property Validation\n\nDefine strict rules for your contract properties directly in the definition:\n\n```typescript\nconst transferContract = ContractEntity.create({\n  name: 'Fund Transfer',\n  category: ContractCategory.TRANSACTION,\n  variants: [{ name: 'type', type: 'string', values: ['internal', 'external'] }],\n  props: [\n    {\n      name: 'amount',\n      type: 'number',\n      required: true,\n      validation: {\n        min: 1000,\n        max: 5000000,\n        message: 'Amount must be between 1,000 and 5,000,000'\n      }\n    },\n    {\n      name: 'currency',\n      type: 'string',\n      required: true,\n      validation: {\n        enum: ['IDR', 'USD', 'SGD']\n      }\n    },\n    {\n      name: 'notes',\n      type: 'string',\n      required: false,\n      validation: {\n        pattern: '^[a-zA-Z0-9 ]+$', // Alphanumeric only\n        message: 'Notes contains invalid characters'\n      }\n    }\n  ]\n});\n```\n\n### Transaction Plugins\n\nInject external logic (e.g., Fraud Detection, Balance Checks) into the validation pipeline without modifying core code.\n\n**1. Create a Plugin**\n\n```typescript\nimport { ITransactionPlugin, Result, TransactionContext } from '@damarkuncoro/meta-architecture';\n\nexport class FraudDetectionPlugin implements ITransactionPlugin {\n  readonly name = 'fraud-detection';\n  readonly version = '1.0.0';\n\n  async validate(context: TransactionContext): Promise<Result<void, string>> {\n    // Access runtime context (User IP, ID, etc.)\n    if (context.userContext?.ip === '1.2.3.4') {\n      return Result.failure('Suspicious IP Address detected');\n    }\n    return Result.success(undefined);\n  }\n}\n```\n\n**2. Load Plugins Dynamically (Factory Pattern)**\n\nUse the `PluginLoaderService` to load plugins from configuration (JSON/Env):\n\n```typescript\nimport { \n  TransactionPluginFactory, \n  PluginLoaderService, \n  TransactionPluginRegistry,\n  ValidateTransactionUseCase\n} from '@damarkuncoro/meta-architecture';\n\n// 1. Register Plugin Type (Auto-registration supported)\nTransactionPluginFactory.registerPluginType('fraud-detection', FraudDetectionPlugin);\n\n// 2. Load from Config\nconst registry = new TransactionPluginRegistry();\nconst loader = new PluginLoaderService(registry);\n\nawait loader.loadPlugins([\n  { type: 'fraud-detection', config: { strictMode: true } },\n  { type: 'external-balance-check' }\n]);\n\n// 3. Execute Validation\nconst useCase = new ValidateTransactionUseCase(contractRepository, registry);\nconst result = await useCase.execute({\n  contractId: 'fund-transfer-01',\n  payload: { amount: 50000, currency: 'IDR' },\n  userContext: { ip: '10.0.0.1', userId: 'user-123' }\n});\n```\n\n## 🌍 **Ecosystem**\n\nThis package is the kernel of the **Satu Raya Integrasi** ecosystem. It powers the following packages:\n\n| Package | Description |\n|---------|-------------|\n| **`@damarkuncoro/meta-architecture`** | **The Core Kernel.** Governance, Validation, and Registry logic. |\n| **`@damarkuncoro/ui-core`** | **Contract Definitions.** Reusable atomic/molecule contracts and types. |\n| **`@damarkuncoro/ui-components`** | **Headless UI.** Framework-agnostic implementations. |\n| **`@damarkuncoro/ui-renderers`** | **React/Vue Renderers.** Maps contracts to visual components. |\n\n## 🏗️ **Project Structure**\n\nThis project follows strict architectural guidelines:\n\n- **1 File 1 Class**: Strict file separation.\n- **Barrel Exports**: Clean `index.ts` APIs.\n- **Strict Layering**: Infrastructure → Application → Domain.\n\n```\nsrc/\n├── domain/           # Pure business logic & interfaces\n├── application/      # Use cases & application services\n├── schemas/          # Contract schemas & definitions\n├── infrastructure/   # External implementations\n└── shared/           # Shared utilities\n```\n\n## 🔒 **Security & Performance**\n\n- **Sandboxing**: Uses Node.js `vm` or browser-compatible safe evaluation for custom logic.\n- **Input Sanitization**: Automatic stripping of dangerous characters.\n- **LRU Caching**: Built-in caching for high-throughput registry access.\n\n## 🤝 **Contributing**\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) (coming soon) for details.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 **License**\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.\n","readmeFilename":"README.md"}