@mark1russell7/service 0.8.0 → 0.8.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/README.md +2 -1
- package/build/{builder-BWfcgx__.d.ts → builder-DQj3NNNc.d.ts} +3 -3
- package/build/{core-Cuh3oSfr.d.ts → core-Dt0HEVMq.d.ts} +4 -4
- package/build/{dial-ZJNa6s9i.d.ts → dial-CSQOl-yj.d.ts} +2 -2
- package/build/grpc.d.ts +3 -3
- package/build/host.d.ts +2 -2
- package/build/host.js +7 -1
- package/build/host.js.map +1 -1
- package/build/http-client.d.ts +3 -3
- package/build/http.d.ts +1 -1
- package/build/index.d.ts +5 -5
- package/build/index.js +13 -1
- package/build/index.js.map +1 -1
- package/build/{lifecycle-C8ffyrQ9.d.ts → lifecycle-Br0jAjTk.d.ts} +2 -2
- package/build/{logger-BY1RFLzq.d.ts → logger-BN2BfPgU.d.ts} +18 -2
- package/build/mongodb.d.ts +3 -3
- package/build/otel.d.ts +7 -0
- package/build/otel.js +14 -0
- package/build/otel.js.map +1 -0
- package/build/pg.d.ts +2 -2
- package/build/{ports-D-Anj51B.d.ts → ports-CSr7qWrA.d.ts} +2 -2
- package/build/{queue-rfmKMwju.d.ts → queue-fIkOXKVG.d.ts} +3 -3
- package/build/rabbitmq.d.ts +4 -4
- package/build/redis.d.ts +2 -2
- package/build/testing.d.ts +4 -4
- package/build/websocket.d.ts +3 -3
- package/package.json +12 -2
package/build/http-client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as Clock } from "./clock-DpVgpY4h.js";
|
|
2
|
-
import {
|
|
3
|
-
import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, c as ClientSpec, d as Factory, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, r as Client, s as ClientSocket, t as Attempt, u as DialFn, w as Manifestation } from "./core-
|
|
4
|
-
import { t as Judge } from "./dial-
|
|
2
|
+
import { N as Poll, ut as Operation } from "./logger-BN2BfPgU.js";
|
|
3
|
+
import { C as MANIFESTATIONS, D as firstDetector, E as Situation, O as unwatched, S as Detector, T as Meeting, _ as Sent, a as ClientKnobs, c as ClientSpec, d as Factory, g as SendOptions, h as STARTING_POLL, i as ClientJoin, l as ClientStep, n as CheckOptions, o as ClientOptions, r as Client, s as ClientSocket, t as Attempt, u as DialFn, w as Manifestation } from "./core-Dt0HEVMq.js";
|
|
4
|
+
import { t as Judge } from "./dial-CSQOl-yj.js";
|
|
5
5
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
6
6
|
import { Machine } from "@mark1russell7/algebra";
|
|
7
7
|
//#region src/http-client/connection.d.ts
|
package/build/http.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as Clock } from "./clock-DpVgpY4h.js";
|
|
2
2
|
import { f as Refused } from "./policy-CwYR95Sz.js";
|
|
3
|
-
import { S as Health, T as ProbeKind, b as RequestWork, d as TransportImpl, h as RequestEnd, n as HealthServer, r as Lifecycle, y as RequestStream } from "./lifecycle-
|
|
3
|
+
import { S as Health, T as ProbeKind, b as RequestWork, d as TransportImpl, h as RequestEnd, n as HealthServer, r as Lifecycle, y as RequestStream } from "./lifecycle-Br0jAjTk.js";
|
|
4
4
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
5
5
|
import { ListenOptions } from "node:net";
|
|
6
6
|
import { IncomingMessage, Server, ServerEventMap, ServerResponse } from "node:http";
|
package/build/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { a as backoffDelay, i as backoffBand, n as DelayBand, o as backoffProblems, r as Jitter, t as Backoff } from "./backoff-B-jGWVDm.js";
|
|
2
2
|
import { a as realClock, i as platformClock, n as Clock, r as PlatformClockOptions, t as Cancel } from "./clock-DpVgpY4h.js";
|
|
3
3
|
import { C as limitRule, D as retryAfterSeconds, E as overCapacity, O as unitsOf, S as idleSpan, T as longestRetryAfter, _ as WaitCause, a as LimitPolicy, b as decide, c as LimiterEviction, d as RefusalCause, f as Refused, g as TokenBucket, h as TakeStep, i as KeyState, l as LimiterSpec, m as StoreFailure, n as CapacityRefused, o as LimitRule, p as SlidingWindow, r as Decision, s as Limiter, t as Allowed, u as LimiterStoreSpec, v as WaitRefused, w as limiterProblems, x as freeAt, y as capacityOf } from "./policy-CwYR95Sz.js";
|
|
4
|
-
import { $ as
|
|
5
|
-
import { A as DurationHistogram, C as HealthVerdict, D as CheckFn, E as StartOptions, F as Outcome, I as Result, M as Episode, N as HealthMetrics, O as CheckMetrics, P as redact, S as Health, T as ProbeKind, _ as RequestFn, a as PhaseContext, b as RequestWork, c as STAGES, d as TransportImpl, f as UncaughtOptions, g as RequestEvent, h as RequestEnd, i as LifecycleState, j as EPISODES_KEPT, k as DURATION_FRACTIONS, l as ShutdownOptions, m as stageRank, n as HealthServer, o as PhaseWork, p as cooperativeAbortAt, r as Lifecycle, s as RunOptions, t as DependencyHandle, u as Stage, v as RequestOptions, w as ProbeAnswer, x as CheckVerdict, y as RequestStream } from "./lifecycle-
|
|
6
|
-
import { a as WatchdogSpec, c as Profile, d as kubernetes, f as localDev, i as Watchdog, l as daemon, n as ServiceBuilder, o as watchdog, r as service, s as PodTiming, t as ControllerBuilder, u as ephemeral } from "./builder-
|
|
4
|
+
import { $ as ProcessTrigger, A as Step, B as recoverSpan, C as FORMAT, D as ProgressMarks, E as Phase, F as Timing, G as EmbeddedProcess, H as RoutePattern, I as asDebounce, J as HostStream, K as ExitSignal, L as asWindow, M as FailsBy, N as Poll, O as RepeatSignal, P as Span, Q as ProcessPort, R as failSpan, S as ExitCodes, T as MessageTrigger, U as RouteRequest, V as OperationOf, W as EXIT_SIGNALS, X as PROCESS_TRIGGERS, Y as MessageShape, Z as ProcessHost, _ as Check, a as LogFields, at as isMessageShape, b as Coupling, c as Logger, ct as processPortOf, d as atLeast, dt as mayReissue, et as UNCAUGHT_ORIGINS, f as consoleLogger, g as Recorder, h as MachineName, i as LogEntry, it as isExitSignal, j as Transport, k as ServiceDescription, l as TraceIds, lt as Idempotency, m as LifecycleEvent, n as ConsoleTarget, nt as embeddedProcess, o as LogFormat, ot as matchesMessage, p as logEvents, q as ExitTrigger, r as LOG_LEVELS, rt as isExitCode, s as LogLevel, st as nodeProcess, t as ConsoleLoggerOptions, tt as UncaughtOrigin, u as TraceIdsSource, ut as Operation, v as Controller, w as Gate, x as Dependency, y as CooperativeFloor, z as heartbeatDetection } from "./logger-BN2BfPgU.js";
|
|
5
|
+
import { A as DurationHistogram, C as HealthVerdict, D as CheckFn, E as StartOptions, F as Outcome, I as Result, M as Episode, N as HealthMetrics, O as CheckMetrics, P as redact, S as Health, T as ProbeKind, _ as RequestFn, a as PhaseContext, b as RequestWork, c as STAGES, d as TransportImpl, f as UncaughtOptions, g as RequestEvent, h as RequestEnd, i as LifecycleState, j as EPISODES_KEPT, k as DURATION_FRACTIONS, l as ShutdownOptions, m as stageRank, n as HealthServer, o as PhaseWork, p as cooperativeAbortAt, r as Lifecycle, s as RunOptions, t as DependencyHandle, u as Stage, v as RequestOptions, w as ProbeAnswer, x as CheckVerdict, y as RequestStream } from "./lifecycle-Br0jAjTk.js";
|
|
6
|
+
import { a as WatchdogSpec, c as Profile, d as kubernetes, f as localDev, i as Watchdog, l as daemon, n as ServiceBuilder, o as watchdog, r as service, s as PodTiming, t as ControllerBuilder, u as ephemeral } from "./builder-DQj3NNNc.js";
|
|
7
7
|
import { Heartbeat, HeartbeatOptions, detectionTime, heartbeat } from "./heartbeat.js";
|
|
8
8
|
import { C as symbolsOf, S as inequalities, _ as TimerMarks, a as O16, b as compression, c as Change, d as Evaluated, f as Inequality, g as TimerMark, h as Term, i as O10, l as Compressed, m as Side, n as O04, o as Binding, p as Rule, r as O09, s as Bound, t as DRAIN_RULES, u as Compression, v as Verdict, w as verdictOf, x as evaluate, y as compress } from "./rules-BBRopO1e.js";
|
|
9
9
|
import { a as TakeRequest, i as MemoryStore, n as LimiterStore, o as keyedLimiter, r as LocalLimiter, s as memoryStore, t as KeyedLimiter } from "./store-1CsNoJ8O.js";
|
|
10
10
|
import { a as limiterStateOf, i as limiterMachine, n as SLIDING_WINDOW_MACHINE, r as TOKEN_BUCKET_MACHINE, t as LimiterState } from "./limiter-D1aluA0V.js";
|
|
11
|
-
import { a as JobSource, c as QueueKnobs, d as queueDrain, f as redeliverOnce, i as JobSettle, l as RedeliveryPolicy, n as JobContext, o as QueueDrain, p as UnitRequest, r as JobFailure, s as QueueDrainOptions, t as JobAction, u as RequeueCause } from "./queue-
|
|
11
|
+
import { a as JobSource, c as QueueKnobs, d as queueDrain, f as redeliverOnce, i as JobSettle, l as RedeliveryPolicy, n as JobContext, o as QueueDrain, p as UnitRequest, r as JobFailure, s as QueueDrainOptions, t as JobAction, u as RequeueCause } from "./queue-fIkOXKVG.js";
|
|
12
12
|
import { Extent, Quantity } from "@mark1russell7/quantity";
|
|
13
13
|
import { replay } from "@mark1russell7/algebra/replay";
|
|
14
14
|
import { Machine } from "@mark1russell7/algebra";
|
|
@@ -422,5 +422,5 @@ export declare const drainMachine: (description: ServiceDescription) => Machine;
|
|
|
422
422
|
/** These are the static machines of the runtime, by the name that their events carry. */
|
|
423
423
|
export declare const MACHINES: Readonly<Record<Exclude<MachineName, "drain" | "client">, Machine>>;
|
|
424
424
|
//#endregion
|
|
425
|
-
export { type Allowed, type Backoff, type Binding, type Bound, type Cancel, type CapacityRefused, type Change, type Check, type CheckFn, type CheckMetrics, type CheckVerdict, type Claim, type Clock, type Compressed, type Compression, type ConsoleLoggerOptions, type ConsoleTarget, type Controller, type ControllerBuilder, type CooperativeFloor, type Coupling, DRAIN_RULES, DURATION_FRACTIONS, type Decision, type DelayBand, type Dependency, type DependencyHandle, type DurationHistogram, EPISODES_KEPT, EXIT_SIGNALS, type EmbeddedProcess, type Episode, type Epochs, type Evaluated, type ExitCodes, type ExitSignal, type ExitTrigger, FORMAT, type FailsBy, type Finding, type Gate, type Health, type HealthMetrics, type HealthServer, type HealthVerdict, type Heartbeat, type HeartbeatOptions, type HostStream, type Idempotency, type IdentityType, type Inequality, type IterationContext, type Jitter, type JobAction, type JobContext, type JobFailure, type JobSettle, type JobSource, type KeyState, type KeyedLimiter, LOG_LEVELS, type Lifecycle, type LifecycleEvent, type LifecycleState, type LimitPolicy, type LimitRule, type Limiter, type LimiterEviction, type LimiterSpec, type LimiterState, type LimiterStore, type LimiterStoreSpec, type LocalLimiter, type LogEntry, type LogFields, type LogFormat, type LogLevel, type Logger, type MachineName, type MemoryStore, type MessageShape, type MessageTrigger, O04, O09, O10, O16, type Operation, type OperationOf, type Outcome, PROCESS_TRIGGERS, type Phase, type PhaseContext, type PhaseWork, type PlatformClockOptions, type PodTiming, type Poll, type ProbeAnswer, type ProbeKind, type ProcessHost, type ProcessPort, type ProcessTrigger, type Profile, type ProgressMarks, type QueueDrain, type QueueDrainOptions, type QueueKnobs, type Recorder, type RedeliveryPolicy, type RefusalCause, type Refused, type RepeatSignal, type RequestEnd, type RequestEvent, type RequestFn, type RequestOptions, type RequestStream, type RequestWork, type RequeueCause, type Result, type Retrier, type RetrierOptions, type RetryOptions, type RoutePattern, type RouteRequest, type Rule, type RunOptions, SLIDING_WINDOW_MACHINE, STAGES, type Scenario, type ScenarioValue, type ScopedChange, type ServiceBuilder, type ServiceDescription, type ShutdownOptions, type Side, type SlidingWindow, type Span, type Stage, type StartOptions, type Statistic, type Step, type Stop, type StopWay, type StoreFailure, TOKEN_BUCKET_MACHINE, type TakeRequest, type TakeStep, type Term, type TimerMark, type TimerMarks, type Timing, type TokenBucket, type Transport, type TransportImpl, UNCAUGHT_ORIGINS, type UncaughtOptions, type UncaughtOrigin, type UnitRequest, type Verdict, type WaitCause, type WaitRefused, type Watchdog, type WatchdogSpec, type WorkerKnobs, type WorkerLoop, type WorkerLoopOptions, asDebounce, asWindow, atLeast, backoffBand, backoffDelay, backoffProblems, capacityOf, compress, compression, consoleLogger, cooperativeAbortAt, daemon, decide, detectionTime, embeddedProcess, ephemeral, evaluate, failSpan, freeAt, heartbeat, heartbeatDetection, idleSpan, inequalities, isExitCode, isExitSignal, isMessageShape, keyedLimiter, kubernetes, limitRule, limiterMachine, limiterProblems, limiterStateOf, localDev, logEvents, longestRetryAfter, matchesMessage, mayReissue, memoryStore, nodeProcess, overCapacity, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redact, redeliverOnce, replay, retryAfterSeconds, service, stageRank, symbolsOf, unitsOf, verdictOf, watchdog };
|
|
425
|
+
export { type Allowed, type Backoff, type Binding, type Bound, type Cancel, type CapacityRefused, type Change, type Check, type CheckFn, type CheckMetrics, type CheckVerdict, type Claim, type Clock, type Compressed, type Compression, type ConsoleLoggerOptions, type ConsoleTarget, type Controller, type ControllerBuilder, type CooperativeFloor, type Coupling, DRAIN_RULES, DURATION_FRACTIONS, type Decision, type DelayBand, type Dependency, type DependencyHandle, type DurationHistogram, EPISODES_KEPT, EXIT_SIGNALS, type EmbeddedProcess, type Episode, type Epochs, type Evaluated, type ExitCodes, type ExitSignal, type ExitTrigger, FORMAT, type FailsBy, type Finding, type Gate, type Health, type HealthMetrics, type HealthServer, type HealthVerdict, type Heartbeat, type HeartbeatOptions, type HostStream, type Idempotency, type IdentityType, type Inequality, type IterationContext, type Jitter, type JobAction, type JobContext, type JobFailure, type JobSettle, type JobSource, type KeyState, type KeyedLimiter, LOG_LEVELS, type Lifecycle, type LifecycleEvent, type LifecycleState, type LimitPolicy, type LimitRule, type Limiter, type LimiterEviction, type LimiterSpec, type LimiterState, type LimiterStore, type LimiterStoreSpec, type LocalLimiter, type LogEntry, type LogFields, type LogFormat, type LogLevel, type Logger, type MachineName, type MemoryStore, type MessageShape, type MessageTrigger, O04, O09, O10, O16, type Operation, type OperationOf, type Outcome, PROCESS_TRIGGERS, type Phase, type PhaseContext, type PhaseWork, type PlatformClockOptions, type PodTiming, type Poll, type ProbeAnswer, type ProbeKind, type ProcessHost, type ProcessPort, type ProcessTrigger, type Profile, type ProgressMarks, type QueueDrain, type QueueDrainOptions, type QueueKnobs, type Recorder, type RedeliveryPolicy, type RefusalCause, type Refused, type RepeatSignal, type RequestEnd, type RequestEvent, type RequestFn, type RequestOptions, type RequestStream, type RequestWork, type RequeueCause, type Result, type Retrier, type RetrierOptions, type RetryOptions, type RoutePattern, type RouteRequest, type Rule, type RunOptions, SLIDING_WINDOW_MACHINE, STAGES, type Scenario, type ScenarioValue, type ScopedChange, type ServiceBuilder, type ServiceDescription, type ShutdownOptions, type Side, type SlidingWindow, type Span, type Stage, type StartOptions, type Statistic, type Step, type Stop, type StopWay, type StoreFailure, TOKEN_BUCKET_MACHINE, type TakeRequest, type TakeStep, type Term, type TimerMark, type TimerMarks, type Timing, type TokenBucket, type TraceIds, type TraceIdsSource, type Transport, type TransportImpl, UNCAUGHT_ORIGINS, type UncaughtOptions, type UncaughtOrigin, type UnitRequest, type Verdict, type WaitCause, type WaitRefused, type Watchdog, type WatchdogSpec, type WorkerKnobs, type WorkerLoop, type WorkerLoopOptions, asDebounce, asWindow, atLeast, backoffBand, backoffDelay, backoffProblems, capacityOf, compress, compression, consoleLogger, cooperativeAbortAt, daemon, decide, detectionTime, embeddedProcess, ephemeral, evaluate, failSpan, freeAt, heartbeat, heartbeatDetection, idleSpan, inequalities, isExitCode, isExitSignal, isMessageShape, keyedLimiter, kubernetes, limitRule, limiterMachine, limiterProblems, limiterStateOf, localDev, logEvents, longestRetryAfter, matchesMessage, mayReissue, memoryStore, nodeProcess, overCapacity, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redact, redeliverOnce, replay, retryAfterSeconds, service, stageRank, symbolsOf, unitsOf, verdictOf, watchdog };
|
|
426
426
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.js
CHANGED
|
@@ -623,6 +623,16 @@ const LOG_LEVELS = [
|
|
|
623
623
|
];
|
|
624
624
|
/** This function tells if `level` is at `least` or more severe. */
|
|
625
625
|
const atLeast = (level, least) => LOG_LEVELS.indexOf(level) >= LOG_LEVELS.indexOf(least);
|
|
626
|
+
/** This function gives the fields with the trace ids of the source added. A field of the entry stays. */
|
|
627
|
+
const withTraceIds = (fields, source) => {
|
|
628
|
+
const ids = source();
|
|
629
|
+
if (ids === void 0) return fields;
|
|
630
|
+
return {
|
|
631
|
+
trace_id: ids.trace_id,
|
|
632
|
+
span_id: ids.span_id,
|
|
633
|
+
...fields
|
|
634
|
+
};
|
|
635
|
+
};
|
|
626
636
|
/** This function gives a value of a field that JSON can write: an error as its name, message and stack, and a bigint as text. */
|
|
627
637
|
const jsonValue = (_key, value) => {
|
|
628
638
|
if (typeof value === "bigint") return value.toString();
|
|
@@ -661,9 +671,11 @@ const jsonLine = (level, message, fields) => {
|
|
|
661
671
|
const consoleLogger = (options = {}) => {
|
|
662
672
|
const least = options.level ?? "info";
|
|
663
673
|
const format = options.format ?? "text";
|
|
674
|
+
const source = options.traceIds;
|
|
664
675
|
if (format !== "text" && format !== "json") throw new Error(`the log format ${JSON.stringify(format)} is not "text" or "json"`);
|
|
665
|
-
return { log(level, message,
|
|
676
|
+
return { log(level, message, entryFields) {
|
|
666
677
|
if (!atLeast(level, least)) return;
|
|
678
|
+
const fields = source === void 0 ? entryFields : withTraceIds(entryFields, source);
|
|
667
679
|
const target = options.console ?? globalThis.console;
|
|
668
680
|
if (format === "json") target[level](jsonLine(level, message, fields));
|
|
669
681
|
else if (Object.keys(fields).length === 0) target[level](message);
|