asyx 0.5.9 → 0.6.0

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.
Files changed (88) hide show
  1. package/README.md +71 -9
  2. package/SECURITY.md +5 -3
  3. package/package.json +13 -23
  4. package/src/commands/name.js +23 -0
  5. package/src/commands/reject-messages.js +54 -0
  6. package/src/commands/setup.js +98 -102
  7. package/src/commands/tunnel.js +279 -2425
  8. package/src/lib/naming.js +81 -0
  9. package/src/main.js +9 -1
  10. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneClient.d.ts +260 -0
  11. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneClient.js +1088 -0
  12. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneTransport.d.ts +79 -0
  13. package/vendor/tunnel-core/dist/control-plane/MqttControlPlaneTransport.js +138 -0
  14. package/vendor/tunnel-core/dist/control-plane/session.d.ts +50 -0
  15. package/vendor/tunnel-core/dist/control-plane/session.js +115 -0
  16. package/vendor/tunnel-core/dist/errors.d.ts +49 -0
  17. package/vendor/tunnel-core/dist/errors.js +53 -0
  18. package/vendor/tunnel-core/dist/flows/http.d.ts +50 -0
  19. package/vendor/tunnel-core/dist/flows/http.js +585 -0
  20. package/vendor/tunnel-core/dist/flows/tcp.d.ts +60 -0
  21. package/vendor/tunnel-core/dist/flows/tcp.js +546 -0
  22. package/vendor/tunnel-core/dist/flows/udp.d.ts +41 -0
  23. package/vendor/tunnel-core/dist/flows/udp.js +376 -0
  24. package/vendor/tunnel-core/dist/lib/adapt-logger.d.ts +2 -0
  25. package/vendor/tunnel-core/dist/lib/adapt-logger.js +6 -0
  26. package/vendor/tunnel-core/dist/lib/fingerprint.d.ts +13 -0
  27. package/vendor/tunnel-core/dist/lib/fingerprint.js +95 -0
  28. package/vendor/tunnel-core/dist/lib/jwt-verifier.d.ts +27 -0
  29. package/vendor/tunnel-core/dist/lib/jwt-verifier.js +230 -0
  30. package/vendor/tunnel-core/dist/lib/logger.d.ts +9 -0
  31. package/vendor/tunnel-core/dist/lib/logger.js +58 -0
  32. package/vendor/tunnel-core/dist/lib/refresh-helpers.d.ts +16 -0
  33. package/vendor/tunnel-core/dist/lib/refresh-helpers.js +66 -0
  34. package/vendor/tunnel-core/dist/lifecycle.d.ts +24 -0
  35. package/vendor/tunnel-core/dist/lifecycle.js +29 -0
  36. package/vendor/tunnel-core/dist/mqtt/awaiter-map.d.ts +56 -0
  37. package/vendor/tunnel-core/dist/mqtt/awaiter-map.js +227 -0
  38. package/vendor/tunnel-core/dist/mqtt/events/handlers.d.ts +58 -0
  39. package/vendor/tunnel-core/dist/mqtt/events/handlers.js +250 -0
  40. package/vendor/tunnel-core/dist/mqtt/events/index.d.ts +1 -0
  41. package/vendor/tunnel-core/dist/mqtt/events/index.js +191 -0
  42. package/vendor/tunnel-core/dist/mqtt/events/schemas.d.ts +498 -0
  43. package/vendor/tunnel-core/dist/mqtt/events/schemas.js +51 -0
  44. package/vendor/tunnel-core/dist/mqtt/ingress.d.ts +63 -0
  45. package/vendor/tunnel-core/dist/mqtt/ingress.js +170 -0
  46. package/vendor/tunnel-core/dist/state/assignment.d.ts +122 -0
  47. package/vendor/tunnel-core/dist/state/assignment.js +322 -0
  48. package/vendor/tunnel-core/dist/state/instance-registry.d.ts +88 -0
  49. package/{src → vendor/tunnel-core/dist}/state/instance-registry.js +38 -53
  50. package/vendor/tunnel-core/dist/tcp-v1/framing.d.ts +43 -0
  51. package/vendor/tunnel-core/dist/tcp-v1/framing.js +157 -0
  52. package/vendor/tunnel-core/dist/tunnel/http-tunnel.d.ts +137 -0
  53. package/vendor/tunnel-core/dist/tunnel/http-tunnel.js +1591 -0
  54. package/vendor/tunnel-core/dist/tunnel/httpws-constants.d.ts +13 -0
  55. package/{src → vendor/tunnel-core/dist}/tunnel/httpws-constants.js +5 -7
  56. package/vendor/tunnel-core/dist/tunnel/reconnect.d.ts +76 -0
  57. package/vendor/tunnel-core/dist/tunnel/reconnect.js +183 -0
  58. package/vendor/tunnel-core/dist/tunnel/request-sink.d.ts +40 -0
  59. package/vendor/tunnel-core/dist/tunnel/request-sink.js +39 -0
  60. package/vendor/tunnel-core/dist/tunnel/tcp-tunnel.d.ts +89 -0
  61. package/vendor/tunnel-core/dist/tunnel/tcp-tunnel.js +838 -0
  62. package/vendor/tunnel-core/dist/tunnel/udp-tunnel.d.ts +90 -0
  63. package/vendor/tunnel-core/dist/tunnel/udp-tunnel.js +737 -0
  64. package/vendor/tunnel-core/dist/tunnel/ws-control.d.ts +22 -0
  65. package/vendor/tunnel-core/dist/tunnel/ws-control.js +124 -0
  66. package/vendor/tunnel-core/dist/types.d.ts +24 -0
  67. package/vendor/tunnel-core/dist/types.js +2 -0
  68. package/vendor/tunnel-core/dist/udp-v1/framing.d.ts +41 -0
  69. package/vendor/tunnel-core/dist/udp-v1/framing.js +158 -0
  70. package/vendor/tunnel-core/package.json +34 -0
  71. package/src/control-plane/MqttControlPlaneClient.js +0 -1196
  72. package/src/control-plane/MqttControlPlaneTransport.js +0 -150
  73. package/src/lib/fingerprint.js +0 -115
  74. package/src/lib/jwt-verifier.js +0 -260
  75. package/src/lib/logger.js +0 -62
  76. package/src/mqtt/awaiter-map.js +0 -247
  77. package/src/mqtt/events/handlers.js +0 -300
  78. package/src/mqtt/events/index.js +0 -222
  79. package/src/mqtt/events/schemas.js +0 -58
  80. package/src/mqtt/ingress.js +0 -182
  81. package/src/state/assignment.js +0 -333
  82. package/src/tcp-v1/framing.js +0 -203
  83. package/src/tunnel/http-tunnel.js +0 -1738
  84. package/src/tunnel/reconnect.js +0 -182
  85. package/src/tunnel/tcp-tunnel.js +0 -944
  86. package/src/tunnel/udp-tunnel.js +0 -813
  87. package/src/tunnel/ws-control.js +0 -135
  88. package/src/udp-v1/framing.js +0 -203
