@platformatic/runtime 2.69.0 → 2.70.1
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/config.d.ts +4 -3
- package/lib/errors.js +93 -22
- package/lib/runtime.js +433 -61
- package/lib/worker/interceptors.js +4 -2
- package/lib/worker/itc.js +21 -4
- package/lib/worker/messaging.js +186 -0
- package/lib/worker/round-robin-map.js +1 -1
- package/lib/worker/symbols.js +7 -1
- package/package.json +23 -23
- package/schema.json +66 -23
package/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* and run json-schema-to-typescript to regenerate this file.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type HttpsSchemasPlatformaticDevPlatformaticRuntime2701Json = {
|
|
9
9
|
[k: string]: unknown;
|
|
10
10
|
} & {
|
|
11
11
|
$schema?: string;
|
|
@@ -29,7 +29,7 @@ export type HttpsSchemasPlatformaticDevPlatformaticRuntime2690Json = {
|
|
|
29
29
|
maxELU?: number | string;
|
|
30
30
|
maxHeapUsed?: number | string;
|
|
31
31
|
maxHeapTotal?: number | string;
|
|
32
|
-
maxYoungGeneration?: number;
|
|
32
|
+
maxYoungGeneration?: number | string;
|
|
33
33
|
};
|
|
34
34
|
preload?: string | string[];
|
|
35
35
|
arguments?: string[];
|
|
@@ -141,7 +141,7 @@ export type HttpsSchemasPlatformaticDevPlatformaticRuntime2690Json = {
|
|
|
141
141
|
maxELU?: number | string;
|
|
142
142
|
maxHeapUsed?: number | string;
|
|
143
143
|
maxHeapTotal?: number | string;
|
|
144
|
-
maxYoungGeneration?: number;
|
|
144
|
+
maxYoungGeneration?: number | string;
|
|
145
145
|
};
|
|
146
146
|
undici?: {
|
|
147
147
|
agentOptions?: {
|
|
@@ -331,6 +331,7 @@ export type HttpsSchemasPlatformaticDevPlatformaticRuntime2690Json = {
|
|
|
331
331
|
[k: string]: unknown;
|
|
332
332
|
};
|
|
333
333
|
serviceTimeout?: number | string;
|
|
334
|
+
messagingTimeout?: number | string;
|
|
334
335
|
resolvedServicesBasePath?: string;
|
|
335
336
|
env?: {
|
|
336
337
|
[k: string]: string;
|
package/lib/errors.js
CHANGED
|
@@ -9,37 +9,108 @@ module.exports = {
|
|
|
9
9
|
RuntimeExitedError: createError(`${ERROR_PREFIX}_RUNTIME_EXIT`, 'The runtime exited before the operation completed'),
|
|
10
10
|
RuntimeAbortedError: createError(`${ERROR_PREFIX}_RUNTIME_ABORT`, 'The runtime aborted the operation'),
|
|
11
11
|
// The following two use the same code as we only need to differentiate the label
|
|
12
|
-
ServiceExitedError: createError(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
ServiceExitedError: createError(
|
|
13
|
+
`${ERROR_PREFIX}_SERVICE_EXIT`,
|
|
14
|
+
'The service "%s" exited prematurely with error code %d'
|
|
15
|
+
),
|
|
16
|
+
WorkerExitedError: createError(
|
|
17
|
+
`${ERROR_PREFIX}_SERVICE_EXIT`,
|
|
18
|
+
'The worker %s of the service "%s" exited prematurely with error code %d'
|
|
19
|
+
),
|
|
20
|
+
UnknownRuntimeAPICommandError: createError(
|
|
21
|
+
`${ERROR_PREFIX}_UNKNOWN_RUNTIME_API_COMMAND`,
|
|
22
|
+
'Unknown Runtime API command "%s"'
|
|
23
|
+
),
|
|
24
|
+
ServiceNotFoundError: createError(
|
|
25
|
+
`${ERROR_PREFIX}_SERVICE_NOT_FOUND`,
|
|
26
|
+
'Service %s not found. Available services are: %s'
|
|
27
|
+
),
|
|
28
|
+
WorkerNotFoundError: createError(
|
|
29
|
+
`${ERROR_PREFIX}_WORKER_NOT_FOUND`,
|
|
30
|
+
'Worker %s of service %s not found. Available services are: %s'
|
|
31
|
+
),
|
|
16
32
|
ServiceNotStartedError: createError(`${ERROR_PREFIX}_SERVICE_NOT_STARTED`, "Service with id '%s' is not started"),
|
|
17
|
-
ServiceStartTimeoutError: createError(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
ServiceStartTimeoutError: createError(
|
|
34
|
+
`${ERROR_PREFIX}_SERVICE_START_TIMEOUT`,
|
|
35
|
+
"Service with id '%s' failed to start in %dms."
|
|
36
|
+
),
|
|
37
|
+
FailedToRetrieveOpenAPISchemaError: createError(
|
|
38
|
+
`${ERROR_PREFIX}_FAILED_TO_RETRIEVE_OPENAPI_SCHEMA`,
|
|
39
|
+
'Failed to retrieve OpenAPI schema for service with id "%s": %s'
|
|
40
|
+
),
|
|
41
|
+
FailedToRetrieveGraphQLSchemaError: createError(
|
|
42
|
+
`${ERROR_PREFIX}_FAILED_TO_RETRIEVE_GRAPHQL_SCHEMA`,
|
|
43
|
+
'Failed to retrieve GraphQL schema for service with id "%s": %s'
|
|
44
|
+
),
|
|
45
|
+
FailedToRetrieveMetaError: createError(
|
|
46
|
+
`${ERROR_PREFIX}_FAILED_TO_RETRIEVE_META`,
|
|
47
|
+
'Failed to retrieve metadata for service with id "%s": %s'
|
|
48
|
+
),
|
|
49
|
+
FailedToRetrieveMetricsError: createError(
|
|
50
|
+
`${ERROR_PREFIX}_FAILED_TO_RETRIEVE_METRICS`,
|
|
51
|
+
'Failed to retrieve metrics for service with id "%s": %s'
|
|
52
|
+
),
|
|
53
|
+
FailedToRetrieveHealthError: createError(
|
|
54
|
+
`${ERROR_PREFIX}_FAILED_TO_RETRIEVE_HEALTH`,
|
|
55
|
+
'Failed to retrieve health for service with id "%s": %s'
|
|
56
|
+
),
|
|
57
|
+
FailedToPerformCustomHealthCheckError: createError(
|
|
58
|
+
`${ERROR_PREFIX}_FAILED_TO_PERFORM_CUSTOM_HEALTH_CHECK`,
|
|
59
|
+
'Failed to perform custom healthcheck for service with id "%s": %s'
|
|
60
|
+
),
|
|
61
|
+
FailedToPerformCustomReadinessCheckError: createError(
|
|
62
|
+
`${ERROR_PREFIX}_FAILED_TO_PERFORM_CUSTOM_READINESS_CHECK`,
|
|
63
|
+
'Failed to perform custom readiness check for service with id "%s": %s'
|
|
64
|
+
),
|
|
65
|
+
ApplicationAlreadyStartedError: createError(
|
|
66
|
+
`${ERROR_PREFIX}_APPLICATION_ALREADY_STARTED`,
|
|
67
|
+
'Application is already started'
|
|
68
|
+
),
|
|
69
|
+
ApplicationNotStartedError: createError(
|
|
70
|
+
`${ERROR_PREFIX}_APPLICATION_NOT_STARTED`,
|
|
71
|
+
'Application has not been started'
|
|
72
|
+
),
|
|
73
|
+
ConfigPathMustBeStringError: createError(
|
|
74
|
+
`${ERROR_PREFIX}_CONFIG_PATH_MUST_BE_STRING`,
|
|
75
|
+
'Config path must be a string'
|
|
76
|
+
),
|
|
28
77
|
NoConfigFileFoundError: createError(`${ERROR_PREFIX}_NO_CONFIG_FILE_FOUND`, "No config file found for service '%s'"),
|
|
29
78
|
InvalidEntrypointError: createError(`${ERROR_PREFIX}_INVALID_ENTRYPOINT`, "Invalid entrypoint: '%s' does not exist"),
|
|
30
79
|
MissingEntrypointError: createError(`${ERROR_PREFIX}_MISSING_ENTRYPOINT`, 'Missing application entrypoint.'),
|
|
31
|
-
InvalidServicesWithWebError: createError(
|
|
80
|
+
InvalidServicesWithWebError: createError(
|
|
81
|
+
`${ERROR_PREFIX}_INVALID_SERVICES_WITH_WEB`,
|
|
82
|
+
'The "services" property cannot be used when the "web" property is also defined'
|
|
83
|
+
),
|
|
32
84
|
MissingDependencyError: createError(`${ERROR_PREFIX}_MISSING_DEPENDENCY`, 'Missing dependency: "%s"'),
|
|
33
|
-
InspectAndInspectBrkError: createError(
|
|
34
|
-
|
|
85
|
+
InspectAndInspectBrkError: createError(
|
|
86
|
+
`${ERROR_PREFIX}_INSPECT_AND_INSPECT_BRK`,
|
|
87
|
+
'--inspect and --inspect-brk cannot be used together'
|
|
88
|
+
),
|
|
89
|
+
InspectorPortError: createError(
|
|
90
|
+
`${ERROR_PREFIX}_INSPECTOR_PORT`,
|
|
91
|
+
'Inspector port must be 0 or in range 1024 to 65535'
|
|
92
|
+
),
|
|
35
93
|
InspectorHostError: createError(`${ERROR_PREFIX}_INSPECTOR_HOST`, 'Inspector host cannot be empty'),
|
|
36
|
-
CannotMapSpecifierToAbsolutePathError: createError(
|
|
37
|
-
|
|
38
|
-
|
|
94
|
+
CannotMapSpecifierToAbsolutePathError: createError(
|
|
95
|
+
`${ERROR_PREFIX}_CANNOT_MAP_SPECIFIER_TO_ABSOLUTE_PATH`,
|
|
96
|
+
'Cannot map "%s" to an absolute path'
|
|
97
|
+
),
|
|
98
|
+
NodeInspectorFlagsNotSupportedError: createError(
|
|
99
|
+
`${ERROR_PREFIX}_NODE_INSPECTOR_FLAGS_NOT_SUPPORTED`,
|
|
100
|
+
"The Node.js inspector flags are not supported. Please use 'platformatic start --inspect' instead."
|
|
101
|
+
),
|
|
102
|
+
FailedToUnlinkManagementApiSocket: createError(
|
|
103
|
+
`${ERROR_PREFIX}_FAILED_TO_UNLINK_MANAGEMENT_API_SOCKET`,
|
|
104
|
+
'Failed to unlink management API socket "%s"'
|
|
105
|
+
),
|
|
39
106
|
LogFileNotFound: createError(`${ERROR_PREFIX}_LOG_FILE_NOT_FOUND`, 'Log file with index %s not found', 404),
|
|
40
107
|
WorkerIsRequired: createError(`${ERROR_PREFIX}_REQUIRED_WORKER`, 'The worker parameter is required'),
|
|
41
108
|
InvalidArgumentError: createError(`${ERROR_PREFIX}_INVALID_ARGUMENT`, 'Invalid argument: "%s"'),
|
|
109
|
+
MessagingError: createError(`${ERROR_PREFIX}_MESSAGING_ERROR`, 'Cannot send a message to service "%s": %s'),
|
|
42
110
|
|
|
43
111
|
// TODO: should remove next one as it's not used anymore
|
|
44
|
-
CannotRemoveServiceOnUpdateError: createError(
|
|
112
|
+
CannotRemoveServiceOnUpdateError: createError(
|
|
113
|
+
`${ERROR_PREFIX}_CANNOT_REMOVE_SERVICE_ON_UPDATE`,
|
|
114
|
+
'Cannot remove service "%s" when updating a Runtime'
|
|
115
|
+
)
|
|
45
116
|
}
|