@flowerforce/flowerbase 1.8.4-beta.5 → 1.8.4-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/providers/custom-function/controller.d.ts.map +1 -1
- package/dist/auth/providers/custom-function/controller.js +2 -1
- package/dist/cli/call-function.js +2 -1
- package/dist/features/functions/controller.d.ts.map +1 -1
- package/dist/features/functions/controller.js +2 -1
- package/dist/utils/context/helpers.d.ts +11 -8
- package/dist/utils/context/helpers.d.ts.map +1 -1
- package/dist/utils/context/helpers.js +19 -2
- package/dist/utils/context/interface.d.ts +1 -1
- package/dist/utils/context/interface.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/auth/providers/custom-function/controller.ts +2 -1
- package/src/cli/call-function.ts +2 -1
- package/src/features/functions/controller.ts +2 -1
- package/src/utils/context/helpers.ts +18 -2
- package/src/utils/context/interface.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../src/auth/providers/custom-function/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAUzC;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../src/auth/providers/custom-function/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAUzC;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,eAAe,iBA2IlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/features/functions/controller.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAKvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AA0IhD,eAAO,MAAM,iCAAiC,GAAI,OAAO,OAAO,KAAG,OA0BlE,CAAA;AAID,eAAO,MAAM,6BAA6B,GAAI,OAAO,OAAO,KAAG,OAgD9D,CAAA;AAqHD,eAAO,MAAM,oCAAoC,GAAI,QAAQ,QAAQ,YAClC,CAAA;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/features/functions/controller.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAKvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AA0IhD,eAAO,MAAM,iCAAiC,GAAI,OAAO,OAAO,KAAG,OA0BlE,CAAA;AAID,eAAO,MAAM,6BAA6B,GAAI,OAAO,OAAO,KAAG,OAgD9D,CAAA;AAqHD,eAAO,MAAM,oCAAoC,GAAI,QAAQ,QAAQ,YAClC,CAAA;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,kBAuSjC,CAAA"}
|
|
@@ -356,7 +356,8 @@ const functionsController = (app_1, _a) => __awaiter(void 0, [app_1, _a], void 0
|
|
|
356
356
|
currentFunction,
|
|
357
357
|
functionName: String(method),
|
|
358
358
|
functionsList,
|
|
359
|
-
services: services_1.services
|
|
359
|
+
services: services_1.services,
|
|
360
|
+
request: req
|
|
360
361
|
});
|
|
361
362
|
const normalizedResult = yield normalizeFunctionResult(result);
|
|
362
363
|
if (isReturnedError(normalizedResult)) {
|
|
@@ -33,14 +33,17 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
33
33
|
};
|
|
34
34
|
context: {
|
|
35
35
|
request: {
|
|
36
|
-
remoteIPAddress: string
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
remoteIPAddress: string;
|
|
37
|
+
requestHeaders: {
|
|
38
|
+
[k: string]: string[];
|
|
39
|
+
};
|
|
40
|
+
webhookUrl: string | undefined;
|
|
41
|
+
httpMethod: string | undefined;
|
|
42
|
+
rawQueryString: string;
|
|
43
|
+
httpReferrer: string | undefined;
|
|
44
|
+
httpUserAgent: string | undefined;
|
|
45
|
+
service: string;
|
|
46
|
+
action: string;
|
|
44
47
|
};
|
|
45
48
|
user: unknown;
|
|
46
49
|
environment: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/context/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAEvD,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,CACN,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACzC,MAAM,CAAA;IACX,MAAM,EAAE,CACN,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,YAAY,CAAC,EAAE,OAAO,EACtB,sBAAsB,CAAC,EAAE,MAAM,EAAE,KAC9B,OAAO,CAAA;CACb,CAAA;AAgFD;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAAI,4GAUjC,yBAAyB;;;;;;;;;;;;;uBA4DP,SAAS;yBAGP,SAAS
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/context/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,yBAA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;;;;;;;;;;;;;;;;;;;;;;;;0BAsGT,CAAC;6BAAa,CAAC;;;;;;;;;;;;;;;4BAyFF,MAAM,OAAO,aAAa,WAAW,SAAS;;;CAkBrE,CAAA"}
|
|
@@ -109,7 +109,7 @@ const createJwtUtils = () => {
|
|
|
109
109
|
* @param functionsList -> the list of all functions
|
|
110
110
|
*/
|
|
111
111
|
const generateContextData = ({ user, services, app, rules, currentFunction, functionName, functionsList, GenerateContextSync, request }) => {
|
|
112
|
-
var _a;
|
|
112
|
+
var _a, _b, _c, _d, _e, _f;
|
|
113
113
|
const BSON = mongodb_1.mongodb.BSON;
|
|
114
114
|
const Binary = BSON === null || BSON === void 0 ? void 0 : BSON.Binary;
|
|
115
115
|
if (Binary && typeof Binary.fromBase64 !== 'function') {
|
|
@@ -160,7 +160,24 @@ const generateContextData = ({ user, services, app, rules, currentFunction, func
|
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
context: {
|
|
163
|
-
request:
|
|
163
|
+
request: {
|
|
164
|
+
remoteIPAddress: (_b = request === null || request === void 0 ? void 0 : request.ip) !== null && _b !== void 0 ? _b : '',
|
|
165
|
+
requestHeaders: (request === null || request === void 0 ? void 0 : request.headers)
|
|
166
|
+
? Object.fromEntries(Object.entries(request.headers).map(([key, value]) => [
|
|
167
|
+
key,
|
|
168
|
+
Array.isArray(value) ? value : value !== undefined ? [value] : []
|
|
169
|
+
]))
|
|
170
|
+
: {},
|
|
171
|
+
webhookUrl: (_c = request === null || request === void 0 ? void 0 : request.url) === null || _c === void 0 ? void 0 : _c.split('?')[0],
|
|
172
|
+
httpMethod: request === null || request === void 0 ? void 0 : request.method,
|
|
173
|
+
rawQueryString: ((_d = request === null || request === void 0 ? void 0 : request.url) === null || _d === void 0 ? void 0 : _d.includes('?'))
|
|
174
|
+
? request.url.substring(request.url.indexOf('?'))
|
|
175
|
+
: '',
|
|
176
|
+
httpReferrer: (_e = request === null || request === void 0 ? void 0 : request.headers) === null || _e === void 0 ? void 0 : _e.referer,
|
|
177
|
+
httpUserAgent: (_f = request === null || request === void 0 ? void 0 : request.headers) === null || _f === void 0 ? void 0 : _f['user-agent'],
|
|
178
|
+
service: '',
|
|
179
|
+
action: ''
|
|
180
|
+
},
|
|
164
181
|
user,
|
|
165
182
|
environment: {
|
|
166
183
|
tag: process.env.NODE_ENV
|
|
@@ -17,7 +17,7 @@ export interface GenerateContextParams {
|
|
|
17
17
|
enqueue?: boolean;
|
|
18
18
|
request?: ContextRequest;
|
|
19
19
|
}
|
|
20
|
-
type ContextRequest = Pick<FastifyRequest, "ips" | "host" | "hostname" | "url" | "method" | "ip" | "id">;
|
|
20
|
+
type ContextRequest = Pick<FastifyRequest, "ips" | "host" | "hostname" | "url" | "method" | "ip" | "id" | "headers">;
|
|
21
21
|
export interface GenerateContextDataParams extends Omit<GenerateContextParams, 'args'> {
|
|
22
22
|
GenerateContext: (params: GenerateContextParams) => Promise<unknown>;
|
|
23
23
|
GenerateContextSync: (params: GenerateContextParams) => unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../src/utils/context/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAEnD,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,eAAe,CAAA;IACpB,eAAe,EAAE,QAAQ,CAAA;IACzB,aAAa,EAAE,SAAS,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;IACV,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GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;AACpH,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACpF,eAAe,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACpE,mBAAmB,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAA;CAChE"}
|
package/package.json
CHANGED
package/src/cli/call-function.ts
CHANGED
|
@@ -441,7 +441,8 @@ export const functionsController: FunctionController = async (
|
|
|
441
441
|
currentFunction,
|
|
442
442
|
functionName: String(method),
|
|
443
443
|
functionsList,
|
|
444
|
-
services
|
|
444
|
+
services,
|
|
445
|
+
request: req
|
|
445
446
|
})
|
|
446
447
|
const normalizedResult = await normalizeFunctionResult(result)
|
|
447
448
|
if (isReturnedError(normalizedResult)) {
|
|
@@ -187,8 +187,24 @@ export const generateContextData = ({
|
|
|
187
187
|
},
|
|
188
188
|
context: {
|
|
189
189
|
request: {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
remoteIPAddress: request?.ip ?? '',
|
|
191
|
+
requestHeaders: request?.headers
|
|
192
|
+
? Object.fromEntries(
|
|
193
|
+
Object.entries(request.headers).map(([key, value]) => [
|
|
194
|
+
key,
|
|
195
|
+
Array.isArray(value) ? value : value !== undefined ? [value] : []
|
|
196
|
+
])
|
|
197
|
+
)
|
|
198
|
+
: {},
|
|
199
|
+
webhookUrl: request?.url?.split('?')[0],
|
|
200
|
+
httpMethod: request?.method,
|
|
201
|
+
rawQueryString: request?.url?.includes('?')
|
|
202
|
+
? request.url.substring(request.url.indexOf('?'))
|
|
203
|
+
: '',
|
|
204
|
+
httpReferrer: request?.headers?.referer as string | undefined,
|
|
205
|
+
httpUserAgent: request?.headers?.['user-agent'] as string | undefined,
|
|
206
|
+
service: '',
|
|
207
|
+
action: ''
|
|
192
208
|
},
|
|
193
209
|
user,
|
|
194
210
|
environment: {
|
|
@@ -19,7 +19,7 @@ export interface GenerateContextParams {
|
|
|
19
19
|
request?: ContextRequest
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
type ContextRequest = Pick<FastifyRequest, "ips" | "host" | "hostname" | "url" | "method" | "ip" | "id">
|
|
22
|
+
type ContextRequest = Pick<FastifyRequest, "ips" | "host" | "hostname" | "url" | "method" | "ip" | "id" | "headers">
|
|
23
23
|
export interface GenerateContextDataParams extends Omit<GenerateContextParams, 'args'> {
|
|
24
24
|
GenerateContext: (params: GenerateContextParams) => Promise<unknown>
|
|
25
25
|
GenerateContextSync: (params: GenerateContextParams) => unknown
|