@lowdefy/api 4.0.0-alpha.4 → 4.0.0-alpha.5
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.
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import createReadConfigFile from './readConfigFile.js';
|
|
16
|
-
async function createApiContext({ buildDirectory , connections , logger , secrets }) {
|
|
16
|
+
async function createApiContext({ buildDirectory , connections , logger , operators , secrets }) {
|
|
17
17
|
const readConfigFile = createReadConfigFile({
|
|
18
18
|
buildDirectory
|
|
19
19
|
});
|
|
@@ -25,6 +25,7 @@ async function createApiContext({ buildDirectory , connections , logger , secret
|
|
|
25
25
|
config,
|
|
26
26
|
connections,
|
|
27
27
|
logger,
|
|
28
|
+
operators,
|
|
28
29
|
readConfigFile,
|
|
29
30
|
secrets
|
|
30
31
|
};
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
15
|
+
*/ // TODO: strip auth prop from page before we send it to the client
|
|
16
|
+
async function getPageConfig({ authorize , readConfigFile }, { pageId }) {
|
|
16
17
|
const pageConfig = await readConfigFile(`pages/${pageId}/${pageId}.json`);
|
|
17
18
|
if (pageConfig && authorize(pageConfig)) return pageConfig;
|
|
18
19
|
return null;
|
|
@@ -12,40 +12,35 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// if (requestErrors.length > 0) {
|
|
36
|
-
// throw new RequestError(requestErrors[0]);
|
|
37
|
-
// }
|
|
38
|
-
// return {
|
|
39
|
-
// connectionProperties,
|
|
40
|
-
// requestProperties,
|
|
41
|
-
// };
|
|
42
|
-
// }
|
|
43
|
-
async function evaluateOperators({ secrets , user }, { connectionConfig , payload , requestConfig }) {
|
|
44
|
-
return {
|
|
45
|
-
connectionProperties: connectionConfig.properties || {
|
|
15
|
+
*/ import { NodeParser } from '@lowdefy/operators';
|
|
16
|
+
import { RequestError } from '../../context/errors.js';
|
|
17
|
+
async function evaluateOperators({ operators , secrets , user }, { connectionConfig , payload , requestConfig }) {
|
|
18
|
+
const operatorsParser = new NodeParser({
|
|
19
|
+
operators,
|
|
20
|
+
payload,
|
|
21
|
+
secrets,
|
|
22
|
+
user
|
|
23
|
+
});
|
|
24
|
+
await operatorsParser.init();
|
|
25
|
+
const { output: connectionProperties , errors: connectionErrors } = operatorsParser.parse({
|
|
26
|
+
input: connectionConfig.properties || {
|
|
27
|
+
},
|
|
28
|
+
location: connectionConfig.connectionId
|
|
29
|
+
});
|
|
30
|
+
if (connectionErrors.length > 0) {
|
|
31
|
+
throw new RequestError(connectionErrors[0]);
|
|
32
|
+
}
|
|
33
|
+
const { output: requestProperties , errors: requestErrors } = operatorsParser.parse({
|
|
34
|
+
input: requestConfig.properties || {
|
|
46
35
|
},
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
location: requestConfig.requestId
|
|
37
|
+
});
|
|
38
|
+
if (requestErrors.length > 0) {
|
|
39
|
+
throw new RequestError(requestErrors[0]);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
connectionProperties,
|
|
43
|
+
requestProperties
|
|
49
44
|
};
|
|
50
45
|
}
|
|
51
46
|
export default evaluateOperators;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/api",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"licence": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"test": "jest --coverage"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@lowdefy/ajv": "4.0.0-alpha.
|
|
45
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
46
|
-
"@lowdefy/node-utils": "4.0.0-alpha.
|
|
47
|
-
"@lowdefy/nunjucks": "4.0.0-alpha.
|
|
48
|
-
"@lowdefy/operators": "4.0.0-alpha.
|
|
44
|
+
"@lowdefy/ajv": "4.0.0-alpha.5",
|
|
45
|
+
"@lowdefy/helpers": "4.0.0-alpha.5",
|
|
46
|
+
"@lowdefy/node-utils": "4.0.0-alpha.5",
|
|
47
|
+
"@lowdefy/nunjucks": "4.0.0-alpha.5",
|
|
48
|
+
"@lowdefy/operators": "4.0.0-alpha.5"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@swc/cli": "0.1.52",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "995fcdb020927f3cdc626fc99c15a2e4137bd962"
|
|
60
60
|
}
|