@flowerforce/flowerbase 1.4.1-beta.3 → 1.4.1
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 +17 -0
- package/dist/features/triggers/utils.d.ts.map +1 -1
- package/dist/features/triggers/utils.js +5 -10
- package/dist/utils/initializer/exposeRoutes.js +1 -1
- package/package.json +1 -1
- package/src/features/triggers/utils.ts +0 -6
- package/src/utils/initializer/exposeRoutes.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 1.4.1 (2026-01-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### 🩹 Fixes
|
|
5
|
+
|
|
6
|
+
- add change on trigger auth ([9ab5a47](https://github.com/flowerforce/flowerbase/commit/9ab5a47))
|
|
7
|
+
|
|
8
|
+
- trigger auth ([f5b0835](https://github.com/flowerforce/flowerbase/commit/f5b0835))
|
|
9
|
+
|
|
10
|
+
- operationType auth trigger ([a349c1c](https://github.com/flowerforce/flowerbase/commit/a349c1c))
|
|
11
|
+
|
|
12
|
+
- trigger auth ([a018f24](https://github.com/flowerforce/flowerbase/commit/a018f24))
|
|
13
|
+
|
|
14
|
+
- location host in production ([f9fe84c](https://github.com/flowerforce/flowerbase/commit/f9fe84c))
|
|
15
|
+
|
|
16
|
+
- autoconfirm auth trigger ([88a6aea](https://github.com/flowerforce/flowerbase/commit/88a6aea))
|
|
17
|
+
|
|
1
18
|
## 1.4.0 (2026-01-15)
|
|
2
19
|
|
|
3
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/features/triggers/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAW,QAAQ,EAAE,MAAM,aAAa,CAAA;AAqC9D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAU,gBAAuB,KAAG,OAAO,CAAC,QAAQ,CAkB5E,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/features/triggers/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAW,QAAQ,EAAE,MAAM,aAAa,CAAA;AAqC9D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAU,gBAAuB,KAAG,OAAO,CAAC,QAAQ,CAkB5E,CAAA;AA8VD,eAAO,MAAM,gBAAgB;0EA1U1B,aAAa;yEAqRb,aAAa;+EA3Pb,aAAa;CAoTf,CAAA"}
|
|
@@ -122,10 +122,9 @@ const mapOpInverse = {
|
|
|
122
122
|
DELETE: ['delete'],
|
|
123
123
|
};
|
|
124
124
|
const handleAuthenticationTrigger = (_a) => __awaiter(void 0, [_a], void 0, function* ({ config, triggerHandler, functionsList, services, app }) {
|
|
125
|
-
var _b
|
|
125
|
+
var _b;
|
|
126
126
|
const { database, isAutoTrigger, operation_types, operation_type } = config;
|
|
127
|
-
const
|
|
128
|
-
const authCollection = (_c = constants_1.AUTH_CONFIG.authCollection) !== null && _c !== void 0 ? _c : 'auth_users';
|
|
127
|
+
const authCollection = (_b = constants_1.AUTH_CONFIG.authCollection) !== null && _b !== void 0 ? _b : 'auth_users';
|
|
129
128
|
const collection = app.mongo.client.db(database || constants_1.DB_NAME).collection(authCollection);
|
|
130
129
|
const pipeline = [
|
|
131
130
|
{
|
|
@@ -151,7 +150,7 @@ const handleAuthenticationTrigger = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
151
150
|
});
|
|
152
151
|
changeStream.on('change', function (change) {
|
|
153
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
var _a, _b
|
|
153
|
+
var _a, _b;
|
|
155
154
|
const operationType = change['operationType'];
|
|
156
155
|
const documentKey = change['documentKey'];
|
|
157
156
|
const fullDocument = change['fullDocument'];
|
|
@@ -159,9 +158,8 @@ const handleAuthenticationTrigger = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
159
158
|
if (!(documentKey === null || documentKey === void 0 ? void 0 : documentKey._id)) {
|
|
160
159
|
return;
|
|
161
160
|
}
|
|
162
|
-
const autoConfirm = ((_a = constants_1.AUTH_CONFIG.localUserpassConfig) === null || _a === void 0 ? void 0 : _a.autoConfirm) === true;
|
|
163
161
|
const updateDescription = change['updateDescription'];
|
|
164
|
-
const updatedStatus = (
|
|
162
|
+
const updatedStatus = (_a = updateDescription === null || updateDescription === void 0 ? void 0 : updateDescription.updatedFields) === null || _a === void 0 ? void 0 : _a.status;
|
|
165
163
|
const isInsert = operationType === 'insert';
|
|
166
164
|
const isUpdate = operationType === 'update';
|
|
167
165
|
const isReplace = operationType === 'replace';
|
|
@@ -267,9 +265,6 @@ const handleAuthenticationTrigger = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
267
265
|
else {
|
|
268
266
|
confirmedCandidate = (confirmedDocument === null || confirmedDocument === void 0 ? void 0 : confirmedDocument.status) === 'confirmed';
|
|
269
267
|
}
|
|
270
|
-
if (autoConfirm && isInsert) {
|
|
271
|
-
confirmedCandidate = true;
|
|
272
|
-
}
|
|
273
268
|
if (!confirmedCandidate) {
|
|
274
269
|
return;
|
|
275
270
|
}
|
|
@@ -284,7 +279,7 @@ const handleAuthenticationTrigger = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
284
279
|
}, {
|
|
285
280
|
returnDocument: 'after'
|
|
286
281
|
});
|
|
287
|
-
const document = (
|
|
282
|
+
const document = (_b = updateResult === null || updateResult === void 0 ? void 0 : updateResult.value) !== null && _b !== void 0 ? _b : confirmedDocument;
|
|
288
283
|
if (!document) {
|
|
289
284
|
return;
|
|
290
285
|
}
|
|
@@ -28,7 +28,7 @@ const exposeRoutes = (fastify) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
28
28
|
const headerHost = (_b = req.headers.host) !== null && _b !== void 0 ? _b : 'localhost:3000';
|
|
29
29
|
const hostname = headerHost.split(':')[0];
|
|
30
30
|
const port = (_c = constants_1.DEFAULT_CONFIG === null || constants_1.DEFAULT_CONFIG === void 0 ? void 0 : constants_1.DEFAULT_CONFIG.PORT) !== null && _c !== void 0 ? _c : 3000;
|
|
31
|
-
const host =
|
|
31
|
+
const host = process.env.NODE_ENV === "production" ? hostname : `${hostname}:${port}`;
|
|
32
32
|
const wsSchema = 'wss';
|
|
33
33
|
return {
|
|
34
34
|
deployment_model: 'LOCAL',
|
package/package.json
CHANGED
|
@@ -116,7 +116,6 @@ const handleAuthenticationTrigger = async ({
|
|
|
116
116
|
app
|
|
117
117
|
}: HandlerParams) => {
|
|
118
118
|
const { database, isAutoTrigger, operation_types, operation_type } = config
|
|
119
|
-
const autoConfirm = AUTH_CONFIG.localUserpassConfig?.autoConfirm === true
|
|
120
119
|
const authCollection = AUTH_CONFIG.authCollection ?? 'auth_users'
|
|
121
120
|
const collection = app.mongo.client.db(database || DB_NAME).collection(authCollection)
|
|
122
121
|
const pipeline = [
|
|
@@ -159,7 +158,6 @@ const handleAuthenticationTrigger = async ({
|
|
|
159
158
|
return
|
|
160
159
|
}
|
|
161
160
|
|
|
162
|
-
const autoConfirm = AUTH_CONFIG.localUserpassConfig?.autoConfirm === true
|
|
163
161
|
const updateDescription = change[
|
|
164
162
|
'updateDescription' as keyof typeof change
|
|
165
163
|
] as { updatedFields?: Record<string, unknown> } | undefined
|
|
@@ -278,10 +276,6 @@ const handleAuthenticationTrigger = async ({
|
|
|
278
276
|
confirmedCandidate = (confirmedDocument as { status?: string } | null)?.status === 'confirmed'
|
|
279
277
|
}
|
|
280
278
|
|
|
281
|
-
if (autoConfirm && isInsert) {
|
|
282
|
-
confirmedCandidate = true
|
|
283
|
-
}
|
|
284
|
-
|
|
285
279
|
if (!confirmedCandidate) {
|
|
286
280
|
return
|
|
287
281
|
}
|
|
@@ -18,7 +18,7 @@ export const exposeRoutes = async (fastify: FastifyInstance) => {
|
|
|
18
18
|
const headerHost = req.headers.host ?? 'localhost:3000'
|
|
19
19
|
const hostname = headerHost.split(':')[0]
|
|
20
20
|
const port = DEFAULT_CONFIG?.PORT ?? 3000
|
|
21
|
-
const host =
|
|
21
|
+
const host = process.env.NODE_ENV === "production" ? hostname : `${hostname}:${port}`
|
|
22
22
|
const wsSchema = 'wss'
|
|
23
23
|
|
|
24
24
|
return {
|