From f9fab52054991bb73315fbd3bb9dafead32b04fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 23 Nov 2024 17:33:37 +0100 Subject: [PATCH] ci: release (#7324) Co-authored-by: github-actions[bot] --- .changeset/hot-maps-unite.md | 23 - .changeset/long-panthers-learn.md | 20 - .../3.middleware/3.api/middleware.api.json | 596 ++++++++++++++++-- .../3.middleware/4.reference/change-log.md | 24 + .../4.sdk/5.reference/sdk-change-log.md | 21 + packages/middleware/CHANGELOG.md | 24 + packages/middleware/package.json | 2 +- packages/sdk/CHANGELOG.md | 21 + packages/sdk/package.json | 4 +- 9 files changed, 626 insertions(+), 109 deletions(-) delete mode 100644 .changeset/hot-maps-unite.md delete mode 100644 .changeset/long-panthers-learn.md diff --git a/.changeset/hot-maps-unite.md b/.changeset/hot-maps-unite.md deleted file mode 100644 index 5c54474173..0000000000 --- a/.changeset/hot-maps-unite.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -"@vue-storefront/middleware": minor ---- - -**[ADDED]** Support for file uploads -Now you can upload files to the server with a `multipart/form-data` content type. Files are available in the `req.files` object. - -```ts -// Example of an endpoint that handles file uploads -export const upload = (context) => { - // Files are available in the `req.files` object - const { files } = context.req; - - // Do something with files - - return Promise.resolve({ - status: 200, - message: "ok", - }); -}; -``` - -Please, read the [Getting Started guide](https://docs.alokai.com/middleware/guides/getting-started#file-upload-configuration) for more information about file uploads. diff --git a/.changeset/long-panthers-learn.md b/.changeset/long-panthers-learn.md deleted file mode 100644 index e05c120055..0000000000 --- a/.changeset/long-panthers-learn.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -"@vue-storefront/sdk": minor ---- - -**[ADDED]** Add support for multipart/form-data requests in SDK - -- Added handling for multipart/form-data content type in the default HTTP client -- Automatically handles File and Blob objects in request parameters - -```typescript -// Upload a file using multipart/form-data -await sdk.commerce.uploadFile( - { file: new File(["content"], "test.txt", { type: "text/plain" }) }, - prepareConfig({ - headers: { - "Content-Type": "multipart/form-data", - }, - }) -); -``` diff --git a/docs/content/3.middleware/3.api/middleware.api.json b/docs/content/3.middleware/3.api/middleware.api.json index 09302a7896..caa3da6185 100644 --- a/docs/content/3.middleware/3.api/middleware.api.json +++ b/docs/content/3.middleware/3.api/middleware.api.json @@ -433,6 +433,95 @@ "endIndex": 6 } }, + { + "kind": "TypeAlias", + "canonicalReference": "@vue-storefront/middleware!AlokaiRequest:type", + "docComment": "", + "excerptTokens": [ + { + "kind": "Content", + "text": "export type AlokaiRequest = " + }, + { + "kind": "Reference", + "text": "Request", + "canonicalReference": "@types/express!e.Request:interface" + }, + { + "kind": "Content", + "text": " & {\n files?: {\n [fieldname: string]: " + }, + { + "kind": "Reference", + "text": "UploadedFile", + "canonicalReference": "@vue-storefront/middleware!UploadedFile:interface" + }, + { + "kind": "Content", + "text": "[];\n } | " + }, + { + "kind": "Reference", + "text": "UploadedFile", + "canonicalReference": "@vue-storefront/middleware!UploadedFile:interface" + }, + { + "kind": "Content", + "text": "[] | undefined;\n}" + }, + { + "kind": "Content", + "text": ";" + } + ], + "fileUrlPath": "src/types/common.ts", + "releaseTag": "Public", + "name": "AlokaiRequest", + "typeTokenRange": { + "startIndex": 1, + "endIndex": 7 + } + }, + { + "kind": "TypeAlias", + "canonicalReference": "@vue-storefront/middleware!AlokaiResponse:type", + "docComment": "", + "excerptTokens": [ + { + "kind": "Content", + "text": "export type AlokaiResponse = " + }, + { + "kind": "Reference", + "text": "Response", + "canonicalReference": "@types/express!e.Response:interface" + }, + { + "kind": "Content", + "text": " any;\n fnOrigin?: string;\n [key: string]: any;\n}>" + }, + { + "kind": "Content", + "text": ";" + } + ], + "fileUrlPath": "src/types/common.ts", + "releaseTag": "Public", + "name": "AlokaiResponse", + "typeTokenRange": { + "startIndex": 1, + "endIndex": 5 + } + }, { "kind": "TypeAlias", "canonicalReference": "@vue-storefront/middleware!AnyFunction:type", @@ -952,8 +1041,8 @@ }, { "kind": "Reference", - "text": "Request", - "canonicalReference": "@types/express!e.Request:interface" + "text": "AlokaiRequest", + "canonicalReference": "@vue-storefront/middleware!AlokaiRequest:type" }, { "kind": "Content", @@ -961,8 +1050,8 @@ }, { "kind": "Reference", - "text": "ResponseWithAlokaiLocals", - "canonicalReference": "@vue-storefront/middleware!ResponseWithAlokaiLocals:type" + "text": "AlokaiResponse", + "canonicalReference": "@vue-storefront/middleware!AlokaiResponse:type" }, { "kind": "Content", @@ -3849,6 +3938,56 @@ "endIndex": 4 } }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!CreateServerOptions#fileUpload:member", + "docComment": "/**\n * Configuration options for handling file uploads.\n *\n * @see\n *\n * FileUploadOptions\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "fileUpload?: " + }, + { + "kind": "Reference", + "text": "FileUploadOptions", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions:interface" + }, + { + "kind": "Content", + "text": " | ((req: " + }, + { + "kind": "Reference", + "text": "FileUploadRequest", + "canonicalReference": "@vue-storefront/middleware!FileUploadRequest:interface" + }, + { + "kind": "Content", + "text": ") => " + }, + { + "kind": "Reference", + "text": "FileUploadOptions", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions:interface" + }, + { + "kind": "Content", + "text": ")" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "fileUpload", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 7 + } + }, { "kind": "PropertySignature", "canonicalReference": "@vue-storefront/middleware!CreateServerOptions#readinessProbes:member", @@ -4457,6 +4596,205 @@ ], "extendsTokenRanges": [] }, + { + "kind": "Interface", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions:interface", + "docComment": "/**\n * Options for file upload middleware\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "export interface FileUploadOptions " + } + ], + "fileUrlPath": "src/types/fileUpload.ts", + "releaseTag": "Public", + "name": "FileUploadOptions", + "preserveMemberOrder": false, + "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions#allowedMimeTypes:member", + "docComment": "/**\n * Allowed MIME types @default [\"image/*\", \"application/pdf\"]\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "allowedMimeTypes?: " + }, + { + "kind": "Content", + "text": "string[]" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "allowedMimeTypes", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions#enabled:member", + "docComment": "/**\n * Whether file upload is enabled @default true\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "enabled?: " + }, + { + "kind": "Content", + "text": "boolean" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "enabled", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions#fieldNames:member", + "docComment": "/**\n * Specific field names to accept @default []\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "fieldNames?: " + }, + { + "kind": "Content", + "text": "string[]" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "fieldNames", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions#maxFiles:member", + "docComment": "/**\n * Maximum number of files @default 5\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "maxFiles?: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "maxFiles", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!FileUploadOptions#maxFileSize:member", + "docComment": "/**\n * Maximum file size in bytes @default 5MB\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "maxFileSize?: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": true, + "releaseTag": "Public", + "name": "maxFileSize", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "extendsTokenRanges": [] + }, + { + "kind": "Interface", + "canonicalReference": "@vue-storefront/middleware!FileUploadRequest:interface", + "docComment": "/**\n * Request object for file upload middleware\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "export interface FileUploadRequest " + } + ], + "fileUrlPath": "src/types/fileUpload.ts", + "releaseTag": "Public", + "name": "FileUploadRequest", + "preserveMemberOrder": false, + "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!FileUploadRequest#headers:member", + "docComment": "/**\n * Request headers\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "headers: " + }, + { + "kind": "Reference", + "text": "IncomingHttpHeaders", + "canonicalReference": "!\"\\\"http\\\"\".IncomingHttpHeaders:interface" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "headers", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "extendsTokenRanges": [] + }, { "kind": "TypeAlias", "canonicalReference": "@vue-storefront/middleware!GetConstructorArgs:type", @@ -4830,8 +5168,8 @@ }, { "kind": "Reference", - "text": "Request", - "canonicalReference": "@types/express!e.Request:interface" + "text": "AlokaiRequest", + "canonicalReference": "@vue-storefront/middleware!AlokaiRequest:type" }, { "kind": "Content", @@ -4839,8 +5177,8 @@ }, { "kind": "Reference", - "text": "ResponseWithAlokaiLocals", - "canonicalReference": "@vue-storefront/middleware!ResponseWithAlokaiLocals:type" + "text": "AlokaiResponse", + "canonicalReference": "@vue-storefront/middleware!AlokaiResponse:type" }, { "kind": "Content", @@ -5434,8 +5772,8 @@ }, { "kind": "Reference", - "text": "ResponseWithAlokaiLocals", - "canonicalReference": "@vue-storefront/middleware!ResponseWithAlokaiLocals:type" + "text": "AlokaiResponse", + "canonicalReference": "@vue-storefront/middleware!AlokaiResponse:type" }, { "kind": "Content", @@ -6336,8 +6674,8 @@ }, { "kind": "Reference", - "text": "Request", - "canonicalReference": "@types/express!e.Request:interface" + "text": "AlokaiRequest", + "canonicalReference": "@vue-storefront/middleware!AlokaiRequest:type" }, { "kind": "Content", @@ -6364,8 +6702,8 @@ }, { "kind": "Reference", - "text": "ResponseWithAlokaiLocals", - "canonicalReference": "@vue-storefront/middleware!ResponseWithAlokaiLocals:type" + "text": "AlokaiResponse", + "canonicalReference": "@vue-storefront/middleware!AlokaiResponse:type" }, { "kind": "Content", @@ -6783,55 +7121,6 @@ ], "extendsTokenRanges": [] }, - { - "kind": "TypeAlias", - "canonicalReference": "@vue-storefront/middleware!ResponseWithAlokaiLocals:type", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "export type ResponseWithAlokaiLocals = " - }, - { - "kind": "Reference", - "text": "Response", - "canonicalReference": "@types/express!e.Response:interface" - }, - { - "kind": "Content", - "text": "" - }, - { - "kind": "Content", - "text": ";" - } - ], - "fileUrlPath": "src/types/common.ts", - "releaseTag": "Public", - "name": "ResponseWithAlokaiLocals", - "typeTokenRange": { - "startIndex": 1, - "endIndex": 7 - } - }, { "kind": "TypeAlias", "canonicalReference": "@vue-storefront/middleware!StatusCode:type", @@ -6971,6 +7260,187 @@ "endIndex": 6 } }, + { + "kind": "Interface", + "canonicalReference": "@vue-storefront/middleware!UploadedFile:interface", + "docComment": "/**\n * Uploaded file object\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "export interface UploadedFile " + } + ], + "fileUrlPath": "src/types/fileUpload.ts", + "releaseTag": "Public", + "name": "UploadedFile", + "preserveMemberOrder": false, + "members": [ + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!UploadedFile#buffer:member", + "docComment": "/**\n * File buffer\n *\n * @see\n *\n * https://nodejs.org/api/buffer.html\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "buffer: " + }, + { + "kind": "Reference", + "text": "Buffer", + "canonicalReference": "!\"\\\"buffer\\\"\".__global.Buffer:interface" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "buffer", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!UploadedFile#encoding:member", + "docComment": "/**\n * Encoding eg. 7bit, 8bit\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "encoding: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "encoding", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!UploadedFile#fieldname:member", + "docComment": "/**\n * Field name Identifies the field name of the file\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "fieldname: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "fieldname", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!UploadedFile#mimetype:member", + "docComment": "/**\n * MIME type eg. image/jpeg, application/pdf\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "mimetype: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "mimetype", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!UploadedFile#originalname:member", + "docComment": "/**\n * Original file name\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "originalname: " + }, + { + "kind": "Content", + "text": "string" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "originalname", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + }, + { + "kind": "PropertySignature", + "canonicalReference": "@vue-storefront/middleware!UploadedFile#size:member", + "docComment": "/**\n * File size in bytes\n */\n", + "excerptTokens": [ + { + "kind": "Content", + "text": "size: " + }, + { + "kind": "Content", + "text": "number" + }, + { + "kind": "Content", + "text": ";" + } + ], + "isReadonly": false, + "isOptional": false, + "releaseTag": "Public", + "name": "size", + "propertyTypeTokenRange": { + "startIndex": 1, + "endIndex": 2 + } + } + ], + "extendsTokenRanges": [] + }, { "kind": "TypeAlias", "canonicalReference": "@vue-storefront/middleware!WithoutContext:type", diff --git a/docs/content/3.middleware/4.reference/change-log.md b/docs/content/3.middleware/4.reference/change-log.md index 00326ca03c..1686c377c8 100644 --- a/docs/content/3.middleware/4.reference/change-log.md +++ b/docs/content/3.middleware/4.reference/change-log.md @@ -1,5 +1,29 @@ # Change log +## 5.2.0 + +### Minor Changes + +**[ADDED]** Support for file uploads +Now you can upload files to the server with a `multipart/form-data` content type. Files are available in the `req.files` object. + +```ts +// Example of an endpoint that handles file uploads +export const upload = (context) => { + // Files are available in the `req.files` object + const { files } = context.req; + + // Do something with files + + return Promise.resolve({ + status: 200, + message: "ok", + }); +}; +``` + +Please, read the [Getting Started guide](https://docs.alokai.com/middleware/guides/getting-started#file-upload-configuration) for more information about file uploads. + ## 5.1.1 ### Patch Changes diff --git a/docs/content/4.sdk/5.reference/sdk-change-log.md b/docs/content/4.sdk/5.reference/sdk-change-log.md index f52922853a..ca5baf8c00 100644 --- a/docs/content/4.sdk/5.reference/sdk-change-log.md +++ b/docs/content/4.sdk/5.reference/sdk-change-log.md @@ -1,5 +1,26 @@ # Change log +## 3.4.0 + +### Minor Changes + +**[ADDED]** Add support for multipart/form-data requests in SDK + +- Added handling for multipart/form-data content type in the default HTTP client +- Automatically handles File and Blob objects in request parameters + +```typescript +// Upload a file using multipart/form-data +await sdk.commerce.uploadFile( + { file: new File(["content"], "test.txt", { type: "text/plain" }) }, + prepareConfig({ + headers: { + "Content-Type": "multipart/form-data", + }, + }) +); +``` + ## 3.3.0 ### Minor Changes diff --git a/packages/middleware/CHANGELOG.md b/packages/middleware/CHANGELOG.md index 00326ca03c..1686c377c8 100644 --- a/packages/middleware/CHANGELOG.md +++ b/packages/middleware/CHANGELOG.md @@ -1,5 +1,29 @@ # Change log +## 5.2.0 + +### Minor Changes + +**[ADDED]** Support for file uploads +Now you can upload files to the server with a `multipart/form-data` content type. Files are available in the `req.files` object. + +```ts +// Example of an endpoint that handles file uploads +export const upload = (context) => { + // Files are available in the `req.files` object + const { files } = context.req; + + // Do something with files + + return Promise.resolve({ + status: 200, + message: "ok", + }); +}; +``` + +Please, read the [Getting Started guide](https://docs.alokai.com/middleware/guides/getting-started#file-upload-configuration) for more information about file uploads. + ## 5.1.1 ### Patch Changes diff --git a/packages/middleware/package.json b/packages/middleware/package.json index 1b69bd6b15..11aebfb102 100644 --- a/packages/middleware/package.json +++ b/packages/middleware/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/middleware", - "version": "5.1.1", + "version": "5.2.0", "main": "lib/index.cjs.js", "module": "lib/index.es.js", "types": "lib/index.d.ts", diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index f52922853a..ca5baf8c00 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,26 @@ # Change log +## 3.4.0 + +### Minor Changes + +**[ADDED]** Add support for multipart/form-data requests in SDK + +- Added handling for multipart/form-data content type in the default HTTP client +- Automatically handles File and Blob objects in request parameters + +```typescript +// Upload a file using multipart/form-data +await sdk.commerce.uploadFile( + { file: new File(["content"], "test.txt", { type: "text/plain" }) }, + prepareConfig({ + headers: { + "Content-Type": "multipart/form-data", + }, + }) +); +``` + ## 3.3.0 ### Minor Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 15e7b01d92..2db3cbb7b5 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,7 +1,7 @@ { "name": "@vue-storefront/sdk", "license": "MIT", - "version": "3.3.0", + "version": "3.4.0", "main": "lib/index.cjs.js", "module": "lib/index.es.js", "types": "lib/index.d.ts", @@ -25,7 +25,7 @@ "devDependencies": { "@types/jest": "^29.0.3", "@types/node": "^18.11.17", - "@vue-storefront/middleware": "5.1.1", + "@vue-storefront/middleware": "5.2.0", "axios": "^1.6.7", "babel-preset-node": "^5.1.1", "isomorphic-fetch": "^3.0.0",