@platformatic/gateway 3.3.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config.d.ts CHANGED
@@ -366,6 +366,10 @@ export interface PlatformaticGatewayConfig {
366
366
  };
367
367
  addEmptySchema?: boolean;
368
368
  refreshTimeout?: number;
369
+ /**
370
+ * Content types that should be passed through without parsing to enable proxying
371
+ */
372
+ passthroughContentTypes?: string[];
369
373
  };
370
374
  types?: {
371
375
  autogenerate?: boolean;
@@ -146,6 +146,17 @@ export async function platformaticGateway (app, capability) {
146
146
 
147
147
  await app.register(gatewayHook)
148
148
 
149
+ // Register pass-through content type parsers from config
150
+ const passthroughTypes = config.gateway.passthroughContentTypes ||
151
+ ['multipart/form-data', 'application/octet-stream']
152
+ for (const contentType of passthroughTypes) {
153
+ if (!app.hasContentTypeParser(contentType)) {
154
+ app.addContentTypeParser(contentType, function (req, body, done) {
155
+ done(null, body)
156
+ })
157
+ }
158
+ }
159
+
149
160
  let generatedComposedOpenAPI = null
150
161
  if (hasOpenapiApplications) {
151
162
  generatedComposedOpenAPI = await openApiGenerator(app, config.gateway)
package/lib/schema.js CHANGED
@@ -181,7 +181,13 @@ export const gateway = {
181
181
  openapi: openApiBase,
182
182
  graphql: graphqlComposerOptions,
183
183
  addEmptySchema: { type: 'boolean', default: false },
184
- refreshTimeout: { type: 'integer', minimum: 0, default: 1000 }
184
+ refreshTimeout: { type: 'integer', minimum: 0, default: 1000 },
185
+ passthroughContentTypes: {
186
+ type: 'array',
187
+ items: { type: 'string' },
188
+ default: ['multipart/form-data', 'application/octet-stream'],
189
+ description: 'Content types that should be passed through without parsing to enable proxying'
190
+ }
185
191
  },
186
192
  required: [],
187
193
  default: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/gateway",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -16,6 +16,7 @@
16
16
  },
17
17
  "homepage": "https://github.com/platformatic/platformatic#readme",
18
18
  "devDependencies": {
19
+ "@fastify/multipart": "^9.2.1",
19
20
  "c8": "^10.0.0",
20
21
  "cleaner-spec-reporter": "^0.5.0",
21
22
  "dedent": "^1.5.1",
@@ -32,7 +33,7 @@
32
33
  "typescript": "^5.5.4",
33
34
  "why-is-node-running": "2",
34
35
  "ws": "^8.16.0",
35
- "@platformatic/db": "3.3.0"
36
+ "@platformatic/db": "3.4.1"
36
37
  },
37
38
  "dependencies": {
38
39
  "@fastify/error": "^4.0.0",
@@ -63,11 +64,11 @@
63
64
  "rfdc": "^1.3.1",
64
65
  "semgrator": "^0.3.0",
65
66
  "undici": "^7.0.0",
66
- "@platformatic/scalar-theme": "3.3.0",
67
- "@platformatic/service": "3.3.0",
68
- "@platformatic/basic": "3.3.0",
69
- "@platformatic/telemetry": "3.3.0",
70
- "@platformatic/foundation": "^3.3.0"
67
+ "@platformatic/basic": "3.4.1",
68
+ "@platformatic/service": "3.4.1",
69
+ "@platformatic/foundation": "^3.4.1",
70
+ "@platformatic/scalar-theme": "3.4.1",
71
+ "@platformatic/telemetry": "3.4.1"
71
72
  },
72
73
  "engines": {
73
74
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.3.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.4.1.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Gateway Config",
5
5
  "type": "object",
@@ -1109,6 +1109,17 @@
1109
1109
  "type": "integer",
1110
1110
  "minimum": 0,
1111
1111
  "default": 1000
1112
+ },
1113
+ "passthroughContentTypes": {
1114
+ "type": "array",
1115
+ "items": {
1116
+ "type": "string"
1117
+ },
1118
+ "default": [
1119
+ "multipart/form-data",
1120
+ "application/octet-stream"
1121
+ ],
1122
+ "description": "Content types that should be passed through without parsing to enable proxying"
1112
1123
  }
1113
1124
  },
1114
1125
  "required": [],