@zlink-systems/zlink 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +198 -0
- package/README.typedoc.md +56 -0
- package/THIRD_PARTY_NOTICES.md +84 -0
- package/binding.gyp +27 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +117 -0
- package/dist/index.mjs +4 -0
- package/dist/zlink/contracts/core/buffer_like.d.ts +2 -0
- package/dist/zlink/contracts/core/buffer_like.js +3 -0
- package/dist/zlink/contracts/core/context.d.ts +103 -0
- package/dist/zlink/contracts/core/context.js +11 -0
- package/dist/zlink/contracts/core/index.d.ts +3 -0
- package/dist/zlink/contracts/core/index.js +20 -0
- package/dist/zlink/contracts/core/routing_id.d.ts +28 -0
- package/dist/zlink/contracts/core/routing_id.js +120 -0
- package/dist/zlink/contracts/errors/errors.d.ts +44 -0
- package/dist/zlink/contracts/errors/errors.js +89 -0
- package/dist/zlink/contracts/errors/index.d.ts +2 -0
- package/dist/zlink/contracts/errors/index.js +29 -0
- package/dist/zlink/contracts/errors/results.d.ts +106 -0
- package/dist/zlink/contracts/errors/results.js +102 -0
- package/dist/zlink/contracts/eventing/index.d.ts +3 -0
- package/dist/zlink/contracts/eventing/index.js +20 -0
- package/dist/zlink/contracts/eventing/monitor.d.ts +157 -0
- package/dist/zlink/contracts/eventing/monitor.js +82 -0
- package/dist/zlink/contracts/eventing/poller.d.ts +76 -0
- package/dist/zlink/contracts/eventing/poller.js +3 -0
- package/dist/zlink/contracts/eventing/timer.d.ts +38 -0
- package/dist/zlink/contracts/eventing/timer.js +3 -0
- package/dist/zlink/contracts/index.d.ts +5 -0
- package/dist/zlink/contracts/index.js +22 -0
- package/dist/zlink/contracts/messaging/handlers.d.ts +5 -0
- package/dist/zlink/contracts/messaging/handlers.js +3 -0
- package/dist/zlink/contracts/messaging/index.d.ts +8 -0
- package/dist/zlink/contracts/messaging/index.js +15 -0
- package/dist/zlink/contracts/messaging/message.d.ts +68 -0
- package/dist/zlink/contracts/messaging/message.js +280 -0
- package/dist/zlink/contracts/messaging/message_parts_envelope.d.ts +14 -0
- package/dist/zlink/contracts/messaging/message_parts_envelope.js +56 -0
- package/dist/zlink/contracts/messaging/operations.d.ts +54 -0
- package/dist/zlink/contracts/messaging/operations.js +3 -0
- package/dist/zlink/contracts/messaging/received.d.ts +41 -0
- package/dist/zlink/contracts/messaging/received.js +130 -0
- package/dist/zlink/contracts/messaging/stream_packet.d.ts +14 -0
- package/dist/zlink/contracts/messaging/stream_packet.js +33 -0
- package/dist/zlink/contracts/messaging/subscription_event.d.ts +12 -0
- package/dist/zlink/contracts/messaging/subscription_event.js +20 -0
- package/dist/zlink/contracts/messaging/topic_message.d.ts +14 -0
- package/dist/zlink/contracts/messaging/topic_message.js +36 -0
- package/dist/zlink/contracts/sockets/dealer_socket.d.ts +29 -0
- package/dist/zlink/contracts/sockets/dealer_socket.js +3 -0
- package/dist/zlink/contracts/sockets/index.d.ts +10 -0
- package/dist/zlink/contracts/sockets/index.js +15 -0
- package/dist/zlink/contracts/sockets/pair_socket.d.ts +20 -0
- package/dist/zlink/contracts/sockets/pair_socket.js +3 -0
- package/dist/zlink/contracts/sockets/pubsub_sockets.d.ts +40 -0
- package/dist/zlink/contracts/sockets/pubsub_sockets.js +3 -0
- package/dist/zlink/contracts/sockets/router_socket.d.ts +32 -0
- package/dist/zlink/contracts/sockets/router_socket.js +3 -0
- package/dist/zlink/contracts/sockets/socket.d.ts +58 -0
- package/dist/zlink/contracts/sockets/socket.js +3 -0
- package/dist/zlink/contracts/sockets/socket_constants.d.ts +88 -0
- package/dist/zlink/contracts/sockets/socket_constants.js +67 -0
- package/dist/zlink/contracts/sockets/socket_options.d.ts +105 -0
- package/dist/zlink/contracts/sockets/socket_options.js +3 -0
- package/dist/zlink/contracts/sockets/stream_socket.d.ts +31 -0
- package/dist/zlink/contracts/sockets/stream_socket.js +3 -0
- package/dist/zlink/runtime/buffers/message_conversion.d.ts +6 -0
- package/dist/zlink/runtime/buffers/message_conversion.js +49 -0
- package/dist/zlink/runtime/core/context.d.ts +43 -0
- package/dist/zlink/runtime/core/context.js +150 -0
- package/dist/zlink/runtime/core/context_options.d.ts +19 -0
- package/dist/zlink/runtime/core/context_options.js +23 -0
- package/dist/zlink/runtime/core/routing_id.d.ts +3 -0
- package/dist/zlink/runtime/core/routing_id.js +30 -0
- package/dist/zlink/runtime/core/routing_id_conversion.d.ts +2 -0
- package/dist/zlink/runtime/core/routing_id_conversion.js +11 -0
- package/dist/zlink/runtime/core/runtime_info.d.ts +8 -0
- package/dist/zlink/runtime/core/runtime_info.js +39 -0
- package/dist/zlink/runtime/errors/error_mapping.d.ts +4 -0
- package/dist/zlink/runtime/errors/error_mapping.js +132 -0
- package/dist/zlink/runtime/errors/error_state.d.ts +1 -0
- package/dist/zlink/runtime/errors/error_state.js +15 -0
- package/dist/zlink/runtime/errors/native_errors.d.ts +16 -0
- package/dist/zlink/runtime/errors/native_errors.js +86 -0
- package/dist/zlink/runtime/eventing/counters.d.ts +16 -0
- package/dist/zlink/runtime/eventing/counters.js +33 -0
- package/dist/zlink/runtime/eventing/index.d.ts +6 -0
- package/dist/zlink/runtime/eventing/index.js +22 -0
- package/dist/zlink/runtime/eventing/monitor_event_state.d.ts +3 -0
- package/dist/zlink/runtime/eventing/monitor_event_state.js +19 -0
- package/dist/zlink/runtime/eventing/monitor_raw.d.ts +50 -0
- package/dist/zlink/runtime/eventing/monitor_raw.js +3 -0
- package/dist/zlink/runtime/eventing/monitor_socket.d.ts +9 -0
- package/dist/zlink/runtime/eventing/monitor_socket.js +39 -0
- package/dist/zlink/runtime/eventing/monitor_status.d.ts +3 -0
- package/dist/zlink/runtime/eventing/monitor_status.js +52 -0
- package/dist/zlink/runtime/eventing/poll_events.d.ts +20 -0
- package/dist/zlink/runtime/eventing/poll_events.js +92 -0
- package/dist/zlink/runtime/eventing/poller.d.ts +34 -0
- package/dist/zlink/runtime/eventing/poller.js +275 -0
- package/dist/zlink/runtime/eventing/thread.d.ts +6 -0
- package/dist/zlink/runtime/eventing/thread.js +52 -0
- package/dist/zlink/runtime/eventing/timer.d.ts +8 -0
- package/dist/zlink/runtime/eventing/timer.js +45 -0
- package/dist/zlink/runtime/handles/native_handle.d.ts +7 -0
- package/dist/zlink/runtime/handles/native_handle.js +24 -0
- package/dist/zlink/runtime/messaging/completion_owner.d.ts +86 -0
- package/dist/zlink/runtime/messaging/completion_owner.js +570 -0
- package/dist/zlink/runtime/messaging/message_materializer.d.ts +36 -0
- package/dist/zlink/runtime/messaging/message_materializer.js +199 -0
- package/dist/zlink/runtime/messaging/message_parts_state.d.ts +4 -0
- package/dist/zlink/runtime/messaging/message_parts_state.js +20 -0
- package/dist/zlink/runtime/messaging/message_snapshot.d.ts +13 -0
- package/dist/zlink/runtime/messaging/message_snapshot.js +42 -0
- package/dist/zlink/runtime/messaging/received_operations.d.ts +5 -0
- package/dist/zlink/runtime/messaging/received_operations.js +46 -0
- package/dist/zlink/runtime/messaging/received_state.d.ts +13 -0
- package/dist/zlink/runtime/messaging/received_state.js +29 -0
- package/dist/zlink/runtime/messaging/request_executor.d.ts +2 -0
- package/dist/zlink/runtime/messaging/request_executor.js +8 -0
- package/dist/zlink/runtime/messaging/send_operation_base.d.ts +13 -0
- package/dist/zlink/runtime/messaging/send_operation_base.js +52 -0
- package/dist/zlink/runtime/messaging/subscription_event_state.d.ts +4 -0
- package/dist/zlink/runtime/messaging/subscription_event_state.js +17 -0
- package/dist/zlink/runtime/messaging/topic_message_state.d.ts +11 -0
- package/dist/zlink/runtime/messaging/topic_message_state.js +75 -0
- package/dist/zlink/runtime/native/binding.d.ts +6 -0
- package/dist/zlink/runtime/native/binding.js +3 -0
- package/dist/zlink/runtime/native/binding_context.d.ts +14 -0
- package/dist/zlink/runtime/native/binding_context.js +3 -0
- package/dist/zlink/runtime/native/binding_core.d.ts +21 -0
- package/dist/zlink/runtime/native/binding_core.js +3 -0
- package/dist/zlink/runtime/native/binding_eventing.d.ts +40 -0
- package/dist/zlink/runtime/native/binding_eventing.js +3 -0
- package/dist/zlink/runtime/native/binding_socket.d.ts +52 -0
- package/dist/zlink/runtime/native/binding_socket.js +3 -0
- package/dist/zlink/runtime/native/binding_types.d.ts +8 -0
- package/dist/zlink/runtime/native/binding_types.js +3 -0
- package/dist/zlink/runtime/native/native.d.ts +2 -0
- package/dist/zlink/runtime/native/native.js +40 -0
- package/dist/zlink/runtime/native/native_load_paths.d.ts +16 -0
- package/dist/zlink/runtime/native/native_load_paths.js +165 -0
- package/dist/zlink/runtime/options/byte_values.d.ts +3 -0
- package/dist/zlink/runtime/options/byte_values.js +27 -0
- package/dist/zlink/runtime/options/option_mapping.d.ts +72 -0
- package/dist/zlink/runtime/options/option_mapping.js +41 -0
- package/dist/zlink/runtime/options/validation.d.ts +1 -0
- package/dist/zlink/runtime/options/validation.js +17 -0
- package/dist/zlink/runtime/public_bridge.d.ts +6 -0
- package/dist/zlink/runtime/public_bridge.js +23 -0
- package/dist/zlink/runtime/sockets/dealer_socket.d.ts +16 -0
- package/dist/zlink/runtime/sockets/dealer_socket.js +56 -0
- package/dist/zlink/runtime/sockets/index.d.ts +19 -0
- package/dist/zlink/runtime/sockets/index.js +27 -0
- package/dist/zlink/runtime/sockets/pair_socket.d.ts +7 -0
- package/dist/zlink/runtime/sockets/pair_socket.js +12 -0
- package/dist/zlink/runtime/sockets/pub_socket.d.ts +7 -0
- package/dist/zlink/runtime/sockets/pub_socket.js +12 -0
- package/dist/zlink/runtime/sockets/router_socket.d.ts +19 -0
- package/dist/zlink/runtime/sockets/router_socket.js +70 -0
- package/dist/zlink/runtime/sockets/socket_base.d.ts +21 -0
- package/dist/zlink/runtime/sockets/socket_base.js +102 -0
- package/dist/zlink/runtime/sockets/socket_operation_builders.d.ts +38 -0
- package/dist/zlink/runtime/sockets/socket_operation_builders.js +93 -0
- package/dist/zlink/runtime/sockets/socket_operations.d.ts +40 -0
- package/dist/zlink/runtime/sockets/socket_operations.js +177 -0
- package/dist/zlink/runtime/sockets/socket_options.d.ts +104 -0
- package/dist/zlink/runtime/sockets/socket_options.js +259 -0
- package/dist/zlink/runtime/sockets/socket_submit_errors.d.ts +3 -0
- package/dist/zlink/runtime/sockets/socket_submit_errors.js +13 -0
- package/dist/zlink/runtime/sockets/stream_socket.d.ts +15 -0
- package/dist/zlink/runtime/sockets/stream_socket.js +93 -0
- package/dist/zlink/runtime/sockets/sub_socket.d.ts +7 -0
- package/dist/zlink/runtime/sockets/sub_socket.js +12 -0
- package/dist/zlink/runtime/sockets/xpub_socket.d.ts +10 -0
- package/dist/zlink/runtime/sockets/xpub_socket.js +39 -0
- package/dist/zlink/runtime/sockets/xsub_socket.d.ts +7 -0
- package/dist/zlink/runtime/sockets/xsub_socket.js +12 -0
- package/native/src/addon.cc +11 -0
- package/native/src/addon_common_api.h +57 -0
- package/native/src/addon_core.cc +3974 -0
- package/native/src/addon_core_api.h +110 -0
- package/native/src/addon_core_options.cc +119 -0
- package/native/src/addon_core_options.h +9 -0
- package/native/src/addon_exports.cc +151 -0
- package/native/src/addon_exports.h +7 -0
- package/native/src/addon_message_parts.h +67 -0
- package/native/src/addon_message_values.h +345 -0
- package/native/src/addon_monitor_status_values.h +71 -0
- package/native/src/addon_submit_results.h +30 -0
- package/package.json +74 -0
- package/prebuilds/linux-x64/libzlink.so.0.17.3 +0 -0
- package/prebuilds/linux-x64/zlink.node +0 -0
- package/provenance/core-package-provenance.json +73 -0
- package/scripts/install.js +37 -0
- package/scripts/resolve_core.js +86 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** A timer that fires on an interval and can be polled or awaited. */
|
|
2
|
+
export interface Timer {
|
|
3
|
+
/** Start the timer firing once per `intervalNs` nanoseconds; `repeatCount` sets how many times it fires. */
|
|
4
|
+
start(intervalNs: bigint, repeatCount: bigint): void;
|
|
5
|
+
/** Stop the timer; it can be restarted with {@link Timer.start}. */
|
|
6
|
+
stop(): void;
|
|
7
|
+
/** Receive the next expiration as the cumulative fire count, or null when none is pending. */
|
|
8
|
+
recv(): bigint | null;
|
|
9
|
+
/** Close the timer and release its resources. */
|
|
10
|
+
close(): void;
|
|
11
|
+
}
|
|
12
|
+
/** A handle to a running background thread. */
|
|
13
|
+
export interface Thread {
|
|
14
|
+
/** Block the caller until the thread finishes running its task. */
|
|
15
|
+
join(): void;
|
|
16
|
+
}
|
|
17
|
+
/** A high-resolution elapsed-time stopwatch. */
|
|
18
|
+
export interface Stopwatch {
|
|
19
|
+
/** Return the elapsed time so far, in microseconds, without stopping. */
|
|
20
|
+
intermediate(): number;
|
|
21
|
+
/** Stop the stopwatch and return the total elapsed time in microseconds. */
|
|
22
|
+
stop(): number;
|
|
23
|
+
/** Release the stopwatch. */
|
|
24
|
+
close(): void;
|
|
25
|
+
}
|
|
26
|
+
/** A thread-safe integer counter that can be shared across threads. */
|
|
27
|
+
export interface AtomicCounter {
|
|
28
|
+
/** Atomically set the value. */
|
|
29
|
+
set(value: number): void;
|
|
30
|
+
/** Atomically increment the counter and return the new value. */
|
|
31
|
+
inc(): number;
|
|
32
|
+
/** Atomically decrement the counter and return the new value. */
|
|
33
|
+
dec(): number;
|
|
34
|
+
/** Return the current value, read atomically. */
|
|
35
|
+
value(): number;
|
|
36
|
+
/** Release the counter. */
|
|
37
|
+
close(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./sockets"), exports);
|
|
19
|
+
__exportStar(require("./eventing"), exports);
|
|
20
|
+
__exportStar(require("./core"), exports);
|
|
21
|
+
__exportStar(require("./messaging"), exports);
|
|
22
|
+
__exportStar(require("./errors"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Message, } from './message';
|
|
2
|
+
export type { MessageLike, } from './message';
|
|
3
|
+
export { Received, ReplyToken, } from './received';
|
|
4
|
+
export { StreamPacket } from './stream_packet';
|
|
5
|
+
export { TopicMessage, } from './topic_message';
|
|
6
|
+
export { SubscriptionEvent, } from './subscription_event';
|
|
7
|
+
export type * from './operations';
|
|
8
|
+
export type * from './handlers';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SubscriptionEvent = exports.TopicMessage = exports.StreamPacket = exports.ReplyToken = exports.Received = exports.Message = void 0;
|
|
5
|
+
var message_1 = require("./message");
|
|
6
|
+
Object.defineProperty(exports, "Message", { enumerable: true, get: function () { return message_1.Message; } });
|
|
7
|
+
var received_1 = require("./received");
|
|
8
|
+
Object.defineProperty(exports, "Received", { enumerable: true, get: function () { return received_1.Received; } });
|
|
9
|
+
Object.defineProperty(exports, "ReplyToken", { enumerable: true, get: function () { return received_1.ReplyToken; } });
|
|
10
|
+
var stream_packet_1 = require("./stream_packet");
|
|
11
|
+
Object.defineProperty(exports, "StreamPacket", { enumerable: true, get: function () { return stream_packet_1.StreamPacket; } });
|
|
12
|
+
var topic_message_1 = require("./topic_message");
|
|
13
|
+
Object.defineProperty(exports, "TopicMessage", { enumerable: true, get: function () { return topic_message_1.TopicMessage; } });
|
|
14
|
+
var subscription_event_1 = require("./subscription_event");
|
|
15
|
+
Object.defineProperty(exports, "SubscriptionEvent", { enumerable: true, get: function () { return subscription_event_1.SubscriptionEvent; } });
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { BufferLike } from '../core/buffer_like';
|
|
2
|
+
/** Reserved native metadata key range; metadata lookup is not implemented yet. */
|
|
3
|
+
export declare const METADATA_KEY_USER_MIN = 256;
|
|
4
|
+
/** Reserved native metadata value limit; metadata lookup is not implemented yet. */
|
|
5
|
+
export declare const METADATA_VALUE_MAX = 65535;
|
|
6
|
+
/**
|
|
7
|
+
* A message payload owned by this wrapper. The payload can use a JavaScript
|
|
8
|
+
* Buffer or native storage. A successful synchronous submit consumes the
|
|
9
|
+
* message. Managed async SEND also consumes it after taking a back-pressure
|
|
10
|
+
* snapshot, which can happen before the Promise resolves. `close` releases it.
|
|
11
|
+
* Do not use a reference after ownership transfers or after `close`, because
|
|
12
|
+
* the runtime may reuse the returned wrapper identity.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Message {
|
|
15
|
+
private _buffer;
|
|
16
|
+
private _refCount;
|
|
17
|
+
private _properties;
|
|
18
|
+
/** Opaque owner when this message uses native storage. */
|
|
19
|
+
private _nativeMessage?;
|
|
20
|
+
/** True when a received frame remains movable until data() exposes it. */
|
|
21
|
+
private _nativeReadOnly;
|
|
22
|
+
/** True after ownership has ended and this facade has entered the pool. */
|
|
23
|
+
private _released;
|
|
24
|
+
/**
|
|
25
|
+
* Create a message holding an independent copy of `buffer` (a buffer-like
|
|
26
|
+
* value or another {@link Message}); the source may be freely reused
|
|
27
|
+
* afterward.
|
|
28
|
+
*/
|
|
29
|
+
static from(buffer: BufferLike | Message): Message;
|
|
30
|
+
/** Allocate a message with `size` bytes of writable payload storage. */
|
|
31
|
+
static allocate(size: number): Message;
|
|
32
|
+
/** Return the payload as a Buffer backed by this message's storage. */
|
|
33
|
+
data(): Buffer;
|
|
34
|
+
/** Return a new Buffer copying the payload. */
|
|
35
|
+
toBytes(): Buffer;
|
|
36
|
+
/** Return a new message holding an independent copy of this payload. */
|
|
37
|
+
copy(): Message;
|
|
38
|
+
/** Return the payload size in bytes. */
|
|
39
|
+
size(): number;
|
|
40
|
+
/** Return true when the payload is empty. */
|
|
41
|
+
isEmpty(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Copy the payload (or `length` bytes from `sourceOffset`) into `destination`
|
|
44
|
+
* at `destinationOffset`; return the number of bytes written. Throws
|
|
45
|
+
* {@link RangeError} when the range is out of bounds.
|
|
46
|
+
*/
|
|
47
|
+
copyTo(destination: Buffer | Uint8Array, sourceOffset?: number, destinationOffset?: number, length?: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* Copy the payload into `destination` when it fits; return true on success,
|
|
50
|
+
* or false when `destination` is too small.
|
|
51
|
+
*/
|
|
52
|
+
tryCopyTo(destination: Buffer | Uint8Array): boolean;
|
|
53
|
+
/** Decode the payload as text using `encoding`. */
|
|
54
|
+
getString(encoding?: BufferEncoding): string;
|
|
55
|
+
/**
|
|
56
|
+
* Return the native message property `name`, or null when it is absent.
|
|
57
|
+
* Native message metadata is reserved in the current binding and is not
|
|
58
|
+
* populated yet, so public factory and receive paths currently return null.
|
|
59
|
+
*/
|
|
60
|
+
getProperty(name: string): string | null;
|
|
61
|
+
/** Return the native payload reference count (a diagnostic only). */
|
|
62
|
+
refCount(): number;
|
|
63
|
+
/** Release native storage and return this wrapper; do not use it afterward. */
|
|
64
|
+
close(): void;
|
|
65
|
+
/** Return the payload decoded as a UTF-8 string. */
|
|
66
|
+
toString(): string;
|
|
67
|
+
private ensureBuffer;
|
|
68
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Message = exports.METADATA_VALUE_MAX = exports.METADATA_KEY_USER_MIN = void 0;
|
|
5
|
+
exports.configureMessageNativeOperations = configureMessageNativeOperations;
|
|
6
|
+
exports.acquireMessageWrapper = acquireMessageWrapper;
|
|
7
|
+
exports.refillMessageWrapper = refillMessageWrapper;
|
|
8
|
+
exports.canShareNativeMessage = canShareNativeMessage;
|
|
9
|
+
exports.hasObservedManagedReceiveData = hasObservedManagedReceiveData;
|
|
10
|
+
exports.consumeSubmittedMessage = consumeSubmittedMessage;
|
|
11
|
+
/** Reserved native metadata key range; metadata lookup is not implemented yet. */
|
|
12
|
+
exports.METADATA_KEY_USER_MIN = 0x0100;
|
|
13
|
+
/** Reserved native metadata value limit; metadata lookup is not implemented yet. */
|
|
14
|
+
exports.METADATA_VALUE_MAX = 65535;
|
|
15
|
+
const EMPTY_PROPERTIES = Object.freeze({});
|
|
16
|
+
const EMPTY_METADATA = Object.freeze(new Map());
|
|
17
|
+
const EMPTY_BUFFER = Buffer.alloc(0);
|
|
18
|
+
const MESSAGE_WRAPPER_POOL_CAPACITY = 64;
|
|
19
|
+
const messageWrapperPool = [];
|
|
20
|
+
let nativeOperations;
|
|
21
|
+
/** @internal Configure the runtime operations hidden behind the Message contract. */
|
|
22
|
+
function configureMessageNativeOperations(operations) {
|
|
23
|
+
nativeOperations = operations;
|
|
24
|
+
}
|
|
25
|
+
function requireMessageNativeOperations() {
|
|
26
|
+
if (!nativeOperations) {
|
|
27
|
+
throw new Error('Message native operations are not configured');
|
|
28
|
+
}
|
|
29
|
+
return nativeOperations;
|
|
30
|
+
}
|
|
31
|
+
function normalizeMessageProperties(properties) {
|
|
32
|
+
if (!properties) {
|
|
33
|
+
return EMPTY_PROPERTIES;
|
|
34
|
+
}
|
|
35
|
+
return Object.isFrozen(properties) ? properties : Object.freeze(properties);
|
|
36
|
+
}
|
|
37
|
+
function normalizeBufferLike(value, label = 'value') {
|
|
38
|
+
if (Buffer.isBuffer(value)) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
if (value instanceof Uint8Array) {
|
|
42
|
+
return Buffer.from(value.buffer, value.byteOffset, value.byteLength);
|
|
43
|
+
}
|
|
44
|
+
if (typeof value === 'string') {
|
|
45
|
+
return Buffer.from(value);
|
|
46
|
+
}
|
|
47
|
+
throw new TypeError(`${label} must be Buffer, Uint8Array, or string`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A message payload owned by this wrapper. The payload can use a JavaScript
|
|
51
|
+
* Buffer or native storage. A successful synchronous submit consumes the
|
|
52
|
+
* message. Managed async SEND also consumes it after taking a back-pressure
|
|
53
|
+
* snapshot, which can happen before the Promise resolves. `close` releases it.
|
|
54
|
+
* Do not use a reference after ownership transfers or after `close`, because
|
|
55
|
+
* the runtime may reuse the returned wrapper identity.
|
|
56
|
+
*/
|
|
57
|
+
class Message {
|
|
58
|
+
_buffer;
|
|
59
|
+
_refCount;
|
|
60
|
+
_properties;
|
|
61
|
+
/** Opaque owner when this message uses native storage. */
|
|
62
|
+
_nativeMessage;
|
|
63
|
+
/** True when a received frame remains movable until data() exposes it. */
|
|
64
|
+
_nativeReadOnly;
|
|
65
|
+
/** True after ownership has ended and this facade has entered the pool. */
|
|
66
|
+
_released;
|
|
67
|
+
/**
|
|
68
|
+
* Create a message holding an independent copy of `buffer` (a buffer-like
|
|
69
|
+
* value or another {@link Message}); the source may be freely reused
|
|
70
|
+
* afterward.
|
|
71
|
+
*/
|
|
72
|
+
static from(buffer) {
|
|
73
|
+
const source = buffer instanceof Message
|
|
74
|
+
? buffer.ensureBuffer()
|
|
75
|
+
: normalizeBufferLike(buffer, 'data');
|
|
76
|
+
const nativeMessage = requireMessageNativeOperations().fromBuffer(source);
|
|
77
|
+
return acquireMessageWrapper(nativeMessage.data, 1, undefined, nativeMessage.nativeMessage);
|
|
78
|
+
}
|
|
79
|
+
/** Allocate a message with `size` bytes of writable payload storage. */
|
|
80
|
+
static allocate(size) {
|
|
81
|
+
if (!Number.isSafeInteger(size) || size < 0) {
|
|
82
|
+
throw new RangeError('size must be a non-negative safe integer');
|
|
83
|
+
}
|
|
84
|
+
const nativeMessage = requireMessageNativeOperations().allocate(size);
|
|
85
|
+
return acquireMessageWrapper(nativeMessage.data, 1, undefined, nativeMessage.nativeMessage);
|
|
86
|
+
}
|
|
87
|
+
/** Return the payload as a Buffer backed by this message's storage. */
|
|
88
|
+
data() {
|
|
89
|
+
return this.ensureBuffer();
|
|
90
|
+
}
|
|
91
|
+
/** Return a new Buffer copying the payload. */
|
|
92
|
+
toBytes() {
|
|
93
|
+
return Buffer.from(this.ensureBuffer());
|
|
94
|
+
}
|
|
95
|
+
/** Return a new message holding an independent copy of this payload. */
|
|
96
|
+
copy() {
|
|
97
|
+
return Message.from(this);
|
|
98
|
+
}
|
|
99
|
+
/** Return the payload size in bytes. */
|
|
100
|
+
size() {
|
|
101
|
+
if (this._buffer !== undefined) {
|
|
102
|
+
return this._buffer.length;
|
|
103
|
+
}
|
|
104
|
+
if (this._nativeMessage !== undefined) {
|
|
105
|
+
return requireMessageNativeOperations().size(this._nativeMessage);
|
|
106
|
+
}
|
|
107
|
+
return 0;
|
|
108
|
+
}
|
|
109
|
+
/** Return true when the payload is empty. */
|
|
110
|
+
isEmpty() {
|
|
111
|
+
return this.size() === 0;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Copy the payload (or `length` bytes from `sourceOffset`) into `destination`
|
|
115
|
+
* at `destinationOffset`; return the number of bytes written. Throws
|
|
116
|
+
* {@link RangeError} when the range is out of bounds.
|
|
117
|
+
*/
|
|
118
|
+
copyTo(destination, sourceOffset = 0, destinationOffset = 0, length = this.size() - sourceOffset) {
|
|
119
|
+
if (!Buffer.isBuffer(destination) && !(destination instanceof Uint8Array)) {
|
|
120
|
+
throw new TypeError('destination must be a Buffer or Uint8Array');
|
|
121
|
+
}
|
|
122
|
+
if (!Number.isSafeInteger(sourceOffset)
|
|
123
|
+
|| sourceOffset < 0
|
|
124
|
+
|| !Number.isSafeInteger(destinationOffset)
|
|
125
|
+
|| destinationOffset < 0
|
|
126
|
+
|| !Number.isSafeInteger(length)
|
|
127
|
+
|| length < 0
|
|
128
|
+
|| sourceOffset + length > this.size()
|
|
129
|
+
|| destinationOffset + length > destination.byteLength) {
|
|
130
|
+
throw new RangeError('copy range is out of bounds');
|
|
131
|
+
}
|
|
132
|
+
const target = Buffer.isBuffer(destination)
|
|
133
|
+
? destination
|
|
134
|
+
: Buffer.from(destination.buffer, destination.byteOffset, destination.byteLength);
|
|
135
|
+
return this.ensureBuffer().copy(target, destinationOffset, sourceOffset, sourceOffset + length);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Copy the payload into `destination` when it fits; return true on success,
|
|
139
|
+
* or false when `destination` is too small.
|
|
140
|
+
*/
|
|
141
|
+
tryCopyTo(destination) {
|
|
142
|
+
if (destination.byteLength < this.size()) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
this.copyTo(destination);
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
/** Decode the payload as text using `encoding`. */
|
|
149
|
+
getString(encoding = 'utf8') {
|
|
150
|
+
return this.ensureBuffer().toString(encoding);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Return the native message property `name`, or null when it is absent.
|
|
154
|
+
* Native message metadata is reserved in the current binding and is not
|
|
155
|
+
* populated yet, so public factory and receive paths currently return null.
|
|
156
|
+
*/
|
|
157
|
+
getProperty(name) {
|
|
158
|
+
if (typeof name !== 'string') {
|
|
159
|
+
throw new TypeError('property name must be a string');
|
|
160
|
+
}
|
|
161
|
+
return Object.prototype.hasOwnProperty.call(this._properties, name)
|
|
162
|
+
? this._properties[name]
|
|
163
|
+
: null;
|
|
164
|
+
}
|
|
165
|
+
/** Return the native payload reference count (a diagnostic only). */
|
|
166
|
+
refCount() {
|
|
167
|
+
return this._refCount;
|
|
168
|
+
}
|
|
169
|
+
/** Release native storage and return this wrapper; do not use it afterward. */
|
|
170
|
+
close() {
|
|
171
|
+
if (this._released) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (this._nativeMessage !== undefined) {
|
|
175
|
+
requireMessageNativeOperations().close(this._nativeMessage);
|
|
176
|
+
}
|
|
177
|
+
releaseMessageWrapper(this);
|
|
178
|
+
}
|
|
179
|
+
/** Return the payload decoded as a UTF-8 string. */
|
|
180
|
+
toString() {
|
|
181
|
+
return this.getString();
|
|
182
|
+
}
|
|
183
|
+
ensureBuffer() {
|
|
184
|
+
if (this._buffer !== undefined) {
|
|
185
|
+
return this._buffer;
|
|
186
|
+
}
|
|
187
|
+
if (this._nativeMessage === undefined) {
|
|
188
|
+
return EMPTY_BUFFER;
|
|
189
|
+
}
|
|
190
|
+
const nativeMessage = this._nativeMessage;
|
|
191
|
+
const operations = requireMessageNativeOperations();
|
|
192
|
+
if (this._nativeReadOnly) {
|
|
193
|
+
// Router receive storage is movable until JavaScript observes it. Once
|
|
194
|
+
// exposed, materialize a managed Buffer and release the native frame.
|
|
195
|
+
this._buffer = operations.copyData(nativeMessage);
|
|
196
|
+
operations.close(nativeMessage);
|
|
197
|
+
this._nativeMessage = undefined;
|
|
198
|
+
this._nativeReadOnly = false;
|
|
199
|
+
return this._buffer;
|
|
200
|
+
}
|
|
201
|
+
this._buffer = operations.data(nativeMessage);
|
|
202
|
+
return this._buffer;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.Message = Message;
|
|
206
|
+
/** @internal Acquire a Message facade for runtime-owned receive state. */
|
|
207
|
+
function acquireMessageWrapper(buffer, refCount = 1, properties, nativeMessage, metadata, nativeReadOnly = false) {
|
|
208
|
+
const message = messageWrapperPool.pop()
|
|
209
|
+
?? Object.create(Message.prototype);
|
|
210
|
+
const state = message;
|
|
211
|
+
state._buffer = buffer;
|
|
212
|
+
state._refCount = refCount | 0;
|
|
213
|
+
state._properties = normalizeMessageProperties(properties);
|
|
214
|
+
state._metadata = metadata ?? EMPTY_METADATA;
|
|
215
|
+
state._nativeMessage = nativeMessage;
|
|
216
|
+
state._nativeReadOnly = nativeReadOnly;
|
|
217
|
+
state._released = false;
|
|
218
|
+
return message;
|
|
219
|
+
}
|
|
220
|
+
/** @internal Refill an exclusively owned receive wrapper without pool traffic. */
|
|
221
|
+
function refillMessageWrapper(message, buffer, nativeMessage) {
|
|
222
|
+
const state = message;
|
|
223
|
+
if (state._nativeMessage !== undefined && state._nativeMessage !== nativeMessage) {
|
|
224
|
+
requireMessageNativeOperations().close(state._nativeMessage);
|
|
225
|
+
}
|
|
226
|
+
state._buffer = buffer;
|
|
227
|
+
state._refCount = 1;
|
|
228
|
+
state._properties = EMPTY_PROPERTIES;
|
|
229
|
+
state._metadata = EMPTY_METADATA;
|
|
230
|
+
state._nativeMessage = nativeMessage;
|
|
231
|
+
state._nativeReadOnly = false;
|
|
232
|
+
state._released = false;
|
|
233
|
+
return message;
|
|
234
|
+
}
|
|
235
|
+
function releaseMessageWrapper(message) {
|
|
236
|
+
const state = message;
|
|
237
|
+
if (state._released) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
state._buffer = EMPTY_BUFFER;
|
|
241
|
+
state._refCount = 0;
|
|
242
|
+
state._properties = EMPTY_PROPERTIES;
|
|
243
|
+
state._metadata = EMPTY_METADATA;
|
|
244
|
+
state._nativeMessage = undefined;
|
|
245
|
+
state._nativeReadOnly = false;
|
|
246
|
+
state._released = true;
|
|
247
|
+
if (messageWrapperPool.length < MESSAGE_WRAPPER_POOL_CAPACITY) {
|
|
248
|
+
messageWrapperPool.push(message);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function markMessageConsumed(message) {
|
|
252
|
+
const state = message;
|
|
253
|
+
state._buffer = EMPTY_BUFFER;
|
|
254
|
+
state._refCount = 0;
|
|
255
|
+
state._properties = EMPTY_PROPERTIES;
|
|
256
|
+
state._metadata = EMPTY_METADATA;
|
|
257
|
+
state._nativeMessage = undefined;
|
|
258
|
+
state._nativeReadOnly = false;
|
|
259
|
+
}
|
|
260
|
+
/** @internal */
|
|
261
|
+
function canShareNativeMessage(message) {
|
|
262
|
+
const state = message;
|
|
263
|
+
return state._nativeMessage !== undefined;
|
|
264
|
+
}
|
|
265
|
+
/** @internal True when receive data was observed and remains in managed storage. */
|
|
266
|
+
function hasObservedManagedReceiveData(message) {
|
|
267
|
+
const state = message;
|
|
268
|
+
return state._buffer !== undefined
|
|
269
|
+
&& state._nativeMessage === undefined
|
|
270
|
+
&& state._refCount > 0
|
|
271
|
+
&& !state._released;
|
|
272
|
+
}
|
|
273
|
+
/** @internal Mark a message whose ownership transferred to an operation empty. */
|
|
274
|
+
function consumeSubmittedMessage(message) {
|
|
275
|
+
const state = message;
|
|
276
|
+
if (state._nativeMessage !== undefined) {
|
|
277
|
+
requireMessageNativeOperations().close(state._nativeMessage);
|
|
278
|
+
}
|
|
279
|
+
markMessageConsumed(message);
|
|
280
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Message } from './message';
|
|
2
|
+
export declare abstract class MessagePartsEnvelope {
|
|
3
|
+
/** The message parts, owned by this envelope. */
|
|
4
|
+
parts: Message[];
|
|
5
|
+
protected constructor();
|
|
6
|
+
/** Return true when the envelope holds exactly one part. */
|
|
7
|
+
isSinglePart(): boolean;
|
|
8
|
+
/** Return the first part without transferring ownership; throws when the envelope has no parts. */
|
|
9
|
+
firstPart(): Message;
|
|
10
|
+
/** Return the only part; throws unless the envelope holds exactly one part. */
|
|
11
|
+
singlePartOrThrow(): Message;
|
|
12
|
+
/** Close every part, releasing their storage. */
|
|
13
|
+
close(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MessagePartsEnvelope = void 0;
|
|
5
|
+
const errors_1 = require("../errors/errors");
|
|
6
|
+
function freezeMessageParts(parts) {
|
|
7
|
+
return Object.freeze(parts.slice());
|
|
8
|
+
}
|
|
9
|
+
const EMPTY_MESSAGE_PARTS = freezeMessageParts([]);
|
|
10
|
+
function invalidMultipartError(partsLength) {
|
|
11
|
+
const error = new errors_1.RecvError(errors_1.RecvResult.NotSupported, 0);
|
|
12
|
+
error.message = `expected exactly 1 part but received ${partsLength}`;
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
function missingPartError() {
|
|
16
|
+
const error = new errors_1.RecvError(errors_1.RecvResult.NotSupported, 0);
|
|
17
|
+
error.message = 'message has no parts';
|
|
18
|
+
return error;
|
|
19
|
+
}
|
|
20
|
+
class MessagePartsEnvelope {
|
|
21
|
+
/** The message parts, owned by this envelope. */
|
|
22
|
+
parts;
|
|
23
|
+
constructor() {
|
|
24
|
+
this.parts = EMPTY_MESSAGE_PARTS;
|
|
25
|
+
}
|
|
26
|
+
/** Return true when the envelope holds exactly one part. */
|
|
27
|
+
isSinglePart() {
|
|
28
|
+
return this.parts.length === 1;
|
|
29
|
+
}
|
|
30
|
+
/** Return the first part without transferring ownership; throws when the envelope has no parts. */
|
|
31
|
+
firstPart() {
|
|
32
|
+
if (this.parts.length === 0) {
|
|
33
|
+
throw missingPartError();
|
|
34
|
+
}
|
|
35
|
+
return this.parts[0];
|
|
36
|
+
}
|
|
37
|
+
/** Return the only part; throws unless the envelope holds exactly one part. */
|
|
38
|
+
singlePartOrThrow() {
|
|
39
|
+
if (!this.isSinglePart()) {
|
|
40
|
+
throw invalidMultipartError(this.parts.length);
|
|
41
|
+
}
|
|
42
|
+
return this.parts[0];
|
|
43
|
+
}
|
|
44
|
+
/** Close every part, releasing their storage. */
|
|
45
|
+
close() {
|
|
46
|
+
try {
|
|
47
|
+
for (const part of this.parts) {
|
|
48
|
+
part.close();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
this.parts = EMPTY_MESSAGE_PARTS;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.MessagePartsEnvelope = MessagePartsEnvelope;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Message, MessageLike } from './message';
|
|
2
|
+
/** Builder stage that accepts one message part and returns the next stage. */
|
|
3
|
+
export interface PartBuilder<TNext> {
|
|
4
|
+
/** Add one message part; its terminal method defines when ownership transfers. */
|
|
5
|
+
message(message: MessageLike): TNext;
|
|
6
|
+
}
|
|
7
|
+
/** Builder stage that sets an operation timeout and returns the next stage. */
|
|
8
|
+
export interface Timeoutable<TNext> {
|
|
9
|
+
/** Set how long the operation waits before timing out. */
|
|
10
|
+
timeout(timeoutMs: number): TNext;
|
|
11
|
+
}
|
|
12
|
+
/** Builds a multipart send with managed nonblocking back-pressure retry. */
|
|
13
|
+
export interface SendOperation extends PartBuilder<SendSubmitOperation> {
|
|
14
|
+
}
|
|
15
|
+
/** Accepts further parts and the synchronous or Promise terminal. */
|
|
16
|
+
export interface SendSubmitOperation extends PartBuilder<SendSubmitOperation> {
|
|
17
|
+
/**
|
|
18
|
+
* Resolve after admission. On back-pressure the runtime waits for the exact
|
|
19
|
+
* WRITABLE token and retries an owned packet snapshot. Message ownership
|
|
20
|
+
* transfers on immediate admission or after the first back-pressure snapshot,
|
|
21
|
+
* which can occur before this Promise resolves. Terminal failures reject.
|
|
22
|
+
*/
|
|
23
|
+
submit(): Promise<void>;
|
|
24
|
+
/** Submit synchronously with Core blocking admission semantics. */
|
|
25
|
+
submit_sync(): void;
|
|
26
|
+
}
|
|
27
|
+
/** Builds a synchronous lossy PUB/XPUB publish. */
|
|
28
|
+
export interface PublishOperation extends PartBuilder<PublishSubmitOperation> {
|
|
29
|
+
}
|
|
30
|
+
/** PUB/XPUB submit is void-or-throw; Core owns lossy/NODROP behavior. */
|
|
31
|
+
export interface PublishSubmitOperation extends PartBuilder<PublishSubmitOperation> {
|
|
32
|
+
submit(): void;
|
|
33
|
+
}
|
|
34
|
+
/** Builds a request: add the request parts, then submit and await a reply. */
|
|
35
|
+
export interface RequestOperation extends PartBuilder<RequestSubmitOperation> {
|
|
36
|
+
}
|
|
37
|
+
/** Accepts further parts, reply timeout, and the two request terminals. */
|
|
38
|
+
export interface RequestSubmitOperation extends PartBuilder<RequestSubmitOperation>, Timeoutable<RequestSubmitOperation> {
|
|
39
|
+
/**
|
|
40
|
+
* Submit the request and return the caller-owned reply parts. Backpressure
|
|
41
|
+
* waits for this request's WRITABLE token before resubmitting the same packet;
|
|
42
|
+
* the reply timeout starts only after admission.
|
|
43
|
+
*/
|
|
44
|
+
submit(): Promise<Message[]>;
|
|
45
|
+
submit_sync(): Message[];
|
|
46
|
+
}
|
|
47
|
+
/** Builds a reply to a received request: add the reply parts, then submit. */
|
|
48
|
+
export interface ReplyOperation extends PartBuilder<ReplySubmitOperation> {
|
|
49
|
+
}
|
|
50
|
+
/** Accepts further parts and the flag-free synchronous reply terminal. */
|
|
51
|
+
export interface ReplySubmitOperation extends PartBuilder<ReplySubmitOperation> {
|
|
52
|
+
/** Submit the accumulated reply parts. */
|
|
53
|
+
submit(): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReplyOperation, SendOperation } from './operations';
|
|
2
|
+
import { RoutingId } from '../core/routing_id';
|
|
3
|
+
import { MessagePartsEnvelope } from './message_parts_envelope';
|
|
4
|
+
/** Opaque capability required to reply to one ROUTER request. */
|
|
5
|
+
export declare class ReplyToken {
|
|
6
|
+
#private;
|
|
7
|
+
private constructor();
|
|
8
|
+
equals(other: ReplyToken): boolean;
|
|
9
|
+
hashCode(): number;
|
|
10
|
+
toString(): 'ReplyToken';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A received message envelope: its routing metadata and message parts, plus an
|
|
14
|
+
* optional reply/send context.
|
|
15
|
+
*
|
|
16
|
+
* Owns its parts until closed. Reuse one instance across `recv` calls to avoid
|
|
17
|
+
* a per-receive allocation.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Received extends MessagePartsEnvelope {
|
|
20
|
+
/** The source routing id, or null when the receive path provides none. */
|
|
21
|
+
routingId: RoutingId | null;
|
|
22
|
+
/** Opaque reply capability, present only for a ROUTER REQUEST receive. */
|
|
23
|
+
replyToken: ReplyToken | null;
|
|
24
|
+
private _replyContext;
|
|
25
|
+
private _sendContext;
|
|
26
|
+
/** Create an empty reusable envelope for use with `recv`. */
|
|
27
|
+
constructor(...args: never[]);
|
|
28
|
+
/**
|
|
29
|
+
* Begin a reply to this request: add parts on the returned builder, then
|
|
30
|
+
* submit. Parts are consumed on a successful submit. Throws when the envelope
|
|
31
|
+
* is not replyable (has no reply token).
|
|
32
|
+
*/
|
|
33
|
+
reply(): ReplyOperation;
|
|
34
|
+
/**
|
|
35
|
+
* Begin a send addressed to this envelope's source route: add parts, then
|
|
36
|
+
* submit. Message ownership transfers on immediate admission or after the
|
|
37
|
+
* managed send takes its first back-pressure snapshot, before the Promise may
|
|
38
|
+
* resolve. Throws when the envelope carries no send context.
|
|
39
|
+
*/
|
|
40
|
+
send(): SendOperation;
|
|
41
|
+
}
|