@flowerforce/flowerbase 1.0.3-beta.7 → 1.1.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,85 @@
1
+ ## 1.1.0 (2025-09-12)
2
+
3
+
4
+ ### 🚀 Features
5
+
6
+ - add demo ([c189d22](https://github.com/flowerforce/flowerbase/commit/c189d22))
7
+
8
+ - add destroy session ([f319319](https://github.com/flowerforce/flowerbase/commit/f319319))
9
+
10
+ - add release pipeline ([a7bb80a](https://github.com/flowerforce/flowerbase/commit/a7bb80a))
11
+
12
+ - add auto trigger on_user_creation_function_name from auth config ([b1c538d](https://github.com/flowerforce/flowerbase/commit/b1c538d))
13
+
14
+ - add swagger ui ([73ae560](https://github.com/flowerforce/flowerbase/commit/73ae560))
15
+
16
+ - add prefilter in aggregate method ([cdcb5a6](https://github.com/flowerforce/flowerbase/commit/cdcb5a6))
17
+
18
+ - add filter match on aggregate ([63d45ad](https://github.com/flowerforce/flowerbase/commit/63d45ad))
19
+
20
+ - update flowerbase package ([bffe6d5](https://github.com/flowerforce/flowerbase/commit/bffe6d5))
21
+
22
+ - add S3 config from envs ([dd88dee](https://github.com/flowerforce/flowerbase/commit/dd88dee))
23
+
24
+ - add pipeline on aggregate controller ([b15490d](https://github.com/flowerforce/flowerbase/commit/b15490d))
25
+
26
+ - add custom run as a system ([b5eb2b9](https://github.com/flowerforce/flowerbase/commit/b5eb2b9))
27
+
28
+ - add handleUserRegistration and create new auth method inside services ([6a963bf](https://github.com/flowerforce/flowerbase/commit/6a963bf))
29
+
30
+ - add FunctionsQueue to handle sequential function calls ([e2ac00e](https://github.com/flowerforce/flowerbase/commit/e2ac00e))
31
+
32
+ - adding body to POST http endpoint ([c016cd1](https://github.com/flowerforce/flowerbase/commit/c016cd1))
33
+
34
+ - add custom function provider ([f4d4ee4](https://github.com/flowerforce/flowerbase/commit/f4d4ee4))
35
+
36
+ - add block for aggregate from client ([d38af75](https://github.com/flowerforce/flowerbase/commit/d38af75))
37
+
38
+ - add handleuserregistration for custom function provider ([308c538](https://github.com/flowerforce/flowerbase/commit/308c538))
39
+
40
+ - add raw body ([94754cc](https://github.com/flowerforce/flowerbase/commit/94754cc))
41
+
42
+
43
+ ### 🩹 Fixes
44
+
45
+ - initial slash endpoints ([ca5ad27](https://github.com/flowerforce/flowerbase/commit/ca5ad27))
46
+
47
+ - fixed user object in on_user_creation_function_name ([031e1a5](https://github.com/flowerforce/flowerbase/commit/031e1a5))
48
+
49
+ - find http and https folder endpoints ([9d0cfbf](https://github.com/flowerforce/flowerbase/commit/9d0cfbf))
50
+
51
+ - remove only first slash ([80172ff](https://github.com/flowerforce/flowerbase/commit/80172ff))
52
+
53
+ - mongodb methods ([288e50d](https://github.com/flowerforce/flowerbase/commit/288e50d))
54
+
55
+ - trigger on user create ([4525fa1](https://github.com/flowerforce/flowerbase/commit/4525fa1))
56
+
57
+ - login user ([9e0bf35](https://github.com/flowerforce/flowerbase/commit/9e0bf35))
58
+
59
+ - on_user_creation_function_name ([45b1e59](https://github.com/flowerforce/flowerbase/commit/45b1e59))
60
+
61
+ - watch user create ([55cbc6b](https://github.com/flowerforce/flowerbase/commit/55cbc6b))
62
+
63
+ - WIP expandQuery ([09a0dca](https://github.com/flowerforce/flowerbase/commit/09a0dca))
64
+
65
+ - Add checks for possible undefined variables to ensure safe operations ([9fab6f2](https://github.com/flowerforce/flowerbase/commit/9fab6f2))
66
+
67
+ - **evaluateComplexExpression:** add rules from StateManager ([4fe7268](https://github.com/flowerforce/flowerbase/commit/4fe7268))
68
+
69
+ - **jwtAuthentication:** ensure correct _id handling in user_data ([5c9d2ff](https://github.com/flowerforce/flowerbase/commit/5c9d2ff))
70
+
71
+ - **triggerHandlers:** add rules from stateManager and removed clusterTime from change obj to avoid BSON error ([994dab0](https://github.com/flowerforce/flowerbase/commit/994dab0))
72
+
73
+ - **getValidRule:** add '%%true': true in checkRule context to satisfy record condition ([e29ebaf](https://github.com/flowerforce/flowerbase/commit/e29ebaf))
74
+
75
+ - **localUserPassController:** fix user login add userWithCustomData ([98732a1](https://github.com/flowerforce/flowerbase/commit/98732a1))
76
+
77
+ - **getOperators:** ensure the corret value for the $match key to resolve error: "the match filter must be an expression in an object" ([097e666](https://github.com/flowerforce/flowerbase/commit/097e666))
78
+
79
+ - **getFormattedQuery:** exclude empty object from getFormattedQuery ([a35eab7](https://github.com/flowerforce/flowerbase/commit/a35eab7))
80
+
81
+ - **localUserPassController:** renamed storedUser to authUser ([3f6f040](https://github.com/flowerforce/flowerbase/commit/3f6f040))
82
+
1
83
  ## 1.0.2 (2025-06-30)
2
84
 
3
85
 
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/features/endpoints/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKvE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE9D;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAU,gBAAuB,KAAG,OAAO,CAAC,SAAS,CAmB9E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,eAAe,EACpB,SAAS,UAAU,CAAC,OAAO,eAAe,CAAC,EAC3C,UAAU,MAAM;;;;;;;CAQhB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,oDAK7B,qBAAqB,MACR,KAAK,cAAc,EAAE,KAAK,YAAY,gBA2CrD,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/features/endpoints/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKvE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAE9D;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAU,gBAAuB,KAAG,OAAO,CAAC,SAAS,CAmB9E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,eAAe,EACpB,SAAS,UAAU,CAAC,OAAO,eAAe,CAAC,EAC3C,UAAU,MAAM;;;;;;;CAgChB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,oDAK7B,qBAAqB,MACR,KAAK,cAAc,EAAE,KAAK,YAAY,gBA4CrD,CAAA"}
@@ -57,12 +57,36 @@ exports.loadEndpoints = loadEndpoints;
57
57
  * @param endpoint -> the current endpoint
58
58
  */
59
59
  const getMethodsConfig = (app, handler, endpoint) => ({
60
- ALL: () => app.all(endpoint, handler),
61
- GET: () => app.get(endpoint, handler),
62
- POST: () => app.post(endpoint, handler),
63
- PUT: () => app.put(endpoint, handler),
64
- PATCH: () => app.patch(endpoint, handler),
65
- DELETE: () => app.delete(endpoint, handler)
60
+ ALL: () => app.all(endpoint, {
61
+ config: {
62
+ rawBody: true
63
+ },
64
+ }, handler),
65
+ GET: () => app.get(endpoint, {
66
+ config: {
67
+ rawBody: true
68
+ },
69
+ }, handler),
70
+ POST: () => app.post(endpoint, {
71
+ config: {
72
+ rawBody: true
73
+ },
74
+ }, handler),
75
+ PUT: () => app.put(endpoint, {
76
+ config: {
77
+ rawBody: true
78
+ },
79
+ }, handler),
80
+ PATCH: () => app.patch(endpoint, {
81
+ config: {
82
+ rawBody: true
83
+ },
84
+ }, handler),
85
+ DELETE: () => app.delete(endpoint, {
86
+ config: {
87
+ rawBody: true
88
+ },
89
+ }, handler)
66
90
  });
67
91
  exports.getMethodsConfig = getMethodsConfig;
68
92
  /**
@@ -75,9 +99,10 @@ exports.getMethodsConfig = getMethodsConfig;
75
99
  const generateHandler = ({ app, currentFunction, functionsList, rulesList }) => {
76
100
  return (req, res) => __awaiter(void 0, void 0, void 0, function* () {
77
101
  var _a;
78
- const { body: originalBody, headers, query } = req;
102
+ const { body: originalBody, headers, query, rawBody } = req;
79
103
  const customBody = {
80
- text: () => JSON.stringify(originalBody)
104
+ text: () => JSON.stringify(originalBody),
105
+ rawBody
81
106
  };
82
107
  const customResponseBody = {
83
108
  data: null
@@ -1 +1 @@
1
- {"version":3,"file":"registerPlugins.d.ts","sourceRoot":"","sources":["../../../src/utils/initializer/registerPlugins.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMzC,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AAE9D,KAAK,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;AAGnD,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,SAAS,CAAA;CACzB,CAAA;AAQD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAU,oDAKnC,qBAAqB,kBAoBvB,CAAA"}
1
+ {"version":3,"file":"registerPlugins.d.ts","sourceRoot":"","sources":["../../../src/utils/initializer/registerPlugins.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAOzC,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AAE9D,KAAK,gBAAgB,GAAG,eAAe,CAAC,UAAU,CAAC,CAAA;AAGnD,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,SAAS,CAAA;CACzB,CAAA;AAQD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAU,oDAKnC,qBAAqB,kBAoBvB,CAAA"}
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.registerPlugins = void 0;
16
16
  const cors_1 = __importDefault(require("@fastify/cors"));
17
17
  const mongodb_1 = __importDefault(require("@fastify/mongodb"));
18
+ const fastify_raw_body_1 = __importDefault(require("fastify-raw-body"));
18
19
  const controller_1 = require("../../auth/controller");
19
20
  const jwt_1 = __importDefault(require("../../auth/plugins/jwt"));
20
21
  const controller_2 = require("../../auth/providers/custom-function/controller");
@@ -81,6 +82,18 @@ const getRegisterConfig = (_a) => __awaiter(void 0, [_a], void 0, function* ({ m
81
82
  secret: jwtSecret
82
83
  }
83
84
  },
85
+ {
86
+ pluginName: 'fastifyRawBody',
87
+ plugin: fastify_raw_body_1.default,
88
+ options: {
89
+ field: 'rawBody',
90
+ global: false,
91
+ encoding: 'utf8',
92
+ runFirst: true,
93
+ routes: [],
94
+ jsonContentTypes: [],
95
+ }
96
+ },
84
97
  {
85
98
  pluginName: 'authController',
86
99
  plugin: controller_1.authController,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowerforce/flowerbase",
3
- "version": "1.0.3-beta.7",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,6 +32,7 @@
32
32
  "fastify": "^5.0.0",
33
33
  "fastify-mongoose-driver": "^3.2.0",
34
34
  "fastify-plugin": "^5.0.1",
35
+ "fastify-raw-body": "^5.0.0",
35
36
  "lodash": "^4.17.21",
36
37
  "node-cron": "^3.0.3",
37
38
  "nodemon": "^3.1.7",
@@ -44,12 +44,36 @@ export const getMethodsConfig = (
44
44
  handler: ReturnType<typeof generateHandler>,
45
45
  endpoint: string
46
46
  ) => ({
47
- ALL: () => app.all(endpoint, handler),
48
- GET: () => app.get(endpoint, handler),
49
- POST: () => app.post(endpoint, handler),
50
- PUT: () => app.put(endpoint, handler),
51
- PATCH: () => app.patch(endpoint, handler),
52
- DELETE: () => app.delete(endpoint, handler)
47
+ ALL: () => app.all(endpoint, {
48
+ config: {
49
+ rawBody: true
50
+ },
51
+ }, handler),
52
+ GET: () => app.get(endpoint, {
53
+ config: {
54
+ rawBody: true
55
+ },
56
+ }, handler),
57
+ POST: () => app.post(endpoint, {
58
+ config: {
59
+ rawBody: true
60
+ },
61
+ }, handler),
62
+ PUT: () => app.put(endpoint, {
63
+ config: {
64
+ rawBody: true
65
+ },
66
+ }, handler),
67
+ PATCH: () => app.patch(endpoint, {
68
+ config: {
69
+ rawBody: true
70
+ },
71
+ }, handler),
72
+ DELETE: () => app.delete(endpoint, {
73
+ config: {
74
+ rawBody: true
75
+ },
76
+ }, handler)
53
77
  })
54
78
 
55
79
  /**
@@ -66,10 +90,11 @@ export const generateHandler = ({
66
90
  rulesList
67
91
  }: GenerateHandlerParams) => {
68
92
  return async (req: FastifyRequest, res: FastifyReply) => {
69
- const { body: originalBody, headers, query } = req
93
+ const { body: originalBody, headers, query, rawBody } = req
70
94
 
71
95
  const customBody = {
72
- text: () => JSON.stringify(originalBody)
96
+ text: () => JSON.stringify(originalBody),
97
+ rawBody
73
98
  }
74
99
 
75
100
  const customResponseBody: {
@@ -1,6 +1,7 @@
1
1
  import cors from '@fastify/cors'
2
2
  import fastifyMongodb from '@fastify/mongodb'
3
3
  import { FastifyInstance } from 'fastify'
4
+ import fastifyRawBody from 'fastify-raw-body'
4
5
  import { authController } from '../../auth/controller'
5
6
  import jwtAuthPlugin from '../../auth/plugins/jwt'
6
7
  import { customFunctionController } from '../../auth/providers/custom-function/controller'
@@ -94,6 +95,18 @@ const getRegisterConfig = async ({
94
95
  secret: jwtSecret
95
96
  }
96
97
  },
98
+ {
99
+ pluginName: 'fastifyRawBody',
100
+ plugin: fastifyRawBody,
101
+ options: {
102
+ field: 'rawBody',
103
+ global: false,
104
+ encoding: 'utf8',
105
+ runFirst: true,
106
+ routes: [],
107
+ jsonContentTypes: [],
108
+ }
109
+ },
97
110
  {
98
111
  pluginName: 'authController',
99
112
  plugin: authController,