mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-04-12 15:40:30 +08:00
feat: Update aws and axios packages to use new plugin structure.
This commit is contained in:
parent
2da55b2534
commit
f20cfef49d
@ -12,5 +12,6 @@
|
||||
"type": "es6",
|
||||
"noInterop": true,
|
||||
"ignoreDynamic": true
|
||||
}
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
"src/packages/*",
|
||||
"src/packages/blocks/*",
|
||||
"src/packages/connections/*",
|
||||
"src/packages/plugins/**",
|
||||
"src/packages/servers/*"
|
||||
],
|
||||
"npmClient": "yarn",
|
||||
|
@ -26,6 +26,7 @@
|
||||
"packages/*",
|
||||
"packages/blocks/*",
|
||||
"packages/connections/*",
|
||||
"packages/plugins/**",
|
||||
"packages/servers/*"
|
||||
],
|
||||
"scripts": {
|
||||
|
@ -26,7 +26,10 @@
|
||||
"url": "https://github.com/lowdefy/lowdefy.git"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./dist/index.js",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./connections/*": "./dist/connections/*"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
@ -14,11 +14,12 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import schema from './AxiosHttpConnectionSchema.json';
|
||||
import AxiosHttp from './AxiosHttpRequest/AxiosHttpRequest.js';
|
||||
|
||||
export default {
|
||||
schema,
|
||||
import: {
|
||||
schema: 'connections/AxiosHttpConnectionSchema.json',
|
||||
},
|
||||
requests: {
|
||||
AxiosHttp,
|
||||
},
|
@ -16,8 +16,7 @@
|
||||
|
||||
import { validate } from '@lowdefy/ajv';
|
||||
import AxiosHttp from './AxiosHttpConnection.js';
|
||||
|
||||
const { schema } = AxiosHttp;
|
||||
import schema from './AxiosHttpConnectionSchema.json';
|
||||
|
||||
test('All requests are present', () => {
|
||||
expect(AxiosHttp.requests.AxiosHttp).toBeDefined();
|
@ -20,8 +20,6 @@ import https from 'https';
|
||||
import axios from 'axios';
|
||||
import { mergeObjects } from '@lowdefy/helpers';
|
||||
|
||||
import schema from '../AxiosHttpConnectionSchema.json';
|
||||
|
||||
async function axiosHttpRequest({ request, connection }) {
|
||||
try {
|
||||
const config = mergeObjects([connection, request]);
|
||||
@ -46,4 +44,4 @@ async function axiosHttpRequest({ request, connection }) {
|
||||
}
|
||||
}
|
||||
|
||||
export default { resolver: axiosHttpRequest, schema, checkRead: false, checkWrite: false };
|
||||
export default axiosHttpRequest;
|
@ -14,16 +14,17 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import AxiosHttpRequest from './AxiosHttpRequest.js';
|
||||
import axiosHttpRequest from './AxiosHttpRequest.js';
|
||||
import requestIndex from './index.js';
|
||||
|
||||
const { resolver } = AxiosHttpRequest;
|
||||
const { checkRead, checkWrite } = requestIndex.meta;
|
||||
|
||||
test('get default method,', async () => {
|
||||
const request = {
|
||||
url: 'https://postman-echo.com/get',
|
||||
};
|
||||
const connection = {};
|
||||
const res = await resolver({ request, connection });
|
||||
const res = await axiosHttpRequest({ request, connection });
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.statusText).toBe('OK');
|
||||
expect(res.method).toBe(undefined);
|
||||
@ -51,7 +52,7 @@ test('get specify method', async () => {
|
||||
method: 'get',
|
||||
};
|
||||
const connection = {};
|
||||
const res = await resolver({ request, connection });
|
||||
const res = await axiosHttpRequest({ request, connection });
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.statusText).toBe('OK');
|
||||
expect(res.method).toBe(undefined);
|
||||
@ -82,7 +83,7 @@ test('get with params', async () => {
|
||||
},
|
||||
};
|
||||
const connection = {};
|
||||
const res = await resolver({ request, connection });
|
||||
const res = await axiosHttpRequest({ request, connection });
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.statusText).toBe('OK');
|
||||
expect(res.method).toBe(undefined);
|
||||
@ -115,13 +116,13 @@ test('axios error', async () => {
|
||||
},
|
||||
};
|
||||
const connection = {};
|
||||
await expect(resolver({ request, connection })).rejects.toThrow(
|
||||
await expect(axiosHttpRequest({ request, connection })).rejects.toThrow(
|
||||
'Request failed with status code 404; Http response "404: Not Found"; Data: "".'
|
||||
);
|
||||
});
|
||||
|
||||
test('other error', async () => {
|
||||
await expect(resolver({ request: { url: true } })).rejects.toThrow(
|
||||
await expect(axiosHttpRequest({ request: { url: true } })).rejects.toThrow(
|
||||
'The "url" argument must be of type string. Received type boolean (true)'
|
||||
);
|
||||
});
|
||||
@ -132,7 +133,7 @@ test('https Agent options in request', async () => {
|
||||
httpsAgentOptions: { keepAlive: true },
|
||||
};
|
||||
const connection = {};
|
||||
const res = await resolver({ request, connection });
|
||||
const res = await axiosHttpRequest({ request, connection });
|
||||
expect(res.headers.connection).toEqual('keep-alive');
|
||||
});
|
||||
|
||||
@ -141,7 +142,7 @@ test('https Agent options in connection', async () => {
|
||||
url: 'https://postman-echo.com/get',
|
||||
};
|
||||
const connection = { httpsAgentOptions: { keepAlive: true } };
|
||||
const res = await resolver({ request, connection });
|
||||
const res = await axiosHttpRequest({ request, connection });
|
||||
expect(res.headers.connection).toEqual('keep-alive');
|
||||
});
|
||||
|
||||
@ -151,7 +152,7 @@ test('http Agent options in request', async () => {
|
||||
httpAgentOptions: { keepAlive: true },
|
||||
};
|
||||
const connection = {};
|
||||
const res = await resolver({ request, connection });
|
||||
const res = await axiosHttpRequest({ request, connection });
|
||||
expect(res.headers.connection).toEqual('keep-alive');
|
||||
});
|
||||
|
||||
@ -160,6 +161,14 @@ test('http Agent options in connection', async () => {
|
||||
url: 'http://postman-echo.com/get',
|
||||
};
|
||||
const connection = { httpAgentOptions: { keepAlive: true } };
|
||||
const res = await resolver({ request, connection });
|
||||
const res = await axiosHttpRequest({ request, connection });
|
||||
expect(res.headers.connection).toEqual('keep-alive');
|
||||
});
|
||||
|
||||
test('checkRead should be false', async () => {
|
||||
expect(checkRead).toBe(false);
|
||||
});
|
||||
|
||||
test('checkWrite should be false', async () => {
|
||||
expect(checkWrite).toBe(false);
|
||||
});
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2020-2021 Lowdefy, Inc
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
import: {
|
||||
path: 'connections/AxiosHttp/AxiosHttpRequest/AxiosHttpRequest.js',
|
||||
schema: 'connections/AxiosHttp/AxiosHttpConnectionSchema.json',
|
||||
},
|
||||
meta: {
|
||||
checkRead: false,
|
||||
checkWrite: false,
|
||||
},
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
import AxiosHttp from './AxiosHttp/AxiosHttpConnection.js';
|
||||
import AxiosHttp from './connections/AxiosHttp/AxiosHttpConnection.js';
|
||||
|
||||
export const connections = {
|
||||
AxiosHttp,
|
@ -26,7 +26,10 @@
|
||||
"url": "https://github.com/lowdefy/lowdefy.git"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./dist/index.js",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./*": "./dist/*"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
@ -26,7 +26,10 @@
|
||||
"url": "https://github.com/lowdefy/lowdefy.git"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./dist/index.js",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./*": "./dist/*"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
@ -26,7 +26,10 @@
|
||||
"url": "https://github.com/lowdefy/lowdefy.git"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./dist/index.js",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./*": "./dist/*"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
1
packages/plugins/connections/mongodb/globalConfig.json
Normal file
1
packages/plugins/connections/mongodb/globalConfig.json
Normal file
@ -0,0 +1 @@
|
||||
{"mongoUri":"mongodb://127.0.0.1:56526/"}
|
BIN
packages/plugins/connections/mongodb/mongod-arm64-darwin-4.0.25
Executable file
BIN
packages/plugins/connections/mongodb/mongod-arm64-darwin-4.0.25
Executable file
Binary file not shown.
@ -26,7 +26,10 @@
|
||||
"url": "https://github.com/lowdefy/lowdefy.git"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./dist/index.js",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./*": "./dist/*"
|
||||
},
|
||||
"files": [
|
||||
"dist/*"
|
||||
],
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user