@tmlmobilidade/utils 20260302.1453.8 → 20260305.1852.13
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/README.md +4 -5
- package/dist/run-on-interval.d.ts +1 -1
- package/dist/run-on-interval.js +14 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A collection of utility functions and helpers for the TML Mobilidade Go monorepo, providing common functionality for batching operations, caching, HTTP requests, object manipulation, permissions, and more.
|
|
4
4
|
|
|
5
|
-
## Installation
|
|
5
|
+
## Installation 1
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @tmlmobilidade/utils
|
|
@@ -215,14 +215,14 @@ import { asyncSingletonProxy } from '@tmlmobilidade/utils';
|
|
|
215
215
|
|
|
216
216
|
class Database {
|
|
217
217
|
private static instance: Database | null = null;
|
|
218
|
-
|
|
218
|
+
|
|
219
219
|
static async getInstance(): Promise<Database> {
|
|
220
220
|
if (!this.instance) {
|
|
221
221
|
this.instance = await this.initialize();
|
|
222
222
|
}
|
|
223
223
|
return this.instance;
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
|
|
226
226
|
async query(sql: string) {
|
|
227
227
|
// ...
|
|
228
228
|
}
|
|
@@ -239,5 +239,4 @@ AGPL-3.0-or-later
|
|
|
239
239
|
|
|
240
240
|
## Repository
|
|
241
241
|
|
|
242
|
-
[GitHub](https://github.com/tmlmobilidade/go)
|
|
243
|
-
|
|
242
|
+
[GitHub](https://github.com/tmlmobilidade/go)
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Errors are caught and logged per-invocation — they do not halt scheduling.
|
|
4
4
|
* Each invocation is fire-and-forget after the first awaited call.
|
|
5
5
|
*/
|
|
6
|
-
export declare function runOnInterval(fn: () => Promise<void>, intervalMs: number):
|
|
6
|
+
export declare function runOnInterval(fn: () => Promise<void>, intervalMs: number): Promise<void>;
|
package/dist/run-on-interval.js
CHANGED
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
* Errors are caught and logged per-invocation — they do not halt scheduling.
|
|
4
4
|
* Each invocation is fire-and-forget after the first awaited call.
|
|
5
5
|
*/
|
|
6
|
-
export function runOnInterval(fn, intervalMs) {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
clearInterval(intervalId);
|
|
6
|
+
export async function runOnInterval(fn, intervalMs) {
|
|
7
|
+
//
|
|
8
|
+
const runner = async () => {
|
|
9
|
+
try {
|
|
10
|
+
await fn();
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
console.error('Error in runOnInterval:', error);
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
setTimeout(runner, intervalMs);
|
|
17
|
+
}
|
|
19
18
|
};
|
|
19
|
+
await runner();
|
|
20
|
+
//
|
|
20
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmlmobilidade/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20260305.1852.13",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "iso@tmlmobilidade.pt",
|
|
6
6
|
"name": "TML-ISO"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@tmlmobilidade/tsconfig": "*",
|
|
45
|
-
"@types/node": "25.3.
|
|
45
|
+
"@types/node": "25.3.3",
|
|
46
46
|
"resolve-tspaths": "0.8.23",
|
|
47
47
|
"tsc-watch": "7.2.0",
|
|
48
48
|
"typescript": "5.9.3"
|