Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit 4f5e4e9

Browse files
authored
Merge pull request #118 from mocks-server/release
Release v3.0.0
2 parents 4b3f3d4 + 2d711c4 commit 4f5e4e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6255
-4301
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"node": true
55
},
66
"parserOptions": {
7-
"ecmaVersion": "2018",
7+
"ecmaVersion": 2018,
88
"sourceType": "module"
99
},
1010
"plugins": ["prettier"],
@@ -16,6 +16,7 @@
1616
"parser": "flow"
1717
}
1818
],
19+
"no-shadow": "error",
1920
"no-undef": "error",
2021
"no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
2122
},

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
node: ["12.19.0", "14.15.0", "15.2.0"]
13+
node: ["12.22.1", "14.17.0", "15.14.0", "16.1.0"]
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v2
@@ -19,7 +19,7 @@ jobs:
1919
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
2020
id: extract-branch
2121
- name: Use Node.js
22-
uses: actions/setup-node@v1
22+
uses: actions/setup-node@v2
2323
with:
2424
node-version: ${{ matrix.node }}
2525
- name: Cache node modules
@@ -64,10 +64,12 @@ jobs:
6464
steps:
6565
- name: Checkout
6666
uses: actions/checkout@v2
67+
with:
68+
fetch-depth: 0
6769
- name: Download test results
6870
uses: actions/download-artifact@v2
6971
with:
70-
name: coverage-15.2.0
72+
name: coverage-16.1.0
7173
path: coverage
7274
- name: Coveralls
7375
uses: coverallsapp/github-action@master

.github/workflows/check-package-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/checkout@v2
1212
- name: Get NPM version is new
1313
id: check
14-
uses: EndBug/version-check@v1.6.0
14+
uses: EndBug/version-check@v2.0.1
1515
with:
1616
diff-search: true
1717
file-name: ./package.json

.github/workflows/publish-to-github.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ jobs:
99
- uses: actions/checkout@v2
1010
- run: npm ci
1111
- run: npm run build
12-
- uses: actions/setup-node@v1
12+
- uses: actions/setup-node@v2
1313
with:
14-
node-version: '12.x'
14+
node-version: '14.x'
1515
registry-url: 'https://npm.pkg.github.com'
1616
# Defaults to the user or organization that owns the workflow file
1717
scope: '@mocks-server'

.github/workflows/publish-to-npm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v2
10-
- uses: actions/setup-node@v1
10+
- uses: actions/setup-node@v2
1111
with:
12-
node-version: '12.x'
12+
node-version: '14.x'
1313
registry-url: 'https://registry.npmjs.org/'
1414
- run: npm ci
1515
- run: npm run build

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run lint-staged

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sonarlint.connectedMode.project": {
3+
"connectionId": "mocks-server",
4+
"projectKey": "mocks-server_admin-api-client-data-provider"
5+
}
6+
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99
### Changed
1010
### Fixed
1111
### Removed
12+
### BREAKING CHANGES
13+
14+
## [3.0.0] - 2021-05-25
15+
16+
### Added
17+
- feat: Support node 16
18+
- feat: Add client methods for Mocks Server v2 API
19+
20+
### Changed
21+
- chore(deps): Update devDependencies
22+
23+
### BREAKING CHANGES
24+
- chore(deps): Update to data-provider v3
25+
- chore(deps): Update to mocks-server v2
1226

1327
## [2.1.0] - 2020-12-26
1428

README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,49 @@ const example = async () => {
3232
console.log("Current mocks-server settings are", currentSettings);
3333

3434
await settings.update({
35-
behavior: "user-super-admin",
35+
mock: "user-super-admin",
3636
delay: 1000
3737
});
38-
console.log("Behavior and delay changed");
38+
console.log("Mock and delay changed");
3939
};
4040

