From 9d0cc45cffd3a373492bc842ba54a7254f7c509f Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 16 Feb 2022 11:45:01 +0200 Subject: [PATCH 1/5] fix: Fix util package tests. --- .../src/__snapshots__/ErrorBoundary.test.js.snap | 2 +- .../block-utils/src/__snapshots__/createIcon.test.js.snap | 7 +++++++ packages/utils/node-utils/src/getConfigFromEnv.test.js | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/utils/block-utils/src/__snapshots__/ErrorBoundary.test.js.snap b/packages/utils/block-utils/src/__snapshots__/ErrorBoundary.test.js.snap index fddfa309e..494202fcf 100644 --- a/packages/utils/block-utils/src/__snapshots__/ErrorBoundary.test.js.snap +++ b/packages/utils/block-utils/src/__snapshots__/ErrorBoundary.test.js.snap @@ -85,7 +85,7 @@ exports[`display fallback component on error generated by child 1`] = ` `; -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`] = `
diff --git a/packages/utils/block-utils/src/__snapshots__/createIcon.test.js.snap b/packages/utils/block-utils/src/__snapshots__/createIcon.test.js.snap index a0e4fca7e..f5e838d6c 100644 --- a/packages/utils/block-utils/src/__snapshots__/createIcon.test.js.snap +++ b/packages/utils/block-utils/src/__snapshots__/createIcon.test.js.snap @@ -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" /> `; diff --git a/packages/utils/node-utils/src/getConfigFromEnv.test.js b/packages/utils/node-utils/src/getConfigFromEnv.test.js index 4dd41c09e..e00bad158 100644 --- a/packages/utils/node-utils/src/getConfigFromEnv.test.js +++ b/packages/utils/node-utils/src/getConfigFromEnv.test.js @@ -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', From fdda1ded52aaca2b39d0a45837c9df461ede6020 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 16 Feb 2022 11:45:55 +0200 Subject: [PATCH 2/5] chore: Convert jest config files to es modules. --- .../{jest.config.cjs => jest.config.js} | 2 +- packages/plugins/blocks/blocks-antd/jest.config.js | 2 +- .../plugins/blocks/blocks-basic/jest.config.js | 2 +- .../blocks/blocks-color-selectors/jest.config.js | 2 +- .../plugins/blocks/blocks-echarts/jest.config.js | 2 +- .../plugins/blocks/blocks-loaders/jest.config.js | 2 +- .../plugins/blocks/blocks-markdown/jest.config.js | 2 +- .../{jest.config.cjs => jest.config.js} | 2 +- .../{jest.config.cjs => jest.config.js} | 2 +- .../{jest.config.cjs => jest.config.js} | 2 +- .../operators/operators-mql/jest.config.cjs | 14 -------------- .../plugins/operators/operators-mql/jest.config.js | 14 ++++++++++++++ .../operators/operators-nunjucks/jest.config.cjs | 14 -------------- .../operators/operators-nunjucks/jest.config.js | 14 ++++++++++++++ .../operators/operators-uuid/jest.config.cjs | 14 -------------- .../operators/operators-uuid/jest.config.js | 14 ++++++++++++++ .../operators/operators-yaml/jest.config.cjs | 14 -------------- .../operators/operators-yaml/jest.config.js | 14 ++++++++++++++ 18 files changed, 66 insertions(+), 66 deletions(-) rename packages/plugins/actions/actions-core/{jest.config.cjs => jest.config.js} (96%) rename packages/plugins/operators/operators-change-case/{jest.config.cjs => jest.config.js} (96%) rename packages/plugins/operators/operators-diff/{jest.config.cjs => jest.config.js} (96%) rename packages/plugins/operators/operators-js/{jest.config.cjs => jest.config.js} (96%) delete mode 100644 packages/plugins/operators/operators-mql/jest.config.cjs create mode 100644 packages/plugins/operators/operators-mql/jest.config.js delete mode 100644 packages/plugins/operators/operators-nunjucks/jest.config.cjs create mode 100644 packages/plugins/operators/operators-nunjucks/jest.config.js delete mode 100644 packages/plugins/operators/operators-uuid/jest.config.cjs create mode 100644 packages/plugins/operators/operators-uuid/jest.config.js delete mode 100644 packages/plugins/operators/operators-yaml/jest.config.cjs create mode 100644 packages/plugins/operators/operators-yaml/jest.config.js diff --git a/packages/plugins/actions/actions-core/jest.config.cjs b/packages/plugins/actions/actions-core/jest.config.js similarity index 96% rename from packages/plugins/actions/actions-core/jest.config.cjs rename to packages/plugins/actions/actions-core/jest.config.js index 67c7bbf70..77ce109f7 100644 --- a/packages/plugins/actions/actions-core/jest.config.cjs +++ b/packages/plugins/actions/actions-core/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { clearMocks: true, collectCoverage: true, collectCoverageFrom: ['src/**/*.js'], diff --git a/packages/plugins/blocks/blocks-antd/jest.config.js b/packages/plugins/blocks/blocks-antd/jest.config.js index 212bbd203..2a0dea045 100644 --- a/packages/plugins/blocks/blocks-antd/jest.config.js +++ b/packages/plugins/blocks/blocks-antd/jest.config.js @@ -4,7 +4,7 @@ export default { collectCoverageFrom: ['src/**/*.js'], coverageDirectory: 'coverage', coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], errorOnDeprecated: true, testEnvironment: 'jsdom', testPathIgnorePatterns: ['/dist/', '/src/test'], diff --git a/packages/plugins/blocks/blocks-basic/jest.config.js b/packages/plugins/blocks/blocks-basic/jest.config.js index 212bbd203..2a0dea045 100644 --- a/packages/plugins/blocks/blocks-basic/jest.config.js +++ b/packages/plugins/blocks/blocks-basic/jest.config.js @@ -4,7 +4,7 @@ export default { collectCoverageFrom: ['src/**/*.js'], coverageDirectory: 'coverage', coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], errorOnDeprecated: true, testEnvironment: 'jsdom', testPathIgnorePatterns: ['/dist/', '/src/test'], diff --git a/packages/plugins/blocks/blocks-color-selectors/jest.config.js b/packages/plugins/blocks/blocks-color-selectors/jest.config.js index 212bbd203..2a0dea045 100644 --- a/packages/plugins/blocks/blocks-color-selectors/jest.config.js +++ b/packages/plugins/blocks/blocks-color-selectors/jest.config.js @@ -4,7 +4,7 @@ export default { collectCoverageFrom: ['src/**/*.js'], coverageDirectory: 'coverage', coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], errorOnDeprecated: true, testEnvironment: 'jsdom', testPathIgnorePatterns: ['/dist/', '/src/test'], diff --git a/packages/plugins/blocks/blocks-echarts/jest.config.js b/packages/plugins/blocks/blocks-echarts/jest.config.js index 212bbd203..2a0dea045 100644 --- a/packages/plugins/blocks/blocks-echarts/jest.config.js +++ b/packages/plugins/blocks/blocks-echarts/jest.config.js @@ -4,7 +4,7 @@ export default { collectCoverageFrom: ['src/**/*.js'], coverageDirectory: 'coverage', coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], errorOnDeprecated: true, testEnvironment: 'jsdom', testPathIgnorePatterns: ['/dist/', '/src/test'], diff --git a/packages/plugins/blocks/blocks-loaders/jest.config.js b/packages/plugins/blocks/blocks-loaders/jest.config.js index 212bbd203..2a0dea045 100644 --- a/packages/plugins/blocks/blocks-loaders/jest.config.js +++ b/packages/plugins/blocks/blocks-loaders/jest.config.js @@ -4,7 +4,7 @@ export default { collectCoverageFrom: ['src/**/*.js'], coverageDirectory: 'coverage', coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], errorOnDeprecated: true, testEnvironment: 'jsdom', testPathIgnorePatterns: ['/dist/', '/src/test'], diff --git a/packages/plugins/blocks/blocks-markdown/jest.config.js b/packages/plugins/blocks/blocks-markdown/jest.config.js index 212bbd203..2a0dea045 100644 --- a/packages/plugins/blocks/blocks-markdown/jest.config.js +++ b/packages/plugins/blocks/blocks-markdown/jest.config.js @@ -4,7 +4,7 @@ export default { collectCoverageFrom: ['src/**/*.js'], coverageDirectory: 'coverage', coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../..' }], 'text', 'clover'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], errorOnDeprecated: true, testEnvironment: 'jsdom', testPathIgnorePatterns: ['/dist/', '/src/test'], diff --git a/packages/plugins/operators/operators-change-case/jest.config.cjs b/packages/plugins/operators/operators-change-case/jest.config.js similarity index 96% rename from packages/plugins/operators/operators-change-case/jest.config.cjs rename to packages/plugins/operators/operators-change-case/jest.config.js index 67c7bbf70..77ce109f7 100644 --- a/packages/plugins/operators/operators-change-case/jest.config.cjs +++ b/packages/plugins/operators/operators-change-case/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { clearMocks: true, collectCoverage: true, collectCoverageFrom: ['src/**/*.js'], diff --git a/packages/plugins/operators/operators-diff/jest.config.cjs b/packages/plugins/operators/operators-diff/jest.config.js similarity index 96% rename from packages/plugins/operators/operators-diff/jest.config.cjs rename to packages/plugins/operators/operators-diff/jest.config.js index 67c7bbf70..77ce109f7 100644 --- a/packages/plugins/operators/operators-diff/jest.config.cjs +++ b/packages/plugins/operators/operators-diff/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { clearMocks: true, collectCoverage: true, collectCoverageFrom: ['src/**/*.js'], diff --git a/packages/plugins/operators/operators-js/jest.config.cjs b/packages/plugins/operators/operators-js/jest.config.js similarity index 96% rename from packages/plugins/operators/operators-js/jest.config.cjs rename to packages/plugins/operators/operators-js/jest.config.js index 67c7bbf70..77ce109f7 100644 --- a/packages/plugins/operators/operators-js/jest.config.cjs +++ b/packages/plugins/operators/operators-js/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { clearMocks: true, collectCoverage: true, collectCoverageFrom: ['src/**/*.js'], diff --git a/packages/plugins/operators/operators-mql/jest.config.cjs b/packages/plugins/operators/operators-mql/jest.config.cjs deleted file mode 100644 index 67c7bbf70..000000000 --- a/packages/plugins/operators/operators-mql/jest.config.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - clearMocks: true, - collectCoverage: true, - collectCoverageFrom: ['src/**/*.js'], - coverageDirectory: 'coverage', - coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], - errorOnDeprecated: true, - testEnvironment: 'jsdom', - testPathIgnorePatterns: ['/dist/', '/src/test'], - transform: { - '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], - }, -}; diff --git a/packages/plugins/operators/operators-mql/jest.config.js b/packages/plugins/operators/operators-mql/jest.config.js new file mode 100644 index 000000000..77ce109f7 --- /dev/null +++ b/packages/plugins/operators/operators-mql/jest.config.js @@ -0,0 +1,14 @@ +export default { + clearMocks: true, + collectCoverage: true, + collectCoverageFrom: ['src/**/*.js'], + coverageDirectory: 'coverage', + coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], + errorOnDeprecated: true, + testEnvironment: 'jsdom', + testPathIgnorePatterns: ['/dist/', '/src/test'], + transform: { + '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], + }, +}; diff --git a/packages/plugins/operators/operators-nunjucks/jest.config.cjs b/packages/plugins/operators/operators-nunjucks/jest.config.cjs deleted file mode 100644 index 67c7bbf70..000000000 --- a/packages/plugins/operators/operators-nunjucks/jest.config.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - clearMocks: true, - collectCoverage: true, - collectCoverageFrom: ['src/**/*.js'], - coverageDirectory: 'coverage', - coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], - errorOnDeprecated: true, - testEnvironment: 'jsdom', - testPathIgnorePatterns: ['/dist/', '/src/test'], - transform: { - '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], - }, -}; diff --git a/packages/plugins/operators/operators-nunjucks/jest.config.js b/packages/plugins/operators/operators-nunjucks/jest.config.js new file mode 100644 index 000000000..77ce109f7 --- /dev/null +++ b/packages/plugins/operators/operators-nunjucks/jest.config.js @@ -0,0 +1,14 @@ +export default { + clearMocks: true, + collectCoverage: true, + collectCoverageFrom: ['src/**/*.js'], + coverageDirectory: 'coverage', + coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], + errorOnDeprecated: true, + testEnvironment: 'jsdom', + testPathIgnorePatterns: ['/dist/', '/src/test'], + transform: { + '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], + }, +}; diff --git a/packages/plugins/operators/operators-uuid/jest.config.cjs b/packages/plugins/operators/operators-uuid/jest.config.cjs deleted file mode 100644 index 67c7bbf70..000000000 --- a/packages/plugins/operators/operators-uuid/jest.config.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - clearMocks: true, - collectCoverage: true, - collectCoverageFrom: ['src/**/*.js'], - coverageDirectory: 'coverage', - coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], - errorOnDeprecated: true, - testEnvironment: 'jsdom', - testPathIgnorePatterns: ['/dist/', '/src/test'], - transform: { - '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], - }, -}; diff --git a/packages/plugins/operators/operators-uuid/jest.config.js b/packages/plugins/operators/operators-uuid/jest.config.js new file mode 100644 index 000000000..77ce109f7 --- /dev/null +++ b/packages/plugins/operators/operators-uuid/jest.config.js @@ -0,0 +1,14 @@ +export default { + clearMocks: true, + collectCoverage: true, + collectCoverageFrom: ['src/**/*.js'], + coverageDirectory: 'coverage', + coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], + errorOnDeprecated: true, + testEnvironment: 'jsdom', + testPathIgnorePatterns: ['/dist/', '/src/test'], + transform: { + '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], + }, +}; diff --git a/packages/plugins/operators/operators-yaml/jest.config.cjs b/packages/plugins/operators/operators-yaml/jest.config.cjs deleted file mode 100644 index 67c7bbf70..000000000 --- a/packages/plugins/operators/operators-yaml/jest.config.cjs +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - clearMocks: true, - collectCoverage: true, - collectCoverageFrom: ['src/**/*.js'], - coverageDirectory: 'coverage', - coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], - coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], - errorOnDeprecated: true, - testEnvironment: 'jsdom', - testPathIgnorePatterns: ['/dist/', '/src/test'], - transform: { - '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], - }, -}; diff --git a/packages/plugins/operators/operators-yaml/jest.config.js b/packages/plugins/operators/operators-yaml/jest.config.js new file mode 100644 index 000000000..77ce109f7 --- /dev/null +++ b/packages/plugins/operators/operators-yaml/jest.config.js @@ -0,0 +1,14 @@ +export default { + clearMocks: true, + collectCoverage: true, + collectCoverageFrom: ['src/**/*.js'], + coverageDirectory: 'coverage', + coveragePathIgnorePatterns: ['/dist/', '/src/test', '/src/index.js'], + coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], + errorOnDeprecated: true, + testEnvironment: 'jsdom', + testPathIgnorePatterns: ['/dist/', '/src/test'], + transform: { + '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], + }, +}; From 64043d3ddee84fcfc40b60ed777eff688517c2c8 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 16 Feb 2022 11:46:50 +0200 Subject: [PATCH 3/5] fix(plugin-aws): Convert @lowdefy/plugin-aws to new plugin package structure. --- .pnp.cjs | 40 ++++----- .../jest-npm-27.4.7-cdda9da561-28ce948b30.zip | Bin 3590 -> 0 bytes .../{jest.config.cjs => jest.config.js} | 6 +- .../plugins/plugins/plugin-aws/package.json | 20 ++++- .../blocks/S3UploadButton/S3UploadButton.js | 4 +- .../connections/AwsS3Bucket/AwsS3Bucket.js | 9 +- .../AwsS3Bucket/AwsS3Bucket.test.js | 3 +- .../AwsS3Bucket/AwsS3BucketSchema.json | 61 -------------- .../AwsS3PresignedGetObject.js | 11 ++- .../AwsS3PresignedGetObject.test.js | 19 ++--- .../AwsS3PresignedGetObjectSchema.json | 48 ----------- .../AwsS3PresignedGetObject/index.js | 26 ------ .../AwsS3PresignedGetObject/schema.js | 64 +++++++++++++++ .../AwsS3PresignedPostPolicy.js | 11 ++- .../AwsS3PresignedPostPolicy.test.js | 19 ++--- .../AwsS3PresignedPostPolicySchema.json | 54 ------------ .../AwsS3PresignedPostPolicy/index.js | 26 ------ .../AwsS3PresignedPostPolicy/schema.js | 70 ++++++++++++++++ .../src/connections/AwsS3Bucket/schema.js | 77 ++++++++++++++++++ yarn.lock | 37 ++++----- 20 files changed, 307 insertions(+), 298 deletions(-) delete mode 100644 .yarn/cache/jest-npm-27.4.7-cdda9da561-28ce948b30.zip rename packages/plugins/plugins/plugin-aws/{jest.config.cjs => jest.config.js} (73%) delete mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3BucketSchema.json delete mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObjectSchema.json delete mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/index.js create mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/schema.js delete mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicySchema.json delete mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/index.js create mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/schema.js create mode 100644 packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/schema.js diff --git a/.pnp.cjs b/.pnp.cjs index ab3486ee8..99fbb388c 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -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,25 @@ 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"] + ["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 +10519,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 +10526,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": [ diff --git a/.yarn/cache/jest-npm-27.4.7-cdda9da561-28ce948b30.zip b/.yarn/cache/jest-npm-27.4.7-cdda9da561-28ce948b30.zip deleted file mode 100644 index feec693d575f9fc5fb0fc56a4cf82699783260bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3590 zcmaJ^2{_by7amK=xMUgIj6EhAG@>XX!^kotCX|V6V;u$;iBYyJpM5Ek(%6OUdkEQb zQ&}>yXDP*4lBJM4D))Z5>df=}m*+X>ea@V7e(!nzdOCFUAi%brDd;=!?cv9TnR+KU z5LkHv(~RmXxzP$89G9gZIm>MSNQW8CQ8^fbdWW@A4D1Sgcdy-*4Av7UE1svP27Ks z+%I#n731rbJoF%Xp;zfi7Gbt)eU!1i*cfrTV$9O7W@c#YgWZ$3;%;4A?trC3Re-vC zvy05S=TB=4LSLf$0_I8YXWrvDLIsRR#w@e_0KO6Bkm0KVV6cIW0xvOxu|B-gyQCDy zAK(s`S(GCX+Oj0sJ>YFlp#M-;Iri3azK{(H8J`4?Yc@o7 zx;Q<3LL|D_uIdS`)kZbMd;-I1KBLBFFOj<*-?K6;Xlo2o_U~g`UIZ8O|1SUj+*{s~>#0GlZDF*AggO;p^f>KIK~HGhmDVzW3nyS-OVAm>NYCp$ z8hL60M%o zm*Z754ZU7|w8op~m6SJ(Ym;Q_JDN>_YMH!=UbOg>C2pB?P>G#}m8WOXDDX(EK%1FE z#u0IiTwwZQlDW2%GKpyXKl-W!PAOcvVG103Sfm#fP=y#WwtKZOC8B_sHx*MpU?Fui z*o4zxVtjoeZgbzSN1SWVk+rlZ>>Bem`=y~7s_z9F0D%9OG27=u+QAJS^Ox=uI4g4X zYuKe?JNB+gI#wnFP6>>KeodhXv75)_9IxW7Bh8Pkmh_CDCsnUrtWWYdf0HneIQu4| zA;Eww2V_q0sR>n#V7&EUF^8FwG)m}V=s_?rC5n84E6ls6^^Z3a9kqol)nX@66`jaT zykbpgdpu9TQGUwH9%>F|A>&o)%T_q2DN8GO3`n`%XV5inqi%KDazlr)$-OLz$ zohNWm(C9jB?h-a<=^B!CMN}Nfc}>#T``s~zW6lKi*sq@P1%pR&@>Y(Ye7CMEQmf{I z!WN6iOhyn^r78Mwv(OSuzhiSyL zF*DuX7$QA*D?&68{o?79*Bl@Dj7G%!`p(?(Pz4}Xa3o9uywgVQA{#9whjDd!O}_+t z2z?oD9w|sVAZC@HkjkUt_9e#o_5{Pe7P>g5ji-uHIg8#OIck#^CXwlZr_8@jnwXfO zug|f#^+H25?oT^(fZOzR5?t609K9R@bLGvx-*!6`-EW8(KZ_T2FOdE^Rm7ir(D!5b zX`AN;>8o?~OU|2zzc*ork+Xe|pHieUGJGEZAh2gST`a8d7Pi*ZNp&U!8K9$+;jDG< zE(kq`a3GX5GmLK4gj95=)Kuoec!_|+=8r0#LI*m13!NHLDFxoiNvk#+w+~*n(FeH= zA!?(?>FhX0s}Jl$gW`i3=lqCv7Y&n3@M+F#Hy#ruz02HNVZGUR&%F1qA4=mKSb4)G zE2yT`RU8bRV|IUe+D@ANlZrUfrs0ib(6OjROH;_1#tq+!cY5NkO2`Mf9tQww=Bl!>rd0AaE_)le}eNC6%Hzm!JiGaY-Lf$Ol zjf$(w8Xhk_wjK_Imp64gf~xQK!)_K3*C!Zk(XU`J2-!ouQ$}4< zVR;v2WUrK+ukS3E!OX`ui+EfR5*f&7rUwc~ZN{h#W6OjnCs3t)6C^ectt|=WLk;EG zNdAcFv#VKyU=t_vs#>MuY<4oEsOQrGKz)@ij5>>d$f51A4K2- zy~YHK2u{)2gCIvVQt{M7q2nnEXNkk*JGm({mPY4X|W*pwv5%5B-~Kk zTYkVjaH{!_nrG^X@3*8HJ+kMvPFYRzLNJdOH)aznVBoBo7XgX+HE02jak+U0+Um|8 z-3=!54lubqD$J0@<+$F|f{ zEJ7VU$ev?|L8_{wk)1|hH5t~R)l~_WsxHLfwMy;Oeey=G!qVMC)phng&%}}j zu@?|zOfSRqfIMs1(Fu-EY^X0GV~4%u}1x~ z-g~W%F2hz#eJSHYxtfJfj8Q&=zbir+c!$@bHL6X?HhdbmR6GQ=i`qtL99L z@d0q_8DwZmg+K#Jjh(@PGY|V%(hwVpCuqHg9G_)#ozgEiBLVYue>h^7yZvJ)XwsPJviYkoy_*3W)9sNCihqret>7Dot z|4Vzu|IpRH`v=?VX2&S1EOdLN@m=fuoXT#s^ACnU;+Ggdw)5}O*_H%5Mp3n+uKWL1 z<@*rspzPFUw?x=M$?#A44a%;RcEENo$bZ2o)Rp<)l>UER?oMns>-~#`qkeV$7waDm j+zqt*c>W7S58MlA*J0Ju*|&c?1W5h0QyEyCY5VPOUE7-j diff --git a/packages/plugins/plugins/plugin-aws/jest.config.cjs b/packages/plugins/plugins/plugin-aws/jest.config.js similarity index 73% rename from packages/plugins/plugins/plugin-aws/jest.config.cjs rename to packages/plugins/plugins/plugin-aws/jest.config.js index 0f5446103..18ba79831 100644 --- a/packages/plugins/plugins/plugin-aws/jest.config.cjs +++ b/packages/plugins/plugins/plugin-aws/jest.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { clearMocks: true, collectCoverage: true, collectCoverageFrom: ['src/**/*.js'], @@ -6,9 +6,11 @@ module.exports = { coveragePathIgnorePatterns: ['/dist/', '/src/index.js'], coverageReporters: [['lcov', { projectRoot: '../../../..' }], 'text', 'clover'], errorOnDeprecated: true, - testEnvironment: 'node', + testEnvironment: 'jsdom', testPathIgnorePatterns: ['/dist/'], transform: { '^.+\\.(t|j)sx?$': ['@swc/jest', { configFile: '../../../../.swcrc.test' }], + '\\.yaml$': 'jest-transform-yaml', }, + snapshotSerializers: ['@emotion/jest/serializer', 'jest-serializer-html'], }; diff --git a/packages/plugins/plugins/plugin-aws/package.json b/packages/plugins/plugins/plugin-aws/package.json index 149638d93..d8fd8e228 100644 --- a/packages/plugins/plugins/plugin-aws/package.json +++ b/packages/plugins/plugins/plugin-aws/package.json @@ -36,19 +36,33 @@ "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", + "jest": "27.5.1", + "jest-serializer-html": "7.1.0", + "jest-transform-yaml": "1.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/plugins/plugins/plugin-aws/src/blocks/S3UploadButton/S3UploadButton.js b/packages/plugins/plugins/plugin-aws/src/blocks/S3UploadButton/S3UploadButton.js index d05743224..a93db318b 100644 --- a/packages/plugins/plugins/plugin-aws/src/blocks/S3UploadButton/S3UploadButton.js +++ b/packages/plugins/plugins/plugin-aws/src/blocks/S3UploadButton/S3UploadButton.js @@ -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; diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.js index 4713ea45b..f3751aca4 100644 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.js +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.js @@ -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, diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.test.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.test.js index 5df4bf28a..9ec11a7e9 100644 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.test.js +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3Bucket.test.js @@ -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(); diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3BucketSchema.json b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3BucketSchema.json deleted file mode 100644 index 7f1d7320e..000000000 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3BucketSchema.json +++ /dev/null @@ -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\"." - } - } -} \ No newline at end of file diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.js index 6f00b49d4..86706cd2d 100644 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.js +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.js @@ -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; diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.test.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.test.js index 789a30d16..43cf86d33 100644 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.test.js +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObject.test.js @@ -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.' ); }); diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObjectSchema.json b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObjectSchema.json deleted file mode 100644 index b8f016942..000000000 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/AwsS3PresignedGetObjectSchema.json +++ /dev/null @@ -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\"." - } -} \ No newline at end of file diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/index.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/index.js deleted file mode 100644 index 9a792586f..000000000 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/index.js +++ /dev/null @@ -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, - }, -}; diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/schema.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/schema.js new file mode 100644 index 000000000..f8e396094 --- /dev/null +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedGetObject/schema.js @@ -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".', + }, +}; diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js index cc039af67..6d0b13695 100644 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.js @@ -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; diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.test.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.test.js index 56f1d3799..2e36104c7 100644 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.test.js +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicy.test.js @@ -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.' ); }); diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicySchema.json b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicySchema.json deleted file mode 100644 index 2da5a0531..000000000 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/AwsS3PresignedPostPolicySchema.json +++ /dev/null @@ -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\"." - } -} \ No newline at end of file diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/index.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/index.js deleted file mode 100644 index ecb8718fb..000000000 --- a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/index.js +++ /dev/null @@ -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, - }, -}; diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/schema.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/schema.js new file mode 100644 index 000000000..3e3a0fde3 --- /dev/null +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/AwsS3PresignedPostPolicy/schema.js @@ -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".', + }, +}; diff --git a/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/schema.js b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/schema.js new file mode 100644 index 000000000..cef7975f6 --- /dev/null +++ b/packages/plugins/plugins/plugin-aws/src/connections/AwsS3Bucket/schema.js @@ -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".', + }, + }, +}; diff --git a/yarn.lock b/yarn.lock index 39e68f408..631cdfbec 100644 --- a/yarn.lock +++ b/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,25 @@ __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 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 +8573,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 +9024,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" From e9fbe55baad4def9daa194c75003fc347a48c57d Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 16 Feb 2022 12:03:33 +0200 Subject: [PATCH 4/5] chore: Fix @lowdefy/plugin-aws dependencies, remove unused comments. --- .pnp.cjs | 1 + .../connection-axios-http/src/types.js | 5 ----- .../connection-elasticsearch/src/types.js | 12 ------------ .../connection-google-sheets/src/types.js | 13 ------------- .../connections/connection-knex/src/types.js | 5 ----- .../connections/connection-mongodb/src/types.js | 15 --------------- .../connections/connection-redis/src/types.js | 5 ----- .../connections/connection-sendgrid/src/types.js | 5 ----- .../connections/connection-stripe/src/types.js | 5 ----- packages/plugins/plugins/plugin-aws/package.json | 1 + packages/plugins/plugins/plugin-aws/src/types.js | 13 ------------- yarn.lock | 1 + 12 files changed, 3 insertions(+), 78 deletions(-) diff --git a/.pnp.cjs b/.pnp.cjs index 99fbb388c..e59bec046 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -3525,6 +3525,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@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"], + ["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"], diff --git a/packages/plugins/connections/connection-axios-http/src/types.js b/packages/plugins/connections/connection-axios-http/src/types.js index 4691afe39..843c4197f 100644 --- a/packages/plugins/connections/connection-axios-http/src/types.js +++ b/packages/plugins/connections/connection-axios-http/src/types.js @@ -23,8 +23,3 @@ export default { .map((connection) => Object.keys(connections[connection].requests)) .flat(), }; - -// export default { -// connections: ['AxiosHttp'], -// requests: ['AxiosHttp'], -// }; diff --git a/packages/plugins/connections/connection-elasticsearch/src/types.js b/packages/plugins/connections/connection-elasticsearch/src/types.js index b14a21d7d..843c4197f 100644 --- a/packages/plugins/connections/connection-elasticsearch/src/types.js +++ b/packages/plugins/connections/connection-elasticsearch/src/types.js @@ -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, -// ], -// }; diff --git a/packages/plugins/connections/connection-google-sheets/src/types.js b/packages/plugins/connections/connection-google-sheets/src/types.js index f283fd643..843c4197f 100644 --- a/packages/plugins/connections/connection-google-sheets/src/types.js +++ b/packages/plugins/connections/connection-google-sheets/src/types.js @@ -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, -// ], -// }; diff --git a/packages/plugins/connections/connection-knex/src/types.js b/packages/plugins/connections/connection-knex/src/types.js index c978a63a8..21ccc53c4 100644 --- a/packages/plugins/connections/connection-knex/src/types.js +++ b/packages/plugins/connections/connection-knex/src/types.js @@ -22,8 +22,3 @@ export default { .map((connection) => Object.keys(connections[connection].requests)) .flat(), }; - -// export default { -// connections: ['Knex'], -// requests: ['KnexBuilder', 'KnexRaw'], -// }; diff --git a/packages/plugins/connections/connection-mongodb/src/types.js b/packages/plugins/connections/connection-mongodb/src/types.js index 04a5333d6..843c4197f 100644 --- a/packages/plugins/connections/connection-mongodb/src/types.js +++ b/packages/plugins/connections/connection-mongodb/src/types.js @@ -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, -// ], -// }; diff --git a/packages/plugins/connections/connection-redis/src/types.js b/packages/plugins/connections/connection-redis/src/types.js index e5f36d5b1..843c4197f 100644 --- a/packages/plugins/connections/connection-redis/src/types.js +++ b/packages/plugins/connections/connection-redis/src/types.js @@ -23,8 +23,3 @@ export default { .map((connection) => Object.keys(connections[connection].requests)) .flat(), }; - -// export default { -// connections: ['Redis'], -// requests: ['Redis'], -// }; diff --git a/packages/plugins/connections/connection-sendgrid/src/types.js b/packages/plugins/connections/connection-sendgrid/src/types.js index b43a4cc6d..843c4197f 100644 --- a/packages/plugins/connections/connection-sendgrid/src/types.js +++ b/packages/plugins/connections/connection-sendgrid/src/types.js @@ -23,8 +23,3 @@ export default { .map((connection) => Object.keys(connections[connection].requests)) .flat(), }; - -// export default { -// connections: ['SendGridMail'], -// requests: ['SendGridMailSend'], -// }; diff --git a/packages/plugins/connections/connection-stripe/src/types.js b/packages/plugins/connections/connection-stripe/src/types.js index c711afeaa..843c4197f 100644 --- a/packages/plugins/connections/connection-stripe/src/types.js +++ b/packages/plugins/connections/connection-stripe/src/types.js @@ -23,8 +23,3 @@ export default { .map((connection) => Object.keys(connections[connection].requests)) .flat(), }; - -// export default { -// connections: ['Stripe'], -// requests: ['StripeRequest'], -// }; diff --git a/packages/plugins/plugins/plugin-aws/package.json b/packages/plugins/plugins/plugin-aws/package.json index d8fd8e228..3b33382ee 100644 --- a/packages/plugins/plugins/plugin-aws/package.json +++ b/packages/plugins/plugins/plugin-aws/package.json @@ -60,6 +60,7 @@ "@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" diff --git a/packages/plugins/plugins/plugin-aws/src/types.js b/packages/plugins/plugins/plugin-aws/src/types.js index f283fd643..843c4197f 100644 --- a/packages/plugins/plugins/plugin-aws/src/types.js +++ b/packages/plugins/plugins/plugin-aws/src/types.js @@ -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, -// ], -// }; diff --git a/yarn.lock b/yarn.lock index 631cdfbec..1fcf7f619 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2620,6 +2620,7 @@ __metadata: "@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 From 0a9370ebc483fd789b5cf2b7d1158dbeaed3cc2a Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 16 Feb 2022 12:07:40 +0200 Subject: [PATCH 5/5] chore: Update CI test definition @lowdefy/engine, @lowdefy/blocks-* and @lowdefy/plugin-aws ignored until tests are fixed for v4 --- .github/workflows/test-pulls.yml | 37 +++----------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test-pulls.yml b/.github/workflows/test-pulls.yml index bdc167689..b1c17abf3 100644 --- a/.github/workflows/test-pulls.yml +++ b/.github/workflows/test-pulls.yml @@ -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