Skip to content

Commit ec718b5

Browse files
chore(build): update dependencies and documentation
1 parent af456a1 commit ec718b5

File tree

6 files changed

+1658
-540
lines changed

6 files changed

+1658
-540
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/docs
21
/build
32
/.idea
43
/node_modules

README.md

Lines changed: 20 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## @conjoon/extjs-dev-webmailsim ![MIT](https://img.shields.io/npm/l/@conjoon/extjs-dev-webmailsim) [![npm version](https://badge.fury.io/js/@conjoon%2Fextjs-dev-webmailsim.svg)](https://badge.fury.io/js/@conjoon%2Fextjs-dev-webmailsim)
22

3-
This Sencha ExtJS NPM package contains mock data for development of [conjoon/extjs-app-webmail](https://github.com/conjoon/extjs-app-webmail).
4-
When using this package, all backend requests of `extjs-app-webmail` will be replaced with mocks.
3+
This Sencha Ext JS NPM package contains mock data for development of [conjoon/extjs-app-webmail](https://github.com/conjoon/extjs-app-webmail).
4+
When using this package, configured urls will be intercepted and static data is returned in
5+
the responses.
56

67
## Installation
78
```bash
@@ -18,11 +19,9 @@ Testing environment will then be available via
1819
$ npm test
1920
```
2021

21-
For using the package as an external dependency in an application, use
22-
```bash
23-
$ npm install --save-prod @conjoon/extjs-dev-webmailsim
24-
```
25-
In your `app.json`, add this package as a requirement, and make sure your ExtJS `workspace.json`
22+
For using the package as an external dependency in an application:
23+
<br>
24+
In your `app.json`, add this package as a requirement, and make sure your Ext JS `workspace.json`
2625
is properly configured to look up local repositories in the `node_modules`-directory.
2726

2827
Example (`workspace.json`) :
@@ -34,58 +33,32 @@ Example (`workspace.json`) :
3433
}
3534
}
3635
```
37-
38-
## Configuration options
39-
40-
In order to properly intercept outgoing requests to the services as described in [rest-api-mail](https://github.com/conjoon/rest-api-description),,
41-
the package needs to be configured with a regular expression representing the urls to catch.
42-
The package is pre-configured so that it catches urls in the form of `https://php-ms-imapuser.ddev.site/rest-api-email/api/v0/*`.
43-
44-
If this package is used in your development or production environment, intercepting urls can be enabled/disabled by changing
45-
the property `enabled` of each url to either `true` or `false`.
46-
<br>Network latency for the mocked requests can be mimicked with the `delay`-option (in milliseconds).
47-
48-
49-
- `attachment.url`
50-
- `attachment.enabled`
51-
- `attachment.delay`
52-
<br><br>
53-
- `messageItem.url`
54-
- `messageItem.enabled`
55-
- `messageItem.delay`
56-
<br><br>
57-
- `mailFolder.url`
58-
- `mailFolder.enabled`
59-
- `mailFolder.delay`
60-
<br><br>
61-
- `mailAccount.url`
62-
- `mailAccount.enabled`
63-
- `mailAccount.delay`
64-
<br><br>
65-
- `sendMessage.url`
66-
- `sendMessage.enabled`
67-
- `sendMessage.delay`
68-
69-
## Usage
70-
Simply update the app.json of the **conjoon**-application
71-
by specifying this package in the `uses`-property in either the `development` and/or `prodution` section:
36+
Update the `app.json` of the application by specifying this package in the `uses`-property in
37+
either the `development` and/or `prodution` section:
7238

