From 3dfaa1c66e8d4d80012393e6f50f974fa38fbac2 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 12:00:19 +0100 Subject: [PATCH 01/79] feat(storage): move to turbomodules --- packages/functions/package.json | 3 ++- yarn.lock | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/functions/package.json b/packages/functions/package.json index 22b9af6637..569881daef 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -27,7 +27,8 @@ "@react-native-firebase/app": "22.2.1" }, "devDependencies": { - "@react-native-firebase/private-tests-firebase-functions": "^0.0.1" + "@react-native-firebase/private-tests-firebase-functions": "^0.0.1", + "typescript": "^5.8.3" }, "publishConfig": { "access": "public", diff --git a/yarn.lock b/yarn.lock index 67dcedb4ff..3bceb15b59 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4785,6 +4785,7 @@ __metadata: resolution: "@react-native-firebase/functions@workspace:packages/functions" dependencies: "@react-native-firebase/private-tests-firebase-functions": "npm:^0.0.1" + typescript: "npm:^5.8.3" peerDependencies: "@react-native-firebase/app": 22.2.1 languageName: unknown From 9d896d2526c312ce5c52eb598d7fdb980ed3c303 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 13:41:36 +0100 Subject: [PATCH 02/79] chore: convert to TS --- packages/functions/lib/index.js | 2 +- packages/functions/lib/modular/index.d.ts | 57 --------- packages/functions/lib/modular/index.js | 85 -------------- packages/functions/lib/modular/index.ts | 135 ++++++++++++++++++++++ packages/functions/types.d.ts | 3 + 5 files changed, 139 insertions(+), 143 deletions(-) delete mode 100644 packages/functions/lib/modular/index.d.ts delete mode 100644 packages/functions/lib/modular/index.js create mode 100644 packages/functions/lib/modular/index.ts create mode 100644 packages/functions/types.d.ts diff --git a/packages/functions/lib/index.js b/packages/functions/lib/index.js index 0175b2c6a7..37dbd9d53c 100644 --- a/packages/functions/lib/index.js +++ b/packages/functions/lib/index.js @@ -200,7 +200,7 @@ export default createModuleNamespace({ ModuleClass: FirebaseFunctionsModule, }); -export * from './modular'; + // import functions, { firebase } from '@react-native-firebase/functions'; // functions().logEvent(...); diff --git a/packages/functions/lib/modular/index.d.ts b/packages/functions/lib/modular/index.d.ts deleted file mode 100644 index cee948f95f..0000000000 --- a/packages/functions/lib/modular/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { ReactNativeFirebase } from '@react-native-firebase/app'; -import { FirebaseFunctionsTypes } from '..'; - -import FirebaseApp = ReactNativeFirebase.FirebaseApp; -import Functions = FirebaseFunctionsTypes.Module; -import HttpsCallable = FirebaseFunctionsTypes.HttpsCallable; -import HttpsCallableOptions = FirebaseFunctionsTypes.HttpsCallableOptions; -import HttpsErrorCodeType = FirebaseFunctionsTypes.HttpsErrorCode; - -export const HttpsErrorCode: HttpsErrorCodeType; - -/** - * Get a {@link Functions} instance for the given app. - * @param {FirebaseApp | undefined} app - The FirebaseApp to use. Optional. - * @param {string | undefined} regionOrCustomDomain - One of: a) The region the callable functions are located in (ex: us-central1) b) A custom domain hosting the callable functions (ex: https://mydomain.com). optional - * @returns {Functions} Returns a {@link Functions} instance for the given app. - */ -export declare function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions; - -/** - * Modify this instance to communicate with the Cloud Functions emulator. - * Note: this must be called before this instance has been used to do any operations. - * @param {Functions} functionsInstance - * @param {string} host The emulator host. (ex: localhost) - * @param {number} port The emulator port. (ex: 5001) - */ -export declare function connectFunctionsEmulator( - functionsInstance: Functions, - host: string, - port: number, -): void; - -/** - * Returns a reference to the {@link HttpsCallable} trigger with the given name. - * @param {Functions} functionsInstance A functions instance. - * @param {string} name The name of the trigger. - * @param {HttpsCallableOptions | undefined} options An instance of {@link HttpsCallableOptions} containing metadata about how calls should be executed. - * @returns {HttpsCallable} - */ -export declare function httpsCallable( - functionsInstance: Functions, - name: string, - options?: HttpsCallableOptions, -): HttpsCallable; - -/** - * Returns a reference to the {@link HttpsCallable} trigger with the specified url. - * @param {Functions} functionsInstance A functions instance. - * @param {string} url The url of the trigger. - * @param {HttpsCallableOptions | undefined} options An instance of {@link HttpsCallableOptions} containing metadata about how calls should be executed. - * @returns {HttpsCallable} - */ -export declare function httpsCallableFromUrl( - functionsInstance: Functions, - url: string, - options?: HttpsCallableOptions, -): HttpsCallable; diff --git a/packages/functions/lib/modular/index.js b/packages/functions/lib/modular/index.js deleted file mode 100644 index 96a076a28b..0000000000 --- a/packages/functions/lib/modular/index.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2016-present Invertase Limited & Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this library except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -/** - * @typedef {import("..").FirebaseFunctionsTypes.Module} Functions - * @typedef {import("..").FirebaseFunctionsTypes.HttpsCallable} HttpsCallable - * @typedef {import("..").FirebaseFunctionsTypes.HttpsCallableOptions} HttpsCallableOptions - * @typedef {import("@firebase/app").FirebaseApp} FirebaseApp - */ - -import { getApp } from '@react-native-firebase/app'; -import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; - -/** - * Returns a Functions instance for the given app. - * @param {FirebaseApp | undefined} app - The FirebaseApp to use. Optional. - * @param {string | undefined} regionOrCustomDomain - One of: a) The region the callable functions are located in (ex: us-central1) b) A custom domain hosting the callable functions (ex: https://mydomain.com). Optional. - * @returns {Functions} - */ -export function getFunctions(app, regionOrCustomDomain) { - if (app) { - return getApp(app.name).functions(regionOrCustomDomain); - } - - return getApp().functions(regionOrCustomDomain); -} - -/** - * Modify this instance to communicate with the Cloud Functions emulator. - * Note: this must be called before this instance has been used to do any operations. - * @param {Functions} functionsInstance A functions instance. - * @param {string} host The emulator host. (ex: localhost) - * @param {number} port The emulator port. (ex: 5001) - * @returns {void} - */ -export function connectFunctionsEmulator(functionsInstance, host, port) { - return functionsInstance.useEmulator.call(functionsInstance, host, port, MODULAR_DEPRECATION_ARG); -} - -/** - * Returns a reference to the callable HTTPS trigger with the given name. - * @param {Functions} functionsInstance A functions instance. - * @param {string} name The name of the trigger. - * @param {HttpsCallableOptions | undefined} options An interface for metadata about how calls should be executed. - * @returns {HttpsCallable} - */ -export function httpsCallable(functionsInstance, name, options) { - return functionsInstance.httpsCallable.call( - functionsInstance, - name, - options, - MODULAR_DEPRECATION_ARG, - ); -} - -/** - * Returns a reference to the callable HTTPS trigger with the specified url. - * @param {Functions} functionsInstance A functions instance. - * @param {string} url The url of the trigger. - * @param {HttpsCallableOptions | undefined} options An instance of {@link HttpsCallableOptions} containing metadata about how calls should be executed. - * @returns {HttpsCallable} - */ -export function httpsCallableFromUrl(functionsInstance, url, options) { - return functionsInstance.httpsCallableFromUrl.call( - functionsInstance, - url, - options, - MODULAR_DEPRECATION_ARG, - ); -} - -export { HttpsErrorCode } from '../index'; diff --git a/packages/functions/lib/modular/index.ts b/packages/functions/lib/modular/index.ts new file mode 100644 index 0000000000..93a89c895d --- /dev/null +++ b/packages/functions/lib/modular/index.ts @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import { ReactNativeFirebase, getApp } from '@react-native-firebase/app'; +import { FirebaseFunctionsTypes } from '..'; +import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; + +import FirebaseApp = ReactNativeFirebase.FirebaseApp; +import Functions = FirebaseFunctionsTypes.Module; +import HttpsCallable = FirebaseFunctionsTypes.HttpsCallable; +import HttpsCallableOptions = FirebaseFunctionsTypes.HttpsCallableOptions; + +/** + * Returns a Functions instance for the given app. + * @param app - The FirebaseApp to use. Optional. + * @param regionOrCustomDomain - One of: a) The region the callable functions are located in (ex: us-central1) b) A custom domain hosting the callable functions (ex: https://mydomain.com). Optional. + * @returns Functions instance for the given app. + */ +export function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions { + if (app) { + return getApp(app.name).functions(regionOrCustomDomain); + } + + return getApp().functions(regionOrCustomDomain); +} + +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * Note: this must be called before this instance has been used to do any operations. + * @param functionsInstance A functions instance. + * @param host The emulator host. (ex: localhost) + * @param port The emulator port. (ex: 5001) + */ +export function connectFunctionsEmulator( + functionsInstance: Functions, + host: string, + port: number, +): void { + return functionsInstance.useEmulator.call(functionsInstance, host, port, MODULAR_DEPRECATION_ARG); +} + +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param functionsInstance A functions instance. + * @param name The name of the trigger. + * @param options An interface for metadata about how calls should be executed. + * @returns HttpsCallable instance + */ +export function httpsCallable( + functionsInstance: Functions, + name: string, + options?: HttpsCallableOptions, +): HttpsCallable { + return functionsInstance.httpsCallable.call( + functionsInstance, + name, + options, + MODULAR_DEPRECATION_ARG, + ); +} + +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param functionsInstance A functions instance. + * @param url The url of the trigger. + * @param options An instance of HttpsCallableOptions containing metadata about how calls should be executed. + * @returns HttpsCallable instance + */ +export function httpsCallableFromUrl( + functionsInstance: Functions, + url: string, + options?: HttpsCallableOptions, +): HttpsCallable { + return functionsInstance.httpsCallableFromUrl.call( + functionsInstance, + url, + options, + MODULAR_DEPRECATION_ARG, + ); +} + +// Define HttpsErrorCode locally to avoid circular imports +export const HttpsErrorCode = { + OK: 'ok', + CANCELLED: 'cancelled', + UNKNOWN: 'unknown', + INVALID_ARGUMENT: 'invalid-argument', + DEADLINE_EXCEEDED: 'deadline-exceeded', + NOT_FOUND: 'not-found', + ALREADY_EXISTS: 'already-exists', + PERMISSION_DENIED: 'permission-denied', + UNAUTHENTICATED: 'unauthenticated', + RESOURCE_EXHAUSTED: 'resource-exhausted', + FAILED_PRECONDITION: 'failed-precondition', + ABORTED: 'aborted', + OUT_OF_RANGE: 'out-of-range', + UNIMPLEMENTED: 'unimplemented', + INTERNAL: 'internal', + UNAVAILABLE: 'unavailable', + DATA_LOSS: 'data-loss', + // Web codes are lowercase dasherized. + ok: 'ok', + cancelled: 'cancelled', + unknown: 'unknown', + 'invalid-argument': 'invalid-argument', + 'deadline-exceeded': 'deadline-exceeded', + 'not-found': 'not-found', + 'already-exists': 'already-exists', + 'permission-denied': 'permission-denied', + unauthenticated: 'unauthenticated', + 'resource-exhausted': 'resource-exhausted', + 'failed-precondition': 'failed-precondition', + aborted: 'aborted', + 'out-of-range': 'out-of-range', + unimplemented: 'unimplemented', + internal: 'internal', + unavailable: 'unavailable', + 'data-loss': 'data-loss', +} as const; + +export * from '../index'; diff --git a/packages/functions/types.d.ts b/packages/functions/types.d.ts new file mode 100644 index 0000000000..16979e6a8c --- /dev/null +++ b/packages/functions/types.d.ts @@ -0,0 +1,3 @@ +declare module '@react-native-firebase/app/lib/common' { + export const MODULAR_DEPRECATION_ARG: string; +} From b80b1a77c262cd1dcf7c24ab076f35d40bd8eada Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 13:42:07 +0100 Subject: [PATCH 03/79] format --- packages/functions/lib/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/functions/lib/index.js b/packages/functions/lib/index.js index 37dbd9d53c..c859b1eab5 100644 --- a/packages/functions/lib/index.js +++ b/packages/functions/lib/index.js @@ -200,8 +200,6 @@ export default createModuleNamespace({ ModuleClass: FirebaseFunctionsModule, }); - - // import functions, { firebase } from '@react-native-firebase/functions'; // functions().logEvent(...); // firebase.functions().logEvent(...); From 1431fbf0f4fff100e794a1467f1c0898a06a5d25 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:08:19 +0100 Subject: [PATCH 04/79] chore: ignore some things for now --- packages/functions/lib/modular/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/functions/lib/modular/index.ts b/packages/functions/lib/modular/index.ts index 93a89c895d..713f891f33 100644 --- a/packages/functions/lib/modular/index.ts +++ b/packages/functions/lib/modular/index.ts @@ -17,6 +17,7 @@ import { ReactNativeFirebase, getApp } from '@react-native-firebase/app'; import { FirebaseFunctionsTypes } from '..'; +// @ts-ignore import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; import FirebaseApp = ReactNativeFirebase.FirebaseApp; @@ -50,6 +51,7 @@ export function connectFunctionsEmulator( host: string, port: number, ): void { + // @ts-ignore return functionsInstance.useEmulator.call(functionsInstance, host, port, MODULAR_DEPRECATION_ARG); } @@ -69,8 +71,9 @@ export function httpsCallable( functionsInstance, name, options, + // @ts-ignore MODULAR_DEPRECATION_ARG, - ); + ) as HttpsCallable; } /** @@ -89,8 +92,9 @@ export function httpsCallableFromUrl; } // Define HttpsErrorCode locally to avoid circular imports From cff1c5f98fffd9bc5484aa8cb09f882651615af4 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:08:35 +0100 Subject: [PATCH 05/79] chore: update package.json main & types --- packages/functions/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/functions/package.json b/packages/functions/package.json index 569881daef..b2d84a90e9 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -3,8 +3,8 @@ "version": "22.2.1", "author": "Invertase (http://invertase.io)", "description": "React Native Firebase - Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. React Native Firebase supports integration with production and locally emulated Cloud Functions with a simple API interface.\n\n", - "main": "lib/index.js", - "types": "lib/index.d.ts", + "main": "dist/module/index.js", + "types": "dist/module/index.d.ts", "scripts": { "build": "genversion --semi lib/version.js", "build:clean": "rimraf android/build && rimraf ios/build", From abd007387323cca6aaf1e6dee060bca107ec0768 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:10:22 +0100 Subject: [PATCH 06/79] init with bob builder --- packages/functions/package.json | 55 +++++++++++++++++++++++++++++--- packages/functions/tsconfig.json | 27 ++++++++++++++++ 2 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 packages/functions/tsconfig.json diff --git a/packages/functions/package.json b/packages/functions/package.json index b2d84a90e9..c2858b8e07 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -3,12 +3,13 @@ "version": "22.2.1", "author": "Invertase (http://invertase.io)", "description": "React Native Firebase - Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. React Native Firebase supports integration with production and locally emulated Cloud Functions with a simple API interface.\n\n", - "main": "dist/module/index.js", - "types": "dist/module/index.d.ts", + "main": "./dist/commonjs/index.js", + "types": "./dist/typescript/commonjs/lib/modular/index.d.ts", "scripts": { "build": "genversion --semi lib/version.js", "build:clean": "rimraf android/build && rimraf ios/build", - "prepare": "yarn run build" + "compile": "bob build", + "prepare": "yarn compile && yarn run build" }, "repository": { "type": "git", @@ -28,10 +29,56 @@ }, "devDependencies": { "@react-native-firebase/private-tests-firebase-functions": "^0.0.1", + "react-native-builder-bob": "^0.40.12", "typescript": "^5.8.3" }, "publishConfig": { "access": "public", "provenance": true - } + }, + "exports": { + ".": { + "source": "./lib/modular/index.ts", + "import": { + "types": "./dist/typescript/module/lib/modular/index.d.ts", + "default": "./dist/module/index.js" + }, + "require": { + "types": "./dist/typescript/commonjs/lib/modular/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./package.json": "./package.json" + }, + "module": "./dist/module/index.js", + "files": [ + "lib/modular", + "dist", + "!**/__tests__", + "!**/__fixtures__", + "!**/__mocks__" + ], + "react-native-builder-bob": { + "source": "lib/modular", + "output": "dist", + "targets": [ + [ + "module", + { + "esm": true + } + ], + [ + "commonjs", + { + "esm": true + } + ], + "typescript" + ] + }, + "eslintIgnore": [ + "node_modules/", + "dist/" + ] } diff --git a/packages/functions/tsconfig.json b/packages/functions/tsconfig.json new file mode 100644 index 0000000000..b89df98d6a --- /dev/null +++ b/packages/functions/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "rootDir": ".", + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-jsx", + "lib": [ + "ESNext" + ], + "module": "ESNext", + "moduleResolution": "bundler", + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "noImplicitUseStrict": false, + "noStrictGenericChecks": false, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true, + "target": "ESNext", + "verbatimModuleSyntax": true + } +} From 9f30fa87e6fd172b310e6e5fb053ef28e6447d8b Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:21:40 +0100 Subject: [PATCH 07/79] yarn.lock --- yarn.lock | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index 3bceb15b59..d4e82543fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -291,6 +291,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-plugin-utils@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/helper-plugin-utils@npm:7.27.1" + checksum: 10/96136c2428888e620e2ec493c25888f9ceb4a21099dcf3dd4508ea64b58cdedbd5a9fb6c7b352546de84d6c24edafe482318646932a22c449ebd16d16c22d864 + languageName: node + linkType: hard + "@babel/helper-remap-async-to-generator@npm:^7.25.9": version: 7.25.9 resolution: "@babel/helper-remap-async-to-generator@npm:7.25.9" @@ -656,6 +663,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-syntax-flow@npm:^7.27.1": + version: 7.27.1 + resolution: "@babel/plugin-syntax-flow@npm:7.27.1" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.27.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10/7baca3171ed595d04c865b0ce46fca7f21900686df9d7fcd1017036ce78bb5483e33803de810831e68d39cf478953db69f49ae3f3de2e3207bc4ba49a96b6739 + languageName: node + linkType: hard + "@babel/plugin-syntax-import-assertions@npm:^7.26.0": version: 7.26.0 resolution: "@babel/plugin-syntax-import-assertions@npm:7.26.0" @@ -1024,6 +1042,18 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-flow-strip-types@npm:^7.26.5": + version: 7.27.1 + resolution: "@babel/plugin-transform-flow-strip-types@npm:7.27.1" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.27.1" + "@babel/plugin-syntax-flow": "npm:^7.27.1" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10/22e260866b122b7d0c35f2c55b2d422b175606b4d14c9ba116b1fbe88e08cc8b024c1c41bb62527cfc5f7ccc0ed06c752e5945cb1ee22465a30aa5623e617940 + languageName: node + linkType: hard + "@babel/plugin-transform-for-of@npm:^7.24.7": version: 7.25.9 resolution: "@babel/plugin-transform-for-of@npm:7.25.9" @@ -4785,6 +4815,7 @@ __metadata: resolution: "@react-native-firebase/functions@workspace:packages/functions" dependencies: "@react-native-firebase/private-tests-firebase-functions": "npm:^0.0.1" + react-native-builder-bob: "npm:^0.40.12" typescript: "npm:^5.8.3" peerDependencies: "@react-native-firebase/app": 22.2.1 @@ -7019,6 +7050,15 @@ __metadata: languageName: node linkType: hard +"babel-plugin-syntax-hermes-parser@npm:^0.28.0": + version: 0.28.1 + resolution: "babel-plugin-syntax-hermes-parser@npm:0.28.1" + dependencies: + hermes-parser: "npm:0.28.1" + checksum: 10/2cbc921e663463480ead9ccc8bb229a5196032367ba2b5ccb18a44faa3afa84b4dc493297749983b9a837a3d76b0b123664aecc06f9122618c3246f03e076a9d + languageName: node + linkType: hard + "babel-plugin-transform-flow-enums@npm:^0.0.2": version: 0.0.2 resolution: "babel-plugin-transform-flow-enums@npm:0.0.2" @@ -9881,7 +9921,7 @@ __metadata: languageName: node linkType: hard -"escape-string-regexp@npm:5.0.0": +"escape-string-regexp@npm:5.0.0, escape-string-regexp@npm:^5.0.0": version: 5.0.0 resolution: "escape-string-regexp@npm:5.0.0" checksum: 10/20daabe197f3cb198ec28546deebcf24b3dbb1a5a269184381b3116d12f0532e06007f4bc8da25669d6a7f8efb68db0758df4cd981f57bc5b57f521a3e12c59e @@ -10565,7 +10605,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.3.0": +"fast-glob@npm:^3.3.0, fast-glob@npm:^3.3.3": version: 3.3.3 resolution: "fast-glob@npm:3.3.3" dependencies: @@ -12226,6 +12266,13 @@ __metadata: languageName: node linkType: hard +"hermes-estree@npm:0.28.1": + version: 0.28.1 + resolution: "hermes-estree@npm:0.28.1" + checksum: 10/3195a1aa7035d96b77839e6bfd6832b51830518aaf8dabfca11248b84d6fb6abd27e21c8caa84229954a76b4f8a1e346b65d421a4daecd3053bd2ea08fe6abc9 + languageName: node + linkType: hard + "hermes-parser@npm:0.23.1": version: 0.23.1 resolution: "hermes-parser@npm:0.23.1" @@ -12244,6 +12291,15 @@ __metadata: languageName: node linkType: hard +"hermes-parser@npm:0.28.1": + version: 0.28.1 + resolution: "hermes-parser@npm:0.28.1" + dependencies: + hermes-estree: "npm:0.28.1" + checksum: 10/cb2aa4d386929825c3bd8184eeb4e3dcf34892c1f850624d09a80aee0674bc2eb135eccaeb7ac33675552130229ee6160025c4e4f351d6a61b503bd8bfdf63f5 + languageName: node + linkType: hard + "highlight.js@npm:^10.7.1": version: 10.7.3 resolution: "highlight.js@npm:10.7.3" @@ -19201,6 +19257,38 @@ __metadata: languageName: node linkType: hard +"react-native-builder-bob@npm:^0.40.12": + version: 0.40.12 + resolution: "react-native-builder-bob@npm:0.40.12" + dependencies: + "@babel/core": "npm:^7.25.2" + "@babel/plugin-transform-flow-strip-types": "npm:^7.26.5" + "@babel/plugin-transform-strict-mode": "npm:^7.24.7" + "@babel/preset-env": "npm:^7.25.2" + "@babel/preset-react": "npm:^7.24.7" + "@babel/preset-typescript": "npm:^7.24.7" + arktype: "npm:^2.1.15" + babel-plugin-syntax-hermes-parser: "npm:^0.28.0" + browserslist: "npm:^4.20.4" + cross-spawn: "npm:^7.0.3" + dedent: "npm:^0.7.0" + del: "npm:^6.1.1" + escape-string-regexp: "npm:^4.0.0" + fs-extra: "npm:^10.1.0" + glob: "npm:^8.0.3" + is-git-dirty: "npm:^2.0.1" + json5: "npm:^2.2.1" + kleur: "npm:^4.1.4" + prompts: "npm:^2.4.2" + react-native-monorepo-config: "npm:^0.1.8" + which: "npm:^2.0.2" + yargs: "npm:^17.5.1" + bin: + bob: bin/bob + checksum: 10/99ae5c952276d93c271542e1075c3d9409d1b9068f2e0d2f7cb0a0a04d51437a95a3848cf7cfc3edd024df185d7089961ed17a540c6001ed8fbdd6df46956da4 + languageName: node + linkType: hard + "react-native-builder-bob@npm:^0.40.6": version: 0.40.6 resolution: "react-native-builder-bob@npm:0.40.6" @@ -19403,6 +19491,16 @@ __metadata: languageName: node linkType: hard +"react-native-monorepo-config@npm:^0.1.8": + version: 0.1.9 + resolution: "react-native-monorepo-config@npm:0.1.9" + dependencies: + escape-string-regexp: "npm:^5.0.0" + fast-glob: "npm:^3.3.3" + checksum: 10/c92d339ab592488996f77a49cc97d0ab8b1d528fb2d15001c255aa03eea48e013175cdaaddc2bb8b1ebdee620448bcf1901410996aaaf4a5fea470a2e354b0c2 + languageName: node + linkType: hard + "react-native@npm:*": version: 0.77.0 resolution: "react-native@npm:0.77.0" From 18c0fdfd703b116eefe3566faf16ccabd1c95c15 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:25:27 +0100 Subject: [PATCH 08/79] chore: rm rootDir from tsconfig.json --- packages/functions/package.json | 2 +- packages/functions/tsconfig.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/functions/package.json b/packages/functions/package.json index c2858b8e07..7b1adadae6 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -4,6 +4,7 @@ "author": "Invertase (http://invertase.io)", "description": "React Native Firebase - Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. React Native Firebase supports integration with production and locally emulated Cloud Functions with a simple API interface.\n\n", "main": "./dist/commonjs/index.js", + "module": "./dist/module/index.js", "types": "./dist/typescript/commonjs/lib/modular/index.d.ts", "scripts": { "build": "genversion --semi lib/version.js", @@ -50,7 +51,6 @@ }, "./package.json": "./package.json" }, - "module": "./dist/module/index.js", "files": [ "lib/modular", "dist", diff --git a/packages/functions/tsconfig.json b/packages/functions/tsconfig.json index b89df98d6a..893362b86f 100644 --- a/packages/functions/tsconfig.json +++ b/packages/functions/tsconfig.json @@ -1,6 +1,5 @@ { "compilerOptions": { - "rootDir": ".", "allowUnreachableCode": false, "allowUnusedLabels": false, "esModuleInterop": true, From 800bf1abd6037fd47cadb81e4105b0198311f0a6 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:25:40 +0100 Subject: [PATCH 09/79] test: import as type for tests --- packages/functions/__tests__/functions.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/functions/__tests__/functions.test.ts b/packages/functions/__tests__/functions.test.ts index 0e1af414a8..c66d545a62 100644 --- a/packages/functions/__tests__/functions.test.ts +++ b/packages/functions/__tests__/functions.test.ts @@ -11,7 +11,7 @@ import functions, { import { createCheckV9Deprecation, - CheckV9DeprecationFunction, + type CheckV9DeprecationFunction, } from '../../app/lib/common/unitTestUtils'; // @ts-ignore test From 196277789a878bf728e31af10284eefab6a57f62 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:37:09 +0100 Subject: [PATCH 10/79] chore: fix types --- packages/functions/lib/modular/index.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/functions/lib/modular/index.ts b/packages/functions/lib/modular/index.ts index 713f891f33..e7ed50cb5c 100644 --- a/packages/functions/lib/modular/index.ts +++ b/packages/functions/lib/modular/index.ts @@ -15,15 +15,19 @@ * */ -import { ReactNativeFirebase, getApp } from '@react-native-firebase/app'; -import { FirebaseFunctionsTypes } from '..'; +import { getApp } from '@react-native-firebase/app'; +import type { ReactNativeFirebase } from '@react-native-firebase/app'; +import type { FirebaseFunctionsTypes } from '..'; // @ts-ignore import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; -import FirebaseApp = ReactNativeFirebase.FirebaseApp; -import Functions = FirebaseFunctionsTypes.Module; -import HttpsCallable = FirebaseFunctionsTypes.HttpsCallable; -import HttpsCallableOptions = FirebaseFunctionsTypes.HttpsCallableOptions; +type FirebaseApp = ReactNativeFirebase.FirebaseApp; +type Functions = FirebaseFunctionsTypes.Module; +type HttpsCallable< + RequestData = unknown, + ResponseData = unknown, +> = FirebaseFunctionsTypes.HttpsCallable; +type HttpsCallableOptions = FirebaseFunctionsTypes.HttpsCallableOptions; /** * Returns a Functions instance for the given app. From 4dd309f62ecd7363ce90532cffc56b5e38be16a7 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:56:16 +0100 Subject: [PATCH 11/79] update types --- packages/functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/functions/package.json b/packages/functions/package.json index 7b1adadae6..955350b07f 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -5,7 +5,7 @@ "description": "React Native Firebase - Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. React Native Firebase supports integration with production and locally emulated Cloud Functions with a simple API interface.\n\n", "main": "./dist/commonjs/index.js", "module": "./dist/module/index.js", - "types": "./dist/typescript/commonjs/lib/modular/index.d.ts", + "types": "./dist/typescript/commonjs/functions/lib/modular/index.d.ts", "scripts": { "build": "genversion --semi lib/version.js", "build:clean": "rimraf android/build && rimraf ios/build", From 193aa9b0428669d75801d5049200039149726044 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:56:22 +0100 Subject: [PATCH 12/79] rm type test --- packages/functions/type-test.ts | 43 --------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 packages/functions/type-test.ts diff --git a/packages/functions/type-test.ts b/packages/functions/type-test.ts deleted file mode 100644 index 44a1b399d0..0000000000 --- a/packages/functions/type-test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import firebase, { FirebaseFunctionsTypes } from '.'; - -console.log(firebase().app); - -// checks module exists at root -console.log(firebase.functions().app.name); - -// checks module exists at app level -console.log(firebase.app().functions().app.name); - -// app level module accepts string arg -console.log(firebase.app().functions('some-string').app.name); -console.log(firebase.app().functions('some-string').httpsCallable('foo')); - -// checks statics exist -console.log(firebase.functions.SDK_VERSION); - -// checks statics exist on defaultExport -console.log(firebase.firebase.SDK_VERSION); - -// checks root exists -console.log(firebase.SDK_VERSION); - -// checks multi-app support exists -console.log(firebase.functions(firebase.app()).app.name); - -// checks default export supports app arg -console.log(firebase.functions(firebase.app('foo')).app.name); - -console.log(firebase.functions.HttpsErrorCode.ABORTED); - -firebase - .functions() - .httpsCallable('foo')(123) - .then((result: FirebaseFunctionsTypes.HttpsCallableResult) => { - console.log(result.data); - }) - .catch((error: { code: any; details: any }) => { - console.log(error.code); - console.log(error.details); - }); - -firebase.functions().useFunctionsEmulator('123'); From a49cf2713d7a2ec0a56bdaf53cf5d245fc019941 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 14:59:37 +0100 Subject: [PATCH 13/79] chore: fix path of type definitions --- packages/functions/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/functions/package.json b/packages/functions/package.json index 955350b07f..817491c26a 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -41,11 +41,11 @@ ".": { "source": "./lib/modular/index.ts", "import": { - "types": "./dist/typescript/module/lib/modular/index.d.ts", + "types": "./dist/typescript/module/functions/lib/modular/index.d.ts", "default": "./dist/module/index.js" }, "require": { - "types": "./dist/typescript/commonjs/lib/modular/index.d.ts", + "types": "./dist/typescript/commonjs/functions/lib/modular/index.d.ts", "default": "./dist/commonjs/index.js" } }, From 6b521296d0b01e451ba12ae6933c1187dfc2a441 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 2 Jul 2025 15:47:22 +0100 Subject: [PATCH 14/79] chore: moving functions to TS --- packages/functions/lib/HttpsError.ts | 57 +++++ packages/functions/lib/index.ts | 229 ++++++++++++++++++ .../functions/lib/web/RNFBFunctionsModule.ts | 160 ++++++++++++ packages/functions/types.d.ts | 47 ++++ 4 files changed, 493 insertions(+) create mode 100644 packages/functions/lib/HttpsError.ts create mode 100644 packages/functions/lib/index.ts create mode 100644 packages/functions/lib/web/RNFBFunctionsModule.ts diff --git a/packages/functions/lib/HttpsError.ts b/packages/functions/lib/HttpsError.ts new file mode 100644 index 0000000000..7ef0a5763d --- /dev/null +++ b/packages/functions/lib/HttpsError.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import { NativeFirebaseError } from '@react-native-firebase/app/lib/internal'; + +interface NativeErrorInstance { + jsStack?: string; +} + +export default class HttpsError extends Error { + readonly code!: string; + readonly details!: any; + readonly message!: string; + + constructor( + code: string, + message?: string, + details?: any, + nativeErrorInstance?: NativeErrorInstance, + ) { + super(message); + + Object.defineProperty(this, 'code', { + enumerable: false, + value: code, + }); + + Object.defineProperty(this, 'details', { + enumerable: false, + value: details, + }); + + Object.defineProperty(this, 'message', { + enumerable: false, + value: message, + }); + + this.stack = NativeFirebaseError.getStackWithMessage( + `Error: ${message}`, + nativeErrorInstance?.jsStack, + ); + } +} diff --git a/packages/functions/lib/index.ts b/packages/functions/lib/index.ts new file mode 100644 index 0000000000..cd011ec3a9 --- /dev/null +++ b/packages/functions/lib/index.ts @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import { isAndroid, isNumber } from '@react-native-firebase/app/lib/common'; +import { + createModuleNamespace, + FirebaseModule, + getFirebaseRoot, +} from '@react-native-firebase/app/lib/internal'; +import HttpsError from './HttpsError'; +import version from './version'; +import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule'; +import fallBackModule from './web/RNFBFunctionsModule'; + +const namespace = 'functions'; +const nativeModuleName = 'RNFBFunctionsModule'; + +export const HttpsErrorCode = { + OK: 'ok', + CANCELLED: 'cancelled', + UNKNOWN: 'unknown', + INVALID_ARGUMENT: 'invalid-argument', + DEADLINE_EXCEEDED: 'deadline-exceeded', + NOT_FOUND: 'not-found', + ALREADY_EXISTS: 'already-exists', + PERMISSION_DENIED: 'permission-denied', + UNAUTHENTICATED: 'unauthenticated', + RESOURCE_EXHAUSTED: 'resource-exhausted', + FAILED_PRECONDITION: 'failed-precondition', + ABORTED: 'aborted', + OUT_OF_RANGE: 'out-of-range', + UNIMPLEMENTED: 'unimplemented', + INTERNAL: 'internal', + UNAVAILABLE: 'unavailable', + DATA_LOSS: 'data-loss', + // Web codes are lowercase dasherized. + ok: 'ok', + cancelled: 'cancelled', + unknown: 'unknown', + 'invalid-argument': 'invalid-argument', + 'deadline-exceeded': 'deadline-exceeded', + 'not-found': 'not-found', + 'already-exists': 'already-exists', + 'permission-denied': 'permission-denied', + unauthenticated: 'unauthenticated', + 'resource-exhausted': 'resource-exhausted', + 'failed-precondition': 'failed-precondition', + aborted: 'aborted', + 'out-of-range': 'out-of-range', + unimplemented: 'unimplemented', + internal: 'internal', + unavailable: 'unavailable', + 'data-loss': 'data-loss', +} as const; + +const statics = { + HttpsErrorCode, +}; + +interface HttpsCallableOptions { + timeout?: number; +} + +interface NativeError { + userInfo?: { + code?: string; + message?: string; + details?: any; + }; + message?: string; +} + +class FirebaseFunctionsModule extends FirebaseModule { + private _customUrlOrRegion: string; + private _useFunctionsEmulatorHost: string | null; + private _useFunctionsEmulatorPort: number; + + constructor(...args: any[]) { + super(...args); + // @ts-ignore + this._customUrlOrRegion = this._customUrlOrRegion || 'us-central1'; + this._useFunctionsEmulatorHost = null; + this._useFunctionsEmulatorPort = -1; + } + + httpsCallable(name: string, options: HttpsCallableOptions = {}) { + if (options.timeout) { + if (isNumber(options.timeout)) { + options.timeout = options.timeout / 1000; + } else { + throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); + } + } + + return (data?: any) => { + const nativePromise = this.native.httpsCallable( + this._useFunctionsEmulatorHost, + this._useFunctionsEmulatorPort, + name, + { + data, + }, + options, + ); + return nativePromise.catch((nativeError: NativeError) => { + const { code, message, details } = nativeError.userInfo || {}; + return Promise.reject( + new HttpsError( + HttpsErrorCode[code as keyof typeof HttpsErrorCode] || HttpsErrorCode.UNKNOWN, + message || nativeError.message, + details || null, + nativeError, + ), + ); + }); + }; + } + + httpsCallableFromUrl(url: string, options: HttpsCallableOptions = {}) { + if (options.timeout) { + if (isNumber(options.timeout)) { + options.timeout = options.timeout / 1000; + } else { + throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); + } + } + + return (data?: any) => { + const nativePromise = this.native.httpsCallableFromUrl( + this._useFunctionsEmulatorHost, + this._useFunctionsEmulatorPort, + url, + { + data, + }, + options, + ); + return nativePromise.catch((nativeError: NativeError) => { + const { code, message, details } = nativeError.userInfo || {}; + return Promise.reject( + new HttpsError( + HttpsErrorCode[code as keyof typeof HttpsErrorCode] || HttpsErrorCode.UNKNOWN, + message || nativeError.message, + details || null, + nativeError, + ), + ); + }); + }; + } + + useFunctionsEmulator(origin: string): void { + const match = /https?\:.*\/\/([^:]+):?(\d+)?/.exec(origin); + if (!match) { + throw new Error('Invalid emulator origin format'); + } + const [, host, portStr] = match; + const port = portStr ? parseInt(portStr) : 5001; + this.useEmulator(host, port); + } + + useEmulator(host: string, port: number): void { + if (!isNumber(port)) { + throw new Error('useEmulator port parameter must be a number'); + } + + let _host = host; + + const androidBypassEmulatorUrlRemap = + typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' && + this.firebaseJson.android_bypass_emulator_url_remap; + if (!androidBypassEmulatorUrlRemap && isAndroid && _host) { + if (_host.startsWith('localhost')) { + _host = _host.replace('localhost', '10.0.2.2'); + // eslint-disable-next-line no-console + console.log( + 'Mapping functions host "localhost" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', + ); + } + if (_host.startsWith('127.0.0.1')) { + _host = _host.replace('127.0.0.1', '10.0.2.2'); + // eslint-disable-next-line no-console + console.log( + 'Mapping functions host "127.0.0.1" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', + ); + } + } + this._useFunctionsEmulatorHost = _host || null; + this._useFunctionsEmulatorPort = port || -1; + } +} + +// import { SDK_VERSION } from '@react-native-firebase/functions'; +export const SDK_VERSION = version; + +// import functions from '@react-native-firebase/functions'; +// functions().logEvent(...); +export default createModuleNamespace({ + statics, + version, + namespace, + nativeModuleName, + nativeEvents: false, + hasMultiAppSupport: true, + hasCustomUrlOrRegionSupport: true, + ModuleClass: FirebaseFunctionsModule, +}); + +// import functions, { firebase } from '@react-native-firebase/functions'; +// functions().logEvent(...); +// firebase.functions().logEvent(...); +export const firebase = getFirebaseRoot(); + +// Register the interop module for non-native platforms. +setReactNativeModule(nativeModuleName, fallBackModule); \ No newline at end of file diff --git a/packages/functions/lib/web/RNFBFunctionsModule.ts b/packages/functions/lib/web/RNFBFunctionsModule.ts new file mode 100644 index 0000000000..7a7ab72d80 --- /dev/null +++ b/packages/functions/lib/web/RNFBFunctionsModule.ts @@ -0,0 +1,160 @@ +import { + getApp, + getFunctions, + httpsCallable, + httpsCallableFromURL, + connectFunctionsEmulator, +} from '@react-native-firebase/app/lib/internal/web/firebaseFunctions'; + +interface WrapperData { + data?: any; +} + +interface CallableOptions { + [key: string]: any; +} + +interface NativeError { + code: string; + message: string; + userInfo: { + code: string; + message: string; + details?: any; + }; +} + +/** + * This is a 'NativeModule' for the web platform. + * Methods here are identical to the ones found in + * the native android/ios modules e.g. `@ReactMethod` annotated + * java methods on Android. + */ +export default { + /** + * Get and execute a Firebase Functions callable. + * @param appName - The name of the app to get the functions instance for. + * @param regionOrCustomDomain - The region or custom domain to use for the functions instance. + * @param host - The host to use for the functions emulator. + * @param port - The port to use for the functions emulator. + * @param name - The name of the functions callable. + * @param wrapper - The wrapper object to use for the functions callable. + * @param options - The options to use for the functions callable. + * @returns The result of the functions callable. + */ + async httpsCallable( + appName: string, + regionOrCustomDomain: string | null, + host: string | null, + port: number, + name: string, + wrapper: WrapperData, + options: CallableOptions, + ): Promise { + try { + const app = getApp(appName); + let functionsInstance; + if (regionOrCustomDomain) { + functionsInstance = getFunctions(app, regionOrCustomDomain); + // Hack to work around custom domain and region not being set on the instance. + if (regionOrCustomDomain.startsWith('http')) { + functionsInstance.customDomain = regionOrCustomDomain; + functionsInstance.region = 'us-central1'; + } else { + functionsInstance.region = regionOrCustomDomain; + functionsInstance.customDomain = null; + } + } else { + functionsInstance = getFunctions(app); + functionsInstance.region = 'us-central1'; + functionsInstance.customDomain = null; + } + if (host) { + connectFunctionsEmulator(functionsInstance, host, port); + // Hack to work around emulator origin not being set on the instance. + functionsInstance.emulatorOrigin = `http://${host}:${port}`; + } + let callable; + if (Object.keys(options).length) { + callable = httpsCallable(functionsInstance, name, options); + } else { + callable = httpsCallable(functionsInstance, name); + } + // if data is undefined use null, + const data = wrapper['data'] ?? null; + const result = await callable(data); + return result; + } catch (error: any) { + const { code, message, details } = error; + const nativeError: NativeError = { + code, + message, + userInfo: { + code: code ? code.replace('functions/', '') : 'unknown', + message, + details, + }, + }; + return Promise.reject(nativeError); + } + }, + + /** + * Get and execute a Firebase Functions callable from a URL. + * @param appName - The name of the app to get the functions instance for. + * @param regionOrCustomDomain - The region or custom domain to use for the functions instance. + * @param host - The host to use for the functions emulator. + * @param port - The port to use for the functions emulator. + * @param url - The URL to use for the functions callable. + * @param wrapper - The wrapper object to use for the functions callable. + * @param options - The options to use for the functions callable. + * @returns The result of the functions callable. + */ + async httpsCallableFromUrl( + appName: string, + regionOrCustomDomain: string | null, + host: string | null, + port: number, + url: string, + wrapper: WrapperData, + options: CallableOptions, + ): Promise { + try { + const app = getApp(appName); + let functionsInstance; + if (regionOrCustomDomain) { + functionsInstance = getFunctions(app, regionOrCustomDomain); + // Hack to work around custom domain and region not being set on the instance. + if (regionOrCustomDomain.startsWith('http')) { + functionsInstance.customDomain = regionOrCustomDomain; + } else { + functionsInstance.region = regionOrCustomDomain; + } + } else { + functionsInstance = getFunctions(app); + functionsInstance.region = 'us-central1'; + functionsInstance.customDomain = null; + } + if (host) { + connectFunctionsEmulator(functionsInstance, host, port); + // Hack to work around emulator origin not being set on the instance. + functionsInstance.emulatorOrigin = `http://${host}:${port}`; + } + const callable = httpsCallableFromURL(functionsInstance, url, options); + const result = await callable(wrapper['data']); + return result; + } catch (error: any) { + const { code, message, details } = error; + const nativeError: NativeError = { + code, + message, + userInfo: { + code: code ? code.replace('functions/', '') : 'unknown', + message, + details, + }, + }; + return Promise.reject(nativeError); + } + }, +}; diff --git a/packages/functions/types.d.ts b/packages/functions/types.d.ts index 16979e6a8c..7c11dd9c13 100644 --- a/packages/functions/types.d.ts +++ b/packages/functions/types.d.ts @@ -1,3 +1,50 @@ declare module '@react-native-firebase/app/lib/common' { export const MODULAR_DEPRECATION_ARG: string; + export const isAndroid: boolean; + export const isNumber: (value: any) => value is number; +} + +declare module '@react-native-firebase/app/lib/internal' { + export function createModuleNamespace(config: any): any; + export class FirebaseModule { + constructor(...args: any[]); + native: any; + firebaseJson: any; + } + export function getFirebaseRoot(): any; + export class NativeFirebaseError { + static getStackWithMessage(message: string, jsStack?: string): string; + } +} + +declare module '@react-native-firebase/app/lib/internal/nativeModule' { + export function setReactNativeModule(moduleName: string, module: any): void; +} + +declare module '@react-native-firebase/app/lib/internal/web/firebaseFunctions' { + export function getApp(appName: string): any; + export function getFunctions(app: any, regionOrCustomDomain?: string): any; + export function httpsCallable(functionsInstance: any, name: string, options?: any): any; + export function httpsCallableFromURL(functionsInstance: any, url: string, options?: any): any; + export function connectFunctionsEmulator( + functionsInstance: any, + host: string, + port: number, + ): void; +} + +declare module './HttpsError' { + export default class HttpsError extends Error { + constructor(code: string, message?: string, details?: any, nativeError?: any); + } +} + +declare module './version' { + const version: string; + export default version; +} + +declare module './web/RNFBFunctionsModule' { + const fallBackModule: any; + export default fallBackModule; } From 1214b3e4554374da13da1687826372e8648bf1b8 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 3 Jul 2025 09:01:44 +0100 Subject: [PATCH 15/79] fix: imports --- packages/functions/__tests__/functions.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/functions/__tests__/functions.test.ts b/packages/functions/__tests__/functions.test.ts index c66d545a62..0c1d700848 100644 --- a/packages/functions/__tests__/functions.test.ts +++ b/packages/functions/__tests__/functions.test.ts @@ -1,14 +1,15 @@ import { afterAll, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals'; -import functions, { +import { firebase, getFunctions, connectFunctionsEmulator, httpsCallable, httpsCallableFromUrl, HttpsErrorCode, -} from '../lib'; +} from '../lib/modular'; +import functions from '../lib'; import { createCheckV9Deprecation, type CheckV9DeprecationFunction, From 34138fa4a860336b72322edb4c8c21e3a4452af9 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 3 Jul 2025 09:35:39 +0100 Subject: [PATCH 16/79] fix some types --- packages/functions/lib/HttpsError.ts | 18 +++++++++--------- packages/functions/lib/index.ts | 15 +++------------ packages/functions/lib/modular/index.ts | 18 +++++++++--------- packages/functions/types.d.ts | 6 ------ 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/packages/functions/lib/HttpsError.ts b/packages/functions/lib/HttpsError.ts index 7ef0a5763d..0e95904fc6 100644 --- a/packages/functions/lib/HttpsError.ts +++ b/packages/functions/lib/HttpsError.ts @@ -17,21 +17,21 @@ import { NativeFirebaseError } from '@react-native-firebase/app/lib/internal'; -interface NativeErrorInstance { +export interface NativeError { + userInfo?: { + code?: string; + message?: string; + details?: any; + }; jsStack?: string; + message?: string; } - -export default class HttpsError extends Error { +export class HttpsError extends Error { readonly code!: string; readonly details!: any; readonly message!: string; - constructor( - code: string, - message?: string, - details?: any, - nativeErrorInstance?: NativeErrorInstance, - ) { + constructor(code: string, message?: string, details?: any, nativeErrorInstance?: NativeError) { super(message); Object.defineProperty(this, 'code', { diff --git a/packages/functions/lib/index.ts b/packages/functions/lib/index.ts index cd011ec3a9..456d164f37 100644 --- a/packages/functions/lib/index.ts +++ b/packages/functions/lib/index.ts @@ -21,7 +21,7 @@ import { FirebaseModule, getFirebaseRoot, } from '@react-native-firebase/app/lib/internal'; -import HttpsError from './HttpsError'; +import { HttpsError, type NativeError } from './HttpsError'; import version from './version'; import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule'; import fallBackModule from './web/RNFBFunctionsModule'; @@ -75,15 +75,6 @@ interface HttpsCallableOptions { timeout?: number; } -interface NativeError { - userInfo?: { - code?: string; - message?: string; - details?: any; - }; - message?: string; -} - class FirebaseFunctionsModule extends FirebaseModule { private _customUrlOrRegion: string; private _useFunctionsEmulatorHost: string | null; @@ -170,7 +161,7 @@ class FirebaseFunctionsModule extends FirebaseModule { } const [, host, portStr] = match; const port = portStr ? parseInt(portStr) : 5001; - this.useEmulator(host, port); + this.useEmulator(host as string, port); } useEmulator(host: string, port: number): void { @@ -226,4 +217,4 @@ export default createModuleNamespace({ export const firebase = getFirebaseRoot(); // Register the interop module for non-native platforms. -setReactNativeModule(nativeModuleName, fallBackModule); \ No newline at end of file +setReactNativeModule(nativeModuleName, fallBackModule); diff --git a/packages/functions/lib/modular/index.ts b/packages/functions/lib/modular/index.ts index e7ed50cb5c..74e1a74bd5 100644 --- a/packages/functions/lib/modular/index.ts +++ b/packages/functions/lib/modular/index.ts @@ -17,17 +17,17 @@ import { getApp } from '@react-native-firebase/app'; import type { ReactNativeFirebase } from '@react-native-firebase/app'; -import type { FirebaseFunctionsTypes } from '..'; // @ts-ignore import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; type FirebaseApp = ReactNativeFirebase.FirebaseApp; -type Functions = FirebaseFunctionsTypes.Module; -type HttpsCallable< - RequestData = unknown, - ResponseData = unknown, -> = FirebaseFunctionsTypes.HttpsCallable; -type HttpsCallableOptions = FirebaseFunctionsTypes.HttpsCallableOptions; +type Functions = any; // Will be properly typed once index.ts is converted +type HttpsCallable = ( + data?: RequestData | null, +) => Promise<{ data: ResponseData }>; +type HttpsCallableOptions = { + timeout?: number; +}; /** * Returns a Functions instance for the given app. @@ -37,10 +37,10 @@ type HttpsCallableOptions = FirebaseFunctionsTypes.HttpsCallableOptions; */ export function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions { if (app) { - return getApp(app.name).functions(regionOrCustomDomain); + return getApp(app.name).functions(regionOrCustomDomain) as Functions; } - return getApp().functions(regionOrCustomDomain); + return getApp().functions(regionOrCustomDomain) as Functions; } /** diff --git a/packages/functions/types.d.ts b/packages/functions/types.d.ts index 7c11dd9c13..4297e21d84 100644 --- a/packages/functions/types.d.ts +++ b/packages/functions/types.d.ts @@ -33,12 +33,6 @@ declare module '@react-native-firebase/app/lib/internal/web/firebaseFunctions' { ): void; } -declare module './HttpsError' { - export default class HttpsError extends Error { - constructor(code: string, message?: string, details?: any, nativeError?: any); - } -} - declare module './version' { const version: string; export default version; From 6802209da2c458b4bd6175de6850fca2ab437c40 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 3 Jul 2025 09:58:22 +0100 Subject: [PATCH 17/79] update types --- packages/functions/lib/index.ts | 20 ++++++++++++++++++++ packages/functions/lib/modular/index.ts | 13 +++---------- packages/functions/types.d.ts | 11 +++++++++++ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/packages/functions/lib/index.ts b/packages/functions/lib/index.ts index 456d164f37..2ad08b40ee 100644 --- a/packages/functions/lib/index.ts +++ b/packages/functions/lib/index.ts @@ -75,6 +75,26 @@ interface HttpsCallableOptions { timeout?: number; } +// Export types for use in modular API +export type { HttpsCallableOptions }; + +export interface HttpsCallable { + (data?: RequestData | null): Promise<{ data: ResponseData }>; +} + +export interface FunctionsModule { + httpsCallable( + name: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + httpsCallableFromUrl( + url: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + useFunctionsEmulator(origin: string): void; + useEmulator(host: string, port: number): void; +} + class FirebaseFunctionsModule extends FirebaseModule { private _customUrlOrRegion: string; private _useFunctionsEmulatorHost: string | null; diff --git a/packages/functions/lib/modular/index.ts b/packages/functions/lib/modular/index.ts index 74e1a74bd5..806c73f4f8 100644 --- a/packages/functions/lib/modular/index.ts +++ b/packages/functions/lib/modular/index.ts @@ -15,19 +15,12 @@ * */ -import { getApp } from '@react-native-firebase/app'; -import type { ReactNativeFirebase } from '@react-native-firebase/app'; -// @ts-ignore +import { getApp, type ReactNativeFirebase } from '@react-native-firebase/app'; +import type { FunctionsModule, HttpsCallable, HttpsCallableOptions } from '../index'; import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; type FirebaseApp = ReactNativeFirebase.FirebaseApp; -type Functions = any; // Will be properly typed once index.ts is converted -type HttpsCallable = ( - data?: RequestData | null, -) => Promise<{ data: ResponseData }>; -type HttpsCallableOptions = { - timeout?: number; -}; +type Functions = FunctionsModule; /** * Returns a Functions instance for the given app. diff --git a/packages/functions/types.d.ts b/packages/functions/types.d.ts index 4297e21d84..52f646860c 100644 --- a/packages/functions/types.d.ts +++ b/packages/functions/types.d.ts @@ -21,6 +21,17 @@ declare module '@react-native-firebase/app/lib/internal/nativeModule' { export function setReactNativeModule(moduleName: string, module: any): void; } +declare module '@react-native-firebase/app' { + export function getApp(name?: string): ReactNativeFirebase.FirebaseApp; + + namespace ReactNativeFirebase { + interface FirebaseApp { + functions(customUrlOrRegion?: string): any; + readonly name: string; + } + } +} + declare module '@react-native-firebase/app/lib/internal/web/firebaseFunctions' { export function getApp(appName: string): any; export function getFunctions(app: any, regionOrCustomDomain?: string): any; From a1cd58af514de9d37b6e8f7013dbc3753171da5b Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 3 Jul 2025 10:17:05 +0100 Subject: [PATCH 18/79] port over remaining types and delete js files --- packages/functions/lib/HttpsError.js | 44 --- packages/functions/lib/index.d.ts | 448 --------------------------- packages/functions/lib/index.js | 209 ------------- packages/functions/lib/index.ts | 92 ++++++ 4 files changed, 92 insertions(+), 701 deletions(-) delete mode 100644 packages/functions/lib/HttpsError.js delete mode 100644 packages/functions/lib/index.d.ts delete mode 100644 packages/functions/lib/index.js diff --git a/packages/functions/lib/HttpsError.js b/packages/functions/lib/HttpsError.js deleted file mode 100644 index 3c4a6e59d0..0000000000 --- a/packages/functions/lib/HttpsError.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-present Invertase Limited & Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this library except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { NativeFirebaseError } from '@react-native-firebase/app/lib/internal'; - -export default class HttpsError extends Error { - constructor(code, message, details, nativeErrorInstance) { - super(message); - - Object.defineProperty(this, 'code', { - enumerable: false, - value: code, - }); - - Object.defineProperty(this, 'details', { - enumerable: false, - value: details, - }); - - Object.defineProperty(this, 'message', { - enumerable: false, - value: message, - }); - - this.stack = NativeFirebaseError.getStackWithMessage( - `Error: ${this.message}`, - nativeErrorInstance.jsStack, - ); - } -} diff --git a/packages/functions/lib/index.d.ts b/packages/functions/lib/index.d.ts deleted file mode 100644 index cfa7323fba..0000000000 --- a/packages/functions/lib/index.d.ts +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (c) 2016-present Invertase Limited & Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this library except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { ReactNativeFirebase } from '@react-native-firebase/app'; - -/** - * Firebase Cloud Functions package for React Native. - * - * #### Example 1 - * - * Access the firebase export from the `functions` package: - * - * ```js - * import { firebase } from '@react-native-firebase/functions'; - * - * // firebase.functions().X - * ``` - * - * #### Example 2 - * - * Using the default export from the `functions` package: - * - * ```js - * import functions from '@react-native-firebase/functions'; - * - * // functions().X - * ``` - * - * #### Example 3 - * - * Using the default export from the `app` package: - * - * ```js - * import firebase from '@react-native-firebase/app'; - * import '@react-native-firebase/functions'; - * - * // firebase.functions().X - * ``` - * - * @firebase functions - */ -export namespace FirebaseFunctionsTypes { - /** - * The set of Firebase Functions status codes. - * - * The codes are the same at the ones exposed by [gRPC](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md). - * - * Possible values: - * - `cancelled`: The operation was cancelled (typically by the caller). - * - `unknown`: Unknown error or an error from a different error domain. - * - `invalid-argument`: Client specified an invalid argument. Note that this - * differs from `failed-precondition`. `invalid-argument` indicates - * arguments that are problematic regardless of the state of the system - * (e.g. an invalid field name). - * - `deadline-exceeded`: Deadline expired before operation could complete. - * For operations that change the state of the system, this error may be - * returned even if the operation has completed successfully. For example, - * a successful response from a server could have been delayed long enough - * for the deadline to expire. - * - `not-found`: Some requested document was not found. - * - `already-exists`: Some document that we attempted to create already - * exists. - * - `permission-denied`: The caller does not have permission to execute the - * specified operation. - * - `resource-exhausted`: Some resource has been exhausted, perhaps a - * per-user quota, or perhaps the entire file system is out of space. - * - `failed-precondition`: Operation was rejected because the system is not - * in a state required for the operation's execution. - * - `aborted`: The operation was aborted, typically due to a concurrency - * issue like transaction aborts, etc. - * - `out-of-range`: Operation was attempted past the valid range. - * - `unimplemented`: Operation is not implemented or not supported/enabled. - * - `internal`: Internal errors. Means some invariants expected by - * underlying system has been broken. If you see one of these errors, - * something is very broken. - * - `unavailable`: The service is currently unavailable. This is most likely - * a transient condition and may be corrected by retrying with a backoff. - * - `data-loss`: Unrecoverable data loss or corruption. - * - `unauthenticated`: The request does not have valid authentication - * credentials for the operation. - */ - import FirebaseModule = ReactNativeFirebase.FirebaseModule; - - export type FunctionsErrorCode = - | 'ok' - | 'cancelled' - | 'unknown' - | 'invalid-argument' - | 'deadline-exceeded' - | 'not-found' - | 'already-exists' - | 'permission-denied' - | 'resource-exhausted' - | 'failed-precondition' - | 'aborted' - | 'out-of-range' - | 'unimplemented' - | 'internal' - | 'unavailable' - | 'data-loss' - | 'unauthenticated'; - - /** - * An HttpsCallableResult wraps a single result from a function call. - */ - export interface HttpsCallableResult { - readonly data: ResponseData; - } - - /** - * An HttpsCallable is a reference to a "callable" http trigger in - * Google Cloud Functions. - * - * #### Example - * - * ```js - * // Create an HttpsCallable reference - * const reference = firebase.functions().httpsCallable('order'); - * - * try { - * const response = await reference({ - * id: '12345', - * }); - * } catch (e) { - * console.error(e); - * } - * ``` - */ - export interface HttpsCallable { - (data?: RequestData | null): Promise>; - } - - /** - * An interface for metadata about how calls should be executed. An instance of HttpsCallableOptions can be passed as the second argument to `firebase.functions().httpsCallable(name, httpsCallableOptions)`. - **/ - export interface HttpsCallableOptions { - /** - * The timeout property is the time in milliseconds after which to cancel if there is no response. Default is 70000. - * - * #### Example - * - *```js - * // The below will wait 7 seconds for a response from the cloud function before an error is thrown. - * try { - * const instance = firebase.functions().httpsCallable('order', { timeout: 7000 }); - * const response = await instance({ - * id: '12345', - * }); - * } catch (e) { - * console.log(e); - * } - * ``` - */ - timeout?: number; - } - - /** - * An HttpsError wraps a single error from a function call. - * - * #### Example - * - * ```js - * try { - * await firebase.functions().httpsCallable('order')(); - * } catch (httpsError) { - * console.log('Message', httpsError.message); - * - * // Check code - * if (httpsError.code === firebase.functions.HttpsErrorCode.NOT_FOUND) { - * console.error('Functions endpoint "order" not found'); - * } - * } - * ``` - */ - export interface HttpsError extends Error { - /** - * A standard error code that will be returned to the client. This also - * determines the HTTP status code of the response, as defined in code.proto. - * - * #### Example - * - * ```js - * try { - * await firebase.functions().httpsCallable('order')(); - * } catch (httpsError) { - * console.error(httpsError.code); - * } - * ``` - */ - readonly code: FunctionsErrorCode; - /** - * Extra data to be converted to JSON and included in the error response. - * - * ```js - * try { - * await firebase.functions().httpsCallable('order')(); - * } catch (httpsError) { - * if (httpsError.details) { - * console.error(httpsError.details); - * } - * } - * ``` - */ - readonly details?: any; - } - - /** - * The HttpsErrorCode interface provides access to all FunctionsErrorCode - * type aliases. - * - * #### Example - * - * ```js - * try { - * await firebase.functions().httpsCallable('order')(); - * } catch (httpsError) { - * switch(httpsError.code) { - * case firebase.functions.HttpsErrorCode.NOT_FOUND: - * console.error('Functions endpoint not found'); - * break; - * case firebase.functions.HttpsErrorCode.CANCELLED: - * console.error('The operation was cancelled'); - * break; - * default: - * console.error('An error occurred'); - * break; - * } - * } - * ``` - */ - export interface HttpsErrorCode { - OK: 'ok'; - CANCELLED: 'cancelled'; - UNKNOWN: 'unknown'; - INVALID_ARGUMENT: 'invalid-argument'; - DEADLINE_EXCEEDED: 'deadline-exceeded'; - NOT_FOUND: 'not-found'; - ALREADY_EXISTS: 'already-exists'; - PERMISSION_DENIED: 'permission-denied'; - UNAUTHENTICATED: 'unauthenticated'; - RESOURCE_EXHAUSTED: 'resource-exhausted'; - FAILED_PRECONDITION: 'failed-precondition'; - ABORTED: 'aborted'; - OUT_OF_RANGE: 'out-of-range'; - UNIMPLEMENTED: 'unimplemented'; - INTERNAL: 'internal'; - UNAVAILABLE: 'unavailable'; - DATA_LOSS: 'data-loss'; - } - - /** - * firebase.functions.X - */ - export interface Statics { - /** - * Uppercase + underscored variables of {@link functions.FunctionsErrorCode} - * - * #### Example - * - * ```js - * firebase.functions.HttpsErrorCode.OK; - * firebase.functions.HttpsErrorCode.NOT_FOUND; - * ``` - */ - HttpsErrorCode: HttpsErrorCode; - } - - /** - * The Firebase Cloud Functions service is available for the default app, a given app or a specified region. - * - * > The default functions region for all apps is `us-central1`. - * - * #### Example 1 - * - * Get the functions instance for the **default app**: - * - * ```js - * const functionsForDefaultApp = firebase.functions(); - * ``` - * - * #### Example 2 - * - * Get the functions instance for a **secondary app**: - * - * ```js - * const otherApp = firebase.app('otherApp'); - * const functionsForOtherApp = firebase.functions(otherApp); - * ``` - * - * #### Example 3 - * - * Get the functions instance for a **specific functions region**: - * - * ```js - * const defaultApp = firebase.app(); - * const functionsForRegion = defaultApp.functions('europe-west1'); - * - * const otherApp = firebase.app('otherApp'); - * const functionsForOtherAppRegion = otherApp.functions('europe-west1'); - * ``` - * - */ - export class Module extends FirebaseModule { - /** - * Returns a reference to the callable HTTPS trigger with the given name. - * - * #### Example - * - * ```js - * const reference = firebase.functions().httpsCallable('order'); - * - * try { - * const response = await reference({ - * id: '12345', - * }); - * } catch (e) { - * console.error(e); - * } - * ``` - * - * @param name The name of the https callable function. - * @return The `HttpsCallable` reference. - */ - httpsCallable( - name: string, - options?: HttpsCallableOptions, - ): HttpsCallable; - - /** - * Returns a reference to the callable HTTPS trigger with the specified url. - * - * #### Example - * - * ```js - * const reference = firebase.functions().httpsCallable('order'); - * - * try { - * const response = await reference({ - * id: '12345', - * }); - * } catch (e) { - * console.error(e); - * } - * ``` - * - * @param name The name of the https callable function. - * @return The `HttpsCallable` reference. - */ - httpsCallableFromUrl( - url: string, - options?: HttpsCallableOptions, - ): HttpsCallable; - - /** - * Changes this instance to point to a Cloud Functions emulator running locally. - * - * See https://firebase.google.com/docs/functions/local-emulator - * - * #### Example - * - * ```js - * if (__DEV__) { - * firebase.functions().useFunctionsEmulator('http://localhost:5001'); - * } - * ``` - * - * Note: on android, hosts 'localhost' and '127.0.0.1' are automatically remapped to '10.0.2.2' (the - * "host" computer IP address for android emulators) to make the standard development experience easy. - * If you want to use the emulator on a real android device, you will need to specify the actual host - * computer IP address. - * - * @deprecated prefer useEmulator instead - * @param origin url of the local emulator started via firebase tools "http://localhost:5001" - */ - useFunctionsEmulator(origin: string): void; - - /** - * Changes this instance to point to a Cloud Functions emulator running locally. - * - * See https://firebase.google.com/docs/functions/local-emulator - * - * #### Example - * - * ```js - * if (__DEV__) { - * firebase.functions().useEmulator('localhost', 5001); - * } - * ``` - * - * Note: on android, hosts 'localhost' and '127.0.0.1' are automatically remapped to '10.0.2.2' (the - * "host" computer IP address for android emulators) to make the standard development experience easy. - * If you want to use the emulator on a real android device, you will need to specify the actual host - * computer IP address. - * - * @param host hostname of the local emulator started via firebase tools, ex. "localhost" - * @param port port of the local emulator started via firebase tools, ex. 5001 - */ - useEmulator(host: string, port: number): void; - } -} - -declare const defaultExport: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp< - FirebaseFunctionsTypes.Module, - FirebaseFunctionsTypes.Statics ->; - -export const firebase: ReactNativeFirebase.Module & { - functions: typeof defaultExport; - app( - name?: string, - ): ReactNativeFirebase.FirebaseApp & { functions(): FirebaseFunctionsTypes.Module }; -}; - -export default defaultExport; - -export * from './modular'; - -/** - * Attach namespace to `firebase.` and `FirebaseApp.`. - */ -declare module '@react-native-firebase/app' { - namespace ReactNativeFirebase { - import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp; - interface Module { - functions: FirebaseModuleWithStaticsAndApp< - FirebaseFunctionsTypes.Module, - FirebaseFunctionsTypes.Statics - >; - } - interface FirebaseApp { - functions(customUrlOrRegion?: string): FirebaseFunctionsTypes.Module; - } - } -} diff --git a/packages/functions/lib/index.js b/packages/functions/lib/index.js deleted file mode 100644 index c859b1eab5..0000000000 --- a/packages/functions/lib/index.js +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2016-present Invertase Limited & Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this library except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { isAndroid, isNumber } from '@react-native-firebase/app/lib/common'; -import { - createModuleNamespace, - FirebaseModule, - getFirebaseRoot, -} from '@react-native-firebase/app/lib/internal'; -import HttpsError from './HttpsError'; -import version from './version'; -import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule'; -import fallBackModule from './web/RNFBFunctionsModule'; - -const namespace = 'functions'; -const nativeModuleName = 'RNFBFunctionsModule'; - -export const HttpsErrorCode = { - OK: 'ok', - CANCELLED: 'cancelled', - UNKNOWN: 'unknown', - INVALID_ARGUMENT: 'invalid-argument', - DEADLINE_EXCEEDED: 'deadline-exceeded', - NOT_FOUND: 'not-found', - ALREADY_EXISTS: 'already-exists', - PERMISSION_DENIED: 'permission-denied', - UNAUTHENTICATED: 'unauthenticated', - RESOURCE_EXHAUSTED: 'resource-exhausted', - FAILED_PRECONDITION: 'failed-precondition', - ABORTED: 'aborted', - OUT_OF_RANGE: 'out-of-range', - UNIMPLEMENTED: 'unimplemented', - INTERNAL: 'internal', - UNAVAILABLE: 'unavailable', - DATA_LOSS: 'data-loss', - // Web codes are lowercase dasherized. - ok: 'ok', - cancelled: 'cancelled', - unknown: 'unknown', - 'invalid-argument': 'invalid-argument', - 'deadline-exceeded': 'deadline-exceeded', - 'not-found': 'not-found', - 'already-exists': 'already-exists', - 'permission-denied': 'permission-denied', - unauthenticated: 'unauthenticated', - 'resource-exhausted': 'resource-exhausted', - 'failed-precondition': 'failed-precondition', - aborted: 'aborted', - 'out-of-range': 'out-of-range', - unimplemented: 'unimplemented', - internal: 'internal', - unavailable: 'unavailable', - 'data-loss': 'data-loss', -}; - -const statics = { - HttpsErrorCode, -}; - -class FirebaseFunctionsModule extends FirebaseModule { - constructor(...args) { - super(...args); - this._customUrlOrRegion = this._customUrlOrRegion || 'us-central1'; - this._useFunctionsEmulatorHost = null; - this._useFunctionsEmulatorPort = -1; - } - - httpsCallable(name, options = {}) { - if (options.timeout) { - if (isNumber(options.timeout)) { - options.timeout = options.timeout / 1000; - } else { - throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); - } - } - - return data => { - const nativePromise = this.native.httpsCallable( - this._useFunctionsEmulatorHost, - this._useFunctionsEmulatorPort, - name, - { - data, - }, - options, - ); - return nativePromise.catch(nativeError => { - const { code, message, details } = nativeError.userInfo || {}; - return Promise.reject( - new HttpsError( - HttpsErrorCode[code] || HttpsErrorCode.UNKNOWN, - message || nativeError.message, - details || null, - nativeError, - ), - ); - }); - }; - } - - httpsCallableFromUrl(url, options = {}) { - if (options.timeout) { - if (isNumber(options.timeout)) { - options.timeout = options.timeout / 1000; - } else { - throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); - } - } - - return data => { - const nativePromise = this.native.httpsCallableFromUrl( - this._useFunctionsEmulatorHost, - this._useFunctionsEmulatorPort, - url, - { - data, - }, - options, - ); - return nativePromise.catch(nativeError => { - const { code, message, details } = nativeError.userInfo || {}; - return Promise.reject( - new HttpsError( - HttpsErrorCode[code] || HttpsErrorCode.UNKNOWN, - message || nativeError.message, - details || null, - nativeError, - ), - ); - }); - }; - } - - useFunctionsEmulator(origin) { - [_, host, port] = /https?\:.*\/\/([^:]+):?(\d+)?/.exec(origin); - if (!port) { - port = 5001; - } - this.useEmulator(host, parseInt(port)); - } - - useEmulator(host, port) { - if (!isNumber(port)) { - throw new Error('useEmulator port parameter must be a number'); - } - - let _host = host; - - const androidBypassEmulatorUrlRemap = - typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' && - this.firebaseJson.android_bypass_emulator_url_remap; - if (!androidBypassEmulatorUrlRemap && isAndroid && _host) { - if (_host.startsWith('localhost')) { - _host = _host.replace('localhost', '10.0.2.2'); - // eslint-disable-next-line no-console - console.log( - 'Mapping functions host "localhost" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', - ); - } - if (_host.startsWith('127.0.0.1')) { - _host = _host.replace('127.0.0.1', '10.0.2.2'); - // eslint-disable-next-line no-console - console.log( - 'Mapping functions host "127.0.0.1" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', - ); - } - } - this._useFunctionsEmulatorHost = _host || null; - this._useFunctionsEmulatorPort = port || -1; - } -} - -// import { SDK_VERSION } from '@react-native-firebase/functions'; -export const SDK_VERSION = version; - -// import functions from '@react-native-firebase/functions'; -// functions().logEvent(...); -export default createModuleNamespace({ - statics, - version, - namespace, - nativeModuleName, - nativeEvents: false, - hasMultiAppSupport: true, - hasCustomUrlOrRegionSupport: true, - ModuleClass: FirebaseFunctionsModule, -}); - -// import functions, { firebase } from '@react-native-firebase/functions'; -// functions().logEvent(...); -// firebase.functions().logEvent(...); -export const firebase = getFirebaseRoot(); - -// Register the interop module for non-native platforms. -setReactNativeModule(nativeModuleName, fallBackModule); diff --git a/packages/functions/lib/index.ts b/packages/functions/lib/index.ts index 2ad08b40ee..a1c442dbf6 100644 --- a/packages/functions/lib/index.ts +++ b/packages/functions/lib/index.ts @@ -95,6 +95,83 @@ export interface FunctionsModule { useEmulator(host: string, port: number): void; } +// Export the complete FirebaseFunctionsTypes namespace +// eslint-disable-next-line @typescript-eslint/no-namespace +export namespace FirebaseFunctionsTypes { + export type FunctionsErrorCode = + | 'ok' + | 'cancelled' + | 'unknown' + | 'invalid-argument' + | 'deadline-exceeded' + | 'not-found' + | 'already-exists' + | 'permission-denied' + | 'resource-exhausted' + | 'failed-precondition' + | 'aborted' + | 'out-of-range' + | 'unimplemented' + | 'internal' + | 'unavailable' + | 'data-loss' + | 'unauthenticated'; + + export interface HttpsCallableResult { + readonly data: ResponseData; + } + + export interface HttpsCallable { + (data?: RequestData | null): Promise>; + } + + export interface HttpsCallableOptions { + timeout?: number; + } + + export interface HttpsError extends Error { + readonly code: FunctionsErrorCode; + readonly details?: any; + } + + export interface HttpsErrorCode { + OK: 'ok'; + CANCELLED: 'cancelled'; + UNKNOWN: 'unknown'; + INVALID_ARGUMENT: 'invalid-argument'; + DEADLINE_EXCEEDED: 'deadline-exceeded'; + NOT_FOUND: 'not-found'; + ALREADY_EXISTS: 'already-exists'; + PERMISSION_DENIED: 'permission-denied'; + UNAUTHENTICATED: 'unauthenticated'; + RESOURCE_EXHAUSTED: 'resource-exhausted'; + FAILED_PRECONDITION: 'failed-precondition'; + ABORTED: 'aborted'; + OUT_OF_RANGE: 'out-of-range'; + UNIMPLEMENTED: 'unimplemented'; + INTERNAL: 'internal'; + UNAVAILABLE: 'unavailable'; + DATA_LOSS: 'data-loss'; + } + + export interface Statics { + HttpsErrorCode: HttpsErrorCode; + } + + export interface Module { + httpsCallable( + name: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + httpsCallableFromUrl( + url: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + useFunctionsEmulator(origin: string): void; + useEmulator(host: string, port: number): void; + } +} + class FirebaseFunctionsModule extends FirebaseModule { private _customUrlOrRegion: string; private _useFunctionsEmulatorHost: string | null; @@ -238,3 +315,18 @@ export const firebase = getFirebaseRoot(); // Register the interop module for non-native platforms. setReactNativeModule(nativeModuleName, fallBackModule); + +export * from './modular'; + +// Module augmentation for @react-native-firebase/app +declare module '@react-native-firebase/app' { + // eslint-disable-next-line @typescript-eslint/no-namespace + namespace ReactNativeFirebase { + interface Module { + functions: any; + } + interface FirebaseApp { + functions(customUrlOrRegion?: string): FirebaseFunctionsTypes.Module; + } + } +} From bd27a05caf001d885011b9a255c25db34dd9fad7 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 3 Jul 2025 10:37:03 +0100 Subject: [PATCH 19/79] remove functions declaration --- packages/functions/lib/index.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/packages/functions/lib/index.ts b/packages/functions/lib/index.ts index a1c442dbf6..006963167a 100644 --- a/packages/functions/lib/index.ts +++ b/packages/functions/lib/index.ts @@ -317,16 +317,3 @@ export const firebase = getFirebaseRoot(); setReactNativeModule(nativeModuleName, fallBackModule); export * from './modular'; - -// Module augmentation for @react-native-firebase/app -declare module '@react-native-firebase/app' { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace ReactNativeFirebase { - interface Module { - functions: any; - } - interface FirebaseApp { - functions(customUrlOrRegion?: string): FirebaseFunctionsTypes.Module; - } - } -} From 3b645b1a550d8c300fe8569c94f24853e19179a4 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 3 Jul 2025 10:45:15 +0100 Subject: [PATCH 20/79] chore: create spec for turbomodules --- packages/functions/specs/functions-spec.ts | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 packages/functions/specs/functions-spec.ts diff --git a/packages/functions/specs/functions-spec.ts b/packages/functions/specs/functions-spec.ts new file mode 100644 index 0000000000..ad9d2c295a --- /dev/null +++ b/packages/functions/specs/functions-spec.ts @@ -0,0 +1,42 @@ +import type { TurboModule } from 'react-native'; +import { TurboModuleRegistry } from 'react-native'; + +export interface Spec extends TurboModule { + /** + * Calls a Cloud Function with the given name and data. + * + * @param emulatorHost - The emulator host (can be null) + * @param emulatorPort - The emulator port (can be -1 for no emulator) + * @param name - The name of the Cloud Function to call + * @param data - The data to pass to the function + * @param options - Additional options for the call + * @returns Promise that resolves with the function result + */ + httpsCallable( + emulatorHost: string | null, + emulatorPort: number, + name: string, + data: { data: any }, + options: { timeout?: number }, + ): Promise<{ data: any }>; + + /** + * Calls a Cloud Function using a full URL instead of just the function name. + * + * @param emulatorHost - The emulator host (can be null) + * @param emulatorPort - The emulator port (can be -1 for no emulator) + * @param url - The full URL of the Cloud Function + * @param data - The data to pass to the function + * @param options - Additional options for the call + * @returns Promise that resolves with the function result + */ + httpsCallableFromUrl( + emulatorHost: string | null, + emulatorPort: number, + url: string, + data: { data: any }, + options: { timeout?: number }, + ): Promise<{ data: any }>; +} + +export default TurboModuleRegistry.getEnforcing('RNFBFunctionsModule'); From 909b9632a18f984d0dac2a530b33f232106e2cf2 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Thu, 3 Jul 2025 11:29:23 +0100 Subject: [PATCH 21/79] rename spec --- .../functions/specs/{functions-spec.ts => RNFBFunctionsSpec.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/functions/specs/{functions-spec.ts => RNFBFunctionsSpec.ts} (100%) diff --git a/packages/functions/specs/functions-spec.ts b/packages/functions/specs/RNFBFunctionsSpec.ts similarity index 100% rename from packages/functions/specs/functions-spec.ts rename to packages/functions/specs/RNFBFunctionsSpec.ts From 98f387cf2bf14c6a88b7171aef933d73a7b4b43e Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 08:42:58 +0100 Subject: [PATCH 22/79] rm old version of cli --- package.json | 3 + packages/functions/package.json | 12 +- tests/package.json | 6 +- yarn.lock | 242 +++++++++++++++++++------------- 4 files changed, 164 insertions(+), 99 deletions(-) diff --git a/package.json b/package.json index 3d5e868ea4..03004b1612 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "lerna:clean": "lerna clean", "build:all:clean": "lerna run build:clean", "build:all:build": "lerna run build", + "codegen:all": "lerna run codegen", "lint": "yarn lint:js && yarn lint:android && yarn lint:ios:check", "lint:js": "eslint packages/* --max-warnings=0", "lint:android": "(google-java-format --set-exit-if-changed --replace --glob=\"packages/*/android/src/**/*.java\" || (echo \"\n\nandroid formatting error - please re-run\n\n\" && exit 1)) && (git diff --exit-code packages/*/android/src || (echo \"\n\nandroid files changed from linting, please examine and commit result\n\n\" && exit 1))", @@ -69,6 +70,8 @@ "@firebase/rules-unit-testing": "^4.0.1", "@inquirer/prompts": "^7.4.1", "@octokit/core": "^6.1.5", + "@react-native-community/cli": "18.0.0", + "@react-native/codegen": "^0.80.1", "@tsconfig/node-lts": "^22.0.1", "@types/react": "^19.0.0", "@types/react-native": "^0.73.0", diff --git a/packages/functions/package.json b/packages/functions/package.json index 817491c26a..7ca5bcb435 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -6,11 +6,21 @@ "main": "./dist/commonjs/index.js", "module": "./dist/module/index.js", "types": "./dist/typescript/commonjs/functions/lib/modular/index.d.ts", + "codegenConfig": { + "name": "RNFBFunctionsSpec", + "type": "modules", + "jsSrcsDir": "specs", + "includesGeneratedCode": true, + "android": { + "javaPackageName": "com.rnfb.functions" + } + }, "scripts": { "build": "genversion --semi lib/version.js", "build:clean": "rimraf android/build && rimraf ios/build", "compile": "bob build", - "prepare": "yarn compile && yarn run build" + "prepare": "yarn compile && yarn run build", + "codegen": "npx @react-native-community/cli codegen" }, "repository": { "type": "git", diff --git a/tests/package.json b/tests/package.json index c5947d025d..7a71261044 100644 --- a/tests/package.json +++ b/tests/package.json @@ -9,9 +9,9 @@ }, "dependencies": { "@react-native-async-storage/async-storage": "^2.1.2", - "@react-native-community/cli": "15.1.3", - "@react-native-community/cli-platform-android": "15.1.3", - "@react-native-community/cli-platform-ios": "15.1.3", + "@react-native-community/cli": "18.0.0", + "@react-native-community/cli-platform-android": "18.0.0", + "@react-native-community/cli-platform-ios": "18.0.0", "@react-native-firebase/analytics": "22.2.1", "@react-native-firebase/app": "22.2.1", "@react-native-firebase/app-check": "22.2.1", diff --git a/yarn.lock b/yarn.lock index d4e82543fd..dbe2d15bea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4498,74 +4498,65 @@ __metadata: languageName: node linkType: hard -"@react-native-community/cli-clean@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-clean@npm:15.1.3" +"@react-native-community/cli-clean@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-clean@npm:18.0.0" dependencies: - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-tools": "npm:18.0.0" chalk: "npm:^4.1.2" execa: "npm:^5.0.0" fast-glob: "npm:^3.3.2" - checksum: 10/5f06ed322708b8d87b83a6a8bc7172bac1e21a2d4eb7a902ac549c3d3d7a7690a4f557c7949379c6ce9dd50fb52781ee0039f16098727a82a91ce2e406b8f1a9 + checksum: 10/3db0c4bf741d4cf527bd9ba3febe676fa7e382be798dc63b5e2b6b7f9d85f38bde4890b64e7189deee18b6ae7d76a0e9515f23d20a672bf166419b0a8dc5bc34 languageName: node linkType: hard -"@react-native-community/cli-config-android@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-config-android@npm:15.1.3" +"@react-native-community/cli-config-android@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-config-android@npm:18.0.0" dependencies: - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-tools": "npm:18.0.0" chalk: "npm:^4.1.2" fast-glob: "npm:^3.3.2" fast-xml-parser: "npm:^4.4.1" - checksum: 10/ea59b9e662f1dfdd8c92e666bf38a80de553e63b645de6d8041b0dcd64d9313aadfd9ee162d778562c01c2350f09b84732572471ca7bb4e5574a27ab616fca28 + checksum: 10/8374e009062fec17aa6af54a22bcc7209830232ddfaf5f421153cc09765e49b7f4278319c14ac408a7665e5e90e8153f23d5a74029fc525bbdb05b2190ca70f4 languageName: node linkType: hard -"@react-native-community/cli-config-apple@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-config-apple@npm:15.1.3" +"@react-native-community/cli-config-apple@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-config-apple@npm:18.0.0" dependencies: - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-tools": "npm:18.0.0" chalk: "npm:^4.1.2" execa: "npm:^5.0.0" fast-glob: "npm:^3.3.2" - checksum: 10/2181cc5569a6fabf8051a751987c603d5ddf7cee9ec5b37c37005ab598dad15c8baf43981de9fa3cde0735c8a8aa231cdd78f6c2a004a6da23ae5c14dcaf2cbc + checksum: 10/c6f8d0ec3b137507061222762124b6204e04a713825c9b19becdc93bfd3dce4de248018af1424c0afe39aeecdc8fffd82fb6faa1b1d5e58635c75a08ae8093b0 languageName: node linkType: hard -"@react-native-community/cli-config@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-config@npm:15.1.3" +"@react-native-community/cli-config@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-config@npm:18.0.0" dependencies: - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-tools": "npm:18.0.0" chalk: "npm:^4.1.2" cosmiconfig: "npm:^9.0.0" deepmerge: "npm:^4.3.0" fast-glob: "npm:^3.3.2" joi: "npm:^17.2.1" - checksum: 10/c867f8ef1b48b0d4557be058e50f209db5d30e4d8629a21d412e1c8ea3da4a8eab9606f10cf746084ffc2eb47b20086e65507a0f6e36cf7536c188c7b6dd4464 + checksum: 10/0d1d94ddc83469dd0b26d96fc5078ee1cf79f955aa261f3facdecef792cdcd9169df44177c276d38ab2a119e153d52222e28ee13a76e562cd1e6973908ced8e3 languageName: node linkType: hard -"@react-native-community/cli-debugger-ui@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-debugger-ui@npm:15.1.3" +"@react-native-community/cli-doctor@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-doctor@npm:18.0.0" dependencies: - serve-static: "npm:^1.13.1" - checksum: 10/317d32e87581f1f9cec0d4e64877f526268f365a5b7d09e1b5b2684c15f7561d640da72ced2d7f82580511c7128d002566543e5d9f741fb8b1a64b66c10ef692 - languageName: node - linkType: hard - -"@react-native-community/cli-doctor@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-doctor@npm:15.1.3" - dependencies: - "@react-native-community/cli-config": "npm:15.1.3" - "@react-native-community/cli-platform-android": "npm:15.1.3" - "@react-native-community/cli-platform-apple": "npm:15.1.3" - "@react-native-community/cli-platform-ios": "npm:15.1.3" - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-config": "npm:18.0.0" + "@react-native-community/cli-platform-android": "npm:18.0.0" + "@react-native-community/cli-platform-apple": "npm:18.0.0" + "@react-native-community/cli-platform-ios": "npm:18.0.0" + "@react-native-community/cli-tools": "npm:18.0.0" chalk: "npm:^4.1.2" command-exists: "npm:^1.2.8" deepmerge: "npm:^4.3.0" @@ -4574,104 +4565,102 @@ __metadata: node-stream-zip: "npm:^1.9.1" ora: "npm:^5.4.1" semver: "npm:^7.5.2" - strip-ansi: "npm:^5.2.0" wcwidth: "npm:^1.0.1" yaml: "npm:^2.2.1" - checksum: 10/3e806b20ca38c51efddab7ee571788b957ee0ffc00b4886cef2e506a91b0be06f5f1524f50ddb618125ec683686e4fa8ba5222d07d751fa396f47725d2212b4d + checksum: 10/5d84604d9dc3b1a81d2e32e1226e0405bcb614eb93676067065d758cd8833d0b654ebb9c08ade03c3181165fe00bd7c7a5cfa3ca042a3fbd21b7ab782ece964c languageName: node linkType: hard -"@react-native-community/cli-platform-android@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-platform-android@npm:15.1.3" +"@react-native-community/cli-platform-android@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-platform-android@npm:18.0.0" dependencies: - "@react-native-community/cli-config-android": "npm:15.1.3" - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-config-android": "npm:18.0.0" + "@react-native-community/cli-tools": "npm:18.0.0" chalk: "npm:^4.1.2" execa: "npm:^5.0.0" logkitty: "npm:^0.7.1" - checksum: 10/8ddfa18a11c6cf9e9b30792e295f62702035f67f2fb5365ed64068e7148fb66a352a969b364ac35acb45033ad8cc0a66639bbd9bb52a405b20e3c63c5ed13564 + checksum: 10/b09b2683cd88a41c0604b6a0b3ee2310dfbb1ea8bf309e4a5e83c8ed967ee41aaf7e5e0e103476bf4cd65b4e1f6a9d189ac0bb58e5f081b26c3ec6c43f56dc77 languageName: node linkType: hard -"@react-native-community/cli-platform-apple@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-platform-apple@npm:15.1.3" +"@react-native-community/cli-platform-apple@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-platform-apple@npm:18.0.0" dependencies: - "@react-native-community/cli-config-apple": "npm:15.1.3" - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-config-apple": "npm:18.0.0" + "@react-native-community/cli-tools": "npm:18.0.0" chalk: "npm:^4.1.2" execa: "npm:^5.0.0" fast-xml-parser: "npm:^4.4.1" - checksum: 10/de3d765de28cc6d4fab53c41e2eda41b14d1bc42c12c2cfc4300b4699f14ab5745225c892e30417640867551c18f94154497afee67c47f29fa5515dacfd478c3 + checksum: 10/27c0d92649e95daf54c67943d2c0f7c70a1f1416f4a9c279181fcf323bcfd28cb81577e810209686e62e346d5d5dd3668a01d50d0429a693a0e02f157bebcb3a languageName: node linkType: hard -"@react-native-community/cli-platform-ios@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-platform-ios@npm:15.1.3" +"@react-native-community/cli-platform-ios@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-platform-ios@npm:18.0.0" dependencies: - "@react-native-community/cli-platform-apple": "npm:15.1.3" - checksum: 10/b99e0a2b51ca1be631e94ce7061b353811bf1b146e670928ae890287380ac652ae48e16f67751d4a772b2035781cf0a55847bb18648359048536d2d314c3ed97 + "@react-native-community/cli-platform-apple": "npm:18.0.0" + checksum: 10/9d0786e41f5f1e8853c0fa43005f7a12b7926dde583163b8dd5b79c95df1a1e0cfdc3e80665c0646aa398f6a1b1bf82e952caeb2c56170204926421e7f5fcbea languageName: node linkType: hard -"@react-native-community/cli-server-api@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-server-api@npm:15.1.3" +"@react-native-community/cli-server-api@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-server-api@npm:18.0.0" dependencies: - "@react-native-community/cli-debugger-ui": "npm:15.1.3" - "@react-native-community/cli-tools": "npm:15.1.3" + "@react-native-community/cli-tools": "npm:18.0.0" + body-parser: "npm:^1.20.3" compression: "npm:^1.7.1" connect: "npm:^3.6.5" errorhandler: "npm:^1.5.1" nocache: "npm:^3.0.1" + open: "npm:^6.2.0" pretty-format: "npm:^26.6.2" serve-static: "npm:^1.13.1" ws: "npm:^6.2.3" - checksum: 10/323f9e4035f162e1115f6a1d3d5654b021bc4dda29856abd6674f516fb02c0d01039748a53b028e883ba0d02254b29ece18558e8c6ba0faed880690dc79df18a + checksum: 10/6319c71dbdbe70d91157b331149c803387d345ab6472be85ea1818a0fa163f9dac2f1237277cd925ff0ded7e865589dbe63649bec2d2e7a58f5c1b24d9121bca languageName: node linkType: hard -"@react-native-community/cli-tools@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-tools@npm:15.1.3" +"@react-native-community/cli-tools@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-tools@npm:18.0.0" dependencies: + "@vscode/sudo-prompt": "npm:^9.0.0" appdirsjs: "npm:^1.2.4" chalk: "npm:^4.1.2" execa: "npm:^5.0.0" find-up: "npm:^5.0.0" + launch-editor: "npm:^2.9.1" mime: "npm:^2.4.1" - open: "npm:^6.2.0" ora: "npm:^5.4.1" prompts: "npm:^2.4.2" semver: "npm:^7.5.2" - shell-quote: "npm:^1.7.3" - sudo-prompt: "npm:^9.0.0" - checksum: 10/050344a4617c39d996c549446e4f894076c99bd2897fa8132c9d675ef387e88e1f5b48cdcd718a2eab90a2e51c6c4d6c4b240421633a2b3f0bc6b7d866f8e6c9 + checksum: 10/8d5ce6a67a744e81c923ac7a3edc5619b65941f7ff7ccb47e89420b6b221a5cf49cd6d84e944d6d733daec2356252532e2734d1388537fe927eea872ffb99eb2 languageName: node linkType: hard -"@react-native-community/cli-types@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli-types@npm:15.1.3" +"@react-native-community/cli-types@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli-types@npm:18.0.0" dependencies: joi: "npm:^17.2.1" - checksum: 10/5551e218499645ec7f1c8c3e24cfed427a5b4fab54d376b20f04fbe6b304bbf7dc69a7e64677e10c5d263ab8d98a37cb26d006ce0bcdad0d9710e09568fd297e + checksum: 10/92768eb2dd74549069230b6b594b3ae4cdeae03f938504a642fcaed564c22b2b2bb516c4b6cd880a5b419f408206404d88034795e369f8bb8765bdb1f38ed07d languageName: node linkType: hard -"@react-native-community/cli@npm:15.1.3": - version: 15.1.3 - resolution: "@react-native-community/cli@npm:15.1.3" +"@react-native-community/cli@npm:18.0.0": + version: 18.0.0 + resolution: "@react-native-community/cli@npm:18.0.0" dependencies: - "@react-native-community/cli-clean": "npm:15.1.3" - "@react-native-community/cli-config": "npm:15.1.3" - "@react-native-community/cli-debugger-ui": "npm:15.1.3" - "@react-native-community/cli-doctor": "npm:15.1.3" - "@react-native-community/cli-server-api": "npm:15.1.3" - "@react-native-community/cli-tools": "npm:15.1.3" - "@react-native-community/cli-types": "npm:15.1.3" + "@react-native-community/cli-clean": "npm:18.0.0" + "@react-native-community/cli-config": "npm:18.0.0" + "@react-native-community/cli-doctor": "npm:18.0.0" + "@react-native-community/cli-server-api": "npm:18.0.0" + "@react-native-community/cli-tools": "npm:18.0.0" + "@react-native-community/cli-types": "npm:18.0.0" chalk: "npm:^4.1.2" commander: "npm:^9.4.1" deepmerge: "npm:^4.3.0" @@ -4683,7 +4672,7 @@ __metadata: semver: "npm:^7.5.2" bin: rnc-cli: build/bin.js - checksum: 10/e27e8685928f0770fcbb8bb9bf0eac2e1aa4fbe8d5ea151a5da9f9f9efc5e5a5f0223396dcbde6f26a6e32bd8a21b45cf13c030ab04b23eab92a8157995b1796 + checksum: 10/f4f08cf81378ed4cf590256a32c645f2c027bb0562d72207addc034b9486b48d09ad1d7156c95d6b8db3f3dfdfa7a4b67732eedecea219c1fc69f55f6b2e3df6 languageName: node linkType: hard @@ -5191,6 +5180,21 @@ __metadata: languageName: node linkType: hard +"@react-native/codegen@npm:^0.80.1": + version: 0.80.1 + resolution: "@react-native/codegen@npm:0.80.1" + dependencies: + glob: "npm:^7.1.1" + hermes-parser: "npm:0.28.1" + invariant: "npm:^2.2.4" + nullthrows: "npm:^1.1.1" + yargs: "npm:^17.6.2" + peerDependencies: + "@babel/core": "*" + checksum: 10/cd568b3721b4d52797f7eb8acfff17832db376e4b54299bf15c7db840e8e1ea7e525c7d2e58da0d3775360507ea1070a1a5f909829ed5a0fcebb88bcce8018c7 + languageName: node + linkType: hard + "@react-native/community-cli-plugin@npm:0.77.0": version: 0.77.0 resolution: "@react-native/community-cli-plugin@npm:0.77.0" @@ -6130,6 +6134,13 @@ __metadata: languageName: node linkType: hard +"@vscode/sudo-prompt@npm:^9.0.0": + version: 9.3.1 + resolution: "@vscode/sudo-prompt@npm:9.3.1" + checksum: 10/233edb992ae5dda69b9c63101f85a7996ff7034cb9b0ea976f3ab06483511a35162a650d8e081ded5f07aa9b2f2bac93e45420d956cf1b1d8a76ac385d4a9581 + languageName: node + linkType: hard + "@wix-pilot/core@npm:^3.2.2": version: 3.2.6 resolution: "@wix-pilot/core@npm:3.2.6" @@ -7294,6 +7305,26 @@ __metadata: languageName: node linkType: hard +"body-parser@npm:^1.20.3": + version: 1.20.3 + resolution: "body-parser@npm:1.20.3" + dependencies: + bytes: "npm:3.1.2" + content-type: "npm:~1.0.5" + debug: "npm:2.6.9" + depd: "npm:2.0.0" + destroy: "npm:1.2.0" + http-errors: "npm:2.0.0" + iconv-lite: "npm:0.4.24" + on-finished: "npm:2.4.1" + qs: "npm:6.13.0" + raw-body: "npm:2.5.2" + type-is: "npm:~1.6.18" + unpipe: "npm:1.0.0" + checksum: 10/8723e3d7a672eb50854327453bed85ac48d045f4958e81e7d470c56bf111f835b97e5b73ae9f6393d0011cc9e252771f46fd281bbabc57d33d3986edf1e6aeca + languageName: node + linkType: hard + "boxen@npm:^5.0.0": version: 5.1.2 resolution: "boxen@npm:5.1.2" @@ -14537,6 +14568,16 @@ __metadata: languageName: node linkType: hard +"launch-editor@npm:^2.9.1": + version: 2.10.0 + resolution: "launch-editor@npm:2.10.0" + dependencies: + picocolors: "npm:^1.0.0" + shell-quote: "npm:^1.8.1" + checksum: 10/2ef26369d89ad22938c1f5c343a622ff2e8e2f7709901c739ef38319a103b7da400afc147005e765fc0c22fd467eeb5f63f98568b3882e21f7782a4061fdeb60 + languageName: node + linkType: hard + "lazystream@npm:^1.0.0": version: 1.0.1 resolution: "lazystream@npm:1.0.1" @@ -19091,6 +19132,15 @@ __metadata: languageName: node linkType: hard +"qs@npm:6.13.0": + version: 6.13.0 + resolution: "qs@npm:6.13.0" + dependencies: + side-channel: "npm:^1.0.6" + checksum: 10/f548b376e685553d12e461409f0d6e5c59ec7c7d76f308e2a888fd9db3e0c5e89902bedd0754db3a9038eda5f27da2331a6f019c8517dc5e0a16b3c9a6e9cef8 + languageName: node + linkType: hard + "qs@npm:^6.6.0, qs@npm:^6.7.0": version: 6.12.1 resolution: "qs@npm:6.12.1" @@ -19345,9 +19395,9 @@ __metadata: dependencies: "@firebase/rules-unit-testing": "npm:^4.0.1" "@react-native-async-storage/async-storage": "npm:^2.1.2" - "@react-native-community/cli": "npm:15.1.3" - "@react-native-community/cli-platform-android": "npm:15.1.3" - "@react-native-community/cli-platform-ios": "npm:15.1.3" + "@react-native-community/cli": "npm:18.0.0" + "@react-native-community/cli-platform-android": "npm:18.0.0" + "@react-native-community/cli-platform-ios": "npm:18.0.0" "@react-native-firebase/analytics": "npm:22.2.1" "@react-native-firebase/app": "npm:22.2.1" "@react-native-firebase/app-check": "npm:22.2.1" @@ -19407,6 +19457,8 @@ __metadata: "@firebase/rules-unit-testing": "npm:^4.0.1" "@inquirer/prompts": "npm:^7.4.1" "@octokit/core": "npm:^6.1.5" + "@react-native-community/cli": "npm:18.0.0" + "@react-native/codegen": "npm:^0.80.1" "@tsconfig/node-lts": "npm:^22.0.1" "@types/react": "npm:^19.0.0" "@types/react-native": "npm:^0.73.0" @@ -20933,13 +20985,20 @@ __metadata: languageName: node linkType: hard -"shell-quote@npm:^1.6.1, shell-quote@npm:^1.7.2, shell-quote@npm:^1.7.3": +"shell-quote@npm:^1.6.1, shell-quote@npm:^1.7.2": version: 1.8.1 resolution: "shell-quote@npm:1.8.1" checksum: 10/af19ab5a1ec30cb4b2f91fd6df49a7442d5c4825a2e269b3712eded10eedd7f9efeaab96d57829880733fc55bcdd8e9b1d8589b4befb06667c731d08145e274d languageName: node linkType: hard +"shell-quote@npm:^1.8.1": + version: 1.8.3 + resolution: "shell-quote@npm:1.8.3" + checksum: 10/5473e354637c2bd698911224129c9a8961697486cff1fb221f234d71c153fc377674029b0223d1d3c953a68d451d79366abfe53d1a0b46ee1f28eb9ade928f4c + languageName: node + linkType: hard + "shelljs@npm:^0.9.2": version: 0.9.2 resolution: "shelljs@npm:0.9.2" @@ -21838,13 +21897,6 @@ __metadata: languageName: node linkType: hard -"sudo-prompt@npm:^9.0.0": - version: 9.2.1 - resolution: "sudo-prompt@npm:9.2.1" - checksum: 10/0557d0eecebf8db8212df4a9816509c875ca65ad9ee26a55240848820f9bdbdbbd9e5a1bdb5aa052fb1f748cba4ef90c8da9b40628f59e6dc79ca986e80740de - languageName: node - linkType: hard - "superstatic@npm:^9.2.0": version: 9.2.0 resolution: "superstatic@npm:9.2.0" From 7bad5183d58c650583d426b60fb452e08b17a30e Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 09:44:20 +0100 Subject: [PATCH 23/79] fix: need react-native as dependency for codegen to work --- package.json | 2 +- packages/functions/package.json | 3 +- yarn.lock | 450 +++++++++++++++++++++++++++++++- 3 files changed, 448 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 03004b1612..d7ba482c58 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@firebase/rules-unit-testing": "^4.0.1", "@inquirer/prompts": "^7.4.1", "@octokit/core": "^6.1.5", - "@react-native-community/cli": "18.0.0", + "@react-native-community/cli": "latest", "@react-native/codegen": "^0.80.1", "@tsconfig/node-lts": "^22.0.1", "@types/react": "^19.0.0", diff --git a/packages/functions/package.json b/packages/functions/package.json index 7ca5bcb435..0495e207ad 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -20,7 +20,7 @@ "build:clean": "rimraf android/build && rimraf ios/build", "compile": "bob build", "prepare": "yarn compile && yarn run build", - "codegen": "npx @react-native-community/cli codegen" + "codegen": "npx react-native codegen --source library" }, "repository": { "type": "git", @@ -40,6 +40,7 @@ }, "devDependencies": { "@react-native-firebase/private-tests-firebase-functions": "^0.0.1", + "react-native": "^0.80.1", "react-native-builder-bob": "^0.40.12", "typescript": "^5.8.3" }, diff --git a/yarn.lock b/yarn.lock index dbe2d15bea..66e8087b4e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3450,7 +3450,7 @@ __metadata: languageName: node linkType: hard -"@jest/create-cache-key-function@npm:^29.6.3": +"@jest/create-cache-key-function@npm:^29.6.3, @jest/create-cache-key-function@npm:^29.7.0": version: 29.7.0 resolution: "@jest/create-cache-key-function@npm:29.7.0" dependencies: @@ -4651,7 +4651,7 @@ __metadata: languageName: node linkType: hard -"@react-native-community/cli@npm:18.0.0": +"@react-native-community/cli@npm:18.0.0, @react-native-community/cli@npm:latest": version: 18.0.0 resolution: "@react-native-community/cli@npm:18.0.0" dependencies: @@ -4804,6 +4804,7 @@ __metadata: resolution: "@react-native-firebase/functions@workspace:packages/functions" dependencies: "@react-native-firebase/private-tests-firebase-functions": "npm:^0.0.1" + react-native: "npm:^0.80.1" react-native-builder-bob: "npm:^0.40.12" typescript: "npm:^5.8.3" peerDependencies: @@ -4934,6 +4935,13 @@ __metadata: languageName: node linkType: hard +"@react-native/assets-registry@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/assets-registry@npm:0.80.1" + checksum: 10/586e8b74da54f8d093cfa115ef48f50def15424baac857f8408bdd116472ae50b0906969f98d0b0ccfb28f45c48eab3405018103d6a1ec907a70b3434ed62375 + languageName: node + linkType: hard + "@react-native/babel-plugin-codegen@npm:0.76.9": version: 0.76.9 resolution: "@react-native/babel-plugin-codegen@npm:0.76.9" @@ -5180,7 +5188,7 @@ __metadata: languageName: node linkType: hard -"@react-native/codegen@npm:^0.80.1": +"@react-native/codegen@npm:0.80.1, @react-native/codegen@npm:^0.80.1": version: 0.80.1 resolution: "@react-native/codegen@npm:0.80.1" dependencies: @@ -5241,6 +5249,27 @@ __metadata: languageName: node linkType: hard +"@react-native/community-cli-plugin@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/community-cli-plugin@npm:0.80.1" + dependencies: + "@react-native/dev-middleware": "npm:0.80.1" + chalk: "npm:^4.0.0" + debug: "npm:^4.4.0" + invariant: "npm:^2.2.4" + metro: "npm:^0.82.2" + metro-config: "npm:^0.82.2" + metro-core: "npm:^0.82.2" + semver: "npm:^7.1.3" + peerDependencies: + "@react-native-community/cli": "*" + peerDependenciesMeta: + "@react-native-community/cli": + optional: true + checksum: 10/9480bec119d7e4ab234b96bcfee88eba4943b96087f460803f83332dfd6f66549ffdb4fa4d12ab9edf70e9f7d5cbba9ff5de1d9b838e4a5a628bf09f20ee00ea + languageName: node + linkType: hard + "@react-native/debugger-frontend@npm:0.76.9": version: 0.76.9 resolution: "@react-native/debugger-frontend@npm:0.76.9" @@ -5262,6 +5291,13 @@ __metadata: languageName: node linkType: hard +"@react-native/debugger-frontend@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/debugger-frontend@npm:0.80.1" + checksum: 10/f11470946dd6c34ee24b0a10b35c8f9fa501bad698ebd2f62492c27112c3a901bd1623281bf06ff143dd663c5a04b3dbc728f566d22d82b643e0c034ed162247 + languageName: node + linkType: hard + "@react-native/dev-middleware@npm:0.76.9": version: 0.76.9 resolution: "@react-native/dev-middleware@npm:0.76.9" @@ -5321,6 +5357,25 @@ __metadata: languageName: node linkType: hard +"@react-native/dev-middleware@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/dev-middleware@npm:0.80.1" + dependencies: + "@isaacs/ttlcache": "npm:^1.4.1" + "@react-native/debugger-frontend": "npm:0.80.1" + chrome-launcher: "npm:^0.15.2" + chromium-edge-launcher: "npm:^0.2.0" + connect: "npm:^3.6.5" + debug: "npm:^4.4.0" + invariant: "npm:^2.2.4" + nullthrows: "npm:^1.1.1" + open: "npm:^7.0.3" + serve-static: "npm:^1.16.2" + ws: "npm:^6.2.3" + checksum: 10/4bcf7b3a88574ec2fd2231ab0ea03de82a14f4bd5825ec899840177213b8a43ca87bcb7ec1942097820711c6eb0a257d21713762357bf26435314a438d4ec1f0 + languageName: node + linkType: hard + "@react-native/gradle-plugin@npm:0.77.0": version: 0.77.0 resolution: "@react-native/gradle-plugin@npm:0.77.0" @@ -5335,6 +5390,13 @@ __metadata: languageName: node linkType: hard +"@react-native/gradle-plugin@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/gradle-plugin@npm:0.80.1" + checksum: 10/8172e700832766d0e95417c07de4e4a97106f062d8a29791cede843d06ed8256a4fb8011ae36fbbb40d8c097bfa4b812b94296dc24c45555ee85d4661ea6b5bc + languageName: node + linkType: hard + "@react-native/js-polyfills@npm:0.77.0": version: 0.77.0 resolution: "@react-native/js-polyfills@npm:0.77.0" @@ -5349,6 +5411,13 @@ __metadata: languageName: node linkType: hard +"@react-native/js-polyfills@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/js-polyfills@npm:0.80.1" + checksum: 10/108386fd71c5431dea64c3ecc89bad94594f9afb96231af1993d702e0425a99be6fc6b0e3f1276b014a25581ab2476f6ce3ae81836b6805e95839402b805ace1 + languageName: node + linkType: hard + "@react-native/metro-babel-transformer@npm:0.77.0": version: 0.77.0 resolution: "@react-native/metro-babel-transformer@npm:0.77.0" @@ -5410,6 +5479,13 @@ __metadata: languageName: node linkType: hard +"@react-native/normalize-colors@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/normalize-colors@npm:0.80.1" + checksum: 10/4e7a03204f9cc5583bc4b807ce65905ec7abd496c43dc4713a0a94cd8b64ec5200e12bd57d5a77b2d6ee3dc33c1b1a26532062b01bb7cd4f3b953d62c891b5c1 + languageName: node + linkType: hard + "@react-native/virtualized-lists@npm:0.77.0": version: 0.77.0 resolution: "@react-native/virtualized-lists@npm:0.77.0" @@ -5444,6 +5520,23 @@ __metadata: languageName: node linkType: hard +"@react-native/virtualized-lists@npm:0.80.1": + version: 0.80.1 + resolution: "@react-native/virtualized-lists@npm:0.80.1" + dependencies: + invariant: "npm:^2.2.4" + nullthrows: "npm:^1.1.1" + peerDependencies: + "@types/react": ^19.0.0 + react: "*" + react-native: "*" + peerDependenciesMeta: + "@types/react": + optional: true + checksum: 10/4ed1285a6ca80853d7d39c6d89fd7caba2b0f634602919b4cb553142aa9240db9ff592a29fc60c6e16760743dfa862c56a39cebf61f60b3e7ea2744f77b9a5f4 + languageName: node + linkType: hard + "@segment/loosely-validate-event@npm:^2.0.0": version: 2.0.0 resolution: "@segment/loosely-validate-event@npm:2.0.0" @@ -6300,6 +6393,13 @@ __metadata: languageName: node linkType: hard +"agent-base@npm:^7.1.2": + version: 7.1.3 + resolution: "agent-base@npm:7.1.3" + checksum: 10/3db6d8d4651f2aa1a9e4af35b96ab11a7607af57a24f3bc721a387eaa3b5f674e901f0a648b0caefd48f3fd117c7761b79a3b55854e2aebaa96c3f32cf76af84 + languageName: node + linkType: hard + "aggregate-error@npm:^3.0.0": version: 3.1.0 resolution: "aggregate-error@npm:3.1.0" @@ -7061,7 +7161,7 @@ __metadata: languageName: node linkType: hard -"babel-plugin-syntax-hermes-parser@npm:^0.28.0": +"babel-plugin-syntax-hermes-parser@npm:0.28.1, babel-plugin-syntax-hermes-parser@npm:^0.28.0": version: 0.28.1 resolution: "babel-plugin-syntax-hermes-parser@npm:0.28.1" dependencies: @@ -9082,6 +9182,18 @@ __metadata: languageName: node linkType: hard +"debug@npm:^4.4.0": + version: 4.4.1 + resolution: "debug@npm:4.4.1" + dependencies: + ms: "npm:^2.1.3" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10/8e2709b2144f03c7950f8804d01ccb3786373df01e406a0f66928e47001cf2d336cbed9ee137261d4f90d68d8679468c755e3548ed83ddacdc82b194d2468afe + languageName: node + linkType: hard + "decamelize-keys@npm:^1.1.0": version: 1.1.1 resolution: "decamelize-keys@npm:1.1.1" @@ -12304,6 +12416,13 @@ __metadata: languageName: node linkType: hard +"hermes-estree@npm:0.29.1": + version: 0.29.1 + resolution: "hermes-estree@npm:0.29.1" + checksum: 10/8989fc224fcd2bb3356d7d330461c9f32303904824891ae4befafc08f13c871013b18d5d4cd4b20bf6f59e9d26afdbb10d33440c6e646de770db4b9543c39db4 + languageName: node + linkType: hard + "hermes-parser@npm:0.23.1": version: 0.23.1 resolution: "hermes-parser@npm:0.23.1" @@ -12331,6 +12450,15 @@ __metadata: languageName: node linkType: hard +"hermes-parser@npm:0.29.1": + version: 0.29.1 + resolution: "hermes-parser@npm:0.29.1" + dependencies: + hermes-estree: "npm:0.29.1" + checksum: 10/2d1ada9d48817668bf12b31deef7c5a4a7d88419448c7e07ad67197a7992462dea3f5e536aea2c6f7e2222940f96bb7cd7a7dc5a101c9b4b2d7a84e1a1272670 + languageName: node + linkType: hard + "highlight.js@npm:^10.7.1": version: 10.7.3 resolution: "highlight.js@npm:10.7.3" @@ -12445,6 +12573,16 @@ __metadata: languageName: node linkType: hard +"https-proxy-agent@npm:^7.0.5": + version: 7.0.6 + resolution: "https-proxy-agent@npm:7.0.6" + dependencies: + agent-base: "npm:^7.1.2" + debug: "npm:4" + checksum: 10/784b628cbd55b25542a9d85033bdfd03d4eda630fb8b3c9477959367f3be95dc476ed2ecbb9836c359c7c698027fc7b45723a302324433590f45d6c1706e8c13 + languageName: node + linkType: hard + "human-signals@npm:^1.1.1": version: 1.1.1 resolution: "human-signals@npm:1.1.1" @@ -15580,6 +15718,18 @@ __metadata: languageName: node linkType: hard +"metro-babel-transformer@npm:0.82.5": + version: 0.82.5 + resolution: "metro-babel-transformer@npm:0.82.5" + dependencies: + "@babel/core": "npm:^7.25.2" + flow-enums-runtime: "npm:^0.0.6" + hermes-parser: "npm:0.29.1" + nullthrows: "npm:^1.1.1" + checksum: 10/1eea9e96292ee86b14158ac6de07278a87191eeb993f3f01a42a5a2bcaa54406cacf0093a4923ec6c3cc409e4c081d301ec6afcc4b3577890f6d1b5ef39bc81f + languageName: node + linkType: hard + "metro-cache-key@npm:0.80.12": version: 0.80.12 resolution: "metro-cache-key@npm:0.80.12" @@ -15607,6 +15757,15 @@ __metadata: languageName: node linkType: hard +"metro-cache-key@npm:0.82.5": + version: 0.82.5 + resolution: "metro-cache-key@npm:0.82.5" + dependencies: + flow-enums-runtime: "npm:^0.0.6" + checksum: 10/d5dcd86249905c7adad0375111a4bef395a5021df251a463f840eb21bf7b34f4e581ae919a88fb612a63c48a5f379ce50f104a576bd71e052693d89ae6a0d9f0 + languageName: node + linkType: hard + "metro-cache@npm:0.80.12": version: 0.80.12 resolution: "metro-cache@npm:0.80.12" @@ -15640,6 +15799,18 @@ __metadata: languageName: node linkType: hard +"metro-cache@npm:0.82.5": + version: 0.82.5 + resolution: "metro-cache@npm:0.82.5" + dependencies: + exponential-backoff: "npm:^3.1.1" + flow-enums-runtime: "npm:^0.0.6" + https-proxy-agent: "npm:^7.0.5" + metro-core: "npm:0.82.5" + checksum: 10/e90299ae6e411349e5283c57a69ec0d4dd8a4424c3a85078d72d740b425b3dfc77078601ab426e6fb35bcb985e835374846e89f9730f4db413424bd48d9df863 + languageName: node + linkType: hard + "metro-config@npm:0.80.12, metro-config@npm:^0.80.9": version: 0.80.12 resolution: "metro-config@npm:0.80.12" @@ -15688,6 +15859,22 @@ __metadata: languageName: node linkType: hard +"metro-config@npm:0.82.5, metro-config@npm:^0.82.2": + version: 0.82.5 + resolution: "metro-config@npm:0.82.5" + dependencies: + connect: "npm:^3.6.5" + cosmiconfig: "npm:^5.0.5" + flow-enums-runtime: "npm:^0.0.6" + jest-validate: "npm:^29.7.0" + metro: "npm:0.82.5" + metro-cache: "npm:0.82.5" + metro-core: "npm:0.82.5" + metro-runtime: "npm:0.82.5" + checksum: 10/91e7860a6a3dfaf7287d5abe553fec1592699f92c756fae1218e0cad5a027396b16d4ba7edea75a9fac26c431f719858c9ae17ed737e54605969730c338eb07f + languageName: node + linkType: hard + "metro-core@npm:0.80.12": version: 0.80.12 resolution: "metro-core@npm:0.80.12" @@ -15721,6 +15908,17 @@ __metadata: languageName: node linkType: hard +"metro-core@npm:0.82.5, metro-core@npm:^0.82.2": + version: 0.82.5 + resolution: "metro-core@npm:0.82.5" + dependencies: + flow-enums-runtime: "npm:^0.0.6" + lodash.throttle: "npm:^4.1.1" + metro-resolver: "npm:0.82.5" + checksum: 10/e97282e0164042d1206fee7ac764eddb33f02abb238c139f0d5804a284a2c9e40683293913e29c900b95ee257f85cd18803a07ab3143481bdddc436e137bdf05 + languageName: node + linkType: hard + "metro-file-map@npm:0.80.12": version: 0.80.12 resolution: "metro-file-map@npm:0.80.12" @@ -15778,6 +15976,23 @@ __metadata: languageName: node linkType: hard +"metro-file-map@npm:0.82.5": + version: 0.82.5 + resolution: "metro-file-map@npm:0.82.5" + dependencies: + debug: "npm:^4.4.0" + fb-watchman: "npm:^2.0.0" + flow-enums-runtime: "npm:^0.0.6" + graceful-fs: "npm:^4.2.4" + invariant: "npm:^2.2.4" + jest-worker: "npm:^29.7.0" + micromatch: "npm:^4.0.4" + nullthrows: "npm:^1.1.1" + walker: "npm:^1.0.7" + checksum: 10/3228947bb567f0e3fee200df55315928fac527a8ce4a5e95de44d3e3a125b153b49e4f8f4f59748842880848a5dd87ac8907e75b55786298fb2e2b4b2581d882 + languageName: node + linkType: hard + "metro-minify-terser@npm:0.80.12": version: 0.80.12 resolution: "metro-minify-terser@npm:0.80.12" @@ -15808,6 +16023,16 @@ __metadata: languageName: node linkType: hard +"metro-minify-terser@npm:0.82.5": + version: 0.82.5 + resolution: "metro-minify-terser@npm:0.82.5" + dependencies: + flow-enums-runtime: "npm:^0.0.6" + terser: "npm:^5.15.0" + checksum: 10/754c150f0928460e1254e90e4e11bd87e069a0b286d21906758cb71fb8b4ec50dc8f78337bf8a9f8a28ddbd34230f5c66dad0fecf18dbe49715bf1300e5318c2 + languageName: node + linkType: hard + "metro-resolver@npm:0.80.12": version: 0.80.12 resolution: "metro-resolver@npm:0.80.12" @@ -15835,6 +16060,15 @@ __metadata: languageName: node linkType: hard +"metro-resolver@npm:0.82.5": + version: 0.82.5 + resolution: "metro-resolver@npm:0.82.5" + dependencies: + flow-enums-runtime: "npm:^0.0.6" + checksum: 10/2ccabf3d9e1f931496b0cbc7075713b79cd6989f802607c845d2ce2fb0a1eeab8133d045fd92d8654ce7a943a276b2ab59e9e1039c9b6744a26d0107554d6f2f + languageName: node + linkType: hard + "metro-runtime@npm:0.80.12": version: 0.80.12 resolution: "metro-runtime@npm:0.80.12" @@ -15865,6 +16099,16 @@ __metadata: languageName: node linkType: hard +"metro-runtime@npm:0.82.5, metro-runtime@npm:^0.82.2": + version: 0.82.5 + resolution: "metro-runtime@npm:0.82.5" + dependencies: + "@babel/runtime": "npm:^7.25.0" + flow-enums-runtime: "npm:^0.0.6" + checksum: 10/212ae207e507fa5fdac81ba079ccb4f6939dcea19416435885f16c173711b71f72eb4269eeb78ffde451e2307b6b01dbe7fc7b8cca117729a67ad4773b9e2d2d + languageName: node + linkType: hard + "metro-source-map@npm:0.80.12": version: 0.80.12 resolution: "metro-source-map@npm:0.80.12" @@ -15918,6 +16162,24 @@ __metadata: languageName: node linkType: hard +"metro-source-map@npm:0.82.5, metro-source-map@npm:^0.82.2": + version: 0.82.5 + resolution: "metro-source-map@npm:0.82.5" + dependencies: + "@babel/traverse": "npm:^7.25.3" + "@babel/traverse--for-generate-function-map": "npm:@babel/traverse@^7.25.3" + "@babel/types": "npm:^7.25.2" + flow-enums-runtime: "npm:^0.0.6" + invariant: "npm:^2.2.4" + metro-symbolicate: "npm:0.82.5" + nullthrows: "npm:^1.1.1" + ob1: "npm:0.82.5" + source-map: "npm:^0.5.6" + vlq: "npm:^1.0.0" + checksum: 10/8731c6257afa7bf2b460d4059d7fea1498c91d982b09e536e6dda73e166c7155ceea2eb7709dbea6d1e10a59be746ec9a7b3e5000e5cc79fd38d30d833c181c6 + languageName: node + linkType: hard + "metro-symbolicate@npm:0.80.12": version: 0.80.12 resolution: "metro-symbolicate@npm:0.80.12" @@ -15967,6 +16229,22 @@ __metadata: languageName: node linkType: hard +"metro-symbolicate@npm:0.82.5": + version: 0.82.5 + resolution: "metro-symbolicate@npm:0.82.5" + dependencies: + flow-enums-runtime: "npm:^0.0.6" + invariant: "npm:^2.2.4" + metro-source-map: "npm:0.82.5" + nullthrows: "npm:^1.1.1" + source-map: "npm:^0.5.6" + vlq: "npm:^1.0.0" + bin: + metro-symbolicate: src/index.js + checksum: 10/593e853b702f3ff2d3f9e6677fcfef832cf3373506a6116a9ec5e3d3f6ab46f83af34167cfd6d53a52cda2238a504b7bac63436dc8b59a6c5d3da54bce9140ad + languageName: node + linkType: hard + "metro-transform-plugins@npm:0.80.12": version: 0.80.12 resolution: "metro-transform-plugins@npm:0.80.12" @@ -16009,6 +16287,20 @@ __metadata: languageName: node linkType: hard +"metro-transform-plugins@npm:0.82.5": + version: 0.82.5 + resolution: "metro-transform-plugins@npm:0.82.5" + dependencies: + "@babel/core": "npm:^7.25.2" + "@babel/generator": "npm:^7.25.0" + "@babel/template": "npm:^7.25.0" + "@babel/traverse": "npm:^7.25.3" + flow-enums-runtime: "npm:^0.0.6" + nullthrows: "npm:^1.1.1" + checksum: 10/413811c1e2cef44ba77f02f3cd823e8987bdfc69b3c051bd41e886f9243fa131fa4a366e34c9483c85e77c8960d5151eecb34924c0f66b3e0f87706ca6ff37c5 + languageName: node + linkType: hard + "metro-transform-worker@npm:0.80.12": version: 0.80.12 resolution: "metro-transform-worker@npm:0.80.12" @@ -16072,6 +16364,27 @@ __metadata: languageName: node linkType: hard +"metro-transform-worker@npm:0.82.5": + version: 0.82.5 + resolution: "metro-transform-worker@npm:0.82.5" + dependencies: + "@babel/core": "npm:^7.25.2" + "@babel/generator": "npm:^7.25.0" + "@babel/parser": "npm:^7.25.3" + "@babel/types": "npm:^7.25.2" + flow-enums-runtime: "npm:^0.0.6" + metro: "npm:0.82.5" + metro-babel-transformer: "npm:0.82.5" + metro-cache: "npm:0.82.5" + metro-cache-key: "npm:0.82.5" + metro-minify-terser: "npm:0.82.5" + metro-source-map: "npm:0.82.5" + metro-transform-plugins: "npm:0.82.5" + nullthrows: "npm:^1.1.1" + checksum: 10/169203ececd0aa4c3d323f0579398ce9b77d3775d046cfa163c53d3dea97425dba6362b7630889fc8eea8232aa7567489f7e4e512ca3f58777c51f5f5e2894dc + languageName: node + linkType: hard + "metro@npm:0.80.12": version: 0.80.12 resolution: "metro@npm:0.80.12" @@ -16224,6 +16537,56 @@ __metadata: languageName: node linkType: hard +"metro@npm:0.82.5, metro@npm:^0.82.2": + version: 0.82.5 + resolution: "metro@npm:0.82.5" + dependencies: + "@babel/code-frame": "npm:^7.24.7" + "@babel/core": "npm:^7.25.2" + "@babel/generator": "npm:^7.25.0" + "@babel/parser": "npm:^7.25.3" + "@babel/template": "npm:^7.25.0" + "@babel/traverse": "npm:^7.25.3" + "@babel/types": "npm:^7.25.2" + accepts: "npm:^1.3.7" + chalk: "npm:^4.0.0" + ci-info: "npm:^2.0.0" + connect: "npm:^3.6.5" + debug: "npm:^4.4.0" + error-stack-parser: "npm:^2.0.6" + flow-enums-runtime: "npm:^0.0.6" + graceful-fs: "npm:^4.2.4" + hermes-parser: "npm:0.29.1" + image-size: "npm:^1.0.2" + invariant: "npm:^2.2.4" + jest-worker: "npm:^29.7.0" + jsc-safe-url: "npm:^0.2.2" + lodash.throttle: "npm:^4.1.1" + metro-babel-transformer: "npm:0.82.5" + metro-cache: "npm:0.82.5" + metro-cache-key: "npm:0.82.5" + metro-config: "npm:0.82.5" + metro-core: "npm:0.82.5" + metro-file-map: "npm:0.82.5" + metro-resolver: "npm:0.82.5" + metro-runtime: "npm:0.82.5" + metro-source-map: "npm:0.82.5" + metro-symbolicate: "npm:0.82.5" + metro-transform-plugins: "npm:0.82.5" + metro-transform-worker: "npm:0.82.5" + mime-types: "npm:^2.1.27" + nullthrows: "npm:^1.1.1" + serialize-error: "npm:^2.1.0" + source-map: "npm:^0.5.6" + throat: "npm:^5.0.0" + ws: "npm:^7.5.10" + yargs: "npm:^17.6.2" + bin: + metro: src/cli.js + checksum: 10/8ada9adce330756249103181c3f99331d095f53d0630a192fd1a2729543dfdc2b71aea024bfa6bba2b38e8c3afdc25b50a6aedb2b6bc4d73b45fbc0599494066 + languageName: node + linkType: hard + "micromark-core-commonmark@npm:^1.0.1": version: 1.1.0 resolution: "micromark-core-commonmark@npm:1.1.0" @@ -17646,6 +18009,15 @@ __metadata: languageName: node linkType: hard +"ob1@npm:0.82.5": + version: 0.82.5 + resolution: "ob1@npm:0.82.5" + dependencies: + flow-enums-runtime: "npm:^0.0.6" + checksum: 10/3faa161e5b5307188b6bbbf7e21727b1e434b8f6c31c51386808b2efd5e7238cf85a7ce71416d9a3f073625afb5a2212f80ec267996dc88fe086944adbb525d9 + languageName: node + linkType: hard + "object-assign@npm:^4, object-assign@npm:^4.0.1, object-assign@npm:^4.1.0, object-assign@npm:^4.1.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" @@ -19286,6 +19658,16 @@ __metadata: languageName: node linkType: hard +"react-devtools-core@npm:^6.1.1": + version: 6.1.5 + resolution: "react-devtools-core@npm:6.1.5" + dependencies: + shell-quote: "npm:^1.6.1" + ws: "npm:^7" + checksum: 10/0323f1d006979374b79ac83fced5bb10c04f2817d7bd4338074ead815ff441b943290d563d7796233767dd973787116a4b3c62040de4d770e0ae5b207fc8d480 + languageName: node + linkType: hard + "react-is@npm:^16.13.1": version: 16.13.1 resolution: "react-is@npm:16.13.1" @@ -19457,7 +19839,7 @@ __metadata: "@firebase/rules-unit-testing": "npm:^4.0.1" "@inquirer/prompts": "npm:^7.4.1" "@octokit/core": "npm:^6.1.5" - "@react-native-community/cli": "npm:18.0.0" + "@react-native-community/cli": "npm:latest" "@react-native/codegen": "npm:^0.80.1" "@tsconfig/node-lts": "npm:^22.0.1" "@types/react": "npm:^19.0.0" @@ -19658,6 +20040,57 @@ __metadata: languageName: node linkType: hard +"react-native@npm:^0.80.1": + version: 0.80.1 + resolution: "react-native@npm:0.80.1" + dependencies: + "@jest/create-cache-key-function": "npm:^29.7.0" + "@react-native/assets-registry": "npm:0.80.1" + "@react-native/codegen": "npm:0.80.1" + "@react-native/community-cli-plugin": "npm:0.80.1" + "@react-native/gradle-plugin": "npm:0.80.1" + "@react-native/js-polyfills": "npm:0.80.1" + "@react-native/normalize-colors": "npm:0.80.1" + "@react-native/virtualized-lists": "npm:0.80.1" + abort-controller: "npm:^3.0.0" + anser: "npm:^1.4.9" + ansi-regex: "npm:^5.0.0" + babel-jest: "npm:^29.7.0" + babel-plugin-syntax-hermes-parser: "npm:0.28.1" + base64-js: "npm:^1.5.1" + chalk: "npm:^4.0.0" + commander: "npm:^12.0.0" + flow-enums-runtime: "npm:^0.0.6" + glob: "npm:^7.1.1" + invariant: "npm:^2.2.4" + jest-environment-node: "npm:^29.7.0" + memoize-one: "npm:^5.0.0" + metro-runtime: "npm:^0.82.2" + metro-source-map: "npm:^0.82.2" + nullthrows: "npm:^1.1.1" + pretty-format: "npm:^29.7.0" + promise: "npm:^8.3.0" + react-devtools-core: "npm:^6.1.1" + react-refresh: "npm:^0.14.0" + regenerator-runtime: "npm:^0.13.2" + scheduler: "npm:0.26.0" + semver: "npm:^7.1.3" + stacktrace-parser: "npm:^0.1.10" + whatwg-fetch: "npm:^3.0.0" + ws: "npm:^6.2.3" + yargs: "npm:^17.6.2" + peerDependencies: + "@types/react": ^19.1.0 + react: ^19.1.0 + peerDependenciesMeta: + "@types/react": + optional: true + bin: + react-native: cli.js + checksum: 10/aab403024d77077bd58cdda22c18306fd909c37b7f0a270cf917a46c1460d901a0d1a2aa22c74eb46fede5011666b5aae73393f423412641e6abe91b05708069 + languageName: node + linkType: hard + "react-refresh@npm:^0.14.0, react-refresh@npm:^0.14.2": version: 0.14.2 resolution: "react-refresh@npm:0.14.2" @@ -20728,6 +21161,13 @@ __metadata: languageName: node linkType: hard +"scheduler@npm:0.26.0": + version: 0.26.0 + resolution: "scheduler@npm:0.26.0" + checksum: 10/1ecf2e5d7de1a7a132796834afe14a2d589ba7e437615bd8c06f3e0786a3ac3434655e67aac8755d9b14e05754c177e49c064261de2673aaa3c926bc98caa002 + languageName: node + linkType: hard + "selfsigned@npm:^2.4.1": version: 2.4.1 resolution: "selfsigned@npm:2.4.1" From 3ba3a761131fe691e1e2d0114d8c1322289c1b7a Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 10:12:22 +0100 Subject: [PATCH 24/79] update scripts for generating code --- packages/functions/package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/functions/package.json b/packages/functions/package.json index 0495e207ad..a6b8d089df 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -12,7 +12,7 @@ "jsSrcsDir": "specs", "includesGeneratedCode": true, "android": { - "javaPackageName": "com.rnfb.functions" + "javaPackageName": "io.invertase.firebase.functions" } }, "scripts": { @@ -20,7 +20,9 @@ "build:clean": "rimraf android/build && rimraf ios/build", "compile": "bob build", "prepare": "yarn compile && yarn run build", - "codegen": "npx react-native codegen --source library" + "codegen": "yarn android:codegen && yarn ios:codegen", + "android:codegen": "npx @react-native-community/cli codegen --platform android --outputPath=./android/src/main/java/io/invertase/firebase/functions/generated", + "ios:codegen": "npx @react-native-community/cli codegen --platform ios --outputPath=./ios/generated" }, "repository": { "type": "git", From d3ca7504aba4e3c58a9d2fa0f2443c87dee600f7 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 10:13:16 +0100 Subject: [PATCH 25/79] generated code for android & ios --- .../functions/generated/jni/CMakeLists.txt | 36 ++++++ .../jni/RNFBFunctionsSpec-generated.cpp | 22 ++++ .../generated/jni/RNFBFunctionsSpec.h | 24 ++++ .../RNFBFunctionsSpecJSI-generated.cpp | 17 +++ .../RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h | 19 ++++ .../ios/generated/RCTAppDependencyProvider.h | 25 +++++ .../ios/generated/RCTAppDependencyProvider.mm | 40 +++++++ .../ios/generated/RCTModuleProviders.h | 16 +++ .../ios/generated/RCTModuleProviders.mm | 51 +++++++++ .../RCTModulesConformingToProtocolsProvider.h | 18 +++ ...RCTModulesConformingToProtocolsProvider.mm | 54 +++++++++ .../RCTThirdPartyComponentsProvider.h | 16 +++ .../RCTThirdPartyComponentsProvider.mm | 30 +++++ ...leModulesRequiringMainQueueSetupProvider.h | 14 +++ ...eModulesRequiringMainQueueSetupProvider.mm | 19 ++++ .../RNFBFunctionsSpec-generated.mm | 16 +++ .../RNFBFunctionsSpec/RNFBFunctionsSpec.h | 38 +++++++ .../RNFBFunctionsSpecJSI-generated.cpp | 17 +++ .../ios/generated/RNFBFunctionsSpecJSI.h | 19 ++++ .../ReactAppDependencyProvider.podspec | 34 ++++++ .../ios/generated/ReactCodegen.podspec | 106 ++++++++++++++++++ 21 files changed, 631 insertions(+) create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h create mode 100644 packages/functions/ios/generated/RCTAppDependencyProvider.h create mode 100644 packages/functions/ios/generated/RCTAppDependencyProvider.mm create mode 100644 packages/functions/ios/generated/RCTModuleProviders.h create mode 100644 packages/functions/ios/generated/RCTModuleProviders.mm create mode 100644 packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h create mode 100644 packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm create mode 100644 packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h create mode 100644 packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm create mode 100644 packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h create mode 100644 packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpecJSI.h create mode 100644 packages/functions/ios/generated/ReactAppDependencyProvider.podspec create mode 100644 packages/functions/ios/generated/ReactCodegen.podspec diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt new file mode 100644 index 0000000000..0eaaad455e --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNFBFunctionsSpec/*.cpp) + +add_library( + react_codegen_RNFBFunctionsSpec + OBJECT + ${react_codegen_SRCS} +) + +target_include_directories(react_codegen_RNFBFunctionsSpec PUBLIC . react/renderer/components/RNFBFunctionsSpec) + +target_link_libraries( + react_codegen_RNFBFunctionsSpec + fbjni + jsi + # We need to link different libraries based on whether we are building rncore or not, that's necessary + # because we want to break a circular dependency between react_codegen_rncore and reactnative + reactnative +) + +target_compile_options( + react_codegen_RNFBFunctionsSpec + PRIVATE + -DLOG_TAG=\"ReactNative\" + -fexceptions + -frtti + -std=c++20 + -Wall +) diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp new file mode 100644 index 0000000000..5305b23af2 --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp @@ -0,0 +1,22 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniCpp.js + */ + +#include "RNFBFunctionsSpec.h" + +namespace facebook::react { + + + +std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { + + return nullptr; +} + +} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h new file mode 100644 index 0000000000..20449d421b --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h @@ -0,0 +1,24 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniH.js + */ + +#pragma once + +#include +#include +#include + +namespace facebook::react { + + + +JSI_EXPORT +std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms); + +} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp new file mode 100644 index 0000000000..7775895216 --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp @@ -0,0 +1,17 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleCpp.js + */ + +#include "RNFBFunctionsSpecJSI.h" + +namespace facebook::react { + + + + +} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h new file mode 100644 index 0000000000..ec162608da --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h @@ -0,0 +1,19 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#pragma once + +#include +#include + +namespace facebook::react { + + + +} // namespace facebook::react diff --git a/packages/functions/ios/generated/RCTAppDependencyProvider.h b/packages/functions/ios/generated/RCTAppDependencyProvider.h new file mode 100644 index 0000000000..5a1502d16f --- /dev/null +++ b/packages/functions/ios/generated/RCTAppDependencyProvider.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + +#import + +#if __has_include() +#import +#elif __has_include() +#import +#else +#import "RCTDependencyProvider.h" +#endif + +NS_ASSUME_NONNULL_BEGIN + +@interface RCTAppDependencyProvider : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/functions/ios/generated/RCTAppDependencyProvider.mm b/packages/functions/ios/generated/RCTAppDependencyProvider.mm new file mode 100644 index 0000000000..b76c468c8a --- /dev/null +++ b/packages/functions/ios/generated/RCTAppDependencyProvider.mm @@ -0,0 +1,40 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTAppDependencyProvider.h" +#import +#import +#import +#import + +@implementation RCTAppDependencyProvider + +- (nonnull NSArray *)URLRequestHandlerClassNames { + return RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames; +} + +- (nonnull NSArray *)imageDataDecoderClassNames { + return RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames; +} + +- (nonnull NSArray *)imageURLLoaderClassNames { + return RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames; +} + +- (nonnull NSArray *)unstableModulesRequiringMainQueueSetup { + return RCTUnstableModulesRequiringMainQueueSetupProvider.modules; +} + +- (nonnull NSDictionary> *)thirdPartyFabricComponents { + return RCTThirdPartyComponentsProvider.thirdPartyFabricComponents; +} + +- (nonnull NSDictionary> *)moduleProviders { + return RCTModuleProviders.moduleProviders; +} + +@end diff --git a/packages/functions/ios/generated/RCTModuleProviders.h b/packages/functions/ios/generated/RCTModuleProviders.h new file mode 100644 index 0000000000..aff637c692 --- /dev/null +++ b/packages/functions/ios/generated/RCTModuleProviders.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@protocol RCTModuleProvider; + +@interface RCTModuleProviders: NSObject + ++ (NSDictionary> *)moduleProviders; + +@end diff --git a/packages/functions/ios/generated/RCTModuleProviders.mm b/packages/functions/ios/generated/RCTModuleProviders.mm new file mode 100644 index 0000000000..7a51188044 --- /dev/null +++ b/packages/functions/ios/generated/RCTModuleProviders.mm @@ -0,0 +1,51 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +#import "RCTModuleProviders.h" +#import +#import + +@implementation RCTModuleProviders + ++ (NSDictionary> *)moduleProviders +{ + static NSDictionary> *providers = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + NSDictionary * moduleMapping = @{ + + }; + + NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:moduleMapping.count]; + + for (NSString *key in moduleMapping) { + NSString * moduleProviderName = moduleMapping[key]; + Class klass = NSClassFromString(moduleProviderName); + if (!klass) { + RCTLogError(@"Module provider %@ cannot be found in the runtime", moduleProviderName); + continue; + } + + id instance = [klass new]; + if (![instance respondsToSelector:@selector(getTurboModule:)]) { + RCTLogError(@"Module provider %@ does not conform to RCTModuleProvider", moduleProviderName); + continue; + } + + [dict setObject:instance forKey:key]; + } + + providers = dict; + }); + + return providers; +} + +@end diff --git a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h new file mode 100644 index 0000000000..10eb848917 --- /dev/null +++ b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface RCTModulesConformingToProtocolsProvider: NSObject + ++(NSArray *)imageURLLoaderClassNames; + ++(NSArray *)imageDataDecoderClassNames; + ++(NSArray *)URLRequestHandlerClassNames; + +@end diff --git a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm new file mode 100644 index 0000000000..a5ff82810e --- /dev/null +++ b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm @@ -0,0 +1,54 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTModulesConformingToProtocolsProvider.h" + +@implementation RCTModulesConformingToProtocolsProvider + ++(NSArray *)imageURLLoaderClassNames +{ + static NSArray *classNames = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + classNames = @[ + + ]; + }); + + return classNames; +} + ++(NSArray *)imageDataDecoderClassNames +{ + static NSArray *classNames = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + classNames = @[ + + ]; + }); + + return classNames; +} + ++(NSArray *)URLRequestHandlerClassNames +{ + static NSArray *classNames = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + classNames = @[ + + ]; + }); + + return classNames; +} + +@end diff --git a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h new file mode 100644 index 0000000000..ab1a249de3 --- /dev/null +++ b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@protocol RCTComponentViewProtocol; + +@interface RCTThirdPartyComponentsProvider: NSObject + ++ (NSDictionary> *)thirdPartyFabricComponents; + +@end diff --git a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm new file mode 100644 index 0000000000..4e05532c39 --- /dev/null +++ b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm @@ -0,0 +1,30 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + +#import + +#import "RCTThirdPartyComponentsProvider.h" +#import + +@implementation RCTThirdPartyComponentsProvider + ++ (NSDictionary> *)thirdPartyFabricComponents +{ + static NSDictionary> *thirdPartyComponents = nil; + static dispatch_once_t nativeComponentsToken; + + dispatch_once(&nativeComponentsToken, ^{ + thirdPartyComponents = @{ + + }; + }); + + return thirdPartyComponents; +} + +@end diff --git a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h new file mode 100644 index 0000000000..114d32253a --- /dev/null +++ b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface RCTUnstableModulesRequiringMainQueueSetupProvider: NSObject + ++(NSArray *)modules; + +@end diff --git a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm new file mode 100644 index 0000000000..9cc59ed7e3 --- /dev/null +++ b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm @@ -0,0 +1,19 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTUnstableModulesRequiringMainQueueSetupProvider.h" + +@implementation RCTUnstableModulesRequiringMainQueueSetupProvider + ++(NSArray *)modules +{ + return @[ + + ]; +} + +@end diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm new file mode 100644 index 0000000000..8dc35f047f --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm @@ -0,0 +1,16 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#import "RNFBFunctionsSpec.h" + + diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h new file mode 100644 index 0000000000..372e79de2c --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h @@ -0,0 +1,38 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#ifndef __cplusplus +#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. +#endif + +// Avoid multiple includes of RNFBFunctionsSpec symbols +#ifndef RNFBFunctionsSpec_H +#define RNFBFunctionsSpec_H + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + + +NS_ASSUME_NONNULL_BEGIN + + +NS_ASSUME_NONNULL_END +#endif // RNFBFunctionsSpec_H diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp new file mode 100644 index 0000000000..7775895216 --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp @@ -0,0 +1,17 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleCpp.js + */ + +#include "RNFBFunctionsSpecJSI.h" + +namespace facebook::react { + + + + +} // namespace facebook::react diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h b/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h new file mode 100644 index 0000000000..ec162608da --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h @@ -0,0 +1,19 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#pragma once + +#include +#include + +namespace facebook::react { + + + +} // namespace facebook::react diff --git a/packages/functions/ios/generated/ReactAppDependencyProvider.podspec b/packages/functions/ios/generated/ReactAppDependencyProvider.podspec new file mode 100644 index 0000000000..c80e01dae7 --- /dev/null +++ b/packages/functions/ios/generated/ReactAppDependencyProvider.podspec @@ -0,0 +1,34 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +version = "0.80.1" +source = { :git => 'https://github.com/facebook/react-native.git' } +if version == '1000.0.0' + # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. + source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") +else + source[:tag] = "v#{version}" +end + +Pod::Spec.new do |s| + s.name = "ReactAppDependencyProvider" + s.version = version + s.summary = "The third party dependency provider for the app" + s.homepage = "https://reactnative.dev/" + s.documentation_url = "https://reactnative.dev/" + s.license = "MIT" + s.author = "Meta Platforms, Inc. and its affiliates" + s.platforms = min_supported_versions + s.source = source + s.source_files = "**/RCTAppDependencyProvider.{h,mm}" + + # This guard prevent to install the dependencies when we run `pod install` in the old architecture. + s.pod_target_xcconfig = { + "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(), + "DEFINES_MODULE" => "YES" + } + + s.dependency "ReactCodegen" +end diff --git a/packages/functions/ios/generated/ReactCodegen.podspec b/packages/functions/ios/generated/ReactCodegen.podspec new file mode 100644 index 0000000000..3a42f3a7b5 --- /dev/null +++ b/packages/functions/ios/generated/ReactCodegen.podspec @@ -0,0 +1,106 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +version = "0.80.1" +source = { :git => 'https://github.com/facebook/react-native.git' } +if version == '1000.0.0' + # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. + source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") +else + source[:tag] = "v#{version}" +end + +use_frameworks = ENV['USE_FRAMEWORKS'] != nil +folly_compiler_flags = Helpers::Constants.folly_config[:compiler_flags] +boost_compiler_flags = Helpers::Constants.boost_config[:compiler_flags] + +header_search_paths = [ + "\"$(PODS_ROOT)/ReactNativeDependencies\"", + "\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"", + "\"$(PODS_ROOT)/Headers/Private/React-Fabric\"", + "\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"", + "\"$(PODS_ROOT)/Headers/Private/Yoga\"", + "\"$(PODS_TARGET_SRCROOT)\"", +] +framework_search_paths = [] + +if use_frameworks + ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"]) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", [])) + .each { |search_path| + header_search_paths << "\"#{search_path}\"" + } +end + +Pod::Spec.new do |s| + s.name = "ReactCodegen" + s.version = version + s.summary = 'Temp pod for generated files for React Native' + s.homepage = 'https://facebook.com/' + s.license = 'Unlicense' + s.authors = 'Facebook' + s.compiler_flags = "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++20" + s.source = { :git => '' } + s.header_mappings_dir = './' + s.platforms = min_supported_versions + s.source_files = "**/*.{h,mm,cpp}" + s.exclude_files = "RCTAppDependencyProvider.{h,mm}" # these files are generated in the same codegen path but needs to belong to a different pod + s.pod_target_xcconfig = { + "HEADER_SEARCH_PATHS" => header_search_paths.join(' '), + "FRAMEWORK_SEARCH_PATHS" => framework_search_paths, + "OTHER_CPLUSPLUSFLAGS" => "$(inherited) #{folly_compiler_flags} #{boost_compiler_flags}" + } + + s.dependency "React-jsiexecutor" + s.dependency "RCTRequired" + s.dependency "RCTTypeSafety" + s.dependency "React-Core" + s.dependency "React-jsi" + s.dependency "ReactCommon/turbomodule/bridging" + s.dependency "ReactCommon/turbomodule/core" + s.dependency "React-NativeModulesApple" + s.dependency 'React-graphics' + s.dependency 'React-rendererdebug' + s.dependency 'React-Fabric' + s.dependency 'React-FabricImage' + s.dependency 'React-debug' + s.dependency 'React-utils' + s.dependency 'React-featureflags' + s.dependency 'React-RCTAppDelegate' + + depend_on_js_engine(s) + add_rn_third_party_dependencies(s) + + s.script_phases = { + 'name' => 'Generate Specs', + 'execution_position' => :before_compile, + 'input_files' => ["${PODS_ROOT}/../.."], + 'show_env_vars_in_log' => true, + 'output_files' => ["${DERIVED_FILE_DIR}/react-codegen.log"], + 'script': <<-SCRIPT +pushd "$PODS_ROOT/../" > /dev/null +RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd) +popd >/dev/null + +export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../../node_modules/react-native" +export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../.." +export RCT_SCRIPT_OUTPUT_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT" +export RCT_SCRIPT_TYPE="withCodegenDiscovery" + +SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh" +WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh" +/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT" +SCRIPT + } + +end From 7eda482c8d14f926f1aa441ee53c9aa4ca5e98d2 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 11:57:19 +0100 Subject: [PATCH 26/79] update podspec & config file as per RN docs --- packages/functions/RNFBFunctions.podspec | 2 +- packages/functions/react-native.config.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 packages/functions/react-native.config.js diff --git a/packages/functions/RNFBFunctions.podspec b/packages/functions/RNFBFunctions.podspec index 16c4118ffc..251c28c7d9 100644 --- a/packages/functions/RNFBFunctions.podspec +++ b/packages/functions/RNFBFunctions.podspec @@ -27,7 +27,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = firebase_ios_target s.macos.deployment_target = firebase_macos_target s.tvos.deployment_target = firebase_tvos_target - s.source_files = 'ios/**/*.{h,m}' + s.source_files = 'ios/**/*.{h,m, mm, cpp}' # React Native dependencies s.dependency 'React-Core' diff --git a/packages/functions/react-native.config.js b/packages/functions/react-native.config.js new file mode 100644 index 0000000000..e10513f186 --- /dev/null +++ b/packages/functions/react-native.config.js @@ -0,0 +1,10 @@ +module.exports = { + dependency: { + platforms: { + android: { + cmakeListsPath: + './android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt', + }, + }, + }, +}; From e714ad845b46cb75e29db07df3284cab8932f170 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 12:20:47 +0100 Subject: [PATCH 27/79] rm generated code --- .../functions/generated/jni/CMakeLists.txt | 36 ---- .../jni/RNFBFunctionsSpec-generated.cpp | 22 --- .../generated/jni/RNFBFunctionsSpec.h | 24 --- .../RNFBFunctionsSpecJSI-generated.cpp | 17 -- .../RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h | 19 -- .../ios/generated/RCTAppDependencyProvider.h | 25 --- .../ios/generated/RCTAppDependencyProvider.mm | 40 ---- .../ios/generated/RCTModuleProviders.h | 16 -- .../ios/generated/RCTModuleProviders.mm | 51 ----- .../RCTModulesConformingToProtocolsProvider.h | 18 -- ...RCTModulesConformingToProtocolsProvider.mm | 54 ----- .../RCTThirdPartyComponentsProvider.h | 16 -- .../RCTThirdPartyComponentsProvider.mm | 30 --- ...leModulesRequiringMainQueueSetupProvider.h | 14 -- ...eModulesRequiringMainQueueSetupProvider.mm | 19 -- .../RNFBFunctionsSpec-generated.mm | 16 -- .../RNFBFunctionsSpec/RNFBFunctionsSpec.h | 38 ---- .../RNFBFunctionsSpecJSI-generated.cpp | 17 -- .../ios/generated/RNFBFunctionsSpecJSI.h | 19 -- .../ReactAppDependencyProvider.podspec | 34 ---- .../ios/generated/ReactCodegen.podspec | 106 ---------- ...unctionsSpec.ts => NativeFunctionsSpec.ts} | 2 +- tests/ios/Podfile.lock | 184 +++++++++--------- 23 files changed, 93 insertions(+), 724 deletions(-) delete mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt delete mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp delete mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h delete mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp delete mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h delete mode 100644 packages/functions/ios/generated/RCTAppDependencyProvider.h delete mode 100644 packages/functions/ios/generated/RCTAppDependencyProvider.mm delete mode 100644 packages/functions/ios/generated/RCTModuleProviders.h delete mode 100644 packages/functions/ios/generated/RCTModuleProviders.mm delete mode 100644 packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h delete mode 100644 packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm delete mode 100644 packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h delete mode 100644 packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm delete mode 100644 packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h delete mode 100644 packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm delete mode 100644 packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm delete mode 100644 packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h delete mode 100644 packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp delete mode 100644 packages/functions/ios/generated/RNFBFunctionsSpecJSI.h delete mode 100644 packages/functions/ios/generated/ReactAppDependencyProvider.podspec delete mode 100644 packages/functions/ios/generated/ReactCodegen.podspec rename packages/functions/specs/{RNFBFunctionsSpec.ts => NativeFunctionsSpec.ts} (94%) diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt deleted file mode 100644 index 0eaaad455e..0000000000 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -cmake_minimum_required(VERSION 3.13) -set(CMAKE_VERBOSE_MAKEFILE on) - -file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNFBFunctionsSpec/*.cpp) - -add_library( - react_codegen_RNFBFunctionsSpec - OBJECT - ${react_codegen_SRCS} -) - -target_include_directories(react_codegen_RNFBFunctionsSpec PUBLIC . react/renderer/components/RNFBFunctionsSpec) - -target_link_libraries( - react_codegen_RNFBFunctionsSpec - fbjni - jsi - # We need to link different libraries based on whether we are building rncore or not, that's necessary - # because we want to break a circular dependency between react_codegen_rncore and reactnative - reactnative -) - -target_compile_options( - react_codegen_RNFBFunctionsSpec - PRIVATE - -DLOG_TAG=\"ReactNative\" - -fexceptions - -frtti - -std=c++20 - -Wall -) diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp deleted file mode 100644 index 5305b23af2..0000000000 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleJniCpp.js - */ - -#include "RNFBFunctionsSpec.h" - -namespace facebook::react { - - - -std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { - - return nullptr; -} - -} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h deleted file mode 100644 index 20449d421b..0000000000 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h +++ /dev/null @@ -1,24 +0,0 @@ - -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleJniH.js - */ - -#pragma once - -#include -#include -#include - -namespace facebook::react { - - - -JSI_EXPORT -std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms); - -} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp deleted file mode 100644 index 7775895216..0000000000 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleCpp.js - */ - -#include "RNFBFunctionsSpecJSI.h" - -namespace facebook::react { - - - - -} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h deleted file mode 100644 index ec162608da..0000000000 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleH.js - */ - -#pragma once - -#include -#include - -namespace facebook::react { - - - -} // namespace facebook::react diff --git a/packages/functions/ios/generated/RCTAppDependencyProvider.h b/packages/functions/ios/generated/RCTAppDependencyProvider.h deleted file mode 100644 index 5a1502d16f..0000000000 --- a/packages/functions/ios/generated/RCTAppDependencyProvider.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -#import - -#if __has_include() -#import -#elif __has_include() -#import -#else -#import "RCTDependencyProvider.h" -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface RCTAppDependencyProvider : NSObject - -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/functions/ios/generated/RCTAppDependencyProvider.mm b/packages/functions/ios/generated/RCTAppDependencyProvider.mm deleted file mode 100644 index b76c468c8a..0000000000 --- a/packages/functions/ios/generated/RCTAppDependencyProvider.mm +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTAppDependencyProvider.h" -#import -#import -#import -#import - -@implementation RCTAppDependencyProvider - -- (nonnull NSArray *)URLRequestHandlerClassNames { - return RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames; -} - -- (nonnull NSArray *)imageDataDecoderClassNames { - return RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames; -} - -- (nonnull NSArray *)imageURLLoaderClassNames { - return RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames; -} - -- (nonnull NSArray *)unstableModulesRequiringMainQueueSetup { - return RCTUnstableModulesRequiringMainQueueSetupProvider.modules; -} - -- (nonnull NSDictionary> *)thirdPartyFabricComponents { - return RCTThirdPartyComponentsProvider.thirdPartyFabricComponents; -} - -- (nonnull NSDictionary> *)moduleProviders { - return RCTModuleProviders.moduleProviders; -} - -@end diff --git a/packages/functions/ios/generated/RCTModuleProviders.h b/packages/functions/ios/generated/RCTModuleProviders.h deleted file mode 100644 index aff637c692..0000000000 --- a/packages/functions/ios/generated/RCTModuleProviders.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol RCTModuleProvider; - -@interface RCTModuleProviders: NSObject - -+ (NSDictionary> *)moduleProviders; - -@end diff --git a/packages/functions/ios/generated/RCTModuleProviders.mm b/packages/functions/ios/generated/RCTModuleProviders.mm deleted file mode 100644 index 7a51188044..0000000000 --- a/packages/functions/ios/generated/RCTModuleProviders.mm +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "RCTModuleProviders.h" -#import -#import - -@implementation RCTModuleProviders - -+ (NSDictionary> *)moduleProviders -{ - static NSDictionary> *providers = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - NSDictionary * moduleMapping = @{ - - }; - - NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:moduleMapping.count]; - - for (NSString *key in moduleMapping) { - NSString * moduleProviderName = moduleMapping[key]; - Class klass = NSClassFromString(moduleProviderName); - if (!klass) { - RCTLogError(@"Module provider %@ cannot be found in the runtime", moduleProviderName); - continue; - } - - id instance = [klass new]; - if (![instance respondsToSelector:@selector(getTurboModule:)]) { - RCTLogError(@"Module provider %@ does not conform to RCTModuleProvider", moduleProviderName); - continue; - } - - [dict setObject:instance forKey:key]; - } - - providers = dict; - }); - - return providers; -} - -@end diff --git a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h deleted file mode 100644 index 10eb848917..0000000000 --- a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTModulesConformingToProtocolsProvider: NSObject - -+(NSArray *)imageURLLoaderClassNames; - -+(NSArray *)imageDataDecoderClassNames; - -+(NSArray *)URLRequestHandlerClassNames; - -@end diff --git a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm deleted file mode 100644 index a5ff82810e..0000000000 --- a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModulesConformingToProtocolsProvider.h" - -@implementation RCTModulesConformingToProtocolsProvider - -+(NSArray *)imageURLLoaderClassNames -{ - static NSArray *classNames = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - classNames = @[ - - ]; - }); - - return classNames; -} - -+(NSArray *)imageDataDecoderClassNames -{ - static NSArray *classNames = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - classNames = @[ - - ]; - }); - - return classNames; -} - -+(NSArray *)URLRequestHandlerClassNames -{ - static NSArray *classNames = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - classNames = @[ - - ]; - }); - - return classNames; -} - -@end diff --git a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h deleted file mode 100644 index ab1a249de3..0000000000 --- a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol RCTComponentViewProtocol; - -@interface RCTThirdPartyComponentsProvider: NSObject - -+ (NSDictionary> *)thirdPartyFabricComponents; - -@end diff --git a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm deleted file mode 100644 index 4e05532c39..0000000000 --- a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -#import - -#import "RCTThirdPartyComponentsProvider.h" -#import - -@implementation RCTThirdPartyComponentsProvider - -+ (NSDictionary> *)thirdPartyFabricComponents -{ - static NSDictionary> *thirdPartyComponents = nil; - static dispatch_once_t nativeComponentsToken; - - dispatch_once(&nativeComponentsToken, ^{ - thirdPartyComponents = @{ - - }; - }); - - return thirdPartyComponents; -} - -@end diff --git a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h deleted file mode 100644 index 114d32253a..0000000000 --- a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTUnstableModulesRequiringMainQueueSetupProvider: NSObject - -+(NSArray *)modules; - -@end diff --git a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm deleted file mode 100644 index 9cc59ed7e3..0000000000 --- a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTUnstableModulesRequiringMainQueueSetupProvider.h" - -@implementation RCTUnstableModulesRequiringMainQueueSetupProvider - -+(NSArray *)modules -{ - return @[ - - ]; -} - -@end diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm deleted file mode 100644 index 8dc35f047f..0000000000 --- a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleObjCpp - * - * We create an umbrella header (and corresponding implementation) here since - * Cxx compilation in BUCK has a limitation: source-code producing genrule()s - * must have a single output. More files => more genrule()s => slower builds. - */ - -#import "RNFBFunctionsSpec.h" - - diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h deleted file mode 100644 index 372e79de2c..0000000000 --- a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleObjCpp - * - * We create an umbrella header (and corresponding implementation) here since - * Cxx compilation in BUCK has a limitation: source-code producing genrule()s - * must have a single output. More files => more genrule()s => slower builds. - */ - -#ifndef __cplusplus -#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. -#endif - -// Avoid multiple includes of RNFBFunctionsSpec symbols -#ifndef RNFBFunctionsSpec_H -#define RNFBFunctionsSpec_H - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - - -NS_ASSUME_NONNULL_BEGIN - - -NS_ASSUME_NONNULL_END -#endif // RNFBFunctionsSpec_H diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp deleted file mode 100644 index 7775895216..0000000000 --- a/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleCpp.js - */ - -#include "RNFBFunctionsSpecJSI.h" - -namespace facebook::react { - - - - -} // namespace facebook::react diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h b/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h deleted file mode 100644 index ec162608da..0000000000 --- a/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleH.js - */ - -#pragma once - -#include -#include - -namespace facebook::react { - - - -} // namespace facebook::react diff --git a/packages/functions/ios/generated/ReactAppDependencyProvider.podspec b/packages/functions/ios/generated/ReactAppDependencyProvider.podspec deleted file mode 100644 index c80e01dae7..0000000000 --- a/packages/functions/ios/generated/ReactAppDependencyProvider.podspec +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -version = "0.80.1" -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |s| - s.name = "ReactAppDependencyProvider" - s.version = version - s.summary = "The third party dependency provider for the app" - s.homepage = "https://reactnative.dev/" - s.documentation_url = "https://reactnative.dev/" - s.license = "MIT" - s.author = "Meta Platforms, Inc. and its affiliates" - s.platforms = min_supported_versions - s.source = source - s.source_files = "**/RCTAppDependencyProvider.{h,mm}" - - # This guard prevent to install the dependencies when we run `pod install` in the old architecture. - s.pod_target_xcconfig = { - "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(), - "DEFINES_MODULE" => "YES" - } - - s.dependency "ReactCodegen" -end diff --git a/packages/functions/ios/generated/ReactCodegen.podspec b/packages/functions/ios/generated/ReactCodegen.podspec deleted file mode 100644 index 3a42f3a7b5..0000000000 --- a/packages/functions/ios/generated/ReactCodegen.podspec +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -version = "0.80.1" -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -use_frameworks = ENV['USE_FRAMEWORKS'] != nil -folly_compiler_flags = Helpers::Constants.folly_config[:compiler_flags] -boost_compiler_flags = Helpers::Constants.boost_config[:compiler_flags] - -header_search_paths = [ - "\"$(PODS_ROOT)/ReactNativeDependencies\"", - "\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"", - "\"$(PODS_ROOT)/Headers/Private/React-Fabric\"", - "\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"", - "\"$(PODS_ROOT)/Headers/Private/Yoga\"", - "\"$(PODS_TARGET_SRCROOT)\"", -] -framework_search_paths = [] - -if use_frameworks - ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"]) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", [])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", [])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", [])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", [])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", [])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", [])) - .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", [])) - .each { |search_path| - header_search_paths << "\"#{search_path}\"" - } -end - -Pod::Spec.new do |s| - s.name = "ReactCodegen" - s.version = version - s.summary = 'Temp pod for generated files for React Native' - s.homepage = 'https://facebook.com/' - s.license = 'Unlicense' - s.authors = 'Facebook' - s.compiler_flags = "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++20" - s.source = { :git => '' } - s.header_mappings_dir = './' - s.platforms = min_supported_versions - s.source_files = "**/*.{h,mm,cpp}" - s.exclude_files = "RCTAppDependencyProvider.{h,mm}" # these files are generated in the same codegen path but needs to belong to a different pod - s.pod_target_xcconfig = { - "HEADER_SEARCH_PATHS" => header_search_paths.join(' '), - "FRAMEWORK_SEARCH_PATHS" => framework_search_paths, - "OTHER_CPLUSPLUSFLAGS" => "$(inherited) #{folly_compiler_flags} #{boost_compiler_flags}" - } - - s.dependency "React-jsiexecutor" - s.dependency "RCTRequired" - s.dependency "RCTTypeSafety" - s.dependency "React-Core" - s.dependency "React-jsi" - s.dependency "ReactCommon/turbomodule/bridging" - s.dependency "ReactCommon/turbomodule/core" - s.dependency "React-NativeModulesApple" - s.dependency 'React-graphics' - s.dependency 'React-rendererdebug' - s.dependency 'React-Fabric' - s.dependency 'React-FabricImage' - s.dependency 'React-debug' - s.dependency 'React-utils' - s.dependency 'React-featureflags' - s.dependency 'React-RCTAppDelegate' - - depend_on_js_engine(s) - add_rn_third_party_dependencies(s) - - s.script_phases = { - 'name' => 'Generate Specs', - 'execution_position' => :before_compile, - 'input_files' => ["${PODS_ROOT}/../.."], - 'show_env_vars_in_log' => true, - 'output_files' => ["${DERIVED_FILE_DIR}/react-codegen.log"], - 'script': <<-SCRIPT -pushd "$PODS_ROOT/../" > /dev/null -RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd) -popd >/dev/null - -export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../../node_modules/react-native" -export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../.." -export RCT_SCRIPT_OUTPUT_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT" -export RCT_SCRIPT_TYPE="withCodegenDiscovery" - -SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh" -WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh" -/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT" -SCRIPT - } - -end diff --git a/packages/functions/specs/RNFBFunctionsSpec.ts b/packages/functions/specs/NativeFunctionsSpec.ts similarity index 94% rename from packages/functions/specs/RNFBFunctionsSpec.ts rename to packages/functions/specs/NativeFunctionsSpec.ts index ad9d2c295a..eb9393e653 100644 --- a/packages/functions/specs/RNFBFunctionsSpec.ts +++ b/packages/functions/specs/NativeFunctionsSpec.ts @@ -39,4 +39,4 @@ export interface Spec extends TurboModule { ): Promise<{ data: any }>; } -export default TurboModuleRegistry.getEnforcing('RNFBFunctionsModule'); +export default TurboModuleRegistry.getEnforcing('NativeFunctionsSpec'); diff --git a/tests/ios/Podfile.lock b/tests/ios/Podfile.lock index 239a1dda27..deaf04760f 100644 --- a/tests/ios/Podfile.lock +++ b/tests/ios/Podfile.lock @@ -82,7 +82,7 @@ PODS: - FirebaseCore (~> 11.13.0) - GoogleUtilities/Environment (~> 8.1) - GoogleUtilities/UserDefaults (~> 8.1) - - FirebaseAppCheckInterop (11.13.0) + - FirebaseAppCheckInterop (11.14.0) - FirebaseAppDistribution (11.13.0-beta): - FirebaseCore (~> 11.13.0) - FirebaseInstallations (~> 11.0) @@ -97,7 +97,7 @@ PODS: - GoogleUtilities/Environment (~> 8.1) - GTMSessionFetcher/Core (< 5.0, >= 3.4) - RecaptchaInterop (~> 101.0) - - FirebaseAuthInterop (11.13.0) + - FirebaseAuthInterop (11.14.0) - FirebaseCore (11.13.0): - FirebaseCoreInternal (~> 11.13.0) - GoogleUtilities/Environment (~> 8.1) @@ -173,7 +173,7 @@ PODS: - GoogleUtilities/Reachability (~> 8.1) - GoogleUtilities/UserDefaults (~> 8.1) - nanopb (~> 3.30910.0) - - FirebaseMessagingInterop (11.13.0) + - FirebaseMessagingInterop (11.14.0) - FirebasePerformance (11.13.0): - FirebaseCore (~> 11.13.0) - FirebaseInstallations (~> 11.0) @@ -192,7 +192,7 @@ PODS: - FirebaseSharedSwift (~> 11.0) - GoogleUtilities/Environment (~> 8.1) - "GoogleUtilities/NSData+zlib (~> 8.1)" - - FirebaseRemoteConfigInterop (11.13.0) + - FirebaseRemoteConfigInterop (11.14.0) - FirebaseSessions (11.13.0): - FirebaseCore (~> 11.13.0) - FirebaseCoreExtension (~> 11.13.0) @@ -1817,73 +1817,73 @@ PODS: - Yoga - RNDeviceInfo (14.0.4): - React-Core - - RNFBAnalytics (22.2.0): + - RNFBAnalytics (22.2.1): - Firebase/Analytics (= 11.13.0) - GoogleAppMeasurementOnDeviceConversion (= 11.13.0) - React-Core - RNFBApp - - RNFBApp (22.2.0): + - RNFBApp (22.2.1): - Firebase/CoreOnly (= 11.13.0) - React-Core - - RNFBAppCheck (22.2.0): + - RNFBAppCheck (22.2.1): - Firebase/AppCheck (= 11.13.0) - React-Core - RNFBApp - - RNFBAppDistribution (22.2.0): + - RNFBAppDistribution (22.2.1): - Firebase/AppDistribution (= 11.13.0) - React-Core - RNFBApp - - RNFBAuth (22.2.0): + - RNFBAuth (22.2.1): - Firebase/Auth (= 11.13.0) - React-Core - RNFBApp - - RNFBCrashlytics (22.2.0): + - RNFBCrashlytics (22.2.1): - Firebase/Crashlytics (= 11.13.0) - FirebaseCoreExtension - React-Core - RNFBApp - - RNFBDatabase (22.2.0): + - RNFBDatabase (22.2.1): - Firebase/Database (= 11.13.0) - React-Core - RNFBApp - - RNFBDynamicLinks (22.2.0): + - RNFBDynamicLinks (22.2.1): - Firebase/DynamicLinks (= 11.13.0) - GoogleUtilities/AppDelegateSwizzler - React-Core - RNFBApp - - RNFBFirestore (22.2.0): + - RNFBFirestore (22.2.1): - Firebase/Firestore (= 11.13.0) - React-Core - RNFBApp - - RNFBFunctions (22.2.0): + - RNFBFunctions (22.2.1): - Firebase/Functions (= 11.13.0) - React-Core - RNFBApp - - RNFBInAppMessaging (22.2.0): + - RNFBInAppMessaging (22.2.1): - Firebase/InAppMessaging (= 11.13.0) - React-Core - RNFBApp - - RNFBInstallations (22.2.0): + - RNFBInstallations (22.2.1): - Firebase/Installations (= 11.13.0) - React-Core - RNFBApp - - RNFBMessaging (22.2.0): + - RNFBMessaging (22.2.1): - Firebase/Messaging (= 11.13.0) - FirebaseCoreExtension - React-Core - RNFBApp - - RNFBML (22.2.0): + - RNFBML (22.2.1): - React-Core - RNFBApp - - RNFBPerf (22.2.0): + - RNFBPerf (22.2.1): - Firebase/Performance (= 11.13.0) - React-Core - RNFBApp - - RNFBRemoteConfig (22.2.0): + - RNFBRemoteConfig (22.2.1): - Firebase/RemoteConfig (= 11.13.0) - React-Core - RNFBApp - - RNFBStorage (22.2.0): + - RNFBStorage (22.2.1): - Firebase/Storage (= 11.13.0) - React-Core - RNFBApp @@ -2217,10 +2217,10 @@ SPEC CHECKSUMS: FirebaseABTesting: 4048f61cc10d2fad064d3089ace6bd5fb910169b FirebaseAnalytics: 630349facf4a114a0977e5d7570e104261973287 FirebaseAppCheck: 6097c3bdf50028493a86b28297d0f1f3309c0741 - FirebaseAppCheckInterop: 72066489c209823649a997132bcd9269bc33a4bb + FirebaseAppCheckInterop: a92ba81d0ee3c4cddb1a2e52c668ea51dc63c3ae FirebaseAppDistribution: 8eed20488ab59271d923fb4e3edd887ccb7c011c FirebaseAuth: 175cb5503dfdb52191b8ff81cdd52c1d9dee9ac9 - FirebaseAuthInterop: 4fa327ec3c551a80a6929561f83af80b1dd44937 + FirebaseAuthInterop: e25b58ecb90f3285085fa2118861a3c9dfdc62ad FirebaseCore: c692c7f1c75305ab6aff2b367f25e11d73aa8bd0 FirebaseCoreExtension: c048485c347616dba6165358dbef765c5197597b FirebaseCoreInternal: 29d7b3af4aaf0b8f3ed20b568c13df399b06f68c @@ -2238,10 +2238,10 @@ SPEC CHECKSUMS: FirebaseInAppMessaging: 33e667985f9027324a89da939cbc823002ab04a0 FirebaseInstallations: 0ee9074f2c1e86561ace168ee1470dc67aabaf02 FirebaseMessaging: 195bbdb73e6ca1dbc76cd46e73f3552c084ef6e4 - FirebaseMessagingInterop: ad5d6bacc76f222424334f3e21bc21868eb9e23a + FirebaseMessagingInterop: c07695471ba98ec7d4ffeb3491c34c105f8e8fcc FirebasePerformance: d8d51127a7d1fe977866813c75836f4911849a09 FirebaseRemoteConfig: 518ca257cdb2ccbc2b781ef2f2104f1104c7488f - FirebaseRemoteConfigInterop: 7915cec47731a806cda541f90898ad0fab8f9f86 + FirebaseRemoteConfigInterop: 7b74ceaa54e28863ed17fa39da8951692725eced FirebaseSessions: eaa8ec037e7793769defe4201c20bd4d976f9677 FirebaseSharedSwift: aca73668bc95e8efccb618e0167eab05d19d3a75 FirebaseStorage: 2a3e5402a565e06e121308dadfe0626976fd6b45 @@ -2257,87 +2257,87 @@ SPEC CHECKSUMS: nanopb: fad817b59e0457d11a5dfbde799381cd727c1275 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851 - RCT-Folly: e78785aa9ba2ed998ea4151e314036f6c49e6d82 + RCT-Folly: 36fe2295e44b10d831836cc0d1daec5f8abcf809 RCTDeprecation: be794de7dc6ed8f9f7fbf525f86e7651b8b68746 RCTRequired: a83787b092ec554c2eb6019ff3f5b8d125472b3b RCTTypeSafety: 48ad3c858926b1c46f46a81a58822b476e178e2c React: 3b5754191f1b65f1dbc52fbea7959c3d2d9e39c9 React-callinvoker: 6beeaf4c7db11b6cc953fac45f2c76e3fb125013 - React-Core: 8a10ac9de53373a3ecb5dfcbcf56df1d3dad0861 - React-CoreModules: af6999b35c7c01b0e12b59d27f3e054e13da43b1 - React-cxxreact: 833f00155ce8c2fda17f6d286f8eaeff2ececc69 + React-Core: 88e817c42de035378cc71e009193b9a044d3f595 + React-CoreModules: dcf764d71efb4f75d38fcae8d4513b6729f49360 + React-cxxreact: 8cdcc937c5fbc406fe843a381102fd69440ca78a React-debug: 0a9fb34ecb645333d905645dabdcfdc945626078 - React-defaultsnativemodule: e3129434d3fc44832b7121bcbdffbe86c29ef34d - React-domnativemodule: 0dd52f92aae48f433ae5fa56876b4d10ab543faf - React-Fabric: 413d5fbb4b5df36df2d63520d529118884c9410e - React-FabricComponents: faa9035cdd551de0eaf2752afaf0b0327932696a - React-FabricImage: d43f0147c170c73cc7b546f95b7b7da82a6f34fc + React-defaultsnativemodule: b5b92d4b4716825afa8c848b793fc7efdf8aeb5a + React-domnativemodule: 073b3161e1b49dfe9045884369ae1ec2b987de26 + React-Fabric: f62d9ce5c158ae40c2a7b2805b7c055297c9dad7 + React-FabricComponents: 4c48b1052f8f6c3b03c3c3e2a231f1abd6d89703 + React-FabricImage: 5ad03b0081353e1e047ae3471bb129c521bf02b1 React-featureflags: 1bfa283a0e6f26eac629e8cef2add1b2670b6f4e - React-featureflagsnativemodule: 82733d2214096feaf44c411de375749ee1cd564f - React-graphics: 87a183c58b6a5bd5c57ae8c9a8105955f07f3947 - React-hermes: 63df5ac5a944889c8758a6213b39ed825863adb7 - React-idlecallbacksnativemodule: 6eac06a2d491a4b081ac45ab03a5ecf8b12404fa - React-ImageManager: f30c60d98a0a41eb116bf7e22a0258c821747ad2 - React-jserrorhandler: d68cef591c019bd8cd93169d253d6fe860b17844 - React-jsi: 99d6207ec802ad73473a0dad3c9ad48cd98463f6 - React-jsiexecutor: 8c8097b4ba7e7f480582d6e6238b01be5dcc01c0 - React-jsinspector: 434f39b00a5850b5479c7c0f0d06b480482d51a1 - React-jsinspectortracing: d43a8b9f953510ecebe3b5ec7e9676bef2d2c7f0 - React-jsitracing: 1df3b12bab22b3bc9078f54eefa53f82ba981dee - React-logger: 763728cf4eebc9c5dc9bfc3649e22295784f69f3 - React-Mapbuffer: 86e068fae064bbd3f24781d6ae5445b0266b2a10 - React-microtasksnativemodule: fd98e3e44af51599576705ec7a85a36e35978913 - React-NativeModulesApple: 5c61cef9e7f0e1d6216ff0af41a3b882806a5cec - React-perflogger: 5f8fa36a8e168fb355efe72099efe77213bc2ac6 - React-performancetimeline: 4f3521ee6238c9caf1b0969da2c4f610ff72b922 + React-featureflagsnativemodule: 7dc781f04bbd4b394fccb85e187bdda954362bca + React-graphics: 7eefc878da8a522942358f53abd6a7170d757bf3 + React-hermes: 08ad9fb832d1b9faef391be17309aa6a69fad23b + React-idlecallbacksnativemodule: 4a5d5ee0f8d7a9fa94ebd1426d349e866c223979 + React-ImageManager: ce227ed251701b3f37e25a2beede459078fcd82c + React-jserrorhandler: 6e5ffaef9b3364351ef6ef58d6665beabf615a0e + React-jsi: afa286d7e0c102c2478dc420d4f8935e13c973fc + React-jsiexecutor: 08f5b512b4db9e2f147416d60a0a797576b9cfef + React-jsinspector: ebe0817345b1c0194ed5c64185269b9668fadf9a + React-jsinspectortracing: 6f251cb68796f3496698127deabe5b0bbbb89b52 + React-jsitracing: 4c3fd6a14f560c52c167254a07029bcf9b60f3d8 + React-logger: 304814ae37503c8eb54359851cc55bd4f936b39c + React-Mapbuffer: 8ba61e036d346d363ad208cfb1dea6c7fce0dce0 + React-microtasksnativemodule: feb934d19767f38faf9f9f0efb7cc1dcdf2d11b7 + React-NativeModulesApple: 55d6d890aa60200292a90cc1ca6c53409650f48f + React-perflogger: 0ea25c109dba33d47dec36b2634bf7ea67c1a555 + React-performancetimeline: 21656d07aede48ca0c8c3ca7d0e755eaa17f697c React-RCTActionSheet: 2ef95837e89b9b154f13cd8401f9054fc3076aff - React-RCTAnimation: 46abefd5acfda7e6629f9e153646deecc70babd2 - React-RCTAppDelegate: 7e58e0299e304cceee3f7019fa77bc6990f66b22 - React-RCTBlob: f68c63a801ef1d27e83c4011e3b083cc86a200d7 - React-RCTFabric: ee035e3c73729b95da4ee0959b6e0d68cd512368 - React-RCTFBReactNativeSpec: 3240b9b8d792aa4be0fb85c9898fc183125ba8de - React-RCTImage: 34e0bba1507e55f1c614bd759eb91d9be48c8c5b - React-RCTLinking: a0b6c9f4871c18b0b81ea952f43e752718bd5f1d - React-RCTNetwork: bdafd661ac2b20d23b779e45bf7ac3e4c8bd1b60 - React-RCTSettings: 98aa5163796f43789314787b584a84eba47787a9 - React-RCTText: 424a274fc9015b29de89cf3cbcdf4dd85dd69f83 - React-RCTVibration: 92d9875a955b0adb34b4b773528fdbbbc5addd6c + React-RCTAnimation: 33d960d7f58a81779eea6dea47ad0364c67e1517 + React-RCTAppDelegate: 85c13403fd6f6b6cc630428d52bd8bd76a670dc9 + React-RCTBlob: 74c986a02d951931d2f6ed0e07ed5a7eb385bfc0 + React-RCTFabric: 384a6e22644799f66f545bf0de4618f4652c791f + React-RCTFBReactNativeSpec: eb1c3ec5149f76133593a516ff9d5efe32ebcecd + React-RCTImage: 2c58b5ddeb3c65e52f942bbe13ff9c59bd649b09 + React-RCTLinking: b6b14f8a3e62c02fc627ac4f3fb0c7bd941f907c + React-RCTNetwork: 1d050f2466c1541b339587d46f78d5eee218d626 + React-RCTSettings: 8148f6be0ccc0cfe6e313417ebf8a479caaa2146 + React-RCTText: 64114531ad1359e4e02a4a8af60df606dbbabc25 + React-RCTVibration: f4859417a7dd859b6bf18b1aba897e52beb72ef6 React-rendererconsistency: 80ffb3fc9635edb785c19f06eb1ba9e1d3b85ea6 - React-rendererdebug: ae050d2e1ad48d69fa20a7060766c9f132416ffa + React-rendererdebug: ea9b0383484ade00d675582d7848be6a86c3feb5 React-rncore: 7c0b895671632ea5eb84edb85f48e180816e9e33 - React-RuntimeApple: c85771bc5430980a8469ad3b28a3c8dd07f95979 - React-RuntimeCore: 45cbbed881ce89605c779b3f4111664664b63897 + React-RuntimeApple: 8e0654961ab947d3febc60f77a4d9fe97e135d0a + React-RuntimeCore: b194b603daafd68b140ab4c871f1556efc2c69bc React-runtimeexecutor: 876dfc1d8daa819dfd039c40f78f277c5a3e66a6 - React-RuntimeHermes: eb7f7ad2ad9d0bbe5e4e2521aae96de55bd4096a - React-runtimescheduler: 9957105c1d7f068a1c00760a9c332167634f945a + React-RuntimeHermes: f337612527ff2ca8bb86a861be4636f177bc3bbb + React-runtimescheduler: 307946600cf701b3ffe38b454d1d1a710e8e74e7 React-timing: 96e060d0d0bf18522d363716623ed2c61f7107c7 - React-utils: 93529ff7b4baa71aea1f42a48e9d3d06db398618 - ReactAppDependencyProvider: 4893bde33952f997a323eb1a1ee87a72764018ff - ReactCodegen: 31f8d982d351eb4dbf3af220f363c7398ae667c8 - ReactCommon: 0adf8f24a3415b6815613bad362d390726b33fc7 + React-utils: 8adf5864fc96ef51957fee06a3e43ed26559d8a7 + ReactAppDependencyProvider: b48473fe434569ff8f6cb6ed4421217ebcbda878 + ReactCodegen: dbfd0fb94c71add45b06cd6c96ccc7545489c1e6 + ReactCommon: 8fdc2d8511f4099f25d5929f7fa4284c14a7e509 RecaptchaInterop: 11e0b637842dfb48308d242afc3f448062325aba - RNCAsyncStorage: 5321442ed26760d7581b26effab82399ea5ff18b - RNDeviceInfo: d863506092aef7e7af3a1c350c913d867d795047 - RNFBAnalytics: c790d199534cbdeb8ab6eae57fcc0a6dffd329a2 - RNFBApp: 20dd96089e67269049587de043ee2c7b47b696cb - RNFBAppCheck: fe3cbf8208eb88ed5cfc88a731d9c781b25fd6d9 - RNFBAppDistribution: 329952b4dc3c89f1b0006277b4b0c0e62f6eb8cf - RNFBAuth: 8c349706a2df0588b5c35af6ac3706fa87112659 - RNFBCrashlytics: 367e9f0d2af9d0772598b55e3574a893260edb6c - RNFBDatabase: 7b36ee0312e973f0d181b2a388cb461ebbddabd0 - RNFBDynamicLinks: 4ea828d2ab9169a013dba99a55d6ce11107fcc12 - RNFBFirestore: 210ee499df7963368a212edf22e3fb5efa2ab44e - RNFBFunctions: 634d4b8db8e9c41cdae7187c5708b0369ace0f3a - RNFBInAppMessaging: 26ad1ff74cc6c300f863dd230a32b8bab738e247 - RNFBInstallations: e8e366d773b558b708629a377a9bcce41d5eda30 - RNFBMessaging: 906a1d15dbdde8d3a39dd9e492d699eda3e38d13 - RNFBML: 09dc58356d8dbfe7fe8fcb4ce3943b20a2ef6f76 - RNFBPerf: 3d137cc120fc107b83f5ee8821e851b1a4c70810 - RNFBRemoteConfig: 1c6b25afb8339db341d8917a4a7173c176a4b34b - RNFBStorage: 42af0c68d67cc6ca83df29df1d551847fb82153d + RNCAsyncStorage: 320c8b9217695928a64d8ae993653425c8605368 + RNDeviceInfo: feea80a690d2bde1fe51461cf548039258bd03f2 + RNFBAnalytics: e90c123b38ae48e174ddcca221888547a744783b + RNFBApp: 9ddaa4edee3ea7dfca8c866a4c1feca2439e2de6 + RNFBAppCheck: 63cbcd35bee5a20b3aab2b5c1d4825bacdec672d + RNFBAppDistribution: 663301a375a0d5a14f3fa598b193bd172b75c20c + RNFBAuth: 0b56c55119d269aae2d699ec751a4b13c2aa24fd + RNFBCrashlytics: 2d69f4c604cbed2cfa6e2efe6133c36b3059b721 + RNFBDatabase: fcfa7b19ac56c666827f10434f1f8257760fe174 + RNFBDynamicLinks: b8849df53de99a3ccc000125c6d69c3db29ddb20 + RNFBFirestore: dde90f839f5d712bd1ea8548d8324ba655fa48d7 + RNFBFunctions: 87ea4cec40d4351457acfce61bcfc1a881a5ef3e + RNFBInAppMessaging: 9810fe36b4f67011305883c8b7b19df207ec6bb4 + RNFBInstallations: 9acf5bb1917e358cd499a78d9e55ef9143cba203 + RNFBMessaging: 8ce084d2f49f59bae6d1abea130335d6b26969cd + RNFBML: 9bc53ef82200162faa19a7979f45cf5369fee692 + RNFBPerf: be64b6314aa23891e38778ac7f7b56a2134228cd + RNFBRemoteConfig: 1c6a8d9765283a9ed1b537fb1537a2d9cd5d7883 + RNFBStorage: 9836f85ce846bb4d4819364d566afceeccd1ae98 SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748 - Yoga: 6eb60fc2c0eef63e7d2ef4a56e0a3353534143a2 + Yoga: 0c521d2eddeeff54ba1126068140b6e970a77fc0 PODFILE CHECKSUM: 3abe8cfe7b06f24b788e90bea320d8ae6ea6d11a -COCOAPODS: 1.16.2 +COCOAPODS: 1.15.2 From 9f17910cc874ba64cd2157ef539e2f5e039a760c Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 12:58:26 +0100 Subject: [PATCH 28/79] rename to Native prefix otherwise ignored by codegen --- .../{NativeFunctionsSpec.ts => NativeFunctionsModule.ts} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename packages/functions/specs/{NativeFunctionsSpec.ts => NativeFunctionsModule.ts} (96%) diff --git a/packages/functions/specs/NativeFunctionsSpec.ts b/packages/functions/specs/NativeFunctionsModule.ts similarity index 96% rename from packages/functions/specs/NativeFunctionsSpec.ts rename to packages/functions/specs/NativeFunctionsModule.ts index eb9393e653..e136398ba7 100644 --- a/packages/functions/specs/NativeFunctionsSpec.ts +++ b/packages/functions/specs/NativeFunctionsModule.ts @@ -36,7 +36,7 @@ export interface Spec extends TurboModule { url: string, data: { data: any }, options: { timeout?: number }, - ): Promise<{ data: any }>; + ): Promise<{ data: unknown }>; } -export default TurboModuleRegistry.getEnforcing('NativeFunctionsSpec'); +export default TurboModuleRegistry.getEnforcing('NativeFunctionsModule'); From d8ffb3331e0bf7a6552d649da6f7a10b1bf9b98c Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 13:05:33 +0100 Subject: [PATCH 29/79] updated generic types for spec --- packages/functions/specs/NativeFunctionsModule.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/functions/specs/NativeFunctionsModule.ts b/packages/functions/specs/NativeFunctionsModule.ts index e136398ba7..429d9a4f60 100644 --- a/packages/functions/specs/NativeFunctionsModule.ts +++ b/packages/functions/specs/NativeFunctionsModule.ts @@ -1,6 +1,10 @@ import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; +// Define generic types outside the interface +export type RequestData = unknown; +export type ResponseData = unknown; + export interface Spec extends TurboModule { /** * Calls a Cloud Function with the given name and data. @@ -16,9 +20,9 @@ export interface Spec extends TurboModule { emulatorHost: string | null, emulatorPort: number, name: string, - data: { data: any }, + data: { data: RequestData }, options: { timeout?: number }, - ): Promise<{ data: any }>; + ): Promise<{ data: ResponseData }>; /** * Calls a Cloud Function using a full URL instead of just the function name. @@ -34,9 +38,9 @@ export interface Spec extends TurboModule { emulatorHost: string | null, emulatorPort: number, url: string, - data: { data: any }, + data: { data: RequestData }, options: { timeout?: number }, - ): Promise<{ data: unknown }>; + ): Promise<{ data: ResponseData }>; } export default TurboModuleRegistry.getEnforcing('NativeFunctionsModule'); From 4bd46077bc754ec5ac44268b23bfdab1ff5bb908 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 13:05:51 +0100 Subject: [PATCH 30/79] latest generated code based on updated spec --- .../specs/NativeFunctionsModuleSpec.java | 44 +++++ .../functions/generated/jni/CMakeLists.txt | 36 +++++ .../jni/RNFBFunctionsSpec-generated.cpp | 38 +++++ .../generated/jni/RNFBFunctionsSpec.h | 31 ++++ .../RNFBFunctionsSpecJSI-generated.cpp | 42 +++++ .../RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h | 80 +++++++++ .../ios/generated/RCTAppDependencyProvider.h | 25 +++ .../ios/generated/RCTAppDependencyProvider.mm | 40 +++++ .../ios/generated/RCTModuleProviders.h | 16 ++ .../ios/generated/RCTModuleProviders.mm | 51 ++++++ .../RCTModulesConformingToProtocolsProvider.h | 18 +++ ...RCTModulesConformingToProtocolsProvider.mm | 54 +++++++ .../RCTThirdPartyComponentsProvider.h | 16 ++ .../RCTThirdPartyComponentsProvider.mm | 30 ++++ ...leModulesRequiringMainQueueSetupProvider.h | 14 ++ ...eModulesRequiringMainQueueSetupProvider.mm | 19 +++ .../RNFBFunctionsSpec-generated.mm | 71 ++++++++ .../RNFBFunctionsSpec/RNFBFunctionsSpec.h | 153 ++++++++++++++++++ .../RNFBFunctionsSpecJSI-generated.cpp | 42 +++++ .../ios/generated/RNFBFunctionsSpecJSI.h | 80 +++++++++ .../ReactAppDependencyProvider.podspec | 34 ++++ .../ios/generated/ReactCodegen.podspec | 106 ++++++++++++ 22 files changed, 1040 insertions(+) create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/java/com/facebook/fbreact/specs/NativeFunctionsModuleSpec.java create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h create mode 100644 packages/functions/ios/generated/RCTAppDependencyProvider.h create mode 100644 packages/functions/ios/generated/RCTAppDependencyProvider.mm create mode 100644 packages/functions/ios/generated/RCTModuleProviders.h create mode 100644 packages/functions/ios/generated/RCTModuleProviders.mm create mode 100644 packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h create mode 100644 packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm create mode 100644 packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h create mode 100644 packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm create mode 100644 packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h create mode 100644 packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp create mode 100644 packages/functions/ios/generated/RNFBFunctionsSpecJSI.h create mode 100644 packages/functions/ios/generated/ReactAppDependencyProvider.podspec create mode 100644 packages/functions/ios/generated/ReactCodegen.podspec diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/java/com/facebook/fbreact/specs/NativeFunctionsModuleSpec.java b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/java/com/facebook/fbreact/specs/NativeFunctionsModuleSpec.java new file mode 100644 index 0000000000..c49a11cdca --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/java/com/facebook/fbreact/specs/NativeFunctionsModuleSpec.java @@ -0,0 +1,44 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs; + +import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public abstract class NativeFunctionsModuleSpec extends ReactContextBaseJavaModule implements TurboModule { + public static final String NAME = "NativeFunctionsModule"; + + public NativeFunctionsModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + @Override + public @Nonnull String getName() { + return NAME; + } + + @ReactMethod + @DoNotStrip + public abstract void httpsCallable(@Nullable String emulatorHost, double emulatorPort, String name, ReadableMap data, ReadableMap options, Promise promise); + + @ReactMethod + @DoNotStrip + public abstract void httpsCallableFromUrl(@Nullable String emulatorHost, double emulatorPort, String url, ReadableMap data, ReadableMap options, Promise promise); +} diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt new file mode 100644 index 0000000000..0eaaad455e --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt @@ -0,0 +1,36 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_VERBOSE_MAKEFILE on) + +file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNFBFunctionsSpec/*.cpp) + +add_library( + react_codegen_RNFBFunctionsSpec + OBJECT + ${react_codegen_SRCS} +) + +target_include_directories(react_codegen_RNFBFunctionsSpec PUBLIC . react/renderer/components/RNFBFunctionsSpec) + +target_link_libraries( + react_codegen_RNFBFunctionsSpec + fbjni + jsi + # We need to link different libraries based on whether we are building rncore or not, that's necessary + # because we want to break a circular dependency between react_codegen_rncore and reactnative + reactnative +) + +target_compile_options( + react_codegen_RNFBFunctionsSpec + PRIVATE + -DLOG_TAG=\"ReactNative\" + -fexceptions + -frtti + -std=c++20 + -Wall +) diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp new file mode 100644 index 0000000000..7dbbd4f09c --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp @@ -0,0 +1,38 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniCpp.js + */ + +#include "RNFBFunctionsSpec.h" + +namespace facebook::react { + +static facebook::jsi::Value __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallable(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, "httpsCallable", "(Ljava/lang/String;DLjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId); +} + +static facebook::jsi::Value __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallableFromUrl(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + static jmethodID cachedMethodId = nullptr; + return static_cast(turboModule).invokeJavaMethod(rt, PromiseKind, "httpsCallableFromUrl", "(Ljava/lang/String;DLjava/lang/String;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId); +} + +NativeFunctionsModuleSpecJSI::NativeFunctionsModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) + : JavaTurboModule(params) { + methodMap_["httpsCallable"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallable}; + methodMap_["httpsCallableFromUrl"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallableFromUrl}; +} + +std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { + if (moduleName == "NativeFunctionsModule") { + return std::make_shared(params); + } + return nullptr; +} + +} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h new file mode 100644 index 0000000000..d3e83c8e90 --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h @@ -0,0 +1,31 @@ + +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniH.js + */ + +#pragma once + +#include +#include +#include + +namespace facebook::react { + +/** + * JNI C++ class for module 'NativeFunctionsModule' + */ +class JSI_EXPORT NativeFunctionsModuleSpecJSI : public JavaTurboModule { +public: + NativeFunctionsModuleSpecJSI(const JavaTurboModule::InitParams ¶ms); +}; + + +JSI_EXPORT +std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms); + +} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp new file mode 100644 index 0000000000..c30171c04e --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp @@ -0,0 +1,42 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleCpp.js + */ + +#include "RNFBFunctionsSpecJSI.h" + +namespace facebook::react { + +static jsi::Value __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallable(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->httpsCallable( + rt, + count <= 0 || args[0].isNull() || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asString(rt)), + count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber(), + count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt), + count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asObject(rt), + count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asObject(rt) + ); +} +static jsi::Value __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallableFromUrl(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->httpsCallableFromUrl( + rt, + count <= 0 || args[0].isNull() || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asString(rt)), + count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber(), + count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt), + count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asObject(rt), + count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asObject(rt) + ); +} + +NativeFunctionsModuleCxxSpecJSI::NativeFunctionsModuleCxxSpecJSI(std::shared_ptr jsInvoker) + : TurboModule("NativeFunctionsModule", jsInvoker) { + methodMap_["httpsCallable"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallable}; + methodMap_["httpsCallableFromUrl"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallableFromUrl}; +} + + +} // namespace facebook::react diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h new file mode 100644 index 0000000000..fd3bfec69d --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h @@ -0,0 +1,80 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#pragma once + +#include +#include + +namespace facebook::react { + + + class JSI_EXPORT NativeFunctionsModuleCxxSpecJSI : public TurboModule { +protected: + NativeFunctionsModuleCxxSpecJSI(std::shared_ptr jsInvoker); + +public: + virtual jsi::Value httpsCallable(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String name, jsi::Object data, jsi::Object options) = 0; + virtual jsi::Value httpsCallableFromUrl(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String url, jsi::Object data, jsi::Object options) = 0; + +}; + +template +class JSI_EXPORT NativeFunctionsModuleCxxSpec : public TurboModule { +public: + jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override { + return delegate_.create(rt, propName); + } + + std::vector getPropertyNames(jsi::Runtime& runtime) override { + return delegate_.getPropertyNames(runtime); + } + + static constexpr std::string_view kModuleName = "NativeFunctionsModule"; + +protected: + NativeFunctionsModuleCxxSpec(std::shared_ptr jsInvoker) + : TurboModule(std::string{NativeFunctionsModuleCxxSpec::kModuleName}, jsInvoker), + delegate_(reinterpret_cast(this), jsInvoker) {} + + +private: + class Delegate : public NativeFunctionsModuleCxxSpecJSI { + public: + Delegate(T *instance, std::shared_ptr jsInvoker) : + NativeFunctionsModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) { + + } + + jsi::Value httpsCallable(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String name, jsi::Object data, jsi::Object options) override { + static_assert( + bridging::getParameterCount(&T::httpsCallable) == 6, + "Expected httpsCallable(...) to have 6 parameters"); + + return bridging::callFromJs( + rt, &T::httpsCallable, jsInvoker_, instance_, std::move(emulatorHost), std::move(emulatorPort), std::move(name), std::move(data), std::move(options)); + } + jsi::Value httpsCallableFromUrl(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String url, jsi::Object data, jsi::Object options) override { + static_assert( + bridging::getParameterCount(&T::httpsCallableFromUrl) == 6, + "Expected httpsCallableFromUrl(...) to have 6 parameters"); + + return bridging::callFromJs( + rt, &T::httpsCallableFromUrl, jsInvoker_, instance_, std::move(emulatorHost), std::move(emulatorPort), std::move(url), std::move(data), std::move(options)); + } + + private: + friend class NativeFunctionsModuleCxxSpec; + T *instance_; + }; + + Delegate delegate_; +}; + +} // namespace facebook::react diff --git a/packages/functions/ios/generated/RCTAppDependencyProvider.h b/packages/functions/ios/generated/RCTAppDependencyProvider.h new file mode 100644 index 0000000000..5a1502d16f --- /dev/null +++ b/packages/functions/ios/generated/RCTAppDependencyProvider.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + +#import + +#if __has_include() +#import +#elif __has_include() +#import +#else +#import "RCTDependencyProvider.h" +#endif + +NS_ASSUME_NONNULL_BEGIN + +@interface RCTAppDependencyProvider : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/functions/ios/generated/RCTAppDependencyProvider.mm b/packages/functions/ios/generated/RCTAppDependencyProvider.mm new file mode 100644 index 0000000000..b76c468c8a --- /dev/null +++ b/packages/functions/ios/generated/RCTAppDependencyProvider.mm @@ -0,0 +1,40 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTAppDependencyProvider.h" +#import +#import +#import +#import + +@implementation RCTAppDependencyProvider + +- (nonnull NSArray *)URLRequestHandlerClassNames { + return RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames; +} + +- (nonnull NSArray *)imageDataDecoderClassNames { + return RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames; +} + +- (nonnull NSArray *)imageURLLoaderClassNames { + return RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames; +} + +- (nonnull NSArray *)unstableModulesRequiringMainQueueSetup { + return RCTUnstableModulesRequiringMainQueueSetupProvider.modules; +} + +- (nonnull NSDictionary> *)thirdPartyFabricComponents { + return RCTThirdPartyComponentsProvider.thirdPartyFabricComponents; +} + +- (nonnull NSDictionary> *)moduleProviders { + return RCTModuleProviders.moduleProviders; +} + +@end diff --git a/packages/functions/ios/generated/RCTModuleProviders.h b/packages/functions/ios/generated/RCTModuleProviders.h new file mode 100644 index 0000000000..aff637c692 --- /dev/null +++ b/packages/functions/ios/generated/RCTModuleProviders.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@protocol RCTModuleProvider; + +@interface RCTModuleProviders: NSObject + ++ (NSDictionary> *)moduleProviders; + +@end diff --git a/packages/functions/ios/generated/RCTModuleProviders.mm b/packages/functions/ios/generated/RCTModuleProviders.mm new file mode 100644 index 0000000000..7a51188044 --- /dev/null +++ b/packages/functions/ios/generated/RCTModuleProviders.mm @@ -0,0 +1,51 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +#import "RCTModuleProviders.h" +#import +#import + +@implementation RCTModuleProviders + ++ (NSDictionary> *)moduleProviders +{ + static NSDictionary> *providers = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + NSDictionary * moduleMapping = @{ + + }; + + NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:moduleMapping.count]; + + for (NSString *key in moduleMapping) { + NSString * moduleProviderName = moduleMapping[key]; + Class klass = NSClassFromString(moduleProviderName); + if (!klass) { + RCTLogError(@"Module provider %@ cannot be found in the runtime", moduleProviderName); + continue; + } + + id instance = [klass new]; + if (![instance respondsToSelector:@selector(getTurboModule:)]) { + RCTLogError(@"Module provider %@ does not conform to RCTModuleProvider", moduleProviderName); + continue; + } + + [dict setObject:instance forKey:key]; + } + + providers = dict; + }); + + return providers; +} + +@end diff --git a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h new file mode 100644 index 0000000000..10eb848917 --- /dev/null +++ b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface RCTModulesConformingToProtocolsProvider: NSObject + ++(NSArray *)imageURLLoaderClassNames; + ++(NSArray *)imageDataDecoderClassNames; + ++(NSArray *)URLRequestHandlerClassNames; + +@end diff --git a/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm new file mode 100644 index 0000000000..a5ff82810e --- /dev/null +++ b/packages/functions/ios/generated/RCTModulesConformingToProtocolsProvider.mm @@ -0,0 +1,54 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTModulesConformingToProtocolsProvider.h" + +@implementation RCTModulesConformingToProtocolsProvider + ++(NSArray *)imageURLLoaderClassNames +{ + static NSArray *classNames = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + classNames = @[ + + ]; + }); + + return classNames; +} + ++(NSArray *)imageDataDecoderClassNames +{ + static NSArray *classNames = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + classNames = @[ + + ]; + }); + + return classNames; +} + ++(NSArray *)URLRequestHandlerClassNames +{ + static NSArray *classNames = nil; + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + classNames = @[ + + ]; + }); + + return classNames; +} + +@end diff --git a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h new file mode 100644 index 0000000000..ab1a249de3 --- /dev/null +++ b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@protocol RCTComponentViewProtocol; + +@interface RCTThirdPartyComponentsProvider: NSObject + ++ (NSDictionary> *)thirdPartyFabricComponents; + +@end diff --git a/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm new file mode 100644 index 0000000000..4e05532c39 --- /dev/null +++ b/packages/functions/ios/generated/RCTThirdPartyComponentsProvider.mm @@ -0,0 +1,30 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + + +#import + +#import "RCTThirdPartyComponentsProvider.h" +#import + +@implementation RCTThirdPartyComponentsProvider + ++ (NSDictionary> *)thirdPartyFabricComponents +{ + static NSDictionary> *thirdPartyComponents = nil; + static dispatch_once_t nativeComponentsToken; + + dispatch_once(&nativeComponentsToken, ^{ + thirdPartyComponents = @{ + + }; + }); + + return thirdPartyComponents; +} + +@end diff --git a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h new file mode 100644 index 0000000000..114d32253a --- /dev/null +++ b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface RCTUnstableModulesRequiringMainQueueSetupProvider: NSObject + ++(NSArray *)modules; + +@end diff --git a/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm new file mode 100644 index 0000000000..9cc59ed7e3 --- /dev/null +++ b/packages/functions/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm @@ -0,0 +1,19 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTUnstableModulesRequiringMainQueueSetupProvider.h" + +@implementation RCTUnstableModulesRequiringMainQueueSetupProvider + ++(NSArray *)modules +{ + return @[ + + ]; +} + +@end diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm new file mode 100644 index 0000000000..fbd954fb3a --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm @@ -0,0 +1,71 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#import "RNFBFunctionsSpec.h" + + +@implementation NativeFunctionsModuleSpecBase + + +- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper +{ + _eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback); +} +@end + +@implementation RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableData) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableData:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableOptions) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableFromUrlData) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableFromUrlData:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +@implementation RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableFromUrlOptions) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableFromUrlOptions:(id)json +{ + return facebook::react::managedPointer(json); +} +@end +namespace facebook::react { + + static facebook::jsi::Value __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallable(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "httpsCallable", @selector(httpsCallable:emulatorPort:name:data:options:resolve:reject:), args, count); + } + + static facebook::jsi::Value __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallableFromUrl(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) { + return static_cast(turboModule).invokeObjCMethod(rt, PromiseKind, "httpsCallableFromUrl", @selector(httpsCallableFromUrl:emulatorPort:url:data:options:resolve:reject:), args, count); + } + + NativeFunctionsModuleSpecJSI::NativeFunctionsModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms) + : ObjCTurboModule(params) { + + methodMap_["httpsCallable"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallable}; + setMethodArgConversionSelector(@"httpsCallable", 3, @"JS_NativeFunctionsModule_SpecHttpsCallableData:"); + setMethodArgConversionSelector(@"httpsCallable", 4, @"JS_NativeFunctionsModule_SpecHttpsCallableOptions:"); + + methodMap_["httpsCallableFromUrl"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallableFromUrl}; + setMethodArgConversionSelector(@"httpsCallableFromUrl", 3, @"JS_NativeFunctionsModule_SpecHttpsCallableFromUrlData:"); + setMethodArgConversionSelector(@"httpsCallableFromUrl", 4, @"JS_NativeFunctionsModule_SpecHttpsCallableFromUrlOptions:"); + } +} // namespace facebook::react diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h new file mode 100644 index 0000000000..67ba0a0896 --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h @@ -0,0 +1,153 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#ifndef __cplusplus +#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. +#endif + +// Avoid multiple includes of RNFBFunctionsSpec symbols +#ifndef RNFBFunctionsSpec_H +#define RNFBFunctionsSpec_H + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + + +NS_ASSUME_NONNULL_BEGIN +namespace JS { + namespace NativeFunctionsModule { + struct SpecHttpsCallableData { + id data() const; + + SpecHttpsCallableData(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableData) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableData:(id)json; +@end +namespace JS { + namespace NativeFunctionsModule { + struct SpecHttpsCallableOptions { + std::optional timeout() const; + + SpecHttpsCallableOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableOptions) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableOptions:(id)json; +@end +namespace JS { + namespace NativeFunctionsModule { + struct SpecHttpsCallableFromUrlData { + id data() const; + + SpecHttpsCallableFromUrlData(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableFromUrlData) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableFromUrlData:(id)json; +@end +namespace JS { + namespace NativeFunctionsModule { + struct SpecHttpsCallableFromUrlOptions { + std::optional timeout() const; + + SpecHttpsCallableFromUrlOptions(NSDictionary *const v) : _v(v) {} + private: + NSDictionary *_v; + }; + } +} + +@interface RCTCxxConvert (NativeFunctionsModule_SpecHttpsCallableFromUrlOptions) ++ (RCTManagedPointer *)JS_NativeFunctionsModule_SpecHttpsCallableFromUrlOptions:(id)json; +@end +@protocol NativeFunctionsModuleSpec + +- (void)httpsCallable:(NSString * _Nullable)emulatorHost + emulatorPort:(double)emulatorPort + name:(NSString *)name + data:(JS::NativeFunctionsModule::SpecHttpsCallableData &)data + options:(JS::NativeFunctionsModule::SpecHttpsCallableOptions &)options + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; +- (void)httpsCallableFromUrl:(NSString * _Nullable)emulatorHost + emulatorPort:(double)emulatorPort + url:(NSString *)url + data:(JS::NativeFunctionsModule::SpecHttpsCallableFromUrlData &)data + options:(JS::NativeFunctionsModule::SpecHttpsCallableFromUrlOptions &)options + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject; + +@end + +@interface NativeFunctionsModuleSpecBase : NSObject { +@protected +facebook::react::EventEmitterCallback _eventEmitterCallback; +} +- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper; + + +@end + +namespace facebook::react { + /** + * ObjC++ class for module 'NativeFunctionsModule' + */ + class JSI_EXPORT NativeFunctionsModuleSpecJSI : public ObjCTurboModule { + public: + NativeFunctionsModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms); + }; +} // namespace facebook::react +inline id JS::NativeFunctionsModule::SpecHttpsCallableData::data() const +{ + id const p = _v[@"data"]; + return p; +} +inline std::optional JS::NativeFunctionsModule::SpecHttpsCallableOptions::timeout() const +{ + id const p = _v[@"timeout"]; + return RCTBridgingToOptionalDouble(p); +} +inline id JS::NativeFunctionsModule::SpecHttpsCallableFromUrlData::data() const +{ + id const p = _v[@"data"]; + return p; +} +inline std::optional JS::NativeFunctionsModule::SpecHttpsCallableFromUrlOptions::timeout() const +{ + id const p = _v[@"timeout"]; + return RCTBridgingToOptionalDouble(p); +} +NS_ASSUME_NONNULL_END +#endif // RNFBFunctionsSpec_H diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp new file mode 100644 index 0000000000..c30171c04e --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp @@ -0,0 +1,42 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleCpp.js + */ + +#include "RNFBFunctionsSpecJSI.h" + +namespace facebook::react { + +static jsi::Value __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallable(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->httpsCallable( + rt, + count <= 0 || args[0].isNull() || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asString(rt)), + count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber(), + count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt), + count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asObject(rt), + count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asObject(rt) + ); +} +static jsi::Value __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallableFromUrl(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) { + return static_cast(&turboModule)->httpsCallableFromUrl( + rt, + count <= 0 || args[0].isNull() || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asString(rt)), + count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber(), + count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt), + count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asObject(rt), + count <= 4 ? throw jsi::JSError(rt, "Expected argument in position 4 to be passed") : args[4].asObject(rt) + ); +} + +NativeFunctionsModuleCxxSpecJSI::NativeFunctionsModuleCxxSpecJSI(std::shared_ptr jsInvoker) + : TurboModule("NativeFunctionsModule", jsInvoker) { + methodMap_["httpsCallable"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallable}; + methodMap_["httpsCallableFromUrl"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleCxxSpecJSI_httpsCallableFromUrl}; +} + + +} // namespace facebook::react diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h b/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h new file mode 100644 index 0000000000..fd3bfec69d --- /dev/null +++ b/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h @@ -0,0 +1,80 @@ +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#pragma once + +#include +#include + +namespace facebook::react { + + + class JSI_EXPORT NativeFunctionsModuleCxxSpecJSI : public TurboModule { +protected: + NativeFunctionsModuleCxxSpecJSI(std::shared_ptr jsInvoker); + +public: + virtual jsi::Value httpsCallable(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String name, jsi::Object data, jsi::Object options) = 0; + virtual jsi::Value httpsCallableFromUrl(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String url, jsi::Object data, jsi::Object options) = 0; + +}; + +template +class JSI_EXPORT NativeFunctionsModuleCxxSpec : public TurboModule { +public: + jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override { + return delegate_.create(rt, propName); + } + + std::vector getPropertyNames(jsi::Runtime& runtime) override { + return delegate_.getPropertyNames(runtime); + } + + static constexpr std::string_view kModuleName = "NativeFunctionsModule"; + +protected: + NativeFunctionsModuleCxxSpec(std::shared_ptr jsInvoker) + : TurboModule(std::string{NativeFunctionsModuleCxxSpec::kModuleName}, jsInvoker), + delegate_(reinterpret_cast(this), jsInvoker) {} + + +private: + class Delegate : public NativeFunctionsModuleCxxSpecJSI { + public: + Delegate(T *instance, std::shared_ptr jsInvoker) : + NativeFunctionsModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) { + + } + + jsi::Value httpsCallable(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String name, jsi::Object data, jsi::Object options) override { + static_assert( + bridging::getParameterCount(&T::httpsCallable) == 6, + "Expected httpsCallable(...) to have 6 parameters"); + + return bridging::callFromJs( + rt, &T::httpsCallable, jsInvoker_, instance_, std::move(emulatorHost), std::move(emulatorPort), std::move(name), std::move(data), std::move(options)); + } + jsi::Value httpsCallableFromUrl(jsi::Runtime &rt, std::optional emulatorHost, double emulatorPort, jsi::String url, jsi::Object data, jsi::Object options) override { + static_assert( + bridging::getParameterCount(&T::httpsCallableFromUrl) == 6, + "Expected httpsCallableFromUrl(...) to have 6 parameters"); + + return bridging::callFromJs( + rt, &T::httpsCallableFromUrl, jsInvoker_, instance_, std::move(emulatorHost), std::move(emulatorPort), std::move(url), std::move(data), std::move(options)); + } + + private: + friend class NativeFunctionsModuleCxxSpec; + T *instance_; + }; + + Delegate delegate_; +}; + +} // namespace facebook::react diff --git a/packages/functions/ios/generated/ReactAppDependencyProvider.podspec b/packages/functions/ios/generated/ReactAppDependencyProvider.podspec new file mode 100644 index 0000000000..c80e01dae7 --- /dev/null +++ b/packages/functions/ios/generated/ReactAppDependencyProvider.podspec @@ -0,0 +1,34 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +version = "0.80.1" +source = { :git => 'https://github.com/facebook/react-native.git' } +if version == '1000.0.0' + # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. + source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") +else + source[:tag] = "v#{version}" +end + +Pod::Spec.new do |s| + s.name = "ReactAppDependencyProvider" + s.version = version + s.summary = "The third party dependency provider for the app" + s.homepage = "https://reactnative.dev/" + s.documentation_url = "https://reactnative.dev/" + s.license = "MIT" + s.author = "Meta Platforms, Inc. and its affiliates" + s.platforms = min_supported_versions + s.source = source + s.source_files = "**/RCTAppDependencyProvider.{h,mm}" + + # This guard prevent to install the dependencies when we run `pod install` in the old architecture. + s.pod_target_xcconfig = { + "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(), + "DEFINES_MODULE" => "YES" + } + + s.dependency "ReactCodegen" +end diff --git a/packages/functions/ios/generated/ReactCodegen.podspec b/packages/functions/ios/generated/ReactCodegen.podspec new file mode 100644 index 0000000000..226793691e --- /dev/null +++ b/packages/functions/ios/generated/ReactCodegen.podspec @@ -0,0 +1,106 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +version = "0.80.1" +source = { :git => 'https://github.com/facebook/react-native.git' } +if version == '1000.0.0' + # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. + source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") +else + source[:tag] = "v#{version}" +end + +use_frameworks = ENV['USE_FRAMEWORKS'] != nil +folly_compiler_flags = Helpers::Constants.folly_config[:compiler_flags] +boost_compiler_flags = Helpers::Constants.boost_config[:compiler_flags] + +header_search_paths = [ + "\"$(PODS_ROOT)/ReactNativeDependencies\"", + "\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"", + "\"$(PODS_ROOT)/Headers/Private/React-Fabric\"", + "\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"", + "\"$(PODS_ROOT)/Headers/Private/Yoga\"", + "\"$(PODS_TARGET_SRCROOT)\"", +] +framework_search_paths = [] + +if use_frameworks + ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"]) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-FabricImage", "React_FabricImage", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "ReactCommon", "ReactCommon", ["react/nativemodule/core"])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-NativeModulesApple", "React_NativeModulesApple", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-debug", "React_debug", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-rendererdebug", "React_rendererdebug", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-utils", "React_utils", [])) + .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-featureflags", "React_featureflags", [])) + .each { |search_path| + header_search_paths << "\"#{search_path}\"" + } +end + +Pod::Spec.new do |s| + s.name = "ReactCodegen" + s.version = version + s.summary = 'Temp pod for generated files for React Native' + s.homepage = 'https://facebook.com/' + s.license = 'Unlicense' + s.authors = 'Facebook' + s.compiler_flags = "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++20" + s.source = { :git => '' } + s.header_mappings_dir = './' + s.platforms = min_supported_versions + s.source_files = "**/*.{h,mm,cpp}" + s.exclude_files = "RCTAppDependencyProvider.{h,mm}" # these files are generated in the same codegen path but needs to belong to a different pod + s.pod_target_xcconfig = { + "HEADER_SEARCH_PATHS" => header_search_paths.join(' '), + "FRAMEWORK_SEARCH_PATHS" => framework_search_paths, + "OTHER_CPLUSPLUSFLAGS" => "$(inherited) #{folly_compiler_flags} #{boost_compiler_flags}" + } + + s.dependency "React-jsiexecutor" + s.dependency "RCTRequired" + s.dependency "RCTTypeSafety" + s.dependency "React-Core" + s.dependency "React-jsi" + s.dependency "ReactCommon/turbomodule/bridging" + s.dependency "ReactCommon/turbomodule/core" + s.dependency "React-NativeModulesApple" + s.dependency 'React-graphics' + s.dependency 'React-rendererdebug' + s.dependency 'React-Fabric' + s.dependency 'React-FabricImage' + s.dependency 'React-debug' + s.dependency 'React-utils' + s.dependency 'React-featureflags' + s.dependency 'React-RCTAppDelegate' + + depend_on_js_engine(s) + add_rn_third_party_dependencies(s) + + s.script_phases = { + 'name' => 'Generate Specs', + 'execution_position' => :before_compile, + 'input_files' => ["${PODS_ROOT}/../../specs/NativeFunctionsModule.ts"], + 'show_env_vars_in_log' => true, + 'output_files' => ["${DERIVED_FILE_DIR}/react-codegen.log"], + 'script': <<-SCRIPT +pushd "$PODS_ROOT/../" > /dev/null +RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd) +popd >/dev/null + +export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../../node_modules/react-native" +export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/../.." +export RCT_SCRIPT_OUTPUT_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT" +export RCT_SCRIPT_TYPE="withCodegenDiscovery" + +SCRIPT_PHASES_SCRIPT="$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh" +WITH_ENVIRONMENT="$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh" +/bin/sh -c "$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT" +SCRIPT + } + +end From 90bbbed136558a66f3994607b30ad5f14001fd86 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 14:21:55 +0100 Subject: [PATCH 31/79] update naming of generated code --- .../firebase/functions/generated/jni/CMakeLists.txt | 10 +++++----- ...nerated.cpp => NativeFunctionsModule-generated.cpp} | 4 ++-- .../{RNFBFunctionsSpec.h => NativeFunctionsModule.h} | 2 +- .../NativeFunctionsModuleJSI-generated.cpp} | 2 +- .../NativeFunctionsModuleJSI.h} | 0 .../NativeFunctionsModule-generated.mm} | 2 +- .../NativeFunctionsModule.h} | 8 ++++---- .../generated/NativeFunctionsModuleJSI-generated.cpp} | 2 +- ...FBFunctionsSpecJSI.h => NativeFunctionsModuleJSI.h} | 0 packages/functions/package.json | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) rename packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/{RNFBFunctionsSpec-generated.cpp => NativeFunctionsModule-generated.cpp} (91%) rename packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/{RNFBFunctionsSpec.h => NativeFunctionsModule.h} (83%) rename packages/functions/{ios/generated/RNFBFunctionsSpecJSI-generated.cpp => android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/NativeFunctionsModule/NativeFunctionsModuleJSI-generated.cpp} (98%) rename packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/{RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h => NativeFunctionsModule/NativeFunctionsModuleJSI.h} (100%) rename packages/functions/ios/generated/{RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm => NativeFunctionsModule/NativeFunctionsModule-generated.mm} (99%) rename packages/functions/ios/generated/{RNFBFunctionsSpec/RNFBFunctionsSpec.h => NativeFunctionsModule/NativeFunctionsModule.h} (96%) rename packages/functions/{android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp => ios/generated/NativeFunctionsModuleJSI-generated.cpp} (98%) rename packages/functions/ios/generated/{RNFBFunctionsSpecJSI.h => NativeFunctionsModuleJSI.h} (100%) diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt index 0eaaad455e..9e890825d5 100644 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt @@ -6,18 +6,18 @@ cmake_minimum_required(VERSION 3.13) set(CMAKE_VERBOSE_MAKEFILE on) -file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNFBFunctionsSpec/*.cpp) +file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/NativeFunctionsModule/*.cpp) add_library( - react_codegen_RNFBFunctionsSpec + react_codegen_NativeFunctionsModule OBJECT ${react_codegen_SRCS} ) -target_include_directories(react_codegen_RNFBFunctionsSpec PUBLIC . react/renderer/components/RNFBFunctionsSpec) +target_include_directories(react_codegen_NativeFunctionsModule PUBLIC . react/renderer/components/NativeFunctionsModule) target_link_libraries( - react_codegen_RNFBFunctionsSpec + react_codegen_NativeFunctionsModule fbjni jsi # We need to link different libraries based on whether we are building rncore or not, that's necessary @@ -26,7 +26,7 @@ target_link_libraries( ) target_compile_options( - react_codegen_RNFBFunctionsSpec + react_codegen_NativeFunctionsModule PRIVATE -DLOG_TAG=\"ReactNative\" -fexceptions diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/NativeFunctionsModule-generated.cpp similarity index 91% rename from packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp rename to packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/NativeFunctionsModule-generated.cpp index 7dbbd4f09c..c36a60947b 100644 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec-generated.cpp +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/NativeFunctionsModule-generated.cpp @@ -8,7 +8,7 @@ * @generated by codegen project: GenerateModuleJniCpp.js */ -#include "RNFBFunctionsSpec.h" +#include "NativeFunctionsModule.h" namespace facebook::react { @@ -28,7 +28,7 @@ NativeFunctionsModuleSpecJSI::NativeFunctionsModuleSpecJSI(const JavaTurboModule methodMap_["httpsCallableFromUrl"] = MethodMetadata {5, __hostFunction_NativeFunctionsModuleSpecJSI_httpsCallableFromUrl}; } -std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { +std::shared_ptr NativeFunctionsModule_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == "NativeFunctionsModule") { return std::make_shared(params); } diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/NativeFunctionsModule.h similarity index 83% rename from packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h rename to packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/NativeFunctionsModule.h index d3e83c8e90..ba653a7b29 100644 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/RNFBFunctionsSpec.h +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/NativeFunctionsModule.h @@ -26,6 +26,6 @@ class JSI_EXPORT NativeFunctionsModuleSpecJSI : public JavaTurboModule { JSI_EXPORT -std::shared_ptr RNFBFunctionsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms); +std::shared_ptr NativeFunctionsModule_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms); } // namespace facebook::react diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/NativeFunctionsModule/NativeFunctionsModuleJSI-generated.cpp similarity index 98% rename from packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp rename to packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/NativeFunctionsModule/NativeFunctionsModuleJSI-generated.cpp index c30171c04e..71fa17655b 100644 --- a/packages/functions/ios/generated/RNFBFunctionsSpecJSI-generated.cpp +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/NativeFunctionsModule/NativeFunctionsModuleJSI-generated.cpp @@ -7,7 +7,7 @@ * @generated by codegen project: GenerateModuleCpp.js */ -#include "RNFBFunctionsSpecJSI.h" +#include "NativeFunctionsModuleJSI.h" namespace facebook::react { diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h b/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/NativeFunctionsModule/NativeFunctionsModuleJSI.h similarity index 100% rename from packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI.h rename to packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/NativeFunctionsModule/NativeFunctionsModuleJSI.h diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm b/packages/functions/ios/generated/NativeFunctionsModule/NativeFunctionsModule-generated.mm similarity index 99% rename from packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm rename to packages/functions/ios/generated/NativeFunctionsModule/NativeFunctionsModule-generated.mm index fbd954fb3a..ebe0f4117c 100644 --- a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec-generated.mm +++ b/packages/functions/ios/generated/NativeFunctionsModule/NativeFunctionsModule-generated.mm @@ -11,7 +11,7 @@ * must have a single output. More files => more genrule()s => slower builds. */ -#import "RNFBFunctionsSpec.h" +#import "NativeFunctionsModule.h" @implementation NativeFunctionsModuleSpecBase diff --git a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h b/packages/functions/ios/generated/NativeFunctionsModule/NativeFunctionsModule.h similarity index 96% rename from packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h rename to packages/functions/ios/generated/NativeFunctionsModule/NativeFunctionsModule.h index 67ba0a0896..c80bd3bd21 100644 --- a/packages/functions/ios/generated/RNFBFunctionsSpec/RNFBFunctionsSpec.h +++ b/packages/functions/ios/generated/NativeFunctionsModule/NativeFunctionsModule.h @@ -15,9 +15,9 @@ #error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. #endif -// Avoid multiple includes of RNFBFunctionsSpec symbols -#ifndef RNFBFunctionsSpec_H -#define RNFBFunctionsSpec_H +// Avoid multiple includes of NativeFunctionsModule symbols +#ifndef NativeFunctionsModule_H +#define NativeFunctionsModule_H #import #import @@ -150,4 +150,4 @@ inline std::optional JS::NativeFunctionsModule::SpecHttpsCallableFromUrl return RCTBridgingToOptionalDouble(p); } NS_ASSUME_NONNULL_END -#endif // RNFBFunctionsSpec_H +#endif // NativeFunctionsModule_H diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp b/packages/functions/ios/generated/NativeFunctionsModuleJSI-generated.cpp similarity index 98% rename from packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp rename to packages/functions/ios/generated/NativeFunctionsModuleJSI-generated.cpp index c30171c04e..71fa17655b 100644 --- a/packages/functions/android/src/main/java/io/invertase/firebase/functions/generated/jni/react/renderer/components/RNFBFunctionsSpec/RNFBFunctionsSpecJSI-generated.cpp +++ b/packages/functions/ios/generated/NativeFunctionsModuleJSI-generated.cpp @@ -7,7 +7,7 @@ * @generated by codegen project: GenerateModuleCpp.js */ -#include "RNFBFunctionsSpecJSI.h" +#include "NativeFunctionsModuleJSI.h" namespace facebook::react { diff --git a/packages/functions/ios/generated/RNFBFunctionsSpecJSI.h b/packages/functions/ios/generated/NativeFunctionsModuleJSI.h similarity index 100% rename from packages/functions/ios/generated/RNFBFunctionsSpecJSI.h rename to packages/functions/ios/generated/NativeFunctionsModuleJSI.h diff --git a/packages/functions/package.json b/packages/functions/package.json index a6b8d089df..8e0e60a7e0 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -7,7 +7,7 @@ "module": "./dist/module/index.js", "types": "./dist/typescript/commonjs/functions/lib/modular/index.d.ts", "codegenConfig": { - "name": "RNFBFunctionsSpec", + "name": "NativeFunctionsModule", "type": "modules", "jsSrcsDir": "specs", "includesGeneratedCode": true, From 938d1c3d170b577eed94e15f977e576a51fcd391 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Mon, 7 Jul 2025 14:38:37 +0100 Subject: [PATCH 32/79] update RNFB functions module --- .../ios/RNFBFunctions/RNFBFunctionsModule.m | 76 +++++++++++-------- 1 file changed, 46 insertions(+), 30 deletions(-) diff --git a/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.m b/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.m index 97149aca60..34a414fdd1 100644 --- a/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.m +++ b/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.m @@ -20,6 +20,10 @@ #import "RNFBApp/RNFBSharedUtils.h" #import "RNFBFunctionsModule.h" +#import "NativeFunctionsModule/NativeFunctionsModule.h" + +@interface RNFBFunctionsModule () +@end @implementation RNFBFunctionsModule #pragma mark - @@ -30,33 +34,39 @@ @implementation RNFBFunctionsModule #pragma mark - #pragma mark Firebase Functions Methods -RCT_EXPORT_METHOD(httpsCallable - : (FIRApp *)firebaseApp customUrlOrRegion - : (NSString *)customUrlOrRegion host - : (NSString *)host port - : (NSNumber *_Nonnull)port name - : (NSString *)name wrapper - : (NSDictionary *)wrapper options - : (NSDictionary *)options resolver - : (RCTPromiseResolveBlock)resolve rejecter - : (RCTPromiseRejectBlock)reject) { +- (void)httpsCallable:(NSString * _Nullable)emulatorHost + emulatorPort:(double)emulatorPort + name:(NSString *)name + data:(JS::NativeFunctionsModule::SpecHttpsCallableData &)data + options:(JS::NativeFunctionsModule::SpecHttpsCallableOptions &)options + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject { + + FIRApp *firebaseApp = [FIRApp defaultApp]; + + id callableData = data.data(); + + std::optional timeout = options.timeout(); + + NSString *customUrlOrRegion = emulatorHost ? emulatorHost : @"us-central1"; + NSURL *url = [NSURL URLWithString:customUrlOrRegion]; FIRFunctions *functions = (url && url.scheme && url.host) ? [FIRFunctions functionsForApp:firebaseApp customDomain:customUrlOrRegion] : [FIRFunctions functionsForApp:firebaseApp region:customUrlOrRegion]; - if (host != nil) { - [functions useEmulatorWithHost:host port:[port intValue]]; + if (emulatorHost != nil) { + [functions useEmulatorWithHost:emulatorHost port:(int)emulatorPort]; } FIRHTTPSCallable *callable = [functions HTTPSCallableWithName:name]; - if (options[@"timeout"]) { - callable.timeoutInterval = [options[@"timeout"] doubleValue]; + if (timeout.has_value()) { + callable.timeoutInterval = timeout.value(); } - [callable callWithObject:[wrapper valueForKey:@"data"] + [callable callWithObject:callableData completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) { if (error) { NSObject *details = [NSNull null]; @@ -80,35 +90,41 @@ @implementation RNFBFunctionsModule }]; } -RCT_EXPORT_METHOD(httpsCallableFromUrl - : (FIRApp *)firebaseApp customUrlOrRegion - : (NSString *)customUrlOrRegion host - : (NSString *)host port - : (NSNumber *_Nonnull)port url - : (NSString *)url wrapper - : (NSDictionary *)wrapper options - : (NSDictionary *)options resolver - : (RCTPromiseResolveBlock)resolve rejecter - : (RCTPromiseRejectBlock)reject) { +- (void)httpsCallableFromUrl:(NSString * _Nullable)emulatorHost + emulatorPort:(double)emulatorPort + url:(NSString *)url + data:(JS::NativeFunctionsModule::SpecHttpsCallableFromUrlData &)data + options:(JS::NativeFunctionsModule::SpecHttpsCallableFromUrlOptions &)options + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject { + + FIRApp *firebaseApp = [FIRApp defaultApp]; + + id callableData = data.data(); + + std::optional timeout = options.timeout(); + + NSString *customUrlOrRegion = emulatorHost ? emulatorHost : @"us-central1"; + NSURL *customUrl = [NSURL URLWithString:customUrlOrRegion]; FIRFunctions *functions = (customUrl && customUrl.scheme && customUrl.host) ? [FIRFunctions functionsForApp:firebaseApp customDomain:customUrlOrRegion] : [FIRFunctions functionsForApp:firebaseApp region:customUrlOrRegion]; - if (host != nil) { - [functions useEmulatorWithHost:host port:[port intValue]]; + if (emulatorHost != nil) { + [functions useEmulatorWithHost:emulatorHost port:(int)emulatorPort]; } NSURL *functionUrl = [NSURL URLWithString:url]; FIRHTTPSCallable *callable = [functions HTTPSCallableWithURL:functionUrl]; - if (options[@"timeout"]) { - callable.timeoutInterval = [options[@"timeout"] doubleValue]; + if (timeout.has_value()) { + callable.timeoutInterval = timeout.value(); } - [callable callWithObject:[wrapper valueForKey:@"data"] + [callable callWithObject:callableData completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) { if (error) { NSObject *details = [NSNull null]; From d4b2541d3522670472fcd1b15182af6a1b3607e3 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 8 Jul 2025 10:12:15 +0100 Subject: [PATCH 33/79] make file `.mm` & update podspec for functions --- packages/functions/RNFBFunctions.podspec | 10 +++++++++- .../{RNFBFunctionsModule.m => RNFBFunctionsModule.mm} | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) rename packages/functions/ios/RNFBFunctions/{RNFBFunctionsModule.m => RNFBFunctionsModule.mm} (99%) diff --git a/packages/functions/RNFBFunctions.podspec b/packages/functions/RNFBFunctions.podspec index 251c28c7d9..c55d9d87d4 100644 --- a/packages/functions/RNFBFunctions.podspec +++ b/packages/functions/RNFBFunctions.podspec @@ -27,11 +27,19 @@ Pod::Spec.new do |s| s.ios.deployment_target = firebase_ios_target s.macos.deployment_target = firebase_macos_target s.tvos.deployment_target = firebase_tvos_target - s.source_files = 'ios/**/*.{h,m, mm, cpp}' + s.source_files = 'ios/**/*.{h,m,mm,cpp}' + s.exclude_files = 'ios/generated/RCTThirdPartyComponentsProvider.*', 'ios/generated/RCTAppDependencyProvider.*', 'ios/generated/RCTModuleProviders.*', 'ios/generated/RCTModulesConformingToProtocolsProvider.*', 'ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.*' + + s.compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1' # React Native dependencies s.dependency 'React-Core' s.dependency 'RNFBApp' + s.dependency 'ReactCodegen' + s.dependency 'ReactAppDependencyProvider' + # TODO - not sure if we need these two as I believe they're UI related + s.dependency 'React-Fabric' + s.dependency 'RCT-Folly' if defined?($FirebaseSDKVersion) Pod::UI.puts "#{s.name}: Using user specified Firebase SDK version '#{$FirebaseSDKVersion}'" diff --git a/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.m b/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.mm similarity index 99% rename from packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.m rename to packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.mm index 34a414fdd1..b42d94feaa 100644 --- a/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.m +++ b/packages/functions/ios/RNFBFunctions/RNFBFunctionsModule.mm @@ -20,7 +20,7 @@ #import "RNFBApp/RNFBSharedUtils.h" #import "RNFBFunctionsModule.h" -#import "NativeFunctionsModule/NativeFunctionsModule.h" +#import "NativeFunctionsModule.h" @interface RNFBFunctionsModule () @end From fba772e3876bc643fbdad32e228a12529cf5c183 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 8 Jul 2025 10:12:39 +0100 Subject: [PATCH 34/79] podfile.lock --- tests/ios/Podfile.lock | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/ios/Podfile.lock b/tests/ios/Podfile.lock index deaf04760f..02c4c960ea 100644 --- a/tests/ios/Podfile.lock +++ b/tests/ios/Podfile.lock @@ -1857,7 +1857,11 @@ PODS: - RNFBApp - RNFBFunctions (22.2.1): - Firebase/Functions (= 11.13.0) + - RCT-Folly - React-Core + - React-Fabric + - ReactAppDependencyProvider + - ReactCodegen - RNFBApp - RNFBInAppMessaging (22.2.1): - Firebase/InAppMessaging (= 11.13.0) @@ -2327,7 +2331,7 @@ SPEC CHECKSUMS: RNFBDatabase: fcfa7b19ac56c666827f10434f1f8257760fe174 RNFBDynamicLinks: b8849df53de99a3ccc000125c6d69c3db29ddb20 RNFBFirestore: dde90f839f5d712bd1ea8548d8324ba655fa48d7 - RNFBFunctions: 87ea4cec40d4351457acfce61bcfc1a881a5ef3e + RNFBFunctions: 12ae18aca53333a20c542caaefb17d7ce57aeb1d RNFBInAppMessaging: 9810fe36b4f67011305883c8b7b19df207ec6bb4 RNFBInstallations: 9acf5bb1917e358cd499a78d9e55ef9143cba203 RNFBMessaging: 8ce084d2f49f59bae6d1abea130335d6b26969cd From 3218d4d16f301c06c76f8953abe31b47d0f2d401 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 8 Jul 2025 10:27:04 +0100 Subject: [PATCH 35/79] yarn.lock --- yarn.lock | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yarn.lock b/yarn.lock index 2131c69938..37ae065503 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20391,6 +20391,9 @@ __metadata: escape-string-regexp: "npm:^5.0.0" fast-glob: "npm:^3.3.3" checksum: 10/c92d339ab592488996f77a49cc97d0ab8b1d528fb2d15001c255aa03eea48e013175cdaaddc2bb8b1ebdee620448bcf1901410996aaaf4a5fea470a2e354b0c2 + languageName: node + linkType: hard + "react-native-url-polyfill@npm:2.0.0": version: 2.0.0 resolution: "react-native-url-polyfill@npm:2.0.0" From 30f5d35a43675e23aef6d5c82c05ff72b9c37868 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 8 Jul 2025 10:55:55 +0100 Subject: [PATCH 36/79] chore: update version --- packages/functions/lib/index.ts | 2 +- packages/functions/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/functions/lib/index.ts b/packages/functions/lib/index.ts index 006963167a..2c51ce537c 100644 --- a/packages/functions/lib/index.ts +++ b/packages/functions/lib/index.ts @@ -22,7 +22,7 @@ import { getFirebaseRoot, } from '@react-native-firebase/app/lib/internal'; import { HttpsError, type NativeError } from './HttpsError'; -import version from './version'; +import { version } from './version'; import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule'; import fallBackModule from './web/RNFBFunctionsModule'; diff --git a/packages/functions/package.json b/packages/functions/package.json index 8e0e60a7e0..00d1fa14f0 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -16,7 +16,7 @@ } }, "scripts": { - "build": "genversion --semi lib/version.js", + "build": "genversion --esm --semi lib/version.ts", "build:clean": "rimraf android/build && rimraf ios/build", "compile": "bob build", "prepare": "yarn compile && yarn run build", From cdfee94cc8f592653f0857dc13d33006b6f8555c Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 8 Jul 2025 11:25:37 +0100 Subject: [PATCH 37/79] chore: reverse order of prepare script --- packages/functions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/functions/package.json b/packages/functions/package.json index 00d1fa14f0..65f8a499b4 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -19,7 +19,7 @@ "build": "genversion --esm --semi lib/version.ts", "build:clean": "rimraf android/build && rimraf ios/build", "compile": "bob build", - "prepare": "yarn compile && yarn run build", + "prepare": "yarn run build && yarn compile", "codegen": "yarn android:codegen && yarn ios:codegen", "android:codegen": "npx @react-native-community/cli codegen --platform android --outputPath=./android/src/main/java/io/invertase/firebase/functions/generated", "ios:codegen": "npx @react-native-community/cli codegen --platform ios --outputPath=./ios/generated" From a04eb09815357d143e4b9064b5d5f8415d586074 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Tue, 8 Jul 2025 15:18:48 +0100 Subject: [PATCH 38/79] feat(android): make NativeFunctionsModule compatible with existing code --- .../common/UniversalFirebaseModule.java | 4 +- .../functions/NativeFunctionsModule.java | 169 ++++++++++++++++++ .../functions/NativeFunctionsPackage.java | 44 +++++ 3 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsModule.java create mode 100644 packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsPackage.java diff --git a/packages/app/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java b/packages/app/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java index bcb4274a9e..740f119e34 100644 --- a/packages/app/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java +++ b/packages/app/android/src/main/java/io/invertase/firebase/common/UniversalFirebaseModule.java @@ -29,7 +29,7 @@ public class UniversalFirebaseModule { private final Context context; private final String serviceName; - protected UniversalFirebaseModule(Context context, String serviceName) { + public UniversalFirebaseModule(Context context, String serviceName) { this.context = context; this.serviceName = serviceName; this.executorService = new TaskExecutorService(getName()); @@ -43,7 +43,7 @@ public Context getApplicationContext() { return getContext().getApplicationContext(); } - protected ExecutorService getExecutor() { + public ExecutorService getExecutor() { return executorService.getExecutor(); } diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsModule.java b/packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsModule.java new file mode 100644 index 0000000000..607cedd329 --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsModule.java @@ -0,0 +1,169 @@ +package io.invertase.firebase.functions; + +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import static io.invertase.firebase.functions.UniversalFirebaseFunctionsModule.CODE_KEY; +import static io.invertase.firebase.functions.UniversalFirebaseFunctionsModule.DATA_KEY; +import static io.invertase.firebase.functions.UniversalFirebaseFunctionsModule.DETAILS_KEY; +import static io.invertase.firebase.functions.UniversalFirebaseFunctionsModule.MSG_KEY; + +import com.facebook.fbreact.specs.NativeFunctionsModuleSpec; +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.Promise; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.WritableMap; +import com.google.android.gms.tasks.Task; +import com.google.firebase.FirebaseApp; +import com.google.firebase.functions.FirebaseFunctionsException; +import io.invertase.firebase.common.RCTConvertFirebase; +import io.invertase.firebase.common.ReactNativeFirebaseModule; +import io.invertase.firebase.common.UniversalFirebaseModule; +; +import java.io.IOException; + +public class NativeFunctionsModule extends NativeFunctionsModuleSpec { + private static final String SERVICE_NAME = "Functions"; + private final UniversalFirebaseFunctionsModule module; + private final UniversalFirebaseModule universalFirebaseModule; + + public NativeFunctionsModule(ReactApplicationContext reactContext) { + super(reactContext); + // cannot have multiple inheritance so we make this a property rather than extending it + universalFirebaseModule = new UniversalFirebaseModule(reactContext, SERVICE_NAME); + this.module = new UniversalFirebaseFunctionsModule(reactContext, SERVICE_NAME); + } + + @Override + public void httpsCallable( + String emulatorHost, + double emulatorPort, + String name, + ReadableMap data, + ReadableMap options, + Promise promise) { + + // Get the default Firebase app + FirebaseApp firebaseApp = FirebaseApp.getInstance(); + String region = "us-central1"; // Default region + + // Extract data from the wrapper + Object callableData = data.toHashMap().get(DATA_KEY); + + // Convert emulatorPort to Integer (null if not using emulator) + Integer port = emulatorHost != null ? (int) emulatorPort : null; + + Task callMethodTask = module.httpsCallable( + firebaseApp.getName(), region, emulatorHost, port, name, callableData, options); + + // resolve + callMethodTask.addOnSuccessListener( + universalFirebaseModule.getExecutor(), + result -> { + promise.resolve(RCTConvertFirebase.mapPutValue(DATA_KEY, result, Arguments.createMap())); + }); + + // reject + callMethodTask.addOnFailureListener( + universalFirebaseModule.getExecutor(), + exception -> { + Object details = null; + String code = "UNKNOWN"; + String message = exception.getMessage(); + WritableMap userInfo = Arguments.createMap(); + if (exception.getCause() instanceof FirebaseFunctionsException) { + FirebaseFunctionsException functionsException = + (FirebaseFunctionsException) exception.getCause(); + details = functionsException.getDetails(); + code = functionsException.getCode().name(); + message = functionsException.getMessage(); + String timeout = FirebaseFunctionsException.Code.DEADLINE_EXCEEDED.name(); + Boolean isTimeout = code.contains(timeout); + + if (functionsException.getCause() instanceof IOException && !isTimeout) { + // return UNAVAILABLE for network io errors, to match iOS + code = FirebaseFunctionsException.Code.UNAVAILABLE.name(); + message = FirebaseFunctionsException.Code.UNAVAILABLE.name(); + } + } + RCTConvertFirebase.mapPutValue(CODE_KEY, code, userInfo); + RCTConvertFirebase.mapPutValue(MSG_KEY, message, userInfo); + RCTConvertFirebase.mapPutValue(DETAILS_KEY, details, userInfo); + promise.reject(code, message, exception, userInfo); + }); + } + + @Override + public void httpsCallableFromUrl( + String emulatorHost, + double emulatorPort, + String url, + ReadableMap data, + ReadableMap options, + Promise promise) { + + // Get the default Firebase app + FirebaseApp firebaseApp = FirebaseApp.getInstance(); + String region = "us-central1"; // Default region + + // Extract data from the wrapper + Object callableData = data.toHashMap().get(DATA_KEY); + + // Convert emulatorPort to Integer (null if not using emulator) + Integer port = emulatorHost != null ? (int) emulatorPort : null; + + Task callMethodTask = module.httpsCallableFromUrl( + firebaseApp.getName(), region, emulatorHost, port, url, callableData, options); + + // resolve + callMethodTask.addOnSuccessListener( + universalFirebaseModule.getExecutor(), + result -> { + promise.resolve(RCTConvertFirebase.mapPutValue(DATA_KEY, result, Arguments.createMap())); + }); + + // reject + callMethodTask.addOnFailureListener( + universalFirebaseModule.getExecutor(), + exception -> { + Object details = null; + String code = "UNKNOWN"; + String message = exception.getMessage(); + WritableMap userInfo = Arguments.createMap(); + if (exception.getCause() instanceof FirebaseFunctionsException) { + FirebaseFunctionsException functionsException = + (FirebaseFunctionsException) exception.getCause(); + details = functionsException.getDetails(); + code = functionsException.getCode().name(); + message = functionsException.getMessage(); + String timeout = FirebaseFunctionsException.Code.DEADLINE_EXCEEDED.name(); + Boolean isTimeout = code.contains(timeout); + + if (functionsException.getCause() instanceof IOException && !isTimeout) { + // return UNAVAILABLE for network io errors, to match iOS + code = FirebaseFunctionsException.Code.UNAVAILABLE.name(); + message = FirebaseFunctionsException.Code.UNAVAILABLE.name(); + } + } + RCTConvertFirebase.mapPutValue(CODE_KEY, code, userInfo); + RCTConvertFirebase.mapPutValue(MSG_KEY, message, userInfo); + RCTConvertFirebase.mapPutValue(DETAILS_KEY, details, userInfo); + promise.reject(code, message, exception, userInfo); + }); + } +} diff --git a/packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsPackage.java b/packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsPackage.java new file mode 100644 index 0000000000..0ee75ec8d5 --- /dev/null +++ b/packages/functions/android/src/main/java/io/invertase/firebase/functions/NativeFunctionsPackage.java @@ -0,0 +1,44 @@ +package io.invertase.firebase.functions; + +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.annotation.Nonnull; + +@SuppressWarnings("unused") +public class NativeFunctionsPackage implements ReactPackage { + @Nonnull + @Override + public List createNativeModules(@Nonnull ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + modules.add(new NativeFunctionsModule(reactContext)); + return modules; + } + + @Nonnull + @Override + public List createViewManagers(@Nonnull ReactApplicationContext reactContext) { + return Collections.emptyList(); + } +} From 1ca5cbb3d4bfcb61e05617a367323c324e52e229 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 9 Jul 2025 08:28:33 +0100 Subject: [PATCH 39/79] update path --- packages/functions/react-native.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/functions/react-native.config.js b/packages/functions/react-native.config.js index e10513f186..d1b6f36785 100644 --- a/packages/functions/react-native.config.js +++ b/packages/functions/react-native.config.js @@ -3,7 +3,7 @@ module.exports = { platforms: { android: { cmakeListsPath: - './android/src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt', + './src/main/java/io/invertase/firebase/functions/generated/jni/CMakeLists.txt', }, }, }, From 1ca1da2b72909900f59fec3a6ed38b6f207fe3c3 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 9 Jul 2025 09:48:06 +0100 Subject: [PATCH 40/79] move modular/namespaced to same directory to fix TS --- .../functions/__tests__/functions.test.ts | 4 +- packages/functions/lib/index.ts | 364 +++++------------- packages/functions/lib/modular/index.ts | 136 ------- packages/functions/lib/namespaced.ts | 295 ++++++++++++++ packages/functions/package.json | 10 +- 5 files changed, 404 insertions(+), 405 deletions(-) delete mode 100644 packages/functions/lib/modular/index.ts create mode 100644 packages/functions/lib/namespaced.ts diff --git a/packages/functions/__tests__/functions.test.ts b/packages/functions/__tests__/functions.test.ts index 0c1d700848..384bf0631a 100644 --- a/packages/functions/__tests__/functions.test.ts +++ b/packages/functions/__tests__/functions.test.ts @@ -7,9 +7,9 @@ import { httpsCallable, httpsCallableFromUrl, HttpsErrorCode, -} from '../lib/modular'; +} from '../lib'; -import functions from '../lib'; +import functions from '../lib/namespaced'; import { createCheckV9Deprecation, type CheckV9DeprecationFunction, diff --git a/packages/functions/lib/index.ts b/packages/functions/lib/index.ts index 2c51ce537c..79ff9151f6 100644 --- a/packages/functions/lib/index.ts +++ b/packages/functions/lib/index.ts @@ -15,20 +15,109 @@ * */ -import { isAndroid, isNumber } from '@react-native-firebase/app/lib/common'; -import { - createModuleNamespace, - FirebaseModule, - getFirebaseRoot, -} from '@react-native-firebase/app/lib/internal'; -import { HttpsError, type NativeError } from './HttpsError'; -import { version } from './version'; -import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule'; -import fallBackModule from './web/RNFBFunctionsModule'; +import { getApp, type ReactNativeFirebase } from '@react-native-firebase/app'; +import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; -const namespace = 'functions'; -const nativeModuleName = 'RNFBFunctionsModule'; +type FirebaseApp = ReactNativeFirebase.FirebaseApp; +type Functions = FunctionsModule; +interface HttpsCallableOptions { + timeout?: number; +} + +// Export types for use in modular API +export type { HttpsCallableOptions }; + +export interface HttpsCallable { + (data?: RequestData | null): Promise<{ data: ResponseData }>; +} + +export interface FunctionsModule { + httpsCallable( + name: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + httpsCallableFromUrl( + url: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + useFunctionsEmulator(origin: string): void; + useEmulator(host: string, port: number): void; +} + +/** + * Returns a Functions instance for the given app. + * @param app - The FirebaseApp to use. Optional. + * @param regionOrCustomDomain - One of: a) The region the callable functions are located in (ex: us-central1) b) A custom domain hosting the callable functions (ex: https://mydomain.com). Optional. + * @returns Functions instance for the given app. + */ +export function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions { + if (app) { + return getApp(app.name).functions(regionOrCustomDomain) as Functions; + } + + return getApp().functions(regionOrCustomDomain) as Functions; +} + +/** + * Modify this instance to communicate with the Cloud Functions emulator. + * Note: this must be called before this instance has been used to do any operations. + * @param functionsInstance A functions instance. + * @param host The emulator host. (ex: localhost) + * @param port The emulator port. (ex: 5001) + */ +export function connectFunctionsEmulator( + functionsInstance: Functions, + host: string, + port: number, +): void { + // @ts-ignore + return functionsInstance.useEmulator.call(functionsInstance, host, port, MODULAR_DEPRECATION_ARG); +} + +/** + * Returns a reference to the callable HTTPS trigger with the given name. + * @param functionsInstance A functions instance. + * @param name The name of the trigger. + * @param options An interface for metadata about how calls should be executed. + * @returns HttpsCallable instance + */ +export function httpsCallable( + functionsInstance: Functions, + name: string, + options?: HttpsCallableOptions, +): HttpsCallable { + return functionsInstance.httpsCallable.call( + functionsInstance, + name, + options, + // @ts-ignore + MODULAR_DEPRECATION_ARG, + ) as HttpsCallable; +} + +/** + * Returns a reference to the callable HTTPS trigger with the specified url. + * @param functionsInstance A functions instance. + * @param url The url of the trigger. + * @param options An instance of HttpsCallableOptions containing metadata about how calls should be executed. + * @returns HttpsCallable instance + */ +export function httpsCallableFromUrl( + functionsInstance: Functions, + url: string, + options?: HttpsCallableOptions, +): HttpsCallable { + return functionsInstance.httpsCallableFromUrl.call( + functionsInstance, + url, + options, + // @ts-ignore + MODULAR_DEPRECATION_ARG, + ) as HttpsCallable; +} + +// Define HttpsErrorCode locally to avoid circular imports export const HttpsErrorCode = { OK: 'ok', CANCELLED: 'cancelled', @@ -67,253 +156,4 @@ export const HttpsErrorCode = { 'data-loss': 'data-loss', } as const; -const statics = { - HttpsErrorCode, -}; - -interface HttpsCallableOptions { - timeout?: number; -} - -// Export types for use in modular API -export type { HttpsCallableOptions }; - -export interface HttpsCallable { - (data?: RequestData | null): Promise<{ data: ResponseData }>; -} - -export interface FunctionsModule { - httpsCallable( - name: string, - options?: HttpsCallableOptions, - ): HttpsCallable; - httpsCallableFromUrl( - url: string, - options?: HttpsCallableOptions, - ): HttpsCallable; - useFunctionsEmulator(origin: string): void; - useEmulator(host: string, port: number): void; -} - -// Export the complete FirebaseFunctionsTypes namespace -// eslint-disable-next-line @typescript-eslint/no-namespace -export namespace FirebaseFunctionsTypes { - export type FunctionsErrorCode = - | 'ok' - | 'cancelled' - | 'unknown' - | 'invalid-argument' - | 'deadline-exceeded' - | 'not-found' - | 'already-exists' - | 'permission-denied' - | 'resource-exhausted' - | 'failed-precondition' - | 'aborted' - | 'out-of-range' - | 'unimplemented' - | 'internal' - | 'unavailable' - | 'data-loss' - | 'unauthenticated'; - - export interface HttpsCallableResult { - readonly data: ResponseData; - } - - export interface HttpsCallable { - (data?: RequestData | null): Promise>; - } - - export interface HttpsCallableOptions { - timeout?: number; - } - - export interface HttpsError extends Error { - readonly code: FunctionsErrorCode; - readonly details?: any; - } - - export interface HttpsErrorCode { - OK: 'ok'; - CANCELLED: 'cancelled'; - UNKNOWN: 'unknown'; - INVALID_ARGUMENT: 'invalid-argument'; - DEADLINE_EXCEEDED: 'deadline-exceeded'; - NOT_FOUND: 'not-found'; - ALREADY_EXISTS: 'already-exists'; - PERMISSION_DENIED: 'permission-denied'; - UNAUTHENTICATED: 'unauthenticated'; - RESOURCE_EXHAUSTED: 'resource-exhausted'; - FAILED_PRECONDITION: 'failed-precondition'; - ABORTED: 'aborted'; - OUT_OF_RANGE: 'out-of-range'; - UNIMPLEMENTED: 'unimplemented'; - INTERNAL: 'internal'; - UNAVAILABLE: 'unavailable'; - DATA_LOSS: 'data-loss'; - } - - export interface Statics { - HttpsErrorCode: HttpsErrorCode; - } - - export interface Module { - httpsCallable( - name: string, - options?: HttpsCallableOptions, - ): HttpsCallable; - httpsCallableFromUrl( - url: string, - options?: HttpsCallableOptions, - ): HttpsCallable; - useFunctionsEmulator(origin: string): void; - useEmulator(host: string, port: number): void; - } -} - -class FirebaseFunctionsModule extends FirebaseModule { - private _customUrlOrRegion: string; - private _useFunctionsEmulatorHost: string | null; - private _useFunctionsEmulatorPort: number; - - constructor(...args: any[]) { - super(...args); - // @ts-ignore - this._customUrlOrRegion = this._customUrlOrRegion || 'us-central1'; - this._useFunctionsEmulatorHost = null; - this._useFunctionsEmulatorPort = -1; - } - - httpsCallable(name: string, options: HttpsCallableOptions = {}) { - if (options.timeout) { - if (isNumber(options.timeout)) { - options.timeout = options.timeout / 1000; - } else { - throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); - } - } - - return (data?: any) => { - const nativePromise = this.native.httpsCallable( - this._useFunctionsEmulatorHost, - this._useFunctionsEmulatorPort, - name, - { - data, - }, - options, - ); - return nativePromise.catch((nativeError: NativeError) => { - const { code, message, details } = nativeError.userInfo || {}; - return Promise.reject( - new HttpsError( - HttpsErrorCode[code as keyof typeof HttpsErrorCode] || HttpsErrorCode.UNKNOWN, - message || nativeError.message, - details || null, - nativeError, - ), - ); - }); - }; - } - - httpsCallableFromUrl(url: string, options: HttpsCallableOptions = {}) { - if (options.timeout) { - if (isNumber(options.timeout)) { - options.timeout = options.timeout / 1000; - } else { - throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); - } - } - - return (data?: any) => { - const nativePromise = this.native.httpsCallableFromUrl( - this._useFunctionsEmulatorHost, - this._useFunctionsEmulatorPort, - url, - { - data, - }, - options, - ); - return nativePromise.catch((nativeError: NativeError) => { - const { code, message, details } = nativeError.userInfo || {}; - return Promise.reject( - new HttpsError( - HttpsErrorCode[code as keyof typeof HttpsErrorCode] || HttpsErrorCode.UNKNOWN, - message || nativeError.message, - details || null, - nativeError, - ), - ); - }); - }; - } - - useFunctionsEmulator(origin: string): void { - const match = /https?\:.*\/\/([^:]+):?(\d+)?/.exec(origin); - if (!match) { - throw new Error('Invalid emulator origin format'); - } - const [, host, portStr] = match; - const port = portStr ? parseInt(portStr) : 5001; - this.useEmulator(host as string, port); - } - - useEmulator(host: string, port: number): void { - if (!isNumber(port)) { - throw new Error('useEmulator port parameter must be a number'); - } - - let _host = host; - - const androidBypassEmulatorUrlRemap = - typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' && - this.firebaseJson.android_bypass_emulator_url_remap; - if (!androidBypassEmulatorUrlRemap && isAndroid && _host) { - if (_host.startsWith('localhost')) { - _host = _host.replace('localhost', '10.0.2.2'); - // eslint-disable-next-line no-console - console.log( - 'Mapping functions host "localhost" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', - ); - } - if (_host.startsWith('127.0.0.1')) { - _host = _host.replace('127.0.0.1', '10.0.2.2'); - // eslint-disable-next-line no-console - console.log( - 'Mapping functions host "127.0.0.1" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', - ); - } - } - this._useFunctionsEmulatorHost = _host || null; - this._useFunctionsEmulatorPort = port || -1; - } -} - -// import { SDK_VERSION } from '@react-native-firebase/functions'; -export const SDK_VERSION = version; - -// import functions from '@react-native-firebase/functions'; -// functions().logEvent(...); -export default createModuleNamespace({ - statics, - version, - namespace, - nativeModuleName, - nativeEvents: false, - hasMultiAppSupport: true, - hasCustomUrlOrRegionSupport: true, - ModuleClass: FirebaseFunctionsModule, -}); - -// import functions, { firebase } from '@react-native-firebase/functions'; -// functions().logEvent(...); -// firebase.functions().logEvent(...); -export const firebase = getFirebaseRoot(); - -// Register the interop module for non-native platforms. -setReactNativeModule(nativeModuleName, fallBackModule); - -export * from './modular'; +export * from './namespaced'; diff --git a/packages/functions/lib/modular/index.ts b/packages/functions/lib/modular/index.ts deleted file mode 100644 index 806c73f4f8..0000000000 --- a/packages/functions/lib/modular/index.ts +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2016-present Invertase Limited & Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this library except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import { getApp, type ReactNativeFirebase } from '@react-native-firebase/app'; -import type { FunctionsModule, HttpsCallable, HttpsCallableOptions } from '../index'; -import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/lib/common'; - -type FirebaseApp = ReactNativeFirebase.FirebaseApp; -type Functions = FunctionsModule; - -/** - * Returns a Functions instance for the given app. - * @param app - The FirebaseApp to use. Optional. - * @param regionOrCustomDomain - One of: a) The region the callable functions are located in (ex: us-central1) b) A custom domain hosting the callable functions (ex: https://mydomain.com). Optional. - * @returns Functions instance for the given app. - */ -export function getFunctions(app?: FirebaseApp, regionOrCustomDomain?: string): Functions { - if (app) { - return getApp(app.name).functions(regionOrCustomDomain) as Functions; - } - - return getApp().functions(regionOrCustomDomain) as Functions; -} - -/** - * Modify this instance to communicate with the Cloud Functions emulator. - * Note: this must be called before this instance has been used to do any operations. - * @param functionsInstance A functions instance. - * @param host The emulator host. (ex: localhost) - * @param port The emulator port. (ex: 5001) - */ -export function connectFunctionsEmulator( - functionsInstance: Functions, - host: string, - port: number, -): void { - // @ts-ignore - return functionsInstance.useEmulator.call(functionsInstance, host, port, MODULAR_DEPRECATION_ARG); -} - -/** - * Returns a reference to the callable HTTPS trigger with the given name. - * @param functionsInstance A functions instance. - * @param name The name of the trigger. - * @param options An interface for metadata about how calls should be executed. - * @returns HttpsCallable instance - */ -export function httpsCallable( - functionsInstance: Functions, - name: string, - options?: HttpsCallableOptions, -): HttpsCallable { - return functionsInstance.httpsCallable.call( - functionsInstance, - name, - options, - // @ts-ignore - MODULAR_DEPRECATION_ARG, - ) as HttpsCallable; -} - -/** - * Returns a reference to the callable HTTPS trigger with the specified url. - * @param functionsInstance A functions instance. - * @param url The url of the trigger. - * @param options An instance of HttpsCallableOptions containing metadata about how calls should be executed. - * @returns HttpsCallable instance - */ -export function httpsCallableFromUrl( - functionsInstance: Functions, - url: string, - options?: HttpsCallableOptions, -): HttpsCallable { - return functionsInstance.httpsCallableFromUrl.call( - functionsInstance, - url, - options, - // @ts-ignore - MODULAR_DEPRECATION_ARG, - ) as HttpsCallable; -} - -// Define HttpsErrorCode locally to avoid circular imports -export const HttpsErrorCode = { - OK: 'ok', - CANCELLED: 'cancelled', - UNKNOWN: 'unknown', - INVALID_ARGUMENT: 'invalid-argument', - DEADLINE_EXCEEDED: 'deadline-exceeded', - NOT_FOUND: 'not-found', - ALREADY_EXISTS: 'already-exists', - PERMISSION_DENIED: 'permission-denied', - UNAUTHENTICATED: 'unauthenticated', - RESOURCE_EXHAUSTED: 'resource-exhausted', - FAILED_PRECONDITION: 'failed-precondition', - ABORTED: 'aborted', - OUT_OF_RANGE: 'out-of-range', - UNIMPLEMENTED: 'unimplemented', - INTERNAL: 'internal', - UNAVAILABLE: 'unavailable', - DATA_LOSS: 'data-loss', - // Web codes are lowercase dasherized. - ok: 'ok', - cancelled: 'cancelled', - unknown: 'unknown', - 'invalid-argument': 'invalid-argument', - 'deadline-exceeded': 'deadline-exceeded', - 'not-found': 'not-found', - 'already-exists': 'already-exists', - 'permission-denied': 'permission-denied', - unauthenticated: 'unauthenticated', - 'resource-exhausted': 'resource-exhausted', - 'failed-precondition': 'failed-precondition', - aborted: 'aborted', - 'out-of-range': 'out-of-range', - unimplemented: 'unimplemented', - internal: 'internal', - unavailable: 'unavailable', - 'data-loss': 'data-loss', -} as const; - -export * from '../index'; diff --git a/packages/functions/lib/namespaced.ts b/packages/functions/lib/namespaced.ts new file mode 100644 index 0000000000..23c07dc8e6 --- /dev/null +++ b/packages/functions/lib/namespaced.ts @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +import { isAndroid, isNumber } from '@react-native-firebase/app/lib/common'; +import { + createModuleNamespace, + FirebaseModule, + getFirebaseRoot, +} from '@react-native-firebase/app/lib/internal'; +import { HttpsError, type NativeError } from './HttpsError'; +import { version } from './version'; +import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule'; +import fallBackModule from './web/RNFBFunctionsModule'; +import type { HttpsCallableOptions } from '.'; +const namespace = 'functions'; +const nativeModuleName = 'RNFBFunctionsModule'; + +export const HttpsErrorCode = { + OK: 'ok', + CANCELLED: 'cancelled', + UNKNOWN: 'unknown', + INVALID_ARGUMENT: 'invalid-argument', + DEADLINE_EXCEEDED: 'deadline-exceeded', + NOT_FOUND: 'not-found', + ALREADY_EXISTS: 'already-exists', + PERMISSION_DENIED: 'permission-denied', + UNAUTHENTICATED: 'unauthenticated', + RESOURCE_EXHAUSTED: 'resource-exhausted', + FAILED_PRECONDITION: 'failed-precondition', + ABORTED: 'aborted', + OUT_OF_RANGE: 'out-of-range', + UNIMPLEMENTED: 'unimplemented', + INTERNAL: 'internal', + UNAVAILABLE: 'unavailable', + DATA_LOSS: 'data-loss', + // Web codes are lowercase dasherized. + ok: 'ok', + cancelled: 'cancelled', + unknown: 'unknown', + 'invalid-argument': 'invalid-argument', + 'deadline-exceeded': 'deadline-exceeded', + 'not-found': 'not-found', + 'already-exists': 'already-exists', + 'permission-denied': 'permission-denied', + unauthenticated: 'unauthenticated', + 'resource-exhausted': 'resource-exhausted', + 'failed-precondition': 'failed-precondition', + aborted: 'aborted', + 'out-of-range': 'out-of-range', + unimplemented: 'unimplemented', + internal: 'internal', + unavailable: 'unavailable', + 'data-loss': 'data-loss', +} as const; + +const statics = { + HttpsErrorCode, +}; + +// Export the complete FirebaseFunctionsTypes namespace +// eslint-disable-next-line @typescript-eslint/no-namespace +export namespace FirebaseFunctionsTypes { + export type FunctionsErrorCode = + | 'ok' + | 'cancelled' + | 'unknown' + | 'invalid-argument' + | 'deadline-exceeded' + | 'not-found' + | 'already-exists' + | 'permission-denied' + | 'resource-exhausted' + | 'failed-precondition' + | 'aborted' + | 'out-of-range' + | 'unimplemented' + | 'internal' + | 'unavailable' + | 'data-loss' + | 'unauthenticated'; + + export interface HttpsCallableResult { + readonly data: ResponseData; + } + + export interface HttpsCallable { + (data?: RequestData | null): Promise>; + } + + export interface HttpsCallableOptions { + timeout?: number; + } + + export interface HttpsError extends Error { + readonly code: FunctionsErrorCode; + readonly details?: any; + } + + export interface HttpsErrorCode { + OK: 'ok'; + CANCELLED: 'cancelled'; + UNKNOWN: 'unknown'; + INVALID_ARGUMENT: 'invalid-argument'; + DEADLINE_EXCEEDED: 'deadline-exceeded'; + NOT_FOUND: 'not-found'; + ALREADY_EXISTS: 'already-exists'; + PERMISSION_DENIED: 'permission-denied'; + UNAUTHENTICATED: 'unauthenticated'; + RESOURCE_EXHAUSTED: 'resource-exhausted'; + FAILED_PRECONDITION: 'failed-precondition'; + ABORTED: 'aborted'; + OUT_OF_RANGE: 'out-of-range'; + UNIMPLEMENTED: 'unimplemented'; + INTERNAL: 'internal'; + UNAVAILABLE: 'unavailable'; + DATA_LOSS: 'data-loss'; + } + + export interface Statics { + HttpsErrorCode: HttpsErrorCode; + } + + export interface Module { + httpsCallable( + name: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + httpsCallableFromUrl( + url: string, + options?: HttpsCallableOptions, + ): HttpsCallable; + useFunctionsEmulator(origin: string): void; + useEmulator(host: string, port: number): void; + } +} + +class FirebaseFunctionsModule extends FirebaseModule { + private _customUrlOrRegion: string; + private _useFunctionsEmulatorHost: string | null; + private _useFunctionsEmulatorPort: number; + + constructor(...args: any[]) { + super(...args); + // @ts-ignore + this._customUrlOrRegion = this._customUrlOrRegion || 'us-central1'; + this._useFunctionsEmulatorHost = null; + this._useFunctionsEmulatorPort = -1; + } + + httpsCallable(name: string, options: HttpsCallableOptions = {}) { + if (options.timeout) { + if (isNumber(options.timeout)) { + options.timeout = options.timeout / 1000; + } else { + throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); + } + } + + return (data?: any) => { + const nativePromise = this.native.httpsCallable( + this._useFunctionsEmulatorHost, + this._useFunctionsEmulatorPort, + name, + { + data, + }, + options, + ); + return nativePromise.catch((nativeError: NativeError) => { + const { code, message, details } = nativeError.userInfo || {}; + return Promise.reject( + new HttpsError( + HttpsErrorCode[code as keyof typeof HttpsErrorCode] || HttpsErrorCode.UNKNOWN, + message || nativeError.message, + details || null, + nativeError, + ), + ); + }); + }; + } + + httpsCallableFromUrl(url: string, options: HttpsCallableOptions = {}) { + if (options.timeout) { + if (isNumber(options.timeout)) { + options.timeout = options.timeout / 1000; + } else { + throw new Error('HttpsCallableOptions.timeout expected a Number in milliseconds'); + } + } + + return (data?: any) => { + const nativePromise = this.native.httpsCallableFromUrl( + this._useFunctionsEmulatorHost, + this._useFunctionsEmulatorPort, + url, + { + data, + }, + options, + ); + return nativePromise.catch((nativeError: NativeError) => { + const { code, message, details } = nativeError.userInfo || {}; + return Promise.reject( + new HttpsError( + HttpsErrorCode[code as keyof typeof HttpsErrorCode] || HttpsErrorCode.UNKNOWN, + message || nativeError.message, + details || null, + nativeError, + ), + ); + }); + }; + } + + useFunctionsEmulator(origin: string): void { + const match = /https?\:.*\/\/([^:]+):?(\d+)?/.exec(origin); + if (!match) { + throw new Error('Invalid emulator origin format'); + } + const [, host, portStr] = match; + const port = portStr ? parseInt(portStr) : 5001; + this.useEmulator(host as string, port); + } + + useEmulator(host: string, port: number): void { + if (!isNumber(port)) { + throw new Error('useEmulator port parameter must be a number'); + } + + let _host = host; + + const androidBypassEmulatorUrlRemap = + typeof this.firebaseJson.android_bypass_emulator_url_remap === 'boolean' && + this.firebaseJson.android_bypass_emulator_url_remap; + if (!androidBypassEmulatorUrlRemap && isAndroid && _host) { + if (_host.startsWith('localhost')) { + _host = _host.replace('localhost', '10.0.2.2'); + // eslint-disable-next-line no-console + console.log( + 'Mapping functions host "localhost" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', + ); + } + if (_host.startsWith('127.0.0.1')) { + _host = _host.replace('127.0.0.1', '10.0.2.2'); + // eslint-disable-next-line no-console + console.log( + 'Mapping functions host "127.0.0.1" to "10.0.2.2" for android emulators. Use real IP on real devices. You can bypass this behaviour with "android_bypass_emulator_url_remap" flag.', + ); + } + } + this._useFunctionsEmulatorHost = _host || null; + this._useFunctionsEmulatorPort = port || -1; + } +} + +// import { SDK_VERSION } from '@react-native-firebase/functions'; +export const SDK_VERSION = version; + +// import functions from '@react-native-firebase/functions'; +// functions().logEvent(...); +export default createModuleNamespace({ + statics, + version, + namespace, + nativeModuleName, + nativeEvents: false, + hasMultiAppSupport: true, + hasCustomUrlOrRegionSupport: true, + ModuleClass: FirebaseFunctionsModule, +}); + +// import functions, { firebase } from '@react-native-firebase/functions'; +// functions().logEvent(...); +// firebase.functions().logEvent(...); +export const firebase = getFirebaseRoot(); + +// Register the interop module for non-native platforms. +setReactNativeModule(nativeModuleName, fallBackModule); + +export * from '.'; diff --git a/packages/functions/package.json b/packages/functions/package.json index 65f8a499b4..f192eb1c7e 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -5,7 +5,7 @@ "description": "React Native Firebase - Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. React Native Firebase supports integration with production and locally emulated Cloud Functions with a simple API interface.\n\n", "main": "./dist/commonjs/index.js", "module": "./dist/module/index.js", - "types": "./dist/typescript/commonjs/functions/lib/modular/index.d.ts", + "types": "./dist/typescript/commonjs/functions/lib/index.d.ts", "codegenConfig": { "name": "NativeFunctionsModule", "type": "modules", @@ -52,13 +52,13 @@ }, "exports": { ".": { - "source": "./lib/modular/index.ts", + "source": "./lib/index.ts", "import": { - "types": "./dist/typescript/module/functions/lib/modular/index.d.ts", + "types": "./dist/typescript/module/functions/lib/index.d.ts", "default": "./dist/module/index.js" }, "require": { - "types": "./dist/typescript/commonjs/functions/lib/modular/index.d.ts", + "types": "./dist/typescript/commonjs/functions/lib/index.d.ts", "default": "./dist/commonjs/index.js" } }, @@ -72,7 +72,7 @@ "!**/__mocks__" ], "react-native-builder-bob": { - "source": "lib/modular", + "source": "lib", "output": "dist", "targets": [ [ From f4014d0daf11f7250bb85275db9376463173946b Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 9 Jul 2025 09:48:23 +0100 Subject: [PATCH 41/79] exclude jni from compilation --- packages/functions/android/build.gradle | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/functions/android/build.gradle b/packages/functions/android/build.gradle index 0c2678a39c..96dd252292 100644 --- a/packages/functions/android/build.gradle +++ b/packages/functions/android/build.gradle @@ -80,9 +80,11 @@ android { } } - sourceSets { + sourceSets { main { java.srcDirs = ['src/main/java', 'src/reactnative/java'] + // Exclude generated JNI files from compilation + java.excludes = ['**/generated/jni/**'] } } } From 459f9365929ba040d0e16cef6592fa5d2b5426e0 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 16 Jul 2025 11:50:47 +0100 Subject: [PATCH 42/79] fix: retreive if turbomodule --- packages/app/lib/internal/nativeModuleAndroidIos.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/app/lib/internal/nativeModuleAndroidIos.js b/packages/app/lib/internal/nativeModuleAndroidIos.js index 31a6a2e281..887b3fb00c 100644 --- a/packages/app/lib/internal/nativeModuleAndroidIos.js +++ b/packages/app/lib/internal/nativeModuleAndroidIos.js @@ -1,5 +1,6 @@ /* eslint-disable no-console */ import { NativeModules } from 'react-native'; +import { TurboModuleRegistry } from 'react-native'; /** * This is used by Android and iOS to get a native module. @@ -8,7 +9,7 @@ import { NativeModules } from 'react-native'; * @param moduleName */ export function getReactNativeModule(moduleName) { - const nativeModule = NativeModules[moduleName]; + const nativeModule = NativeModules[moduleName] || TurboModuleRegistry.getEnforcing(moduleName); if (!globalThis.RNFBDebug) { return nativeModule; } From 471b28514073e30979330a70664737067686f653 Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 16 Jul 2025 11:51:03 +0100 Subject: [PATCH 43/79] fix: rename native module name --- packages/functions/lib/namespaced.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/functions/lib/namespaced.ts b/packages/functions/lib/namespaced.ts index 23c07dc8e6..4e215f505a 100644 --- a/packages/functions/lib/namespaced.ts +++ b/packages/functions/lib/namespaced.ts @@ -27,7 +27,7 @@ import { setReactNativeModule } from '@react-native-firebase/app/lib/internal/na import fallBackModule from './web/RNFBFunctionsModule'; import type { HttpsCallableOptions } from '.'; const namespace = 'functions'; -const nativeModuleName = 'RNFBFunctionsModule'; +const nativeModuleName = 'NativeFunctionsModule'; export const HttpsErrorCode = { OK: 'ok', From 1bb2088624208752342dc9919c130118bf4ee3bc Mon Sep 17 00:00:00 2001 From: russellwheatley Date: Wed, 16 Jul 2025 11:51:21 +0100 Subject: [PATCH 44/79] setup example app --- tests/test-app/examples/functions/index.js | 38 ++++++++++++++++++++++ tests/test-app/index.js | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/test-app/examples/functions/index.js diff --git a/tests/test-app/examples/functions/index.js b/tests/test-app/examples/functions/index.js new file mode 100644 index 0000000000..d65a8ee5ae --- /dev/null +++ b/tests/test-app/examples/functions/index.js @@ -0,0 +1,38 @@ +import React from 'react'; +import { AppRegistry, Button, Text, View } from 'react-native'; + +import { getApp } from '@react-native-firebase/app'; +import { + getFunctions, + connectFunctionsEmulator, + httpsCallable, +} from '@react-native-firebase/functions'; + +const functions = getFunctions(); +connectFunctionsEmulator(functions, 'localhost', 5001); +function App() { + return ( + + React Native Firebase + Functions API + Ensure Emulator is running!! +