@platformatic/runtime 1.43.0 → 1.45.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/fixtures/configs/monorepo-with-dependencies.json +8 -0
- package/fixtures/management-api/services/service-1/platformatic.json +3 -1
- package/fixtures/management-api/services/service-db/migrations/001.do.sql +4 -0
- package/fixtures/management-api/services/service-db/migrations/001.undo.sql +1 -0
- package/fixtures/management-api/services/service-db/package.json +5 -0
- package/fixtures/management-api/services/service-db/platformatic.db.json +29 -0
- package/fixtures/management-api/services/service-db/plugin.js +12 -0
- package/fixtures/monorepo-with-dependencies/main/clients/service-1/package.json +3 -0
- package/fixtures/monorepo-with-dependencies/main/clients/service-1/schema.json +204 -0
- package/fixtures/monorepo-with-dependencies/main/clients/service-2/package.json +3 -0
- package/fixtures/monorepo-with-dependencies/main/clients/service-2/schema.json +204 -0
- package/fixtures/monorepo-with-dependencies/main/external-service.schema.json +204 -0
- package/fixtures/monorepo-with-dependencies/main/platformatic.json +46 -0
- package/fixtures/monorepo-with-dependencies/service-1/clients/service-2/package.json +3 -0
- package/fixtures/monorepo-with-dependencies/service-1/clients/service-2/schema.json +204 -0
- package/fixtures/monorepo-with-dependencies/service-1/external-service.schema.json +204 -0
- package/fixtures/monorepo-with-dependencies/service-1/platformatic.json +29 -0
- package/fixtures/monorepo-with-dependencies/service-2/platformatic.json +15 -0
- package/lib/api.js +11 -1
- package/lib/config.js +73 -116
- package/lib/management-api.js +12 -0
- package/package.json +10 -10
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://platformatic.dev/schemas/v1.44.0/composer",
|
|
3
|
+
"server": {
|
|
4
|
+
"hostname": "127.0.0.1",
|
|
5
|
+
"port": 0,
|
|
6
|
+
"logger": {
|
|
7
|
+
"level": "info"
|
|
8
|
+
},
|
|
9
|
+
"pluginTimeout": 0
|
|
10
|
+
},
|
|
11
|
+
"composer": {
|
|
12
|
+
"services": [
|
|
13
|
+
{
|
|
14
|
+
"id": "service-1",
|
|
15
|
+
"openapi": {
|
|
16
|
+
"url": "/documentation/json",
|
|
17
|
+
"prefix": "/service-1"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "external-service-1",
|
|
22
|
+
"origin": "http://external-dependency-1",
|
|
23
|
+
"openapi": {
|
|
24
|
+
"file": "./external-service.schema.json",
|
|
25
|
+
"prefix": "/external-service-1"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"clients": [
|
|
31
|
+
{
|
|
32
|
+
"schema": "./clients/service-1/schema.json",
|
|
33
|
+
"serviceId": "service-1",
|
|
34
|
+
"name": "service1",
|
|
35
|
+
"type": "openapi",
|
|
36
|
+
"url": "{PLT_SERVICE1_URL}"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "./clients/service-2",
|
|
40
|
+
"name": "service2",
|
|
41
|
+
"type": "openapi",
|
|
42
|
+
"url": "{PLT_SERVICE2_URL}"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"watch": false
|
|
46
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"version": "8.3.1",
|
|
5
|
+
"title": "@fastify/swagger"
|
|
6
|
+
},
|
|
7
|
+
"components": {
|
|
8
|
+
"schemas": {}
|
|
9
|
+
},
|
|
10
|
+
"paths": {
|
|
11
|
+
"/posts": {
|
|
12
|
+
"get": {
|
|
13
|
+
"responses": {
|
|
14
|
+
"200": {
|
|
15
|
+
"description": "Default Response",
|
|
16
|
+
"content": {
|
|
17
|
+
"application/json": {
|
|
18
|
+
"schema": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"id": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
},
|
|
26
|
+
"name": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"post": {
|
|
38
|
+
"requestBody": {
|
|
39
|
+
"content": {
|
|
40
|
+
"application/json": {
|
|
41
|
+
"schema": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"name": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"responses": {
|
|
53
|
+
"200": {
|
|
54
|
+
"description": "Default Response",
|
|
55
|
+
"content": {
|
|
56
|
+
"application/json": {
|
|
57
|
+
"schema": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"id": {
|
|
61
|
+
"type": "number"
|
|
62
|
+
},
|
|
63
|
+
"name": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"put": {
|
|
74
|
+
"requestBody": {
|
|
75
|
+
"content": {
|
|
76
|
+
"application/json": {
|
|
77
|
+
"schema": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"id": {
|
|
81
|
+
"type": "number"
|
|
82
|
+
},
|
|
83
|
+
"name": {
|
|
84
|
+
"type": "string"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"responses": {
|
|
92
|
+
"200": {
|
|
93
|
+
"description": "Default Response",
|
|
94
|
+
"content": {
|
|
95
|
+
"application/json": {
|
|
96
|
+
"schema": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"id": {
|
|
100
|
+
"type": "number"
|
|
101
|
+
},
|
|
102
|
+
"name": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"/posts/{id}": {
|
|
114
|
+
"get": {
|
|
115
|
+
"responses": {
|
|
116
|
+
"200": {
|
|
117
|
+
"description": "Default Response",
|
|
118
|
+
"content": {
|
|
119
|
+
"application/json": {
|
|
120
|
+
"schema": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"id": {
|
|
124
|
+
"type": "number"
|
|
125
|
+
},
|
|
126
|
+
"name": {
|
|
127
|
+
"type": "string"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"post": {
|
|
137
|
+
"responses": {
|
|
138
|
+
"200": {
|
|
139
|
+
"description": "Default Response",
|
|
140
|
+
"content": {
|
|
141
|
+
"application/json": {
|
|
142
|
+
"schema": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"properties": {
|
|
145
|
+
"id": {
|
|
146
|
+
"type": "number"
|
|
147
|
+
},
|
|
148
|
+
"name": {
|
|
149
|
+
"type": "string"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"put": {
|
|
159
|
+
"responses": {
|
|
160
|
+
"200": {
|
|
161
|
+
"description": "Default Response",
|
|
162
|
+
"content": {
|
|
163
|
+
"application/json": {
|
|
164
|
+
"schema": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"properties": {
|
|
167
|
+
"id": {
|
|
168
|
+
"type": "number"
|
|
169
|
+
},
|
|
170
|
+
"name": {
|
|
171
|
+
"type": "string"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"delete": {
|
|
181
|
+
"responses": {
|
|
182
|
+
"200": {
|
|
183
|
+
"description": "Default Response",
|
|
184
|
+
"content": {
|
|
185
|
+
"application/json": {
|
|
186
|
+
"schema": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"properties": {
|
|
189
|
+
"id": {
|
|
190
|
+
"type": "number"
|
|
191
|
+
},
|
|
192
|
+
"name": {
|
|
193
|
+
"type": "string"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"version": "8.3.1",
|
|
5
|
+
"title": "@fastify/swagger"
|
|
6
|
+
},
|
|
7
|
+
"components": {
|
|
8
|
+
"schemas": {}
|
|
9
|
+
},
|
|
10
|
+
"paths": {
|
|
11
|
+
"/posts": {
|
|
12
|
+
"get": {
|
|
13
|
+
"responses": {
|
|
14
|
+
"200": {
|
|
15
|
+
"description": "Default Response",
|
|
16
|
+
"content": {
|
|
17
|
+
"application/json": {
|
|
18
|
+
"schema": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"id": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
},
|
|
26
|
+
"name": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"post": {
|
|
38
|
+
"requestBody": {
|
|
39
|
+
"content": {
|
|
40
|
+
"application/json": {
|
|
41
|
+
"schema": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"name": {
|
|
45
|
+
"type": "string"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"responses": {
|
|
53
|
+
"200": {
|
|
54
|
+
"description": "Default Response",
|
|
55
|
+
"content": {
|
|
56
|
+
"application/json": {
|
|
57
|
+
"schema": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"id": {
|
|
61
|
+
"type": "number"
|
|
62
|
+
},
|
|
63
|
+
"name": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"put": {
|
|
74
|
+
"requestBody": {
|
|
75
|
+
"content": {
|
|
76
|
+
"application/json": {
|
|
77
|
+
"schema": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"properties": {
|
|
80
|
+
"id": {
|
|
81
|
+
"type": "number"
|
|
82
|
+
},
|
|
83
|
+
"name": {
|
|
84
|
+
"type": "string"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"responses": {
|
|
92
|
+
"200": {
|
|
93
|
+
"description": "Default Response",
|
|
94
|
+
"content": {
|
|
95
|
+
"application/json": {
|
|
96
|
+
"schema": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"id": {
|
|
100
|
+
"type": "number"
|
|
101
|
+
},
|
|
102
|
+
"name": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"/posts/{id}": {
|
|
114
|
+
"get": {
|
|
115
|
+
"responses": {
|
|
116
|
+
"200": {
|
|
117
|
+
"description": "Default Response",
|
|
118
|
+
"content": {
|
|
119
|
+
"application/json": {
|
|
120
|
+
"schema": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"id": {
|
|
124
|
+
"type": "number"
|
|
125
|
+
},
|
|
126
|
+
"name": {
|
|
127
|
+
"type": "string"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"post": {
|
|
137
|
+
"responses": {
|
|
138
|
+
"200": {
|
|
139
|
+
"description": "Default Response",
|
|
140
|
+
"content": {
|
|
141
|
+
"application/json": {
|
|
142
|
+
"schema": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"properties": {
|
|
145
|
+
"id": {
|
|
146
|
+
"type": "number"
|
|
147
|
+
},
|
|
148
|
+
"name": {
|
|
149
|
+
"type": "string"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"put": {
|
|
159
|
+
"responses": {
|
|
160
|
+
"200": {
|
|
161
|
+
"description": "Default Response",
|
|
162
|
+
"content": {
|
|
163
|
+
"application/json": {
|
|
164
|
+
"schema": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"properties": {
|
|
167
|
+
"id": {
|
|
168
|
+
"type": "number"
|
|
169
|
+
},
|
|
170
|
+
"name": {
|
|
171
|
+
"type": "string"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"delete": {
|
|
181
|
+
"responses": {
|
|
182
|
+
"200": {
|
|
183
|
+
"description": "Default Response",
|
|
184
|
+
"content": {
|
|
185
|
+
"application/json": {
|
|
186
|
+
"schema": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"properties": {
|
|
189
|
+
"id": {
|
|
190
|
+
"type": "number"
|
|
191
|
+
},
|
|
192
|
+
"name": {
|
|
193
|
+
"type": "string"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://platformatic.dev/schemas/v1.44.0/service",
|
|
3
|
+
"server": {
|
|
4
|
+
"hostname": "127.0.0.1",
|
|
5
|
+
"port": 0,
|
|
6
|
+
"logger": {
|
|
7
|
+
"level": "info"
|
|
8
|
+
},
|
|
9
|
+
"pluginTimeout": 0
|
|
10
|
+
},
|
|
11
|
+
"service": {
|
|
12
|
+
"openapi": true
|
|
13
|
+
},
|
|
14
|
+
"clients": [
|
|
15
|
+
{
|
|
16
|
+
"schema": "./clients/service-2/schema.json",
|
|
17
|
+
"name": "service2",
|
|
18
|
+
"type": "openapi",
|
|
19
|
+
"serviceId": "service-2"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"schema": "./external-service.schema.json",
|
|
23
|
+
"name": "external-service-1",
|
|
24
|
+
"type": "openapi",
|
|
25
|
+
"url": "http://external-dependency-1"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"watch": false
|
|
29
|
+
}
|
package/lib/api.js
CHANGED
|
@@ -234,8 +234,18 @@ class RuntimeApi {
|
|
|
234
234
|
const status = service.getStatus()
|
|
235
235
|
|
|
236
236
|
const type = service.config?.configType
|
|
237
|
+
const version = service.config?.app?.configManagerConfig.version ?? null
|
|
237
238
|
const { entrypoint, dependencies, localUrl } = service.appConfig
|
|
238
|
-
|
|
239
|
+
|
|
240
|
+
const serviceDetails = {
|
|
241
|
+
id,
|
|
242
|
+
type,
|
|
243
|
+
status,
|
|
244
|
+
version,
|
|
245
|
+
localUrl,
|
|
246
|
+
entrypoint,
|
|
247
|
+
dependencies
|
|
248
|
+
}
|
|
239
249
|
|
|
240
250
|
if (entrypoint) {
|
|
241
251
|
serviceDetails.url = status === 'started' ? service.server.url : null
|