![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
potion-client
Advanced tools
A TypeScript client for APIs written in Flask-Potion.
$(node bin)/jspm install potion
Before you use this package, make sure you include reflect-metadata and a shim for ES6/7 features (core-js has the most comprehensive collection of shims and I advise using it).
Furthermore, this package has multiple implementations available, it can be used as:
Note that any routes created with Route.<method>
and the following methods on Item
return a Promise:
.save()
.update()
.destroy()
.query()
.fetch()
TODO
If you decide to use this package as a AngularJS module, use the following example as a starting point:
import angular from 'angular';
import 'potion/angularjs';
// If the bellow import is used,
// the line above is not necessary.
// By importing anything from the module,
// it will implicitly load and register the angularjs module.
import {Item, Route} from 'potion/angularjs';
angular
.module('myApp', ['potion'])
// Config the Potion client
.config(['potionProvider', (potionProvider) => {
potionProvider.config({prefix: ''});
}])
// Register a resource
.factory('User', ['potion', (potion) => {
class User extends Item {
static names = Route.GET('/names');
attributes = Route.GET('/attributes');
name: string;
}
potion.register('/user', User);
return User;
}])
.controller('MyAppController', ['User', (User) => {
// Fetch a user by id
const user1 = User.fetch(1);
// Get all user names using the static route created with `Route.GET('/names')`
const names = User.names();
// Get the user attributes using the instance route created with `Route.GET('/attributes')`
user1.then((user) => {
user.attributes().then((attrs) => {
console.log(attrs);
});
});
// Get all users
const users = User.query();
// Update a user
user1.then((user) => {
const name = 'John Foo Doe';
user.update({name});
});
// Delete a user
user1.then((user) => {
user.destroy({name});
});
// Create and save a new user
const name = 'Foo Bar';
let user2 = User.create({name});
user2.save();
}]);
Clone the repository git clone https://github.com/biosustain/potion-node
, install all the deps (npm install
, $(npm bin)/typings install
, $(npm bin)/jspm install
) and start hacking.
Make sure that the builds and tests will run successfully, before you make a pull request. Follow the next steps:
npm run build
to build the .ts
files and see if any errors have occurred;npm test
(if you wish to run tests on file change, use $(npm bin)/karma start karma.config.js
.);npm run lint
.Note: If you add new files or remove files, make sure to edit the "files"
field in tsconfig.json
:
"files": [
// these files will always stay here
"node_modules/typescript/lib/lib.es6.d.ts",
"typings/main.d.ts",
// you can change the bellow as you wish
"src/angularjs.ts",
"src/fetch.ts",
"src/base.ts",
"src/utils.ts"
]
FAQs
A ES6 client for APIs written in Flask-Potion
The npm package potion-client receives a total of 101 weekly downloads. As such, potion-client popularity was classified as not popular.
We found that potion-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.