@platformatic/composer 2.47.0 → 2.49.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 +17 -0
- package/lib/proxy.js +23 -4
- package/lib/schema.js +32 -3
- package/lib/stackable.js +1 -1
- package/package.json +12 -11
- package/schema.json +53 -2
package/config.d.ts
CHANGED
|
@@ -229,8 +229,25 @@ export interface PlatformaticComposer {
|
|
|
229
229
|
proxy?:
|
|
230
230
|
| false
|
|
231
231
|
| {
|
|
232
|
+
upstream?: string;
|
|
232
233
|
prefix?: string;
|
|
233
234
|
hostname?: string;
|
|
235
|
+
ws?: {
|
|
236
|
+
upstream?: string;
|
|
237
|
+
reconnect?: {
|
|
238
|
+
pingInterval?: number;
|
|
239
|
+
maxReconnectionRetries?: number;
|
|
240
|
+
reconnectInterval?: number;
|
|
241
|
+
reconnectDecay?: number;
|
|
242
|
+
connectionTimeout?: number;
|
|
243
|
+
reconnectOnClose?: boolean;
|
|
244
|
+
logs?: boolean;
|
|
245
|
+
[k: string]: unknown;
|
|
246
|
+
};
|
|
247
|
+
hooks?: {
|
|
248
|
+
path: string;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
234
251
|
};
|
|
235
252
|
}[];
|
|
236
253
|
openapi?: {
|
package/lib/proxy.js
CHANGED
|
@@ -34,6 +34,11 @@ async function resolveServiceProxyParameters (service) {
|
|
|
34
34
|
internalRewriteLocationHeader = false
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
if (service.proxy?.ws?.hooks) {
|
|
38
|
+
const hooks = require(service.proxy.ws.hooks.path)
|
|
39
|
+
service.proxy.ws.hooks = hooks
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
return {
|
|
38
43
|
origin: service.origin,
|
|
39
44
|
url: meta.url,
|
|
@@ -41,7 +46,9 @@ async function resolveServiceProxyParameters (service) {
|
|
|
41
46
|
rewritePrefix,
|
|
42
47
|
internalRewriteLocationHeader,
|
|
43
48
|
needsRootRedirect: meta.needsRootRedirect,
|
|
44
|
-
needsRefererBasedRedirect: meta.needsRefererBasedRedirect
|
|
49
|
+
needsRefererBasedRedirect: meta.needsRefererBasedRedirect,
|
|
50
|
+
upstream: service.proxy?.upstream,
|
|
51
|
+
ws: service.proxy?.ws
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
|
|
@@ -66,7 +73,8 @@ module.exports = fp(async function (app, opts) {
|
|
|
66
73
|
rewritePrefix,
|
|
67
74
|
internalRewriteLocationHeader,
|
|
68
75
|
needsRootRedirect,
|
|
69
|
-
needsRefererBasedRedirect
|
|
76
|
+
needsRefererBasedRedirect,
|
|
77
|
+
ws
|
|
70
78
|
} = parameters
|
|
71
79
|
meta.proxies[service.id] = parameters
|
|
72
80
|
|
|
@@ -159,8 +167,19 @@ module.exports = fp(async function (app, opts) {
|
|
|
159
167
|
websocket: true,
|
|
160
168
|
prefix,
|
|
161
169
|
rewritePrefix,
|
|
162
|
-
upstream: origin,
|
|
163
|
-
|
|
170
|
+
upstream: service.proxy?.upstream ?? origin,
|
|
171
|
+
|
|
172
|
+
wsUpstream: ws?.upstream ?? url ?? origin,
|
|
173
|
+
wsReconnect: ws?.reconnect,
|
|
174
|
+
wsHooks: {
|
|
175
|
+
onConnect: ws?.hooks?.onConnect,
|
|
176
|
+
onDisconnect: ws?.hooks?.onDisconnect,
|
|
177
|
+
onReconnect: ws?.hooks?.onReconnect,
|
|
178
|
+
onPong: ws?.hooks?.onPong,
|
|
179
|
+
onIncomingMessage: ws?.hooks?.onIncomingMessage,
|
|
180
|
+
onOutgoingMessage: ws?.hooks?.onOutgoingMessage
|
|
181
|
+
},
|
|
182
|
+
|
|
164
183
|
undici: dispatcher,
|
|
165
184
|
destroyAgent: false,
|
|
166
185
|
config: {
|
package/lib/schema.js
CHANGED
|
@@ -121,18 +121,47 @@ const composer = {
|
|
|
121
121
|
openapi: openApiService,
|
|
122
122
|
graphql: graphqlService,
|
|
123
123
|
proxy: {
|
|
124
|
-
|
|
124
|
+
anyOf: [
|
|
125
125
|
{ type: 'boolean', const: false },
|
|
126
126
|
{
|
|
127
127
|
type: 'object',
|
|
128
128
|
properties: {
|
|
129
|
+
upstream: { type: 'string' },
|
|
129
130
|
prefix: { type: 'string' },
|
|
130
|
-
hostname: { type: 'string' }
|
|
131
|
+
hostname: { type: 'string' },
|
|
132
|
+
ws: {
|
|
133
|
+
type: 'object',
|
|
134
|
+
properties: {
|
|
135
|
+
upstream: { type: 'string' },
|
|
136
|
+
reconnect: {
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {
|
|
139
|
+
pingInterval: { type: 'number' },
|
|
140
|
+
maxReconnectionRetries: { type: 'number' },
|
|
141
|
+
reconnectInterval: { type: 'number' },
|
|
142
|
+
reconnectDecay: { type: 'number' },
|
|
143
|
+
connectionTimeout: { type: 'number' },
|
|
144
|
+
reconnectOnClose: { type: 'boolean' },
|
|
145
|
+
logs: { type: 'boolean' },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
hooks: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
properties: {
|
|
151
|
+
path: { type: 'string' }
|
|
152
|
+
},
|
|
153
|
+
required: ['path'],
|
|
154
|
+
additionalProperties: false
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
required: [],
|
|
158
|
+
additionalProperties: false
|
|
159
|
+
},
|
|
131
160
|
},
|
|
132
161
|
required: [],
|
|
133
162
|
additionalProperties: false
|
|
134
163
|
}
|
|
135
|
-
]
|
|
164
|
+
],
|
|
136
165
|
}
|
|
137
166
|
},
|
|
138
167
|
required: ['id'],
|
package/lib/stackable.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/composer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.49.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"json-schema-to-typescript": "^15.0.0",
|
|
25
25
|
"neostandard": "^0.12.0",
|
|
26
26
|
"openapi-schema-validator": "^12.1.3",
|
|
27
|
+
"pino-test": "^1.0.1",
|
|
27
28
|
"self-cert": "^2.0.0",
|
|
28
29
|
"single-user-cache": "^1.0.1",
|
|
29
30
|
"split2": "^4.2.0",
|
|
@@ -31,13 +32,13 @@
|
|
|
31
32
|
"typescript": "^5.5.4",
|
|
32
33
|
"why-is-node-running": "2",
|
|
33
34
|
"ws": "^8.16.0",
|
|
34
|
-
"@platformatic/
|
|
35
|
-
"@platformatic/
|
|
36
|
-
"@platformatic/
|
|
35
|
+
"@platformatic/client": "2.49.0",
|
|
36
|
+
"@platformatic/db": "2.49.0",
|
|
37
|
+
"@platformatic/config": "2.49.0"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@fastify/error": "^4.0.0",
|
|
40
|
-
"@fastify/http-proxy": "^11.
|
|
41
|
+
"@fastify/http-proxy": "^11.1.1",
|
|
41
42
|
"@fastify/reply-from": "^12.0.0",
|
|
42
43
|
"@fastify/static": "^8.0.0",
|
|
43
44
|
"@fastify/swagger": "^9.0.0",
|
|
@@ -67,12 +68,12 @@
|
|
|
67
68
|
"rfdc": "^1.3.1",
|
|
68
69
|
"semgrator": "^0.3.0",
|
|
69
70
|
"undici": "^7.0.0",
|
|
70
|
-
"@platformatic/config": "2.
|
|
71
|
-
"@platformatic/
|
|
72
|
-
"@platformatic/
|
|
73
|
-
"@platformatic/
|
|
74
|
-
"@platformatic/
|
|
75
|
-
"@platformatic/
|
|
71
|
+
"@platformatic/config": "2.49.0",
|
|
72
|
+
"@platformatic/generators": "2.49.0",
|
|
73
|
+
"@platformatic/service": "2.49.0",
|
|
74
|
+
"@platformatic/telemetry": "2.49.0",
|
|
75
|
+
"@platformatic/scalar-theme": "2.49.0",
|
|
76
|
+
"@platformatic/utils": "^2.49.0"
|
|
76
77
|
},
|
|
77
78
|
"scripts": {
|
|
78
79
|
"test": "pnpm run lint && borp -T --timeout=300000 -c 1 && tsd",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/composer/2.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/composer/2.49.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Composer",
|
|
5
5
|
"type": "object",
|
|
@@ -717,7 +717,7 @@
|
|
|
717
717
|
]
|
|
718
718
|
},
|
|
719
719
|
"proxy": {
|
|
720
|
-
"
|
|
720
|
+
"anyOf": [
|
|
721
721
|
{
|
|
722
722
|
"type": "boolean",
|
|
723
723
|
"const": false
|
|
@@ -725,11 +725,62 @@
|
|
|
725
725
|
{
|
|
726
726
|
"type": "object",
|
|
727
727
|
"properties": {
|
|
728
|
+
"upstream": {
|
|
729
|
+
"type": "string"
|
|
730
|
+
},
|
|
728
731
|
"prefix": {
|
|
729
732
|
"type": "string"
|
|
730
733
|
},
|
|
731
734
|
"hostname": {
|
|
732
735
|
"type": "string"
|
|
736
|
+
},
|
|
737
|
+
"ws": {
|
|
738
|
+
"type": "object",
|
|
739
|
+
"properties": {
|
|
740
|
+
"upstream": {
|
|
741
|
+
"type": "string"
|
|
742
|
+
},
|
|
743
|
+
"reconnect": {
|
|
744
|
+
"type": "object",
|
|
745
|
+
"properties": {
|
|
746
|
+
"pingInterval": {
|
|
747
|
+
"type": "number"
|
|
748
|
+
},
|
|
749
|
+
"maxReconnectionRetries": {
|
|
750
|
+
"type": "number"
|
|
751
|
+
},
|
|
752
|
+
"reconnectInterval": {
|
|
753
|
+
"type": "number"
|
|
754
|
+
},
|
|
755
|
+
"reconnectDecay": {
|
|
756
|
+
"type": "number"
|
|
757
|
+
},
|
|
758
|
+
"connectionTimeout": {
|
|
759
|
+
"type": "number"
|
|
760
|
+
},
|
|
761
|
+
"reconnectOnClose": {
|
|
762
|
+
"type": "boolean"
|
|
763
|
+
},
|
|
764
|
+
"logs": {
|
|
765
|
+
"type": "boolean"
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
"hooks": {
|
|
770
|
+
"type": "object",
|
|
771
|
+
"properties": {
|
|
772
|
+
"path": {
|
|
773
|
+
"type": "string"
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
"required": [
|
|
777
|
+
"path"
|
|
778
|
+
],
|
|
779
|
+
"additionalProperties": false
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
"required": [],
|
|
783
|
+
"additionalProperties": false
|
|
733
784
|
}
|
|
734
785
|
},
|
|
735
786
|
"required": [],
|