7339
*Example:*
7440
```json
7541
{
7642
"development": {
7743
"uses": [
78-
"extjs-app-webmail",
44+
"extjs-dev-imapusersim",
7945
"extjs-app-imapuser",
80-
"extjs-dev-webmailsim",
81-
"extjs-dev-imapusersim"
46+
"extjs-app-webmail",
47+
"extjs-dev-webmailsim"
8248
]
8349
},
8450
"production": {
8551
"uses": [
86-
"extjs-app-webmail",
87-
"extjs-app-imapuser"
52+
"extjs-app-imapuser",
53+
"extjs-app-webmail"
8854
]
8955
}
9056
}
9157
```
58+
59+
60+
## Configuration and Usage
61+
For more information on how to configure and use the package, refer to the [documentation](./docs/README.md).
62+
63+
## Tests
64+
Tests are written with [Siesta](https://bryntum.com/siesta). Documentation can be found [here](./tests/README.md).

docs/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# @conjoon/extjs-dev-webmailsim Documentation
2+
3+
**extjs-dev-webmailsim** is a **coon.js** package and is tagged as such in the
4+
`package.json`:
5+
6+
```json
7+
{
8+
"coon-js": {
9+
"package": {
10+
"autoLoad": {
11+
"registerController": true
12+
},
13+
"config" : "${package.resourcePath}/extjs-dev-webmailsim.conf.json"
14+
}
15+
}
16+
}
17+
```
18+
19+
By default, this package's configuration can be found in this package's `resources` folder
20+
in a file named `extjs-dev-webmailsim.conf.json`.
21+
22+
## What goes into a `extjs-dev-webmailsim` configuration?
23+
24+
The package intercepts outgoing network requests to all urls matching a specific
25+
url-pattern. Additionally, you can configure whether the package's url intercepting should
26+
be enabled or disabled - this makes it easier to use this package in environments where
27+
you have to test for fully functional network behavior with real HTTP-requests and live- and mock-data should be used side-by-side.
28+
29+
The configuration file for this package has various entries representing entities and their endpoints:
30+
`mailAccount`, `mailFolder`, `messageItem` and `attachment`:
31+
32+
```json
33+
{
34+
"attachment": {
35+
"url": "https://ddev-ms-email.ddev.site/rest-api-email/api/v.*?/MailAccounts/(.+)/MailFolders/(.+)/MessageItems/(.+)/Attachments(/.*)?",
36+
"enabled": true,
37+
"delay": 250
38+
},
39+
"messageItem": {
40+
"url": "https://ddev-ms-email.ddev.site/rest-api-email/api/v.*?/MailAccounts/(.+)/MailFolders/(.+)/MessageItems(/.*)?",
41+
"enabled": true,
42+
"delay": 250
43+
},
44+
"mailFolder": {
45+
"url": "https://ddev-ms-email.ddev.site/rest-api-email/api/v.*?/MailAccounts/(.+)/MailFolders(/.*)?",
46+
"enabled": true,
47+
"delay": 250
48+
},
49+
"mailAccount": {
50+
"url": "https://ddev-ms-email.ddev.site/rest-api-email/api/v.*?/MailAccounts(/d+)?",
51+
"enabled": true,
52+
"delay": 250
53+
}
54+
}
55+
```
56+
Each entry in the configuration can be configured with
57+
58+
- `url` - In order to properly intercept outgoing requests to the services as described in
59+
[rest-api-mail](https://github.com/conjoon/rest-api-description), the package needs
60+
to be configured with various regular expressions representing urls to catch.
61+
The package is pre-configured. For example, HTTP-requests to the following URLs are intercepted by this package:
62+
- `https://dev-ms-email.ddev.site/rest-api-email/api/v0/MailAccounts`
63+
- `https://dev-ms-email.ddev.site/rest-api-email/api/v1/MailAccounts/dev/MailFolders/INBOX.Sent/MessageItems/123`
64+
65+
- `enabled` - If this package is used with your development or production environment, intercepting urls can be enabled/disabled by changing the property `enabled`
66+
to either `true` or `false`.
67+
- `delay` - the delay in milliseconds to mimic network latency
68+
69+
### Order of matching URLs
70+
The Simmanager will consider url-matching in the order the urls are configured.
71+
Make sure more specific regular expressions are defined first, followed by more common ones.
72+
73+
For example, the url `https://dev-ms-email.ddev.site/rest-api-email/api/v1/MailAccounts/dev/MailFolders/INBOX.Sent/MessageItems/123`
74+
would be intercepted by the regular expression defined with `mailFolder` (because it is defined _at first_), although it should be intercepted by `messageItem`:
75+
76+
```json
77+
{
78+
"mailFolder": {
79+
"url": "https://ddev-ms-email.ddev.site/rest-api-email/api/v.*?/MailAccounts/(.+)/MailFolders(/.*)?",
80+
"enabled": true,
81+
"delay": 250
82+
},
83+
"messageItem": {
84+
"url": "https://ddev-ms-email.ddev.site/rest-api-email/api/v.*?/MailAccounts/(.+)/MailFolders/(.+)/MessageItems(/.*)?",
85+
"enabled": true,
86+
"delay": 250
87+
}
88+
}
89+
```
90+
91+
## Response Data
92+
If a request was intercepted, static data is returned to mimic responses of backends
93+
implementing the [REST API](https://github.com/conjoon/rest-api-description). The data returned
94+
can be edited in this package's `src/data/table/MessageTable.js` and `src/data/table/AttachmentTable.js`.

0 commit comments

Comments
 (0)