@shisyamo4131/air-firebase-v2-client-adapter 2.1.0 → 2.1.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/index.js +6 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* アプリ側で使用する FireModel のアダプターです。
|
|
3
3
|
* FireModel に Firestore に対する CRUD 機能を注入します。
|
|
4
4
|
*
|
|
5
|
+
* @update 2025-12-30 - Modified constructor to accept Functions instance.
|
|
5
6
|
* @update 2025-12-29 - Added GeoPoint import and httpsCallable import.
|
|
6
7
|
*/
|
|
7
8
|
import {
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
GeoPoint, // 2025-12-29 added
|
|
21
22
|
} from "firebase/firestore";
|
|
22
23
|
import { getAuth } from "firebase/auth";
|
|
23
|
-
import {
|
|
24
|
+
import { httpsCallable } from "firebase/functions"; // 2025-12-29 added
|
|
24
25
|
import { ClientAdapterError, ERRORS } from "./error.js";
|
|
25
26
|
|
|
26
27
|
/*****************************************************************************
|
|
@@ -35,10 +36,10 @@ class ClientAdapter {
|
|
|
35
36
|
static GeoPoint = null; // 2025-12-29 added
|
|
36
37
|
static httpsCallable = null; // 2025-12-29 added
|
|
37
38
|
|
|
38
|
-
constructor() {
|
|
39
|
+
constructor(functions = null) {
|
|
39
40
|
ClientAdapter.firestore = getFirestore();
|
|
40
41
|
ClientAdapter.auth = getAuth();
|
|
41
|
-
ClientAdapter.functions =
|
|
42
|
+
ClientAdapter.functions = functions; // 2025-12-30 changed from getFunctions();
|
|
42
43
|
ClientAdapter.GeoPoint = GeoPoint; // 2025-12-29 added
|
|
43
44
|
ClientAdapter.httpsCallable = httpsCallable; // 2025-12-29 added
|
|
44
45
|
}
|
|
@@ -80,13 +81,10 @@ class ClientAdapter {
|
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* Returns the Functions instance.
|
|
83
|
-
* - 2025-12-
|
|
84
|
+
* - 2025-12-30 modified to return null if not initialized (instead of throwing error)
|
|
84
85
|
*/
|
|
85
86
|
get functions() {
|
|
86
|
-
|
|
87
|
-
throw new ClientAdapterError(ERRORS.SYSTEM_FUNCTIONS_NOT_INITIALIZED);
|
|
88
|
-
}
|
|
89
|
-
return ClientAdapter.functions;
|
|
87
|
+
return ClientAdapter.functions; // ← null を返すように変更(エラーをスローしない)
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
/**
|