@platformatic/globals 3.41.0 → 3.43.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.
Files changed (2) hide show
  1. package/lib/index.d.ts +7 -7
  2. package/package.json +6 -4
package/lib/index.d.ts CHANGED
@@ -3,8 +3,6 @@ import { type EventEmitter } from 'node:events'
3
3
  import { type Level, type Logger } from 'pino'
4
4
  import * as Client from '@platformatic/prom-client'
5
5
 
6
- type Optional<T> = T | undefined
7
-
8
6
  export type Handler = ((data: any) => any) | ((data: any) => Promise<any>)
9
7
 
10
8
  export interface InvalidateHttpCacheOptions {
@@ -28,7 +26,7 @@ export interface MessagingApi {
28
26
  handle (message: string, handler: Handler): void
29
27
  }
30
28
 
31
- export interface PlatformaticGlobalInterface {
29
+ export interface PlatformaticGlobal {
32
30
  // Runtime
33
31
  isBuilding: boolean
34
32
  executable: string
@@ -52,10 +50,10 @@ export interface PlatformaticGlobalInterface {
52
50
 
53
51
  // Metrics
54
52
  prometheus: {
55
- client: Client
53
+ client: typeof Client
56
54
  registry: Client.Registry
57
55
  }
58
- clientSpansAls: AsyncLocalStorage
56
+ clientSpansAls: InstanceType<typeof AsyncLocalStorage>
59
57
 
60
58
  // Caching
61
59
  onHttpCacheHit (key: string): void
@@ -87,6 +85,8 @@ export interface PlatformaticGlobalInterface {
87
85
  messaging: MessagingApi
88
86
  }
89
87
 
90
- export type PlatformaticGlobal = Optional<PlatformaticGlobalInterface>
91
- export declare function getGlobal<T = {}> (): PlatformaticGlobal & T
88
+ /** @deprecated Use `PlatformaticGlobal` instead. */
89
+ export type PlatformaticGlobalInterface = PlatformaticGlobal
90
+
91
+ export declare function getGlobal<T extends {}> (): (PlatformaticGlobal & T) | undefined
92
92
  export default getGlobal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/globals",
3
- "version": "3.41.0",
3
+ "version": "3.43.0",
4
4
  "description": "Platformatic Global Object Getter",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -21,17 +21,19 @@
21
21
  "cleaner-spec-reporter": "^0.5.0",
22
22
  "eslint": "^9.18.0",
23
23
  "neostandard": "^0.12.0",
24
+ "tstyche": "^6.2.0",
24
25
  "typescript": "^5.7.3"
25
26
  },
26
27
  "dependencies": {
27
- "pino": "^9.9.0",
28
- "@platformatic/prom-client": "^1.0.0"
28
+ "@platformatic/prom-client": "^1.0.0",
29
+ "pino": "^9.9.0"
29
30
  },
30
31
  "engines": {
31
32
  "node": ">=22.19.0"
32
33
  },
33
34
  "scripts": {
34
- "test": "node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js test/**/*.test.js",
35
+ "test": "npm run test:types && node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js test/**/*.test.js",
36
+ "test:types": "tstyche",
35
37
  "lint": "eslint"
36
38
  }
37
39
  }