@prefactor/core 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/instance-manager.d.ts +5 -8
- package/dist/agent/instance-manager.d.ts.map +1 -1
- package/dist/agent/instance-manager.js +34 -55
- package/dist/agent/instance-manager.js.map +1 -1
- package/dist/config.d.ts +15 -63
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +29 -20
- package/dist/config.js.map +1 -1
- package/dist/create-core.d.ts +0 -2
- package/dist/create-core.d.ts.map +1 -1
- package/dist/create-core.js +17 -28
- package/dist/create-core.js.map +1 -1
- package/dist/index.cjs +678 -453
- package/dist/index.cjs.map +20 -15
- package/dist/index.d.ts +4 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +678 -453
- package/dist/index.js.map +20 -15
- package/dist/lifecycle.d.ts +5 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +27 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/queue/actions.d.ts +15 -26
- package/dist/queue/actions.d.ts.map +1 -1
- package/dist/queue/base.d.ts +15 -3
- package/dist/queue/base.d.ts.map +1 -1
- package/dist/queue/in-memory-queue.d.ts +11 -0
- package/dist/queue/in-memory-queue.d.ts.map +1 -0
- package/dist/queue/in-memory-queue.js +46 -0
- package/dist/queue/in-memory-queue.js.map +1 -0
- package/dist/queue/task-executor.d.ts +18 -0
- package/dist/queue/task-executor.d.ts.map +1 -0
- package/dist/queue/task-executor.js +77 -0
- package/dist/queue/task-executor.js.map +1 -0
- package/dist/tracing/active-tracer.d.ts +5 -0
- package/dist/tracing/active-tracer.d.ts.map +1 -0
- package/dist/tracing/active-tracer.js +13 -0
- package/dist/tracing/active-tracer.js.map +1 -0
- package/dist/tracing/span.d.ts +7 -14
- package/dist/tracing/span.d.ts.map +1 -1
- package/dist/tracing/span.js +5 -36
- package/dist/tracing/span.js.map +1 -1
- package/dist/tracing/tracer.d.ts +6 -7
- package/dist/tracing/tracer.d.ts.map +1 -1
- package/dist/tracing/tracer.js +27 -12
- package/dist/tracing/tracer.js.map +1 -1
- package/dist/tracing/with-span.d.ts +4 -0
- package/dist/tracing/with-span.d.ts.map +1 -0
- package/dist/tracing/with-span.js +35 -0
- package/dist/tracing/with-span.js.map +1 -0
- package/dist/transport/http/agent-instance-client.d.ts +23 -0
- package/dist/transport/http/agent-instance-client.d.ts.map +1 -0
- package/dist/transport/http/agent-instance-client.js +25 -0
- package/dist/transport/http/agent-instance-client.js.map +1 -0
- package/dist/transport/http/agent-span-client.d.ts +25 -0
- package/dist/transport/http/agent-span-client.d.ts.map +1 -0
- package/dist/transport/http/agent-span-client.js +37 -0
- package/dist/transport/http/agent-span-client.js.map +1 -0
- package/dist/transport/http/http-client.d.ts +43 -0
- package/dist/transport/http/http-client.d.ts.map +1 -0
- package/dist/transport/http/http-client.js +127 -0
- package/dist/transport/http/http-client.js.map +1 -0
- package/dist/transport/http/retry-policy.d.ts +4 -0
- package/dist/transport/http/retry-policy.d.ts.map +1 -0
- package/dist/transport/http/retry-policy.js +10 -0
- package/dist/transport/http/retry-policy.js.map +1 -0
- package/dist/transport/http.d.ts +34 -50
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/http.js +163 -227
- package/dist/transport/http.js.map +1 -1
- package/dist/utils/logging.d.ts.map +1 -1
- package/dist/utils/logging.js +7 -1
- package/dist/utils/logging.js.map +1 -1
- package/package.json +1 -1
- package/dist/agent/schema-registry.d.ts +0 -9
- package/dist/agent/schema-registry.d.ts.map +0 -1
- package/dist/agent/schema-registry.js +0 -16
- package/dist/agent/schema-registry.js.map +0 -1
- package/dist/queue/in-memory.d.ts +0 -9
- package/dist/queue/in-memory.d.ts.map +0 -1
- package/dist/queue/in-memory.js +0 -18
- package/dist/queue/in-memory.js.map +0 -1
- package/dist/transport/base.d.ts +0 -18
- package/dist/transport/base.d.ts.map +0 -1
- package/dist/transport/base.js +0 -2
- package/dist/transport/base.js.map +0 -1
- package/dist/transport/stdio.d.ts +0 -36
- package/dist/transport/stdio.d.ts.map +0 -1
- package/dist/transport/stdio.js +0 -56
- package/dist/transport/stdio.js.map +0 -1
- package/dist/transport/worker.d.ts +0 -22
- package/dist/transport/worker.d.ts.map +0 -1
- package/dist/transport/worker.js +0 -85
- package/dist/transport/worker.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../src/queue/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,KAAK,CAAW;IAExB,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAItB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,EAAE;IAKnC,IAAI,IAAI,MAAM;IAIR,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dist/queue/in-memory.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class InMemoryQueue {
|
|
2
|
-
items = [];
|
|
3
|
-
enqueue(item) {
|
|
4
|
-
this.items.push(item);
|
|
5
|
-
}
|
|
6
|
-
dequeueBatch(maxItems) {
|
|
7
|
-
if (this.items.length === 0)
|
|
8
|
-
return [];
|
|
9
|
-
return this.items.splice(0, maxItems);
|
|
10
|
-
}
|
|
11
|
-
size() {
|
|
12
|
-
return this.items.length;
|
|
13
|
-
}
|
|
14
|
-
async flush() {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=in-memory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory.js","sourceRoot":"","sources":["../../src/queue/in-memory.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IAChB,KAAK,GAAQ,EAAE,CAAC;IAExB,OAAO,CAAC,IAAO;QACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,QAAgB;QAC3B,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO;IACT,CAAC;CACF"}
|
package/dist/transport/base.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { QueueAction } from '../queue/actions.js';
|
|
2
|
-
/**
|
|
3
|
-
* Transport interface for emitting spans to different backends
|
|
4
|
-
*
|
|
5
|
-
* Transports are responsible for sending span data to a destination
|
|
6
|
-
* (e.g., stdout, HTTP API). They implement the strategy pattern to allow
|
|
7
|
-
* pluggable backends.
|
|
8
|
-
*/
|
|
9
|
-
export interface Transport {
|
|
10
|
-
processBatch(items: QueueAction[]): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Close the transport and flush any pending data
|
|
13
|
-
*
|
|
14
|
-
* @returns Promise that resolves when the transport is fully closed
|
|
15
|
-
*/
|
|
16
|
-
close(): void | Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/transport/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;;;OAIG;IACH,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B"}
|
package/dist/transport/base.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/transport/base.ts"],"names":[],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { QueueAction } from '../queue/actions.js';
|
|
2
|
-
import type { Transport } from './base.js';
|
|
3
|
-
/**
|
|
4
|
-
* STDIO transport emits spans as newline-delimited JSON to stdout.
|
|
5
|
-
*
|
|
6
|
-
* This is the default transport and requires no configuration.
|
|
7
|
-
* It's useful for local development and for piping span data to other tools.
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Newline-delimited JSON output
|
|
11
|
-
* - Promise-based write locking for ordering
|
|
12
|
-
* - Graceful error handling
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const transport = new StdioTransport();
|
|
17
|
-
* const tracer = new Tracer(transport);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare class StdioTransport implements Transport {
|
|
21
|
-
private closed;
|
|
22
|
-
private writeLock;
|
|
23
|
-
/**
|
|
24
|
-
* Emit a batch of queue actions to stdout as newline-delimited JSON
|
|
25
|
-
*
|
|
26
|
-
* @param items - The queue actions to emit
|
|
27
|
-
*/
|
|
28
|
-
processBatch(items: QueueAction[]): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Close the transport and wait for pending writes to complete
|
|
31
|
-
*
|
|
32
|
-
* @returns Promise that resolves when all writes are complete
|
|
33
|
-
*/
|
|
34
|
-
close(): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/transport/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,YAAW,SAAS;IAC9C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAqB;IAEtC;;;;OAIG;IACG,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBvD;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
|
package/dist/transport/stdio.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { serializeValue } from '../utils/serialization.js';
|
|
2
|
-
/**
|
|
3
|
-
* STDIO transport emits spans as newline-delimited JSON to stdout.
|
|
4
|
-
*
|
|
5
|
-
* This is the default transport and requires no configuration.
|
|
6
|
-
* It's useful for local development and for piping span data to other tools.
|
|
7
|
-
*
|
|
8
|
-
* Features:
|
|
9
|
-
* - Newline-delimited JSON output
|
|
10
|
-
* - Promise-based write locking for ordering
|
|
11
|
-
* - Graceful error handling
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const transport = new StdioTransport();
|
|
16
|
-
* const tracer = new Tracer(transport);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export class StdioTransport {
|
|
20
|
-
closed = false;
|
|
21
|
-
writeLock = Promise.resolve();
|
|
22
|
-
/**
|
|
23
|
-
* Emit a batch of queue actions to stdout as newline-delimited JSON
|
|
24
|
-
*
|
|
25
|
-
* @param items - The queue actions to emit
|
|
26
|
-
*/
|
|
27
|
-
async processBatch(items) {
|
|
28
|
-
if (this.closed || items.length === 0) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
// Queue write to maintain ordering
|
|
32
|
-
this.writeLock = this.writeLock.then(async () => {
|
|
33
|
-
for (const item of items) {
|
|
34
|
-
try {
|
|
35
|
-
const serialized = serializeValue(item);
|
|
36
|
-
const json = JSON.stringify(serialized);
|
|
37
|
-
await Bun.write(Bun.stdout, `${json}\n`);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
console.error('Failed to emit queue action to stdout:', error);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
await this.writeLock;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Close the transport and wait for pending writes to complete
|
|
48
|
-
*
|
|
49
|
-
* @returns Promise that resolves when all writes are complete
|
|
50
|
-
*/
|
|
51
|
-
async close() {
|
|
52
|
-
this.closed = true;
|
|
53
|
-
await this.writeLock;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=stdio.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../src/transport/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IACjB,MAAM,GAAG,KAAK,CAAC;IACf,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAEtC;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,KAAoB;QACrC,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO;QACT,CAAC;QAED,mCAAmC;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,IAAI,CAAC;oBACH,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;oBACxC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;oBACxC,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC;gBAC3C,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;gBACjE,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { QueueAction } from '../queue/actions.js';
|
|
2
|
-
import type { Queue } from '../queue/base.js';
|
|
3
|
-
import type { Transport } from './base.js';
|
|
4
|
-
type WorkerConfig = {
|
|
5
|
-
batchSize: number;
|
|
6
|
-
intervalMs: number;
|
|
7
|
-
};
|
|
8
|
-
export declare class TransportWorker {
|
|
9
|
-
private queue;
|
|
10
|
-
private transport;
|
|
11
|
-
private config;
|
|
12
|
-
private closed;
|
|
13
|
-
private inFlightPromise;
|
|
14
|
-
private loopPromise;
|
|
15
|
-
private pendingBatch;
|
|
16
|
-
constructor(queue: Queue<QueueAction>, transport: Transport, config: WorkerConfig);
|
|
17
|
-
private start;
|
|
18
|
-
flush(timeoutMs: number): Promise<void>;
|
|
19
|
-
close(timeoutMs?: number): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/transport/worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,KAAK,YAAY,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,qBAAa,eAAe;IAOxB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IARhB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,YAAY,CAA8B;gBAGxC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,EACzB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,YAAY;YAKhB,KAAK;IAuBb,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvC,KAAK,CAAC,SAAS,SAA8B,GAAG,OAAO,CAAC,IAAI,CAAC;CAmDpE"}
|
package/dist/transport/worker.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
export class TransportWorker {
|
|
2
|
-
queue;
|
|
3
|
-
transport;
|
|
4
|
-
config;
|
|
5
|
-
closed = false;
|
|
6
|
-
inFlightPromise = null;
|
|
7
|
-
loopPromise;
|
|
8
|
-
pendingBatch = null;
|
|
9
|
-
constructor(queue, transport, config) {
|
|
10
|
-
this.queue = queue;
|
|
11
|
-
this.transport = transport;
|
|
12
|
-
this.config = config;
|
|
13
|
-
this.loopPromise = this.start();
|
|
14
|
-
}
|
|
15
|
-
async start() {
|
|
16
|
-
while (!this.closed || this.pendingBatch || this.queue.size() > 0 || this.inFlightPromise) {
|
|
17
|
-
const batch = this.pendingBatch ?? this.queue.dequeueBatch(this.config.batchSize);
|
|
18
|
-
if (batch.length === 0) {
|
|
19
|
-
await new Promise((resolve) => setTimeout(resolve, this.config.intervalMs));
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const inFlight = this.transport.processBatch(batch);
|
|
24
|
-
this.inFlightPromise = inFlight;
|
|
25
|
-
await inFlight;
|
|
26
|
-
this.pendingBatch = null;
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
this.pendingBatch = batch;
|
|
30
|
-
console.error('TransportWorker.processBatch failed', error);
|
|
31
|
-
await new Promise((resolve) => setTimeout(resolve, this.config.intervalMs));
|
|
32
|
-
}
|
|
33
|
-
finally {
|
|
34
|
-
this.inFlightPromise = null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async flush(timeoutMs) {
|
|
39
|
-
const start = Date.now();
|
|
40
|
-
while ((this.queue.size() > 0 || this.pendingBatch || this.inFlightPromise) &&
|
|
41
|
-
Date.now() - start < timeoutMs) {
|
|
42
|
-
await new Promise((resolve) => setTimeout(resolve, this.config.intervalMs));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async close(timeoutMs = this.config.intervalMs * 50) {
|
|
46
|
-
this.closed = true;
|
|
47
|
-
const deadline = Date.now() + timeoutMs;
|
|
48
|
-
const awaitWithTimeout = async (promise, label, timeoutMs, warnOnTimeout = true) => {
|
|
49
|
-
if (timeoutMs <= 0) {
|
|
50
|
-
if (warnOnTimeout) {
|
|
51
|
-
console.warn(`TransportWorker.close timed out waiting for ${label}`);
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
const resolvedPromise = Promise.resolve(promise);
|
|
56
|
-
let timeoutId = null;
|
|
57
|
-
const timeoutPromise = new Promise((resolve) => {
|
|
58
|
-
timeoutId = setTimeout(() => resolve(false), timeoutMs);
|
|
59
|
-
});
|
|
60
|
-
const completed = await Promise.race([resolvedPromise.then(() => true), timeoutPromise]);
|
|
61
|
-
if (timeoutId) {
|
|
62
|
-
clearTimeout(timeoutId);
|
|
63
|
-
}
|
|
64
|
-
if (!completed && warnOnTimeout) {
|
|
65
|
-
console.warn(`TransportWorker.close timed out waiting for ${label}`);
|
|
66
|
-
}
|
|
67
|
-
return completed;
|
|
68
|
-
};
|
|
69
|
-
const remainingTime = () => Math.max(0, deadline - Date.now());
|
|
70
|
-
const loopCompleted = await awaitWithTimeout(this.loopPromise, 'loop to finish', remainingTime(), false);
|
|
71
|
-
if (!loopCompleted) {
|
|
72
|
-
console.warn('TransportWorker.close timed out waiting for loop to finish; closing transport now may cause potential data loss');
|
|
73
|
-
}
|
|
74
|
-
const safeTransportClose = async () => {
|
|
75
|
-
try {
|
|
76
|
-
await this.transport.close();
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
console.error('TransportWorker.close failed', error);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
await awaitWithTimeout(safeTransportClose(), 'transport to close', remainingTime());
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/transport/worker.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,eAAe;IAOhB;IACA;IACA;IARF,MAAM,GAAG,KAAK,CAAC;IACf,eAAe,GAAyB,IAAI,CAAC;IAC7C,WAAW,CAAgB;IAC3B,YAAY,GAAyB,IAAI,CAAC;IAElD,YACU,KAAyB,EACzB,SAAoB,EACpB,MAAoB;QAFpB,UAAK,GAAL,KAAK,CAAoB;QACzB,cAAS,GAAT,SAAS,CAAW;QACpB,WAAM,GAAN,MAAM,CAAc;QAE5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;IAEO,KAAK,CAAC,KAAK;QACjB,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1F,MAAM,KAAK,GAAG,IAAI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