Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanshtalwar committed Jun 25, 2024
1 parent 55cb3af commit 953338f
Show file tree
Hide file tree
Showing 16 changed files with 7,883 additions and 7,881 deletions.
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": ["@babel/preset-env", "@babel/preset-typescript"],
"plugins": []
"presets": ["@babel/preset-env", "@babel/preset-typescript"],
"plugins": []
}
34 changes: 17 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: Release

on:
push:
branches:
- master
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm i
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm i
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 7 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"semi": false,
"printWidth": 180,
"singleQuote": true
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 180,
"useTabs": true,
"tabWidth": 4,
"arrowParens": "always"
}
30 changes: 15 additions & 15 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", { "changelogFile": "CHANGELOG.md" }],
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": ["package.json", "pnpm-lock.yaml", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
]
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/changelog", { "changelogFile": "CHANGELOG.md" }],
"@semantic-release/npm",
[
"@semantic-release/git",
{
"assets": ["package.json", "pnpm-lock.yaml", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
],
"@semantic-release/github"
]
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [1.0.5]

fixes and improvements

## [1.0.4]

fixes and improvements
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,33 @@ A clean simple wrapper targeted at redis streams and redis List and basic pub-su
## Usage

```ts
const rediFlow = new RediFlow({})
const stream = rediFlow.createStream('mystream')
const rediFlow = new RediFlow({});
const stream = rediFlow.createStream('mystream');

const replica2 = await stream.createConsumerGroup(stream.streamName, 'replica-2', { startId: '$' })
const replica1 = await stream.createConsumerGroup(stream.streamName, 'replica-1', { startId: '$' })
const replica2 = await stream.createConsumerGroup(stream.streamName, 'replica-2', { startId: '$' });
const replica1 = await stream.createConsumerGroup(stream.streamName, 'replica-1', { startId: '$' });

const replica1Observable = await replica1.observeStream(1)
const replica2Observable = await replica2.observeStream(1)
const replica1Observable = await replica1.observeStream(1);
const replica2Observable = await replica2.observeStream(1);

replica1Observable.subscribe(async ({ ids, data }) => {
console.log({ handledBy: 'replica-1', data, ids })
await replica1.acknowledge(ids)
await stream.delete(ids)
})
console.log({ handledBy: 'replica-1', data, ids });
await replica1.acknowledge(ids);
await stream.delete(ids);
});

replica2Observable.subscribe(async ({ ids, data }) => {
console.log({ handledBy: 'replica-2', data, ids })
await replica1.acknowledge(ids)
await stream.delete(ids)
})

await stream.addToStream({ cool: { boom: 1 } }, '*')
await stream.addToStream({ cool: { boom: 2 } }, '*')
await stream.addToStream({ cool: { boom: 3 } }, '*')
await stream.addToStream({ cool: { boom: 4 } }, '*')
await stream.addToStream({ cool: { boom: 5 } }, '*')
await stream.addToStream({ cool: { boom: 6 } }, '*')
console.log({ handledBy: 'replica-2', data, ids });
await replica1.acknowledge(ids);
await stream.delete(ids);
});

await stream.addToStream({ cool: { boom: 1 } }, '*');
await stream.addToStream({ cool: { boom: 2 } }, '*');
await stream.addToStream({ cool: { boom: 3 } }, '*');
await stream.addToStream({ cool: { boom: 4 } }, '*');
await stream.addToStream({ cool: { boom: 5 } }, '*');
await stream.addToStream({ cool: { boom: 6 } }, '*');
```

## LICENSE
Expand Down
10 changes: 5 additions & 5 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [0, 'always', 100],
},
}
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [0, 'always', 100]
}
};
Loading

0 comments on commit 953338f

Please sign in to comment.