@platformatic/runtime 0.47.6 → 1.1.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/dbApp/db.sqlite +0 -0
- package/fixtures/dbAppWithMigrationError/db.sqlite +0 -0
- package/fixtures/server/overrides-service/platformatic.runtime.json +19 -0
- package/fixtures/server/overrides-service/services/echo/platformatic.service.json +19 -0
- package/fixtures/server/overrides-service/services/echo/routes/span.js +8 -0
- package/fixtures/server/runtime-server/platformatic.runtime.json +19 -0
- package/fixtures/server/runtime-server/services/echo/platformatic.service.json +12 -0
- package/fixtures/server/runtime-server/services/echo/routes/span.js +8 -0
- package/fixtures/typescript/services/composer/.env +4 -0
- package/fixtures/typescript/services/movies/dist/plugin.js +6 -0
- package/fixtures/typescript/services/movies/dist/plugin.js.map +1 -0
- package/fixtures/typescript/services/titles/.env +3 -0
- package/fixtures/typescript/services/titles/dist/plugins/example.js +7 -0
- package/fixtures/typescript/services/titles/dist/plugins/example.js.map +1 -0
- package/fixtures/typescript/services/titles/dist/routes/root.js +14 -0
- package/fixtures/typescript/services/titles/dist/routes/root.js.map +1 -0
- package/fixtures/typescript-custom-flags/services/composer/.env +4 -0
- package/fixtures/typescript-custom-flags/services/movies/.env +4 -0
- package/fixtures/typescript-custom-flags/services/titles/.env +3 -0
- package/lib/api.js +7 -1
- package/lib/app.js +11 -1
- package/lib/config.js +1 -0
- package/lib/schema.js +2 -0
- package/package.json +19 -19
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://platformatic.dev/schemas/v0.31.0/runtime",
|
|
3
|
+
"entrypoint": "echo",
|
|
4
|
+
"allowCycles": false,
|
|
5
|
+
"hotReload": true,
|
|
6
|
+
"autoload": {
|
|
7
|
+
"path": "services",
|
|
8
|
+
"exclude": [
|
|
9
|
+
"docs"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"server": {
|
|
13
|
+
"hostname": "127.0.0.1",
|
|
14
|
+
"port": "14242",
|
|
15
|
+
"logger": {
|
|
16
|
+
"level": "info"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://platformatic.dev/schemas/v0.28.1/service",
|
|
3
|
+
"service": {
|
|
4
|
+
"openapi": true
|
|
5
|
+
},
|
|
6
|
+
"plugins": {
|
|
7
|
+
"paths": [
|
|
8
|
+
"./routes"
|
|
9
|
+
],
|
|
10
|
+
"typescript": false
|
|
11
|
+
},
|
|
12
|
+
"server": {
|
|
13
|
+
"hostname": "127.0.0.1",
|
|
14
|
+
"port": "14343",
|
|
15
|
+
"logger": {
|
|
16
|
+
"level": "info"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://platformatic.dev/schemas/v0.31.0/runtime",
|
|
3
|
+
"entrypoint": "echo",
|
|
4
|
+
"allowCycles": false,
|
|
5
|
+
"hotReload": true,
|
|
6
|
+
"autoload": {
|
|
7
|
+
"path": "services",
|
|
8
|
+
"exclude": [
|
|
9
|
+
"docs"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"server": {
|
|
13
|
+
"hostname": "127.0.0.1",
|
|
14
|
+
"port": "14242",
|
|
15
|
+
"logger": {
|
|
16
|
+
"level": "info"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../plugin.ts"],"names":[],"mappings":";;AAGe,KAAK,oBAAW,GAAoB;AACnD,CAAC;AADD,4BACC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","sourceRoot":"","sources":["../../plugins/example.ts"],"names":[],"mappings":";;AAGe,KAAK,oBAAW,OAAwB,EAAE,IAA0B;IACjF,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AACvC,CAAC;AAFD,4BAEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
async function default_1(fastify, opts) {
|
|
4
|
+
fastify.get('/', async (request, reply) => {
|
|
5
|
+
return { hello: fastify.example };
|
|
6
|
+
});
|
|
7
|
+
fastify.get('/titles', async (request, reply) => {
|
|
8
|
+
const movies = await fastify.client.getMovies({});
|
|
9
|
+
const titles = movies.map((movie) => movie.title);
|
|
10
|
+
return { titles };
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.default = default_1;
|
|
14
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../routes/root.ts"],"names":[],"mappings":";;AAUe,KAAK,oBAAW,OAAwB,EAAE,IAA0B;IACjF,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QACxC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACjD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACjD,OAAO,EAAE,MAAM,EAAE,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AAVD,4BAUC"}
|
package/lib/api.js
CHANGED
|
@@ -16,7 +16,13 @@ class RuntimeApi {
|
|
|
16
16
|
for (let i = 0; i < config.services.length; ++i) {
|
|
17
17
|
const service = config.services[i]
|
|
18
18
|
const serviceTelemetryConfig = telemetryConfig ? { ...telemetryConfig, serviceName: `${telemetryConfig.serviceName}-${service.id}` } : null
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
// If the service is an entrypoint and runtime server config is defined, use it.
|
|
21
|
+
let serverConfig = null
|
|
22
|
+
if (config.server && service.entrypoint) {
|
|
23
|
+
serverConfig = config.server
|
|
24
|
+
}
|
|
25
|
+
const app = new PlatformaticApp(service, loaderPort, logger, serviceTelemetryConfig, serverConfig)
|
|
20
26
|
|
|
21
27
|
this.#services.set(service.id, app)
|
|
22
28
|
}
|
package/lib/app.js
CHANGED
|
@@ -17,9 +17,10 @@ class PlatformaticApp {
|
|
|
17
17
|
#fileWatcher
|
|
18
18
|
#logger
|
|
19
19
|
#telemetryConfig
|
|
20
|
+
#serverConfig
|
|
20
21
|
#debouncedRestart
|
|
21
22
|
|
|
22
|
-
constructor (appConfig, loaderPort, logger, telemetryConfig) {
|
|
23
|
+
constructor (appConfig, loaderPort, logger, telemetryConfig, serverConfig) {
|
|
23
24
|
this.appConfig = appConfig
|
|
24
25
|
this.config = null
|
|
25
26
|
this.#hotReload = false
|
|
@@ -33,6 +34,7 @@ class PlatformaticApp {
|
|
|
33
34
|
name: this.appConfig.id
|
|
34
35
|
})
|
|
35
36
|
this.#telemetryConfig = telemetryConfig
|
|
37
|
+
this.#serverConfig = serverConfig
|
|
36
38
|
|
|
37
39
|
/* c8 ignore next 4 */
|
|
38
40
|
this.#debouncedRestart = debounce(() => {
|
|
@@ -93,6 +95,14 @@ class PlatformaticApp {
|
|
|
93
95
|
...configManager.current,
|
|
94
96
|
telemetry: this.#telemetryConfig
|
|
95
97
|
})
|
|
98
|
+
|
|
99
|
+
if (this.#serverConfig) {
|
|
100
|
+
configManager.update({
|
|
101
|
+
...configManager.current,
|
|
102
|
+
server: this.#serverConfig
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
96
106
|
const config = configManager.current
|
|
97
107
|
|
|
98
108
|
this.#setuplogger(configManager)
|
package/lib/config.js
CHANGED
package/lib/schema.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict'
|
|
3
3
|
|
|
4
4
|
const telemetry = require('@platformatic/telemetry').schema
|
|
5
|
+
const { server } = require('@platformatic/service').schema
|
|
5
6
|
const pkg = require('../package.json')
|
|
6
7
|
const version = 'v' + pkg.version
|
|
7
8
|
const platformaticRuntimeSchema = {
|
|
@@ -44,6 +45,7 @@ const platformaticRuntimeSchema = {
|
|
|
44
45
|
}
|
|
45
46
|
},
|
|
46
47
|
telemetry,
|
|
48
|
+
server,
|
|
47
49
|
services: {
|
|
48
50
|
type: 'array',
|
|
49
51
|
default: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/runtime",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -17,38 +17,38 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/platformatic/platformatic#readme",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"c8": "^8.0.
|
|
21
|
-
"execa": "^8.0.
|
|
20
|
+
"c8": "^8.0.1",
|
|
21
|
+
"execa": "^8.0.1",
|
|
22
22
|
"snazzy": "^9.0.0",
|
|
23
23
|
"split2": "^4.2.0",
|
|
24
24
|
"standard": "^17.1.0",
|
|
25
25
|
"tsd": "^0.29.0",
|
|
26
|
-
"typescript": "^5.
|
|
27
|
-
"@platformatic/sql-
|
|
28
|
-
"@platformatic/sql-
|
|
26
|
+
"typescript": "^5.2.2",
|
|
27
|
+
"@platformatic/sql-mapper": "1.1.0",
|
|
28
|
+
"@platformatic/sql-graphql": "1.1.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@fastify/error": "^3.3.0",
|
|
31
32
|
"@hapi/topo": "^6.0.2",
|
|
32
|
-
"@fastify/error": "^3.2.1",
|
|
33
33
|
"close-with-grace": "^1.2.0",
|
|
34
34
|
"commist": "^3.2.0",
|
|
35
35
|
"debounce": "^1.2.1",
|
|
36
36
|
"desm": "^1.3.0",
|
|
37
|
-
"es-main": "^1.
|
|
37
|
+
"es-main": "^1.3.0",
|
|
38
38
|
"fastest-levenshtein": "^1.0.16",
|
|
39
|
-
"fastify": "^4.
|
|
40
|
-
"fastify-undici-dispatcher": "^0.4.
|
|
39
|
+
"fastify": "^4.23.2",
|
|
40
|
+
"fastify-undici-dispatcher": "^0.4.2",
|
|
41
41
|
"help-me": "^4.2.0",
|
|
42
42
|
"minimist": "^1.2.8",
|
|
43
|
-
"pino": "^8.
|
|
44
|
-
"pino-pretty": "^10.
|
|
45
|
-
"undici": "^5.
|
|
46
|
-
"@platformatic/
|
|
47
|
-
"@platformatic/
|
|
48
|
-
"@platformatic/
|
|
49
|
-
"@platformatic/
|
|
50
|
-
"@platformatic/
|
|
51
|
-
"@platformatic/
|
|
43
|
+
"pino": "^8.15.3",
|
|
44
|
+
"pino-pretty": "^10.2.0",
|
|
45
|
+
"undici": "^5.25.3",
|
|
46
|
+
"@platformatic/service": "1.1.0",
|
|
47
|
+
"@platformatic/db": "1.1.0",
|
|
48
|
+
"@platformatic/telemetry": "1.1.0",
|
|
49
|
+
"@platformatic/utils": "1.1.0",
|
|
50
|
+
"@platformatic/config": "1.1.0",
|
|
51
|
+
"@platformatic/composer": "1.1.0"
|
|
52
52
|
},
|
|
53
53
|
"standard": {
|
|
54
54
|
"ignore": [
|