@ti-engine/core 1.7.1 → 1.7.2
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/CHANGELOG.md +383 -377
- package/LICENSE.md +321 -321
- package/README.md +597 -597
- package/bin/localization/labels.json +122 -122
- package/bin/settings.json +41 -41
- package/bin/start-instance.js +164 -164
- package/components/auditing.js +191 -191
- package/components/connection-observer.js +72 -72
- package/components/definitions.types.js +248 -248
- package/components/exchange/default/default-message-exchange.js +136 -136
- package/components/exchange/default/default-message-receiver.js +101 -101
- package/components/exchange/default/default-message-sender.js +100 -100
- package/components/exchange/message-dispatcher.js +168 -168
- package/components/exchange/message-exchange.js +449 -449
- package/components/exchange/message-handler.js +235 -235
- package/components/exchange/message-memory-cache.js +190 -190
- package/components/exchange/message-observer.js +126 -126
- package/components/exchange/message-receiver.js +181 -181
- package/components/exchange/message-sender.js +143 -143
- package/components/exchange/message-tracer.js +212 -212
- package/components/service-caller.js +370 -370
- package/components/service-consumer.js +131 -131
- package/components/service-executor.js +278 -278
- package/components/service-instance.js +316 -316
- package/components/service-provider.js +251 -251
- package/integrations/redis-integration.js +591 -591
- package/package.json +89 -89
- package/utils/cache.js +772 -772
- package/utils/config.js +103 -103
- package/utils/exceptions.js +368 -368
- package/utils/localization.js +298 -298
- package/utils/logger.js +82 -82
- package/utils/tools.js +632 -632
|
@@ -1,248 +1,248 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The ti-engine is an open source, free to use—both for personal and commercial projects—framework for the creation of microservice-based solutions using node.js.
|
|
3
|
-
* Copyright © 2021-2026 Boris Kostadinov <kostadinov.boris@gmail.com>
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
5
|
-
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
6
|
-
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// Configuration Definitions:
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {string} EnvironmentVariable
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @typedef {NodeJS.Process} Environment
|
|
17
|
-
* @property {ProcessEnv} env
|
|
18
|
-
* @property {EnvironmentVariable} env.TI_GCLOUD_API_KEY
|
|
19
|
-
* @property {EnvironmentVariable} env.TI_GCLOUD_ENABLED
|
|
20
|
-
* @property {EnvironmentVariable} env.TI_GCLOUD_PROJECT_ID
|
|
21
|
-
* @property {EnvironmentVariable} env.TI_INSTANCE_CLASS
|
|
22
|
-
* @property {EnvironmentVariable} env.TI_INSTANCE_CONFIG
|
|
23
|
-
* @property {EnvironmentVariable} env.TI_INSTANCE_ID
|
|
24
|
-
* @property {EnvironmentVariable} env.TI_INSTANCE_NAME
|
|
25
|
-
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_CONSOLE_ENABLED
|
|
26
|
-
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_DETAILS
|
|
27
|
-
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_MIN_LEVEL
|
|
28
|
-
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_USES_JSON
|
|
29
|
-
* @property {EnvironmentVariable} env.TI_LOCALIZATION_LABELS_PATH
|
|
30
|
-
* @property {EnvironmentVariable} env.TI_LOCALIZATION_LANGUAGE
|
|
31
|
-
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_AUTH_KEY
|
|
32
|
-
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_REDIS_DB
|
|
33
|
-
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_REDIS_HOST
|
|
34
|
-
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_REDIS_PORT
|
|
35
|
-
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_RETRY_MAX_ATTEMPTS
|
|
36
|
-
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_RETRY_MAX_INTERVAL
|
|
37
|
-
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_USER
|
|
38
|
-
* @property {EnvironmentVariable} env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_ENABLED
|
|
39
|
-
* @property {EnvironmentVariable} env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_KEY
|
|
40
|
-
* @property {EnvironmentVariable} env.TI_MESSAGE_EXCHANGE_TRACE_LOG_ENABLED
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @typedef {Object} SettingsMain
|
|
45
|
-
* @property {SettingsAuditing} auditing
|
|
46
|
-
* @property {SettingsGcloudIntegration} gcloudIntegration
|
|
47
|
-
* @property {SettingsLocalization} localization
|
|
48
|
-
* @property {SettingsMemoryCache} memoryCache
|
|
49
|
-
* @property {SettingsMessageExchange} messageExchange
|
|
50
|
-
* @property {SettingsServiceConfig} serviceConfig
|
|
51
|
-
* @property {string} operationMode
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @typedef {Object} SettingsAuditing
|
|
56
|
-
* @property {boolean} logConsoleEnabled
|
|
57
|
-
* @property {boolean} logDetails
|
|
58
|
-
* @property {TiLogSeverity} logMinLevel
|
|
59
|
-
* @property {boolean} logUsesJSON
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @typedef {Object} SettingsGcloudIntegration
|
|
64
|
-
* @property {string} apiKey
|
|
65
|
-
* @property {string} projectID
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @typedef {Object} SettingsLocalization
|
|
70
|
-
* @property {Array<string>} labelsPath
|
|
71
|
-
* @property {TiLocalizationLanguage} language
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @typedef {Object} SettingsMemoryCache
|
|
76
|
-
* @property {string} authKey
|
|
77
|
-
* @property {number} redisDB
|
|
78
|
-
* @property {string} redisHost
|
|
79
|
-
* @property {number} redisPort
|
|
80
|
-
* @property {number} retryMaxAttempts
|
|
81
|
-
* @property {number} retryMaxInterval
|
|
82
|
-
* @property {string} user
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @typedef {Object} SettingsMessageExchange
|
|
87
|
-
* @property {string} messageQueuePrefix
|
|
88
|
-
* @property {string} messageStore
|
|
89
|
-
* @property {boolean} securityHashEnabled
|
|
90
|
-
* @property {string} securityHashKey
|
|
91
|
-
* @property {number} traceExpirationTime
|
|
92
|
-
* @property {boolean} traceLogEnabled
|
|
93
|
-
* @property {string} traceRepository
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @typedef {Object} SettingsServiceConfig
|
|
98
|
-
* @property {number} executionTimeout
|
|
99
|
-
* @property {string} healthCheckAddress
|
|
100
|
-
* @property {CronString} healthCheckInterval
|
|
101
|
-
* @property {number} healthCheckTimeout
|
|
102
|
-
* @property {string} serviceRegistryAddress
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
// Utility Definitions:
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @typedef {string} CronString
|
|
109
|
-
*/
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* @typedef {Object} TiEnumValue
|
|
113
|
-
* @property {number|string} value
|
|
114
|
-
* @property {string} name
|
|
115
|
-
* @property {string} [description]
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @typedef {Object} TiEnum
|
|
120
|
-
* @property {Object.<number|string,TiEnumValue>} properties
|
|
121
|
-
* @property {function( (number|string), [string] ): (string|undefined)} name
|
|
122
|
-
* @property {function( (number|string), [string] ): (string|undefined)} description
|
|
123
|
-
* @property {function( (number|string) ): boolean} contains
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @typedef {Object} TiLogEntry
|
|
128
|
-
* @property {string} _id Unique identifier that can be used to identify the document in a NoSQL database.
|
|
129
|
-
* @property {TiLogSeverity} severity The log severity level.
|
|
130
|
-
* @property {string} thread The categorization of the log message.
|
|
131
|
-
* @property {string} reporter
|
|
132
|
-
* @property {string} message The actual log message.
|
|
133
|
-
* @property {number} timestamp The timestamp of the log entry in UTC time.
|
|
134
|
-
* @property {Object} data Additional JSON data to go with the message.
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @typedef {Object} TiTraceEntry
|
|
139
|
-
* @property {string} chainID
|
|
140
|
-
* @property {string} dispatchEvent
|
|
141
|
-
* @property {string} fromAddress
|
|
142
|
-
* @property {string} messageID
|
|
143
|
-
* @property {Object} messageSnapshot
|
|
144
|
-
* @property {string} messageState
|
|
145
|
-
* @property {string} messageType
|
|
146
|
-
* @property {string} toAddress
|
|
147
|
-
* @property {string} traceID
|
|
148
|
-
* @property {number} traceTimestamp
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* The key of this object is the language code, and the value is the textual representation of the label.
|
|
153
|
-
*
|
|
154
|
-
* @typedef {Object<TiLocalizationLanguage, string>} TiLocalizedLabel
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* A nested labels tree where intermediate nodes are objects and leaf nodes are language-to-text maps.
|
|
159
|
-
*
|
|
160
|
-
* @typedef {Object<string, TiLocalizedLabel | TiLabelsTree>} TiLabelsTree
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
// Service Bus Definitions:
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @typedef {Object} ServiceAddress
|
|
167
|
-
* @property {string} serviceAlias A valid service alias.
|
|
168
|
-
* @property {string} serviceDomainName A valid service domain name.
|
|
169
|
-
* @property {number|undefined} serviceVersion Optional service version. If not provided, the latest version will be assumed as a target.
|
|
170
|
-
*/
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* @typedef {Object} ServiceExecContext
|
|
174
|
-
* @property {string|undefined} authToken A valid authentication token that initialized the service call (if applicable).
|
|
175
|
-
* @property {ServiceCallPredecessor|undefined} previousServiceCall The previous service call in the execution chain (if such exists).
|
|
176
|
-
*/
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* @typedef {Message} ServiceCallPredecessor
|
|
180
|
-
* @property {string} predecessor The {@link Message.messageID} of the predecessor in the service call tree.
|
|
181
|
-
* @property {ServiceAddress} serviceAddress The address of the service that has to process the service call.
|
|
182
|
-
* @property {Object|undefined} serviceParams The named params to be provided to the API service.
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @typedef {ServiceCallPredecessor} ServiceCall
|
|
187
|
-
* @property {string} authToken A valid authentication token that initialized the service call.
|
|
188
|
-
* @property {number} createdOn A unix timestamp taken at creation time of the service call.
|
|
189
|
-
* @property {number} executionTime The total execution time of this service call in milliseconds.
|
|
190
|
-
* @property {Object|undefined} exception If there was exception during the service call processing, it will be set here. Otherwise, it will be 'undefined'.
|
|
191
|
-
* @property {number|undefined} finishedOn A unix timestamp taken at finish time of the service call.
|
|
192
|
-
* @property {boolean} isCompleted Flag to indicate if this service call has been completed.
|
|
193
|
-
* @property {boolean|undefined} isSuccessful A flag indicating if this service call can be considered successful or not. Will be 'undefined' until the service call is processed.
|
|
194
|
-
* @property {string[]} successors The service call IDs of the successors in the service call tree.
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* @typedef {Object} ServiceCallResult
|
|
199
|
-
* @property {TiException|undefined} exception If there was exception during the service call processing, it will be set here. Otherwise, it will be 'undefined'.
|
|
200
|
-
* @property {boolean} isSuccessful A flag indicating if this service call can be considered successful or not.
|
|
201
|
-
* @property {Object|string|undefined} payload The payload containing the results from the service call processing. If a string, it is ID of the payload in the memory cache instead.
|
|
202
|
-
*/
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @typedef {Object} ServiceDefinition
|
|
206
|
-
* @property {string} serviceAlias Service alias.
|
|
207
|
-
* @property {string} serviceFile The JS file containing the service itself. This has to be exposed via package.json import structure!
|
|
208
|
-
* @property {number} [serviceVersion] Service version.
|
|
209
|
-
*/
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* @typedef {Object.<string, ServiceInterfaceVersion>} ServiceInterface
|
|
213
|
-
*/
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* @typedef {Object.<number, ServiceHandlerMethod>} ServiceInterfaceVersion
|
|
217
|
-
*/
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* @typedef {Object} ServiceConfiguration
|
|
221
|
-
* @property {ServiceDefinition[]} [services] A list of service definitions to be registered with the {@link ServiceProvider}.
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
// Message Exchange Definitions:
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @typedef {Object} MessageDestination
|
|
228
|
-
* @property {string|undefined} [instanceID] The instance ID of the message exchange by which the message was received (available after acceptance).
|
|
229
|
-
* @property {string} route The route to destination for the message. The exact structure will depend on the implementation of the message exchange.
|
|
230
|
-
*/
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* @typedef {Object} MessageSource
|
|
234
|
-
* @property {string} instanceID The instance ID of the message exchange from which the service call originated.
|
|
235
|
-
* @property {string} route The route from source of the message. The exact structure will depend on the implementation of the message exchange.
|
|
236
|
-
*/
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* @typedef {Object} Message
|
|
240
|
-
* @property {string} chainID Unique identifier of the message chain if the message is part of one.
|
|
241
|
-
* @property {number} chainLevel The node level of this message in the message chain tree.
|
|
242
|
-
* @property {MessageDestination} destination The destination of the message.
|
|
243
|
-
* @property {string} [hash] Security hash for the message if the mechanism is enabled.
|
|
244
|
-
* @property {string} messageID Unique message identifier.
|
|
245
|
-
* @property {Object|string|undefined} payload The message contents to be processed in destination. If a string, it is ID of the payload in the memory cache instead.
|
|
246
|
-
* Note that if this is not an Object or a string, there is no guarantee that it will be delivered in the same/proper format!
|
|
247
|
-
* @property {MessageSource} source The source of the message.
|
|
248
|
-
*/
|
|
1
|
+
/*
|
|
2
|
+
* The ti-engine is an open source, free to use—both for personal and commercial projects—framework for the creation of microservice-based solutions using node.js.
|
|
3
|
+
* Copyright © 2021-2026 Boris Kostadinov <kostadinov.boris@gmail.com>
|
|
4
|
+
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
5
|
+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
6
|
+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Configuration Definitions:
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {string} EnvironmentVariable
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {NodeJS.Process} Environment
|
|
17
|
+
* @property {ProcessEnv} env
|
|
18
|
+
* @property {EnvironmentVariable} env.TI_GCLOUD_API_KEY
|
|
19
|
+
* @property {EnvironmentVariable} env.TI_GCLOUD_ENABLED
|
|
20
|
+
* @property {EnvironmentVariable} env.TI_GCLOUD_PROJECT_ID
|
|
21
|
+
* @property {EnvironmentVariable} env.TI_INSTANCE_CLASS
|
|
22
|
+
* @property {EnvironmentVariable} env.TI_INSTANCE_CONFIG
|
|
23
|
+
* @property {EnvironmentVariable} env.TI_INSTANCE_ID
|
|
24
|
+
* @property {EnvironmentVariable} env.TI_INSTANCE_NAME
|
|
25
|
+
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_CONSOLE_ENABLED
|
|
26
|
+
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_DETAILS
|
|
27
|
+
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_MIN_LEVEL
|
|
28
|
+
* @property {EnvironmentVariable} env.TI_AUDITING_LOG_USES_JSON
|
|
29
|
+
* @property {EnvironmentVariable} env.TI_LOCALIZATION_LABELS_PATH
|
|
30
|
+
* @property {EnvironmentVariable} env.TI_LOCALIZATION_LANGUAGE
|
|
31
|
+
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_AUTH_KEY
|
|
32
|
+
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_REDIS_DB
|
|
33
|
+
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_REDIS_HOST
|
|
34
|
+
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_REDIS_PORT
|
|
35
|
+
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_RETRY_MAX_ATTEMPTS
|
|
36
|
+
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_RETRY_MAX_INTERVAL
|
|
37
|
+
* @property {EnvironmentVariable} env.TI_MEMORY_CACHE_USER
|
|
38
|
+
* @property {EnvironmentVariable} env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_ENABLED
|
|
39
|
+
* @property {EnvironmentVariable} env.TI_MESSAGE_EXCHANGE_SECURITY_HASH_KEY
|
|
40
|
+
* @property {EnvironmentVariable} env.TI_MESSAGE_EXCHANGE_TRACE_LOG_ENABLED
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {Object} SettingsMain
|
|
45
|
+
* @property {SettingsAuditing} auditing
|
|
46
|
+
* @property {SettingsGcloudIntegration} gcloudIntegration
|
|
47
|
+
* @property {SettingsLocalization} localization
|
|
48
|
+
* @property {SettingsMemoryCache} memoryCache
|
|
49
|
+
* @property {SettingsMessageExchange} messageExchange
|
|
50
|
+
* @property {SettingsServiceConfig} serviceConfig
|
|
51
|
+
* @property {string} operationMode
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} SettingsAuditing
|
|
56
|
+
* @property {boolean} logConsoleEnabled
|
|
57
|
+
* @property {boolean} logDetails
|
|
58
|
+
* @property {TiLogSeverity} logMinLevel
|
|
59
|
+
* @property {boolean} logUsesJSON
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {Object} SettingsGcloudIntegration
|
|
64
|
+
* @property {string} apiKey
|
|
65
|
+
* @property {string} projectID
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @typedef {Object} SettingsLocalization
|
|
70
|
+
* @property {Array<string>} labelsPath
|
|
71
|
+
* @property {TiLocalizationLanguage} language
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @typedef {Object} SettingsMemoryCache
|
|
76
|
+
* @property {string} authKey
|
|
77
|
+
* @property {number} redisDB
|
|
78
|
+
* @property {string} redisHost
|
|
79
|
+
* @property {number} redisPort
|
|
80
|
+
* @property {number} retryMaxAttempts
|
|
81
|
+
* @property {number} retryMaxInterval
|
|
82
|
+
* @property {string} user
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {Object} SettingsMessageExchange
|
|
87
|
+
* @property {string} messageQueuePrefix
|
|
88
|
+
* @property {string} messageStore
|
|
89
|
+
* @property {boolean} securityHashEnabled
|
|
90
|
+
* @property {string} securityHashKey
|
|
91
|
+
* @property {number} traceExpirationTime
|
|
92
|
+
* @property {boolean} traceLogEnabled
|
|
93
|
+
* @property {string} traceRepository
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {Object} SettingsServiceConfig
|
|
98
|
+
* @property {number} executionTimeout
|
|
99
|
+
* @property {string} healthCheckAddress
|
|
100
|
+
* @property {CronString} healthCheckInterval
|
|
101
|
+
* @property {number} healthCheckTimeout
|
|
102
|
+
* @property {string} serviceRegistryAddress
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
// Utility Definitions:
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @typedef {string} CronString
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @typedef {Object} TiEnumValue
|
|
113
|
+
* @property {number|string} value
|
|
114
|
+
* @property {string} name
|
|
115
|
+
* @property {string} [description]
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @typedef {Object} TiEnum
|
|
120
|
+
* @property {Object.<number|string,TiEnumValue>} properties
|
|
121
|
+
* @property {function( (number|string), [string] ): (string|undefined)} name
|
|
122
|
+
* @property {function( (number|string), [string] ): (string|undefined)} description
|
|
123
|
+
* @property {function( (number|string) ): boolean} contains
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @typedef {Object} TiLogEntry
|
|
128
|
+
* @property {string} _id Unique identifier that can be used to identify the document in a NoSQL database.
|
|
129
|
+
* @property {TiLogSeverity} severity The log severity level.
|
|
130
|
+
* @property {string} thread The categorization of the log message.
|
|
131
|
+
* @property {string} reporter
|
|
132
|
+
* @property {string} message The actual log message.
|
|
133
|
+
* @property {number} timestamp The timestamp of the log entry in UTC time.
|
|
134
|
+
* @property {Object} data Additional JSON data to go with the message.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @typedef {Object} TiTraceEntry
|
|
139
|
+
* @property {string} chainID
|
|
140
|
+
* @property {string} dispatchEvent
|
|
141
|
+
* @property {string} fromAddress
|
|
142
|
+
* @property {string} messageID
|
|
143
|
+
* @property {Object} messageSnapshot
|
|
144
|
+
* @property {string} messageState
|
|
145
|
+
* @property {string} messageType
|
|
146
|
+
* @property {string} toAddress
|
|
147
|
+
* @property {string} traceID
|
|
148
|
+
* @property {number} traceTimestamp
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The key of this object is the language code, and the value is the textual representation of the label.
|
|
153
|
+
*
|
|
154
|
+
* @typedef {Object<TiLocalizationLanguage, string>} TiLocalizedLabel
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* A nested labels tree where intermediate nodes are objects and leaf nodes are language-to-text maps.
|
|
159
|
+
*
|
|
160
|
+
* @typedef {Object<string, TiLocalizedLabel | TiLabelsTree>} TiLabelsTree
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
// Service Bus Definitions:
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @typedef {Object} ServiceAddress
|
|
167
|
+
* @property {string} serviceAlias A valid service alias.
|
|
168
|
+
* @property {string} serviceDomainName A valid service domain name.
|
|
169
|
+
* @property {number|undefined} serviceVersion Optional service version. If not provided, the latest version will be assumed as a target.
|
|
170
|
+
*/
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @typedef {Object} ServiceExecContext
|
|
174
|
+
* @property {string|undefined} authToken A valid authentication token that initialized the service call (if applicable).
|
|
175
|
+
* @property {ServiceCallPredecessor|undefined} previousServiceCall The previous service call in the execution chain (if such exists).
|
|
176
|
+
*/
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @typedef {Message} ServiceCallPredecessor
|
|
180
|
+
* @property {string} predecessor The {@link Message.messageID} of the predecessor in the service call tree.
|
|
181
|
+
* @property {ServiceAddress} serviceAddress The address of the service that has to process the service call.
|
|
182
|
+
* @property {Object|undefined} serviceParams The named params to be provided to the API service.
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @typedef {ServiceCallPredecessor} ServiceCall
|
|
187
|
+
* @property {string} authToken A valid authentication token that initialized the service call.
|
|
188
|
+
* @property {number} createdOn A unix timestamp taken at creation time of the service call.
|
|
189
|
+
* @property {number} executionTime The total execution time of this service call in milliseconds.
|
|
190
|
+
* @property {Object|undefined} exception If there was exception during the service call processing, it will be set here. Otherwise, it will be 'undefined'.
|
|
191
|
+
* @property {number|undefined} finishedOn A unix timestamp taken at finish time of the service call.
|
|
192
|
+
* @property {boolean} isCompleted Flag to indicate if this service call has been completed.
|
|
193
|
+
* @property {boolean|undefined} isSuccessful A flag indicating if this service call can be considered successful or not. Will be 'undefined' until the service call is processed.
|
|
194
|
+
* @property {string[]} successors The service call IDs of the successors in the service call tree.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @typedef {Object} ServiceCallResult
|
|
199
|
+
* @property {TiException|undefined} exception If there was exception during the service call processing, it will be set here. Otherwise, it will be 'undefined'.
|
|
200
|
+
* @property {boolean} isSuccessful A flag indicating if this service call can be considered successful or not.
|
|
201
|
+
* @property {Object|string|undefined} payload The payload containing the results from the service call processing. If a string, it is ID of the payload in the memory cache instead.
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @typedef {Object} ServiceDefinition
|
|
206
|
+
* @property {string} serviceAlias Service alias.
|
|
207
|
+
* @property {string} serviceFile The JS file containing the service itself. This has to be exposed via package.json import structure!
|
|
208
|
+
* @property {number} [serviceVersion] Service version.
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @typedef {Object.<string, ServiceInterfaceVersion>} ServiceInterface
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @typedef {Object.<number, ServiceHandlerMethod>} ServiceInterfaceVersion
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @typedef {Object} ServiceConfiguration
|
|
221
|
+
* @property {ServiceDefinition[]} [services] A list of service definitions to be registered with the {@link ServiceProvider}.
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
// Message Exchange Definitions:
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @typedef {Object} MessageDestination
|
|
228
|
+
* @property {string|undefined} [instanceID] The instance ID of the message exchange by which the message was received (available after acceptance).
|
|
229
|
+
* @property {string} route The route to destination for the message. The exact structure will depend on the implementation of the message exchange.
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @typedef {Object} MessageSource
|
|
234
|
+
* @property {string} instanceID The instance ID of the message exchange from which the service call originated.
|
|
235
|
+
* @property {string} route The route from source of the message. The exact structure will depend on the implementation of the message exchange.
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @typedef {Object} Message
|
|
240
|
+
* @property {string} chainID Unique identifier of the message chain if the message is part of one.
|
|
241
|
+
* @property {number} chainLevel The node level of this message in the message chain tree.
|
|
242
|
+
* @property {MessageDestination} destination The destination of the message.
|
|
243
|
+
* @property {string} [hash] Security hash for the message if the mechanism is enabled.
|
|
244
|
+
* @property {string} messageID Unique message identifier.
|
|
245
|
+
* @property {Object|string|undefined} payload The message contents to be processed in destination. If a string, it is ID of the payload in the memory cache instead.
|
|
246
|
+
* Note that if this is not an Object or a string, there is no guarantee that it will be delivered in the same/proper format!
|
|
247
|
+
* @property {MessageSource} source The source of the message.
|
|
248
|
+
*/
|