vybekiit 0.7.4 → 0.7.7
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/bin.js +10483 -1704
- package/dist/global-skills/aws-cdk/SKILL.md +2 -1
- package/dist/global-skills/aws-cloudformation/SKILL.md +2 -1
- package/dist/global-skills/aws-serverless/SKILL.md +45 -44
- package/dist/global-skills/aws-serverless/assets/powertools-handler.py +2 -1
- package/dist/global-skills/aws-serverless/references/api-gateway.md +50 -470
- package/dist/global-skills/aws-serverless/references/architecture.md +47 -186
- package/dist/global-skills/aws-serverless/references/concurrency.md +44 -158
- package/dist/global-skills/aws-serverless/references/deployment.md +1 -1
- package/dist/global-skills/aws-serverless/references/event-sources.md +72 -391
- package/dist/global-skills/aws-serverless/references/lambda.md +69 -428
- package/dist/global-skills/aws-serverless/references/orchestration.md +65 -384
- package/dist/global-skills/aws-serverless/references/production.md +78 -415
- package/dist/global-skills/aws-serverless/references/troubleshooting.md +92 -619
- package/dist/global-skills/claimable-postgres/SKILL.md +60 -49
- package/dist/global-skills/design-my-data/SKILL.md +2 -0
- package/dist/global-skills/eas-app-stores/SKILL.md +8 -0
- package/dist/global-skills/eas-app-stores/references/play-store.md +2 -0
- package/dist/global-skills/eas-hosting/SKILL.md +8 -0
- package/dist/global-skills/eas-observe/SKILL.md +30 -8
- package/dist/global-skills/eas-observe/agents/openai.yaml +1 -1
- package/dist/global-skills/eas-observe/references/metrics.md +54 -3
- package/dist/global-skills/eas-observe/references/queries.md +78 -17
- package/dist/global-skills/eas-observe/references/setup.md +164 -5
- package/dist/global-skills/eas-observe/references/third-party.md +136 -0
- package/dist/global-skills/eas-simulator/SKILL.md +63 -11
- package/dist/global-skills/eas-simulator/references/controllers.md +21 -2
- package/dist/global-skills/eas-simulator/references/run-your-app.md +16 -11
- package/dist/global-skills/eas-simulator/references/troubleshooting.md +8 -5
- package/dist/global-skills/eas-update-insights/SKILL.md +8 -0
- package/dist/global-skills/eas-workflows/SKILL.md +15 -10
- package/dist/global-skills/eas-workflows/scripts/package.json +2 -7
- package/dist/global-skills/email-best-practices/.github/workflows/sync-skills.yml +30 -0
- package/dist/global-skills/email-best-practices/README.md +63 -0
- package/dist/global-skills/email-best-practices/references/accessibility.md +189 -0
- package/dist/global-skills/email-best-practices/references/compliance.md +125 -0
- package/dist/global-skills/email-best-practices/references/deliverability.md +121 -0
- package/dist/global-skills/email-best-practices/references/email-capture.md +129 -0
- package/dist/global-skills/email-best-practices/references/email-types.md +173 -0
- package/dist/global-skills/email-best-practices/references/list-management.md +157 -0
- package/dist/global-skills/email-best-practices/references/marketing-emails.md +115 -0
- package/dist/global-skills/email-best-practices/references/sending-reliability.md +155 -0
- package/dist/global-skills/email-best-practices/references/transactional-email-catalog.md +418 -0
- package/dist/global-skills/email-best-practices/references/transactional-emails.md +92 -0
- package/dist/global-skills/email-best-practices/references/webhooks-events.md +167 -0
- package/dist/global-skills/email-best-practices/tests/README.md +35 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/01-spam-deliverability.md +46 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/02-multi-region-compliance.md +48 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/03-retry-idempotency.md +36 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/04-webhook-bounce-handling.md +52 -0
- package/dist/global-skills/email-best-practices/tests/scenarios/05-new-saas-email-plan.md +51 -0
- package/dist/global-skills/expo-animation/LICENSE +21 -0
- package/dist/global-skills/expo-animation/RECIPES.md +385 -0
- package/dist/global-skills/expo-animation/SKILL.md +267 -0
- package/dist/global-skills/expo-animation/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-app-clip/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/SKILL.md +8 -0
- package/dist/global-skills/expo-brownfield/references/brownfield-isolated.md +53 -4
- package/dist/global-skills/expo-data-fetching/SKILL.md +8 -0
- package/dist/global-skills/expo-design-system/SKILL.md +356 -0
- package/dist/global-skills/expo-design-system/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-design-system/references/audit.md +185 -0
- package/dist/global-skills/expo-dev-client/SKILL.md +8 -0
- package/dist/global-skills/expo-dom/SKILL.md +8 -0
- package/dist/global-skills/expo-examples/SKILL.md +8 -0
- package/dist/global-skills/expo-migrate-module/SKILL.md +113 -0
- package/dist/global-skills/expo-migrate-module/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-migrate-module/references/compatibility.md +73 -0
- package/dist/global-skills/expo-migrate-module/references/example.md +212 -0
- package/dist/global-skills/expo-migrate-module/references/migration-map.md +306 -0
- package/dist/global-skills/expo-module/SKILL.md +11 -1
- package/dist/global-skills/expo-native-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-project-structure/SKILL.md +114 -0
- package/dist/global-skills/expo-project-structure/agents/openai.yaml +4 -0
- package/dist/global-skills/expo-router/SKILL.md +8 -0
- package/dist/global-skills/expo-skill-feedback/SKILL.md +66 -33
- package/dist/global-skills/expo-skill-feedback/agents/openai.yaml +2 -2
- package/dist/global-skills/expo-tailwind-setup/SKILL.md +8 -0
- package/dist/global-skills/expo-ui/SKILL.md +8 -0
- package/dist/global-skills/expo-upgrade/SKILL.md +15 -1
- package/dist/global-skills/expo-web-to-native/SKILL.md +8 -0
- package/dist/global-skills/extension-to-functions-codebase/SKILL.md +129 -0
- package/dist/global-skills/extension-to-functions-codebase/references/configuration-migration.md +161 -0
- package/dist/global-skills/extension-to-functions-codebase/references/destructuring-shim.md +122 -0
- package/dist/global-skills/extension-to-functions-codebase/references/signature-mapping.md +84 -0
- package/dist/global-skills/firebase-ai-logic-basics/SKILL.md +61 -19
- package/dist/global-skills/firebase-ai-logic-basics/references/flutter_setup.md +6 -3
- package/dist/global-skills/firebase-app-hosting-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-auth-basics/SKILL.md +4 -2
- package/dist/global-skills/firebase-basics/SKILL.md +5 -5
- package/dist/global-skills/firebase-crashlytics/SKILL.md +2 -0
- package/dist/global-skills/firebase-data-connect/SKILL.md +2 -0
- package/dist/global-skills/firebase-firestore/SKILL.md +3 -6
- package/dist/global-skills/firebase-hosting-basics/SKILL.md +4 -1
- package/dist/global-skills/firebase-remote-config-basics/SKILL.md +5 -1
- package/dist/global-skills/firebase-security-rules-auditor/SKILL.md +4 -1
- package/dist/global-skills/harden/SKILL.md +2 -1
- package/dist/global-skills/instrument-feature-flags/SKILL.md +1 -0
- package/dist/global-skills/instrument-feature-flags/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-feature-flags/references/adding-feature-flag-code.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/android.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/api.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/best-practices.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/django.md +38 -5
- package/dist/global-skills/instrument-feature-flags/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-feature-flags/references/elixir.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/flask.md +17 -5
- package/dist/global-skills/instrument-feature-flags/references/flutter.md +7 -5
- package/dist/global-skills/instrument-feature-flags/references/go.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ios.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/java.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/laravel.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/next-js.md +74 -8
- package/dist/global-skills/instrument-feature-flags/references/nodejs.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/php.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/python.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react-native.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/react.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/ruby.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/rust.md +6 -4
- package/dist/global-skills/instrument-feature-flags/references/usage.md +41 -4
- package/dist/global-skills/instrument-feature-flags/references/web.md +7 -5
- package/dist/global-skills/instrument-product-analytics/SKILL.md +2 -1
- package/dist/global-skills/instrument-product-analytics/references/COMMANDMENTS.md +5 -0
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-hybrid.md +12 -14
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-astro-ssr.md +25 -21
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-django.md +75 -55
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-fastapi.md +3 -6
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-flask.md +26 -16
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-3-6.md +8 -5
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-nuxt-4.md +4 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-react-react-router-7-framework.md +3 -3
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-ruby-on-rails.md +8 -4
- package/dist/global-skills/instrument-product-analytics/references/EXAMPLE-tanstack-start.md +20 -8
- package/dist/global-skills/instrument-product-analytics/references/android.md +46 -4
- package/dist/global-skills/instrument-product-analytics/references/angular.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/astro.md +41 -5
- package/dist/global-skills/instrument-product-analytics/references/configuration.md +7 -4
- package/dist/global-skills/instrument-product-analytics/references/django.md +38 -5
- package/dist/global-skills/instrument-product-analytics/references/dotnet.md +10 -4
- package/dist/global-skills/instrument-product-analytics/references/elixir.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/flask.md +17 -5
- package/dist/global-skills/instrument-product-analytics/references/flutter.md +49 -4
- package/dist/global-skills/instrument-product-analytics/references/go.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/identify-users.md +38 -7
- package/dist/global-skills/instrument-product-analytics/references/ios.md +14 -4
- package/dist/global-skills/instrument-product-analytics/references/laravel.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/next-js.md +74 -8
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js-3-6.md +39 -7
- package/dist/global-skills/instrument-product-analytics/references/nuxt-js.md +40 -4
- package/dist/global-skills/instrument-product-analytics/references/php.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/posthog-python.md +21 -17
- package/dist/global-skills/instrument-product-analytics/references/python.md +15 -5
- package/dist/global-skills/instrument-product-analytics/references/react-native.md +41 -7
- package/dist/global-skills/instrument-product-analytics/references/react-router-v6.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-data-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-declarative-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/react-router-v7-framework-mode.md +18 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby-on-rails.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/ruby.md +6 -4
- package/dist/global-skills/instrument-product-analytics/references/svelte.md +42 -6
- package/dist/global-skills/instrument-product-analytics/references/tanstack-start.md +31 -7
- package/dist/global-skills/instrument-product-analytics/references/usage.md +41 -4
- package/dist/global-skills/instrument-product-analytics/references/vue-js.md +42 -6
- package/dist/global-skills/manifest.json +6 -1
- package/dist/global-skills/neon/SKILL.md +235 -121
- package/dist/global-skills/neon-ai-gateway/SKILL.md +95 -16
- package/dist/global-skills/neon-functions/SKILL.md +242 -152
- package/dist/global-skills/neon-functions/references/ai-sdk.md +9 -3
- package/dist/global-skills/neon-functions/references/mastra-studio.md +1 -1
- package/dist/global-skills/neon-functions/references/mcp.md +13 -4
- package/dist/global-skills/neon-functions/references/sentry.md +165 -52
- package/dist/global-skills/neon-functions/references/sse.md +23 -6
- package/dist/global-skills/neon-object-storage/SKILL.md +40 -16
- package/dist/global-skills/neon-postgres/SKILL.md +63 -262
- package/dist/global-skills/neon-postgres-branches/SKILL.md +61 -50
- package/dist/global-skills/neon-postgres-egress-optimizer/SKILL.md +22 -3
- package/dist/global-skills/resend/SKILL.md +6 -6
- package/dist/global-skills/resend/references/automations.md +2 -2
- package/dist/global-skills/resend/references/broadcasts.md +11 -3
- package/dist/global-skills/resend/references/domains.md +25 -3
- package/dist/global-skills/resend/references/installation.md +7 -7
- package/dist/global-skills/setup-payments/SKILL.md +4 -5
- package/dist/global-skills/stripe-best-practices/SKILL.md +32 -7
- package/dist/global-skills/stripe-best-practices/references/billing.md +11 -1
- package/dist/global-skills/stripe-best-practices/references/payments.md +23 -2
- package/dist/global-skills/stripe-best-practices/references/security.md +21 -11
- package/dist/global-skills/stripe-best-practices/references/tax.md +116 -11
- package/dist/global-skills/supabase/CHANGELOG.md +25 -0
- package/dist/global-skills/supabase/SKILL.md +5 -1
- package/dist/global-skills/supabase-postgres-best-practices/CHANGELOG.md +30 -0
- package/dist/global-skills/supabase-postgres-best-practices/SKILL.md +1 -1
- package/dist/global-skills/use-kit-mcp/SKILL.md +5 -5
- package/dist/global-skills/use-railway/SKILL.md +4 -4
- package/dist/global-skills/use-railway/references/iac.md +206 -57
- package/dist/global-skills/use-railway/scripts/railway-api.sh +7 -2
- package/dist/global-skills/xcode-project-setup/SKILL.md +2 -0
- package/package.json +12 -9
- package/LICENSE.md +0 -47
- package/dist/global-skills/eas-workflows/scripts/validate.js +0 -84
- package/dist/global-skills/expo-skill-feedback/scripts/skill-feedback.cjs +0 -118
- package/dist/global-skills/neon-functions/references/hono-websockets.md +0 -145
|
@@ -27,6 +27,8 @@ npx expo install expo@next --fix # install beta
|
|
|
27
27
|
|
|
28
28
|
## Step-by-Step Upgrade Process
|
|
29
29
|
|
|
30
|
+
> If upgrading from SDK 55 or earlier, skip SDK 56 and upgrade directly to SDK 57. Don't use `expo@57.0.8` or below. SDK 55 with Hermes V1 enabled, SDK 56, and older SDK 57 releases contain a Hermes V1 memory regression that can drastically increase memory usage when using `react-native-worklets` or `react-native-reanimated`.
|
|
31
|
+
|
|
30
32
|
1. Upgrade Expo and dependencies
|
|
31
33
|
|
|
32
34
|
```bash
|
|
@@ -75,6 +77,7 @@ These steps only apply when `ios/` and/or `android/` directories exist in the pr
|
|
|
75
77
|
## Housekeeping
|
|
76
78
|
|
|
77
79
|
- Review release notes for the target SDK version at https://expo.dev/changelog
|
|
80
|
+
- Update versioned docs links in agent instruction files (`AGENTS.md`). The default template links to `https://docs.expo.dev/versions/v<version>/`. Search for `docs.expo.dev/versions/` and bump each link to the new SDK version.
|
|
78
81
|
- If using Expo SDK 54 or later, ensure react-native-worklets is installed — this is required for react-native-reanimated to work.
|
|
79
82
|
- Enable React Compiler in SDK 54+ by adding `"experiments": { "reactCompiler": true }` to app.json — it's stable and recommended
|
|
80
83
|
- Delete sdkVersion from `app.json` to let Expo manage it automatically
|
|
@@ -106,6 +109,7 @@ Check if package.json has excluded packages:
|
|
|
106
109
|
```
|
|
107
110
|
|
|
108
111
|
Exclusions are often workarounds that may no longer be needed after upgrading. Review each one.
|
|
112
|
+
|
|
109
113
|
## Removing patches
|
|
110
114
|
|
|
111
115
|
Check if there are any outdated patches in the `patches/` directory. Remove them if they are no longer needed.
|
|
@@ -127,8 +131,18 @@ Remove redundant metro config options:
|
|
|
127
131
|
|
|
128
132
|
## Hermes engine v1
|
|
129
133
|
|
|
130
|
-
|
|
134
|
+
Hermes V1 is the default on SDK 56 and later. SDK 55 apps using Hermes V1, all SDK 56 apps, and SDK 57 apps before `expo@57.0.9` may encounter a memory regression when importing `react-native-worklets` or `react-native-reanimated`. Upgrade directly to SDK 57 and `expo@57.0.9` or later. Do not recommend Worklets Bundle Mode as a production workaround; it is unsupported and experimental and may not work as expected.
|
|
135
|
+
|
|
136
|
+
Do not guide users to opt in to or out of Hermes V1. Changing the Hermes version from the SDK default is unsupported and has significant build and dependency-management caveats.
|
|
131
137
|
|
|
132
138
|
## New Architecture
|
|
133
139
|
|
|
134
140
|
The new architecture is enabled by default, the app.json field `"newArchEnabled": true` is no longer needed as it's the default. Expo Go only supports the new architecture as of SDK +53.
|
|
141
|
+
|
|
142
|
+
## Submitting Feedback
|
|
143
|
+
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
|
|
144
|
+
```bash
|
|
145
|
+
npx --yes submit-expo-feedback@latest --category skills --subject "expo-upgrade" "<actionable feedback>"
|
|
146
|
+
```
|
|
147
|
+
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
|
|
148
|
+
If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.
|
|
@@ -81,3 +81,11 @@ Pass on parity of **content and behavior** — not pixels: a nativized screen sh
|
|
|
81
81
|
- [`./references/verify-on-device.md`](./references/verify-on-device.md) — the two-agent parity recipe: drive the web app (browser agent) and the native app (argent), open the same route, compare.
|
|
82
82
|
- [`./references/run-as-goal.md`](./references/run-as-goal.md) — a ready-shaped, migration-specific goal objective for driving step 4 unattended (re-reads this skill each iteration).
|
|
83
83
|
- [Expo — From Web to Native with React](https://expo.dev/blog/from-web-to-native-with-react) — the canonical guide this skill operationalizes.
|
|
84
|
+
|
|
85
|
+
## Submitting Feedback
|
|
86
|
+
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:
|
|
87
|
+
```bash
|
|
88
|
+
npx --yes submit-expo-feedback@latest --category skills --subject "expo-web-to-native" "<actionable feedback>"
|
|
89
|
+
```
|
|
90
|
+
Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
|
|
91
|
+
If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: extension-to-functions-codebase
|
|
3
|
+
description: Skill for converting an installed Firebase Extension (or extension source) into a standalone Cloud Functions for Firebase codebase or publishable npm package, including V1 to V2 trigger upgrades, lifecycle hooks, and declarative security
|
|
4
|
+
metadata:
|
|
5
|
+
category: Serverless
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Extension to Functions Codebase & npm Package Migration
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Migrates a Firebase Extension into either:
|
|
13
|
+
|
|
14
|
+
1. **A local Cloud Functions codebase** (`functions/src/` for app integration).
|
|
15
|
+
1. **A publishable npm package** (reusable open-source package exporting V2
|
|
16
|
+
functions).
|
|
17
|
+
|
|
18
|
+
Leverages native Cloud Functions features (declarative IAM, Parameterized
|
|
19
|
+
Config, SDK Lifecycle Hooks) and modernizes 1st Gen triggers to 2nd Gen using
|
|
20
|
+
the Destructuring Compatibility Shim.
|
|
21
|
+
|
|
22
|
+
______________________________________________________________________
|
|
23
|
+
|
|
24
|
+
## Target Migration Workflows
|
|
25
|
+
|
|
26
|
+
- **Target A: Local Functions Codebase** (End-User App Integration)
|
|
27
|
+
|
|
28
|
+
- Output: Code under `functions/src/`. Config in `.env`.
|
|
29
|
+
- Deployment: `firebase deploy --only functions`.
|
|
30
|
+
|
|
31
|
+
- **Target B: Publishable npm Package / Shareable Package**
|
|
32
|
+
|
|
33
|
+
- Output: Reusable npm package exporting V2 functions.
|
|
34
|
+
- Configuration: `package.json` specifying `exports` map,
|
|
35
|
+
`engines: { "node": ">=22" }`, and
|
|
36
|
+
`peerDependencies: { "firebase-functions": ">=6.0.0" }`.
|
|
37
|
+
- Usage: Consumers install package and re-export functions in `index.ts`
|
|
38
|
+
(`export * from "<package-name>"`).
|
|
39
|
+
|
|
40
|
+
______________________________________________________________________
|
|
41
|
+
|
|
42
|
+
## Core Rules & Constraints
|
|
43
|
+
|
|
44
|
+
### 1. Declarative IAM & APIs (Zero-Local-Overhead)
|
|
45
|
+
|
|
46
|
+
Use native SDK declarations instead of manual `gcloud` scripts or console
|
|
47
|
+
instructions:
|
|
48
|
+
|
|
49
|
+
- Use `requiresRole("roles/...")` for required GCP IAM permissions.
|
|
50
|
+
- Use `requiresAPI("service.googleapis.com", "Description")` for Google APIs.
|
|
51
|
+
|
|
52
|
+
### 2. Global Parameter Access Restriction
|
|
53
|
+
|
|
54
|
+
- **Never call `.value()` at top-level module load scope.**
|
|
55
|
+
- Initialize global SDK instances inside `onInit()` or lazy getters:
|
|
56
|
+
```typescript
|
|
57
|
+
import { defineString } from "firebase-functions/params";
|
|
58
|
+
import { onInit } from "firebase-functions/v2";
|
|
59
|
+
|
|
60
|
+
const dataset = defineString("DATASET_ID");
|
|
61
|
+
let client: BigQuery;
|
|
62
|
+
|
|
63
|
+
onInit(() => {
|
|
64
|
+
client = new BigQuery({ datasetId: dataset.value() });
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. V2 Concurrency & Cost Parity
|
|
69
|
+
|
|
70
|
+
V2 enables concurrency (up to 80 requests). To preserve V1 single-concurrency
|
|
71
|
+
pricing, set `cpu: "gcf_gen1"`.
|
|
72
|
+
|
|
73
|
+
______________________________________________________________________
|
|
74
|
+
|
|
75
|
+
## Step-by-Step Migration Execution
|
|
76
|
+
|
|
77
|
+
### Step 1: Inventory Extension Resources
|
|
78
|
+
|
|
79
|
+
1. **`extension.yaml`**:
|
|
80
|
+
- `params` → `defineString`, `defineInt`, `defineBoolean`, `defineSecret`.
|
|
81
|
+
- `apis` → `requiresAPI(...)`.
|
|
82
|
+
- `roles` → `requiresRole(...)`.
|
|
83
|
+
- `lifecycleEvents` → `afterFirstDeploy` & `afterRedeploy`.
|
|
84
|
+
- `resources` → Upgrade 1st Gen triggers to 2nd Gen (`onDocumentWritten`,
|
|
85
|
+
`onTaskDispatched`, `onRequest`).
|
|
86
|
+
1. **Files & Scripts**: Preserve devDependencies, test framework (`jest`), and
|
|
87
|
+
test scripts.
|
|
88
|
+
|
|
89
|
+
### Step 2: Configure `package.json`
|
|
90
|
+
|
|
91
|
+
- Set `name: "<package-name>"`, `engines: { "node": ">=22" }`.
|
|
92
|
+
- Set `peerDependencies`:
|
|
93
|
+
```json
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"firebase-admin": "^11.0.0 || ^12.0.0",
|
|
96
|
+
"firebase-functions": ">=6.0.0"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
- Configure `exports` map targeting ESM/CommonJS and TypeScript declarations
|
|
100
|
+
(`lib/index.js`, `lib/index.d.ts`).
|
|
101
|
+
|
|
102
|
+
### Step 3: Upgrade Triggers from V1 to V2
|
|
103
|
+
|
|
104
|
+
- Firestore: Use `onDocumentWritten` from `firebase-functions/v2/firestore`.
|
|
105
|
+
- Tasks: Use `onTaskDispatched` from `firebase-functions/v2/tasks`. Remove
|
|
106
|
+
`EXT_INSTANCE_ID` when enqueueing tasks.
|
|
107
|
+
- HTTP: Use `onRequest` from `firebase-functions/v2/https`.
|
|
108
|
+
- Apply Destructuring Compatibility Shim (`{ change, context }`,
|
|
109
|
+
`{ snapshot, context }`) where legacy 1st Gen handlers expect
|
|
110
|
+
`(change, context)`.
|
|
111
|
+
|
|
112
|
+
### Step 4: Convert Lifecycle Events
|
|
113
|
+
|
|
114
|
+
Map extension lifecycle events to SDK lifecycle hooks in `src/index.ts`:
|
|
115
|
+
|
|
116
|
+
- `onInstall` → `afterFirstDeploy({ task: { function: "initTask" } })`
|
|
117
|
+
- `onUpdate` / `onConfigure` →
|
|
118
|
+
`afterRedeploy({ task: { function: "setupTask" } })`
|
|
119
|
+
|
|
120
|
+
### Step 5: Package README & Export Instructions
|
|
121
|
+
|
|
122
|
+
Generate `README.md` containing:
|
|
123
|
+
|
|
124
|
+
1. Installation instructions (`npm install`).
|
|
125
|
+
1. Re-export snippet (`export * from "<package-name>"`).
|
|
126
|
+
1. Parameterized Configuration `.env` reference table.
|
|
127
|
+
1. What Changed (Extension vs Package) comparison table.
|
|
128
|
+
|
|
129
|
+
_Reminder: NEVER execute `npm publish`._
|
package/dist/global-skills/extension-to-functions-codebase/references/configuration-migration.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Migrating Runtime Configurations (runWith)
|
|
2
|
+
|
|
3
|
+
In Cloud Functions for Firebase V1 (`firebase-functions/v1`), you configured
|
|
4
|
+
runtime settings like memory, timeout, and service accounts using `.runWith()`.
|
|
5
|
+
In V2 (`firebase-functions/v2`), `.runWith()` is removed and replaced by a more
|
|
6
|
+
flexible options system.
|
|
7
|
+
|
|
8
|
+
You can configure V2 functions in two ways: **Per-Function** (passing an options
|
|
9
|
+
object directly to the trigger) or **Globally** (`setGlobalOptions` at the top
|
|
10
|
+
of a file).
|
|
11
|
+
|
|
12
|
+
______________________________________________________________________
|
|
13
|
+
|
|
14
|
+
## 1. Per-Function Configuration
|
|
15
|
+
|
|
16
|
+
Pass the configuration options object as the **first argument** to the V2
|
|
17
|
+
trigger function. Per-function options always override any global defaults.
|
|
18
|
+
|
|
19
|
+
### V1 Legacy
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import * as functions from "firebase-functions";
|
|
23
|
+
|
|
24
|
+
export const processOrder = functions
|
|
25
|
+
.runWith({ memory: "2GB" })
|
|
26
|
+
.pubsub.topic("orders")
|
|
27
|
+
.onPublish((message, context) => { ... });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### V2 Modern Equivalent
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { onMessagePublished } from "firebase-functions/v2/pubsub";
|
|
34
|
+
|
|
35
|
+
export const processOrder = onMessagePublished(
|
|
36
|
+
{
|
|
37
|
+
topic: "orders",
|
|
38
|
+
memory: "2GiB", // Options passed as the first argument!
|
|
39
|
+
},
|
|
40
|
+
({ message, context }) => { ... } // Destructuring shim pattern
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
> [!TIP] **Memory Unit Caveat**: V1 accepted `"1GB"`. V2 types strongly prefer
|
|
45
|
+
> IEC units like `"1GiB"`, `"2GiB"`, etc.
|
|
46
|
+
|
|
47
|
+
______________________________________________________________________
|
|
48
|
+
|
|
49
|
+
## 2. Global Configuration (`setGlobalOptions`)
|
|
50
|
+
|
|
51
|
+
Use `setGlobalOptions` at the top of your file when all or most functions in
|
|
52
|
+
that file share the exact same runtime requirements (e.g. identical region,
|
|
53
|
+
memory allocation, timeout, or service account). Individual functions can still
|
|
54
|
+
override specific settings by declaring per-function options.
|
|
55
|
+
|
|
56
|
+
### V1 Legacy
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import * as functions from "firebase-functions";
|
|
60
|
+
|
|
61
|
+
export const myFn = functions
|
|
62
|
+
.runWith({
|
|
63
|
+
memory: "1GB",
|
|
64
|
+
timeoutSeconds: 120,
|
|
65
|
+
serviceAccount: "custom-sa@my-project.iam.gserviceaccount.com",
|
|
66
|
+
})
|
|
67
|
+
.https.onRequest((req, res) => { ... });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### V2 Modern Equivalent
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { setGlobalOptions } from "firebase-functions/v2";
|
|
74
|
+
import { onRequest } from "firebase-functions/v2/https";
|
|
75
|
+
|
|
76
|
+
// Set global defaults for all functions defined after this call in this file
|
|
77
|
+
setGlobalOptions({
|
|
78
|
+
memory: "1GiB", // Note: GiB instead of GB is preferred in V2 types
|
|
79
|
+
timeoutSeconds: 120,
|
|
80
|
+
serviceAccount: "custom-sa@my-project.iam.gserviceaccount.com",
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const myFn = onRequest((req, res) => { ... });
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
______________________________________________________________________
|
|
87
|
+
|
|
88
|
+
## Common Property Translations
|
|
89
|
+
|
|
90
|
+
| V1 Property | V2 Property | Notes |
|
|
91
|
+
| :--------------------------- | :--------------------------- | :-------------------------------------------------------------- |
|
|
92
|
+
| `memory` | `memory` | Use `"1GiB"` instead of `"1GB"`. |
|
|
93
|
+
| `timeoutSeconds` | `timeoutSeconds` | Same. |
|
|
94
|
+
| `ingressSettings` | `ingressSettings` | Same. |
|
|
95
|
+
| `vpcConnector` | `vpcConnector` | Same. |
|
|
96
|
+
| `vpcConnectorEgressSettings` | `vpcConnectorEgressSettings` | Same. |
|
|
97
|
+
| `serviceAccount` | `serviceAccount` | Same. |
|
|
98
|
+
| `secrets` | `secrets` | Same. |
|
|
99
|
+
| `failurePolicy` | `retry` | Renamed to boolean `retry: true/false` in V2 Eventarc triggers. |
|
|
100
|
+
|
|
101
|
+
______________________________________________________________________
|
|
102
|
+
|
|
103
|
+
## 3. Migrating Environment Configurations (`functions.config()`)
|
|
104
|
+
|
|
105
|
+
In V1, you used `functions.config()` to access environment configuration. In V2,
|
|
106
|
+
this is replaced by **Parameterized Configuration**.
|
|
107
|
+
|
|
108
|
+
### Deterministic Rules for Migration
|
|
109
|
+
|
|
110
|
+
Follow these rules to ensure a deterministic and safe migration:
|
|
111
|
+
|
|
112
|
+
#### Typing & Exports
|
|
113
|
+
|
|
114
|
+
- **Numbers**: If the value is used as a number, use `defineInt` or
|
|
115
|
+
`defineNumber`.
|
|
116
|
+
- **Secrets**: If the key contains "KEY", "SECRET", "TOKEN", or "PASSWORD", use
|
|
117
|
+
`defineSecret()` or `defineJsonSecret()`.
|
|
118
|
+
- *Note*: Secrets MUST be explicitly bound to the function that uses them in
|
|
119
|
+
the options object (e.g., `{ secrets: [myKey, myJsonSecret] }`). Both
|
|
120
|
+
`SecretParam` and `JsonSecretParam` are supported in the `secrets` array.
|
|
121
|
+
- **Lists**: Use `defineList` for comma-separated lists.
|
|
122
|
+
- **JSON**: Use `defineJSON` for JSON strings.
|
|
123
|
+
- **Buckets**: If the param is a storage bucket, set `input: { text: {} }` or
|
|
124
|
+
bucket selector.
|
|
125
|
+
- **Input Validation**: Use `nonEmpty: true` inside `input.text` or
|
|
126
|
+
`input.multiSelect` to enforce non-empty parameter input during CLI prompting
|
|
127
|
+
(e.g. `defineString("PARAM", { input: { text: { nonEmpty: true } } })`).
|
|
128
|
+
- **Type Annotations**: Import parameter types directly from
|
|
129
|
+
`firebase-functions/params` (e.g.
|
|
130
|
+
`import type { StringParam, SecretParam, JsonSecretParam, IntParam } from "firebase-functions/params"`).
|
|
131
|
+
|
|
132
|
+
#### Initialization & Scope
|
|
133
|
+
|
|
134
|
+
- **Global Initialization**: If a variable was initialized globally in V1 (e.g.,
|
|
135
|
+
`const client = new Client(functions.config().key)`), you must split it to
|
|
136
|
+
have declaration at global scope and initialization inside `onInit`:
|
|
137
|
+
```typescript
|
|
138
|
+
import { onInit } from "firebase-functions/v2";
|
|
139
|
+
|
|
140
|
+
const myKey = defineSecret("MY_KEY");
|
|
141
|
+
let client: Client;
|
|
142
|
+
|
|
143
|
+
onInit(() => {
|
|
144
|
+
client = new Client(myKey.value());
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Advanced Interpolation & Logic
|
|
149
|
+
|
|
150
|
+
- **String Interpolation**: Use the `expr` tagged template literal from
|
|
151
|
+
`firebase-functions/params` (e.g., `` `expr`every ${period} days` ``) instead
|
|
152
|
+
of standard template literals when constructing dynamic strings with
|
|
153
|
+
parameters. Do NOT call `.value()` inside `expr`.
|
|
154
|
+
- **Logic Operators**: Use expressions like
|
|
155
|
+
`projectID.equals('prod').thenElse(1, 0)` for logical operations instead of
|
|
156
|
+
ternary operators on `.value()`.
|
|
157
|
+
|
|
158
|
+
#### Built-ins
|
|
159
|
+
|
|
160
|
+
- Prefer built-in variables like `databaseURL`, `projectID`, `gcloudProject`,
|
|
161
|
+
`storageBucket` rather than defining new params for these values.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Architectural Deep Dive: Destructuring Compatibility Shim
|
|
2
|
+
|
|
3
|
+
The Destructuring Compatibility Shim is a **Zero-Touch Logic Migration**
|
|
4
|
+
pattern. It allows you to upgrade a function's infrastructure to V2 (and take
|
|
5
|
+
advantage of GCF 2nd Gen runtimes) without rewriting any of your internal
|
|
6
|
+
business logic.
|
|
7
|
+
|
|
8
|
+
______________________________________________________________________
|
|
9
|
+
|
|
10
|
+
## How it Works
|
|
11
|
+
|
|
12
|
+
When you migrate a V1 function to V2, the signature changes from two parameters
|
|
13
|
+
`(data, context)` to a single `CloudEvent` object.
|
|
14
|
+
|
|
15
|
+
Instead of manually rewriting all usages of `context.params` or `message.json`
|
|
16
|
+
inside the function, you use JavaScript's **Object Destructuring** in the
|
|
17
|
+
signature.
|
|
18
|
+
|
|
19
|
+
### Example Transformation
|
|
20
|
+
|
|
21
|
+
#### Step 1: Legacy V1
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
export const processOrder = functions.pubsub.topic("orders").onPublish((message, context) => {
|
|
25
|
+
const orderId = message.json.id;
|
|
26
|
+
console.log(`Processing order ${orderId} at ${context.timestamp}`);
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Step 2: Modern V2 + Shim
|
|
31
|
+
|
|
32
|
+
We change the trigger to `onMessagePublished`, and instead of accepting `event`,
|
|
33
|
+
we destructure `{ message, context }` directly:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
export const processOrder = onMessagePublished("orders", ({ message, context }) => {
|
|
37
|
+
const orderId = message.json.id; // Legacy logic remains untouched!
|
|
38
|
+
console.log(`Processing order ${orderId} at ${context.timestamp}`);
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Why This Works
|
|
43
|
+
|
|
44
|
+
The Firebase Functions SDK uses a utility called `addV1Compat` to attach these
|
|
45
|
+
properties via **Lazy Getters** on the `CloudEvent` object for standard event
|
|
46
|
+
triggers. When you attempt to destructure `{ message, context }` from the event,
|
|
47
|
+
the SDK transparently maps the V2 event properties back into V1-compatible
|
|
48
|
+
objects on the fly! This feature is available in modern V2 environments
|
|
49
|
+
supported by the SDK.
|
|
50
|
+
|
|
51
|
+
______________________________________________________________________
|
|
52
|
+
|
|
53
|
+
## Provider Mapping Examples
|
|
54
|
+
|
|
55
|
+
Here are the exact destructuring patterns for every supported V2 provider:
|
|
56
|
+
|
|
57
|
+
### 1. Cloud Firestore
|
|
58
|
+
|
|
59
|
+
- **Created / Deleted** triggers:
|
|
60
|
+
```typescript
|
|
61
|
+
// V2: onDocumentCreated, onDocumentDeleted
|
|
62
|
+
export const processDoc = onDocumentCreated("users/{id}", ({ snapshot, context }) => { ... });
|
|
63
|
+
```
|
|
64
|
+
- **Updated / Written** triggers:
|
|
65
|
+
```typescript
|
|
66
|
+
// V2: onDocumentUpdated, onDocumentWritten
|
|
67
|
+
export const processDoc = onDocumentUpdated("users/{id}", ({ change, context }) => { ... });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Cloud Storage
|
|
71
|
+
|
|
72
|
+
- **All** triggers (`onObjectFinalized`, `onObjectDeleted`, `onObjectArchived`,
|
|
73
|
+
`onObjectMetadataUpdated`):
|
|
74
|
+
```typescript
|
|
75
|
+
export const processFile = onObjectFinalized(({ object, context }) => { ... });
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Realtime Database
|
|
79
|
+
|
|
80
|
+
- **Created / Deleted** triggers:
|
|
81
|
+
```typescript
|
|
82
|
+
export const processData = onValueCreated("/users/{id}", ({ snapshot, context }) => { ... });
|
|
83
|
+
```
|
|
84
|
+
- **Updated / Written** triggers:
|
|
85
|
+
```typescript
|
|
86
|
+
export const processData = onValueWritten("/users/{id}", ({ change, context }) => { ... });
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 4. Remote Config
|
|
90
|
+
|
|
91
|
+
- **Updated** triggers:
|
|
92
|
+
```typescript
|
|
93
|
+
export const processConfig = onConfigUpdated(({ version, context }) => { ... });
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
______________________________________________________________________
|
|
97
|
+
|
|
98
|
+
## Best Practices for AI Agents
|
|
99
|
+
|
|
100
|
+
1. **Rely on the shim for complex logic.** When converting functions with
|
|
101
|
+
extensive or complex internal business logic, prefer using the destructuring
|
|
102
|
+
shim (`{ shimmedKey, context }`) by default to minimize risk and avoid
|
|
103
|
+
introducing subtle bugs.
|
|
104
|
+
1. **Clean-room rewrites.** If the function body is very simple, or if the user
|
|
105
|
+
explicitly asks for a comprehensive code modernization/cleanup, you can ask
|
|
106
|
+
the user if they would prefer a full clean-room rewrite to native V2 event
|
|
107
|
+
properties.
|
|
108
|
+
1. **Always type-check (`tsc`) after the rewrite.** If the types are wrong, the
|
|
109
|
+
shim might not be fully supported for that specific provider yet.
|
|
110
|
+
1. **HTTPS Callables (Flattened Context)**: Unlike event triggers, Callables do
|
|
111
|
+
**not** use `V1Compat` or a `context` object. Instead, all context properties
|
|
112
|
+
are flattened onto the request object.
|
|
113
|
+
- **V1 Priority**: `(data, context) => { ... }`
|
|
114
|
+
- **V2 Equivalent**: `({ data, auth, app }) => { ... }`
|
|
115
|
+
|
|
116
|
+
______________________________________________________________________
|
|
117
|
+
|
|
118
|
+
## Related Migrations
|
|
119
|
+
|
|
120
|
+
For a complete guide on migrating runtime options and `functions.config()` to V2
|
|
121
|
+
Parameterized Configuration, refer to
|
|
122
|
+
[configuration-migration.md](configuration-migration.md).
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Firebase Functions V1 vs V2 Signature Mapping
|
|
2
|
+
|
|
3
|
+
This reference maps legacy V1 functions to their modern V2 equivalents. When
|
|
4
|
+
using the compatibility shim, you can destructure the V2 event object using the
|
|
5
|
+
exact parameter names from the legacy V1 trigger signature (`change`,
|
|
6
|
+
`snapshot`, `message`, `object`) alongside `context`.
|
|
7
|
+
|
|
8
|
+
______________________________________________________________________
|
|
9
|
+
|
|
10
|
+
## Cloud Firestore
|
|
11
|
+
|
|
12
|
+
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|
|
13
|
+
| :-------------------------------- | :-------------------- | :------------------------ |
|
|
14
|
+
| `firestore.document().onWrite()` | `onDocumentWritten()` | `({ change, context })` |
|
|
15
|
+
| `firestore.document().onCreate()` | `onDocumentCreated()` | `({ snapshot, context })` |
|
|
16
|
+
| `firestore.document().onUpdate()` | `onDocumentUpdated()` | `({ change, context })` |
|
|
17
|
+
| `firestore.document().onDelete()` | `onDocumentDeleted()` | `({ snapshot, context })` |
|
|
18
|
+
|
|
19
|
+
______________________________________________________________________
|
|
20
|
+
|
|
21
|
+
## Cloud Pub/Sub
|
|
22
|
+
|
|
23
|
+
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|
|
24
|
+
| :--------------------------- | :--------------------- | :----------------------- |
|
|
25
|
+
| `pubsub.topic().onPublish()` | `onMessagePublished()` | `({ message, context })` |
|
|
26
|
+
| `pubsub.schedule().onRun()` | `onSchedule()` | Access `event` directly |
|
|
27
|
+
|
|
28
|
+
> [!NOTE] Scheduled functions moved from the `pubsub` namespace to the
|
|
29
|
+
> `scheduler` namespace in V2.
|
|
30
|
+
|
|
31
|
+
______________________________________________________________________
|
|
32
|
+
|
|
33
|
+
## Realtime Database
|
|
34
|
+
|
|
35
|
+
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|
|
36
|
+
| :-------------------------- | :----------------- | :------------------------ |
|
|
37
|
+
| `database.ref().onWrite()` | `onValueWritten()` | `({ change, context })` |
|
|
38
|
+
| `database.ref().onCreate()` | `onValueCreated()` | `({ snapshot, context })` |
|
|
39
|
+
| `database.ref().onUpdate()` | `onValueUpdated()` | `({ change, context })` |
|
|
40
|
+
| `database.ref().onDelete()` | `onValueDeleted()` | `({ snapshot, context })` |
|
|
41
|
+
|
|
42
|
+
______________________________________________________________________
|
|
43
|
+
|
|
44
|
+
## Cloud Storage
|
|
45
|
+
|
|
46
|
+
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|
|
47
|
+
| :------------------------------------ | :-------------------------- | :---------------------- |
|
|
48
|
+
| `storage.object().onArchive()` | `onObjectArchived()` | `({ object, context })` |
|
|
49
|
+
| `storage.object().onDelete()` | `onObjectDeleted()` | `({ object, context })` |
|
|
50
|
+
| `storage.object().onFinalize()` | `onObjectFinalized()` | `({ object, context })` |
|
|
51
|
+
| `storage.object().onMetadataUpdate()` | `onObjectMetadataUpdated()` | `({ object, context })` |
|
|
52
|
+
|
|
53
|
+
______________________________________________________________________
|
|
54
|
+
|
|
55
|
+
## HTTP / Callables
|
|
56
|
+
|
|
57
|
+
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|
|
58
|
+
| :------------------ | :------------------ | :----------------------------- |
|
|
59
|
+
| `https.onRequest()` | `https.onRequest()` | Standard Express `(req, res)` |
|
|
60
|
+
| `https.onCall()` | `https.onCall()` | Destructure `({ data, auth })` |
|
|
61
|
+
|
|
62
|
+
> [!IMPORTANT] **HTTP Callables do NOT use the Destructuring Shim.** In V2, the
|
|
63
|
+
> handler receives a single `CallableRequest` object (not a `CloudEvent`). You
|
|
64
|
+
> should destructure properties like `data`, `auth`, and `app` directly from it.
|
|
65
|
+
> The traditional `context` object is **unavailable**.
|
|
66
|
+
|
|
67
|
+
______________________________________________________________________
|
|
68
|
+
|
|
69
|
+
## Auth (Blocking)
|
|
70
|
+
|
|
71
|
+
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|
|
72
|
+
| :--------------------------- | :------------------------------ | :---------------------- |
|
|
73
|
+
| `auth.user().beforeSignIn()` | `identity.beforeUserSignedIn()` | Access `event` directly |
|
|
74
|
+
| `auth.user().beforeCreate()` | `identity.beforeUserCreated()` | Access `event` directly |
|
|
75
|
+
|
|
76
|
+
> [!NOTE] Auth Blocking triggers moved to the `identity` namespace in V2.
|
|
77
|
+
|
|
78
|
+
______________________________________________________________________
|
|
79
|
+
|
|
80
|
+
## Cloud Tasks
|
|
81
|
+
|
|
82
|
+
| V1 Trigger | V2 Equivalent | Destructuring Pattern |
|
|
83
|
+
| :------------------------------- | :------------------- | :---------------------- |
|
|
84
|
+
| `tasks.taskQueue().onDispatch()` | `onTaskDispatched()` | Access `event` directly |
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
name: firebase-ai-logic-basics
|
|
3
3
|
description: Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.
|
|
4
4
|
version: 1.0.1
|
|
5
|
+
metadata:
|
|
6
|
+
category: AiAndMachineLearning
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Firebase AI Logic Basics
|
|
@@ -16,25 +18,25 @@ of Google's AI integration platform for mobile and web developers.
|
|
|
16
18
|
|
|
17
19
|
It supports the two Gemini API providers:
|
|
18
20
|
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
21
|
+
- **Gemini Developer API**: It has a free tier ideal for prototyping, and
|
|
22
|
+
pay-as-you-go for production
|
|
23
|
+
- **Agent Platform Gemini API** (formerly branded Vertex AI): Ideal for scale
|
|
24
|
+
with enterprise-grade production readiness, requires Blaze plan
|
|
23
25
|
|
|
24
|
-
Use the Gemini Developer API as a default, and only
|
|
25
|
-
application requires it.
|
|
26
|
+
Use the Gemini Developer API as a default, and only Agent Platform Gemini API
|
|
27
|
+
(formerly branded Vertex AI) if the application requires it.
|
|
26
28
|
|
|
27
29
|
## Setup & Initialization
|
|
28
30
|
|
|
29
31
|
### Prerequisites
|
|
30
32
|
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
- Before starting, ensure you have **Node.js 16+** and npm installed. Install
|
|
34
|
+
them if they aren’t already available.
|
|
35
|
+
- Identify the platform the user is interested in building on prior to
|
|
36
|
+
starting: Android, iOS, Flutter or Web.
|
|
37
|
+
- If their platform is unsupported, Direct the user to Firebase Docs to learn
|
|
38
|
+
how to set up AI Logic for their application (share this link with the user
|
|
39
|
+
https://firebase.google.com/docs/ai-logic/get-started)
|
|
38
40
|
|
|
39
41
|
### Installation
|
|
40
42
|
|
|
@@ -95,7 +97,7 @@ faster display of results.
|
|
|
95
97
|
> [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt)
|
|
96
98
|
> for the currently supported image generation (Nano Banana) model names.
|
|
97
99
|
|
|
98
|
-
-
|
|
100
|
+
- Requires an upgraded Blaze pay-as-you-go billing plan.
|
|
99
101
|
|
|
100
102
|
### Search Grounding with the built in googleSearch tool
|
|
101
103
|
|
|
@@ -130,6 +132,36 @@ See
|
|
|
130
132
|
[App Check with reCAPTCHA Enterprise](https://firebase.google.com/docs/app-check/web/recaptcha-enterprise-provider.md.txt)
|
|
131
133
|
for setup instructions.
|
|
132
134
|
|
|
135
|
+
#### App Check Debug Tokens for Local Development & CI/CD
|
|
136
|
+
|
|
137
|
+
Because App Check attestation providers (like Play Integrity or DeviceCheck)
|
|
138
|
+
reject emulators, simulators, or CI environments, you must use **App Check Debug
|
|
139
|
+
Tokens** during development and testing to bypass standard attestation.
|
|
140
|
+
|
|
141
|
+
##### Local Development (Auto-Generated)
|
|
142
|
+
|
|
143
|
+
1. Configure your code's App Check provider to use the debug factory:
|
|
144
|
+
* **Web**: Set `self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;` before
|
|
145
|
+
initializing App Check.
|
|
146
|
+
* **Android**: Install `DebugAppCheckProviderFactory.getInstance()`.
|
|
147
|
+
* **iOS**: Set provider factory to `AppCheckDebugProviderFactory()`.
|
|
148
|
+
2. Run your app in the emulator/localhost.
|
|
149
|
+
3. Look at your runtime debugger console / Logcat logs for the generated UUID:
|
|
150
|
+
* *Example:* `AppCheck debug token:
|
|
151
|
+
"123a4567-b89c-12d3-e456-789012345678"`
|
|
152
|
+
4. Register this token in the Firebase Console under **Security > App Check >
|
|
153
|
+
Apps > Manage debug tokens**.
|
|
154
|
+
|
|
155
|
+
##### CI/CD Pipelines (Pre-Provisioned)
|
|
156
|
+
|
|
157
|
+
1. Generate and register a new debug token in the Firebase Console under
|
|
158
|
+
**Security > App Check > Apps > Manage debug tokens**.
|
|
159
|
+
2. Add this token string as an encrypted secret in your CI system (e.g.
|
|
160
|
+
`APP_CHECK_DEBUG_TOKEN`).
|
|
161
|
+
3. Configure your build to pass this secret as an environment variable to the
|
|
162
|
+
SDK during test execution (e.g. `self.FIREBASE_APPCHECK_DEBUG_TOKEN =
|
|
163
|
+
process.env.APP_CHECK_DEBUG_TOKEN`).
|
|
164
|
+
|
|
133
165
|
### Remote Config
|
|
134
166
|
|
|
135
167
|
Consider that you do not need to hardcode model names (e.g., a specific model
|
|
@@ -145,11 +177,21 @@ without deploying new client code. See
|
|
|
145
177
|
|
|
146
178
|
## Initialization Code References
|
|
147
179
|
|
|
148
|
-
| Language,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
|
152
|
-
|
|
|
180
|
+
| Language, | Gemini API | Context URL |
|
|
181
|
+
: Framework, : provider : :
|
|
182
|
+
: Platform : : :
|
|
183
|
+
| :---------- | :--------- | :---------------------------------------------- |
|
|
184
|
+
| Web Modular | Gemini | firebase://docs/ai-logic/get-started |
|
|
185
|
+
: API : Developer : :
|
|
186
|
+
: : API : :
|
|
187
|
+
: : (Developer : :
|
|
188
|
+
: : API) : :
|
|
189
|
+
| iOS (Swift) | Gemini | [ios_setup.md](references/ios_setup.md) |
|
|
190
|
+
: : Developer : :
|
|
191
|
+
: : API : :
|
|
192
|
+
| Flutter | Gemini | [flutter_setup.md](references/flutter_setup.md) |
|
|
193
|
+
: (Dart) : Developer : :
|
|
194
|
+
: : API : :
|
|
153
195
|
|
|
154
196
|
> [!WARNING] **CRITICAL: Use current model names:** Always check the
|
|
155
197
|
> [Firebase AI Logic Models documentation](https://firebase.google.com/docs/ai-logic/models.md.txt)
|