@mark1russell7/service 0.6.6 → 0.6.7
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 +4 -0
- package/build/index.d.ts +19 -1
- package/build/index.js +43 -1
- package/build/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -811,6 +811,10 @@ For the Redis client, the application also installs `ioredis@6`. For the Postgre
|
|
|
811
811
|
|
|
812
812
|
For the gRPC client, it installs `@grpc/grpc-js@1`. The HTTP client needs no other package.
|
|
813
813
|
|
|
814
|
+
### One copy of service
|
|
815
|
+
|
|
816
|
+
Service keeps state for some objects by identity, for example the late holds of each lifecycle and the mark of each HTTP answer. Each copy of the package has its own state. Thus a lifecycle of one copy and a transport of another copy lose that state with no error. `IDENTITY_TYPES` names each exported type that holds or reaches such a value. A package whose public API takes or gives one of these types declares service as a peer dependency. A test calculates the list from the sources, thus the list stays current.
|
|
817
|
+
|
|
814
818
|
The package uses [`@mark1russell7/quantity`](https://www.npmjs.com/package/@mark1russell7/quantity) for each amount. No entry of the service loads `zod` at run time, thus `zod` is an optional peer dependency. An application that validates amounts with the schemas of `quantity` installs `zod`.
|
|
815
819
|
|
|
816
820
|
## Example
|
package/build/index.d.ts
CHANGED
|
@@ -213,6 +213,24 @@ export declare const STOP_RULE = "stop";
|
|
|
213
213
|
*/
|
|
214
214
|
export declare const lintStop: (svc: ServiceDescription, scenario: Scenario, rules: readonly Rule[], way: StopWay) => Finding[];
|
|
215
215
|
//#endregion
|
|
216
|
+
//#region src/identity.d.ts
|
|
217
|
+
/**
|
|
218
|
+
* The exported type names that hold or reach a value that service knows by identity. A package
|
|
219
|
+
* whose public API takes or gives a value of one of these types has service as a peer dependency.
|
|
220
|
+
* A plain dependency is not sufficient. Then the package and its caller use one copy of service.
|
|
221
|
+
*
|
|
222
|
+
* The roots are `Lifecycle` and `RequestStream`, the keys of the maps, and `TransportImpl` and
|
|
223
|
+
* `RequestHandler`, whose values write to the maps of their own copy. The list is each exported type
|
|
224
|
+
* that names a root, or names a type of the list, in its declaration. A type can be on the list
|
|
225
|
+
* although its own use crosses copies safely: for that type, a peer is the safe choice.
|
|
226
|
+
*
|
|
227
|
+
* `identity.test.ts` calculates this list from the sources and from the maps, thus the list stays
|
|
228
|
+
* current.
|
|
229
|
+
*/
|
|
230
|
+
export declare const IDENTITY_TYPES: readonly ["Client", "GrpcClient", "HttpClient", "HttpTransport", "IterationContext", "JobContext", "Lifecycle", "MongoClient", "MountContext", "PgClient", "QueueDrain", "QueueDrainOptions", "RabbitClient", "RedisClient", "RedisSender", "RequestHandler", "RequestStream", "ServiceBuilder", "SubjectFactory", "TransportImpl", "TransportSubject", "UpgradeHandler", "WorkerLoop", "WorkerLoopOptions", "WsClient"];
|
|
231
|
+
/** A name of `IDENTITY_TYPES`. */
|
|
232
|
+
type IdentityType = (typeof IDENTITY_TYPES)[number];
|
|
233
|
+
//#endregion
|
|
216
234
|
//#region src/retrier.d.ts
|
|
217
235
|
/** These options make a retrier: a backoff policy, the clock of its timers, and the signal that cancels it. */
|
|
218
236
|
interface RetrierOptions extends Backoff {
|
|
@@ -404,5 +422,5 @@ export declare const drainMachine: (description: ServiceDescription) => Machine;
|
|
|
404
422
|
/** These are the static machines of the runtime, by the name that their events carry. */
|
|
405
423
|
export declare const MACHINES: Readonly<Record<Exclude<MachineName, "drain" | "client">, Machine>>;
|
|
406
424
|
//#endregion
|
|
407
|
-
export { type Allowed, type Backoff, type Binding, type Bound, type Cancel, 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 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 Watchdog, type WatchdogSpec, type WorkerKnobs, type WorkerLoop, type WorkerLoopOptions, asDebounce, asWindow, atLeast, backoffBand, backoffDelay, backoffProblems, 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, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redact, redeliverOnce, replay, retryAfterSeconds, service, stageRank, symbolsOf, verdictOf, watchdog };
|
|
425
|
+
export { type Allowed, type Backoff, type Binding, type Bound, type Cancel, 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 Watchdog, type WatchdogSpec, type WorkerKnobs, type WorkerLoop, type WorkerLoopOptions, asDebounce, asWindow, atLeast, backoffBand, backoffDelay, backoffProblems, 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, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redact, redeliverOnce, replay, retryAfterSeconds, service, stageRank, symbolsOf, verdictOf, watchdog };
|
|
408
426
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.js
CHANGED
|
@@ -2519,6 +2519,48 @@ const lintStop = (svc, scenario, rules, way) => {
|
|
|
2519
2519
|
}];
|
|
2520
2520
|
};
|
|
2521
2521
|
//#endregion
|
|
2522
|
+
//#region src/identity.ts
|
|
2523
|
+
/**
|
|
2524
|
+
* The exported type names that hold or reach a value that service knows by identity. A package
|
|
2525
|
+
* whose public API takes or gives a value of one of these types has service as a peer dependency.
|
|
2526
|
+
* A plain dependency is not sufficient. Then the package and its caller use one copy of service.
|
|
2527
|
+
*
|
|
2528
|
+
* The roots are `Lifecycle` and `RequestStream`, the keys of the maps, and `TransportImpl` and
|
|
2529
|
+
* `RequestHandler`, whose values write to the maps of their own copy. The list is each exported type
|
|
2530
|
+
* that names a root, or names a type of the list, in its declaration. A type can be on the list
|
|
2531
|
+
* although its own use crosses copies safely: for that type, a peer is the safe choice.
|
|
2532
|
+
*
|
|
2533
|
+
* `identity.test.ts` calculates this list from the sources and from the maps, thus the list stays
|
|
2534
|
+
* current.
|
|
2535
|
+
*/
|
|
2536
|
+
const IDENTITY_TYPES = [
|
|
2537
|
+
"Client",
|
|
2538
|
+
"GrpcClient",
|
|
2539
|
+
"HttpClient",
|
|
2540
|
+
"HttpTransport",
|
|
2541
|
+
"IterationContext",
|
|
2542
|
+
"JobContext",
|
|
2543
|
+
"Lifecycle",
|
|
2544
|
+
"MongoClient",
|
|
2545
|
+
"MountContext",
|
|
2546
|
+
"PgClient",
|
|
2547
|
+
"QueueDrain",
|
|
2548
|
+
"QueueDrainOptions",
|
|
2549
|
+
"RabbitClient",
|
|
2550
|
+
"RedisClient",
|
|
2551
|
+
"RedisSender",
|
|
2552
|
+
"RequestHandler",
|
|
2553
|
+
"RequestStream",
|
|
2554
|
+
"ServiceBuilder",
|
|
2555
|
+
"SubjectFactory",
|
|
2556
|
+
"TransportImpl",
|
|
2557
|
+
"TransportSubject",
|
|
2558
|
+
"UpgradeHandler",
|
|
2559
|
+
"WorkerLoop",
|
|
2560
|
+
"WorkerLoopOptions",
|
|
2561
|
+
"WsClient"
|
|
2562
|
+
];
|
|
2563
|
+
//#endregion
|
|
2522
2564
|
//#region src/profiles.ts
|
|
2523
2565
|
const s = (value) => ({
|
|
2524
2566
|
value,
|
|
@@ -3505,6 +3547,6 @@ const MACHINES = {
|
|
|
3505
3547
|
watchdog: WATCHDOG_MACHINE
|
|
3506
3548
|
};
|
|
3507
3549
|
//#endregion
|
|
3508
|
-
export { BOUND_RULES, CLOSE_BOUND_RULE, DECLARATION_RULE, DRAIN_RULES, DRAIN_RULE_IDS, DURATION_FRACTIONS, EPISODES_KEPT, EXIT_MACHINE, EXIT_SIGNALS, FORMAT, GATE_MACHINE, LATCH_MACHINE, LAW_STATISTIC, LIMITER_RULES, LOG_LEVELS, MACHINES, NAME_RULE, O04, O09, O10, O16, PLATFORM_MARKS, POLLER_MACHINE, PROCESS_TRIGGERS, PROGRESS_RULE, SERVICE_RULES, SLIDING_WINDOW_MACHINE, STAGES, STOPS, STOP_RULE, TOKEN_BUCKET_MACHINE, UNCAUGHT_ORIGINS, UNIT_BOUND_RULE, WATCHDOG_MACHINE, WINDOW_MACHINE, asDebounce, asWindow, atLeast, backoffBand, backoffDelay, backoffProblems, capKnob, compress, compression, compressionOf, consoleLogger, cooperativeAbortAt, daemon, decide, detectionTime, drainMachine, embeddedProcess, ephemeral, evaluate, failSpan, freeAt, heartbeat, heartbeatDetection, idleSpan, inequalities, isExitCode, isExitSignal, isMessageShape, keyedLimiter, kubernetes, limitRule, limiterMachine, limiterProblems, limiterStateOf, lint, lintStop, localDev, logEvents, longestRetryAfter, matchesMessage, mayReissue, memoryStore, nodeProcess, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redact, redeliverOnce, replay, retrier, retry, retryAfterDelay, retryAfterSeconds, service, serviceBindings, stageRank, symbolsOf, verdictOf, watchdog, workerLoop };
|
|
3550
|
+
export { BOUND_RULES, CLOSE_BOUND_RULE, DECLARATION_RULE, DRAIN_RULES, DRAIN_RULE_IDS, DURATION_FRACTIONS, EPISODES_KEPT, EXIT_MACHINE, EXIT_SIGNALS, FORMAT, GATE_MACHINE, IDENTITY_TYPES, LATCH_MACHINE, LAW_STATISTIC, LIMITER_RULES, LOG_LEVELS, MACHINES, NAME_RULE, O04, O09, O10, O16, PLATFORM_MARKS, POLLER_MACHINE, PROCESS_TRIGGERS, PROGRESS_RULE, SERVICE_RULES, SLIDING_WINDOW_MACHINE, STAGES, STOPS, STOP_RULE, TOKEN_BUCKET_MACHINE, UNCAUGHT_ORIGINS, UNIT_BOUND_RULE, WATCHDOG_MACHINE, WINDOW_MACHINE, asDebounce, asWindow, atLeast, backoffBand, backoffDelay, backoffProblems, capKnob, compress, compression, compressionOf, consoleLogger, cooperativeAbortAt, daemon, decide, detectionTime, drainMachine, embeddedProcess, ephemeral, evaluate, failSpan, freeAt, heartbeat, heartbeatDetection, idleSpan, inequalities, isExitCode, isExitSignal, isMessageShape, keyedLimiter, kubernetes, limitRule, limiterMachine, limiterProblems, limiterStateOf, lint, lintStop, localDev, logEvents, longestRetryAfter, matchesMessage, mayReissue, memoryStore, nodeProcess, platformClock, processPortOf, queueDrain, realClock, recoverSpan, redact, redeliverOnce, replay, retrier, retry, retryAfterDelay, retryAfterSeconds, service, serviceBindings, stageRank, symbolsOf, verdictOf, watchdog, workerLoop };
|
|
3509
3551
|
|
|
3510
3552
|
//# sourceMappingURL=index.js.map
|