2
0

(s3) Improve storage management and type safety

Closes #756
This commit is contained in:
Baptiste Arnaud
2023-09-08 15:28:11 +02:00
parent 43be38cf50
commit fbb198af9d
47 changed files with 790 additions and 128 deletions

View File

@@ -133,15 +133,16 @@ For `*_PATH` parameters, you can use dot notation to access nested properties (i
Used for uploading images, videos, etc... It can be any S3 compatible object storage service (Minio, Digital Oceans Space, AWS S3...)
| Parameter | Default | Description |
| ------------- | ------- | -------------------------------------------------------------- |
| S3_ACCESS_KEY | | S3 access key. Also used to check if upload feature is enabled |
| S3_SECRET_KEY | | S3 secret key. |
| S3_BUCKET | typebot | Name of the bucket where assets will be uploaded in. |
| S3_PORT | | S3 Host port number |
| S3_ENDPOINT | | S3 endpoint (i.e. `s3.domain.com`). |
| S3_SSL | true | Use SSL when establishing the connection. |
| S3_REGION | | S3 region. |
| Parameter | Default | Description |
| ----------------------- | ------- | ---------------------------------------------------------------------------------- |
| S3_ACCESS_KEY | | S3 access key. Also used to check if upload feature is enabled |
| S3_SECRET_KEY | | S3 secret key. |
| S3_BUCKET | typebot | Name of the bucket where assets will be uploaded in. |
| S3_PORT | | S3 Host port number |
| S3_ENDPOINT | | S3 endpoint (i.e. `s3.domain.com`). |
| S3_SSL | true | Use SSL when establishing the connection. |
| S3_REGION | | S3 region. |
| S3_PUBLIC_CUSTOM_DOMAIN | | If the final URL that is used to read public files is different from `S3_ENDPOINT` |
Note that for AWS S3, your endpoint is usually: `s3.<S3_REGION>.amazonaws.com`

View File

@@ -32214,6 +32214,148 @@
}
}
}
},
"/generate-upload-url": {
"post": {
"operationId": "generateUploadUrl",
"summary": "Generate upload URL",
"description": "Generate the needed URL to upload a file from the client",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"filePathProps": {
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"type": "object",
"properties": {
"workspaceId": {
"type": "string"
},
"typebotId": {
"type": "string"
},
"blockId": {
"type": "string"
},
"itemId": {
"type": "string"
}
},
"required": [
"workspaceId",
"typebotId",
"blockId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"workspaceId": {
"type": "string"
},
"typebotId": {
"type": "string"
},
"fileName": {
"type": "string"
}
},
"required": [
"workspaceId",
"typebotId",
"fileName"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"fileName": {
"type": "string"
}
},
"required": [
"userId",
"fileName"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"workspaceId": {
"type": "string"
},
"fileName": {
"type": "string"
}
},
"required": [
"workspaceId",
"fileName"
],
"additionalProperties": false
}
]
},
"fileType": {
"type": "string"
}
},
"required": [
"filePathProps"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"presignedUrl": {
"type": "string"
},
"fileUrl": {
"type": "string"
}
},
"required": [
"presignedUrl",
"fileUrl"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
}
},
"components": {

View File

@@ -6282,6 +6282,86 @@
"default": {
"$ref": "#/components/responses/error"
}
},
"deprecated": true
}
},
"/generate-upload-url": {
"post": {
"operationId": "generateUploadUrl",
"summary": "Generate upload URL",
"description": "Used to upload anything from the client to S3 bucket",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"filePathProps": {
"type": "object",
"properties": {
"typebotId": {
"type": "string"
},
"blockId": {
"type": "string"
},
"resultId": {
"type": "string"
},
"fileName": {
"type": "string"
}
},
"required": [
"typebotId",
"blockId",
"resultId",
"fileName"
],
"additionalProperties": false
},
"fileType": {
"type": "string"
}
},
"required": [
"filePathProps"
],
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"presignedUrl": {
"type": "string"
},
"fileUrl": {
"type": "string"
}
},
"required": [
"presignedUrl",
"fileUrl"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
},