@google-cloud/functions-framework
Advanced tools
Comparing version 3.1.3 to 3.2.0
@@ -34,5 +34,2 @@ "use strict"; | ||
res.locals.functionExecutionFinished = true; | ||
if (err) { | ||
console.error(err.stack); | ||
} | ||
(0, invoker_1.sendResponse)(result, err, res); | ||
@@ -39,0 +36,0 @@ } |
@@ -60,3 +60,3 @@ /// <reference types="node" /> | ||
*/ | ||
export declare type HandlerFunction<T = unknown> = HttpFunction | EventFunction | EventFunctionWithCallback | CloudEventFunction<T> | CloudEventFunctionWithCallback<T>; | ||
export type HandlerFunction<T = unknown> = HttpFunction | EventFunction | EventFunctionWithCallback | CloudEventFunction<T> | CloudEventFunctionWithCallback<T>; | ||
/** | ||
@@ -83,3 +83,3 @@ * A legacy event. | ||
*/ | ||
export declare type LegacyCloudFunctionsContext = CloudFunctionsContext | Data; | ||
export type LegacyCloudFunctionsContext = CloudFunctionsContext | Data; | ||
/** | ||
@@ -115,3 +115,3 @@ * The Cloud Functions context object for the event. | ||
*/ | ||
export declare type Context = CloudFunctionsContext | CloudEvent<unknown>; | ||
export type Context = CloudFunctionsContext | CloudEvent<unknown>; | ||
//# sourceMappingURL=functions.d.ts.map |
@@ -17,3 +17,7 @@ "use strict"; | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -20,0 +24,0 @@ if (k2 === undefined) k2 = k; |
@@ -104,3 +104,3 @@ "use strict"; | ||
} | ||
let userFunction = functionTarget | ||
const userFunction = functionTarget | ||
.split('.') | ||
@@ -115,13 +115,6 @@ .reduce((code, functionTargetPart) => { | ||
}, functionModule); | ||
// TODO: do we want 'function' fallback? | ||
if (typeof userFunction === 'undefined') { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (functionModule.hasOwnProperty('function')) { | ||
userFunction = functionModule['function']; | ||
} | ||
else { | ||
console.error(`Function '${functionTarget}' is not defined in the provided ` + | ||
'module.\nDid you specify the correct target function to execute?'); | ||
return null; | ||
} | ||
console.error(`Function '${functionTarget}' is not defined in the provided ` + | ||
'module.\nDid you specify the correct target function to execute?'); | ||
return null; | ||
} | ||
@@ -128,0 +121,0 @@ if (typeof userFunction !== 'function') { |
@@ -9,3 +9,3 @@ export declare const FUNCTION_STATUS_HEADER_FIELD = "X-Google-Status"; | ||
*/ | ||
export declare type SignatureType = typeof SignatureType[number]; | ||
export type SignatureType = typeof SignatureType[number]; | ||
/** | ||
@@ -12,0 +12,0 @@ * Type guard to test if a provided value is valid SignatureType |
{ | ||
"name": "@google-cloud/functions-framework", | ||
"version": "3.1.3", | ||
"version": "3.2.0", | ||
"description": "FaaS (Function as a service) framework for writing portable Node.js functions", | ||
@@ -22,3 +22,3 @@ "engines": { | ||
"dependencies": { | ||
"@types/express": "4.17.13", | ||
"@types/express": "4.17.17", | ||
"body-parser": "^1.18.3", | ||
@@ -59,15 +59,15 @@ "cloudevents": "^6.0.0", | ||
"@types/minimist": "1.2.2", | ||
"@types/mocha": "9.0.0", | ||
"@types/node": "14.18.11", | ||
"@types/mocha": "9.1.1", | ||
"@types/node": "14.18.37", | ||
"@types/on-finished": "2.3.1", | ||
"@types/semver": "^7.3.6", | ||
"@types/sinon": "^10.0.0", | ||
"@types/supertest": "2.0.11", | ||
"gts": "3.1.0", | ||
"mocha": "9.1.2", | ||
"@types/supertest": "2.0.12", | ||
"gts": "3.1.1", | ||
"mocha": "9.2.2", | ||
"pack-n-play": "^1.0.0-2", | ||
"sinon": "^14.0.0", | ||
"supertest": "6.1.6", | ||
"typescript": "4.5.4" | ||
"sinon": "^15.0.0", | ||
"supertest": "6.3.3", | ||
"typescript": "4.9.5" | ||
} | ||
} |
@@ -90,5 +90,7 @@ # Functions Framework for Node.js | ||
```js | ||
exports.helloWorld = (req, res) => { | ||
const functions = require('@google-cloud/functions-framework'); | ||
functions.http('helloWorld', (req, res) => { | ||
res.send('Hello, World'); | ||
}; | ||
}); | ||
``` | ||
@@ -95,0 +97,0 @@ |
261
101828
1970
+ Added@babel/code-frame@7.24.2(transitive)
+ Added@babel/helper-validator-identifier@7.24.5(transitive)
+ Added@babel/highlight@7.24.5(transitive)
+ Added@types/express@4.17.17(transitive)
+ Added@types/express-serve-static-core@4.19.0(transitive)
+ Addedspdx-license-ids@3.0.17(transitive)
- Removed@babel/code-frame@7.24.6(transitive)
- Removed@babel/helper-validator-identifier@7.24.6(transitive)
- Removed@babel/highlight@7.24.6(transitive)
- Removed@types/express@4.17.13(transitive)
- Removed@types/express-serve-static-core@4.19.1(transitive)
- Removedspdx-license-ids@3.0.18(transitive)
Updated@types/express@4.17.17