@capacitor-firebase/functions 8.3.0 → 8.4.0
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/CapacitorFirebaseFunctions.podspec +1 -1
- package/README.md +62 -3
- package/package.json +13 -6
|
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '15.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'FirebaseFunctions', '~> 12.7
|
|
16
|
+
s.dependency 'FirebaseFunctions', '~> 12.7'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
s.static_framework = true
|
|
19
19
|
end
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Capacitor Firebase Cloud Functions Plugin
|
|
2
2
|
|
|
3
3
|
Unofficial Capacitor plugin for [Firebase Cloud Functions](https://firebase.google.com/docs/functions/).[^1]
|
|
4
4
|
|
|
@@ -8,9 +8,14 @@ Unofficial Capacitor plugin for [Firebase Cloud Functions](https://firebase.goog
|
|
|
8
8
|
</a>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Use Cases
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The Firebase Cloud Functions plugin is typically used to run backend logic from your Capacitor app without managing your own server, for example:
|
|
14
|
+
|
|
15
|
+
- **Serverless backend logic**: Call callable Cloud Functions by name to run trusted server-side code from your app.
|
|
16
|
+
- **Structured data exchange**: Pass strings, numbers, booleans, arrays, and objects to a function and process the returned result.
|
|
17
|
+
- **Custom domains and regions**: Call functions that are deployed in a specific region or hosted on a custom domain by their URL.
|
|
18
|
+
- **Local development**: Test your functions against the Cloud Functions emulator before deploying them to production.
|
|
14
19
|
|
|
15
20
|
## Compatibility
|
|
16
21
|
|
|
@@ -87,6 +92,12 @@ A working example can be found here: [robingenz/capacitor-firebase-plugin-demo](
|
|
|
87
92
|
|
|
88
93
|
## Usage
|
|
89
94
|
|
|
95
|
+
The following examples show how to call Cloud Functions by name or by URL and how to connect to the Cloud Functions emulator.
|
|
96
|
+
|
|
97
|
+
### Call a function by name
|
|
98
|
+
|
|
99
|
+
Call a callable Cloud Function by its name. You can pass strings, numbers, booleans, arrays, and objects as data and receive the result of the function in the `data` property. Use the `region` option if your function is not deployed in the default region:
|
|
100
|
+
|
|
90
101
|
```typescript
|
|
91
102
|
import { FirebaseFunctions } from '@capacitor-firebase/functions';
|
|
92
103
|
|
|
@@ -105,6 +116,14 @@ const callByName = async () => {
|
|
|
105
116
|
});
|
|
106
117
|
return data;
|
|
107
118
|
};
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Call a function by URL
|
|
122
|
+
|
|
123
|
+
If your callable function is hosted on a custom domain or you prefer to address it directly, call it by its URL:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
import { FirebaseFunctions } from '@capacitor-firebase/functions';
|
|
108
127
|
|
|
109
128
|
const callByUrl = async () => {
|
|
110
129
|
const { data } = await FirebaseFunctions.callByUrl({
|
|
@@ -121,6 +140,14 @@ const callByUrl = async () => {
|
|
|
121
140
|
});
|
|
122
141
|
return data;
|
|
123
142
|
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Use the Cloud Functions emulator
|
|
146
|
+
|
|
147
|
+
During development, you can instrument your app to talk to the local Cloud Functions emulator. When using an Android emulator device, `10.0.2.2` is the special IP address to connect to the `localhost` of the host computer. Note that on Android, the cleartext traffic must be allowed, which is not intended for use in production:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { FirebaseFunctions } from '@capacitor-firebase/functions';
|
|
124
151
|
|
|
125
152
|
const useEmulator = async () => {
|
|
126
153
|
await FirebaseFunctions.useEmulator({
|
|
@@ -258,6 +285,38 @@ On Android, the cleartext traffic must be allowed. On the Capacitor configuratio
|
|
|
258
285
|
|
|
259
286
|
</docgen-api>
|
|
260
287
|
|
|
288
|
+
## FAQ
|
|
289
|
+
|
|
290
|
+
### What is the difference between `callByName` and `callByUrl`?
|
|
291
|
+
|
|
292
|
+
The `callByName(...)` method calls a callable function by its name and, optionally, its region. The `callByUrl(...)` method calls a callable function by its full URL instead, which is useful if the function is hosted on a custom domain.
|
|
293
|
+
|
|
294
|
+
### What data types can I pass to a callable function?
|
|
295
|
+
|
|
296
|
+
You can pass strings, numbers, booleans, arrays, and nested objects as data to a callable function. The result of the function is returned in the `data` property of the call result.
|
|
297
|
+
|
|
298
|
+
### How do I test my functions locally?
|
|
299
|
+
|
|
300
|
+
Use the `useEmulator(...)` method to instrument your app to talk to the local Cloud Functions emulator, as shown in the [usage example](#use-the-cloud-functions-emulator) above. When testing on an Android emulator device, use `10.0.2.2` as the host to reach the `localhost` of the host computer. Keep in mind that on Android, the cleartext traffic must be allowed for this, which is not intended for use in production.
|
|
301
|
+
|
|
302
|
+
### Why do I get a SwiftPM package identity collision on iOS?
|
|
303
|
+
|
|
304
|
+
This is a known issue when using the plugin with Swift Package Manager. Add the `symlink` package option for `@capacitor-firebase/functions` to your Capacitor configuration as described in the [Installation](#installation) section. Note that SPM `packageOptions` support requires Capacitor CLI 8.4.0 or later.
|
|
305
|
+
|
|
306
|
+
### Can I use this plugin with Ionic, React, Vue or Angular?
|
|
307
|
+
|
|
308
|
+
Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.
|
|
309
|
+
|
|
310
|
+
## Related Plugins
|
|
311
|
+
|
|
312
|
+
- [Firebase Authentication](https://capawesome.io/docs/sdks/capacitor/firebase/authentication/): Sign in users with Firebase Authentication.
|
|
313
|
+
- [Firebase Cloud Firestore](https://capawesome.io/docs/sdks/capacitor/firebase/cloud-firestore/): Store and sync app data in Cloud Firestore.
|
|
314
|
+
- [Firebase Cloud Storage](https://capawesome.io/docs/sdks/capacitor/firebase/cloud-storage/): Upload and download files with Firebase Cloud Storage.
|
|
315
|
+
|
|
316
|
+
## Newsletter
|
|
317
|
+
|
|
318
|
+
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
|
|
319
|
+
|
|
261
320
|
## Changelog
|
|
262
321
|
|
|
263
322
|
See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/functions/CHANGELOG.md).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-firebase/functions",
|
|
3
|
-
"version": "8.
|
|
4
|
-
"description": "Capacitor plugin for Firebase Cloud Functions.",
|
|
3
|
+
"version": "8.4.0",
|
|
4
|
+
"description": "Capacitor plugin for Firebase Cloud Functions on Android, iOS, and Web.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
@@ -37,7 +37,14 @@
|
|
|
37
37
|
"keywords": [
|
|
38
38
|
"capacitor",
|
|
39
39
|
"plugin",
|
|
40
|
-
"native"
|
|
40
|
+
"native",
|
|
41
|
+
"capacitor-plugin",
|
|
42
|
+
"firebase",
|
|
43
|
+
"firebase functions",
|
|
44
|
+
"firebase cloud functions",
|
|
45
|
+
"cloud functions",
|
|
46
|
+
"callable functions",
|
|
47
|
+
"serverless"
|
|
41
48
|
],
|
|
42
49
|
"scripts": {
|
|
43
50
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
@@ -59,16 +66,16 @@
|
|
|
59
66
|
},
|
|
60
67
|
"devDependencies": {
|
|
61
68
|
"@capacitor/android": "8.0.0",
|
|
62
|
-
"@capacitor/cli": "8.
|
|
69
|
+
"@capacitor/cli": "8.4.2",
|
|
63
70
|
"@capacitor/core": "8.0.0",
|
|
64
71
|
"@capacitor/docgen": "0.3.1",
|
|
65
72
|
"@capacitor/ios": "8.0.0",
|
|
66
73
|
"@ionic/eslint-config": "0.4.0",
|
|
67
74
|
"eslint": "8.57.0",
|
|
68
75
|
"firebase": "11.2.0",
|
|
69
|
-
"prettier-plugin-java": "2.
|
|
76
|
+
"prettier-plugin-java": "2.9.7",
|
|
70
77
|
"rimraf": "6.1.2",
|
|
71
|
-
"rollup": "4.
|
|
78
|
+
"rollup": "4.62.3",
|
|
72
79
|
"swiftlint": "2.0.0",
|
|
73
80
|
"typescript": "5.9.3"
|
|
74
81
|
},
|