@ylsoo/core
v2.0.1
Published
Enterprise cross-platform SDK for Ylsoo projects
Maintainers
Readme
🚀 Overview
@ylsoo/core v2.2 introduces tier-1 routing capabilities and highly rigorous A/B target evaluation. Everything operates entirely on native standard technologies, avoiding the devastating payload bloat of common frameworks.
📦 Installation
npm i @ylsoo/core🛠️ V2.2 Enterprise Architecture Models
1. 🛣️ Professional DOM Router (ylsoo.router)
An incredibly capable HTML5 Frontend matcher mimicking heavily advanced Vue/React dynamics.
- Dynamic Constraints: Extracts
/:id/params cleanly into variables. - Middleware Control: Provides
beforeEach()to easily intercept and blockade navigations dynamically. - Click Hijacking: Automatically binds to HTML5 PushState and catches
data-routeclick events!
// 1. Build an Authentication Middleware Guard
ylsoo.router.beforeEach((to, from, next) => {
if (to.includes('admin') && !loggedIn) next(false); // Halt routing
});
// 2. Configure Dynamic Deep Routes
ylsoo.router.add('/users/:id/billing', (route) => {
console.log('Loading Billing For User:', route.params.id);
});
ylsoo.router.start();2. 🎛️ Deterministic A/B Flags (ylsoo.feature)
Not just a switch. A true matrix evaluation engine utilizing cryptographic hashing to guarantee specific users continuously load the exact same "random" feature buckets.
// Force the dashboard to turn on ONLY for:
// 1) Exactly 25% of traffic
// 2) Users whose attributes dictate they live in the UK
ylsoo.feature.setFlag('beta_dashboard', {
enabled: true,
rolloutPercentage: 25,
conditions: { country: 'UK' }
});
// Execution check during login
const userContext = { userId: "uuid-123", attributes: { country: 'UK' }};
if (await ylsoo.feature.evaluate('beta_dashboard', userContext)) {
console.log('User Granted Beta Access');
}3. 🛡️ Resilience Core (ylsoo.resilience)
withRetry(fn): Wraps flaky API calls and repeats them on an exponential delay loop (e.g. 1s... 2s... 4s...) rather than immediately panicking.createBreaker(fn): Operates a Circuit Breaker algorithm to instantly cut network traffic down if an upstream service goes offline, protecting your node instances from dead-locking.
4. 🕐 Precise Time Formatter (ylsoo.time)
Completely strips the need for massive moment.js dependency packets. Quickly parses standard intervals.
ylsoo.time.format(Date.now(), "YYYY-MM-DD HH:mm:ss");
ylsoo.time.timeAgo(oldDate); // "5 minutes ago"5. 🗄️ Strict Config Matrix (ylsoo.config)
A deep-merging configurations orchestrator. Implements .freeze() architecture to physically lock constants into memory, violently blocking any injected bad code downstream from maliciously altering your API_KEYS.
6. 🗃️ Concurrency Queue (ylsoo.createQueue)
Need thousands of promises to compute, but executing them simultaneously throttles your CPU? Assign them to a limit.
const q = ylsoo.createQueue(5); // Throttle process to exactly 5 lanes
q.add(() => fetchBigData1());
q.add(() => fetchBigData2());