@saltcorn/server 0.9.0-beta.9 → 0.9.1-beta.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/auth/admin.js +2 -0
- package/auth/testhelp.js +13 -0
- package/help/API actions.tmd +12 -0
- package/locales/en.json +8 -1
- package/locales/es.json +1270 -273
- package/locales/fr.json +7 -1
- package/package.json +8 -8
- package/public/saltcorn-common.js +41 -11
- package/public/saltcorn.js +14 -0
- package/routes/actions.js +21 -7
- package/routes/api.js +2 -2
- package/routes/common_lists.js +11 -5
- package/routes/homepage.js +10 -4
- package/routes/page.js +1 -0
- package/routes/pageedit.js +10 -3
- package/routes/viewedit.js +2 -2
- package/tests/api.test.js +67 -0
- package/tests/viewedit.test.js +244 -1
- package/wrapper.js +6 -3
package/auth/admin.js
CHANGED
package/auth/testhelp.js
CHANGED
|
@@ -215,6 +215,18 @@ const succeedJsonWith = (pred) => (res) => {
|
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
|
|
218
|
+
const succeedJsonWithWholeBody = (pred) => (res) => {
|
|
219
|
+
if (res.statusCode !== 200) {
|
|
220
|
+
console.log(res.text);
|
|
221
|
+
throw new Error(`Expected status 200, received ${res.statusCode}`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (!pred(res.body)) {
|
|
225
|
+
console.log(res.body);
|
|
226
|
+
throw new Error(`Not satisfied`);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
218
230
|
/**
|
|
219
231
|
*
|
|
220
232
|
* @param {number} code
|
|
@@ -260,6 +272,7 @@ module.exports = {
|
|
|
260
272
|
notAuthorized,
|
|
261
273
|
respondJsonWith,
|
|
262
274
|
toSucceedWithImage,
|
|
275
|
+
succeedJsonWithWholeBody,
|
|
263
276
|
resToLoginCookie,
|
|
264
277
|
itShouldIncludeTextForAdmin,
|
|
265
278
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
This trigger can be run with by making an HTTP request to
|
|
2
|
+
|
|
3
|
+
{{scState.getConfig("base_url","").replace(/\/$/, "")}}/api/action/{{ query.name }}
|
|
4
|
+
|
|
5
|
+
If you make a POST request, the POST body is expected to be JSON and its value
|
|
6
|
+
is accessible using the `row` variable (e.g. in a `run_js_code`)
|
|
7
|
+
|
|
8
|
+
If you make a GET request, the query string values
|
|
9
|
+
are accessible as a JSON object using the `row` variable (e.g. in a `run_js_code`).
|
|
10
|
+
|
|
11
|
+
If you return a value from the action, it will be available in the `data`
|
|
12
|
+
subfield of the JSON body in the HTTP response
|
package/locales/en.json
CHANGED
|
@@ -1266,5 +1266,12 @@
|
|
|
1266
1266
|
"Initially open": "Initially open",
|
|
1267
1267
|
"Not a valid pack": "Not a valid pack",
|
|
1268
1268
|
"Pack file": "Pack file",
|
|
1269
|
-
"Upload a pack file": "Upload a pack file"
|
|
1269
|
+
"Upload a pack file": "Upload a pack file",
|
|
1270
|
+
"No menu": "No menu",
|
|
1271
|
+
"Omit the menu from this page": "Omit the menu from this page",
|
|
1272
|
+
"%s finished without a result": "%s finished without a result",
|
|
1273
|
+
"Body size limit (Kb)": "Body size limit (Kb)",
|
|
1274
|
+
"Maximum request body size in kilobytes": "Maximum request body size in kilobytes",
|
|
1275
|
+
"URL encoded size limit (Kb)": "URL encoded size limit (Kb)",
|
|
1276
|
+
"Maximum URL encoded request size in kilobytes": "Maximum URL encoded request size in kilobytes"
|
|
1270
1277
|
}
|