@firebase/functions
Advanced tools
Comparing version 0.11.8 to 0.11.9-20241017211210
@@ -44,14 +44,25 @@ /** | ||
* An error returned by the Firebase Functions client SDK. | ||
* | ||
* See {@link FunctionsErrorCode} for full documentation of codes. | ||
* | ||
* @public | ||
*/ | ||
export declare interface FunctionsError extends FirebaseError { | ||
export declare class FunctionsError extends FirebaseError { | ||
/** | ||
* Additional details to be converted to JSON and included in the error response. | ||
*/ | ||
readonly details?: unknown; | ||
/** | ||
* Constructs a new instance of the `FunctionsError` class. | ||
*/ | ||
constructor( | ||
/** | ||
* 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. | ||
*/ | ||
readonly code: FunctionsErrorCode; | ||
code: FunctionsErrorCodeCore, message?: string, | ||
/** | ||
* Extra data to be converted to JSON and included in the error response. | ||
* Additional details to be converted to JSON and included in the error response. | ||
*/ | ||
readonly details?: unknown; | ||
details?: unknown); | ||
} | ||
@@ -58,0 +69,0 @@ |
@@ -44,14 +44,25 @@ /** | ||
* An error returned by the Firebase Functions client SDK. | ||
* | ||
* See {@link FunctionsErrorCode} for full documentation of codes. | ||
* | ||
* @public | ||
*/ | ||
export declare interface FunctionsError extends FirebaseError { | ||
export declare class FunctionsError extends FirebaseError { | ||
/** | ||
* Additional details to be converted to JSON and included in the error response. | ||
*/ | ||
readonly details?: unknown; | ||
/** | ||
* Constructs a new instance of the `FunctionsError` class. | ||
*/ | ||
constructor( | ||
/** | ||
* 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. | ||
*/ | ||
readonly code: FunctionsErrorCode; | ||
code: FunctionsErrorCodeCore, message?: string, | ||
/** | ||
* Extra data to be converted to JSON and included in the error response. | ||
* Additional details to be converted to JSON and included in the error response. | ||
*/ | ||
readonly details?: unknown; | ||
details?: unknown); | ||
} | ||
@@ -58,0 +69,0 @@ |
@@ -178,6 +178,12 @@ 'use strict'; | ||
/** | ||
* An explicit error that can be thrown from a handler to send an error to the | ||
* client that called the function. | ||
* An error returned by the Firebase Functions client SDK. | ||
* | ||
* See {@link FunctionsErrorCode} for full documentation of codes. | ||
* | ||
* @public | ||
*/ | ||
class FunctionsError extends util.FirebaseError { | ||
/** | ||
* Constructs a new instance of the `FunctionsError` class. | ||
*/ | ||
constructor( | ||
@@ -190,3 +196,3 @@ /** | ||
/** | ||
* Extra data to be converted to JSON and included in the error response. | ||
* Additional details to be converted to JSON and included in the error response. | ||
*/ | ||
@@ -196,2 +202,5 @@ details) { | ||
this.details = details; | ||
// Since the FirebaseError constructor sets the prototype of `this` to FirebaseError.prototype, | ||
// we also have to do it in all subclasses to allow for correct `instanceof` checks. | ||
Object.setPrototypeOf(this, FunctionsError.prototype); | ||
} | ||
@@ -433,5 +442,4 @@ } | ||
*/ | ||
constructor(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain = DEFAULT_REGION, fetchImpl) { | ||
constructor(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain = DEFAULT_REGION) { | ||
this.app = app; | ||
this.fetchImpl = fetchImpl; | ||
this.emulatorOrigin = null; | ||
@@ -516,7 +524,7 @@ this.contextProvider = new ContextProvider(authProvider, messagingProvider, appCheckProvider); | ||
*/ | ||
async function postJSON(url, body, headers, fetchImpl) { | ||
async function postJSON(url, body, headers) { | ||
headers['Content-Type'] = 'application/json'; | ||
let response; | ||
try { | ||
response = await fetchImpl(url, { | ||
response = await fetch(url, { | ||
method: 'POST', | ||
@@ -583,3 +591,3 @@ body: JSON.stringify(body), | ||
const response = await Promise.race([ | ||
postJSON(url, body, headers, functionsInstance.fetchImpl), | ||
postJSON(url, body, headers), | ||
failAfterHandle.promise, | ||
@@ -618,3 +626,3 @@ functionsInstance.cancelAllRequests | ||
const name = "@firebase/functions"; | ||
const version = "0.11.8"; | ||
const version = "0.11.9-20241017211210"; | ||
@@ -640,3 +648,3 @@ /** | ||
const MESSAGING_INTERNAL_NAME = 'messaging-internal'; | ||
function registerFunctions(fetchImpl, variant) { | ||
function registerFunctions(variant) { | ||
const factory = (container, { instanceIdentifier: regionOrCustomDomain }) => { | ||
@@ -649,7 +657,7 @@ // Dependencies | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return new FunctionsService(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain, fetchImpl); | ||
return new FunctionsService(app, authProvider, messagingProvider, appCheckProvider, regionOrCustomDomain); | ||
}; | ||
app._registerComponent(new component.Component(FUNCTIONS_TYPE, factory, "PUBLIC" /* ComponentType.PUBLIC */).setMultipleInstances(true)); | ||
app.registerVersion(name, version, variant); | ||
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation | ||
// BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation | ||
app.registerVersion(name, version, 'cjs2017'); | ||
@@ -728,4 +736,5 @@ } | ||
*/ | ||
registerFunctions(fetch.bind(self)); | ||
registerFunctions(); | ||
exports.FunctionsError = FunctionsError; | ||
exports.connectFunctionsEmulator = connectFunctionsEmulator; | ||
@@ -732,0 +741,0 @@ exports.getFunctions = getFunctions; |
@@ -19,2 +19,3 @@ /** | ||
import { Functions, HttpsCallableOptions, HttpsCallable } from './public-types'; | ||
export { FunctionsError } from './error'; | ||
export * from './public-types'; | ||
@@ -21,0 +22,0 @@ /** |
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
export declare function registerFunctions(fetchImpl: typeof fetch, variant?: string): void; | ||
export declare function registerFunctions(variant?: string): void; |
@@ -21,10 +21,16 @@ /** | ||
/** | ||
* An explicit error that can be thrown from a handler to send an error to the | ||
* client that called the function. | ||
* An error returned by the Firebase Functions client SDK. | ||
* | ||
* See {@link FunctionsErrorCode} for full documentation of codes. | ||
* | ||
* @public | ||
*/ | ||
export declare class FunctionsError extends FirebaseError { | ||
/** | ||
* Extra data to be converted to JSON and included in the error response. | ||
* Additional details to be converted to JSON and included in the error response. | ||
*/ | ||
readonly details?: unknown; | ||
/** | ||
* Constructs a new instance of the `FunctionsError` class. | ||
*/ | ||
constructor( | ||
@@ -37,3 +43,3 @@ /** | ||
/** | ||
* Extra data to be converted to JSON and included in the error response. | ||
* Additional details to be converted to JSON and included in the error response. | ||
*/ | ||
@@ -40,0 +46,0 @@ details?: unknown); |
@@ -18,3 +18,2 @@ /** | ||
import { FirebaseApp } from '@firebase/app'; | ||
import { FirebaseError } from '@firebase/util'; | ||
/** | ||
@@ -120,17 +119,2 @@ * An `HttpsCallableResult` wraps a single result from a function call. | ||
export declare type FunctionsErrorCode = `functions/${FunctionsErrorCodeCore}`; | ||
/** | ||
* An error returned by the Firebase Functions client SDK. | ||
* @public | ||
*/ | ||
export interface FunctionsError extends FirebaseError { | ||
/** | ||
* 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. | ||
*/ | ||
readonly code: FunctionsErrorCode; | ||
/** | ||
* Extra data to be converted to JSON and included in the error response. | ||
*/ | ||
readonly details?: unknown; | ||
} | ||
declare module '@firebase/component' { | ||
@@ -137,0 +121,0 @@ interface NameServiceMapping { |
@@ -45,3 +45,2 @@ /** | ||
readonly app: FirebaseApp; | ||
readonly fetchImpl: typeof fetch; | ||
readonly contextProvider: ContextProvider; | ||
@@ -57,3 +56,3 @@ emulatorOrigin: string | null; | ||
*/ | ||
constructor(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, messagingProvider: Provider<MessagingInternalComponentName>, appCheckProvider: Provider<AppCheckInternalComponentName>, regionOrCustomDomain: string | undefined, fetchImpl: typeof fetch); | ||
constructor(app: FirebaseApp, authProvider: Provider<FirebaseAuthInternalName>, messagingProvider: Provider<MessagingInternalComponentName>, appCheckProvider: Provider<AppCheckInternalComponentName>, regionOrCustomDomain?: string); | ||
_delete(): Promise<void>; | ||
@@ -60,0 +59,0 @@ /** |
{ | ||
"name": "@firebase/functions", | ||
"version": "0.11.8", | ||
"version": "0.11.9-20241017211210", | ||
"description": "", | ||
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"main": "dist/index.node.cjs.js", | ||
"browser": "dist/index.esm2017.js", | ||
"module": "dist/index.esm2017.js", | ||
"esm5": "dist/index.esm.js", | ||
"main": "dist/index.cjs.js", | ||
"browser": "dist/esm/index.esm2017.js", | ||
"module": "dist/esm/index.esm2017.js", | ||
"exports": { | ||
@@ -14,11 +13,10 @@ ".": { | ||
"node": { | ||
"import": "./dist/esm-node/index.node.esm.js", | ||
"require": "./dist/index.node.cjs.js" | ||
"import": "./dist/esm/index.esm2017.js", | ||
"require": "./dist/index.cjs.js" | ||
}, | ||
"esm5": "./dist/index.esm.js", | ||
"browser": { | ||
"require": "./dist/index.cjs.js", | ||
"import": "./dist/index.esm2017.js" | ||
"import": "./dist/esm/index.esm2017.js" | ||
}, | ||
"default": "./dist/index.esm2017.js" | ||
"default": "./dist/esm/index.esm2017.js" | ||
}, | ||
@@ -42,3 +40,3 @@ "./package.json": "./package.json" | ||
"test:browser:debug": "karma start --browsers=Chrome --auto-watch", | ||
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'src/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js", | ||
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'src/{,!(browser)/**/}*.test.ts' --file src/index.ts --config ../../config/mocharc.node.js", | ||
"test:emulator": "env FIREBASE_FUNCTIONS_EMULATOR_ORIGIN=http://localhost:5005 run-p --npm-path npm test:node", | ||
@@ -53,6 +51,6 @@ "trusted-type-check": "tsec -p tsconfig.json --noEmit", | ||
"peerDependencies": { | ||
"@firebase/app": "0.x" | ||
"@firebase/app": "0.10.14-20241017211210" | ||
}, | ||
"devDependencies": { | ||
"@firebase/app": "0.10.11", | ||
"@firebase/app": "0.10.14-20241017211210", | ||
"rollup": "2.79.1", | ||
@@ -73,8 +71,7 @@ "@rollup/plugin-json": "4.1.0", | ||
"dependencies": { | ||
"@firebase/component": "0.6.9", | ||
"@firebase/component": "0.6.10-20241017211210", | ||
"@firebase/messaging-interop-types": "0.2.2", | ||
"@firebase/auth-interop-types": "0.2.3", | ||
"@firebase/app-check-interop-types": "0.3.2", | ||
"@firebase/util": "1.10.0", | ||
"undici": "6.19.7", | ||
"@firebase/util": "1.10.1-20241017211210", | ||
"tslib": "^2.1.0" | ||
@@ -87,3 +84,6 @@ }, | ||
"reportDir": "./coverage/node" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 4 instances in 1 package
7
2
80
3
198739
36
2647
+ Added@firebase/app@0.10.14-20241017211210(transitive)
+ Added@firebase/component@0.6.10-20241017211210(transitive)
+ Added@firebase/logger@0.4.3-20241017211210(transitive)
+ Added@firebase/util@1.10.1-20241017211210(transitive)
- Removedundici@6.19.7
- Removed@firebase/app@0.10.18(transitive)
- Removed@firebase/component@0.6.120.6.9(transitive)
- Removed@firebase/logger@0.4.4(transitive)
- Removed@firebase/util@1.10.01.10.3(transitive)
- Removedundici@6.19.7(transitive)