@platformatic/gateway 3.38.1 → 3.39.0
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 +10 -0
- package/lib/proxy.js +6 -0
- package/lib/schema.js +11 -0
- package/package.json +8 -8
- package/schema.json +73 -1
package/config.d.ts
CHANGED
|
@@ -79,6 +79,10 @@ export interface PlatformaticGatewayConfig {
|
|
|
79
79
|
customLevels?: {
|
|
80
80
|
[k: string]: unknown;
|
|
81
81
|
};
|
|
82
|
+
openTelemetryExporter?: {
|
|
83
|
+
protocol: "grpc" | "http";
|
|
84
|
+
url: string;
|
|
85
|
+
};
|
|
82
86
|
[k: string]: unknown;
|
|
83
87
|
};
|
|
84
88
|
loggerInstance?: {
|
|
@@ -244,6 +248,8 @@ export interface PlatformaticGatewayConfig {
|
|
|
244
248
|
proxy?:
|
|
245
249
|
| false
|
|
246
250
|
| {
|
|
251
|
+
methods?: ("GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS")[];
|
|
252
|
+
routes?: string[];
|
|
247
253
|
upstream?: string;
|
|
248
254
|
prefix?: string;
|
|
249
255
|
hostname?: string;
|
|
@@ -456,6 +462,10 @@ export interface PlatformaticGatewayConfig {
|
|
|
456
462
|
customLevels?: {
|
|
457
463
|
[k: string]: unknown;
|
|
458
464
|
};
|
|
465
|
+
openTelemetryExporter?: {
|
|
466
|
+
protocol: "grpc" | "http";
|
|
467
|
+
url: string;
|
|
468
|
+
};
|
|
459
469
|
[k: string]: unknown;
|
|
460
470
|
};
|
|
461
471
|
server?: {
|
package/lib/proxy.js
CHANGED
|
@@ -59,6 +59,8 @@ async function resolveApplicationProxyParameters (application) {
|
|
|
59
59
|
|
|
60
60
|
return {
|
|
61
61
|
origin: application.origin,
|
|
62
|
+
methods: application.proxy?.methods,
|
|
63
|
+
routes: application.proxy?.routes,
|
|
62
64
|
url: meta.url,
|
|
63
65
|
prefix,
|
|
64
66
|
rewritePrefix,
|
|
@@ -90,6 +92,8 @@ async function proxyPlugin (app, opts) {
|
|
|
90
92
|
prefix,
|
|
91
93
|
origin,
|
|
92
94
|
url,
|
|
95
|
+
routes,
|
|
96
|
+
methods,
|
|
93
97
|
rewritePrefix,
|
|
94
98
|
internalRewriteLocationHeader,
|
|
95
99
|
needsRootTrailingSlash,
|
|
@@ -204,6 +208,8 @@ async function proxyPlugin (app, opts) {
|
|
|
204
208
|
[kProxyRoute]: true
|
|
205
209
|
},
|
|
206
210
|
|
|
211
|
+
httpMethods: methods,
|
|
212
|
+
routes,
|
|
207
213
|
internalRewriteLocationHeader: false,
|
|
208
214
|
replyOptions: {
|
|
209
215
|
rewriteHeaders: headers => {
|
package/lib/schema.js
CHANGED
|
@@ -136,6 +136,17 @@ export const gateway = {
|
|
|
136
136
|
{
|
|
137
137
|
type: 'object',
|
|
138
138
|
properties: {
|
|
139
|
+
methods: {
|
|
140
|
+
type: 'array',
|
|
141
|
+
// Note: HEAD is purposely not included as it makes sense only if there is a GET route
|
|
142
|
+
items: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'] },
|
|
143
|
+
default: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS']
|
|
144
|
+
},
|
|
145
|
+
routes: {
|
|
146
|
+
type: 'array',
|
|
147
|
+
items: { type: 'string' },
|
|
148
|
+
default: ['/', '/*']
|
|
149
|
+
},
|
|
139
150
|
upstream: { type: 'string' },
|
|
140
151
|
prefix: { type: 'string' },
|
|
141
152
|
hostname: { type: 'string' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/gateway",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.39.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"typescript": "^5.5.4",
|
|
33
33
|
"why-is-node-running": "2",
|
|
34
34
|
"ws": "^8.16.0",
|
|
35
|
-
"@platformatic/db": "3.
|
|
35
|
+
"@platformatic/db": "3.39.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fastify/error": "^4.0.0",
|
|
39
|
-
"@fastify/http-proxy": "^11.
|
|
39
|
+
"@fastify/http-proxy": "^11.4.0",
|
|
40
40
|
"@fastify/reply-from": "^12.0.0",
|
|
41
41
|
"@fastify/static": "^8.0.0",
|
|
42
42
|
"@fastify/swagger": "^9.0.0",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"rfdc": "^1.3.1",
|
|
64
64
|
"semgrator": "^0.3.0",
|
|
65
65
|
"undici": "^7.0.0",
|
|
66
|
-
"@platformatic/
|
|
67
|
-
"@platformatic/
|
|
68
|
-
"@platformatic/
|
|
69
|
-
"@platformatic/
|
|
70
|
-
"@platformatic/
|
|
66
|
+
"@platformatic/basic": "3.39.0",
|
|
67
|
+
"@platformatic/scalar-theme": "3.39.0",
|
|
68
|
+
"@platformatic/service": "3.39.0",
|
|
69
|
+
"@platformatic/telemetry": "3.39.0",
|
|
70
|
+
"@platformatic/foundation": "^3.39.0"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=22.19.0"
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/gateway/3.39.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Gateway Config",
|
|
5
5
|
"type": "object",
|
|
@@ -237,6 +237,26 @@
|
|
|
237
237
|
"customLevels": {
|
|
238
238
|
"type": "object",
|
|
239
239
|
"additionalProperties": true
|
|
240
|
+
},
|
|
241
|
+
"openTelemetryExporter": {
|
|
242
|
+
"type": "object",
|
|
243
|
+
"properties": {
|
|
244
|
+
"protocol": {
|
|
245
|
+
"type": "string",
|
|
246
|
+
"enum": [
|
|
247
|
+
"grpc",
|
|
248
|
+
"http"
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
"url": {
|
|
252
|
+
"type": "string"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"required": [
|
|
256
|
+
"protocol",
|
|
257
|
+
"url"
|
|
258
|
+
],
|
|
259
|
+
"additionalProperties": false
|
|
240
260
|
}
|
|
241
261
|
},
|
|
242
262
|
"default": {},
|
|
@@ -779,6 +799,38 @@
|
|
|
779
799
|
{
|
|
780
800
|
"type": "object",
|
|
781
801
|
"properties": {
|
|
802
|
+
"methods": {
|
|
803
|
+
"type": "array",
|
|
804
|
+
"items": {
|
|
805
|
+
"type": "string",
|
|
806
|
+
"enum": [
|
|
807
|
+
"GET",
|
|
808
|
+
"POST",
|
|
809
|
+
"PUT",
|
|
810
|
+
"DELETE",
|
|
811
|
+
"PATCH",
|
|
812
|
+
"OPTIONS"
|
|
813
|
+
]
|
|
814
|
+
},
|
|
815
|
+
"default": [
|
|
816
|
+
"GET",
|
|
817
|
+
"POST",
|
|
818
|
+
"PUT",
|
|
819
|
+
"DELETE",
|
|
820
|
+
"PATCH",
|
|
821
|
+
"OPTIONS"
|
|
822
|
+
]
|
|
823
|
+
},
|
|
824
|
+
"routes": {
|
|
825
|
+
"type": "array",
|
|
826
|
+
"items": {
|
|
827
|
+
"type": "string"
|
|
828
|
+
},
|
|
829
|
+
"default": [
|
|
830
|
+
"/",
|
|
831
|
+
"/*"
|
|
832
|
+
]
|
|
833
|
+
},
|
|
782
834
|
"upstream": {
|
|
783
835
|
"type": "string"
|
|
784
836
|
},
|
|
@@ -1833,6 +1885,26 @@
|
|
|
1833
1885
|
"customLevels": {
|
|
1834
1886
|
"type": "object",
|
|
1835
1887
|
"additionalProperties": true
|
|
1888
|
+
},
|
|
1889
|
+
"openTelemetryExporter": {
|
|
1890
|
+
"type": "object",
|
|
1891
|
+
"properties": {
|
|
1892
|
+
"protocol": {
|
|
1893
|
+
"type": "string",
|
|
1894
|
+
"enum": [
|
|
1895
|
+
"grpc",
|
|
1896
|
+
"http"
|
|
1897
|
+
]
|
|
1898
|
+
},
|
|
1899
|
+
"url": {
|
|
1900
|
+
"type": "string"
|
|
1901
|
+
}
|
|
1902
|
+
},
|
|
1903
|
+
"required": [
|
|
1904
|
+
"protocol",
|
|
1905
|
+
"url"
|
|
1906
|
+
],
|
|
1907
|
+
"additionalProperties": false
|
|
1836
1908
|
}
|
|
1837
1909
|
},
|
|
1838
1910
|
"default": {},
|