@bgord/bun 1.17.1 → 1.17.3
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/uptime.service.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uptime.service.d.ts","sourceRoot":"","sources":["../src/uptime.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAEzE,MAAM,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"uptime.service.d.ts","sourceRoot":"","sources":["../src/uptime.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAEzE,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB;CAM/C"}
|
package/dist/uptime.service.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as tools from "@bgord/tools";
|
|
2
2
|
export class Uptime {
|
|
3
3
|
static rounding = new tools.RoundingToNearestStrategy();
|
|
4
|
-
static get(
|
|
4
|
+
static get(Clock) {
|
|
5
|
+
const now = Clock.now();
|
|
5
6
|
const duration = tools.Duration.Seconds(Uptime.rounding.round(process.uptime()));
|
|
6
|
-
return { duration, formatted:
|
|
7
|
+
return { duration, formatted: tools.DateFormatter.relative(now, now.subtract(duration)) };
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=uptime.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uptime.service.js","sourceRoot":"","sources":["../src/uptime.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAKtC,MAAM,OAAO,MAAM;IACT,MAAM,CAAU,QAAQ,GAAG,IAAI,KAAK,CAAC,yBAAyB,EAAE,CAAC;IAEzE,MAAM,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"uptime.service.js","sourceRoot":"","sources":["../src/uptime.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAKtC,MAAM,OAAO,MAAM;IACT,MAAM,CAAU,QAAQ,GAAG,IAAI,KAAK,CAAC,yBAAyB,EAAE,CAAC;IAEzE,MAAM,CAAC,GAAG,CAAC,KAAgB;QACzB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAEjF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;IAC5F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/bun",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bartosz Gordon",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"yazl": "3.3.1"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@bgord/tools": "1.5.
|
|
49
|
+
"@bgord/tools": "1.5.2",
|
|
50
50
|
"emittery": "2.0.0",
|
|
51
51
|
"hono": "4.12.12",
|
|
52
52
|
"node-cache": "5.1.2"
|
package/src/uptime.service.ts
CHANGED
|
@@ -6,9 +6,10 @@ export type UptimeResultType = { duration: tools.Duration; formatted: string };
|
|
|
6
6
|
export class Uptime {
|
|
7
7
|
private static readonly rounding = new tools.RoundingToNearestStrategy();
|
|
8
8
|
|
|
9
|
-
static get(
|
|
9
|
+
static get(Clock: ClockPort): UptimeResultType {
|
|
10
|
+
const now = Clock.now();
|
|
10
11
|
const duration = tools.Duration.Seconds(Uptime.rounding.round(process.uptime()));
|
|
11
12
|
|
|
12
|
-
return { duration, formatted:
|
|
13
|
+
return { duration, formatted: tools.DateFormatter.relative(now, now.subtract(duration)) };
|
|
13
14
|
}
|
|
14
15
|
}
|