@dnax/core 0.8.3 → 0.8.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/lib/collection.ts +35 -17
- package/package.json +3 -2
- package/utils/index.ts +2 -0
package/lib/collection.ts
CHANGED
|
@@ -91,7 +91,12 @@ async function syncCollectionDatabase() {
|
|
|
91
91
|
await t.database.db?.createCollection(c.slug);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
var allIndexes = await t.database.db
|
|
94
|
+
var allIndexes = await t.database.db
|
|
95
|
+
?.collection(c.slug)
|
|
96
|
+
.indexes()
|
|
97
|
+
.catch((err) => {
|
|
98
|
+
console.error(err?.message);
|
|
99
|
+
});
|
|
95
100
|
|
|
96
101
|
// console.log('Allindex',allIndexes)
|
|
97
102
|
|
|
@@ -112,7 +117,10 @@ async function syncCollectionDatabase() {
|
|
|
112
117
|
if (!findexIndexKey)
|
|
113
118
|
await t.database.db
|
|
114
119
|
?.collection(c?.slug)
|
|
115
|
-
.dropIndex(dbIndex?.name as string)
|
|
120
|
+
.dropIndex(dbIndex?.name as string)
|
|
121
|
+
.catch((err) => {
|
|
122
|
+
console.error(err?.message);
|
|
123
|
+
});
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
//console.log(t.database.db);
|
|
@@ -120,7 +128,10 @@ async function syncCollectionDatabase() {
|
|
|
120
128
|
await t.database.db
|
|
121
129
|
?.collection(c.slug)
|
|
122
130
|
.createIndex(["createdAt", "updatedAt"])
|
|
123
|
-
.then((e) => {})
|
|
131
|
+
.then((e) => {})
|
|
132
|
+
.catch((err) => {
|
|
133
|
+
console.error(err?.message);
|
|
134
|
+
});
|
|
124
135
|
|
|
125
136
|
// 3- suppression des indexes
|
|
126
137
|
//
|
|
@@ -132,7 +143,9 @@ async function syncCollectionDatabase() {
|
|
|
132
143
|
.dropIndex({
|
|
133
144
|
[f.name]: 1,
|
|
134
145
|
})
|
|
135
|
-
.catch()
|
|
146
|
+
.catch((err) => {
|
|
147
|
+
console.error(err?.message);
|
|
148
|
+
});
|
|
136
149
|
}
|
|
137
150
|
});
|
|
138
151
|
|
|
@@ -176,19 +189,24 @@ async function syncCollectionDatabase() {
|
|
|
176
189
|
});
|
|
177
190
|
}
|
|
178
191
|
|
|
179
|
-
await t.database.db
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
await t.database.db
|
|
193
|
+
?.collection(c.slug)
|
|
194
|
+
.createIndex(
|
|
195
|
+
{
|
|
196
|
+
...omit(index, ["sparse", "unique", "expireAfterSeconds"]),
|
|
197
|
+
},
|
|
198
|
+
//@ts-expect-error
|
|
199
|
+
{
|
|
200
|
+
...cleanDeep({
|
|
201
|
+
unique: index?.unique || false,
|
|
202
|
+
sparse: index?.sparse || false,
|
|
203
|
+
expireAfterSeconds: index.expireAfterSeconds ?? null,
|
|
204
|
+
}),
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
.catch((err) => {
|
|
208
|
+
console.error(err?.message);
|
|
209
|
+
});
|
|
192
210
|
}
|
|
193
211
|
// Sortie de boule
|
|
194
212
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dnax/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@types/bun": "latest",
|
|
11
|
-
"@types/nodemailer": "^6.4.15"
|
|
11
|
+
"@types/nodemailer": "^6.4.15",
|
|
12
|
+
"@types/uuid": "^10.0.0"
|
|
12
13
|
},
|
|
13
14
|
"peerDependencies": {
|
|
14
15
|
"typescript": "^5.0.0"
|
package/utils/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import generateUniqueId from "generate-unique-id";
|
|
|
9
9
|
import dayjs from "dayjs";
|
|
10
10
|
import { Otp } from "../lib/opt";
|
|
11
11
|
import collect from "collect.js";
|
|
12
|
+
import * as uuid from "uuid";
|
|
12
13
|
import * as urlencode from "urlencode";
|
|
13
14
|
|
|
14
15
|
const JWT_SECRET = process?.env?.JWT_SECRET || "secret-libv";
|
|
@@ -294,6 +295,7 @@ const password = {
|
|
|
294
295
|
};
|
|
295
296
|
|
|
296
297
|
export {
|
|
298
|
+
uuid,
|
|
297
299
|
pick,
|
|
298
300
|
password, // Hash and verify Password utils
|
|
299
301
|
email, // smtp utils
|