@feathersjs/memory 5.0.1 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +5 -84
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.0.4](https://github.com/feathersjs/feathers/compare/v5.0.3...v5.0.4) (2023-04-12)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Make sure all Readme files are up to date ([#3154](https://github.com/feathersjs/feathers/issues/3154)) ([a5f0b38](https://github.com/feathersjs/feathers/commit/a5f0b38bbf2a11486415a39533bcc6c67fb51e3e))
|
|
11
|
+
- **memory:** Fix memory adapter readme ([#3153](https://github.com/feathersjs/feathers/issues/3153)) ([a9d826a](https://github.com/feathersjs/feathers/commit/a9d826a7dbe7df4501fbf82a47d2c3a77ca9e0c0))
|
|
12
|
+
|
|
13
|
+
## [5.0.3](https://github.com/feathersjs/feathers/compare/v5.0.2...v5.0.3) (2023-04-05)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **dependencies:** Update all dependencies ([#3139](https://github.com/feathersjs/feathers/issues/3139)) ([f24276e](https://github.com/feathersjs/feathers/commit/f24276e9a909e2e58a0730c730258ce1f70f4028))
|
|
18
|
+
|
|
6
19
|
## [5.0.1](https://github.com/feathersjs/feathers/compare/v5.0.0...v5.0.1) (2023-03-15)
|
|
7
20
|
|
|
8
21
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -4,96 +4,17 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@feathersjs/memory)
|
|
5
5
|
[](https://discord.gg/qa8kez8QBx)
|
|
6
6
|
|
|
7
|
-
A
|
|
7
|
+
> A Feathers service adapter for in-memory data storage that works on all platforms.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
12
|
$ npm install --save @feathersjs/memory
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## API
|
|
16
|
-
|
|
17
|
-
### `service([options])`
|
|
18
|
-
|
|
19
|
-
Returns a new service instance initialized with the given options.
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
const service = require('@feathersjs/memory')
|
|
23
|
-
|
|
24
|
-
app.use('/messages', service())
|
|
25
|
-
app.use('/messages', service({ id, startId, store, events, paginate }))
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
**Options:**
|
|
29
|
-
|
|
30
|
-
- `id` (_optional_, default: `'id'`) - The name of the id field property.
|
|
31
|
-
- `startId` (_optional_, default: `0`) - An id number to start with that will be incremented for every new record (unless it is already set).
|
|
32
|
-
- `store` (_optional_) - An object with id to item assignments to pre-initialize the data store
|
|
33
|
-
- `events` (_optional_) - A list of [custom service events](https://docs.feathersjs.com/api/events.html#custom-events) sent by this service
|
|
34
|
-
- `paginate` (_optional_) - A [pagination object](https://docs.feathersjs.com/api/databases/common.html#pagination) containing a `default` and `max` page size
|
|
35
|
-
- `whitelist` (_DEPRECATED_) - renamed to `allow`
|
|
36
|
-
- `allow` (_optional_) - A list of additional query parameters to allow
|
|
37
|
-
- `multi` (_optional_) - Allow `create` with arrays and `update` and `remove` with `id` `null` to change multiple items. Can be `true` for all methods or an array of allowed methods (e.g. `[ 'remove', 'create' ]`)
|
|
38
|
-
|
|
39
|
-
## Example
|
|
40
|
-
|
|
41
|
-
Here is an example of a Feathers server with a `messages` in-memory service that supports pagination:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
$ npm install @feathersjs/feathers @feathersjs/express @feathersjs/socketio @feathersjs/errors @feathersjs/memory
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
In `app.js`:
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
const feathers = require('@feathersjs/feathers')
|
|
51
|
-
const express = require('@feathersjs/express')
|
|
52
|
-
const socketio = require('@feathersjs/socketio')
|
|
53
|
-
|
|
54
|
-
const memory = require('@feathersjs/memory')
|
|
55
|
-
|
|
56
|
-
// Create an Express compatible Feathers application instance.
|
|
57
|
-
const app = express(feathers())
|
|
58
|
-
// Turn on JSON parser for REST services
|
|
59
|
-
app.use(express.json())
|
|
60
|
-
// Turn on URL-encoded parser for REST services
|
|
61
|
-
app.use(express.urlencoded({ extended: true }))
|
|
62
|
-
// Enable REST services
|
|
63
|
-
app.configure(express.rest())
|
|
64
|
-
// Enable REST services
|
|
65
|
-
app.configure(socketio())
|
|
66
|
-
// Create an in-memory Feathers service with a default page size of 2 items
|
|
67
|
-
// and a maximum size of 4
|
|
68
|
-
app.use(
|
|
69
|
-
'/messages',
|
|
70
|
-
memory({
|
|
71
|
-
paginate: {
|
|
72
|
-
default: 2,
|
|
73
|
-
max: 4
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
)
|
|
77
|
-
// Set up default error handler
|
|
78
|
-
app.use(express.errorHandler())
|
|
79
|
-
|
|
80
|
-
// Create a dummy Message
|
|
81
|
-
app
|
|
82
|
-
.service('messages')
|
|
83
|
-
.create({
|
|
84
|
-
text: 'Message created on server'
|
|
85
|
-
})
|
|
86
|
-
.then((message) => console.log('Created message', message))
|
|
87
|
-
|
|
88
|
-
// Start the server.
|
|
89
|
-
const port = 3030
|
|
90
|
-
|
|
91
|
-
app.listen(port, () => {
|
|
92
|
-
console.log(`Feathers server listening on port ${port}`)
|
|
93
|
-
})
|
|
94
|
-
```
|
|
15
|
+
## Documentation
|
|
95
16
|
|
|
96
|
-
|
|
17
|
+
See [FeathersJS Memory Adapter API documentation](https://feathersjs.com/api/databases/memory.html) for more details.
|
|
97
18
|
|
|
98
19
|
## License
|
|
99
20
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/memory",
|
|
3
3
|
"description": "An in memory service store",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.4",
|
|
5
5
|
"homepage": "https://github.com/feathersjs/feathers",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -49,20 +49,20 @@
|
|
|
49
49
|
"lib": "lib"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@feathersjs/adapter-commons": "^5.0.
|
|
53
|
-
"@feathersjs/commons": "^5.0.
|
|
54
|
-
"@feathersjs/errors": "^5.0.
|
|
52
|
+
"@feathersjs/adapter-commons": "^5.0.4",
|
|
53
|
+
"@feathersjs/commons": "^5.0.4",
|
|
54
|
+
"@feathersjs/errors": "^5.0.4",
|
|
55
55
|
"sift": "^17.0.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@feathersjs/adapter-tests": "^5.0.
|
|
59
|
-
"@feathersjs/feathers": "^5.0.
|
|
58
|
+
"@feathersjs/adapter-tests": "^5.0.4",
|
|
59
|
+
"@feathersjs/feathers": "^5.0.4",
|
|
60
60
|
"@types/mocha": "^10.0.1",
|
|
61
|
-
"@types/node": "^18.
|
|
61
|
+
"@types/node": "^18.15.11",
|
|
62
62
|
"mocha": "^10.2.0",
|
|
63
63
|
"shx": "^0.3.4",
|
|
64
64
|
"ts-node": "^10.9.1",
|
|
65
|
-
"typescript": "^
|
|
65
|
+
"typescript": "^5.0.3"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "376e89040991db500f1f327aa699322543315039"
|
|
68
68
|
}
|