Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dropkit

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dropkit - npm Package Compare versions

Comparing version 0.9.4 to 1.0.0-0

dist/index.d.ts

55

package.json
{
"name": "dropkit",
"version": "0.9.4",
"description": "A DigitalOcean Node.js module",
"main": "index.js",
"version": "1.0.0-0",
"description": "A minimalist approach to custom dropdowns, autocompletes, and more.",
"source": "index.ts",
"main": "dist/index.js",
"module": "dist/index.es.js",
"unpkg": "dist/index.umd.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"test": "./node_modules/mocha/bin/mocha"
"build": "microbundle build",
"watch": "microbundle watch",
"publish": "np"
},
"author": "Warren Mira warrenmira@gmail.com",
"license": "MIT",
"dependencies": {
"bluebird": "^2.3.11"
},
"keywords": [
"digital ocean",
"digitalocean",
"digitalocean api"
],
"repository": {
"type": "git",
"url": "https://github.com/wmira/dropkit.git"
"url": "git+ssh://git@github.com/truework/dropkit.git"
},
"author": "estrattonbailey",
"license": "MIT",
"bugs": {
"url": "https://github.com/truework/dropkit/issues"
},
"homepage": "https://github.com/truework/dropkit#readme",
"devDependencies": {
"mocha": "^2.0.1",
"proxyquire": "^1.1.0"
"@types/react": "^16.9.35",
"ava": "^2.4.0",
"microbundle": "^0.11.0",
"np": "^6.3.2",
"react": "^16.13.1",
"ts-node": "^8.4.1"
},
"ava": {
"compileEnhancements": false,
"extensions": [
"ts"
],
"require": [
"ts-node/register"
]
},
"peerDependencies": {
"react": ">= 16.9"
}
}

@@ -1,118 +0,86 @@

dropkit
=======
# dropkit ![npm](https://img.shields.io/npm/v/dropkit) [![](https://badgen.net/bundlephobia/minzip/dropkit)](https://bundlephobia.com/result?p=dropkit)
dropkit is a node.js module for Digital Ocean's V2 REST API.
A minimalist approach to custom dropdowns, autocompletes, and more.
[![Build Status](https://travis-ci.org/wmira/dropkit.svg?branch=master)](https://travis-ci.org/wmira/dropkit)
### Features
# Usage:
- bring your own markup
- no magic
- full a11y support
- supports multi-select
- controlled, integrate with any form library
npm install --save dropkit
### Install
DropKit uses [BlueBird](https://github.com/petkaantonov/bluebird) and returns promises.
```javascript
var Dropkit = require("dropkit");
var v2 = new Dropkit("TOKEN");
v2.accounts().then(function(account) {
console.log(account);
}).error(function(error) {
console.log("httpStatusCode: " + error.statusCode);
console.log("response: " + error.res);
});
```
# API:
See the DigitalOcean's [V2 Rest API](https://developers.digitalocean.com/#introduction) for return definition
## Accounts
```javascript
v2.accounts();
v2.account.keys(); //return all keys
v2.account.keys(keyIdOrFingerPrint); //retrieve key info
v2.account.keys({name: 'keyname',public_key: "ssh-rsa ..."}); //create a new key
npm i dropkit --save
```
## Actions
```javascript
v2.actions(); //list all actions
v2.actions({page=1,per_page=2}); //pass parameter on action list
v2.actions(actionId); //retrieve specific actionid
# Usage
```
## Domains
```javascript
v2.domains(); //list all domains
v2.domains(domainName); //get domain info
v2.domain.create({name:'domain.com','ip_address':"127.0.0.1"});
v2.domain.delete("domain.com"); //delete
```
import React from "react";
import cx from "classnames";
## Domain Records
```javascript
v2.records(domainName); //list all records for a given domain
v2.records(domainName,recordId);//return info for a particular record id
import { useSelect } from "dropkit";
//create a new data, where recordData is https://developers.digitalocean.com/#create-a-new-domain-record
v2.record.create(domainName,recordData);
function Dropdown() {
const [label, labelSet] = React.useState("Please select");
v2.record.update(domainName,recordId,"newrecordname");//update the name of a record
v2.record.delete(domainName,recordId); //delete the record id
```
const {
id,
items,
isOpen,
getControlProps,
getDropProps,
} = useSelect({
items: [
{ value: "san-francisco", label: "San Francisco" },
{ value: "los-angeles", label: "Los Angeles" },
{ value: "san-diego", label: "San Diego" },
{ value: "new-york", label: "New York" },
{ value: "albany", label: "Albany" },
{ value: "rochester", label: "Rochester" }
],
onSelect(item) {
labelSet(item.label); // set to active item
},
onRemove() {
labelSet("Please select"); // reset to placeholder
},
});
## Droplets
```javascript
v2.droplets(); //return list of droplets
v2.droplets(dropletId); //return info for droplet id
return (
<>
<label htmlFor={id}>Cities</label>
<button id={id} controlProps={getControlProps()}>{label}</button>
v2.droplet_upgrades(); //return droplet upgrades
//create a droplet where droplet is https://developers.digitalocean.com/#create-a-new-droplet
v2.droplet.create(droplet);
v2.droplet.kernels(dropletId);
v2.droplet.snapshots(dropletId);
v2.droplet.backups(dropletId);
v2.droplet.delete(dropletId);
//action here can be disable_backups,reboot,power_cycle,shutdown,power_off,power_on,restore,password_reset ..etc
//see https://developers.digitalocean.com/#droplet-actions
v2.droplet.action(dropletId,action);
{isOpen && (
<ul {...getDropProps()}>
{items.map(i => (
<li
key={i.value}
className={cx({
'is-selected': i.selected,
'is-highlighted': i.highlighted,
})}
{...i.getItemProps()}
>
{i.label}
</li>
))}
</ul>
)}
</>
);
}
```
## Droplets
```javascript
v2.images(); //return all images
v2.images({type:"distribution"}); //list all distribution images
v2.images({type:"application"}); //list all application images
v2.images(id); //retrieve an image id
### Credits
Many thanks to [@wmira](https://github.com/wmira) for providing the `dropkit`
npm package name. If you're looking for the Digital Ocean V2 REST API library,
try [`v0.9.4` and below](https://www.npmjs.com/package/dropkit/v/0.9.4).
v2.image.update(id,"newName"); //update name of id
v2.image.delete(id); //as specified
v2.image.transfer(imageId,'nyc2'); //transfer image id to specified region
v2.image.action(imageId,actionId); //retrieve actionId
### License
```
## Others
```javascript
v2.regions();
v2.sizes();
```
# Dev
1. npm install
2. npm test
# TODO
1. Write more tests!
MIT License © [Eric Bailey](https://estrattonbailey.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc