![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
swipelime-client-node
Advanced tools
swipelime-client-node is the official swipelime Node.js client library
Official Node.js Client Library for swipelime.
See the API documentation for more information and example usage.
To use the package, you'll need to have API credentials. To get an API account, please contact us.
npm i swipelime-client-node
The package officially supports Node.js version 20 an above.
Import the package and construct a Client
. The first argument is an object of your API credentials.
With the second argument you can specify the environment you will connect to.
You'll need to add a ServiceHandler
to the client to handle the tenant.
Be careful not to expose your credentials, for example when sharing source code.
An example using async
/await
and ES Modules:
import { Client } from 'swipelime-client-node';
const username = 'insert-your-username-here';
const password = 'insert-your-password-here';
const client = new Client({ username, password }, { environment: 'test' });
(async () => {
const serviceHandler = await client.addServiceHandler({ tenantId: 'insert-tenant-id-here' });
})();
This example is for demonstration purposes only. In production code, the API credentials should NOT be hard-coded, but instead fetched from a configuration file or environment variable.
You will need to add listeners to get the events or commands to process
The newTasks
event will be called when you receive new tasks from the swipelime API.
The tasks
is an array containing TaskEvent
and/or TaskCommand
objects.
serviceHandler.emitter.on('newTasks', (tasks) =>
{
tasks.forEach(async (task) =>
{
// Process the task here
});
})
You will receive TaskEvent
task when the swipelime API is reporting that
something has happened in the system.
You can check the data for useful information and react to it in your system.
After you done processing it you will need to confirm it with the confirm function.
if(task instanceof TaskEvent)
{
// Test event
if(task.data.eventType === 'test')
{
console.log('test event has arrived');
}
await task.confirm();
console.log('test event has been confirmed');
}
You will receive TaskCommand
task when the swipelime API is requesting data from your system.
You will need to gather the data and call the matching function for the command type.
For example if you receive the test
command you will need to call serviceHandler.confirmTestCommand
.
You do not need to confirm the TaskCommand
because calling the function will automatically does it for you.
else if(task instanceof TaskCommand)
{
// Test command
if(task.data.commandType === 'test')
{
console.log('test command has arrived');
await serviceHandler.confirmTestCommand(task);
console.log('test command has been confirmed');
}
}
You have the option to just refuse to give us the information when you receive the command.
This is possible by calling the task.refuse
function.
It is also a good idea to refuse any unknown or not implemented commands so it don't fill up the queue.
else
{
task.refuse();
}
You can find an example typescript project here, which demonstrates the usage of swipelime client.
[0.4.2] - 2024-12-04
FAQs
swipelime-client-node is the official swipelime Node.js client library
The npm package swipelime-client-node receives a total of 5 weekly downloads. As such, swipelime-client-node popularity was classified as not popular.
We found that swipelime-client-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.