Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
anticipated-io-js
Advanced tools
Changelog
[1.0.0] - 2022-06-12
Initial version
createJson
createSqs
get
Readme
A lightweight library designed to use the anticipated.io service in your Javascript / Typescript / Node projects.
The anticipated.io service provides a way to schedule and receive events based on a specific date/time. You can set an event to fire a few minutes from now or years from now. Event types are either JSON web event, XML web event or Amazon AWS SQS event.
The recommended way to install the anticipated.io SDK is through npm
or Yarn
.
npm:
npm install anticipated-io-js
yarn:
yarn add anticipated-io-js
You will need an API key from the anticipated.io service.
If you want to schedule SQS events you will want to create a user in your AWS account and provide the user access ONLY to send messages into the SQS queue. Make sure you ONLY provide access for that user. An example policy might be this:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:{region}:{accountID}:{queueName}"
}
]
}
With the Javascript/Node/Typescript SDK you can create / schedule events and delete events. There is not an option to update an event. You can, however, delete the event and build a new event. Please note the new event would have a new ID.
To create an event you need to call the createJson
function with the information you want to schedule.
const a = new AnticipatedEvent({ key: API_KEY })
const results = await a.createJson({
when: new Date('2022-06-14T22:09:00.000Z'),
url: YOUR_URL,
method: 'post', // or 'post' or 'GET' or 'POST'
document: {
info: 'custom information sent back in the payload for the POST',
id: 2352
}
})
console.log(results)
output:
{
"now": "2022-06-14T22:05:49.272Z",
"event": {
"id": "4jcBhmdUFnwxUpNSzivAGt",
"company": "x3BHxPtCEgoM323EKxKbiEh7",
"type": "json",
"when": "2022-06-14T22:09:00.000Z",
"created": "2022-06-14T22:05:49.256Z",
"details": {
"document": {
"info": "custom information sent back in the payload for the POST",
"id": 2352
},
"url": "YOUR_URL",
"method": "post",
"headers": []
}
}
}
To create an event you need to call the createSqs
function with the information you want to schedule.
const a = new AnticipatedEvent({ key: API_KEY })
const results = await a.createSqs({
when: new Date('2022-05-24 20:10:00'),
url: YOUR_SQS_QUEUE_URL,
document: {
info: 'custom information sent in the MessageBode',
id: 2352
}
})
console.log(results)
output:
{
"now": "2022-05-20T22:10:00.623Z",
"event": {
"id": "B1tPZBFPSUMfYU4PCPCGjc",
"company": "x3BHxPtCEgoM323EKxKbiEh7",
"type": "sqs",
"when": "2022-05-25T20:10:00.000Z",
"created": "2022-05-20T22:10:00.123Z",
"details": {
"document": {
"info": "custom information sent in the MessageBody",
"id": 2352
},
"url": "YOUR_SQS_QUEUE_URL",
"delaySeconds": 0
}
}
}
To create an event you need to call the createSqs
function with the information you want to schedule.
const a = new AnticipatedEvent({ key: API_KEY })
const results = await a.delete('B1tPZBFPSUMfYU4PCPCGjc')
console.log(results)
output:
{
"now": "2022-06-14T22:41:31.986Z",
"event": {
"id": "MC4a3fskFv5pFiZ9JNjXGu",
"company": "x3BHxPtCEgoM323EKxKbiEh7",
"when": "2022-06-14T22:46:31.571Z",
"created": "2022-06-14T21:33:31.893Z",
"type": "json",
"details": {
"headers": [],
"method": "post",
"url": "https://dev-diagnostics.anticipated.io/v1/event/4aVTdjM4fJXAXFxBWyaFT3/5eG76FnniNXzqkgALAas8Q",
"document": {
"id": "4aVTdjM4fJXAXFxBWyaFT3",
"application": "deltaTest",
"key": "5eG76FnniNXzqkgALAas8Q",
"url": "https://dev-diagnostics.anticipated.io/v1/event/4aVTdjM4fJXAXFxBWyaFT3/5eG76FnniNXzqkgALAas8Q",
"minutesAhead": 73
}
},
"deletedTime": "2022-06-14T22:41:31.974Z",
"deletedBy": "CMwVDx844JMsfNgALLLX51"
}
}
Tests are executed via Jest.
npm run test
FAQs
An ES6 / Typescript SDK for the anticipated.io service (https://www.anticipated.io).
The npm package anticipated-io-js receives a total of 21 weekly downloads. As such, anticipated-io-js popularity was classified as not popular.
We found that anticipated-io-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.