You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 28, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+43Lines changed: 43 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,49 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
9
9
### Changed
10
10
### Fixed
11
11
### Removed
12
+
### Breaking change
13
+
14
+
## [3.0.0] - 2021-02-17
15
+
16
+
### Added
17
+
- feat: Expose one different method for each action.
18
+
- feat: Reject promises in case of status code different to 2xx
19
+
20
+
### Changed
21
+
- feat: Rename `apiPath` config property into `adminApiPath`
22
+
- feat: Update mocks-server dependencies to v2 beta versions and adapt routes and tests.
23
+
24
+
### Removed
25
+
- feat: Make entities private
26
+
27
+
### BREAKING CHANGES
28
+
- Core and plugins updated to v2. Please read the [migration from v1.x guide](https://www.mocks-server.org/docs/guides-migrating-from-v1) and the [Core v2 release notes](https://github.com/mocks-server/core/releases/tag/v2.0.0) for further info.
29
+
- Rename `apiPath` config property into `adminApiPath`
30
+
- Removed previous entity-based methods
31
+
32
+
## [3.0.0-beta.2] - 2021-02-16
33
+
34
+
### Changed
35
+
- chore(deps): Update dependencies. Adapt tests
36
+
- feat: Rename `apiPath` config property into `adminApiPath`
37
+
- feat: Rename `readMockCustomRoutesVariants` method into `readCustomRoutesVariants`
38
+
- feat: Rename `addMockCustomRouteVariant` method into `useRouteVariant`
39
+
- feat: Rename `restoreMockRoutesVariants` method into `restoreRoutesVariants`
40
+
41
+
## [3.0.0-beta.1] - 2021-02-15
42
+
43
+
### Added
44
+
- feat: Expose one different method for each action.
45
+
- feat: Reject promises in case of status code different to 2xx
46
+
47
+
### Changed
48
+
- feat: Update mocks-server dependencies to v2 beta versions and adapt routes and tests.
Copy file name to clipboardExpand all lines: README.md
+35-23Lines changed: 35 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@
7
7
8
8
# Mocks-server administration api client
9
9
10
-
This package contains methods for administrating `mocks-server`_(through the [@mocks-server/plugin-admin-api](https://github.com/mocks-server/plugin-admin-api)REST API)_.
10
+
This package contains methods for administrating Mocks Server _(using the [Admin API plugin](https://github.com/mocks-server/plugin-admin-api)under the hood)_.
11
11
12
-
Requests to `mocks-server`are made using [cross-fetch](https://www.npmjs.com/package/cross-fetch), which makes this package compatible with browsers and nodejs environments, but, if you are going to build a browser application, you'll probably prefer to use the [@mocks-server/admin-api-client-data-provider package](https://www.npmjs.com/package/@mocks-server/admin-api-client-data-provider), which uses [@data-provider](https://github.com/data-provider), and works well with Redux, React, etc.
12
+
Requests to the Mocks Server API are made using [`cross-fetch`](https://www.npmjs.com/package/cross-fetch), which makes this package compatible with browsers and nodejs environments, but, if you are going to build a browser application, you'll probably prefer to use the [`@mocks-server/admin-api-client-data-provider` package](https://www.npmjs.com/package/@mocks-server/admin-api-client-data-provider), which uses [Data Provider](https://www.data-provider.org), and works well with Redux, React, etc.
13
13
14
14
## Install
15
15
@@ -28,51 +28,63 @@ The UMD build is also available on unpkg:
28
28
29
29
## Usage
30
30
31
-
All methods described in the [Api](#api) (expect the `config` method) return Promises when executed:
31
+
All methods described in the [Api](#api) (except the `config` method) return Promises when executed:
console.log("Current Mocks Server settings are", currentSettings);
42
42
43
-
awaitsettings.update({
44
-
behavior:"user-super-admin",
43
+
awaitupdateSettings({
44
+
mock:"user-super-admin",
45
45
delay:1000
46
46
});
47
-
console.log("Behavior and delay changed");
47
+
console.log("Mock and delay changed");
48
48
};
49
49
50
50
example();
51
51
```
52
52
53
53
## Api
54
54
55
-
*`about.read()` - Returns info about mocks-server/plugin-admin-api, such as current version.
56
-
*`settings.read()` - Returns current @mocks-server settings.
57
-
*`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.
58
-
*`behaviors.read()` - Returns collection of available behaviors.
59
-
*`behavior(behaviorName).read()` - Returns an specific behavior.
60
-
*`fixtures.read()` - Returns collection of available fixtures.
61
-
*`fixture(fixtureId).read()` - Returns an specific fixture.
62
-
*`alerts.read()` - Returns array of current alerts.
63
-
*`alert(alertId).read()` - Returns an specific alert.
55
+
*`readAbout()` - Returns info about the Admin API plugin, such as current version.
56
+
*`readSettings()` - Returns current Mocks Server settings.
57
+
*`updateSettings(settingsObject)` - Updates Mocks Server settings. A settings object has to be provided. Read the [Mocks Server configuration docs](https://www.mocks-server.org/docs/configuration-options) for further info.
58
+
*`readAlerts()` - Returns array of current alerts.
59
+
*`readAlert(alertId)` - Returns an specific alert.
60
+
*`readMocks()` - Returns available mocks.
61
+
*`readMock(id)` - Returns data of a specific mock.
62
+
*`readRoutes()` - Returns available routes.
63
+
*`readRoute(id)` - Returns data of a specific route.
64
+
*`readRoutesVariants()` - Returns available routes variants.
65
+
*`readRouteVariant(id)` - Returns data of a specific route variant.
66
+
*`readCustomRoutesVariants()` - Returns current routes variants manually added to current mock.
67
+
*`useRouteVariant(id)` - Sets a specific route variant to be used by current mock.
68
+
*`restoreRoutesVariants()` - Restore routes variants to those defined in current mock.
69
+
70
+
##### Legacy methods
71
+
72
+
*`readBehaviors()` - Returns collection of available behaviors.
73
+
*`readBehavior(behaviorName)` - Returns an specific behavior.
74
+
*`readFixtures()` - Returns collection of available fixtures.
75
+
*`readFixture(fixtureId)` - Returns an specific fixture.
64
76
65
77
## Configuration
66
78
67
-
By default, the client is configured to request to http://localhost:3100/admin, based in the [default options of @mocks-server](https://www.mocks-server.org/docs/configuration-options)
79
+
By default, the client is configured to request to `http://localhost:3100/admin`, based in the [default options of Mocks Server](https://www.mocks-server.org/docs/configuration-options)
68
80
69
-
You can change both the base url of the "@mocks-server", and the base api path of the "@mocks-server/plugin-admin-api" using the `config` method:
81
+
You can change both the base url of Mocks Server, and the path of the [Admin API plugin][plugin-admin-api-url] using the `config` method:
0 commit comments