@platformatic/service 0.27.0 → 0.29.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/hello/platformatic.service.json +1 -2
- package/fixtures/hello/warn-log.service.json +1 -2
- package/fixtures/hello-client/platformatic.service.json +2 -3
- package/fixtures/hello-client-ts/platformatic.service.json +2 -3
- package/fixtures/hello-client-ts-without-deps/hello.d.ts +34 -0
- package/fixtures/hello-client-ts-without-deps/hello.openapi.json +22 -0
- package/fixtures/hello-client-ts-without-deps/platformatic.service.json +23 -0
- package/fixtures/hello-client-ts-without-deps/plugin.ts +8 -0
- package/fixtures/hello-client-ts-without-deps/tsconfig.json +22 -0
- package/fixtures/hello-client-without-deps/hello.d.ts +34 -0
- package/fixtures/hello-client-without-deps/hello.openapi.json +22 -0
- package/fixtures/hello-client-without-deps/platformatic.service.json +21 -0
- package/fixtures/hello-client-without-deps/plugin.js +8 -0
- package/help/compile.txt +2 -1
- package/index.d.ts +17 -11
- package/index.js +4 -21
- package/index.test-d.ts +14 -22
- package/lib/compile.js +0 -26
- package/lib/load-config.js +1 -2
- package/lib/plugins/clients.js +7 -3
- package/lib/plugins/plugins.js +17 -33
- package/lib/plugins/typescript.js +1 -31
- package/lib/root-endpoint/public/background_frame.svg +614 -0
- package/lib/root-endpoint/public/background_polygon_14.svg +3 -0
- package/lib/root-endpoint/public/background_polygon_28.svg +3 -0
- package/lib/root-endpoint/public/dark_mode.svg +3 -0
- package/lib/root-endpoint/public/index.html +164 -35
- package/lib/root-endpoint/public/light_mode.svg +11 -0
- package/lib/root-endpoint/public/platformatic-logo-dark.svg +8 -0
- package/lib/root-endpoint/public/platformatic-logo-light.svg +8 -0
- package/lib/schema.js +28 -14
- package/lib/start.js +2 -23
- package/package.json +17 -9
- package/test/autoload.test.js +0 -182
- package/test/cli/compile.test.mjs +98 -1
- package/test/clients.test.js +53 -0
- package/test/fixtures/bad-typescript-plugin/platformatic.service.json +1 -1
- package/test/fixtures/typescript-plugin-nocompile-string/platformatic.service.json +16 -0
- package/test/fixtures/typescript-plugin-nocompile-string/plugin.ts +5 -0
- package/test/fixtures/typescript-plugin-nocompile-string/tsconfig.json +22 -0
- package/test/fixtures/typescript-plugin-string/platformatic.service.json +16 -0
- package/test/fixtures/typescript-plugin-string/plugin.ts +5 -0
- package/test/fixtures/typescript-plugin-string/tsconfig.json +22 -0
- package/test/load-and-reload-files.test.js +7 -278
- package/tsconfig.json +12 -0
- package/lib/plugins/file-watcher.js +0 -44
- package/lib/root-endpoint/public/logo-512x512.png +0 -0
- package/test/cli/watch.test.mjs +0 -289
- package/test/watch.test.js +0 -248
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="832" height="868" viewBox="0 0 832 868" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path opacity="0.05" d="M336.903 6.9095L746.07 152.023L824.982 578.928L494.727 860.721L85.5601 715.608L6.648 288.702L336.903 6.9095Z" stroke="#21FA90" stroke-width="12"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M5.38034 22.9538C3.01077 12.1815 12.2916 6.49615 17.2282 5C14.7599 8.49103 11.3043 16.9692 17.2282 22.9538C23.1521 28.9385 31.5444 25.4474 35 22.9538C33.8152 32.5292 25.6205 34.9231 21.6712 34.9231C17.2282 35.4218 7.74991 33.7262 5.38034 22.9538Z" stroke="#00283D" stroke-width="2" stroke-linejoin="round"/>
|
|
3
|
+
</svg>
|
|
@@ -3,19 +3,37 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/images/favicon.ico" />
|
|
6
|
+
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800&display=swap" rel="stylesheet">
|
|
6
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Platformatic
|
|
8
|
+
<title>Platformatic Service</title>
|
|
8
9
|
<style>
|
|
9
|
-
|
|
10
|
+
body {
|
|
10
11
|
width: 100%;
|
|
11
|
-
|
|
12
|
+
height: 100vh;
|
|
13
|
+
overflow-y: hidden;
|
|
14
|
+
--text-color: #FFFFFF;
|
|
15
|
+
--bg-color: #001825;
|
|
16
|
+
--theme-img: url('./light_mode.svg')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
body.light-theme {
|
|
20
|
+
--text-color: #001825;
|
|
21
|
+
--bg-color: #FFFFFF;
|
|
22
|
+
--theme-img: url('./dark_mode.svg')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
background: var(--bg-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:root {
|
|
30
|
+
font-family: Montserrat, Inter, Avenir, Helvetica, Arial, sans-serif;
|
|
12
31
|
font-size: 16px;
|
|
13
32
|
line-height: 24px;
|
|
14
33
|
font-weight: 400;
|
|
15
34
|
|
|
16
35
|
color-scheme: light dark;
|
|
17
|
-
color:
|
|
18
|
-
background-color: #092339;
|
|
36
|
+
color: inherit;
|
|
19
37
|
|
|
20
38
|
font-synthesis: none;
|
|
21
39
|
text-rendering: optimizeLegibility;
|
|
@@ -24,29 +42,49 @@
|
|
|
24
42
|
-webkit-text-size-adjust: 100%;
|
|
25
43
|
}
|
|
26
44
|
|
|
45
|
+
|
|
27
46
|
a {
|
|
28
|
-
font-weight:
|
|
29
|
-
color:
|
|
47
|
+
font-weight: 600;
|
|
48
|
+
color: var(--text-color);
|
|
30
49
|
text-decoration: inherit;
|
|
50
|
+
width: 100%;
|
|
51
|
+
text-align: center;
|
|
52
|
+
padding: 4px 0px;
|
|
31
53
|
}
|
|
32
54
|
a:hover {
|
|
33
|
-
|
|
55
|
+
text-decoration: underline;
|
|
34
56
|
}
|
|
35
57
|
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
h1 {
|
|
59
|
+
font-size: 4.375rem;
|
|
60
|
+
line-height: 5rem;
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
margin: 2rem 0;
|
|
63
|
+
}
|
|
64
|
+
h2, h1 {
|
|
65
|
+
color: var(--text-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.text-main-green {
|
|
69
|
+
color: #21FA90;
|
|
70
|
+
}
|
|
71
|
+
.text-center {
|
|
72
|
+
text-align: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.button-container {
|
|
38
76
|
display: flex;
|
|
39
|
-
|
|
77
|
+
column-gap: 3rem;
|
|
40
78
|
justify-content: center;
|
|
41
|
-
|
|
42
|
-
margin:
|
|
43
|
-
min-height: 100vh;
|
|
79
|
+
align-items: center;
|
|
80
|
+
margin: 2rem 0;
|
|
44
81
|
}
|
|
45
82
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
83
|
+
.button-link {
|
|
84
|
+
width: 250px;
|
|
85
|
+
border: 1px solid var(--text-color);
|
|
86
|
+
border-radius: 2px;
|
|
87
|
+
}
|
|
50
88
|
|
|
51
89
|
button {
|
|
52
90
|
border-radius: 8px;
|
|
@@ -67,35 +105,108 @@
|
|
|
67
105
|
outline: 4px auto -webkit-focus-ring-color;
|
|
68
106
|
}
|
|
69
107
|
|
|
70
|
-
|
|
71
|
-
:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
button {
|
|
79
|
-
background-color: #f9f9f9;
|
|
80
|
-
}
|
|
108
|
+
#root {
|
|
109
|
+
width: 100%;
|
|
110
|
+
min-height: inherit;
|
|
111
|
+
height: 100%;
|
|
112
|
+
display: flex;
|
|
113
|
+
position: relative;
|
|
114
|
+
z-index: 20;
|
|
81
115
|
}
|
|
82
116
|
|
|
83
|
-
#
|
|
117
|
+
#content {
|
|
84
118
|
display: flex;
|
|
85
119
|
flex-direction: column;
|
|
86
120
|
align-items: center;
|
|
87
121
|
justify-content: center;
|
|
122
|
+
margin: auto;
|
|
123
|
+
position: relative;
|
|
124
|
+
z-index: 20;
|
|
88
125
|
}
|
|
89
126
|
|
|
127
|
+
.polygon14 {
|
|
128
|
+
background-image: url("background_polygon_14.svg");
|
|
129
|
+
background-repeat: no-repeat;
|
|
130
|
+
position: fixed;
|
|
131
|
+
height: 868px;
|
|
132
|
+
width: 832px;
|
|
133
|
+
transform-origin: center;
|
|
134
|
+
animation: rotationClockwise 15s infinite linear;
|
|
135
|
+
z-index: 0;
|
|
136
|
+
bottom: -40%;
|
|
137
|
+
left: -10%;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.polygon28 {
|
|
141
|
+
background-image: url("background_polygon_28.svg");
|
|
142
|
+
background-repeat: no-repeat;
|
|
143
|
+
position: absolute;
|
|
144
|
+
height: 212px;
|
|
145
|
+
width: 246px;
|
|
146
|
+
transform-origin: 123px 106px;
|
|
147
|
+
animation: rotationAntiClockwise 15s infinite linear;
|
|
148
|
+
z-index: 0;
|
|
149
|
+
top: 20vH;
|
|
150
|
+
left: 10%;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.topFrame {
|
|
154
|
+
position: absolute;
|
|
155
|
+
top: 0;
|
|
156
|
+
right: 0;
|
|
157
|
+
width: 50vw;
|
|
158
|
+
height: auto;
|
|
159
|
+
z-index: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
#button-theme-selector {
|
|
163
|
+
border: none;
|
|
164
|
+
position: absolute;
|
|
165
|
+
top: 2rem;
|
|
166
|
+
right: 3rem;
|
|
167
|
+
width: 40px;
|
|
168
|
+
height: 40px;
|
|
169
|
+
background: var(--theme-img);
|
|
170
|
+
outline: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
@keyframes rotationClockwise {
|
|
175
|
+
from {
|
|
176
|
+
transform: rotate(0deg);
|
|
177
|
+
}
|
|
178
|
+
to {
|
|
179
|
+
transform: rotate(359deg);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@keyframes rotationAntiClockwise {
|
|
184
|
+
from {
|
|
185
|
+
transform: rotate(-0deg);
|
|
186
|
+
}
|
|
187
|
+
to {
|
|
188
|
+
transform: rotate(-359deg);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
90
191
|
</style>
|
|
91
192
|
</head>
|
|
92
193
|
<body>
|
|
93
194
|
<div id="root">
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
|
|
195
|
+
<div class="polygon14"></div>
|
|
196
|
+
<div class="polygon28"></div>
|
|
197
|
+
<img class="topFrame" src="background_frame.svg" />
|
|
198
|
+
<button id="button-theme-selector" type="button" class="theme-selector" alt="theme selector" onclick="toggleLightMode()"></button>
|
|
199
|
+
|
|
200
|
+
<div id="content">
|
|
201
|
+
<img id="logo" height="256" />
|
|
202
|
+
<h1 class="text-center"><span>Welcome to</span><br/><span class="text-main-green">Platformatic Service</span></h1>
|
|
203
|
+
<h2 class="text-center">Explore our flexible toolkit for building robust APIs.</h2>
|
|
204
|
+
<div class="button-container">
|
|
205
|
+
<a href="https://oss.platformatic.dev" target="_blank" class="button-link">Documentation</a>
|
|
206
|
+
<a id="openapi-link" target="_blank" class="button-link">OpenAPI Documentation</a>
|
|
207
|
+
<a id="graphql-link" target="_blank" class="button-link">GraphiQL</a>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
99
210
|
</div>
|
|
100
211
|
|
|
101
212
|
<script>
|
|
@@ -106,6 +217,24 @@
|
|
|
106
217
|
|
|
107
218
|
const graphqlLink = document.getElementById('graphql-link')
|
|
108
219
|
graphqlLink.href = currentPath + 'graphiql'
|
|
220
|
+
|
|
221
|
+
const prefersLightScheme = window.matchMedia('(prefers-color-scheme: light)');
|
|
222
|
+
if (prefersLightScheme.matches) {
|
|
223
|
+
document.body.classList.add('light-theme');
|
|
224
|
+
document.getElementById('logo').src = 'platformatic-logo-light.svg'
|
|
225
|
+
} else {
|
|
226
|
+
document.body.classList.remove('light-theme');
|
|
227
|
+
document.getElementById('logo').src = 'platformatic-logo-dark.svg'
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const toggleLightMode = function() {
|
|
231
|
+
document.body.classList.toggle('light-theme');
|
|
232
|
+
if (document.body.classList.contains('light-theme')) {
|
|
233
|
+
document.getElementById('logo').src = 'platformatic-logo-light.svg'
|
|
234
|
+
} else {
|
|
235
|
+
document.getElementById('logo').src = 'platformatic-logo-dark.svg'
|
|
236
|
+
}
|
|
237
|
+
}
|
|
109
238
|
</script>
|
|
110
239
|
</body>
|
|
111
240
|
</html>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M26 13L31 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M9 8L14 13" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M14 28L9 33" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M31 33L26 28" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<path d="M10.0713 20L5 20" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
<circle cx="20.0713" cy="20" r="6" stroke="white" stroke-width="2"/>
|
|
8
|
+
<path d="M30.0712 20.0001L35 20" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9
|
+
<path d="M20 29.9287L20 34.9999" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
10
|
+
<path d="M20.0001 9.92876L20 4.99999" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="383" height="306" viewBox="0 0 383 306" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M108.854 224.267H323.497V224.199C331.631 223.82 339.576 221.624 346.748 217.771C353.919 213.918 360.134 208.508 364.935 201.938C369.735 195.367 372.999 187.805 374.487 179.808C375.974 171.811 375.646 163.582 373.528 155.728C371.41 147.874 367.555 140.594 362.247 134.426C356.939 128.257 350.314 123.357 342.859 120.085C335.404 116.814 327.309 115.254 319.171 115.522C311.032 115.79 303.058 117.878 295.834 121.632C291.376 111.352 284.629 102.223 276.107 94.94C267.584 87.6573 257.51 82.4129 246.653 79.606M62.8089 79.606C47.0036 83.6771 33.0019 92.8821 23.007 105.773C13.0121 118.663 7.59128 134.508 7.59757 150.813C7.60386 167.118 13.0369 182.958 23.0417 195.841C33.0466 208.724 47.0554 217.918 62.8638 221.977" stroke="white" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M147.719 124.69L119.082 134.743L131.684 161.444" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M119.727 135.216C132.785 142.886 148.015 146.031 163.047 144.161C178.08 142.291 192.072 135.51 202.848 124.875C213.624 114.239 220.58 100.344 222.632 85.3505C224.685 70.3574 221.721 55.1069 214.2 41.971C206.678 28.8352 195.023 18.5504 181.045 12.7164C167.067 6.88249 151.552 5.82641 136.911 9.71246C122.27 13.5985 109.326 22.2088 100.09 34.2042C90.8552 46.1995 85.8471 60.9074 85.8452 76.0401V178.408" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path opacity="0.2" d="M85.8452 286.631V298.589" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<path opacity="0.4" d="M85.955 249V267.891" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
<path opacity="0.7" d="M85.8452 197.861V229.444" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg width="383" height="306" viewBox="0 0 383 306" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M108.854 224.267H323.497V224.199C331.631 223.82 339.576 221.623 346.748 217.771C353.919 213.918 360.134 208.507 364.935 201.937C369.735 195.367 372.999 187.805 374.487 179.808C375.974 171.81 375.646 163.582 373.528 155.728C371.41 147.874 367.555 140.594 362.247 134.426C356.939 128.257 350.314 123.357 342.859 120.085C335.404 116.813 327.309 115.254 319.171 115.522C311.032 115.79 303.058 117.878 295.834 121.632C291.376 111.352 284.629 102.222 276.107 94.9397C267.584 87.657 257.51 82.4126 246.653 79.6057M62.8089 79.6057C47.0036 83.6768 33.0019 92.8819 23.007 105.772C13.0121 118.663 7.59128 134.507 7.59757 150.813C7.60386 167.118 13.0369 182.958 23.0417 195.841C33.0466 208.724 47.0554 217.918 62.8638 221.977" stroke="#00283D" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M147.719 124.69L119.082 134.743L131.684 161.444" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M119.727 135.216C132.785 142.886 148.015 146.031 163.047 144.161C178.08 142.291 192.072 135.51 202.848 124.875C213.624 114.239 220.58 100.344 222.632 85.3505C224.685 70.3574 221.721 55.1068 214.2 41.971C206.678 28.8351 195.023 18.5503 181.045 12.7164C167.067 6.88243 151.552 5.82634 136.911 9.7124C122.27 13.5985 109.326 22.2088 100.09 34.2041C90.8552 46.1995 85.8471 60.9073 85.8452 76.04V178.408" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path opacity="0.2" d="M85.8452 286.631V298.589" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<path opacity="0.4" d="M85.955 249V267.891" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
<path opacity="0.7" d="M85.8452 197.861V229.444" stroke="#21FA90" stroke-width="14.1463" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
+
</svg>
|
package/lib/schema.js
CHANGED
|
@@ -390,14 +390,11 @@ const plugins = {
|
|
|
390
390
|
type: 'integer'
|
|
391
391
|
},
|
|
392
392
|
typescript: {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
hotReload: {
|
|
399
|
-
type: 'boolean',
|
|
400
|
-
default: true
|
|
393
|
+
anyOf: [{
|
|
394
|
+
type: 'boolean'
|
|
395
|
+
}, {
|
|
396
|
+
type: 'string'
|
|
397
|
+
}]
|
|
401
398
|
}
|
|
402
399
|
},
|
|
403
400
|
additionalProperties: false,
|
|
@@ -410,7 +407,12 @@ const metrics = {
|
|
|
410
407
|
{
|
|
411
408
|
type: 'object',
|
|
412
409
|
properties: {
|
|
413
|
-
port: {
|
|
410
|
+
port: {
|
|
411
|
+
anyOf: [
|
|
412
|
+
{ type: 'integer' },
|
|
413
|
+
{ type: 'string' }
|
|
414
|
+
]
|
|
415
|
+
},
|
|
414
416
|
hostname: { type: 'string' },
|
|
415
417
|
auth: {
|
|
416
418
|
type: 'object',
|
|
@@ -519,16 +521,29 @@ const clients = {
|
|
|
519
521
|
items: {
|
|
520
522
|
type: 'object',
|
|
521
523
|
properties: {
|
|
524
|
+
serviceId: {
|
|
525
|
+
type: 'string'
|
|
526
|
+
},
|
|
527
|
+
name: {
|
|
528
|
+
type: 'string'
|
|
529
|
+
},
|
|
530
|
+
type: {
|
|
531
|
+
type: 'string',
|
|
532
|
+
enum: ['openapi', 'graphql']
|
|
533
|
+
},
|
|
522
534
|
path: {
|
|
523
535
|
type: 'string',
|
|
524
536
|
resolvePath: true
|
|
525
537
|
},
|
|
538
|
+
schema: {
|
|
539
|
+
type: 'string',
|
|
540
|
+
resolvePath: true
|
|
541
|
+
},
|
|
526
542
|
url: {
|
|
527
543
|
type: 'string'
|
|
528
544
|
}
|
|
529
545
|
},
|
|
530
|
-
additionalProperties: false
|
|
531
|
-
required: ['path', 'url']
|
|
546
|
+
additionalProperties: false
|
|
532
547
|
}
|
|
533
548
|
}
|
|
534
549
|
|
|
@@ -542,11 +557,10 @@ const platformaticServiceSchema = {
|
|
|
542
557
|
watch: {
|
|
543
558
|
anyOf: [watch, {
|
|
544
559
|
type: 'boolean'
|
|
560
|
+
}, {
|
|
561
|
+
type: 'string'
|
|
545
562
|
}]
|
|
546
563
|
},
|
|
547
|
-
hotReload: {
|
|
548
|
-
type: 'boolean'
|
|
549
|
-
},
|
|
550
564
|
$schema: {
|
|
551
565
|
type: 'string'
|
|
552
566
|
},
|
package/lib/start.js
CHANGED
|
@@ -69,27 +69,6 @@ async function buildServer (options, app) {
|
|
|
69
69
|
|
|
70
70
|
const handler = await restartable(createRestartable)
|
|
71
71
|
|
|
72
|
-
configManager.on('update', async (newConfig) => {
|
|
73
|
-
handler.log.debug('config changed')
|
|
74
|
-
handler.log.trace({ newConfig }, 'new config')
|
|
75
|
-
|
|
76
|
-
if (newConfig.watch === false) {
|
|
77
|
-
/* c8 ignore next 4 */
|
|
78
|
-
if (handler.tsCompilerWatcher) {
|
|
79
|
-
handler.tsCompilerWatcher.kill('SIGTERM')
|
|
80
|
-
handler.log.debug('stop watching typescript files')
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (handler.fileWatcher) {
|
|
84
|
-
await handler.fileWatcher.stopWatching()
|
|
85
|
-
handler.log.debug('stop watching files')
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
await safeRestart(handler)
|
|
90
|
-
/* c8 ignore next 1 */
|
|
91
|
-
})
|
|
92
|
-
|
|
93
72
|
configManager.on('error', function (err) {
|
|
94
73
|
/* c8 ignore next 1 */
|
|
95
74
|
handler.log.error({ err }, 'error reloading the configuration')
|
|
@@ -103,10 +82,10 @@ async function buildServer (options, app) {
|
|
|
103
82
|
return handler
|
|
104
83
|
}
|
|
105
84
|
|
|
85
|
+
/* c8 ignore next 12 */
|
|
106
86
|
async function safeRestart (app) {
|
|
107
87
|
try {
|
|
108
88
|
await app.restart()
|
|
109
|
-
/* c8 ignore next 8 */
|
|
110
89
|
} catch (err) {
|
|
111
90
|
app.log.error({
|
|
112
91
|
err: {
|
|
@@ -118,6 +97,7 @@ async function safeRestart (app) {
|
|
|
118
97
|
}
|
|
119
98
|
|
|
120
99
|
async function start (appType, _args) {
|
|
100
|
+
/* c8 ignore next 55 */
|
|
121
101
|
const { configManager } = await loadConfig({}, _args, appType)
|
|
122
102
|
|
|
123
103
|
const config = configManager.current
|
|
@@ -145,7 +125,6 @@ async function start (appType, _args) {
|
|
|
145
125
|
|
|
146
126
|
// Ignore from CI because SIGUSR2 is not available
|
|
147
127
|
// on Windows
|
|
148
|
-
/* c8 ignore next 25 */
|
|
149
128
|
process.on('SIGUSR2', function () {
|
|
150
129
|
app.log.info('reloading configuration')
|
|
151
130
|
safeRestart(app)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/service",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,15 +18,16 @@
|
|
|
18
18
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@fastify/aws-lambda": "^3.2.0",
|
|
21
|
-
"@matteo.collina/worker": "^3.1.0",
|
|
22
21
|
"bindings": "^1.5.0",
|
|
23
22
|
"c8": "^8.0.0",
|
|
23
|
+
"openapi-types": "^12.1.3",
|
|
24
24
|
"self-cert": "^2.0.0",
|
|
25
25
|
"snazzy": "^9.0.0",
|
|
26
26
|
"split2": "^4.2.0",
|
|
27
27
|
"standard": "^17.1.0",
|
|
28
28
|
"strip-ansi": "^7.1.0",
|
|
29
29
|
"tap": "^16.3.6",
|
|
30
|
+
"ts-standard": "^12.0.2",
|
|
30
31
|
"tsd": "^0.28.1",
|
|
31
32
|
"typescript": "^5.1.3",
|
|
32
33
|
"undici": "^5.22.1",
|
|
@@ -55,7 +56,6 @@
|
|
|
55
56
|
"fastify": "^4.18.0",
|
|
56
57
|
"fastify-metrics": "^10.3.0",
|
|
57
58
|
"fastify-plugin": "^4.5.0",
|
|
58
|
-
"fastify-sandbox": "^0.13.1",
|
|
59
59
|
"graphql": "^16.6.0",
|
|
60
60
|
"help-me": "^4.2.0",
|
|
61
61
|
"mercurius": "^13.0.0",
|
|
@@ -64,18 +64,26 @@
|
|
|
64
64
|
"pino-pretty": "^10.0.0",
|
|
65
65
|
"rfdc": "^1.3.0",
|
|
66
66
|
"ua-parser-js": "^1.0.35",
|
|
67
|
-
"@platformatic/client": "0.
|
|
68
|
-
"@platformatic/config": "0.
|
|
69
|
-
"@platformatic/swagger-ui-theme": "0.
|
|
70
|
-
"@platformatic/
|
|
67
|
+
"@platformatic/client": "0.29.0",
|
|
68
|
+
"@platformatic/config": "0.29.0",
|
|
69
|
+
"@platformatic/swagger-ui-theme": "0.29.0",
|
|
70
|
+
"@platformatic/types": "0.29.0",
|
|
71
|
+
"@platformatic/utils": "0.29.0"
|
|
71
72
|
},
|
|
72
73
|
"standard": {
|
|
73
74
|
"ignore": [
|
|
74
75
|
"**/dist/*"
|
|
75
76
|
]
|
|
76
77
|
},
|
|
78
|
+
"ts-standard": {
|
|
79
|
+
"ignore": [
|
|
80
|
+
"**/dist/*",
|
|
81
|
+
"fixtures/**/*",
|
|
82
|
+
"test/**/*"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
77
85
|
"scripts": {
|
|
78
|
-
"test": "
|
|
79
|
-
"lint": "standard | snazzy"
|
|
86
|
+
"test": "pnpm run lint && c8 --100 tap test/*test.js test/*/*.test.mjs && tsd",
|
|
87
|
+
"lint": "standard | snazzy && ts-standard | snazzy"
|
|
80
88
|
}
|
|
81
89
|
}
|