@kaspernj/api-maker 1.0.176 → 1.0.183
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/.eslintrc.js +3 -1
- package/package.json +1 -1
- package/src/commands-pool.cjs +2 -2
- package/src/with-router.jsx +15 -11
package/.eslintrc.js
CHANGED
|
@@ -113,6 +113,7 @@ module.exports = {
|
|
|
113
113
|
"no-caller": "error",
|
|
114
114
|
"no-confusing-arrow": "error",
|
|
115
115
|
"no-constant-binary-expression": "error",
|
|
116
|
+
"no-constant-condition": "off",
|
|
116
117
|
"no-constructor-return": "error",
|
|
117
118
|
"no-continue": "error",
|
|
118
119
|
"no-div-regex": "error",
|
|
@@ -251,6 +252,7 @@ module.exports = {
|
|
|
251
252
|
"react/jsx-sort-props": "error",
|
|
252
253
|
"react/jsx-tag-spacing": "error",
|
|
253
254
|
"react/jsx-wrap-multilines": "error",
|
|
255
|
+
"react/jsx-max-props-per-line": "off",
|
|
254
256
|
"react/no-access-state-in-setstate": "error",
|
|
255
257
|
"react/no-adjacent-inline-elements": "error",
|
|
256
258
|
"react/no-array-index-key": "error",
|
|
@@ -292,7 +294,7 @@ module.exports = {
|
|
|
292
294
|
"sort-imports": "error",
|
|
293
295
|
"sort-vars": "error",
|
|
294
296
|
"space-before-blocks": "error",
|
|
295
|
-
"space-before-function-paren": "error",
|
|
297
|
+
"space-before-function-paren": ["error", "never"],
|
|
296
298
|
"space-in-parens": "error",
|
|
297
299
|
"space-infix-ops": "error",
|
|
298
300
|
"space-unary-ops": "error",
|
package/package.json
CHANGED
package/src/commands-pool.cjs
CHANGED
|
@@ -47,7 +47,7 @@ module.exports = class ApiMakerCommandsPool {
|
|
|
47
47
|
this.pool = {}
|
|
48
48
|
this.poolData = {}
|
|
49
49
|
this.currentId = 1
|
|
50
|
-
this.globalRequestData =
|
|
50
|
+
this.globalRequestData = {}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
addCommand (data) {
|
|
@@ -107,7 +107,7 @@ module.exports = class ApiMakerCommandsPool {
|
|
|
107
107
|
try {
|
|
108
108
|
const submitData = {pool: currentPoolData}
|
|
109
109
|
|
|
110
|
-
if (this.globalRequestData)
|
|
110
|
+
if (Object.keys(this.globalRequestData).length > 0)
|
|
111
111
|
submitData.global = this.globalRequestData
|
|
112
112
|
|
|
113
113
|
const commandSubmitData = new CommandSubmitData(submitData)
|
package/src/with-router.jsx
CHANGED
|
@@ -8,8 +8,8 @@ import shouldComponentUpdate from "set-state-compare/src/should-component-update
|
|
|
8
8
|
export default (WrapperComponent) => class WithRouter extends React.Component {
|
|
9
9
|
static propTypes = {
|
|
10
10
|
path: PropTypes.string,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
routeDefinitions: PropTypes.object,
|
|
12
|
+
routes: PropTypes.object
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
parsedRouteDefinitions = this.parseRouteDefinitions()
|
|
@@ -18,7 +18,7 @@ export default (WrapperComponent) => class WithRouter extends React.Component {
|
|
|
18
18
|
return shouldComponentUpdate(this, nextProps, nextState)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
findRouteParams
|
|
21
|
+
findRouteParams(routeDefinition) {
|
|
22
22
|
const result = []
|
|
23
23
|
const parts = routeDefinition.path.split("/")
|
|
24
24
|
|
|
@@ -33,13 +33,18 @@ export default (WrapperComponent) => class WithRouter extends React.Component {
|
|
|
33
33
|
path() {
|
|
34
34
|
let path = this.props.path || window.location.pathname
|
|
35
35
|
|
|
36
|
-
path = path.replace(/[
|
|
36
|
+
path = path.replace(/[/]+$/, "")
|
|
37
37
|
|
|
38
38
|
return path
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
routeDefinitions() {
|
|
42
|
-
|
|
41
|
+
routeDefinitions() {
|
|
42
|
+
return this.props.routeDefinitions || config.getRouteDefinitions()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
routes() {
|
|
46
|
+
return this.props.routes || config.getRoutes()
|
|
47
|
+
}
|
|
43
48
|
|
|
44
49
|
parseRouteDefinitions() {
|
|
45
50
|
const Locales = require("shared/locales").default
|
|
@@ -58,10 +63,9 @@ export default (WrapperComponent) => class WithRouter extends React.Component {
|
|
|
58
63
|
if (!(routePathName in routes))
|
|
59
64
|
throw new Error(`${routePathName} not found in routes: ${Object.keys(routes, ", ")}`)
|
|
60
65
|
|
|
61
|
-
const routePath = routes[routePathName](...params).replace(/[
|
|
66
|
+
const routePath = routes[routePathName](...params).replace(/[/]+$/, "")
|
|
62
67
|
const groups = []
|
|
63
|
-
|
|
64
|
-
let pathRegexString = '^'
|
|
68
|
+
let pathRegexString = "^"
|
|
65
69
|
|
|
66
70
|
pathRegexString += escapeStringRegexp(routePath)
|
|
67
71
|
|
|
@@ -74,10 +78,10 @@ export default (WrapperComponent) => class WithRouter extends React.Component {
|
|
|
74
78
|
|
|
75
79
|
groups.push(variableName)
|
|
76
80
|
|
|
77
|
-
pathRegexString = pathRegexString.replace(match[0],
|
|
81
|
+
pathRegexString = pathRegexString.replace(match[0], "([^/]+)")
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
pathRegexString +=
|
|
84
|
+
pathRegexString += "$"
|
|
81
85
|
|
|
82
86
|
const pathRegex = new RegExp(pathRegexString)
|
|
83
87
|
|