@@ -0,0 +1,51 @@
1
+ import { z } from "zod";
2
+ export const Envelope = z.object({
3
+ type: z.enum(["setup_required", "open_ack", "open_reject", "error"]),
4
+ v: z.literal(1),
5
+ requestId: z.string().min(1),
6
+ ts: z.number().int().positive(),
7
+ data: z.unknown(),
8
+ });
9
+ export const SetupRequired = Envelope.extend({
10
+ type: z.literal("setup_required"),
11
+ data: z.object({ reason: z.string().optional() }),
12
+ });
13
+ export const OpenAck = Envelope.extend({
14
+ type: z.literal("open_ack"),
15
+ data: z.object({
16
+ relayId: z.string().min(1),
17
+ leaseMs: z.number().int().positive(),
18
+ assignment: z.object({
19
+ jwt: z.string().min(10),
20
+ fqdn: z.string().min(1),
21
+ proto: z.string().min(1),
22
+ path: z.string().min(1),
23
+ kid: z.string().optional(),
24
+ alg: z.string().optional(),
25
+ exp: z.number().optional(),
26
+ }),
27
+ }),
28
+ });
29
+ // Legacy OpenAck schema for backward compatibility
30
+ export const OpenAckLegacy = Envelope.extend({
31
+ type: z.literal("open_ack"),
32
+ data: z.object({
33
+ relayId: z.string().min(1),
34
+ jwt: z.string().min(10),
35
+ leaseMs: z.number().int().positive(),
36
+ }),
37
+ });
38
+ export const OpenReject = Envelope.extend({
39
+ type: z.literal("open_reject"),
40
+ data: z.object({
41
+ reason: z.string().min(1),
42
+ }),
43
+ });
44
+ export const ErrorEvt = Envelope.extend({
45
+ type: z.enum(["error"]),
46
+ data: z.object({
47
+ code: z.string().min(1),
48
+ msg: z.string().optional(),
49
+ }),
50
+ });
51
+ export const AnyEvt = z.union([SetupRequired, OpenAck, OpenAckLegacy, OpenReject, ErrorEvt]);
@@ -0,0 +1,63 @@
1
+ export class MessageIngress {
2
+ constructor(options?: {});
3
+ awaiterMap: AwaiterMap;
4
+ dispatcher: Function;
5
+ observability: any;
6
+ onObserve: any;
7
+ messageCounter: number;
8
+ _observe(line: any): void;
9
+ /**
10
+ * Set the CP-3F event dispatcher
11
+ * @param {Function} dispatcher - The dispatchEvt function
12
+ */
13
+ setDispatcher(dispatcher: Function): void;
14
+ /**
15
+ * Register an awaiter for request/response correlation
16
+ * @param {Function} criteria - Function that returns true if message matches
17
+ * @param {number} timeoutMs - Timeout in milliseconds
18
+ * @returns {Promise} Promise that resolves with the matching message
19
+ */
20
+ registerAwaiter(criteria: Function, timeoutMs?: number): Promise<any>;
21
+ /**
22
+ * Cancel awaiters that match a test criteria
23
+ * @param {Function} testCriteria - Function that returns true if an awaiter should be cancelled
24
+ * @returns {number} Number of awaiters cancelled
25
+ */
26
+ cancelAwaitersByCriteria(testCriteria: Function): number;
27
+ /**
28
+ * Main ingress handler - processes all incoming MQTT messages
29
+ * @param {Object} message - Raw MQTT message from transport
30
+ */
31
+ handleMessage(message: any): Promise<{
32
+ msgId: number;
33
+ awaiterResolved: boolean;
34
+ parseStatus: string;
35
+ sizeBytes: any;
36
+ }>;
37
+ /**
38
+ * Get statistics about the ingress system
39
+ * @returns {Object} Statistics object
40
+ */
41
+ getStats(): any;
42
+ /**
43
+ * Clear all awaiters (for cleanup)
44
+ */
45
+ clear(): void;
46
+ /**
47
+ * Create a session ID awaiter (backward compatibility)
48
+ * @param {string} sessionId - Session ID to match
49
+ * @param {string} expectedTopic - Expected topic pattern
50
+ * @param {number} timeoutMs - Timeout in milliseconds
51
+ * @returns {Promise} Promise that resolves with the matching message
52
+ */
53
+ awaitSessionId(sessionId: string, expectedTopic: string, timeoutMs?: number): Promise<any>;
54
+ /**
55
+ * Create a correlation ID awaiter (future use)
56
+ * @param {string} correlationId - Correlation ID to match
57
+ * @param {string} expectedTopic - Expected topic pattern
58
+ * @param {number} timeoutMs - Timeout in milliseconds
59
+ * @returns {Promise} Promise that resolves with the matching message
60
+ */
61
+ awaitCorrelationId(correlationId: string, expectedTopic: string, timeoutMs?: number): Promise<any>;
62
+ }
63
+ import { AwaiterMap } from './awaiter-map.js';
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Single Ingress Message Handler
3
+ *
4
+ * Provides a single point of entry for all MQTT messages that:
5
+ * 1. Parses messages once
6
+ * 2. Resolves awaiters for request/response flows
7
+ * 3. Always forwards messages to the CP-3F dispatcher
8
+ *
9
+ * This eliminates the handler-order race that prevents CP-3F envelopes
10
+ * from being processed and establishes the pattern for future stories.
11
+ */
12
+ import { AwaiterMap } from './awaiter-map.js';
13
+ export class MessageIngress {
14
+ constructor(options = {}) {
15
+ // QPA-CLI-10: Pass logger to AwaiterMap for quiet mode
16
+ this.awaiterMap = new AwaiterMap(options.maxAwaiters || 100, options.logger || null);
17
+ this.dispatcher = null;
18
+ this.observability = options.observability || false;
19
+ // Story 12.1 (c2): the core never prints; observability lines (ASYX_DEBUG=1) go to onObserve
20
+ this.onObserve = options.onObserve || null;
21
+ this.messageCounter = 0;
22
+ }
23
+ _observe(line) {
24
+ if (this.onObserve)
25
+ this.onObserve(line);
26
+ }
27
+ /**
28
+ * Set the CP-3F event dispatcher
29
+ * @param {Function} dispatcher - The dispatchEvt function
30
+ */
31
+ setDispatcher(dispatcher) {
32
+ this.dispatcher = dispatcher;
33
+ }
34
+ /**
35
+ * Register an awaiter for request/response correlation
36
+ * @param {Function} criteria - Function that returns true if message matches
37
+ * @param {number} timeoutMs - Timeout in milliseconds
38
+ * @returns {Promise} Promise that resolves with the matching message
39
+ */
40
+ registerAwaiter(criteria, timeoutMs = 5000) {
41
+ return this.awaiterMap.register(criteria, timeoutMs);
42
+ }
43
+ /**
44
+ * Cancel awaiters that match a test criteria
45
+ * @param {Function} testCriteria - Function that returns true if an awaiter should be cancelled
46
+ * @returns {number} Number of awaiters cancelled
47
+ */
48
+ cancelAwaitersByCriteria(testCriteria) {
49
+ return this.awaiterMap.cancelByCriteria(testCriteria);
50
+ }
51
+ /**
52
+ * Main ingress handler - processes all incoming MQTT messages
53
+ * @param {Object} message - Raw MQTT message from transport
54
+ */
55
+ async handleMessage(message) {
56
+ const msgId = ++this.messageCounter;
57
+ const ts = Date.now();
58
+ const sizeBytes = message.payload ? message.payload.length : 0;
59
+ // Parse message once
60
+ let parsedMessage;
61
+ let parseStatus = 'success';
62
+ try {
63
+ const raw = message.payload;
64
+ const buffer = typeof raw === 'string' ? Buffer.from(raw, 'utf8')
65
+ : Buffer.isBuffer(raw) ? raw
66
+ : ArrayBuffer.isView(raw) ? Buffer.from(raw.buffer, raw.byteOffset, raw.byteLength)
67
+ : raw instanceof ArrayBuffer ? Buffer.from(raw)
68
+ : null;
69
+ let parsedPayload;
70
+ if (buffer) {
71
+ try {
72
+ parsedPayload = JSON.parse(buffer.toString('utf8'));
73
+ }
74
+ catch {
75
+ parseStatus = 'json_parse_error';
76
+ }
77
+ }
78
+ parsedMessage = {
79
+ topic: message.topic,
80
+ payload: parsedPayload,
81
+ raw: buffer,
82
+ sizeBytes,
83
+ msgId,
84
+ ts
85
+ };
86
+ }
87
+ catch (error) {
88
+ parseStatus = 'parse_error';
89
+ parsedMessage = {
90
+ topic: message.topic,
91
+ payload: undefined,
92
+ raw: message.payload,
93
+ sizeBytes,
94
+ msgId,
95
+ ts,
96
+ error: error.message
97
+ };
98
+ }
99
+ // Log ingress (CP-5 ready)
100
+ if (this.observability) {
101
+ this._observe(`[ingress] ts=${ts} msgId=${msgId} topic=${parsedMessage.topic} parseStatus=${parseStatus} sizeBytes=${sizeBytes}`);
102
+ }
103
+ // Check awaiters and resolve any matching promises
104
+ const awaiterResolved = this.awaiterMap.processMessage(parsedMessage);
105
+ // Always dispatch to CP-3F dispatcher (non-exclusive broadcast)
106
+ if (this.dispatcher) {
107
+ try {
108
+ await this.dispatcher(parsedMessage);
109
+ // Log dispatch completion (CP-5 ready)
110
+ if (this.observability) {
111
+ this._observe(`[dispatch] ts=${Date.now()} msgId=${msgId} dispatched=true`);
112
+ }
113
+ }
114
+ catch (error) {
115
+ // Log dispatch error but don't crash
116
+ if (this.observability) {
117
+ this._observe(`[dispatch] ts=${Date.now()} msgId=${msgId} dispatched=false error=${error.message}`);
118
+ }
119
+ // Re-throw dispatcher errors (they contain business logic like exit codes)
120
+ throw error;
121
+ }
122
+ }
123
+ return {
124
+ msgId,
125
+ awaiterResolved,
126
+ parseStatus,
127
+ sizeBytes
128
+ };
129
+ }
130
+ /**
131
+ * Get statistics about the ingress system
132
+ * @returns {Object} Statistics object
133
+ */
134
+ getStats() {
135
+ return {
136
+ messageCounter: this.messageCounter,
137
+ awaiterStats: this.awaiterMap.getStats(),
138
+ hasDispatcher: !!this.dispatcher,
139
+ observabilityEnabled: this.observability
140
+ };
141
+ }
142
+ /**
143
+ * Clear all awaiters (for cleanup)
144
+ */
145
+ clear() {
146
+ this.awaiterMap.clear();
147
+ }
148
+ /**
149
+ * Create a session ID awaiter (backward compatibility)
150
+ * @param {string} sessionId - Session ID to match
151
+ * @param {string} expectedTopic - Expected topic pattern
152
+ * @param {number} timeoutMs - Timeout in milliseconds
153
+ * @returns {Promise} Promise that resolves with the matching message
154
+ */
155
+ awaitSessionId(sessionId, expectedTopic, timeoutMs = 5000) {
156
+ const criteria = AwaiterMap.createSessionIdCriteria(sessionId, expectedTopic);
157
+ return this.registerAwaiter(criteria, timeoutMs);
158
+ }
159
+ /**
160
+ * Create a correlation ID awaiter (future use)
161
+ * @param {string} correlationId - Correlation ID to match
162
+ * @param {string} expectedTopic - Expected topic pattern
163
+ * @param {number} timeoutMs - Timeout in milliseconds
164
+ * @returns {Promise} Promise that resolves with the matching message
165
+ */
166
+ awaitCorrelationId(correlationId, expectedTopic, timeoutMs = 5000) {
167
+ const criteria = AwaiterMap.createCorrelationIdCriteria(correlationId, expectedTopic);
168
+ return this.registerAwaiter(criteria, timeoutMs);
169
+ }
170
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Set assignment for a specific tunnel instance
3
+ * TPB-12: Per-instance assignment storage to prevent cross-wiring
4
+ * @param {string} instanceId - Tunnel instance ID (full MQTT clientId)
5
+ * @param {Object} assignment - Assignment data
6
+ * @param {string} assignment.requestId - Request ID
7
+ * @param {string} assignment.relayId - Relay ID
8
+ * @param {string} assignment.relayUrl - Relay URL
9
+ * @param {string} assignment.jwt - JWT token (stored in memory only)
10
+ * @param {number} assignment.leaseMs - Lease duration in milliseconds
11
+ * @param {string} assignment.leaseId - Lease ID for JWT refresh (optional)
12
+ * @param {string} [assignment.quickpassSlug]
13
+ * @param {string} [assignment.tcpAliasFqdn]
14
+ * @param {number} [assignment.publicPort]
15
+ * @param {string} [assignment.fqdn]
16
+ * @param {boolean} [assignment.srvProvisioned]
17
+ * @param {string} [assignment.srvFqdn]
18
+ * @param {unknown[]} [assignment.warnings]
19
+ * @param {string} [assignment.tunnelMode]
20
+ * @param {string} [assignment.protocol]
21
+ * @param {string} [assignment.assignmentJwt]
22
+ */
23
+ export function setAssignment(instanceId: string, assignment: {
24
+ requestId: string;
25
+ relayId: string;
26
+ relayUrl: string;
27
+ jwt: string;
28
+ leaseMs: number;
29
+ leaseId: string;
30
+ quickpassSlug?: string;
31
+ tcpAliasFqdn?: string;
32
+ publicPort?: number;
33
+ fqdn?: string;
34
+ srvProvisioned?: boolean;
35
+ srvFqdn?: string;
36
+ warnings?: unknown[];
37
+ tunnelMode?: string;
38
+ protocol?: string;
39
+ assignmentJwt?: string;
40
+ }): void;
41
+ /**
42
+ * Get assignment for a specific tunnel instance
43
+ * TPB-12: Per-instance assignment retrieval
44
+ * @param {string} instanceId - Tunnel instance ID (full MQTT clientId)
45
+ * @returns {Object|null} Assignment for the instance or null if none set
46
+ */
47
+ export function getAssignment(instanceId: string): any | null;
48
+ /**
49
+ * Resolve instanceId from leaseId
50
+ * TPB-12: Helper to route events that only have leaseId
51
+ * @param {string} leaseId - Lease ID
52
+ * @returns {string|null} Instance ID or null if not found
53
+ */
54
+ export function resolveInstanceByLease(leaseId: string): string | null;
55
+ /**
56
+ * Clear assignment for a specific tunnel instance
57
+ * TPB-12: Per-instance assignment clearing
58
+ * @param {string} instanceId - Tunnel instance ID (full MQTT clientId)
59
+ */
60
+ export function clearAssignment(instanceId: string): void;
61
+ /**
62
+ * Drop one instance key without touching a lease mapping that already points elsewhere.
63
+ * Does not reject assignment waiters.
64
+ * @param {string} instanceId
65
+ */
66
+ export function forgetInstanceAssignment(instanceId: string): void;
67
+ /**
68
+ * Copy an assignment onto a new instance id and drop the old key.
69
+ * When a tunnel object is passed, its instanceId moves with the assignment.
70
+ * @param {{ oldId: string, newId: string, tunnel?: { instanceId?: string } | null }} opts
71
+ * @returns {{ moved: boolean, leaseId: string | null, size: number }}
72
+ */
73
+ export function migrateInstanceAssignment({ oldId, newId, tunnel }?: {
74
+ oldId: string;
75
+ newId: string;
76
+ tunnel?: {
77
+ instanceId?: string;
78
+ } | null;
79
+ }): {
80
+ moved: boolean;
81
+ leaseId: string | null;
82
+ size: number;
83
+ };
84
+ /**
85
+ * Assignment stored for this instance after a refresh ack.
86
+ * Throws when the keyed entry is missing or the JWT has no exp.
87
+ * @param {string} instanceId
88
+ * @returns {{ assignment: Object, expMs: number }}
89
+ */
90
+ export function readRefreshAssignment(instanceId: string): {
91
+ assignment: any;
92
+ expMs: number;
93
+ };
94
+ /**
95
+ * Check if an assignment exists for a specific tunnel instance
96
+ * TPB-12: Per-instance assignment check
97
+ * @param {string} instanceId - Tunnel instance ID (full MQTT clientId)
98
+ * @returns {boolean} True if assignment exists for the instance
99
+ */
100
+ export function hasAssignment(instanceId: string): boolean;
101
+ /**
102
+ * Wait until an assignment with the specified requestId is available.
103
+ * @param {string} requestId - Request ID to wait for
104
+ * @param {number} [timeoutMs=10000] - Timeout before rejecting
105
+ * @returns {Promise<Object>} resolves with the assignment snapshot
106
+ */
107
+ export function waitForAssignment(requestId: string, timeoutMs?: number): Promise<any>;
108
+ /**
109
+ * Get assignment metadata (without JWT for logging)
110
+ * TPB-12: Per-instance metadata retrieval
111
+ * @param {string} instanceId - Tunnel instance ID (full MQTT clientId)
112
+ * @returns {Object|null} Assignment metadata or null
113
+ */
114
+ export function getAssignmentMetadata(instanceId: string): any | null;
115
+ /**
116
+ * Record a successful refresh in the assignment cache and return delta ms since last refresh (or since initial assignment if none).
117
+ * TPB-12: Per-instance refresh recording
118
+ * @param {string} instanceId - Tunnel instance ID (full MQTT clientId)
119
+ * @param {number} [nowMs]
120
+ * @returns {number} delta milliseconds since last refresh or initial assignment
121
+ */
122
+ export function recordRefresh(instanceId: string, nowMs?: number): number;