@platformatic/globals 3.0.0-alpha.5 → 3.0.0-alpha.7

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 +16 -14
  2. package/package.json +3 -4
package/lib/index.d.ts CHANGED
@@ -3,6 +3,8 @@ 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;
7
+
6
8
  export type Handler = ((data: any) => any) | ((data: any) => Promise<any>)
7
9
 
8
10
  export interface InvalidateHttpCacheOptions {
@@ -21,7 +23,7 @@ export interface PlatformaticGlobalInterface {
21
23
  host: string
22
24
  port: number
23
25
  config: object
24
- serviceId: string
26
+ applicationId: string
25
27
  workerId: number | string
26
28
  root: string
27
29
  isEntrypoint: boolean
@@ -42,23 +44,23 @@ export interface PlatformaticGlobalInterface {
42
44
  clientSpansAls: AsyncLocalStorage
43
45
 
44
46
  // Caching
45
- onHttpCacheHit(key: string): void
46
- onHttpCacheMiss(key: string): void
47
- invalidateHttpCache(options: InvalidateHttpCacheOptions): void
47
+ onHttpCacheHit (key: string): void
48
+ onHttpCacheMiss (key: string): void
49
+ invalidateHttpCache (options: InvalidateHttpCacheOptions): void
48
50
 
49
51
  // Setters
50
- setBasePath(path: string): void
51
- setOpenapiSchema(schema: object): void
52
- setGraphqlSchema(schema: object): void
53
- setConnectionString(connection: string): void
54
- setCustomHealthCheck(
52
+ setBasePath (path: string): void
53
+ setOpenapiSchema (schema: object): void
54
+ setGraphqlSchema (schema: object): void
55
+ setConnectionString (connection: string): void
56
+ setCustomHealthCheck (
55
57
  healthCheck: () =>
56
58
  | boolean
57
59
  | Promise<boolean>
58
60
  | { status: boolean; statusCode?: number; body?: string }
59
61
  | Promise<{ status: boolean; statusCode?: number; body?: string }>
60
62
  ): void
61
- setCustomReadinessCheck(
63
+ setCustomReadinessCheck (
62
64
  readinessCheck: () =>
63
65
  | boolean
64
66
  | Promise<boolean>
@@ -68,12 +70,12 @@ export interface PlatformaticGlobalInterface {
68
70
 
69
71
  // Messaging
70
72
  messaging: {
71
- send(name: string, message: any, options?: Record<string, any>): Promise<any>
72
- handle(message: Record<string, Handler>): void
73
- handle(message: string, handler: Handler): void
73
+ send (name: string, message: any, options?: Record<string, any>): Promise<any>
74
+ handle (message: Record<string, Handler>): void
75
+ handle (message: string, handler: Handler): void
74
76
  }
75
77
  }
76
78
 
77
79
  export type PlatformaticGlobal = Optional<PlatformaticGlobalInterface>
78
- export declare function getGlobal<T = {}>(): PlatformaticGlobal & T
80
+ export declare function getGlobal<T = {}> (): PlatformaticGlobal & T
79
81
  export default getGlobal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/globals",
3
- "version": "3.0.0-alpha.5",
3
+ "version": "3.0.0-alpha.7",
4
4
  "description": "Platformatic Global Object Getter",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -18,7 +18,7 @@
18
18
  "homepage": "https://github.com/platformatic/platformatic#readme",
19
19
  "devDependencies": {
20
20
  "@types/node": "^22.10.6",
21
- "borp": "^0.20.0",
21
+ "cleaner-spec-reporter": "^0.5.0",
22
22
  "eslint": "^9.18.0",
23
23
  "neostandard": "^0.12.0",
24
24
  "typescript": "^5.7.3"
@@ -31,8 +31,7 @@
31
31
  "node": ">=22.18.0"
32
32
  },
33
33
  "scripts": {
34
- "test": "npm run lint",
35
- "coverage": "npm run lint && borp -C -X test",
34
+ "test": "node --test --test-reporter=cleaner-spec-reporter --test-concurrency=1 --test-timeout=2000000 test/*.test.js test/**/*.test.js",
36
35
  "lint": "eslint"
37
36
  }
38
37
  }