@platformatic/globals 3.5.1 → 3.7.0
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/index.d.ts +20 -9
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type EventEmitter } from 'node:events'
|
|
|
3
3
|
import { type Level, type Logger } from 'pino'
|
|
4
4
|
import * as Client from 'prom-client'
|
|
5
5
|
|
|
6
|
-
type Optional<T> = T | undefined
|
|
6
|
+
type Optional<T> = T | undefined
|
|
7
7
|
|
|
8
8
|
export type Handler = ((data: any) => any) | ((data: any) => Promise<any>)
|
|
9
9
|
|
|
@@ -12,9 +12,23 @@ export interface InvalidateHttpCacheOptions {
|
|
|
12
12
|
tags?: string[]
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
// This is purposely a copy of the one in @platformatic/itc to avoid the dependency
|
|
16
|
+
export interface ITC {
|
|
17
|
+
send (message: string, data: any, options?: Record<string, any>): Promise<any>
|
|
18
|
+
notify (message: string, data: any, options?: Record<string, any>): void
|
|
19
|
+
handle (message: string, handler: Handler): void
|
|
20
|
+
getHandler (message: string): Handler | undefined
|
|
21
|
+
listen (): void
|
|
22
|
+
close (): void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface MessagingApi {
|
|
26
|
+
send (name: string, message: string, data: any, options?: Record<string, any>): Promise<any>
|
|
27
|
+
notify (name: string, message: string, data: any): void
|
|
28
|
+
handle (message: string, handler: Handler): void
|
|
29
|
+
}
|
|
17
30
|
|
|
31
|
+
export interface PlatformaticGlobalInterface {
|
|
18
32
|
// Runtime
|
|
19
33
|
isBuilding: boolean
|
|
20
34
|
executable: string
|
|
@@ -68,12 +82,9 @@ export interface PlatformaticGlobalInterface {
|
|
|
68
82
|
| Promise<{ status: boolean; statusCode?: number; body?: string }>
|
|
69
83
|
): void
|
|
70
84
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
handle (message: Record<string, Handler>): void
|
|
75
|
-
handle (message: string, handler: Handler): void
|
|
76
|
-
}
|
|
85
|
+
events: EventEmitter & { emitAndNotify: EventEmitter['emit'] }
|
|
86
|
+
itc: ITC
|
|
87
|
+
messaging: MessagingApi
|
|
77
88
|
}
|
|
78
89
|
|
|
79
90
|
export type PlatformaticGlobal = Optional<PlatformaticGlobalInterface>
|