mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-03-19 15:01:06 +08:00
Merge branch 'develop' into build-docs
This commit is contained in:
commit
244b70bfc5
37
.github/workflows/test-pulls.yml
vendored
37
.github/workflows/test-pulls.yml
vendored
@ -16,41 +16,10 @@ jobs:
|
||||
- name: yarn install
|
||||
run: yarn install
|
||||
- name: Build packages
|
||||
run: yarn build --ignore='@lowdefy/blocks-*'
|
||||
run: yarn build
|
||||
|
||||
# format tests don't pass on node 12 since icu is missing and tests don't work with locales
|
||||
- name: Test packages
|
||||
run: yarn test --ignore='@lowdefy/format' --ignore='@lowdefy/blocks-*'
|
||||
|
||||
- name: Upload coverage to codecov
|
||||
run: bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- name: Upload coverage to codeclimate
|
||||
uses: paambaati/codeclimate-action@v2.7.5
|
||||
env:
|
||||
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
|
||||
with:
|
||||
coverageLocations: |
|
||||
${{github.workspace}}/packages/**/coverage/lcov.info:lcov
|
||||
continue-on-error: true
|
||||
|
||||
test-blocks:
|
||||
name: Test blocks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- uses: actions/checkout@v2
|
||||
- name: yarn install
|
||||
run: yarn install
|
||||
- name: Build packages
|
||||
run: yarn build --ignore='@lowdefy/api' --ignore='@lowdefy/build' --ignore='@lowdefy/cli' --ignore='@lowdefy/client' --ignore='@lowdefy/engine' --ignore='@lowdefy/layout' --ignore='@lowdefy/node-utils' --ignore='@lowdefy/operators' --ignore='@lowdefy/server*'
|
||||
|
||||
# format tests don't pass on node 12 since icu is missing and tests don't work with locales
|
||||
- name: Test packages
|
||||
run: yarn test --scope='@lowdefy/blocks-*'
|
||||
run: yarn test --ignore='@lowdefy/engine' --ignore='@lowdefy/blocks-*' --ignore='@lowdefy/plugin-aws'
|
||||
|
||||
- name: Upload coverage to codecov
|
||||
run: bash <(curl -s https://codecov.io/bash)
|
||||
@ -71,7 +40,7 @@ jobs:
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12.x'
|
||||
node-version: '14.x'
|
||||
- uses: actions/checkout@v2
|
||||
- name: Check yarn cache integrity
|
||||
run: yarn install --immutable --immutable-cache --check-cache
|
||||
|
41
.pnp.cjs
generated
41
.pnp.cjs
generated
@ -2810,7 +2810,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
["@swc/cli", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.1.55"],
|
||||
["@swc/core", "npm:1.2.135"],
|
||||
["@swc/jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.2.17"],
|
||||
["jest", "virtual:42e288f3c714e1d86d12bf40fb17a72864641a713e0a167e85a3dab47534d11bcd2e71357e431b2f4737000bc9432f95c60dff0c9bfb212cd46e1f0f5bf0ad9f#npm:27.4.7"]
|
||||
["jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:27.5.1"]
|
||||
],
|
||||
"linkType": "SOFT",
|
||||
}]
|
||||
@ -3511,12 +3511,26 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
"packageLocation": "./packages/plugins/plugins/plugin-aws/",
|
||||
"packageDependencies": [
|
||||
["@lowdefy/plugin-aws", "workspace:packages/plugins/plugins/plugin-aws"],
|
||||
["@emotion/jest", "virtual:573fe255dffc9c89f4f7aa60da718603753ee98acc55d6772bbd0ebdcf07f9183fb8e54b4f3f2246c538a14ead402db8d2e076039c667d1538702638a0cc87b8#npm:11.7.1"],
|
||||
["@lowdefy/ajv", "workspace:packages/utils/ajv"],
|
||||
["@lowdefy/block-dev", "workspace:packages/utils/block-dev"],
|
||||
["@lowdefy/block-utils", "workspace:packages/utils/block-utils"],
|
||||
["@lowdefy/blocks-antd", "workspace:packages/plugins/blocks/blocks-antd"],
|
||||
["@lowdefy/helpers", "workspace:packages/utils/helpers"],
|
||||
["@swc/cli", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.1.55"],
|
||||
["@swc/core", "npm:1.2.135"],
|
||||
["@swc/jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:0.2.17"],
|
||||
["@testing-library/dom", "npm:8.11.3"],
|
||||
["@testing-library/react", "virtual:573fe255dffc9c89f4f7aa60da718603753ee98acc55d6772bbd0ebdcf07f9183fb8e54b4f3f2246c538a14ead402db8d2e076039c667d1538702638a0cc87b8#npm:13.0.0-alpha.4"],
|
||||
["@testing-library/user-event", "virtual:573fe255dffc9c89f4f7aa60da718603753ee98acc55d6772bbd0ebdcf07f9183fb8e54b4f3f2246c538a14ead402db8d2e076039c667d1538702638a0cc87b8#npm:14.0.0-alpha.14"],
|
||||
["antd", "virtual:f494f6d4e058cb1c8a3b456f6099aff9bd740d65abfc014377b7a3f1e34fcb35eb64a962e127c8bfbedaa0555175b6f2cdc47011e32e2fb5f081d7d32f526c78#npm:4.17.0-alpha.7"],
|
||||
["aws-sdk", "npm:2.1066.0"],
|
||||
["jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:27.5.1"]
|
||||
["copyfiles", "npm:2.4.1"],
|
||||
["jest", "virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:27.5.1"],
|
||||
["jest-serializer-html", "npm:7.1.0"],
|
||||
["jest-transform-yaml", "npm:1.0.0"],
|
||||
["react", "npm:18.0.0-rc.0"],
|
||||
["react-dom", "virtual:573fe255dffc9c89f4f7aa60da718603753ee98acc55d6772bbd0ebdcf07f9183fb8e54b4f3f2246c538a14ead402db8d2e076039c667d1538702638a0cc87b8#npm:18.0.0-rc.0"]
|
||||
],
|
||||
"linkType": "SOFT",
|
||||
}]
|
||||
@ -10506,13 +10520,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
}]
|
||||
]],
|
||||
["jest", [
|
||||
["npm:27.4.7", {
|
||||
"packageLocation": "./.yarn/cache/jest-npm-27.4.7-cdda9da561-28ce948b30.zip/node_modules/jest/",
|
||||
"packageDependencies": [
|
||||
["jest", "npm:27.4.7"]
|
||||
],
|
||||
"linkType": "SOFT",
|
||||
}],
|
||||
["npm:27.5.1", {
|
||||
"packageLocation": "./.yarn/cache/jest-npm-27.5.1-bacad4fe2a-96f1d69042.zip/node_modules/jest/",
|
||||
"packageDependencies": [
|
||||
@ -10520,22 +10527,6 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
],
|
||||
"linkType": "SOFT",
|
||||
}],
|
||||
["virtual:42e288f3c714e1d86d12bf40fb17a72864641a713e0a167e85a3dab47534d11bcd2e71357e431b2f4737000bc9432f95c60dff0c9bfb212cd46e1f0f5bf0ad9f#npm:27.4.7", {
|
||||
"packageLocation": "./.yarn/__virtual__/jest-virtual-4325f46d83/0/cache/jest-npm-27.4.7-cdda9da561-28ce948b30.zip/node_modules/jest/",
|
||||
"packageDependencies": [
|
||||
["jest", "virtual:42e288f3c714e1d86d12bf40fb17a72864641a713e0a167e85a3dab47534d11bcd2e71357e431b2f4737000bc9432f95c60dff0c9bfb212cd46e1f0f5bf0ad9f#npm:27.4.7"],
|
||||
["@jest/core", "virtual:af105d7a2bc799821f67e8114057f53830abc6c7c9faa96846247605351f361b4158d347970d00ebc3c04dbab6e46e1c1e24df193c1caf1f7d80a00c65068a2a#npm:27.5.1"],
|
||||
["@types/node-notifier", null],
|
||||
["import-local", "npm:3.1.0"],
|
||||
["jest-cli", "virtual:af105d7a2bc799821f67e8114057f53830abc6c7c9faa96846247605351f361b4158d347970d00ebc3c04dbab6e46e1c1e24df193c1caf1f7d80a00c65068a2a#npm:27.5.1"],
|
||||
["node-notifier", null]
|
||||
],
|
||||
"packagePeers": [
|
||||
"@types/node-notifier",
|
||||
"node-notifier"
|
||||
],
|
||||
"linkType": "HARD",
|
||||
}],
|
||||
["virtual:babee6e81435a5d101529cd67f2c6b175f4db37a4ab0b58df15adf73dd11be8917ac14caf44ab4e6882a92c61661055072365b349016e85173e049f006fc2305#npm:27.5.1", {
|
||||
"packageLocation": "./.yarn/__virtual__/jest-virtual-af105d7a2b/0/cache/jest-npm-27.5.1-bacad4fe2a-96f1d69042.zip/node_modules/jest/",
|
||||
"packageDependencies": [
|
||||
|
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
@ -4,7 +4,7 @@ export default {
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
|
@ -4,7 +4,7 @@ export default {
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
|
@ -4,7 +4,7 @@ export default {
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
|
@ -4,7 +4,7 @@ export default {
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
|
@ -4,7 +4,7 @@ export default {
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
|
@ -4,7 +4,7 @@ export default {
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
|
@ -23,8 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['AxiosHttp'],
|
||||
// requests: ['AxiosHttp'],
|
||||
// };
|
||||
|
@ -23,15 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['Elasticsearch'],
|
||||
// requests: [
|
||||
// ElasticsearchDelete,
|
||||
// ElasticsearchDeleteByQuery,
|
||||
// ElasticsearchIndex,
|
||||
// ElasticsearchSearch,
|
||||
// ElasticsearchUpdate,
|
||||
// ElasticsearchUpdateByQuery,
|
||||
// ],
|
||||
// };
|
||||
|
@ -23,16 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['GoogleSheet'],
|
||||
// requests: [
|
||||
// GoogleSheetAppendMany,
|
||||
// GoogleSheetAppendOne,
|
||||
// GoogleSheetDeleteOne,
|
||||
// GoogleSheetGetMany,
|
||||
// GoogleSheetGetOne,
|
||||
// GoogleSheetUpdateOne,
|
||||
// GoogleSheetUpdateMany,
|
||||
// ],
|
||||
// };
|
||||
|
@ -22,8 +22,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['Knex'],
|
||||
// requests: ['KnexBuilder', 'KnexRaw'],
|
||||
// };
|
||||
|
@ -23,18 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['MongoDBCollection'],
|
||||
// requests: [
|
||||
// MongoDBAggregation,
|
||||
// MongoDBDeleteMany,
|
||||
// MongoDBDeleteOne,
|
||||
// MongoDBFind,
|
||||
// MongoDBFindOne,
|
||||
// MongoDBInsertMany,
|
||||
// MongoDBInsertOne,
|
||||
// MongoDBUpdateMany,
|
||||
// MongoDBUpdateOne,
|
||||
// ],
|
||||
// };
|
||||
|
@ -23,8 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['Redis'],
|
||||
// requests: ['Redis'],
|
||||
// };
|
||||
|
@ -23,8 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['SendGridMail'],
|
||||
// requests: ['SendGridMailSend'],
|
||||
// };
|
||||
|
@ -23,8 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['Stripe'],
|
||||
// requests: ['StripeRequest'],
|
||||
// };
|
||||
|
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
14
packages/plugins/operators/operators-mql/jest.config.js
Normal file
14
packages/plugins/operators/operators-mql/jest.config.js
Normal file
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
14
packages/plugins/operators/operators-nunjucks/jest.config.js
Normal file
14
packages/plugins/operators/operators-nunjucks/jest.config.js
Normal file
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
14
packages/plugins/operators/operators-uuid/jest.config.js
Normal file
14
packages/plugins/operators/operators-uuid/jest.config.js
Normal file
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
14
packages/plugins/operators/operators-yaml/jest.config.js
Normal file
14
packages/plugins/operators/operators-yaml/jest.config.js
Normal file
@ -0,0 +1,14 @@
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
coverageDirectory: 'coverage',
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/test'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
},
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['src/**/*.js'],
|
||||
@ -6,9 +6,11 @@ module.exports = {
|
||||
coveragePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/src/index.js'],
|
||||
coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'],
|
||||
errorOnDeprecated: true,
|
||||
testEnvironment: 'node',
|
||||
testEnvironment: 'jsdom',
|
||||
testPathIgnorePatterns: ['<rootDir>/dist/'],
|
||||
transform: {
|
||||
'^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }],
|
||||
'\\.yaml$': 'jest-transform-yaml',
|
||||
},
|
||||
snapshotSerializers: ['@emotion/jest/serializer', 'jest-serializer-html'],
|
||||
};
|
@ -36,19 +36,34 @@
|
||||
"scripts": {
|
||||
"build": "yarn swc",
|
||||
"clean": "rm -rf dist",
|
||||
"copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
|
||||
"prepare": "yarn build",
|
||||
"swc": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
|
||||
"swc": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start && yarn copyfiles",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"aws-sdk": "2.1066.0"
|
||||
"@lowdefy/block-utils": "4.0.0-alpha.6",
|
||||
"@lowdefy/blocks-antd": "4.0.0-alpha.6",
|
||||
"@lowdefy/helpers": "4.0.0-alpha.6",
|
||||
"antd": "4.17.0-alpha.7",
|
||||
"aws-sdk": "2.1066.0",
|
||||
"react": "18.0.0-rc.0",
|
||||
"react-dom": "18.0.0-rc.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@emotion/jest": "11.7.1",
|
||||
"@lowdefy/ajv": "4.0.0-alpha.6",
|
||||
"@lowdefy/block-dev": "4.0.0-alpha.6",
|
||||
"@swc/cli": "0.1.55",
|
||||
"@swc/core": "1.2.135",
|
||||
"@swc/jest": "0.2.17",
|
||||
"jest": "27.5.1"
|
||||
"@testing-library/dom": "8.11.3",
|
||||
"@testing-library/react": "13.0.0-alpha.4",
|
||||
"@testing-library/user-event": "14.0.0-alpha.14",
|
||||
"copyfiles": "2.4.1",
|
||||
"jest": "27.5.1",
|
||||
"jest-serializer-html": "7.1.0",
|
||||
"jest-transform-yaml": "1.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@ -17,9 +17,9 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { blockDefaultProps } from '@lowdefy/block-utils';
|
||||
import { get } from '@lowdefy/helpers';
|
||||
import { Upload } from 'antd';
|
||||
import { Button } from '@lowdefy/blocks-antd/blocks';
|
||||
|
||||
import Button from '../Button/Button.js';
|
||||
import { Upload } from 'antd';
|
||||
|
||||
const makeFileValue = (file, s3Parameters) => {
|
||||
const { lastModified, name, percent, size, status, type, uid } = file;
|
||||
|
@ -14,13 +14,12 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import AwsS3PresignedGetObject from './AwsS3PresignedGetObject/index.js';
|
||||
import AwsS3PresignedPostPolicy from './AwsS3PresignedPostPolicy/index.js';
|
||||
import AwsS3PresignedGetObject from './AwsS3PresignedGetObject/AwsS3PresignedGetObject.js';
|
||||
import AwsS3PresignedPostPolicy from './AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js';
|
||||
import schema from './schema.js';
|
||||
|
||||
export default {
|
||||
import: {
|
||||
schema: 'connections/AwsS3Bucket/AwsS3BucketSchema.json',
|
||||
},
|
||||
schema,
|
||||
requests: {
|
||||
AwsS3PresignedGetObject,
|
||||
AwsS3PresignedPostPolicy,
|
||||
|
@ -17,7 +17,8 @@
|
||||
import { validate } from '@lowdefy/ajv';
|
||||
|
||||
import AwsS3Bucket from './AwsS3Bucket.js';
|
||||
import schema from './AwsS3BucketSchema.json';
|
||||
|
||||
const schema = AwsS3Bucket.schema;
|
||||
|
||||
test('All requests are present', () => {
|
||||
expect(AwsS3Bucket.requests.AwsS3PresignedGetObject).toBeDefined();
|
||||
|
@ -1,61 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Lowdefy Connection Schema - AwsS3Bucket",
|
||||
"type": "object",
|
||||
"required": ["accessKeyId", "secretAccessKey", "region", "bucket"],
|
||||
"properties": {
|
||||
"accessKeyId": {
|
||||
"type": "string",
|
||||
"description": "AWS IAM access key id with s3 access.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3Bucket connection property \"accessKeyId\" should be a string."
|
||||
}
|
||||
},
|
||||
"secretAccessKey": {
|
||||
"type": "string",
|
||||
"description": "AWS IAM secret access key with s3 access.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3Bucket connection property \"secretAccessKey\" should be a string."
|
||||
}
|
||||
},
|
||||
"region": {
|
||||
"type": "string",
|
||||
"description": "AWS region the bucket is located in.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3Bucket connection property \"region\" should be a string."
|
||||
}
|
||||
},
|
||||
"bucket": {
|
||||
"type": "string",
|
||||
"description": "S3 bucket name.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3Bucket connection property \"bucket\" should be a string."
|
||||
}
|
||||
},
|
||||
"read": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "Allow reads from the bucket.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3Bucket connection property \"read\" should be a boolean."
|
||||
}
|
||||
},
|
||||
"write": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Allow writes to the bucket.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3Bucket connection property \"write\" should be a boolean."
|
||||
}
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "AwsS3Bucket connection properties should be an object.",
|
||||
"required": {
|
||||
"accessKeyId": "AwsS3Bucket connection should have required property \"accessKeyId\".",
|
||||
"secretAccessKey": "AwsS3Bucket connection should have required property \"secretAccessKey\".",
|
||||
"region": "AwsS3Bucket connection should have required property \"region\".",
|
||||
"bucket": "AwsS3Bucket connection should have required property \"bucket\"."
|
||||
}
|
||||
}
|
||||
}
|
@ -15,8 +15,9 @@
|
||||
*/
|
||||
|
||||
import AWS from 'aws-sdk';
|
||||
import schema from './schema.js';
|
||||
|
||||
function awsS3PresignedGetObject({ request, connection }) {
|
||||
function AwsS3PresignedGetObject({ request, connection }) {
|
||||
const { accessKeyId, secretAccessKey, region, bucket } = connection;
|
||||
const { expires, key, versionId, responseContentDisposition, responseContentType } = request;
|
||||
const params = {
|
||||
@ -31,4 +32,10 @@ function awsS3PresignedGetObject({ request, connection }) {
|
||||
return s3.getSignedUrl('getObject', params);
|
||||
}
|
||||
|
||||
export default awsS3PresignedGetObject;
|
||||
AwsS3PresignedGetObject.schema = schema;
|
||||
AwsS3PresignedGetObject.meta = {
|
||||
checkRead: true,
|
||||
checkWrite: false,
|
||||
};
|
||||
|
||||
export default AwsS3PresignedGetObject;
|
||||
|
@ -17,12 +17,13 @@
|
||||
import { validate } from '@lowdefy/ajv';
|
||||
import AWS from 'aws-sdk';
|
||||
|
||||
import awsS3PresignedGetObject from './AwsS3PresignedGetObject.js';
|
||||
import requestIndex from './index.js';
|
||||
import schema from './AwsS3PresignedGetObjectSchema.json';
|
||||
import AwsS3PresignedGetObject from './AwsS3PresignedGetObject.js';
|
||||
|
||||
jest.mock('aws-sdk');
|
||||
|
||||
const schema = AwsS3PresignedGetObject.schema;
|
||||
const { checkRead, checkWrite } = AwsS3PresignedGetObject.meta;
|
||||
|
||||
const mockGetSignedUrl = jest.fn();
|
||||
const getSignedUrlMockImp = () => 'res';
|
||||
const mockS3Constructor = jest.fn();
|
||||
@ -32,8 +33,6 @@ const s3ConstructorMockImp = () => ({
|
||||
|
||||
AWS.S3 = mockS3Constructor;
|
||||
|
||||
const { checkRead, checkWrite } = requestIndex.meta;
|
||||
|
||||
beforeEach(() => {
|
||||
mockGetSignedUrl.mockReset();
|
||||
mockS3Constructor.mockReset();
|
||||
@ -41,7 +40,7 @@ beforeEach(() => {
|
||||
mockS3Constructor.mockImplementation(s3ConstructorMockImp);
|
||||
});
|
||||
|
||||
test('awsS3PresignedGetObject', () => {
|
||||
test('AwsS3PresignedGetObject', () => {
|
||||
const request = { key: 'key' };
|
||||
const connection = {
|
||||
accessKeyId: 'accessKeyId',
|
||||
@ -50,7 +49,7 @@ test('awsS3PresignedGetObject', () => {
|
||||
write: true,
|
||||
bucket: 'bucket',
|
||||
};
|
||||
const res = awsS3PresignedGetObject({ request, connection });
|
||||
const res = AwsS3PresignedGetObject({ request, connection });
|
||||
expect(mockS3Constructor.mock.calls).toEqual([
|
||||
[
|
||||
{
|
||||
@ -73,7 +72,7 @@ test('awsS3PresignedGetObject', () => {
|
||||
expect(res).toEqual('res');
|
||||
});
|
||||
|
||||
test('awsS3PresignedGetObject options ', async () => {
|
||||
test('AwsS3PresignedGetObject options ', async () => {
|
||||
const request = {
|
||||
key: 'key',
|
||||
versionId: 'versionId',
|
||||
@ -87,7 +86,7 @@ test('awsS3PresignedGetObject options ', async () => {
|
||||
region: 'region',
|
||||
bucket: 'bucket',
|
||||
};
|
||||
const res = awsS3PresignedGetObject({ request, connection });
|
||||
const res = AwsS3PresignedGetObject({ request, connection });
|
||||
expect(mockS3Constructor.mock.calls).toEqual([
|
||||
[
|
||||
{
|
||||
@ -133,7 +132,7 @@ test('Error from s3 client', async () => {
|
||||
region: 'region',
|
||||
bucket: 'bucket',
|
||||
};
|
||||
await expect(() => awsS3PresignedGetObject({ request, connection })).toThrow(
|
||||
await expect(() => AwsS3PresignedGetObject({ request, connection })).toThrow(
|
||||
'Test S3 client error.'
|
||||
);
|
||||
});
|
||||
|
@ -1,48 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Lowdefy Request Schema - AwsS3PresignedGetObject",
|
||||
"type": "object",
|
||||
"required": ["key"],
|
||||
"properties": {
|
||||
"expires": {
|
||||
"type": "number",
|
||||
"description": "Number of seconds for which the policy should be valid.",
|
||||
"default": 3600,
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedGetObject request property \"expires\" should be a number."
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"description": "Key under which object is stored.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedGetObject request property \"key\" should be a string."
|
||||
}
|
||||
},
|
||||
"responseContentDisposition": {
|
||||
"type": "string",
|
||||
"description": "Sets the Content-Disposition header of the response.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedGetObject request property \"responseContentDisposition\" should be a string."
|
||||
}
|
||||
},
|
||||
"responseContentType": {
|
||||
"type": "string",
|
||||
"description": "Sets the Content-Type header of the response.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedGetObject request property \"responseContentType\" should be a string."
|
||||
}
|
||||
},
|
||||
"versionId": {
|
||||
"type": "string",
|
||||
"description": "VersionId used to reference a specific version of the object.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedGetObject request property \"versionId\" should be a string."
|
||||
}
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedGetObject request properties should be an object.",
|
||||
"required": "AwsS3PresignedGetObject request should have required property \"key\"."
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
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/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.js',
|
||||
schema: 'connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObjectSchema.json',
|
||||
},
|
||||
meta: {
|
||||
checkRead: true,
|
||||
checkWrite: false,
|
||||
},
|
||||
};
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
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 {
|
||||
$schema: 'http://json-schema.org/draft-07/schema#',
|
||||
title: 'Lowdefy Request Schema - AwsS3PresignedGetObject',
|
||||
type: 'object',
|
||||
required: ['key'],
|
||||
properties: {
|
||||
expires: {
|
||||
type: 'number',
|
||||
description: 'Number of seconds for which the policy should be valid.',
|
||||
default: 3600,
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedGetObject request property "expires" should be a number.',
|
||||
},
|
||||
},
|
||||
key: {
|
||||
type: 'string',
|
||||
description: 'Key under which object is stored.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedGetObject request property "key" should be a string.',
|
||||
},
|
||||
},
|
||||
responseContentDisposition: {
|
||||
type: 'string',
|
||||
description: 'Sets the Content-Disposition header of the response.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedGetObject request property "responseContentDisposition" should be a string.',
|
||||
},
|
||||
},
|
||||
responseContentType: {
|
||||
type: 'string',
|
||||
description: 'Sets the Content-Type header of the response.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedGetObject request property "responseContentType" should be a string.',
|
||||
},
|
||||
},
|
||||
versionId: {
|
||||
type: 'string',
|
||||
description: 'VersionId used to reference a specific version of the object.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedGetObject request property "versionId" should be a string.',
|
||||
},
|
||||
},
|
||||
},
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedGetObject request properties should be an object.',
|
||||
required: 'AwsS3PresignedGetObject request should have required property "key".',
|
||||
},
|
||||
};
|
@ -15,8 +15,9 @@
|
||||
*/
|
||||
|
||||
import AWS from 'aws-sdk';
|
||||
import schema from './schema.js';
|
||||
|
||||
function awsS3PresignedPostPolicy({ request, connection }) {
|
||||
function AwsS3PresignedPostPolicy({ request, connection }) {
|
||||
const { accessKeyId, secretAccessKey, region, bucket } = connection;
|
||||
const { acl, conditions, expires, key } = request;
|
||||
const params = {
|
||||
@ -38,4 +39,10 @@ function awsS3PresignedPostPolicy({ request, connection }) {
|
||||
return s3.createPresignedPost(params);
|
||||
}
|
||||
|
||||
export default awsS3PresignedPostPolicy;
|
||||
AwsS3PresignedPostPolicy.schema = schema;
|
||||
AwsS3PresignedPostPolicy.meta = {
|
||||
checkRead: false,
|
||||
checkWrite: true,
|
||||
};
|
||||
|
||||
export default AwsS3PresignedPostPolicy;
|
||||
|
@ -17,12 +17,13 @@
|
||||
import { validate } from '@lowdefy/ajv';
|
||||
import AWS from 'aws-sdk';
|
||||
|
||||
import awsS3PresignedPostPolicy from './AwsS3PresignedPostPolicy.js';
|
||||
import requestIndex from './index.js';
|
||||
import schema from './AwsS3PresignedPostPolicySchema.json';
|
||||
import AwsS3PresignedPostPolicy from './AwsS3PresignedPostPolicy.js';
|
||||
|
||||
jest.mock('aws-sdk');
|
||||
|
||||
const schema = AwsS3PresignedPostPolicy.schema;
|
||||
const { checkRead, checkWrite } = AwsS3PresignedPostPolicy.meta;
|
||||
|
||||
const mockCreatePresignedPost = jest.fn();
|
||||
const createPresignedPostMockImp = () => 'res';
|
||||
const mockS3Constructor = jest.fn();
|
||||
@ -32,8 +33,6 @@ const s3ConstructorMockImp = () => ({
|
||||
|
||||
AWS.S3 = mockS3Constructor;
|
||||
|
||||
const { checkRead, checkWrite } = requestIndex.meta;
|
||||
|
||||
beforeEach(() => {
|
||||
mockCreatePresignedPost.mockReset();
|
||||
mockS3Constructor.mockReset();
|
||||
@ -41,7 +40,7 @@ beforeEach(() => {
|
||||
mockS3Constructor.mockImplementation(s3ConstructorMockImp);
|
||||
});
|
||||
|
||||
test('awsS3PresignedPostPolicy', () => {
|
||||
test('AwsS3PresignedPostPolicy', () => {
|
||||
const request = { key: 'key' };
|
||||
const connection = {
|
||||
accessKeyId: 'accessKeyId',
|
||||
@ -50,7 +49,7 @@ test('awsS3PresignedPostPolicy', () => {
|
||||
write: true,
|
||||
bucket: 'bucket',
|
||||
};
|
||||
const res = awsS3PresignedPostPolicy({ request, connection });
|
||||
const res = AwsS3PresignedPostPolicy({ request, connection });
|
||||
expect(mockS3Constructor.mock.calls).toEqual([
|
||||
[
|
||||
{
|
||||
@ -74,7 +73,7 @@ test('awsS3PresignedPostPolicy', () => {
|
||||
expect(res).toEqual('res');
|
||||
});
|
||||
|
||||
test('awsS3PresignedPostPolicy options ', async () => {
|
||||
test('AwsS3PresignedPostPolicy options ', async () => {
|
||||
const request = {
|
||||
key: 'key',
|
||||
acl: 'private',
|
||||
@ -88,7 +87,7 @@ test('awsS3PresignedPostPolicy options ', async () => {
|
||||
write: true,
|
||||
bucket: 'bucket',
|
||||
};
|
||||
const res = awsS3PresignedPostPolicy({ request, connection });
|
||||
const res = AwsS3PresignedPostPolicy({ request, connection });
|
||||
expect(mockS3Constructor.mock.calls).toEqual([
|
||||
[
|
||||
{
|
||||
@ -127,7 +126,7 @@ test('Error from s3 client', async () => {
|
||||
bucket: 'bucket',
|
||||
write: true,
|
||||
};
|
||||
await expect(() => awsS3PresignedPostPolicy({ request, connection })).toThrow(
|
||||
await expect(() => AwsS3PresignedPostPolicy({ request, connection })).toThrow(
|
||||
'Test S3 client error.'
|
||||
);
|
||||
});
|
||||
|
@ -1,54 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Lowdefy Request Schema - AwsS3PresignedPostPolicy",
|
||||
"type": "object",
|
||||
"required": ["key"],
|
||||
"properties": {
|
||||
"acl": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"private",
|
||||
"public-read",
|
||||
"public-read-write",
|
||||
"aws-exec-read",
|
||||
"authenticated-read",
|
||||
"bucket-owner-read",
|
||||
"bucket-owner-full-control"
|
||||
],
|
||||
"description": "Access control lists used to grant read and write access.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedPostPolicy request property \"acl\" should be a string.",
|
||||
"enum": "AwsS3PresignedPostPolicy request property \"acl\" is not one of \"private\", \"public-read\", \"public-read-write\", \"aws-exec-read\", \"authenticated-read\", \"bucket-owner-read\", \"bucket-owner-full-control\"."
|
||||
}
|
||||
},
|
||||
"conditions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "array"
|
||||
},
|
||||
"description": "Conditions to be enforced on the request.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedPostPolicy request property \"conditions\" should be a array."
|
||||
}
|
||||
},
|
||||
"expires": {
|
||||
"type": "number",
|
||||
"description": "Number of seconds for which the policy should be valid.",
|
||||
"default": 3600,
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedPostPolicy request property \"expires\" should be a number."
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"description": "Key under which object will be stored.",
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedPostPolicy request property \"key\" should be a string."
|
||||
}
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"type": "AwsS3PresignedPostPolicy request properties should be an object.",
|
||||
"required": "AwsS3PresignedPostPolicy request should have required property \"key\"."
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/*
|
||||
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/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js',
|
||||
schema: 'connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedPostPolicySchema.json',
|
||||
},
|
||||
meta: {
|
||||
checkRead: false,
|
||||
checkWrite: true,
|
||||
},
|
||||
};
|
@ -0,0 +1,70 @@
|
||||
/*
|
||||
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 {
|
||||
$schema: 'http://json-schema.org/draft-07/schema#',
|
||||
title: 'Lowdefy Request Schema - AwsS3PresignedPostPolicy',
|
||||
type: 'object',
|
||||
required: ['key'],
|
||||
properties: {
|
||||
acl: {
|
||||
type: 'string',
|
||||
enum: [
|
||||
'private',
|
||||
'public-read',
|
||||
'public-read-write',
|
||||
'aws-exec-read',
|
||||
'authenticated-read',
|
||||
'bucket-owner-read',
|
||||
'bucket-owner-full-control',
|
||||
],
|
||||
description: 'Access control lists used to grant read and write access.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedPostPolicy request property "acl" should be a string.',
|
||||
enum: 'AwsS3PresignedPostPolicy request property "acl" is not one of "private", "public-read", "public-read-write", "aws-exec-read", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control".',
|
||||
},
|
||||
},
|
||||
conditions: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'array',
|
||||
},
|
||||
description: 'Conditions to be enforced on the request.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedPostPolicy request property "conditions" should be a array.',
|
||||
},
|
||||
},
|
||||
expires: {
|
||||
type: 'number',
|
||||
description: 'Number of seconds for which the policy should be valid.',
|
||||
default: 3600,
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedPostPolicy request property "expires" should be a number.',
|
||||
},
|
||||
},
|
||||
key: {
|
||||
type: 'string',
|
||||
description: 'Key under which object will be stored.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedPostPolicy request property "key" should be a string.',
|
||||
},
|
||||
},
|
||||
},
|
||||
errorMessage: {
|
||||
type: 'AwsS3PresignedPostPolicy request properties should be an object.',
|
||||
required: 'AwsS3PresignedPostPolicy request should have required property "key".',
|
||||
},
|
||||
};
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
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 {
|
||||
$schema: 'http://json-schema.org/draft-07/schema#',
|
||||
title: 'Lowdefy Connection Schema - AwsS3Bucket',
|
||||
type: 'object',
|
||||
required: ['accessKeyId', 'secretAccessKey', 'region', 'bucket'],
|
||||
properties: {
|
||||
accessKeyId: {
|
||||
type: 'string',
|
||||
description: 'AWS IAM access key id with s3 access.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3Bucket connection property "accessKeyId" should be a string.',
|
||||
},
|
||||
},
|
||||
secretAccessKey: {
|
||||
type: 'string',
|
||||
description: 'AWS IAM secret access key with s3 access.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3Bucket connection property "secretAccessKey" should be a string.',
|
||||
},
|
||||
},
|
||||
region: {
|
||||
type: 'string',
|
||||
description: 'AWS region the bucket is located in.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3Bucket connection property "region" should be a string.',
|
||||
},
|
||||
},
|
||||
bucket: {
|
||||
type: 'string',
|
||||
description: 'S3 bucket name.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3Bucket connection property "bucket" should be a string.',
|
||||
},
|
||||
},
|
||||
read: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Allow reads from the bucket.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3Bucket connection property "read" should be a boolean.',
|
||||
},
|
||||
},
|
||||
write: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Allow writes to the bucket.',
|
||||
errorMessage: {
|
||||
type: 'AwsS3Bucket connection property "write" should be a boolean.',
|
||||
},
|
||||
},
|
||||
},
|
||||
errorMessage: {
|
||||
type: 'AwsS3Bucket connection properties should be an object.',
|
||||
required: {
|
||||
accessKeyId: 'AwsS3Bucket connection should have required property "accessKeyId".',
|
||||
secretAccessKey: 'AwsS3Bucket connection should have required property "secretAccessKey".',
|
||||
region: 'AwsS3Bucket connection should have required property "region".',
|
||||
bucket: 'AwsS3Bucket connection should have required property "bucket".',
|
||||
},
|
||||
},
|
||||
};
|
@ -23,16 +23,3 @@ export default {
|
||||
.map((connection) => Object.keys(connections[connection].requests))
|
||||
.flat(),
|
||||
};
|
||||
|
||||
// export default {
|
||||
// connections: ['GoogleSheet'],
|
||||
// requests: [
|
||||
// GoogleSheetAppendMany,
|
||||
// GoogleSheetAppendOne,
|
||||
// GoogleSheetDeleteOne,
|
||||
// GoogleSheetGetMany,
|
||||
// GoogleSheetGetOne,
|
||||
// GoogleSheetUpdateOne,
|
||||
// GoogleSheetUpdateMany,
|
||||
// ],
|
||||
// };
|
||||
|
@ -85,7 +85,7 @@ exports[`display fallback component on error generated by child 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`display no error message on error generated by child 1`] = ``;
|
||||
exports[`display no error message on error generated by child 1`] = `null`;
|
||||
|
||||
exports[`no error 1`] = `
|
||||
<div>
|
||||
|
@ -21,6 +21,7 @@ exports[`Icon onClick.loading false 1`] = `
|
||||
class="emotion-0"
|
||||
data-testid="AiIcon"
|
||||
id="test-id"
|
||||
title="AiIcon"
|
||||
/>
|
||||
`;
|
||||
|
||||
@ -29,6 +30,7 @@ exports[`Icon onClick.loading true 1`] = `
|
||||
class="emotion-0"
|
||||
data-testid="AiOutlineLoading3Quarters"
|
||||
id="test-id"
|
||||
title="AiIcon"
|
||||
/>
|
||||
`;
|
||||
|
||||
@ -37,6 +39,7 @@ exports[`Icon properties string 1`] = `
|
||||
class="emotion-0"
|
||||
data-testid="AiIcon"
|
||||
id="test-id"
|
||||
title="AiIcon"
|
||||
/>
|
||||
`;
|
||||
|
||||
@ -45,6 +48,7 @@ exports[`Icon properties.name 1`] = `
|
||||
class="emotion-0"
|
||||
data-testid="AiIcon"
|
||||
id="test-id"
|
||||
title="AiIcon"
|
||||
/>
|
||||
`;
|
||||
|
||||
@ -54,6 +58,7 @@ exports[`Icon properties.name error 1`] = `
|
||||
color="#F00"
|
||||
data-testid="AiOutlineExclamationCircle"
|
||||
id="test-id"
|
||||
title="ErrorIcon"
|
||||
/>
|
||||
`;
|
||||
|
||||
@ -83,6 +88,7 @@ exports[`Icon properties.spin 1`] = `
|
||||
class="emotion-0 emotion-1"
|
||||
data-testid="AiIcon"
|
||||
id="test-id"
|
||||
title="AiIcon"
|
||||
/>
|
||||
`;
|
||||
|
||||
@ -95,5 +101,6 @@ exports[`Icon properties.style 1`] = `
|
||||
class="emotion-0"
|
||||
data-testid="AiIcon"
|
||||
id="test-id"
|
||||
title="AiIcon"
|
||||
/>
|
||||
`;
|
||||
|
@ -27,7 +27,8 @@ test('Get config from env', () => {
|
||||
LOWDEFY_SERVER_BUILD_DIRECTORY: 'build',
|
||||
LOWDEFY_SERVER_PUBLIC_DIRECTORY: 'public',
|
||||
LOWDEFY_SERVER_PORT: '8080',
|
||||
LOWDEFY_SERVER_BASE_PATH: 'base',
|
||||
LOWDEFY_BASE_PATH: 'base',
|
||||
LOWDEFY_SERVER_LOG_LEVEL: 'verbose',
|
||||
OTHER_VAR: 'other',
|
||||
ANOTHER_VAR: 'another',
|
||||
ASDF_GHJK: 'asdfghjk',
|
||||
@ -35,6 +36,7 @@ test('Get config from env', () => {
|
||||
const config = getConfigFromEnv();
|
||||
expect(config).toEqual({
|
||||
buildDirectory: 'build',
|
||||
logLevel: 'verbose',
|
||||
publicDirectory: 'public',
|
||||
port: 8080,
|
||||
basePath: 'base',
|
||||
|
38
yarn.lock
38
yarn.lock
@ -960,7 +960,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@jest/core@npm:^27.4.7, @jest/core@npm:^27.5.1":
|
||||
"@jest/core@npm:^27.5.1":
|
||||
version: 27.5.1
|
||||
resolution: "@jest/core@npm:27.5.1"
|
||||
dependencies:
|
||||
@ -1975,7 +1975,7 @@ __metadata:
|
||||
"@swc/cli": 0.1.55
|
||||
"@swc/core": 1.2.135
|
||||
"@swc/jest": 0.2.17
|
||||
jest: 27.4.7
|
||||
jest: 27.5.1
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -2606,12 +2606,26 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@lowdefy/plugin-aws@workspace:packages/plugins/plugins/plugin-aws"
|
||||
dependencies:
|
||||
"@emotion/jest": 11.7.1
|
||||
"@lowdefy/ajv": 4.0.0-alpha.6
|
||||
"@lowdefy/block-dev": 4.0.0-alpha.6
|
||||
"@lowdefy/block-utils": 4.0.0-alpha.6
|
||||
"@lowdefy/blocks-antd": 4.0.0-alpha.6
|
||||
"@lowdefy/helpers": 4.0.0-alpha.6
|
||||
"@swc/cli": 0.1.55
|
||||
"@swc/core": 1.2.135
|
||||
"@swc/jest": 0.2.17
|
||||
"@testing-library/dom": 8.11.3
|
||||
"@testing-library/react": 13.0.0-alpha.4
|
||||
"@testing-library/user-event": 14.0.0-alpha.14
|
||||
antd: 4.17.0-alpha.7
|
||||
aws-sdk: 2.1066.0
|
||||
copyfiles: 2.4.1
|
||||
jest: 27.5.1
|
||||
jest-serializer-html: 7.1.0
|
||||
jest-transform-yaml: 1.0.0
|
||||
react: 18.0.0-rc.0
|
||||
react-dom: 18.0.0-rc.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -8560,7 +8574,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jest-cli@npm:^27.4.7, jest-cli@npm:^27.5.1":
|
||||
"jest-cli@npm:^27.5.1":
|
||||
version: 27.5.1
|
||||
resolution: "jest-cli@npm:27.5.1"
|
||||
dependencies:
|
||||
@ -9011,24 +9025,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jest@npm:27.4.7":
|
||||
version: 27.4.7
|
||||
resolution: "jest@npm:27.4.7"
|
||||
dependencies:
|
||||
"@jest/core": ^27.4.7
|
||||
import-local: ^3.0.2
|
||||
jest-cli: ^27.4.7
|
||||
peerDependencies:
|
||||
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
|
||||
peerDependenciesMeta:
|
||||
node-notifier:
|
||||
optional: true
|
||||
bin:
|
||||
jest: bin/jest.js
|
||||
checksum: 28ce948b30c074907393f37553acac4422d0f60190776e62b3403e4c742d33dd6012e3a20748254a43e38b5b4ce52d813b13a3a5be1d43d6d12429bd08ce1a23
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jest@npm:27.5.1":
|
||||
version: 27.5.1
|
||||
resolution: "jest@npm:27.5.1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user