4141
example();
4242
```
4343

4444
## Usage with data-provider
4545

46-
Exported properties `about`, `settings`, `behaviors`, `behaviorsModel`, `fixtures` and `fixturesModel` are [`@data-provider/axios`](https://github.com/data-provider/axios) providers, so can be used to define @data-provider Selectors. Methods can also be connected to frameworks using another `data-provider` packages, such as [`@data-provider/react`](https://github.com/data-provider/react).
46+
Exported properties `about`, `settings`, `mocks`, `mocksModel`, `routes`, `routesModel`, `routesVariants` and `routesVariantsModel` are [`@data-provider/axios`](https://github.com/data-provider/axios) providers, so can be used to define @data-provider Selectors. Methods can also be connected to frameworks using another `data-provider` packages, such as [`@data-provider/react`](https://github.com/data-provider/react).
4747

4848
## Api
4949

5050
* `about.read()` - Returns info about `mocks-server/plugin-admin-api`, such as current version.
5151
* `settings.read()` - Returns current `mocks-server` settings.
5252
* `settings.update(settingsObject)` - Updates `mocks-server` settings. A settings object has to be provided. Read the [`mocks-server` configuration documentation](https://www.mocks-server.org/docs/configuration-options) for further info.
53+
* `alerts.read()` - Returns collection of current alerts.
54+
* `alert(id).read()` - Returns a specific alert.
55+
* `alertsModel.queries.byId(id).read()` - Returns a specific alert.
56+
* `mocks.read()` - Returns collection of available mocks.
57+
* `mock(mockId).read()` - Returns a specific mock.
58+
* `mocksModel.queries.byId(mockId).read()` - Returns a specific mock.
59+
* `routes.read()` - Returns collection of available routes.
60+
* `route(id).read()` - Returns a specific route.
61+
* `routes.queries.byId(id).read()` - Returns an specific route.
62+
* `routesVariants.read()` - Returns collection of available routes variants.
63+
* `routeVariant(id).read()` - Returns a specific route variant.
64+
* `routesVariants.queries.byId(id).read()` - Returns an specific route variant.
65+
* `customRouteVariants.read()` - Returns collection of current custom route variants.
66+
* `customRouteVariants.create(id)` - Sets a specific route variant to be used by current mock.
67+
* `customRouteVariants.delete()` - Restore routes variants to those defined in current mock.
68+
69+
### Legacy methods
70+
Next methods correspond to Mocks Server legacy methods
71+
5372
* `behaviors.read()` - Returns collection of available behaviors.
54-
* `behavior(behaviorName).read()` - Returns an specific behavior.
55-
* `behaviorsModel.queries.byName(behaviorName).read()` - Returns an specific behavior.
73+
* `behavior(behaviorName).read()` - Returns a specific behavior.
74+
* `behaviorsModel.queries.byName(behaviorName).read()` - Returns a specific behavior.
5675
* `fixtures.read()` - Returns collection of available fixtures.
57-
* `fixture(id).read()` - Returns an specific fixture.
58-
* `fixturesModel.queries.byId(id).read()` - Returns an specific fixture.
59-
* `alerts.read()` - Returns collection of current alerts.
60-
* `alert(id).read()` - Returns an specific alert.
61-
* `alertsModel.queries.byId(id).read()` - Returns an specific alert.
76+
* `fixture(id).read()` - Returns a specific fixture.
77+
* `fixturesModel.queries.byId(id).read()` - Returns a specific fixture.
6278

6379
## Configuration
6480

@@ -94,7 +110,7 @@ Please read the [contributing guidelines](.github/CONTRIBUTING.md) and [code of
94110
[npm-downloads-url]: https://www.npmjs.com/package/@mocks-server/admin-api-client-data-provider
95111
[npm-dependencies-image]: https://img.shields.io/david/mocks-server/admin-api-client-data-provider.svg
96112
[npm-dependencies-url]: https://david-dm.org/mocks-server/admin-api-client-data-provider
97-
[quality-gate-image]: https://sonarcloud.io/api/project_badges/measure?project=mocks-server-admin-api-client-data-provider&metric=alert_status
98-
[quality-gate-url]: https://sonarcloud.io/dashboard?id=mocks-server-admin-api-client-data-provider
113+
[quality-gate-image]: https://sonarcloud.io/api/project_badges/measure?project=mocks-server_admin-api-client-data-provider&metric=alert_status
114+
[quality-gate-url]: https://sonarcloud.io/dashboard?id=mocks-server_admin-api-client-data-provider
99115
[release-image]: https://img.shields.io/github/release-date/mocks-server/admin-api-client-data-provider.svg
100116
[release-url]: https://github.com/mocks-server/admin-api-client-data-provider/releases

0 commit comments

Comments
 (0)