@platformatic/foundation 3.0.0-alpha.4 → 3.0.0-alpha.6
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/LICENSE +1 -1
- package/index.d.ts +3 -3
- package/lib/cli.js +3 -3
- package/lib/configuration.js +2 -1
- package/lib/logger.js +3 -3
- package/lib/node.js +1 -1
- package/lib/schema.js +16 -14
- package/package.json +3 -4
package/LICENSE
CHANGED
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
with Licensor regarding such Contributions.
|
|
137
137
|
|
|
138
138
|
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks,
|
|
139
|
+
names, trademarks, application marks, or product names of the Licensor,
|
|
140
140
|
except as required for reasonable and customary use in describing the
|
|
141
141
|
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
142
|
|
package/index.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export declare function buildPinoTimestamp (timestamp: string): Function
|
|
|
167
167
|
export declare function buildPinoOptions (
|
|
168
168
|
loggerConfig: any,
|
|
169
169
|
serverConfig: any,
|
|
170
|
-
|
|
170
|
+
applicationId?: string,
|
|
171
171
|
workerId?: string,
|
|
172
172
|
context?: any,
|
|
173
173
|
root?: string
|
|
@@ -201,7 +201,7 @@ export declare function detectApplicationType (
|
|
|
201
201
|
export declare function loadModule (require: NodeRequire, path: string): Promise<any>
|
|
202
202
|
|
|
203
203
|
// Node types
|
|
204
|
-
export declare function
|
|
204
|
+
export declare function checkNodeVersionForApplications (): void
|
|
205
205
|
export declare const features: {
|
|
206
206
|
node: {
|
|
207
207
|
reusePort: boolean
|
|
@@ -234,7 +234,7 @@ export declare const health: JSONSchemaType<object>
|
|
|
234
234
|
export declare const healthWithoutDefaults: JSONSchemaType<object>
|
|
235
235
|
export declare const telemetryExporter: JSONSchemaType<object>
|
|
236
236
|
export declare const telemetry: JSONSchemaType<object>
|
|
237
|
-
export declare const
|
|
237
|
+
export declare const applications: JSONSchemaType<object[]>
|
|
238
238
|
export declare const runtimeUnwrappablePropertiesList: string[]
|
|
239
239
|
export declare const runtimeProperties: JSONSchemaType<object>
|
|
240
240
|
export declare const wrappedRuntimeProperties: JSONSchemaType<object>
|
package/lib/cli.js
CHANGED
|
@@ -152,8 +152,8 @@ export function getRoot (positionals) {
|
|
|
152
152
|
return root
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
export function
|
|
156
|
-
return `
|
|
155
|
+
export function applicationToEnvVariable (application) {
|
|
156
|
+
return `PLT_APPLICATION_${application.toUpperCase().replaceAll(/[^A-Z0-9_]/g, '_')}_PATH`
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
export async function findRuntimeConfigurationFile (
|
|
@@ -166,7 +166,7 @@ export async function findRuntimeConfigurationFile (
|
|
|
166
166
|
) {
|
|
167
167
|
let configFile = await findConfigurationFileRecursive(root, configurationFile, '@platformatic/runtime')
|
|
168
168
|
|
|
169
|
-
// If a runtime was not found, search for
|
|
169
|
+
// If a runtime was not found, search for application file that we wrap in a runtime
|
|
170
170
|
if (!configFile && !configurationFile) {
|
|
171
171
|
configFile = await findConfigurationFileRecursive(root, configurationFile)
|
|
172
172
|
}
|
package/lib/configuration.js
CHANGED
|
@@ -120,7 +120,8 @@ export function printValidationErrors (err) {
|
|
|
120
120
|
|
|
121
121
|
export function listRecognizedConfigurationFiles (suffixes, extensions) {
|
|
122
122
|
if (typeof suffixes === 'undefined' || suffixes === null) {
|
|
123
|
-
|
|
123
|
+
// composer is retained for backward compatibility with V2
|
|
124
|
+
suffixes = ['runtime', 'service', 'application', 'db', 'gateway', 'composer']
|
|
124
125
|
} else if (suffixes && !Array.isArray(suffixes)) {
|
|
125
126
|
suffixes = [suffixes]
|
|
126
127
|
} else if (!suffixes) {
|
package/lib/logger.js
CHANGED
|
@@ -54,13 +54,13 @@ export function buildPinoTimestamp (timestamp) {
|
|
|
54
54
|
return stdTimeFunctions[timestamp]
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function buildPinoOptions (loggerConfig, serverConfig,
|
|
57
|
+
export function buildPinoOptions (loggerConfig, serverConfig, applicationId, workerId, context, root) {
|
|
58
58
|
const pinoOptions = {
|
|
59
59
|
level: loggerConfig?.level ?? serverConfig?.level ?? 'trace'
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (
|
|
63
|
-
pinoOptions.name =
|
|
62
|
+
if (applicationId) {
|
|
63
|
+
pinoOptions.name = applicationId
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
if (loggerConfig?.base) {
|
package/lib/node.js
CHANGED
package/lib/schema.js
CHANGED
|
@@ -618,13 +618,13 @@ export const telemetry = {
|
|
|
618
618
|
}
|
|
619
619
|
]
|
|
620
620
|
},
|
|
621
|
-
|
|
621
|
+
applicationName: {
|
|
622
622
|
type: 'string',
|
|
623
|
-
description: 'The name of the
|
|
623
|
+
description: 'The name of the application. Defaults to the folder name if not specified.'
|
|
624
624
|
},
|
|
625
625
|
version: {
|
|
626
626
|
type: 'string',
|
|
627
|
-
description: 'The version of the
|
|
627
|
+
description: 'The version of the application (optional)'
|
|
628
628
|
},
|
|
629
629
|
skip: {
|
|
630
630
|
type: 'array',
|
|
@@ -655,11 +655,11 @@ export const telemetry = {
|
|
|
655
655
|
]
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
|
-
required: ['
|
|
658
|
+
required: ['applicationName'],
|
|
659
659
|
additionalProperties: false
|
|
660
660
|
}
|
|
661
661
|
|
|
662
|
-
export const
|
|
662
|
+
export const applications = {
|
|
663
663
|
type: 'array',
|
|
664
664
|
items: {
|
|
665
665
|
type: 'object',
|
|
@@ -750,10 +750,11 @@ export const services = {
|
|
|
750
750
|
export const runtimeUnwrappablePropertiesList = [
|
|
751
751
|
'$schema',
|
|
752
752
|
'entrypoint',
|
|
753
|
+
'applications',
|
|
753
754
|
'autoload',
|
|
754
|
-
'
|
|
755
|
+
'applications',
|
|
755
756
|
'web',
|
|
756
|
-
'
|
|
757
|
+
'resolvedApplicationsBasePath'
|
|
757
758
|
]
|
|
758
759
|
|
|
759
760
|
export const runtimeProperties = {
|
|
@@ -816,9 +817,10 @@ export const runtimeProperties = {
|
|
|
816
817
|
}
|
|
817
818
|
}
|
|
818
819
|
},
|
|
819
|
-
|
|
820
|
+
applications,
|
|
821
|
+
services: applications,
|
|
822
|
+
web: applications,
|
|
820
823
|
workers: { ...workers, default: 1 },
|
|
821
|
-
web: services,
|
|
822
824
|
logger,
|
|
823
825
|
server,
|
|
824
826
|
startTimeout: {
|
|
@@ -849,7 +851,7 @@ export const runtimeProperties = {
|
|
|
849
851
|
],
|
|
850
852
|
default: 10000
|
|
851
853
|
},
|
|
852
|
-
|
|
854
|
+
application: {
|
|
853
855
|
anyOf: [
|
|
854
856
|
{
|
|
855
857
|
type: 'number',
|
|
@@ -861,7 +863,7 @@ export const runtimeProperties = {
|
|
|
861
863
|
}
|
|
862
864
|
},
|
|
863
865
|
default: {},
|
|
864
|
-
required: ['runtime', '
|
|
866
|
+
required: ['runtime', 'application'],
|
|
865
867
|
additionalProperties: false
|
|
866
868
|
},
|
|
867
869
|
health,
|
|
@@ -1081,7 +1083,7 @@ export const runtimeProperties = {
|
|
|
1081
1083
|
}
|
|
1082
1084
|
}
|
|
1083
1085
|
},
|
|
1084
|
-
|
|
1086
|
+
applicationTimeout: {
|
|
1085
1087
|
anyOf: [
|
|
1086
1088
|
{
|
|
1087
1089
|
type: 'number',
|
|
@@ -1101,7 +1103,7 @@ export const runtimeProperties = {
|
|
|
1101
1103
|
],
|
|
1102
1104
|
default: 30000 // 5 minutes
|
|
1103
1105
|
},
|
|
1104
|
-
|
|
1106
|
+
resolvedApplicationsBasePath: {
|
|
1105
1107
|
type: 'string',
|
|
1106
1108
|
default: 'external'
|
|
1107
1109
|
},
|
|
@@ -1182,7 +1184,7 @@ export const schemaComponents = {
|
|
|
1182
1184
|
healthWithoutDefaults,
|
|
1183
1185
|
telemetryExporter,
|
|
1184
1186
|
telemetry,
|
|
1185
|
-
|
|
1187
|
+
applications,
|
|
1186
1188
|
runtimeProperties,
|
|
1187
1189
|
wrappedRuntimeProperties,
|
|
1188
1190
|
wrappedRuntime
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/foundation",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.6",
|
|
4
4
|
"description": "Platformatic Foundation",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"yaml": "^2.4.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"borp": "^0.20.0",
|
|
37
36
|
"c8": "^10.0.0",
|
|
37
|
+
"cleaner-spec-reporter": "^0.5.0",
|
|
38
38
|
"eslint": "9",
|
|
39
39
|
"fastify": "^5.0.0",
|
|
40
40
|
"neostandard": "^0.12.0",
|
|
@@ -46,8 +46,7 @@
|
|
|
46
46
|
"node": ">=22.18.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"test": "
|
|
50
|
-
"coverage": "c8 -r html -r text node --test --test-concurrency=1 --test-timeout=1200000 test/*.test.js",
|
|
49
|
+
"test": "node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js test/**/*.test.js",
|
|
51
50
|
"lint": "eslint"
|
|
52
51
|
}
|
|
53
52
|
}
|