@lowdefy/api 4.0.0-alpha.6 → 4.0.0-alpha.9

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -12,10 +12,12 @@
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
- */ // TODO: strip auth prop from page before we send it to the client
16
- async function getPageConfig({ authorize , readConfigFile }, { pageId }) {
15
+ */ async function getPageConfig({ authorize , readConfigFile }, { pageId }) {
17
16
  const pageConfig = await readConfigFile(`pages/${pageId}/${pageId}.json`);
18
- if (pageConfig && authorize(pageConfig)) return pageConfig;
17
+ if (pageConfig && authorize(pageConfig)) {
18
+ delete pageConfig.auth;
19
+ return pageConfig;
20
+ }
19
21
  return null;
20
22
  }
21
23
  export default getPageConfig;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -50,7 +50,7 @@ async function callRequest(context, { pageId , payload , requestId }) {
50
50
  connection,
51
51
  requestConfig
52
52
  });
53
- const { connectionProperties , requestProperties } = await evaluateOperators(context, {
53
+ const { connectionProperties , requestProperties } = evaluateOperators(context, {
54
54
  connectionConfig,
55
55
  payload: serializer.deserialize(payload),
56
56
  requestConfig
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -14,14 +14,13 @@
14
14
  limitations under the License.
15
15
  */ import { NodeParser } from '@lowdefy/operators';
16
16
  import { RequestError } from '../../context/errors.js';
17
- async function evaluateOperators({ operators , secrets , user }, { connectionConfig , payload , requestConfig }) {
17
+ function evaluateOperators({ operators , secrets , user }, { connectionConfig , payload , requestConfig }) {
18
18
  const operatorsParser = new NodeParser({
19
19
  operators,
20
20
  payload,
21
21
  secrets,
22
22
  user
23
23
  });
24
- await operatorsParser.init();
25
24
  const { output: connectionProperties , errors: connectionErrors } = operatorsParser.parse({
26
25
  input: connectionConfig.properties || {},
27
26
  location: connectionConfig.connectionId
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2021 Lowdefy, Inc
2
+ Copyright 2020-2022 Lowdefy, Inc
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -18,6 +18,8 @@ function testContext({ config ={} , connections ={} , headers ={} , host ='host'
18
18
  error: ()=>{},
19
19
  info: ()=>{},
20
20
  warn: ()=>{}
21
+ } , operators ={
22
+ _test: ()=>'test'
21
23
  } , readConfigFile , roles , secrets ={} , setHeader , user , protocol ='https' , } = {}) {
22
24
  const authenticated = user && !!user.sub;
23
25
  return {
@@ -31,6 +33,7 @@ function testContext({ config ={} , connections ={} , headers ={} , host ='host'
31
33
  headers,
32
34
  host,
33
35
  logger,
36
+ operators,
34
37
  protocol,
35
38
  readConfigFile,
36
39
  secrets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/api",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.0.0-alpha.9",
4
4
  "licence": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -38,23 +38,25 @@
38
38
  "clean": "rm -rf dist",
39
39
  "prepare": "yarn build",
40
40
  "swc": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start",
41
- "test": "jest --coverage"
41
+ "test": "yarn node --experimental-vm-modules $(yarn bin jest)"
42
42
  },
43
43
  "dependencies": {
44
- "@lowdefy/ajv": "4.0.0-alpha.6",
45
- "@lowdefy/helpers": "4.0.0-alpha.6",
46
- "@lowdefy/node-utils": "4.0.0-alpha.6",
47
- "@lowdefy/nunjucks": "4.0.0-alpha.6",
48
- "@lowdefy/operators": "4.0.0-alpha.6"
44
+ "@lowdefy/ajv": "4.0.0-alpha.9",
45
+ "@lowdefy/helpers": "4.0.0-alpha.9",
46
+ "@lowdefy/node-utils": "4.0.0-alpha.9",
47
+ "@lowdefy/nunjucks": "4.0.0-alpha.9",
48
+ "@lowdefy/operators": "4.0.0-alpha.9"
49
49
  },
50
50
  "devDependencies": {
51
+ "@jest/globals": "27.5.1",
52
+ "@lowdefy/operators-js": "4.0.0-alpha.9",
51
53
  "@swc/cli": "0.1.55",
52
- "@swc/core": "1.2.130",
54
+ "@swc/core": "1.2.135",
53
55
  "@swc/jest": "0.2.17",
54
- "jest": "27.3.1"
56
+ "jest": "27.5.1"
55
57
  },
56
58
  "publishConfig": {
57
59
  "access": "public"
58
60
  },
59
- "gitHead": "2530e31af795b6a3c75ac8f72c8dbe0ab5d1251b"
61
+ "gitHead": "98b544eca231bdcfca6c3a8601a891835d5ce571"
60
62
  }