@platformatic/globals 2.69.0 → 2.70.1

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 +25 -4
  2. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -3,12 +3,14 @@ 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
- interface InvalidateHttpCacheOptions {
6
+ export type Handler = ((data: any) => any) | ((data: any) => Promise<any>)
7
+
8
+ export interface InvalidateHttpCacheOptions {
7
9
  keys?: string[]
8
10
  tags?: string[]
9
11
  }
10
12
 
11
- interface PlatformaticGlobalInterface {
13
+ export interface PlatformaticGlobalInterface {
12
14
  events: EventEmitter
13
15
 
14
16
  // Runtime
@@ -49,8 +51,27 @@ interface PlatformaticGlobalInterface {
49
51
  setOpenapiSchema(schema: object): void
50
52
  setGraphqlSchema(schema: object): void
51
53
  setConnectionString(connection: string): void
52
- setCustomHealthCheck(healthCheck: () => boolean | Promise<boolean> | { status: boolean, statusCode?: number, body?: string } | Promise<{ status: boolean, statusCode?: number, body?: string }>): void
53
- setCustomReadinessCheck(readinessCheck: () => boolean | Promise<boolean> | { status: boolean, statusCode?: number, body?: string } | Promise<{ status: boolean, statusCode?: number, body?: string }>): void
54
+ setCustomHealthCheck(
55
+ healthCheck: () =>
56
+ | boolean
57
+ | Promise<boolean>
58
+ | { status: boolean; statusCode?: number; body?: string }
59
+ | Promise<{ status: boolean; statusCode?: number; body?: string }>
60
+ ): void
61
+ setCustomReadinessCheck(
62
+ readinessCheck: () =>
63
+ | boolean
64
+ | Promise<boolean>
65
+ | { status: boolean; statusCode?: number; body?: string }
66
+ | Promise<{ status: boolean; statusCode?: number; body?: string }>
67
+ ): void
68
+
69
+ // Messaging
70
+ 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
74
+ }
54
75
  }
55
76
 
56
77
  export type PlatformaticGlobal = Optional<PlatformaticGlobalInterface>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/globals",
3
- "version": "2.69.0",
3
+ "version": "2.70.1",
4
4
  "description": "Platformatic Global Object Getter",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",