@celerity-sdk/runtime 0.2.3 → 0.3.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/index.d.ts +570 -1
- package/index.js +55 -52
- package/package.json +17 -13
package/index.d.ts
CHANGED
|
@@ -1,31 +1,233 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* An application to run in the Celerity runtime.
|
|
5
|
+
*
|
|
6
|
+
* Depending on the blueprint configuration file, this can run HTTP APIs,
|
|
7
|
+
* WebSocket APIs and event source consumers for the current environment
|
|
8
|
+
* (e.g. SQS queue consumers when deployed to AWS).
|
|
9
|
+
*
|
|
10
|
+
* This class is not thread-safe — handlers run on the Rust async runtime
|
|
11
|
+
* and should not access the application instance directly.
|
|
12
|
+
* Use `websocketRegistry()` to get a thread-safe registry for sending
|
|
13
|
+
* WebSocket messages from handlers.
|
|
14
|
+
*/
|
|
3
15
|
export declare class CoreRuntimeApplication {
|
|
16
|
+
/** Creates a new application with the given runtime configuration. */
|
|
4
17
|
constructor(runtimeConfig: CoreRuntimeConfig)
|
|
18
|
+
/**
|
|
19
|
+
* Sets up the application based on the configuration the application was
|
|
20
|
+
* instantiated with. Returns configuration such as HTTP handler definitions
|
|
21
|
+
* that should be used to register handlers.
|
|
22
|
+
*
|
|
23
|
+
* This must be called before `registerHttpHandler`, `registerWebsocketHandler`,
|
|
24
|
+
* or any other registration methods.
|
|
25
|
+
*/
|
|
5
26
|
setup(): CoreRuntimeAppConfig
|
|
27
|
+
/**
|
|
28
|
+
* Registers a new HTTP handler with the application.
|
|
29
|
+
*
|
|
30
|
+
* The handler must be an async function that takes a `Request` object
|
|
31
|
+
* and returns a `Response` object. An optional timeout in seconds can be
|
|
32
|
+
* specified (defaults to 60s).
|
|
33
|
+
*/
|
|
6
34
|
registerHttpHandler(path: string, method: string, timeoutSeconds: number | undefined | null, handler: (err: Error | null, request: Request) => Promise<Response>): void
|
|
35
|
+
/**
|
|
36
|
+
* Registers a custom authentication guard handler with the application.
|
|
37
|
+
*
|
|
38
|
+
* The handler receives a `GuardInput` and must return a `GuardResult`
|
|
39
|
+
* with status "allowed", "unauthorised", or "forbidden".
|
|
40
|
+
*/
|
|
41
|
+
registerGuardHandler(name: string, handler: (err: Error | null, input: GuardInput) => Promise<GuardResult>): Promise<void>
|
|
42
|
+
/**
|
|
43
|
+
* Registers a consumer event handler with the application.
|
|
44
|
+
*
|
|
45
|
+
* The handler receives a `JsConsumerEventInput` containing a batch of messages
|
|
46
|
+
* and must return a `JsEventResult`. An optional timeout in seconds can be
|
|
47
|
+
* specified (defaults to 60s).
|
|
48
|
+
*/
|
|
49
|
+
registerConsumerHandler(handlerTag: string, timeoutSeconds: number | undefined | null, handler: (err: Error | null, input: JsConsumerEventInput) => Promise<JsEventResult>): void
|
|
50
|
+
/**
|
|
51
|
+
* Registers a schedule event handler with the application.
|
|
52
|
+
*
|
|
53
|
+
* The handler receives a `JsScheduleEventInput` when a schedule fires
|
|
54
|
+
* and must return a `JsEventResult`. An optional timeout in seconds can be
|
|
55
|
+
* specified (defaults to 60s).
|
|
56
|
+
*/
|
|
57
|
+
registerScheduleHandler(handlerTag: string, timeoutSeconds: number | undefined | null, handler: (err: Error | null, input: JsScheduleEventInput) => Promise<JsEventResult>): void
|
|
58
|
+
/**
|
|
59
|
+
* Registers a WebSocket handler with the application for the given route.
|
|
60
|
+
*
|
|
61
|
+
* The handler receives a `JsWebSocketMessageInfo` object for each WebSocket event
|
|
62
|
+
* ($connect, $disconnect, or a message matching the route).
|
|
63
|
+
*/
|
|
64
|
+
registerWebsocketHandler(route: string, handler: (err: Error | null, message: JsWebSocketMessageInfo) => Promise<void>): void
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves the WebSocket registry for the application.
|
|
67
|
+
*
|
|
68
|
+
* The registry allows sending messages to specific WebSocket connections
|
|
69
|
+
* that are either connected to the current node or other nodes in a
|
|
70
|
+
* WebSocket API cluster. The returned registry is thread-safe and can
|
|
71
|
+
* be used from handler functions.
|
|
72
|
+
*/
|
|
73
|
+
websocketRegistry(): CoreWebSocketRegistry
|
|
74
|
+
/**
|
|
75
|
+
* Registers a custom handler that can be invoked programmatically
|
|
76
|
+
* via `invokeHandler()`.
|
|
77
|
+
*
|
|
78
|
+
* An optional timeout in seconds can be specified (defaults to 60s).
|
|
79
|
+
*/
|
|
80
|
+
registerCustomHandler(handlerName: string, timeoutSeconds: number | undefined | null, handler: (err: Error | null, payload: any) => Promise<any>): void
|
|
81
|
+
/**
|
|
82
|
+
* Invokes a registered custom handler by name with the given payload.
|
|
83
|
+
*
|
|
84
|
+
* Returns the result from the handler. Throws if the handler is not
|
|
85
|
+
* registered or the application is not running.
|
|
86
|
+
*/
|
|
87
|
+
invokeHandler(handlerName: string, payload: any): Promise<any>
|
|
88
|
+
/**
|
|
89
|
+
* Runs the application including an HTTP/WebSocket server and event source consumers
|
|
90
|
+
* based on the configuration the application was instantiated with.
|
|
91
|
+
*
|
|
92
|
+
* When `block` is `true`, the method blocks until the application is stopped.
|
|
93
|
+
* When `block` is `false`, the application runs in a background thread and
|
|
94
|
+
* returns immediately — call `shutdown()` to stop it.
|
|
95
|
+
*/
|
|
7
96
|
run(block: boolean): Promise<void>
|
|
97
|
+
/**
|
|
98
|
+
* Shuts down the application and cleans up resources.
|
|
99
|
+
*
|
|
100
|
+
* This should be called when the application is running in non-blocking mode
|
|
101
|
+
* (i.e. `run(false)`) to gracefully stop the server and consumers.
|
|
102
|
+
*/
|
|
8
103
|
shutdown(): void
|
|
9
104
|
}
|
|
10
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Builder for manually creating core runtime configuration
|
|
108
|
+
* that can be used to instantiate an application.
|
|
109
|
+
*/
|
|
11
110
|
export declare class CoreRuntimeConfigBuilder {
|
|
111
|
+
/** Creates a new builder with the required configuration elements. */
|
|
12
112
|
constructor(blueprintConfigPath: string, serviceName: string, serverPort: number)
|
|
113
|
+
/**
|
|
114
|
+
* Sets whether the HTTP/WebSocket server should only be exposed on
|
|
115
|
+
* the loopback interface (127.0.0.1). Defaults to `true`.
|
|
116
|
+
*
|
|
117
|
+
* When running in an environment such as a docker container,
|
|
118
|
+
* this should be set to `false` so that the server can be accessed
|
|
119
|
+
* from outside the container.
|
|
120
|
+
*/
|
|
13
121
|
setServerLoopbackOnly(value: boolean): this
|
|
122
|
+
/**
|
|
123
|
+
* Sets whether the runtime should use a custom health check endpoint.
|
|
124
|
+
* Defaults to `false`.
|
|
125
|
+
*
|
|
126
|
+
* When `false`, the `GET /runtime/health/check` endpoint returns 200 OK.
|
|
127
|
+
* The default health check is not accessible under custom base paths
|
|
128
|
+
* and is only accessible from the root path.
|
|
129
|
+
*/
|
|
14
130
|
setUseCustomHealthCheck(value: boolean): this
|
|
131
|
+
/**
|
|
132
|
+
* Sets the endpoint for sending trace data to an OTLP collector.
|
|
133
|
+
* Defaults to `"http://otelcollector:4317"`.
|
|
134
|
+
*/
|
|
15
135
|
setTraceOtlpCollectorEndpoint(value: string): this
|
|
136
|
+
/**
|
|
137
|
+
* Sets the maximum diagnostics level for logging and tracing.
|
|
138
|
+
* Defaults to `"info"`.
|
|
139
|
+
*/
|
|
16
140
|
setRuntimeMaxDiagnosticsLevel(value: string): this
|
|
141
|
+
/**
|
|
142
|
+
* Sets the platform the application is running on.
|
|
143
|
+
* Defaults to `CoreRuntimePlatform.Other`.
|
|
144
|
+
*
|
|
145
|
+
* This determines which platform-specific features are available,
|
|
146
|
+
* such as AWS X-Ray trace propagation.
|
|
147
|
+
*/
|
|
17
148
|
setPlatform(value: CoreRuntimePlatform): this
|
|
149
|
+
/**
|
|
150
|
+
* Sets whether the runtime is running in test mode
|
|
151
|
+
* (e.g. for integration tests). Defaults to `false`.
|
|
152
|
+
*/
|
|
18
153
|
setTestMode(value: boolean): this
|
|
154
|
+
/**
|
|
155
|
+
* Sets the name of the API resource in the blueprint to use as the
|
|
156
|
+
* configuration source for setting up API endpoints.
|
|
157
|
+
*/
|
|
19
158
|
setApiResource(value: string): this
|
|
159
|
+
/**
|
|
160
|
+
* Sets the name of the consumer app in the blueprint to use as the
|
|
161
|
+
* configuration source for setting up event source consumers.
|
|
162
|
+
*
|
|
163
|
+
* If not set, the runtime will use the first `celerity/consumer`
|
|
164
|
+
* resource defined in the blueprint.
|
|
165
|
+
*/
|
|
20
166
|
setConsumerApp(value: string): this
|
|
167
|
+
/**
|
|
168
|
+
* Sets the name of the schedule app in the blueprint to use as the
|
|
169
|
+
* configuration source for setting up scheduled event handlers.
|
|
170
|
+
*
|
|
171
|
+
* If not set, the runtime will use the first `celerity/schedule`
|
|
172
|
+
* resource defined in the blueprint.
|
|
173
|
+
*/
|
|
21
174
|
setScheduleApp(value: string): this
|
|
175
|
+
/**
|
|
176
|
+
* Sets whether to verify TLS certificates when making requests
|
|
177
|
+
* to the resource store. Defaults to `true`.
|
|
178
|
+
*
|
|
179
|
+
* Must be `true` for production environments; can be `false`
|
|
180
|
+
* for development environments with self-signed certificates.
|
|
181
|
+
*/
|
|
22
182
|
setResourceStoreVerifyTls(value: boolean): this
|
|
183
|
+
/**
|
|
184
|
+
* Sets the TTL in seconds for cache entries in the resource store.
|
|
185
|
+
* Defaults to 600 seconds (10 minutes).
|
|
186
|
+
*/
|
|
23
187
|
setResourceStoreCacheEntryTtl(value: number): this
|
|
188
|
+
/**
|
|
189
|
+
* Sets the interval in seconds at which the resource store cleanup
|
|
190
|
+
* task should run. Defaults to 3600 seconds (1 hour).
|
|
191
|
+
*/
|
|
24
192
|
setResourceStoreCleanupInterval(value: number): this
|
|
193
|
+
/**
|
|
194
|
+
* Sets the source used to resolve client IP addresses.
|
|
195
|
+
*
|
|
196
|
+
* One of: "ConnectInfo", "CfConnectingIp", "TrueClientIp",
|
|
197
|
+
* "CloudFrontViewerAddress", "RightmostXForwardedFor", "XRealIp", "FlyClientIp".
|
|
198
|
+
* Defaults to "ConnectInfo".
|
|
199
|
+
*/
|
|
25
200
|
setClientIpSource(value: string): this
|
|
201
|
+
/**
|
|
202
|
+
* Sets the log output format.
|
|
203
|
+
* If not set, falls back to the `CELERITY_LOG_FORMAT` environment variable.
|
|
204
|
+
*/
|
|
205
|
+
setLogFormat(value: string): this
|
|
206
|
+
/** Sets whether to enable metrics collection. Defaults to `false`. */
|
|
207
|
+
setMetricsEnabled(value: boolean): this
|
|
208
|
+
/** Sets the trace sampling ratio (0.0–1.0). Defaults to `0.1` (10%). */
|
|
209
|
+
setTraceSampleRatio(value: number): this
|
|
210
|
+
/** Builds a new runtime configuration object from the values set on the builder. */
|
|
26
211
|
build(): CoreRuntimeConfig
|
|
27
212
|
}
|
|
28
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Registry for sending messages to WebSocket connections.
|
|
216
|
+
*
|
|
217
|
+
* This is thread-safe and can be used from handler functions to send messages
|
|
218
|
+
* to clients connected to the current node or other nodes in a WebSocket API cluster.
|
|
219
|
+
*/
|
|
220
|
+
export declare class CoreWebSocketRegistry {
|
|
221
|
+
/**
|
|
222
|
+
* Sends a message to a WebSocket connection.
|
|
223
|
+
*
|
|
224
|
+
* The connection can be on the current node or on another node in a
|
|
225
|
+
* WebSocket API cluster. The message type determines whether the
|
|
226
|
+
* message is sent as JSON text or binary data.
|
|
227
|
+
*/
|
|
228
|
+
sendMessage(connectionId: string, messageId: string, messageType: JsMessageType, message: string, ctx?: JsSendContext | undefined | null): Promise<void>
|
|
229
|
+
}
|
|
230
|
+
|
|
29
231
|
export declare class Request {
|
|
30
232
|
/**
|
|
31
233
|
* Allows the creation of requests, primarily for test purposes.
|
|
@@ -80,25 +282,133 @@ export declare class Request {
|
|
|
80
282
|
}
|
|
81
283
|
export type JsRequestWrapper = Request
|
|
82
284
|
|
|
285
|
+
/** Configuration for HTTP and WebSocket APIs. */
|
|
83
286
|
export interface CoreApiConfig {
|
|
287
|
+
/** Configuration for HTTP endpoint handlers, or undefined if no HTTP handlers are configured. */
|
|
84
288
|
http?: CoreHttpConfig
|
|
289
|
+
/**
|
|
290
|
+
* Configuration for WebSocket connection lifecycle and message handlers,
|
|
291
|
+
* or undefined if no WebSocket handlers are configured.
|
|
292
|
+
*/
|
|
85
293
|
websocket?: CoreWebsocketConfig
|
|
294
|
+
/**
|
|
295
|
+
* Configuration for authentication guard handlers,
|
|
296
|
+
* or undefined if no guards are configured.
|
|
297
|
+
*/
|
|
298
|
+
guards?: CoreGuardsConfig
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/** Configuration for an individual event source consumer. */
|
|
302
|
+
export interface CoreConsumerConfig {
|
|
303
|
+
/** The name of the consumer. */
|
|
304
|
+
consumerName: string
|
|
305
|
+
/** The identifier of the event source (e.g. queue URL or stream name). */
|
|
306
|
+
sourceId: string
|
|
307
|
+
/** Maximum number of messages to process in a single batch. */
|
|
308
|
+
batchSize?: number
|
|
309
|
+
/** Time in seconds before a message becomes visible again after being received. */
|
|
310
|
+
visibilityTimeout?: number
|
|
311
|
+
/** Long-polling wait time in seconds. */
|
|
312
|
+
waitTimeSeconds?: number
|
|
313
|
+
/** Whether to report partial batch failures. */
|
|
314
|
+
partialFailures?: boolean
|
|
315
|
+
/** Optional routing key for filtering messages. */
|
|
316
|
+
routingKey?: string
|
|
317
|
+
/** List of event handler definitions for this consumer. */
|
|
318
|
+
handlers: Array<CoreEventHandlerDefinition>
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** Configuration for event source consumers. */
|
|
322
|
+
export interface CoreConsumersConfig {
|
|
323
|
+
/** List of consumer configurations parsed from the blueprint. */
|
|
324
|
+
consumers: Array<CoreConsumerConfig>
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** Definition of a custom handler that can be invoked programmatically. */
|
|
328
|
+
export interface CoreCustomHandlerDefinition {
|
|
329
|
+
/** The name of the custom handler. */
|
|
330
|
+
name: string
|
|
331
|
+
/** The file location of the handler. */
|
|
332
|
+
location: string
|
|
333
|
+
/** The fully qualified handler function (e.g. "module.function"). */
|
|
334
|
+
handler: string
|
|
335
|
+
/** The timeout in seconds for the handler. */
|
|
336
|
+
timeout: number
|
|
337
|
+
/** Whether distributed tracing is enabled for the handler. */
|
|
338
|
+
tracingEnabled: boolean
|
|
86
339
|
}
|
|
87
340
|
|
|
341
|
+
/** Configuration for custom handler invocations. */
|
|
342
|
+
export interface CoreCustomHandlersConfig {
|
|
343
|
+
/** List of custom handler definitions parsed from the blueprint. */
|
|
344
|
+
handlers: Array<CoreCustomHandlerDefinition>
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** Definition of an event handler for consumers or schedules. */
|
|
348
|
+
export interface CoreEventHandlerDefinition {
|
|
349
|
+
/** The name of the handler. */
|
|
350
|
+
name: string
|
|
351
|
+
/** The file location of the handler. */
|
|
352
|
+
location: string
|
|
353
|
+
/** The fully qualified handler function (e.g. "module.function"). */
|
|
354
|
+
handler: string
|
|
355
|
+
/** The timeout in seconds for the handler. */
|
|
356
|
+
timeout: number
|
|
357
|
+
/** Whether distributed tracing is enabled for the handler. */
|
|
358
|
+
tracingEnabled: boolean
|
|
359
|
+
/** Optional routing key for the handler. */
|
|
360
|
+
route?: string
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** Definition of a guard handler. */
|
|
364
|
+
export interface CoreGuardHandlerDefinition {
|
|
365
|
+
/** The name of the guard handler as defined in the blueprint. */
|
|
366
|
+
name: string
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Configuration for authentication guard handlers. */
|
|
370
|
+
export interface CoreGuardsConfig {
|
|
371
|
+
/** List of guard handler definitions parsed from the blueprint. */
|
|
372
|
+
handlers: Array<CoreGuardHandlerDefinition>
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** Configuration for HTTP endpoint handlers. */
|
|
88
376
|
export interface CoreHttpConfig {
|
|
377
|
+
/** List of HTTP handler definitions parsed from the blueprint. */
|
|
89
378
|
handlers: Array<CoreHttpHandlerDefinition>
|
|
90
379
|
}
|
|
91
380
|
|
|
381
|
+
/** Definition of an HTTP handler. */
|
|
92
382
|
export interface CoreHttpHandlerDefinition {
|
|
383
|
+
/** The name of the handler as defined in the blueprint. */
|
|
384
|
+
name: string
|
|
385
|
+
/** The path of the handler (e.g. "/items/{itemId}"). */
|
|
93
386
|
path: string
|
|
387
|
+
/** The HTTP method of the handler (e.g. "GET", "POST"). */
|
|
94
388
|
method: string
|
|
389
|
+
/** The file location of the handler. */
|
|
95
390
|
location: string
|
|
391
|
+
/** The fully qualified handler function (e.g. "module.function"). */
|
|
96
392
|
handler: string
|
|
393
|
+
/** The timeout in seconds for the handler. */
|
|
97
394
|
timeout: number
|
|
98
395
|
}
|
|
99
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Configuration for the application running in the Celerity runtime.
|
|
399
|
+
*
|
|
400
|
+
* Returned by `CoreRuntimeApplication.setup()` and contains the handler definitions
|
|
401
|
+
* that should be used to register handlers with the application.
|
|
402
|
+
*/
|
|
100
403
|
export interface CoreRuntimeAppConfig {
|
|
404
|
+
/** Configuration for HTTP and WebSocket APIs, or undefined if no API is configured. */
|
|
101
405
|
api?: CoreApiConfig
|
|
406
|
+
/** Configuration for event source consumers, or undefined if none are configured. */
|
|
407
|
+
consumers?: CoreConsumersConfig
|
|
408
|
+
/** Configuration for scheduled event handlers, or undefined if none are configured. */
|
|
409
|
+
schedules?: CoreSchedulesConfig
|
|
410
|
+
/** Configuration for custom handler invocations, or undefined if none are configured. */
|
|
411
|
+
customHandlers?: CoreCustomHandlersConfig
|
|
102
412
|
}
|
|
103
413
|
|
|
104
414
|
export interface CoreRuntimeConfig {
|
|
@@ -123,6 +433,15 @@ export interface CoreRuntimeConfig {
|
|
|
123
433
|
* "CloudFrontViewerAddress", "RightmostXForwardedFor", "XRealIp", "FlyClientIp".
|
|
124
434
|
*/
|
|
125
435
|
clientIpSource?: string
|
|
436
|
+
/**
|
|
437
|
+
* The log output format. If not set, falls back to the `CELERITY_LOG_FORMAT`
|
|
438
|
+
* environment variable.
|
|
439
|
+
*/
|
|
440
|
+
logFormat?: string
|
|
441
|
+
/** Whether to enable metrics collection. Defaults to `false` when not set. */
|
|
442
|
+
metricsEnabled?: boolean
|
|
443
|
+
/** The trace sampling ratio (0.0–1.0). Defaults to `0.1` (10%) when not set. */
|
|
444
|
+
traceSampleRatio?: number
|
|
126
445
|
}
|
|
127
446
|
|
|
128
447
|
/** The platform the runtime is running on. */
|
|
@@ -134,16 +453,266 @@ export declare const enum CoreRuntimePlatform {
|
|
|
134
453
|
Other = 'other'
|
|
135
454
|
}
|
|
136
455
|
|
|
456
|
+
/** Configuration for an individual schedule. */
|
|
457
|
+
export interface CoreScheduleConfig {
|
|
458
|
+
/** The identifier of the schedule. */
|
|
459
|
+
scheduleId: string
|
|
460
|
+
/** The schedule expression (e.g. cron expression or rate). */
|
|
461
|
+
scheduleValue: string
|
|
462
|
+
/** List of event handler definitions for this schedule. */
|
|
463
|
+
handlers: Array<CoreEventHandlerDefinition>
|
|
464
|
+
/** Optional input data to pass to schedule handlers. */
|
|
465
|
+
input?: any
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** Configuration for scheduled event handlers. */
|
|
469
|
+
export interface CoreSchedulesConfig {
|
|
470
|
+
/** List of schedule configurations parsed from the blueprint. */
|
|
471
|
+
schedules: Array<CoreScheduleConfig>
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/** Configuration for WebSocket connection lifecycle and message handlers. */
|
|
137
475
|
export interface CoreWebsocketConfig {
|
|
476
|
+
/** List of WebSocket handler definitions parsed from the blueprint. */
|
|
477
|
+
handlers: Array<CoreWebSocketHandlerDefinition>
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** Definition of a WebSocket handler. */
|
|
481
|
+
export interface CoreWebSocketHandlerDefinition {
|
|
482
|
+
/** The name of the WebSocket handler. */
|
|
483
|
+
name: string
|
|
484
|
+
/** The route of the handler (e.g. "$connect", "$default", "$disconnect", or a custom route). */
|
|
485
|
+
route: string
|
|
486
|
+
/** The file location of the handler. */
|
|
487
|
+
location: string
|
|
488
|
+
/** The fully qualified handler function (e.g. "module.function"). */
|
|
489
|
+
handler: string
|
|
490
|
+
/** The timeout in seconds for the handler. */
|
|
491
|
+
timeout: number
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** The input passed to a guard handler callback from the Rust runtime. */
|
|
495
|
+
export interface GuardInput {
|
|
496
|
+
/**
|
|
497
|
+
* The auth token extracted from the request by the runtime
|
|
498
|
+
* (using the configured token source and auth scheme).
|
|
499
|
+
*/
|
|
500
|
+
token: string
|
|
501
|
+
/** Request information available to the guard. */
|
|
502
|
+
request: GuardRequestInfo
|
|
503
|
+
/**
|
|
504
|
+
* Accumulated auth context from preceding guards in the chain.
|
|
505
|
+
* Keyed by guard name, e.g. `{ "jwt": { "claims": { ... } } }`.
|
|
506
|
+
* Empty for the first guard in the chain.
|
|
507
|
+
*/
|
|
508
|
+
auth: any
|
|
509
|
+
/**
|
|
510
|
+
* The blueprint handler name for the route being protected (e.g. "Orders").
|
|
511
|
+
* None for WebSocket connections and when no name is available.
|
|
512
|
+
*/
|
|
513
|
+
handlerName?: string
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/** HTTP request information available to guard handlers. */
|
|
517
|
+
export interface GuardRequestInfo {
|
|
518
|
+
method: string
|
|
519
|
+
path: string
|
|
520
|
+
headers: Record<string, Array<string>>
|
|
521
|
+
query: Record<string, Array<string>>
|
|
522
|
+
cookies: Record<string, string>
|
|
523
|
+
body?: string
|
|
524
|
+
requestId: string
|
|
525
|
+
clientIp: string
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/** The result returned from a guard handler callback. */
|
|
529
|
+
export interface GuardResult {
|
|
530
|
+
/** One of: "allowed", "unauthorised", "forbidden", "error". */
|
|
531
|
+
status: string
|
|
532
|
+
/** The auth context to store for this guard (returned on success). */
|
|
533
|
+
auth?: any
|
|
534
|
+
/** Error message (returned on failure). */
|
|
535
|
+
message?: string
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/** The handler input for when consumer event messages are received from an event source. */
|
|
539
|
+
export interface JsConsumerEventInput {
|
|
540
|
+
/** A tag identifying the handler, in the format "source::\<source_id\>::\<handler_name\>". */
|
|
541
|
+
handlerTag: string
|
|
542
|
+
/** List of consumer messages in the batch. */
|
|
543
|
+
messages: Array<JsConsumerMessage>
|
|
544
|
+
/** Vendor-specific metadata for the event source (e.g. AWS SQS metadata). */
|
|
545
|
+
vendor: any
|
|
546
|
+
/**
|
|
547
|
+
* A dictionary of trace context including a W3C Trace Context string
|
|
548
|
+
* (in the traceparent format) and platform specific trace IDs.
|
|
549
|
+
*/
|
|
550
|
+
traceContext?: Record<string, string>
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** A single message from an event source consumer. */
|
|
554
|
+
export interface JsConsumerMessage {
|
|
555
|
+
/** The unique identifier of the message. */
|
|
556
|
+
messageId: string
|
|
557
|
+
/** The message body as a string. */
|
|
558
|
+
body: string
|
|
559
|
+
/** The source of the message (e.g. queue URL or stream name). */
|
|
560
|
+
source: string
|
|
561
|
+
/** Vendor-specific message attributes. */
|
|
562
|
+
messageAttributes: any
|
|
563
|
+
/** Vendor-specific metadata for the message. */
|
|
564
|
+
vendor: any
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/** The result returned from a consumer or schedule event handler. */
|
|
568
|
+
export interface JsEventResult {
|
|
569
|
+
/** Whether the event was processed successfully. */
|
|
570
|
+
success: boolean
|
|
571
|
+
/**
|
|
572
|
+
* Optional list of individual message processing failures
|
|
573
|
+
* (for partial failure reporting in consumer handlers).
|
|
574
|
+
*/
|
|
575
|
+
failures?: Array<JsMessageProcessingFailure>
|
|
576
|
+
/** Optional error message (used for schedule handler failures). */
|
|
577
|
+
errorMessage?: string
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/** Represents a failure to process an individual message in a consumer batch. */
|
|
581
|
+
export interface JsMessageProcessingFailure {
|
|
582
|
+
/** The ID of the message that failed to process. */
|
|
583
|
+
messageId: string
|
|
584
|
+
/** Optional description of the error. */
|
|
585
|
+
errorMessage?: string
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Request context for a WebSocket message.
|
|
590
|
+
*
|
|
591
|
+
* Contains information about the original HTTP request that was
|
|
592
|
+
* upgraded to a WebSocket connection.
|
|
593
|
+
*/
|
|
594
|
+
export interface JsMessageRequestContext {
|
|
595
|
+
/** The ID of the request. */
|
|
596
|
+
requestId: string
|
|
597
|
+
/** The time the request was received as a Unix timestamp in milliseconds. */
|
|
598
|
+
requestTime: number
|
|
599
|
+
/** The path of the request including query string. */
|
|
600
|
+
path: string
|
|
601
|
+
/** The protocol version of the original HTTP request (e.g. "HTTP/1.1"). */
|
|
602
|
+
protocolVersion: string
|
|
603
|
+
/** A dictionary of HTTP headers, allowing for multiple values per header name. */
|
|
604
|
+
headers: Record<string, Array<string>>
|
|
605
|
+
/** The value of the User-Agent header, or undefined if not present. */
|
|
606
|
+
userAgent?: string
|
|
607
|
+
/**
|
|
608
|
+
* The secure IP address of the client extracted from trusted headers
|
|
609
|
+
* or directly from the socket.
|
|
610
|
+
*/
|
|
611
|
+
clientIp: string
|
|
612
|
+
/** A dictionary of query parameters, allowing for multiple values per parameter name. */
|
|
613
|
+
query: Record<string, Array<string>>
|
|
614
|
+
/** A dictionary of cookies. */
|
|
615
|
+
cookies: Record<string, string>
|
|
616
|
+
/** Authentication context from the auth middleware, or undefined if no auth. */
|
|
617
|
+
auth?: any
|
|
618
|
+
/**
|
|
619
|
+
* A dictionary of trace context including a W3C Trace Context string
|
|
620
|
+
* (in the traceparent format) and platform specific trace IDs.
|
|
621
|
+
*/
|
|
622
|
+
traceContext?: Record<string, string>
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/** The type of message to send to a WebSocket connection. */
|
|
626
|
+
export declare const enum JsMessageType {
|
|
627
|
+
/** A JSON text message. */
|
|
628
|
+
Json = 'json',
|
|
629
|
+
/** A binary message (base64-encoded when passed as a string). */
|
|
630
|
+
Binary = 'binary'
|
|
631
|
+
}
|
|
138
632
|
|
|
633
|
+
/** The handler input for when a scheduled event is triggered. */
|
|
634
|
+
export interface JsScheduleEventInput {
|
|
635
|
+
/** A tag identifying the handler, in the format "source::\<schedule_id\>::\<handler_name\>". */
|
|
636
|
+
handlerTag: string
|
|
637
|
+
/** The identifier of the schedule that triggered the event. */
|
|
638
|
+
scheduleId: string
|
|
639
|
+
/** The unique identifier of the schedule event message. */
|
|
640
|
+
messageId: string
|
|
641
|
+
/** The schedule expression (e.g. cron expression or rate). */
|
|
642
|
+
schedule: string
|
|
643
|
+
/** Optional input data configured for the schedule. */
|
|
644
|
+
input?: any
|
|
645
|
+
/** Vendor-specific metadata for the schedule event. */
|
|
646
|
+
vendor: any
|
|
647
|
+
/**
|
|
648
|
+
* A dictionary of trace context including a W3C Trace Context string
|
|
649
|
+
* (in the traceparent format) and platform specific trace IDs.
|
|
650
|
+
*/
|
|
651
|
+
traceContext?: Record<string, string>
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/** Context for sending a message to a WebSocket connection. */
|
|
655
|
+
export interface JsSendContext {
|
|
656
|
+
/** The name of the caller sending the message. */
|
|
657
|
+
caller?: string
|
|
658
|
+
/** Whether to wait for an acknowledgement from the client. */
|
|
659
|
+
waitForAck: boolean
|
|
660
|
+
/** List of client IDs to inform when a message is considered lost. */
|
|
661
|
+
informClients: Array<string>
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/** The type of event that a handler receives for a WebSocket connection. */
|
|
665
|
+
export declare const enum JsWebSocketEventType {
|
|
666
|
+
/** A new WebSocket connection was established. */
|
|
667
|
+
Connect = 'connect',
|
|
668
|
+
/** A message was received on an existing WebSocket connection. */
|
|
669
|
+
Message = 'message',
|
|
670
|
+
/** A WebSocket connection was closed. */
|
|
671
|
+
Disconnect = 'disconnect'
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* The handler input for when a WebSocket event occurs.
|
|
676
|
+
*
|
|
677
|
+
* This includes the message content, event type, connection information,
|
|
678
|
+
* and context from the original HTTP upgrade request.
|
|
679
|
+
*/
|
|
680
|
+
export interface JsWebSocketMessageInfo {
|
|
681
|
+
/** The type of the message: "json" or "binary". */
|
|
682
|
+
messageType: string
|
|
683
|
+
/** The type of event: connect, message, or disconnect. */
|
|
684
|
+
eventType: JsWebSocketEventType
|
|
685
|
+
/** The ID of the WebSocket connection. */
|
|
686
|
+
connectionId: string
|
|
687
|
+
/** The ID of the message. */
|
|
688
|
+
messageId: string
|
|
689
|
+
/** The JSON body of the message, set when message_type is "json". */
|
|
690
|
+
jsonBody?: any
|
|
691
|
+
/** The binary body of the message as a Buffer, set when message_type is "binary". */
|
|
692
|
+
binaryBody?: Buffer
|
|
693
|
+
/** The context of the original HTTP request that upgraded to a WebSocket connection. */
|
|
694
|
+
requestContext?: JsMessageRequestContext
|
|
695
|
+
/** A dictionary of trace context for distributed tracing propagation. */
|
|
696
|
+
traceContext?: Record<string, string>
|
|
139
697
|
}
|
|
140
698
|
|
|
699
|
+
/** HTTP response to return to the client from a handler. */
|
|
141
700
|
export interface Response {
|
|
701
|
+
/** HTTP status code to return to the client (e.g. 200, 404, 500). */
|
|
142
702
|
status: number
|
|
703
|
+
/** Optional headers to return to the client. */
|
|
143
704
|
headers?: Record<string, string>
|
|
705
|
+
/** Optional text body to return to the client. */
|
|
144
706
|
body?: string
|
|
707
|
+
/** Optional binary body to return to the client as a Buffer. */
|
|
145
708
|
binaryBody?: Buffer
|
|
146
709
|
}
|
|
147
710
|
|
|
148
|
-
/**
|
|
711
|
+
/**
|
|
712
|
+
* Creates a `CoreRuntimeConfig` by reading from `CELERITY_*` environment variables.
|
|
713
|
+
*
|
|
714
|
+
* This reads all `CELERITY_*` environment variables and constructs a runtime
|
|
715
|
+
* configuration object. This is the recommended way to create a runtime config
|
|
716
|
+
* when deploying to a managed environment.
|
|
717
|
+
*/
|
|
149
718
|
export declare function runtimeConfigFromEnv(): CoreRuntimeConfig
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@celerity-sdk/runtime-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@celerity-sdk/runtime-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
80
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@celerity-sdk/runtime-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@celerity-sdk/runtime-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
96
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@celerity-sdk/runtime-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@celerity-sdk/runtime-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
117
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@celerity-sdk/runtime-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@celerity-sdk/runtime-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
133
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@celerity-sdk/runtime-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@celerity-sdk/runtime-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@celerity-sdk/runtime-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@celerity-sdk/runtime-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
166
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@celerity-sdk/runtime-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@celerity-sdk/runtime-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
185
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@celerity-sdk/runtime-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@celerity-sdk/runtime-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
201
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@celerity-sdk/runtime-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@celerity-sdk/runtime-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
217
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@celerity-sdk/runtime-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@celerity-sdk/runtime-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
237
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@celerity-sdk/runtime-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@celerity-sdk/runtime-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
253
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@celerity-sdk/runtime-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
274
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@celerity-sdk/runtime-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
290
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@celerity-sdk/runtime-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
308
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@celerity-sdk/runtime-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
324
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@celerity-sdk/runtime-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
342
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@celerity-sdk/runtime-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
358
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@celerity-sdk/runtime-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
376
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@celerity-sdk/runtime-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
392
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@celerity-sdk/runtime-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
410
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@celerity-sdk/runtime-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
426
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@celerity-sdk/runtime-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@celerity-sdk/runtime-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@celerity-sdk/runtime-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@celerity-sdk/runtime-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@celerity-sdk/runtime-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
479
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@celerity-sdk/runtime-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@celerity-sdk/runtime-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
495
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@celerity-sdk/runtime-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@celerity-sdk/runtime-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
511
|
+
if (bindingPackageVersion !== '0.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -578,7 +578,10 @@ if (!nativeBinding) {
|
|
|
578
578
|
module.exports = nativeBinding
|
|
579
579
|
module.exports.CoreRuntimeApplication = nativeBinding.CoreRuntimeApplication
|
|
580
580
|
module.exports.CoreRuntimeConfigBuilder = nativeBinding.CoreRuntimeConfigBuilder
|
|
581
|
+
module.exports.CoreWebSocketRegistry = nativeBinding.CoreWebSocketRegistry
|
|
581
582
|
module.exports.Request = nativeBinding.Request
|
|
582
583
|
module.exports.JsRequestWrapper = nativeBinding.JsRequestWrapper
|
|
583
584
|
module.exports.CoreRuntimePlatform = nativeBinding.CoreRuntimePlatform
|
|
585
|
+
module.exports.JsMessageType = nativeBinding.JsMessageType
|
|
586
|
+
module.exports.JsWebSocketEventType = nativeBinding.JsWebSocketEventType
|
|
584
587
|
module.exports.runtimeConfigFromEnv = nativeBinding.runtimeConfigFromEnv
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celerity-sdk/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -30,9 +30,12 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@dotenvx/dotenvx": "^1.45.2",
|
|
32
32
|
"@napi-rs/cli": "^3.0.0",
|
|
33
|
+
"@types/ws": "^8.5.0",
|
|
33
34
|
"ava": "^6.0.1",
|
|
35
|
+
"ioredis": "^5.4.0",
|
|
34
36
|
"tsx": "^4.19.0",
|
|
35
|
-
"typescript": "^5.7.0"
|
|
37
|
+
"typescript": "^5.7.0",
|
|
38
|
+
"ws": "^8.18.0"
|
|
36
39
|
},
|
|
37
40
|
"ava": {
|
|
38
41
|
"timeout": "3m",
|
|
@@ -48,22 +51,23 @@
|
|
|
48
51
|
},
|
|
49
52
|
"scripts": {
|
|
50
53
|
"artifacts": "napi artifacts",
|
|
51
|
-
"build": "napi build --platform --release",
|
|
54
|
+
"build": "napi build --platform --release -F celerity_local_consumers,aws_consumers,gcloud_consumers,azure_consumers",
|
|
52
55
|
"build:debug": "napi build --platform",
|
|
53
56
|
"prepublishOnly": "napi prepublish -t npm --no-gh-release",
|
|
54
|
-
"test": "
|
|
57
|
+
"test": "bash scripts/test.sh",
|
|
58
|
+
"test:no-deps": "dotenvx run -f .env.test -- ava -s",
|
|
55
59
|
"universal": "napi universalize",
|
|
56
60
|
"version": "napi version"
|
|
57
61
|
},
|
|
58
62
|
"optionalDependencies": {
|
|
59
|
-
"@celerity-sdk/runtime-darwin-arm64": "0.
|
|
60
|
-
"@celerity-sdk/runtime-linux-arm64-gnu": "0.
|
|
61
|
-
"@celerity-sdk/runtime-linux-arm64-musl": "0.
|
|
62
|
-
"@celerity-sdk/runtime-win32-arm64-msvc": "0.
|
|
63
|
-
"@celerity-sdk/runtime-darwin-x64": "0.
|
|
64
|
-
"@celerity-sdk/runtime-win32-x64-msvc": "0.
|
|
65
|
-
"@celerity-sdk/runtime-linux-x64-gnu": "0.
|
|
66
|
-
"@celerity-sdk/runtime-linux-x64-musl": "0.
|
|
67
|
-
"@celerity-sdk/runtime-freebsd-x64": "0.
|
|
63
|
+
"@celerity-sdk/runtime-darwin-arm64": "0.3.1",
|
|
64
|
+
"@celerity-sdk/runtime-linux-arm64-gnu": "0.3.1",
|
|
65
|
+
"@celerity-sdk/runtime-linux-arm64-musl": "0.3.1",
|
|
66
|
+
"@celerity-sdk/runtime-win32-arm64-msvc": "0.3.1",
|
|
67
|
+
"@celerity-sdk/runtime-darwin-x64": "0.3.1",
|
|
68
|
+
"@celerity-sdk/runtime-win32-x64-msvc": "0.3.1",
|
|
69
|
+
"@celerity-sdk/runtime-linux-x64-gnu": "0.3.1",
|
|
70
|
+
"@celerity-sdk/runtime-linux-x64-musl": "0.3.1",
|
|
71
|
+
"@celerity-sdk/runtime-freebsd-x64": "0.3.1"
|
|
68
72
|
}
|
|
69
73
|
}
|