@platformatic/gateway 3.38.1 → 3.40.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 +16 -0
- package/lib/proxy.js +6 -0
- package/lib/schema.js +11 -0
- package/package.json +8 -8
- package/schema.json +119 -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?: {
|
|
@@ -594,6 +604,12 @@ export interface PlatformaticGatewayConfig {
|
|
|
594
604
|
*/
|
|
595
605
|
socket?: string;
|
|
596
606
|
};
|
|
607
|
+
management?:
|
|
608
|
+
| boolean
|
|
609
|
+
| {
|
|
610
|
+
enabled?: boolean;
|
|
611
|
+
operations?: string[];
|
|
612
|
+
};
|
|
597
613
|
metrics?:
|
|
598
614
|
| boolean
|
|
599
615
|
| {
|
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.40.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.40.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/scalar-theme": "3.
|
|
69
|
-
"@platformatic/
|
|
70
|
-
"@platformatic/
|
|
66
|
+
"@platformatic/basic": "3.40.0",
|
|
67
|
+
"@platformatic/foundation": "^3.40.0",
|
|
68
|
+
"@platformatic/scalar-theme": "3.40.0",
|
|
69
|
+
"@platformatic/telemetry": "3.40.0",
|
|
70
|
+
"@platformatic/service": "3.40.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.40.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
|
},
|
|
@@ -1614,6 +1666,29 @@
|
|
|
1614
1666
|
"additionalProperties": false
|
|
1615
1667
|
}
|
|
1616
1668
|
]
|
|
1669
|
+
},
|
|
1670
|
+
"management": {
|
|
1671
|
+
"anyOf": [
|
|
1672
|
+
{
|
|
1673
|
+
"type": "boolean"
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
"type": "object",
|
|
1677
|
+
"properties": {
|
|
1678
|
+
"enabled": {
|
|
1679
|
+
"type": "boolean",
|
|
1680
|
+
"default": true
|
|
1681
|
+
},
|
|
1682
|
+
"operations": {
|
|
1683
|
+
"type": "array",
|
|
1684
|
+
"items": {
|
|
1685
|
+
"type": "string"
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
"additionalProperties": false
|
|
1690
|
+
}
|
|
1691
|
+
]
|
|
1617
1692
|
}
|
|
1618
1693
|
}
|
|
1619
1694
|
}
|
|
@@ -1833,6 +1908,26 @@
|
|
|
1833
1908
|
"customLevels": {
|
|
1834
1909
|
"type": "object",
|
|
1835
1910
|
"additionalProperties": true
|
|
1911
|
+
},
|
|
1912
|
+
"openTelemetryExporter": {
|
|
1913
|
+
"type": "object",
|
|
1914
|
+
"properties": {
|
|
1915
|
+
"protocol": {
|
|
1916
|
+
"type": "string",
|
|
1917
|
+
"enum": [
|
|
1918
|
+
"grpc",
|
|
1919
|
+
"http"
|
|
1920
|
+
]
|
|
1921
|
+
},
|
|
1922
|
+
"url": {
|
|
1923
|
+
"type": "string"
|
|
1924
|
+
}
|
|
1925
|
+
},
|
|
1926
|
+
"required": [
|
|
1927
|
+
"protocol",
|
|
1928
|
+
"url"
|
|
1929
|
+
],
|
|
1930
|
+
"additionalProperties": false
|
|
1836
1931
|
}
|
|
1837
1932
|
},
|
|
1838
1933
|
"default": {},
|
|
@@ -2333,6 +2428,29 @@
|
|
|
2333
2428
|
],
|
|
2334
2429
|
"default": true
|
|
2335
2430
|
},
|
|
2431
|
+
"management": {
|
|
2432
|
+
"anyOf": [
|
|
2433
|
+
{
|
|
2434
|
+
"type": "boolean"
|
|
2435
|
+
},
|
|
2436
|
+
{
|
|
2437
|
+
"type": "object",
|
|
2438
|
+
"properties": {
|
|
2439
|
+
"enabled": {
|
|
2440
|
+
"type": "boolean",
|
|
2441
|
+
"default": true
|
|
2442
|
+
},
|
|
2443
|
+
"operations": {
|
|
2444
|
+
"type": "array",
|
|
2445
|
+
"items": {
|
|
2446
|
+
"type": "string"
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
},
|
|
2450
|
+
"additionalProperties": false
|
|
2451
|
+
}
|
|
2452
|
+
]
|
|
2453
|
+
},
|
|
2336
2454
|
"metrics": {
|
|
2337
2455
|
"anyOf": [
|
|
2338
2456
|
{
|