# can-restless

> can-connect client for Flask-Restless

Latest version **0.12.5** (published 2017-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install can-restless
pnpm add can-restless
yarn add can-restless
bun add can-restless
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.5 |
| Published | 2017-07-20 |
| First published | 2016-07-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 61 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | roemhildtg |
| Maintainers | roemhildtg |

## Links

- npm: https://www.npmjs.com/package/can-restless
- Repository: https://github.com/roemhildtg/can-restless
- Homepage: https://github.com/roemhildtg/can-restless#readme
- Issues: https://github.com/roemhildtg/can-restless/issues
- npm.io page: https://npm.io/package/can-restless

## Dependencies (61)

- [jquery](https://npm.io/package/jquery.md) ^3.2.1
- [can-cid](https://npm.io/package/can-cid.md) 1.0.3
- [can-ejs](https://npm.io/package/can-ejs.md) 3.1.2
- [can-map](https://npm.io/package/can-map.md) 3.3.1
- [can-set](https://npm.io/package/can-set.md) 1.3.0
- [can-list](https://npm.io/package/can-list.md) 3.2.0
- [can-util](https://npm.io/package/can-util.md) 3.9.6
- [can-vdom](https://npm.io/package/can-vdom.md) 3.1.0
- [can-zone](https://npm.io/package/can-zone.md) 0.6.10
- [can-event](https://npm.io/package/can-event.md) 3.5.0
- [can-param](https://npm.io/package/can-param.md) 1.0.1
- [can-route](https://npm.io/package/can-route.md) 3.2.0
- [can-types](https://npm.io/package/can-types.md) 1.1.0
- [can-define](https://npm.io/package/can-define.md) 1.3.2
- [can-jquery](https://npm.io/package/can-jquery.md) 3.2.1
- [can-stache](https://npm.io/package/can-stache.md) 3.2.0
- [can-stream](https://npm.io/package/can-stream.md) 0.3.1
- [can-symbol](https://npm.io/package/can-symbol.md) 1.0.0
- [can-compute](https://npm.io/package/can-compute.md) 3.3.1
- [can-connect](https://npm.io/package/can-connect.md) 1.5.3
- [can-control](https://npm.io/package/can-control.md) 3.2.0
- [can-deparam](https://npm.io/package/can-deparam.md) 1.0.1
- [can-fixture](https://npm.io/package/can-fixture.md) 1.1.0
- [can-reflect](https://npm.io/package/can-reflect.md) 1.2.3
- [can-validate](https://npm.io/package/can-validate.md) 1.1.0
- [can-component](https://npm.io/package/can-component.md) 3.3.0
- [can-construct](https://npm.io/package/can-construct.md) 3.2.0
- [can-namespace](https://npm.io/package/can-namespace.md) 1.0.0
- [can-view-href](https://npm.io/package/can-view-href.md) 3.1.0
- [can-view-live](https://npm.io/package/can-view-live.md) 3.2.0
- [can-map-backup](https://npm.io/package/can-map-backup.md) 3.1.0
- [can-map-define](https://npm.io/package/can-map-define.md) 3.1.1
- [can-simple-dom](https://npm.io/package/can-simple-dom.md) 1.0.10
- [can-simple-map](https://npm.io/package/can-simple-map.md) 3.3.0
- [can-stache-key](https://npm.io/package/can-stache-key.md) 0.0.3
- [can-view-model](https://npm.io/package/can-view-model.md) 3.4.0
- [can-view-scope](https://npm.io/package/can-view-scope.md) 3.3.0
- [can-observation](https://npm.io/package/can-observation.md) 3.3.1
- [can-view-import](https://npm.io/package/can-view-import.md) 3.1.0
- [can-view-parser](https://npm.io/package/can-view-parser.md) 3.4.0
- [can-view-target](https://npm.io/package/can-view-target.md) 3.1.0
- [can-stream-kefir](https://npm.io/package/can-stream-kefir.md) 0.3.1
- [can-define-stream](https://npm.io/package/can-define-stream.md) 0.2.1
- [can-ndjson-stream](https://npm.io/package/can-ndjson-stream.md) 0.1.4
- [can-view-nodelist](https://npm.io/package/can-view-nodelist.md) 3.1.0
- [can-connect-ndjson](https://npm.io/package/can-connect-ndjson.md) 0.1.1
- [can-fixture-socket](https://npm.io/package/can-fixture-socket.md) 0.7.0
- [can-view-callbacks](https://npm.io/package/can-view-callbacks.md) 3.2.0
- [can-connect-signalr](https://npm.io/package/can-connect-signalr.md) 0.2.0
- [can-construct-super](https://npm.io/package/can-construct-super.md) 3.1.0
- [can-react-component](https://npm.io/package/can-react-component.md) 0.1.6
- [can-route-pushstate](https://npm.io/package/can-route-pushstate.md) 3.1.0
- [can-stache-bindings](https://npm.io/package/can-stache-bindings.md) 3.4.4
- [can-validate-legacy](https://npm.io/package/can-validate-legacy.md) 1.1.0
- [can-view-autorender](https://npm.io/package/can-view-autorender.md) 3.1.0
- [can-connect-feathers](https://npm.io/package/can-connect-feathers.md) 3.6.0
- [can-connect-cloneable](https://npm.io/package/can-connect-cloneable.md) 0.2.0
- [can-stache-converters](https://npm.io/package/can-stache-converters.md) 3.2.0
- [can-define-stream-kefir](https://npm.io/package/can-define-stream-kefir.md) 0.1.0
- [can-validate-validatejs](https://npm.io/package/can-validate-validatejs.md) 0.1.0
- [can-define-validate-validatejs](https://npm.io/package/can-define-validate-validatejs.md) 0.1.1

## Recent versions

- 0.12.5 (latest) — 2017-07-20
- 0.12.4 — 2017-07-20
- 0.12.3 — 2017-06-26
- 0.12.2 — 2017-06-13
- 0.12.1 — 2017-05-26
- 0.12.0 — 2017-05-26
- 0.11.1 — 2017-05-25
- 0.11.0 — 2017-05-16
- 0.10.1 — 2017-05-03
- 0.10.0 — 2017-04-14
- 0.9.0 — 2017-03-16
- 0.8.0 — 2017-03-07
- 0.7.0 — 2017-03-07
- 0.6.0 — 2016-12-07
- 0.5.1 — 2016-12-05
- … 6 more at https://npm.io/package/can-restless/versions

## README

<!--
@page can-restless Home
@group can-restless.types Type Definitions
-->

# can-restless

[![Greenkeeper badge](https://badges.greenkeeper.io/roemhildtg/can-restless.svg)](https://greenkeeper.io/)
A client data model for interacting with data from [`flask-restless`](https://github.com/jfinkels/flask-restless)
Note: Can-restless has been built to work with the JSON API specification that
flask-restless is currently developing. To utilize this package, the development version 1.0.0b should be used.


# Features
- Full crud api for retrieving, updating, and deleting data
- Retrieve lists of data with filtering, pagination, and sorting
- Pure data model, quickly build your own user interface, or use [can-crud](https://github.com/roemhildtg/can-admin-app)

# Quick Start

```
#install flask-restless from github:
virtualenv env
source env/bin/activate
pip install -e git://github.com/jfinkels/flask-restless.git#egg=flask-restless

#install can-restless
npm install can-restless --save
npm run export
```

## AMD

```javascript
require(['can-restless/dist/amd/index'], function(Factory){
  var Task = Factory(/* ... */);
});
```

## Require JS

```javascript
var Factory = require('can-restless/dist/cjs/index');
var Task = Factory(/* .... */);
```

## StealJS - ES6 Style Example

```javascript
import Factory from 'can-restless';
import CanMap from 'can/map/';

let TaskMap = CanMap.extend({
  name: 'My Task',
  description: 'More details about the task'
  is_complete: false,
});

let Task = Factory({
  map: TaskMap,

  //this is the default id property
  //idProp: 'id',
  name: 'task',
  url: '/api/tasks'
});

//fetch the list with no parameters
let deferred = Task.getList({});

//fetch the list with sorting
deferred = Task.getList({
  sort: {
    type: 'asc',
    fieldName: 'description'
  }
});

//fetch the list with a filter
deferred = Task.getList({
  filters: [{
    name: 'description',
    operator: 'like',
    value: '%details%'
  }]
});

//fetch one item by id
deferred = Task.get({
  id: 1
});
```

# Running the tests
Set up flask restless:

```
cd test/demo
virtualenv env
source env/bin/activate
pip install -r pip_require.txt
python run.py
```

Once the development server is running, run the tests either in a browser at `index.html` or by running

```
npm run test
```

# Limitations
**Filtering**:

Currently the only filter syntax supported is the array type with `name`, `op`, and `val`. Each filter in the array will be "and". Or is not currently implemented. For example:

```
deferred = Task.getList({
  filters: [{
    name: 'description',
    operator: 'like',
    value: '%details%'
  }, {
    name: 'birth_date',
    operator: 'after',
    value: '10/5/2005'
  }]
});
```

Will query person where name contains "details" AND where birth_date is after October 5, 2005.

# Contributing
Contributions from anyone are welcome!
- Pull Requests
- Report Issues via the issue tracker on github
- Feedback and Code Reviews

---
_Source: https://npm.io/package/can-restless · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
