@tahminator/sapling 2.1.0-beta.39c06f1e → 2.1.0-beta.419f8e67

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/index.cjs CHANGED
@@ -409,7 +409,7 @@ let HealthRegistrar = class HealthRegistrar {
409
409
  /**
410
410
  * Add a health check.
411
411
  *
412
- * Health checks will be used to determine whether service can service traffic or not (a.k.a `liveness`).
412
+ * Health checks will be used to determine whether service can serve traffic or not (a.k.a `liveness`).
413
413
  */
414
414
  add(healthCheck) {
415
415
  this._checks.push(healthCheck);
@@ -421,7 +421,16 @@ let HealthRegistrar = class HealthRegistrar {
421
421
  _markReady() {
422
422
  this._ready = true;
423
423
  }
424
- async check() {
424
+ /**
425
+ * @internal
426
+ */
427
+ async ready() {
428
+ return this._ready;
429
+ }
430
+ /**
431
+ * @internal
432
+ */
433
+ async live() {
425
434
  if (!this._ready) return false;
426
435
  return (await Promise.all(this._checks.map((c) => c()))).every((c) => c === true);
427
436
  }
@@ -1213,11 +1222,11 @@ let DefaultHealthMiddleware = class DefaultHealthMiddleware {
1213
1222
  this.healthRegistrar = healthRegistrar;
1214
1223
  }
1215
1224
  async readiness(_request, _response, _next) {
1216
- const up = await this.healthRegistrar.check();
1225
+ const up = await this.healthRegistrar.ready();
1217
1226
  return ResponseEntity.ok().body({ up });
1218
1227
  }
1219
1228
  async liveness(_request, _response, _next) {
1220
- const up = await this.healthRegistrar.check();
1229
+ const up = await this.healthRegistrar.live();
1221
1230
  return ResponseEntity.ok().body({ up });
1222
1231
  }
1223
1232
  };
package/dist/index.d.cts CHANGED
@@ -1123,7 +1123,7 @@ declare class HealthRegistrar {
1123
1123
  /**
1124
1124
  * Add a health check.
1125
1125
  *
1126
- * Health checks will be used to determine whether service can service traffic or not (a.k.a `liveness`).
1126
+ * Health checks will be used to determine whether service can serve traffic or not (a.k.a `liveness`).
1127
1127
  */
1128
1128
  add(healthCheck: HealthCheck): void;
1129
1129
  /**
@@ -1131,7 +1131,14 @@ declare class HealthRegistrar {
1131
1131
  * checks have been registered and server is, at the very least, alive.
1132
1132
  */
1133
1133
  _markReady(): void;
1134
- check(): Promise<boolean>;
1134
+ /**
1135
+ * @internal
1136
+ */
1137
+ ready(): Promise<boolean>;
1138
+ /**
1139
+ * @internal
1140
+ */
1141
+ live(): Promise<boolean>;
1135
1142
  }
1136
1143
  //#endregion
1137
1144
  //#region src/middleware/default/health/index.d.ts
package/dist/index.d.mts CHANGED
@@ -1123,7 +1123,7 @@ declare class HealthRegistrar {
1123
1123
  /**
1124
1124
  * Add a health check.
1125
1125
  *
1126
- * Health checks will be used to determine whether service can service traffic or not (a.k.a `liveness`).
1126
+ * Health checks will be used to determine whether service can serve traffic or not (a.k.a `liveness`).
1127
1127
  */
1128
1128
  add(healthCheck: HealthCheck): void;
1129
1129
  /**
@@ -1131,7 +1131,14 @@ declare class HealthRegistrar {
1131
1131
  * checks have been registered and server is, at the very least, alive.
1132
1132
  */
1133
1133
  _markReady(): void;
1134
- check(): Promise<boolean>;
1134
+ /**
1135
+ * @internal
1136
+ */
1137
+ ready(): Promise<boolean>;
1138
+ /**
1139
+ * @internal
1140
+ */
1141
+ live(): Promise<boolean>;
1135
1142
  }
1136
1143
  //#endregion
1137
1144
  //#region src/middleware/default/health/index.d.ts
package/dist/index.mjs CHANGED
@@ -384,7 +384,7 @@ let HealthRegistrar = class HealthRegistrar {
384
384
  /**
385
385
  * Add a health check.
386
386
  *
387
- * Health checks will be used to determine whether service can service traffic or not (a.k.a `liveness`).
387
+ * Health checks will be used to determine whether service can serve traffic or not (a.k.a `liveness`).
388
388
  */
389
389
  add(healthCheck) {
390
390
  this._checks.push(healthCheck);
@@ -396,7 +396,16 @@ let HealthRegistrar = class HealthRegistrar {
396
396
  _markReady() {
397
397
  this._ready = true;
398
398
  }
399
- async check() {
399
+ /**
400
+ * @internal
401
+ */
402
+ async ready() {
403
+ return this._ready;
404
+ }
405
+ /**
406
+ * @internal
407
+ */
408
+ async live() {
400
409
  if (!this._ready) return false;
401
410
  return (await Promise.all(this._checks.map((c) => c()))).every((c) => c === true);
402
411
  }
@@ -1188,11 +1197,11 @@ let DefaultHealthMiddleware = class DefaultHealthMiddleware {
1188
1197
  this.healthRegistrar = healthRegistrar;
1189
1198
  }
1190
1199
  async readiness(_request, _response, _next) {
1191
- const up = await this.healthRegistrar.check();
1200
+ const up = await this.healthRegistrar.ready();
1192
1201
  return ResponseEntity.ok().body({ up });
1193
1202
  }
1194
1203
  async liveness(_request, _response, _next) {
1195
- const up = await this.healthRegistrar.check();
1204
+ const up = await this.healthRegistrar.live();
1196
1205
  return ResponseEntity.ok().body({ up });
1197
1206
  }
1198
1207
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tahminator/sapling",
3
- "version": "2.1.0-beta.39c06f1e",
3
+ "version": "2.1.0-beta.419f8e67",
4
4
  "author": "Tahmid Ahmed",
5
5
  "description": "A library to help you write cleaner Express.js code",
6
6
  "repository": {