@nxtedition/lib 23.3.29 → 23.3.31
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/logger.d.ts +2 -2
- package/package.json +15 -16
- package/time.js +16 -4
- package/util/template/index.d.ts +43 -0
package/logger.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.31",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"singleQuote": true
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aws-sdk/client-s3": "^3.
|
|
65
|
+
"@aws-sdk/client-s3": "^3.796.0",
|
|
66
66
|
"@elastic/elasticsearch": "^8.17.1",
|
|
67
67
|
"@elastic/transport": "^8.9.3",
|
|
68
|
-
"@nxtedition/nxt-undici": "^6.
|
|
68
|
+
"@nxtedition/nxt-undici": "^6.3.4",
|
|
69
69
|
"@smithy/node-http-handler": "^4.0.4",
|
|
70
|
-
"@swc/wasm-web": "^1.11.
|
|
70
|
+
"@swc/wasm-web": "^1.11.22",
|
|
71
71
|
"date-fns": "^4.1.0",
|
|
72
72
|
"diff": "5.2.0",
|
|
73
73
|
"fast-querystring": "^1.1.1",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"json5": "^2.2.3",
|
|
77
77
|
"koa-compose": "^4.1.0",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
79
|
-
"lru-cache": "^11.0
|
|
80
|
-
"mime": "^4.0.
|
|
79
|
+
"lru-cache": "^11.1.0",
|
|
80
|
+
"mime": "^4.0.7",
|
|
81
81
|
"mitata": "^1.0.34",
|
|
82
|
-
"moment-timezone": "^0.5.
|
|
82
|
+
"moment-timezone": "^0.5.48",
|
|
83
83
|
"nconf": "^0.12.1",
|
|
84
84
|
"nested-error-stacks": "^2.1.1",
|
|
85
85
|
"object-hash": "^3.0.0",
|
|
@@ -91,28 +91,27 @@
|
|
|
91
91
|
"split-string": "^6.0.0",
|
|
92
92
|
"url-join": "^5.0.0",
|
|
93
93
|
"xuid": "^4.1.5",
|
|
94
|
-
"yocto-queue": "^1.2.
|
|
94
|
+
"yocto-queue": "^1.2.1"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@nxtedition/deepstream.io-client-js": ">=28.1.
|
|
98
|
-
"@types/diff": "^5.0.9",
|
|
97
|
+
"@nxtedition/deepstream.io-client-js": ">=28.1.15",
|
|
99
98
|
"@types/lodash": "^4.17.16",
|
|
100
|
-
"@types/node": "^22.
|
|
101
|
-
"eslint": "^9.
|
|
102
|
-
"eslint-config-prettier": "^10.1.
|
|
99
|
+
"@types/node": "^22.15.1",
|
|
100
|
+
"eslint": "^9.25.1",
|
|
101
|
+
"eslint-config-prettier": "^10.1.2",
|
|
103
102
|
"eslint-config-standard": "^17.0.0",
|
|
104
103
|
"eslint-plugin-import": "^2.31.0",
|
|
105
|
-
"eslint-plugin-n": "^17.
|
|
104
|
+
"eslint-plugin-n": "^17.17.0",
|
|
106
105
|
"eslint-plugin-node": "^11.1.0",
|
|
107
106
|
"eslint-plugin-promise": "^7.2.1",
|
|
108
107
|
"husky": "^9.1.7",
|
|
109
|
-
"lint-staged": "^15.
|
|
108
|
+
"lint-staged": "^15.5.1",
|
|
110
109
|
"pinst": "^3.0.0",
|
|
111
110
|
"prettier": "^3.5.3",
|
|
112
111
|
"rxjs": "^7.8.2",
|
|
113
112
|
"send": "^1.1.0",
|
|
114
113
|
"tap": "^21.1.0",
|
|
115
|
-
"typescript-eslint": "^8.
|
|
114
|
+
"typescript-eslint": "^8.31.0"
|
|
116
115
|
},
|
|
117
116
|
"peerDependencies": {
|
|
118
117
|
"@elastic/elasticsearch": "^8.6.0",
|
package/time.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
export function isTimeBetween(date, startTime, endTime) {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export function isTimeBetween(date, startTime, endTime, isUTC) {
|
|
2
|
+
let currentHours = date.getHours()
|
|
3
|
+
let currentMinutes = date.getMinutes()
|
|
4
|
+
|
|
5
|
+
if (isUTC) {
|
|
6
|
+
currentHours = date.getUTCHours()
|
|
7
|
+
currentMinutes = date.getUTCMinutes()
|
|
8
|
+
} else {
|
|
9
|
+
// Convert local time to UTC equivalent
|
|
10
|
+
const utcDate = new Date(date.getTime() + date.getTimezoneOffset() * 60000)
|
|
11
|
+
currentHours = utcDate.getUTCHours()
|
|
12
|
+
currentMinutes = utcDate.getUTCMinutes()
|
|
13
|
+
}
|
|
4
14
|
|
|
5
15
|
// Validate and parse start and end times
|
|
6
16
|
if (!startTime) startTime = '00:00' // Default start at midnight
|
|
@@ -49,7 +59,9 @@ export function getUTCRangeForLocalTime(range) {
|
|
|
49
59
|
// Validate input format (hh:mm-hh:mm)
|
|
50
60
|
const timeFormat = /^\d{2}:\d{2}-\d{2}:\d{2}$/
|
|
51
61
|
if (!timeFormat.test(range)) {
|
|
52
|
-
throw new Error("Invalid format. Use 'hh:mm-hh:mm' (e.g., '01:00-05:00').")
|
|
62
|
+
throw Object.assign(new Error("Invalid format. Use 'hh:mm-hh:mm' (e.g., '01:00-05:00')."), {
|
|
63
|
+
data: range,
|
|
64
|
+
})
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
const [startTime, endTime] = range.split('-')
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { FirstValueFromConfig } from 'rxjs/internal/firstValueFrom'
|
|
2
|
+
import type * as rx from 'rxjs'
|
|
3
|
+
|
|
4
|
+
export function makeTemplateCompiler(params: MakeTemplateCompilerParams): TemplateCompiler
|
|
5
|
+
|
|
6
|
+
export interface TemplateCompiler {
|
|
7
|
+
current: null
|
|
8
|
+
|
|
9
|
+
resolveTemplate<ReturnValue, Context>(
|
|
10
|
+
template: Nxtpression<ReturnValue, Context> | string,
|
|
11
|
+
args$?: Context | rx.Observable<Context>,
|
|
12
|
+
options?: FirstValueFromConfig,
|
|
13
|
+
): Promise<ReturnValue>
|
|
14
|
+
|
|
15
|
+
onResolveTemplate<ReturnValue, Context>(
|
|
16
|
+
template: Nxtpression<ReturnValue, Context> | string,
|
|
17
|
+
args$?: Context | rx.Observable<Context>,
|
|
18
|
+
): rx.Observable<ReturnValue>
|
|
19
|
+
|
|
20
|
+
compileTemplate<ReturnValue, Context>(
|
|
21
|
+
template: Nxtpression<ReturnValue, Context> | string,
|
|
22
|
+
): null | ((args$?: Context | rx.Observable<Context>) => rx.Observable<ReturnValue>)
|
|
23
|
+
|
|
24
|
+
isTemplate(value: unknown): value is Nxtpression
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type Nxtpression<ReturnValue = string, Context extends object = object> =
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
|
|
29
|
+
| (String & {
|
|
30
|
+
/**
|
|
31
|
+
* TS-HACK: this property doesn't really exist on the nxtpression string,
|
|
32
|
+
* it is only here to make sure the generic Context won't get stripped.
|
|
33
|
+
*/
|
|
34
|
+
__context: Context
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* TS-HACK: this property doesn't really exist on the nxtpression string,
|
|
38
|
+
* it is only here to make sure the generic Context won't get stripped.
|
|
39
|
+
*/
|
|
40
|
+
__returnValue: ReturnValue
|
|
41
|
+
})
|
|
42
|
+
| string
|
|
43
|
+
| ReturnValue
|