
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
ancient-cursor
Advanced tools
Abstract container of data synchronization.
npm i --save ancient-cursor
In most popular realisations of pubsub next abstractions (query, content, transport, source, storage) are stirred or combined, what, for example, makes dependence from current environment or makes schemes for data required.
Query
may be in any form.content
. Use it as desired.transport
. It have events with data, which should be tracked, and something will make decisions about transporting. (we recommend ancient-channels and ancient-peer)source
of data. It may be database-client or query-lang executor (like GraphQL). (we recommend ancient-asket)storage
. (we recommend ancient-tracker)We use this term around all the package. It may be like this
'a[1].c'
or ['a', 1, 'c']
['a', { b:2 }, 'c']
."Box" for data-changings with functions and parsers to work with it.
import {
bundleParsers,
} from 'ancient-cursor/lib/bundle';
const container = { data: { a:[{ b:3, c:4 }] } };
bundleParsers.extend(container, {
type: 'extend',
path: 'a.0',
value: { d: 6 },
});
container.data; // { a:[{ b:3, c:4, d:6 }] }
Simple capsule to actualize remote data. With cursor.exec()
you can send query to remote data source.
All changes apply using bundles as external stand-alone instructions what and where to change, when called cursor.apply ()
function. cursor.apply()
emits 'changed' event, where you can use watch()
to listen changes by specified path.
import {
Cursor,
watch,
} from '../lib/cursor';
let changed = false;
let watched = false;
const cursor = new Cursor();
cursor.on('exec', ({ cursor }) => {
// Here is transportation logic and after executing cursor.query by remote data-source may be called cursor.apply();
cursor.apply({
type: 'set',
path: '',
value: { a: [{ b: { c: 'd' } }] },
});
});
cursor.exec('some query');
cursor.on('changed', ({ bundleChanges }) => {
changed = true;
watch(bundleChanges, 'b', () => {
watched = true;
});
});
cursor.data // { a: [{ b: { c: 'd' } }] }
cursor.apply({
type: 'set',
path: 'a.0',
value: { d: { e: 'f' } },
});
cursor.data // { a: [{ d: { e: 'f' } }] }
triggered; // true;
watched; // false
cursor.apply({
type: 'extend',
path: '',
value: { b: 123 },
});
cursor.data // { a: [{ d: { e: 'f' } }], b: 123 }
watched; // true
Extends Cursor
with queue funcionality.
import {
StackableCursor,
} from '../lib/stackable-cursor';
const cursor = new StackableCursor();
cursor.exec(undefined, { a: [{ b: { c: 123 } }] });
cursor.apply({ indexInStack: 2, type: 'extend', path: 'a.0.b', value: {d: 234} });
cursor.bundlesStack.length; // 1
cursor.nextBundleIndex; // 0
cursor.data; // { a: [{ b: { c: 123 } }] }
cursor.apply({ indexInStack: 0, type: 'set', path: 'a.0.b.c', value: 456 });
cursor.bundlesStack.length; // 1
cursor.nextBundleIndex; // 1
cursor.data; // { a: [{ b: { c: 456 } }] }
cursor.apply({ indexInStack: 1, type: 'set', path: 'a.0.b.c', value: 345 });
cursor.bundlesStack.length; // 0
cursor.nextBundleIndex; // 3
cursor.data; // { a: [{ b: { c: 345, d: 234 } }] }
FAQs
Abstract container of data synchronization.
The npm package ancient-cursor receives a total of 181 weekly downloads. As such, ancient-cursor popularity was classified as not popular.
We found that ancient-cursor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.