Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Before creating an issue please make sure you have checked out the docs, specifi

If you haven't found your answer please feel free to join our [slack channel](http://slack.feathersjs.com), create an issue on Github, or post on [Stackoverflow](http://stackoverflow.com) using the `feathers` or `feathersjs` tag. We try our best to monitor Stackoverflow but you're likely to get more immediate responses in Slack and Github.

Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.
Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.

## Report a Security Concern

Expand Down Expand Up @@ -40,7 +40,7 @@ Feathers uses [Babel](https://babeljs.io/) to leverage the latest developments o

> npm run compile

__Note:__ `npm test` will run the compilation automatically before the tests.
**Note:** `npm test` will run the compilation automatically before the tests.

### Tests

Expand Down
4 changes: 3 additions & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ here](https://github.com/feathersjs/feathers/blob/master/.github/contributing.md
- [ ] If you can, please create a simple example that reproduces the issue and link to a gist, jsbin, repo, etc.

### Expected behavior

Tell us what should happen

### Actual behavior

Tell us what happens instead

### System configuration
Expand All @@ -26,4 +28,4 @@ Tell us about the applicable parts of your setup.

**React Native Version**:

**Module Loader**:
**Module Loader**:
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Your PR will be reviewed by a core team member and they will work with you to ge

If your changes involve documentation updates please mention that and link the appropriate PR in [feathers-docs](https://github.com/feathersjs/feathers-docs).

Thanks for contributing to Feathers! :heart:
Thanks for contributing to Feathers! :heart:
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Start Redis
uses: supercharge/[email protected]
with:
redis-version: "5"
redis-version: '5'
- name: Setup Rabbitmq
uses: nijel/[email protected]
- name: Setup NATS
Expand Down
43 changes: 21 additions & 22 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
name: Update dependencies

on:
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
update-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '15.x'
- run: npm ci
- run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
git checkout -b update-dependencies-$GITHUB_RUN_ID
- run: |
npm run update-dependencies
npm install
- run: |
git commit -am "chore(dependencies): Update dependencies"
git push origin update-dependencies-$GITHUB_RUN_ID
- run: |
gh pr create --title "chore(dependencies): Update all dependencies" --body ""
env:
GITHUB_TOKEN: ${{secrets.CI_ACCESS_TOKEN}}

- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '15.x'
- run: npm ci
- run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
git checkout -b update-dependencies-$GITHUB_RUN_ID
- run: |
npm run update-dependencies
npm install
- run: |
git commit -am "chore(dependencies): Update dependencies"
git push origin update-dependencies-$GITHUB_RUN_ID
- run: |
gh pr create --title "chore(dependencies): Update all dependencies" --body ""
env:
GITHUB_TOKEN: ${{secrets.CI_ACCESS_TOKEN}}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ node_modules
# Users Environment Variables
.lock-wscript

dist/
lib/
.vscode/launch.json
41 changes: 8 additions & 33 deletions .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,16 @@
"verbose": false,
"tempDirectory": "./coverage/.tmp",
"semistandard": {
"env": [
"mocha"
]
"env": ["mocha"]
},
"extension": [
".ts",
".tsx",
".js"
],
"exclude": [
"**/test/*"
],
"extension": [".ts", ".tsx", ".js"],
"exclude": ["**/test/*"],
"print": "detail",
"reporter": [
"html",
"text",
"text-summary",
"lcov"
],
"reporter": ["html", "text", "text-summary", "lcov"],
"watermarks": {
"statements": [
70,
90
],
"lines": [
70,
90
],
"functions": [
70,
90
],
"branches": [
70,
90
]
"statements": [70, 90],
"lines": [70, 90],
"functions": [70, 90],
"branches": [70, 90]
}
}
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 110,
"semi": false,
"trailingComma": "none",
"singleQuote": true
}
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
- Feathers-sync Redis Adapter with an existing Redis Sentinel client and Feathers-Socket.io [\#182](https://github.com/feathersjs/feathers-sync/issues/182)
- High RAM usage when large files are uploaded [\#181](https://github.com/feathersjs/feathers-sync/issues/181)
- startup errors after update to 3.0.0 with redis adapter [\#178](https://github.com/feathersjs/feathers-sync/issues/178)
- bson - cyclic dependency detected [\#168](https://github.com/feathersjs/feathers-sync/issues/168)
- bson - cyclic dependency detected [\#168](https://github.com/feathersjs/feathers-sync/issues/168)

## [v3.0.1](https://github.com/feathersjs/feathers-sync/tree/v3.0.1) (2022-03-15)

Expand Down Expand Up @@ -249,7 +249,7 @@

**Merged pull requests:**

- Send safely stringified data to MongoDB [\#85](https://github.com/feathersjs/feathers-sync/pull/85) ([daffl](https://github.com/daffl))
- Send safely stringified data to MongoDB [\#85](https://github.com/feathersjs/feathers-sync/pull/85) ([daffl](https://github.com/daffl))

## [v1.0.2](https://github.com/feathersjs/feathers-sync/tree/v1.0.2) (2018-06-11)

Expand Down Expand Up @@ -375,6 +375,4 @@
- disallow yoda http://eslint.org/docs/rules/yoda.html [\#4](https://github.com/feathersjs/feathers-sync/pull/4) ([cloudlena](https://github.com/cloudlena))
- redis adapter [\#2](https://github.com/feathersjs/feathers-sync/pull/2) ([kc-dot-io](https://github.com/kc-dot-io))



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
\* _This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)_
70 changes: 35 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ This allows to scale real-time websocket connections to any number of clients.
The application initialized in the following example will use the local `feathers-sync` database and `sync` collection and share service events with every other instance connected to the same database:

```js
const feathers = require('@feathers/feathers');
const sync = require('feathers-sync');
const feathers = require('@feathers/feathers')
const sync = require('feathers-sync')

const app = feathers();
const app = feathers()

app.configure(
sync({
uri: 'redis://localhost:6379',
uri: 'redis://localhost:6379'
})
);
app.use('/todos', todoService);
)
app.use('/todos', todoService)
```

> Note that configuring sync should happen before configuring services
Expand All @@ -65,28 +65,28 @@ When set up, `app.sync` will contain the following information:
```js
app.sync.ready.then(() => {
// Do things here
});
})
```

### Disabling synchronization

`feathers-sync` can be disabled on the service method call level in a hook by setting the `require('feathers-sync').SYNC` property on the hook context to `false`:

```js
const { SYNC } = require('feathers-sync');
const { SYNC } = require('feathers-sync')

app.service('messages').hooks({
after: {
create(context) {
// Don't synchronize if more than 1000 items were created at once
if (context.result.length > 1000) {
context[SYNC] = false;
context[SYNC] = false
}

return context;
},
},
});
return context
}
}
})
```

## Adapters
Expand All @@ -97,22 +97,22 @@ app.service('messages').hooks({
// Configure Redis
app.configure(
sync({
uri: 'redis://localhost:6379',
uri: 'redis://localhost:6379'
})
);
)

app.configure(
sync.redis({
db: redisInstance,
db: redisInstance
})
);
)

// Configure Redis using an existing redisClient
app.configure(
sync.redis({
redisClient: redisClient,
redisClient: redisClient
})
);
)
```

### Redis
Expand Down Expand Up @@ -150,17 +150,17 @@ Event data are serialized and deserialized using `JSON.stringify` and `JSON.pars

```js
// BSON can serialize / deserialize `Date` values.
const bson = require('bson');
const bson = require('bson')

app.configure(
sync({
uri: 'redis://localhost:6379',
// Replies will be sent to callbacks as Buffers instead of Strings for bson.deserialize to work.
redisOptions: { return_buffers: true },
serialize: bson.serialize,
deserialize: bson.deserialize,
deserialize: bson.deserialize
})
);
)
```

> `Redis` and `AMQP` can support binary serialization / deserialization (i.e. `Buffer` data). `NATS` currently does not support custom serialization / deserialization/
Expand All @@ -170,45 +170,45 @@ app.configure(
`feathers-sync` allows to implement custom adapters using the `sync-in` and `sync-out` events on the application:

```js
const { core } = require('feathers-sync');
const { core } = require('feathers-sync')
const myMessagingService = {
publish(data) {
// send data here
},

subscribe(callback) {
// subscribe to message queue and emit data
},
};
}
}

module.exports = (config) => {
// If adapter supports configurable serializer / deserializer (defaults to `JSON.stringfy` / `JSON.parse`)
const { deserialize, serialize } = config;
const { deserialize, serialize } = config

return (app) => {
app.configure(core);
app.configure(core)
app.sync = {
type: 'custom',
ready: new Promise((resolve, reject) => {
// resolve when client is ready
// reject on connection error
}),
serialize,
deserialize,
};
deserialize
}

// Sent every time a service
app.on('sync-out', (data) => {
// Publish `data` to the message queue
myMessagingService.publish(data);
});
myMessagingService.publish(data)
})

myMessagingService.subscribe((data) => {
// Send the synchronization event to the application
app.emit('sync-in', data);
});
};
};
app.emit('sync-in', data)
})
}
}
```

The `data` for the `sync-in` event should be in the same form as the one that is sent by `sync-out` (currently it includes `{ event, path, data, context }`).
Expand Down
Loading
Loading