busroot-sdk 0.0.7 → 0.0.8-dev.2691268423
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 +278 -0
- package/build/index.d.ts +5748 -5
- package/build/index.js +9463 -17
- package/package.json +24 -18
- package/build/client.d.ts +0 -99
- package/build/client.d.ts.map +0 -1
- package/build/client.js +0 -234
- package/build/client.test.d.ts +0 -2
- package/build/client.test.d.ts.map +0 -1
- package/build/client.test.js +0 -6
- package/build/hooks.d.ts +0 -8
- package/build/hooks.d.ts.map +0 -1
- package/build/hooks.js +0 -45
- package/build/index.d.ts.map +0 -1
- package/build/types.d.ts +0 -3145
- package/build/types.d.ts.map +0 -1
- package/build/types.js +0 -796
- package/build/utils.d.ts +0 -3
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js +0 -50
package/build/utils.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const formattedDuration: (millis?: number, roundTo?: "millis" | "seconds" | "minutes", isShort?: boolean) => string;
|
|
2
|
-
export declare function formattedDateTime(input?: string, timezone?: string, includeFromNow?: boolean): string | undefined;
|
|
3
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/build/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,EAAE,UAAS,QAAQ,GAAG,SAAS,GAAG,SAAqB,EAAE,UAAS,OAAe,WAsCjI,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,SAAkB,EAAE,cAAc,UAAQ,sBAgBnG"}
|
package/build/utils.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.formattedDuration = void 0;
|
|
7
|
-
exports.formattedDateTime = formattedDateTime;
|
|
8
|
-
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
|
-
const formattedDuration = (millis, roundTo = "seconds", isShort = false) => {
|
|
10
|
-
if (!millis) {
|
|
11
|
-
return "0sec";
|
|
12
|
-
}
|
|
13
|
-
const duration = moment_timezone_1.default.duration(millis);
|
|
14
|
-
let durationString = "";
|
|
15
|
-
if (duration.years() > 0) {
|
|
16
|
-
durationString += duration.years() + (isShort ? "Y " : "yr ");
|
|
17
|
-
}
|
|
18
|
-
if (duration.months() > 0) {
|
|
19
|
-
durationString += duration.months() + (isShort ? "M " : "mth ");
|
|
20
|
-
}
|
|
21
|
-
if (duration.days() > 0) {
|
|
22
|
-
durationString += duration.days() + (isShort ? "D " : "d ");
|
|
23
|
-
}
|
|
24
|
-
if (duration.hours() > 0) {
|
|
25
|
-
durationString += duration.hours() + (isShort ? "H " : "hr ");
|
|
26
|
-
}
|
|
27
|
-
if (duration.minutes() > 0) {
|
|
28
|
-
durationString += duration.minutes() + (isShort ? "m " : "min ");
|
|
29
|
-
}
|
|
30
|
-
if ((roundTo === "seconds" || roundTo === "millis") && duration.seconds() > 0) {
|
|
31
|
-
durationString += duration.seconds() + (isShort ? "s " : "sec ");
|
|
32
|
-
}
|
|
33
|
-
if (roundTo === "millis" && duration.milliseconds() > 0) {
|
|
34
|
-
durationString += duration.milliseconds() + (isShort ? "ms " : "ms ");
|
|
35
|
-
}
|
|
36
|
-
return durationString.trim();
|
|
37
|
-
};
|
|
38
|
-
exports.formattedDuration = formattedDuration;
|
|
39
|
-
function formattedDateTime(input, timezone = "Europe/London", includeFromNow = false) {
|
|
40
|
-
if (input == null) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
const inputMoment = moment_timezone_1.default.utc(input).tz(timezone);
|
|
44
|
-
const dateTimeString = inputMoment.format("HH:mm | DD-MM-YYYY");
|
|
45
|
-
if (includeFromNow) {
|
|
46
|
-
const diff = inputMoment.diff((0, moment_timezone_1.default)()).valueOf();
|
|
47
|
-
return dateTimeString + " (in " + (0, exports.formattedDuration)(diff, "minutes") + ")";
|
|
48
|
-
}
|
|
49
|
-
return dateTimeString;
|
|
50
|
-
}
|