fix(plugin-aws): Convert @lowdefy/plugin-aws to new plugin package structure.

This commit is contained in:
Sam 2022-02-16 11:46:50 +02:00
parent fdda1ded52
commit 64043d3dde
No known key found for this signature in database
GPG Key ID: D004126FCD1A6DF0
20 changed files with 307 additions and 298 deletions

40
.pnp.cjs generated
View File

@ -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": [

View File

@ -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'],
};

View File

@ -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"

View File

@ -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;

View 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,

View File

@ -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();

View File

@ -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\"."
}
}
}

View File

@ -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;

View File

@ -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.'
);
});

View File

@ -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\"."
}
}

View File

@ -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,
},
};

View File

@ -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".',
},
};

View File

@ -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;

View File

@ -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.'
);
});

View File

@ -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\"."
}
}

View File

@ -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,
},
};

View File

@ -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".',
},
};

View File

@ -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".',
},
},
};

View File

@ -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"