@causa/runtime-google 0.32.0 → 0.32.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.
@@ -1,16 +1,11 @@
1
1
  import { BaseHealthIndicatorService } from '@causa/runtime/nestjs';
2
2
  import { HealthIndicatorResult } from '@nestjs/terminus';
3
3
  import { Firestore } from 'firebase-admin/firestore';
4
- import { FirestoreAdminClient } from '../firebase/index.js';
5
4
  /**
6
5
  * A service testing the availability of the Firestore service.
7
6
  */
8
7
  export declare class FirestoreHealthIndicator extends BaseHealthIndicatorService {
9
- private readonly admin;
10
- /**
11
- * The ID of the database used by Firestore.
12
- */
13
- private readonly databaseId;
14
- constructor(admin: FirestoreAdminClient, firestore: Firestore);
8
+ private readonly firestore;
9
+ constructor(firestore: Firestore);
15
10
  check(): Promise<HealthIndicatorResult>;
16
11
  }
@@ -11,7 +11,6 @@ import { BaseHealthIndicatorService } from '@causa/runtime/nestjs';
11
11
  import { Injectable } from '@nestjs/common';
12
12
  import { HealthCheckError } from '@nestjs/terminus';
13
13
  import { Firestore } from 'firebase-admin/firestore';
14
- import { FirestoreAdminClient } from '../firebase/index.js';
15
14
  /**
16
15
  * The key used to identify the Firestore health indicator.
17
16
  */
@@ -20,25 +19,18 @@ const FIRESTORE_HEALTH_KEY = 'google.firestore';
20
19
  * A service testing the availability of the Firestore service.
21
20
  */
22
21
  let FirestoreHealthIndicator = class FirestoreHealthIndicator extends BaseHealthIndicatorService {
23
- admin;
24
- /**
25
- * The ID of the database used by Firestore.
26
- */
27
- databaseId;
28
- constructor(admin, firestore) {
22
+ firestore;
23
+ constructor(firestore) {
29
24
  super();
30
- this.admin = admin;
31
- this.databaseId = firestore.databaseId;
25
+ this.firestore = firestore;
32
26
  }
33
27
  async check() {
34
28
  try {
35
- const projectId = await this.admin.getProjectId();
36
- const name = this.admin.databasePath(projectId, this.databaseId);
37
- await this.admin.getDatabase({ name });
29
+ await this.firestore.listCollections();
38
30
  return this.getStatus(FIRESTORE_HEALTH_KEY, true);
39
31
  }
40
32
  catch (error) {
41
- throw new HealthCheckError('Failed to check health by getting Firestore database.', this.getStatus(FIRESTORE_HEALTH_KEY, false, {
33
+ throw new HealthCheckError('Failed to check health by listing Firestore collections.', this.getStatus(FIRESTORE_HEALTH_KEY, false, {
42
34
  error: error.message,
43
35
  }));
44
36
  }
@@ -46,7 +38,6 @@ let FirestoreHealthIndicator = class FirestoreHealthIndicator extends BaseHealth
46
38
  };
47
39
  FirestoreHealthIndicator = __decorate([
48
40
  Injectable(),
49
- __metadata("design:paramtypes", [FirestoreAdminClient,
50
- Firestore])
41
+ __metadata("design:paramtypes", [Firestore])
51
42
  ], FirestoreHealthIndicator);
52
43
  export { FirestoreHealthIndicator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@causa/runtime-google",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "description": "An extension to the Causa runtime SDK (`@causa/runtime`), providing Google-specific features.",
5
5
  "repository": "github:causa-io/runtime-typescript-google",
6
6
  "license": "ISC",