mockaton 8.17.0 → 8.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -550,7 +550,7 @@ Defaults to `true`. When `true`, these are the default options:
550
550
  ```js
551
551
  config.corsOrigins = ['*']
552
552
  config.corsMethods = require('node:http').METHODS
553
- config.corsHeaders = ['content-type']
553
+ config.corsHeaders = ['content-type', 'authorization']
554
554
  config.corsCredentials = true
555
555
  config.corsMaxAge = 0 // seconds to cache the preflight req
556
556
  config.corsExposedHeaders = [] // headers you need to access in client-side JS
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mockaton",
3
3
  "description": "HTTP Mock Server",
4
4
  "type": "module",
5
- "version": "8.17.0",
5
+ "version": "8.18.0",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
8
8
  "license": "MIT",
package/src/Dashboard.css CHANGED
@@ -7,7 +7,6 @@
7
7
  :root {
8
8
  --color4xxBackground: #ffedd1;
9
9
  --colorAccent: #0068c1;
10
- --colorAccentAlt: #068185;
11
10
  --colorBackground: #fff;
12
11
  --colorComboBoxHeaderBackground: #fff;
13
12
  --colorComboBoxBackground: #eee;
@@ -126,12 +125,11 @@ header {
126
125
  align-items: flex-end;
127
126
  gap: 10px;
128
127
 
129
- @media (max-width: 860px) {
130
- max-width: 500px;
128
+ @media (max-width: 890px) {
129
+ max-width: 400px;
131
130
  }
132
131
  }
133
132
 
134
-
135
133
  img {
136
134
  width: 130px;
137
135
  align-self: center;
@@ -233,6 +231,21 @@ header {
233
231
  color: white;
234
232
  }
235
233
  }
234
+
235
+ .Help {
236
+ align-self: center;
237
+ margin-left: auto;
238
+ min-width: 24px;
239
+ fill: var(--colorSecondaryAction);
240
+
241
+ &:hover {
242
+ fill: var(--colorAccent);
243
+ }
244
+
245
+ @media (max-width: 590px) {
246
+ display: none;
247
+ }
248
+ }
236
249
  }
237
250
 
238
251
 
package/src/Dashboard.js CHANGED
@@ -43,6 +43,7 @@ const CSS = {
43
43
  FallbackBackend: 'FallbackBackend',
44
44
  Field: 'Field',
45
45
  GlobalDelayField: 'GlobalDelayField',
46
+ Help: 'Help',
46
47
  InternalServerErrorToggler: 'InternalServerErrorToggler',
47
48
  MainLeftSide: 'leftSide',
48
49
  MainRightSide: 'rightSide',
@@ -115,7 +116,13 @@ function Header({ cookies, comments, delay, fallbackAddress, collectProxied }) {
115
116
  r(BulkSelector, { comments }),
116
117
  r(GlobalDelayField, { delay }),
117
118
  r(ProxyFallbackField, { fallbackAddress, collectProxied }),
118
- r(ResetButton))))
119
+ r(ResetButton)),
120
+ r('a', {
121
+ className: CSS.Help,
122
+ href: 'https://github.com/ericfortis/mockaton',
123
+ target: '_blank',
124
+ rel: 'noopener noreferrer'
125
+ }, r(HelpIcon))))
119
126
  }
120
127
 
121
128
  function Logo() {
@@ -627,6 +634,11 @@ function CloudIcon() {
627
634
  s('path', { d: 'm6.1 9.1c2.8 0 5 2.3 5 5' })))
628
635
  }
629
636
 
637
+ function HelpIcon() {
638
+ return (
639
+ s('svg', { viewBox: '0 0 24 24' },
640
+ s('path', { d: 'M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4' })))
641
+ }
630
642
 
631
643
  /**
632
644
  * # Poll UI Sync Version
package/src/Filename.js CHANGED
@@ -47,10 +47,10 @@ function validateFilename(file) {
47
47
  export function parseFilename(file) {
48
48
  const tokens = file.replace(reComments, '').split('.')
49
49
  return {
50
- urlMask: '/' + removeTrailingSlash(tokens.slice(0, -3).join('.')),
51
- method: tokens.at(-3),
52
- status: Number(tokens.at(-2)),
53
- ext: tokens.at(-1)
50
+ ext: tokens.pop(),
51
+ status: Number(tokens.pop()),
52
+ method: tokens.pop(),
53
+ urlMask: '/' + removeTrailingSlash(tokens.join('.'))
54
54
  }
55
55
  }
56
56
 
package/src/config.js CHANGED
@@ -42,7 +42,7 @@ const schema = {
42
42
  corsAllowed: [true, is(Boolean)],
43
43
  corsOrigins: [['*'], validateCorsAllowedOrigins],
44
44
  corsMethods: [SUPPORTED_METHODS, validateCorsAllowedMethods],
45
- corsHeaders: [['content-type'], Array.isArray],
45
+ corsHeaders: [['content-type', 'authorization'], Array.isArray],
46
46
  corsExposedHeaders: [[], Array.isArray],
47
47
  corsCredentials: [true, is(Boolean)],
48
48
  corsMaxAge: [0, is(Number)],
@@ -61,7 +61,7 @@ for (const [k, [defaultVal, validator]] of Object.entries(schema)) {
61
61
  /** @type {Config} */
62
62
  export const config = Object.seal(defaults)
63
63
 
64
- /** @type {Record<keyof Config, (val: unknown) => boolean>} */
64
+ /** @type {Record<keyof Config, (val: unknown) => val is Config[keyof Config]>} */
65
65
  export const ConfigValidator = Object.freeze(validators)
66
66
 
67
67