@platformatic/service 2.49.0 → 2.51.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/lib/plugins/openapi.js +3 -2
- package/lib/stackable.js +15 -1
- package/package.json +10 -10
- package/schema.json +2 -2
package/lib/plugins/openapi.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const Swagger = require('@fastify/swagger')
|
|
4
|
-
const ScalarApiReference = require('@scalar/fastify-api-reference')
|
|
5
4
|
const deepmerge = require('@fastify/deepmerge')({ all: true })
|
|
6
5
|
const fp = require('fastify-plugin')
|
|
7
6
|
|
|
@@ -45,6 +44,8 @@ async function setupOpenAPI (app, opts) {
|
|
|
45
44
|
await app.register(Swagger, swaggerOptions)
|
|
46
45
|
|
|
47
46
|
const { default: scalarTheme } = await import('@platformatic/scalar-theme')
|
|
47
|
+
const { default: scalarApiReference } = await import('@scalar/fastify-api-reference')
|
|
48
|
+
|
|
48
49
|
const routePrefix = openapi.swaggerPrefix || '/documentation'
|
|
49
50
|
|
|
50
51
|
/** Serve spec file in yaml and json */
|
|
@@ -57,7 +58,7 @@ async function setupOpenAPI (app, opts) {
|
|
|
57
58
|
logLevel: 'warn',
|
|
58
59
|
}, async () => app.swagger({ yaml: true }))
|
|
59
60
|
|
|
60
|
-
app.register(
|
|
61
|
+
app.register(scalarApiReference, {
|
|
61
62
|
...opts,
|
|
62
63
|
...openapi,
|
|
63
64
|
routePrefix,
|
package/lib/stackable.js
CHANGED
|
@@ -31,6 +31,8 @@ class ServiceStackable {
|
|
|
31
31
|
|
|
32
32
|
this.runtimeConfig = deepmerge(this.context.runtimeConfig ?? {}, workerData?.config ?? {})
|
|
33
33
|
|
|
34
|
+
this.customHealthCheck = null
|
|
35
|
+
|
|
34
36
|
this.configManager.on('error', err => {
|
|
35
37
|
/* c8 ignore next */
|
|
36
38
|
this.stackable.log({
|
|
@@ -53,7 +55,8 @@ class ServiceStackable {
|
|
|
53
55
|
setBasePath: this.setBasePath.bind(this),
|
|
54
56
|
runtimeBasePath: this.runtimeConfig?.basePath ?? null,
|
|
55
57
|
invalidateHttpCache: this.#invalidateHttpCache.bind(this),
|
|
56
|
-
prometheus: { client, registry: this.metricsRegistry }
|
|
58
|
+
prometheus: { client, registry: this.metricsRegistry },
|
|
59
|
+
setCustomHealthCheck: this.setCustomHealthCheck.bind(this)
|
|
57
60
|
})
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -176,6 +179,17 @@ class ServiceStackable {
|
|
|
176
179
|
return this.app.graphql ? printSchema(this.app.graphql.schema) : null
|
|
177
180
|
}
|
|
178
181
|
|
|
182
|
+
setCustomHealthCheck (fn) {
|
|
183
|
+
this.customHealthCheck = fn
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async getCustomHealthCheck () {
|
|
187
|
+
if (!this.customHealthCheck) {
|
|
188
|
+
return true
|
|
189
|
+
}
|
|
190
|
+
return await this.customHealthCheck()
|
|
191
|
+
}
|
|
192
|
+
|
|
179
193
|
// This method is not a part of Stackable interface because we need to register
|
|
180
194
|
// fastify metrics before the server is started.
|
|
181
195
|
async #collectMetrics () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/service",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@fastify/under-pressure": "^9.0.0",
|
|
49
49
|
"@mercuriusjs/federation": "^5.0.0",
|
|
50
50
|
"@platformatic/fastify-http-metrics": "^0.2.0",
|
|
51
|
-
"@scalar/fastify-api-reference": "
|
|
51
|
+
"@scalar/fastify-api-reference": "1.25.122",
|
|
52
52
|
"@types/ws": "^8.5.10",
|
|
53
53
|
"ajv": "^8.12.0",
|
|
54
54
|
"cli-progress": "^3.12.0",
|
|
@@ -77,14 +77,14 @@
|
|
|
77
77
|
"rfdc": "^1.3.1",
|
|
78
78
|
"semgrator": "^0.3.0",
|
|
79
79
|
"undici": "^7.0.0",
|
|
80
|
-
"@platformatic/client": "2.
|
|
81
|
-
"@platformatic/config": "2.
|
|
82
|
-
"@platformatic/generators": "2.
|
|
83
|
-
"@platformatic/metrics": "2.
|
|
84
|
-
"@platformatic/scalar-theme": "2.
|
|
85
|
-
"@platformatic/
|
|
86
|
-
"@platformatic/
|
|
87
|
-
"@platformatic/
|
|
80
|
+
"@platformatic/client": "2.51.0",
|
|
81
|
+
"@platformatic/config": "2.51.0",
|
|
82
|
+
"@platformatic/generators": "2.51.0",
|
|
83
|
+
"@platformatic/metrics": "2.51.0",
|
|
84
|
+
"@platformatic/scalar-theme": "2.51.0",
|
|
85
|
+
"@platformatic/telemetry": "2.51.0",
|
|
86
|
+
"@platformatic/utils": "2.51.0",
|
|
87
|
+
"@platformatic/ts-compiler": "2.51.0"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"test": "pnpm run lint && borp -T --concurrency=1 --timeout=300000 && tsd",
|
package/schema.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/service/2.
|
|
3
|
-
"version": "2.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/service/2.51.0.json",
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"title": "Platformatic Service",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|