
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
node module for integration with Omnis Platform omnis npm omnis-cli npm
npm install omnis
or
yarn add omnis
After installtion generate omnis.json on application settings page (read guide). And put this file into root project directory.
For requiring Omnis use following code:
import Omnis from 'omnis'
Omnis.get('test_endpoint')
.then(res => console.log(res))
.catch(err => console.log(err))
Then run your project, if everything configuration was properly done. In dev tools, you will see the next output.
Omnis node module has methods, which allow developers to manipulate the data on the server side by make HTTP requests. You don't need to modelate any queries for sending data to the server, just use Omnis methods and paste data, which you want to send on a server, like an argument to the method.
GET method used for getting data from endpoint.
import get from 'omnis/get'
let args = [
{ limit: 1 },
{ order: 'asc' },
{ page: 1 },
{ per_page: 4 },
{ q: '' },
{ slug: 'posts' }
]
get('test', ...args)
.then(res => console.log(res))
.catch(err => console.error(err))
GET method takes like a first argument - endpoint name, the second argument is the array of arguments:
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| limit | intiger | whole numbers | null | Returns first items in the limit |
| order | string | 'desc', 'asc' | 'desc' | Returns ordered by date items. asc - ascending order, desc - descending order |
| page | intiger | whole numbers | null | Returns items per page |
| per_page | intiger | whole numbers | null | Returns items on the page |
| q | string | all | null | Returns items with matching data |
| ids | number | whole numbers | null | Returns item with matching id |
| slug | string | all | null | Returns item with matching slug |
POST method used for send and write data on endpoint.
import post from 'omnis/post'
const data = {
title: 'Lorem',
subtitle: 'Ipsum'
}
post('test', data)
.then(res => console.log(res))
.catch(err => console.log(err))
POST method takes like first argument - endpoint name, the second argument is the data object with any object keys and a values.
| Name | Type | Allow value | Default |
|---|---|---|---|
| data | object | all | null |
PUT method used for replacing all data in endpoint.
import put from 'omnis/put'
const data = {
title: 'Lorem',
subtitle: 'Ipsum'
}
put('test', data)
.then(res => console.log(res))
.catch(err => console.log(err))
PUT method takes like the first argument - endpoint name, the second argument is the data object with any object keys and values, on which will be replaced all endpoint data.
| Name | Type | Allow value | Default |
|---|---|---|---|
| data | object | all | null |
PATCH method used for update existing data in endpoint.
import patch from 'omnis/patch'
const data = {
title: 'Lorem',
subtitle: 'Ipsum'
}
patch('test', data, id)
.then(res => console.log(res))
.catch(err => console.log(err))
PATCH method takes like the first argument - endpoint name, the second argument is the data object with any object keys and values. The third argument is id of the item which you want to update.
| Name | Type | Allow value | Default |
|---|---|---|---|
| data | object | string | null |
| ids | array | all | null |
DELETE method used for deleting existing data from endpoint.
import delete from 'omnis/remove' //package has a name remove because delete is reserved the name in JavaScript
const ids = ['first_id', 'second_id']
delete('test', ids)
.then(res => console.log(res))
.catch(err => console.log(err))
DELETE method takes like first argument - endpoint name, the second argument is the ids array of items which you want to delete from the endpoint. If you don't pass any ids all items from endpoint will be deleted.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| ids | array | string | null | Return true if there no errors |
File method used for upload file or image (image endpoint type) to endpoint.
import file from 'omnis/file'
const file = document.querySelector('input[type="file"]').files[0]
file('test', file)
.then(res => console.log(res))
.catch(err => console.log(err))
File method takes like first argument - endpoint name, the second argument is the file object. Max file size 10mb.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| file | object | file object | null | max file size 10mb |
Email method used for sending email to user from omnis and write them on the endpoint.
import email from 'omnis/email'
const email = {
email_to: 'test@example.com',
email_subject: 'test subject',
content: 'Hello World!'
}
email('test', email)
.then(res => console.log(res))
.catch(err => console.log(err))
Email method takes like first argument - endpoint name, the second argument is the email object.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| email_to | string | null | ||
| email_subject | string | all | null | |
| content | text/html | all | null |
Connect method used for listening updates in endpoint in real-time.
import connect from 'omnis/connect'
connect('test')
.onmessage = res => console.log(res)
Email method takes like first argument - endpoint name.
Omnis Platform can serve users, for it you can use following methods
Create methods used for creating user
import create from 'omnis/user/create'
const image = document.querySelector('input[type="file"]').files[0]
const user = {
username: 'John Smith',
email: 'test@example.com',
password: '1234567890',
passwordConfirmation: '1234567890',
image: image,
content: {
phoneNumber: '(123) 456-7890',
country: 'United Kingdom'
}
}
create('test', user)
.then(res => console.log(res))
.catch(err => console.log(err))
Create method takes like first argument - endpoint name, the second argument is the user object. In user object username, email, password, passwordConfirmation are required.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| username | string | all | null | |
| string | null | |||
| password | string | all | null | match to passwordConfirmation |
| passwordConfirmation | string | all | null | match to password |
| image | object | file object | null | max file size 10mb |
| content | object | all | null |
Show method used for returning user by userId
import show from 'omnis/user/show'
show('test', 'userId')
.then(res => console.log(res))
.catch(err => console.log(err))
Show method takes like first argument - endpoint name, the second argument is the userId.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| userId | string | all | null |
Edit method used for edit current user and return updated user object
import edit from 'omnis/user/edit'
const updatedUser = {
username: 'NewUserName',
email: 'newemail@example.com',
password: 'NewPassword',
passwordConfirmation: 'NewPassword',
content: {
... new content
}
}
edit('test', updatedUser, userId, sessionToken)
.then(res => console.log(res))
.catch(err => console.log(err))
Edit method takes like first argument - endpoint name, the second argument is the user object. In user object username, email, password, passwordConfirmation are required.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| userId | string | number | null | |
| sessionToken | string | null | ||
| username | string | all | null | |
| string | null | |||
| password | string | all | null | match to passwordConfirmation |
| passwordConfirmation | string | all | null | match to password |
| image | object | file object | null | max file size 10mb |
| content | object | all | null |
Login method used for login the user and returns a current user object
import login from 'omnis/user/login'
const auth = {
email: 'test@example.com'
password: '1234567890'
}
login('test', auth)
.then(res => console.log(res))
.catch(err => console.log(err))
Login method takes like first argument - endpoint name, the second argument is the auth object.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| string | null | |||
| password | string | all | null |
Logout method used for logout the user
import logout from 'omnis/user/logout'
logout('test', userId, sessionToken)
.then(res => console.log(res))
.catch(err => console.log(err))
Logout method takes like first argument - endpoint name, the second argument is the userId, the third argument is sessionToken from the current user object.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| userId | string | number | null | |
| sessionToken | string | null |
Password reset method used for resetting user password and returning user_token. Which will be used in the next method.
import resetPassword from 'omnis/user/resetPassword'
resetPassword('test', email)
.then(res => console.log(res))
.catch(err => console.log(err))
Password reset method takes like first argument - endpoint name, the second argument is the user email address.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| string | null |
Password update method used for update user password dropped in the Password Reset method and returning updated user object.
import passwordUpdate from 'omnis/user/passwordUpdate'
const newPassword = {
password: '1234567890',
passwordConfirmation: '1234567890'
}
passwordUpdate('test', newPassword, userToken)
.then(res => console.log(res))
.catch(err => console.log(err))
Password update method takes like first argument - endpoint name, the second argument is the new password object, the third argument is userToken from the Password Reset method.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| password | string | all | null | match to passwordConfirmation |
| passwordConfirmation | string | all | null | match to password |
| userToken | string | null |
Remove method used for deleting current user.
import remove from 'omnis/user/remove'
remove('test', userId, sessionToken)
.then(res => console.log(res))
.catch(err => console.log(err))
Remove method takes like first argument - endpoint name, the second argument is userId, the third argument is sessionToken.
| Name | Type | Allow value | Default | Details |
|---|---|---|---|---|
| userId | string | number | null | |
| sessionToken | string | null |
FAQs
Fron-end interface form omnis platform
We found that omnis 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.