@capacitor-firebase/functions 8.2.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 +87 -4
- package/package.json +13 -7
|
@@ -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
|
|
|
@@ -25,7 +30,7 @@ You can use our **AI-Assisted Setup** to install the plugin.
|
|
|
25
30
|
Add the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:
|
|
26
31
|
|
|
27
32
|
```bash
|
|
28
|
-
npx skills add capawesome-team/skills
|
|
33
|
+
npx skills add capawesome-team/skills --skill capacitor-plugins
|
|
29
34
|
```
|
|
30
35
|
|
|
31
36
|
Then use the following prompt:
|
|
@@ -53,6 +58,30 @@ If needed, you can define the following project variable in your app’s `variab
|
|
|
53
58
|
|
|
54
59
|
This can be useful if you encounter dependency conflicts with other plugins in your project.
|
|
55
60
|
|
|
61
|
+
### iOS
|
|
62
|
+
|
|
63
|
+
#### Swift Package Manager
|
|
64
|
+
|
|
65
|
+
Add the following to your `capacitor.config.json` (or `capacitor.config.ts`) to avoid a [SwiftPM package identity collision](https://github.com/capawesome-team/capacitor-firebase/issues/959):
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"experimental": {
|
|
70
|
+
"ios": {
|
|
71
|
+
"spm": {
|
|
72
|
+
"packageOptions": {
|
|
73
|
+
"@capacitor-firebase/functions": {
|
|
74
|
+
"symlink": true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Attention**: SPM `packageOptions` support requires Capacitor CLI **8.4.0+**.
|
|
84
|
+
|
|
56
85
|
## Configuration
|
|
57
86
|
|
|
58
87
|
No configuration required for this plugin.
|
|
@@ -63,6 +92,12 @@ A working example can be found here: [robingenz/capacitor-firebase-plugin-demo](
|
|
|
63
92
|
|
|
64
93
|
## Usage
|
|
65
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
|
+
|
|
66
101
|
```typescript
|
|
67
102
|
import { FirebaseFunctions } from '@capacitor-firebase/functions';
|
|
68
103
|
|
|
@@ -81,6 +116,14 @@ const callByName = async () => {
|
|
|
81
116
|
});
|
|
82
117
|
return data;
|
|
83
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';
|
|
84
127
|
|
|
85
128
|
const callByUrl = async () => {
|
|
86
129
|
const { data } = await FirebaseFunctions.callByUrl({
|
|
@@ -97,6 +140,14 @@ const callByUrl = async () => {
|
|
|
97
140
|
});
|
|
98
141
|
return data;
|
|
99
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';
|
|
100
151
|
|
|
101
152
|
const useEmulator = async () => {
|
|
102
153
|
await FirebaseFunctions.useEmulator({
|
|
@@ -234,6 +285,38 @@ On Android, the cleartext traffic must be allowed. On the Capacitor configuratio
|
|
|
234
285
|
|
|
235
286
|
</docgen-api>
|
|
236
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
|
+
|
|
237
320
|
## Changelog
|
|
238
321
|
|
|
239
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,17 +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": "
|
|
70
|
-
"prettier-plugin-java": "2.6.7",
|
|
76
|
+
"prettier-plugin-java": "2.9.7",
|
|
71
77
|
"rimraf": "6.1.2",
|
|
72
|
-
"rollup": "4.
|
|
78
|
+
"rollup": "4.62.3",
|
|
73
79
|
"swiftlint": "2.0.0",
|
|
74
80
|
"typescript": "5.9.3"
|
|
75
81
|
},
|