@venizia/ignis-helpers 0.0.7-0 → 0.0.8-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 (63) hide show
  1. package/dist/common/constants/grpc.d.ts +60 -0
  2. package/dist/common/constants/grpc.d.ts.map +1 -0
  3. package/dist/common/constants/grpc.js +61 -0
  4. package/dist/common/constants/grpc.js.map +1 -0
  5. package/dist/common/constants/http.d.ts +74 -6
  6. package/dist/common/constants/http.d.ts.map +1 -1
  7. package/dist/common/constants/http.js +87 -6
  8. package/dist/common/constants/http.js.map +1 -1
  9. package/dist/common/constants/index.d.ts +1 -0
  10. package/dist/common/constants/index.d.ts.map +1 -1
  11. package/dist/common/constants/index.js +1 -0
  12. package/dist/common/constants/index.js.map +1 -1
  13. package/dist/modules/queue/kafka/admin.d.ts +32 -0
  14. package/dist/modules/queue/kafka/admin.d.ts.map +1 -0
  15. package/dist/modules/queue/kafka/admin.js +75 -0
  16. package/dist/modules/queue/kafka/admin.js.map +1 -0
  17. package/dist/modules/queue/kafka/base.d.ts +38 -0
  18. package/dist/modules/queue/kafka/base.d.ts.map +1 -0
  19. package/dist/modules/queue/kafka/base.js +70 -0
  20. package/dist/modules/queue/kafka/base.js.map +1 -0
  21. package/dist/modules/queue/kafka/common/constants.d.ts +25 -0
  22. package/dist/modules/queue/kafka/common/constants.d.ts.map +1 -1
  23. package/dist/modules/queue/kafka/common/constants.js +38 -1
  24. package/dist/modules/queue/kafka/common/constants.js.map +1 -1
  25. package/dist/modules/queue/kafka/common/types.d.ts +76 -4
  26. package/dist/modules/queue/kafka/common/types.d.ts.map +1 -1
  27. package/dist/modules/queue/kafka/consumer.d.ts +64 -0
  28. package/dist/modules/queue/kafka/consumer.d.ts.map +1 -0
  29. package/dist/modules/queue/kafka/consumer.js +232 -0
  30. package/dist/modules/queue/kafka/consumer.js.map +1 -0
  31. package/dist/modules/queue/kafka/index.d.ts +5 -3
  32. package/dist/modules/queue/kafka/index.d.ts.map +1 -1
  33. package/dist/modules/queue/kafka/index.js +5 -3
  34. package/dist/modules/queue/kafka/index.js.map +1 -1
  35. package/dist/modules/queue/kafka/producer.d.ts +39 -0
  36. package/dist/modules/queue/kafka/producer.d.ts.map +1 -0
  37. package/dist/modules/queue/kafka/producer.js +127 -0
  38. package/dist/modules/queue/kafka/producer.js.map +1 -0
  39. package/dist/modules/queue/kafka/schema/index.d.ts +2 -0
  40. package/dist/modules/queue/kafka/schema/index.d.ts.map +1 -0
  41. package/dist/modules/queue/kafka/schema/index.js +18 -0
  42. package/dist/modules/queue/kafka/schema/index.js.map +1 -0
  43. package/dist/modules/queue/kafka/schema/registry.d.ts +29 -0
  44. package/dist/modules/queue/kafka/schema/registry.d.ts.map +1 -0
  45. package/dist/modules/queue/kafka/schema/registry.js +50 -0
  46. package/dist/modules/queue/kafka/schema/registry.js.map +1 -0
  47. package/dist/utilities/module.utility.d.ts +5 -0
  48. package/dist/utilities/module.utility.d.ts.map +1 -1
  49. package/dist/utilities/module.utility.js +12 -1
  50. package/dist/utilities/module.utility.js.map +1 -1
  51. package/package.json +1 -1
  52. package/dist/modules/queue/kafka/admin.helper.d.ts +0 -32
  53. package/dist/modules/queue/kafka/admin.helper.d.ts.map +0 -1
  54. package/dist/modules/queue/kafka/admin.helper.js +0 -59
  55. package/dist/modules/queue/kafka/admin.helper.js.map +0 -1
  56. package/dist/modules/queue/kafka/consumer.helper.d.ts +0 -55
  57. package/dist/modules/queue/kafka/consumer.helper.d.ts.map +0 -1
  58. package/dist/modules/queue/kafka/consumer.helper.js +0 -93
  59. package/dist/modules/queue/kafka/consumer.helper.js.map +0 -1
  60. package/dist/modules/queue/kafka/producer.helper.d.ts +0 -53
  61. package/dist/modules/queue/kafka/producer.helper.d.ts.map +0 -1
  62. package/dist/modules/queue/kafka/producer.helper.js +0 -85
  63. package/dist/modules/queue/kafka/producer.helper.js.map +0 -1
@@ -0,0 +1,60 @@
1
+ import { ValueOf } from '../types';
2
+ export declare class GRPC {
3
+ /** Standard gRPC methods (lowercase). */
4
+ static readonly Methods: {
5
+ readonly UNARY: "unary";
6
+ readonly SERVER_STREAMING: "server_streaming";
7
+ readonly CLIENT_STREAMING: "client_streaming";
8
+ readonly BIDI_STREAMING: "bidi_streaming";
9
+ };
10
+ /** Standard gRPC protocol headers (PROTOCOL-HTTP2.md). */
11
+ static readonly Headers: {
12
+ readonly CONTENT_TYPE: "content-type";
13
+ readonly TE: "te";
14
+ readonly USER_AGENT: "user-agent";
15
+ readonly GRPC_TIMEOUT: "grpc-timeout";
16
+ readonly GRPC_ENCODING: "grpc-encoding";
17
+ readonly GRPC_ACCEPT_ENCODING: "grpc-accept-encoding";
18
+ readonly GRPC_MESSAGE_TYPE: "grpc-message-type";
19
+ readonly GRPC_STATUS: "grpc-status";
20
+ readonly GRPC_MESSAGE: "grpc-message";
21
+ readonly GRPC_STATUS_DETAILS_BIN: "grpc-status-details-bin";
22
+ readonly GRPC_PREVIOUS_RPC_ATTEMPTS: "grpc-previous-rpc-attempts";
23
+ readonly GRPC_RETRY_PUSHBACK_MS: "grpc-retry-pushback-ms";
24
+ readonly GRPC_TRACE_BIN: "grpc-trace-bin";
25
+ readonly GRPC_TAGS_BIN: "grpc-tags-bin";
26
+ };
27
+ /** gRPC MIME / Content-Type values. */
28
+ static readonly HeaderValues: {
29
+ readonly GRPC: "application/grpc";
30
+ readonly GRPC_PROTO: "application/grpc+proto";
31
+ readonly GRPC_JSON: "application/grpc+json";
32
+ readonly GRPC_WEB: "application/grpc-web";
33
+ readonly GRPC_WEB_PROTO: "application/grpc-web+proto";
34
+ readonly GRPC_WEB_JSON: "application/grpc-web+json";
35
+ readonly GRPC_WEB_TEXT: "application/grpc-web-text";
36
+ };
37
+ /** Standard gRPC status codes (google.rpc.Code). */
38
+ static readonly ResultCodes: {
39
+ readonly OK: 0;
40
+ readonly CANCELLED: 1;
41
+ readonly UNKNOWN: 2;
42
+ readonly INVALID_ARGUMENT: 3;
43
+ readonly DEADLINE_EXCEEDED: 4;
44
+ readonly NOT_FOUND: 5;
45
+ readonly ALREADY_EXISTS: 6;
46
+ readonly PERMISSION_DENIED: 7;
47
+ readonly RESOURCE_EXHAUSTED: 8;
48
+ readonly FAILED_PRECONDITION: 9;
49
+ readonly ABORTED: 10;
50
+ readonly OUT_OF_RANGE: 11;
51
+ readonly UNIMPLEMENTED: 12;
52
+ readonly INTERNAL: 13;
53
+ readonly UNAVAILABLE: 14;
54
+ readonly DATA_LOSS: 15;
55
+ readonly UNAUTHENTICATED: 16;
56
+ };
57
+ }
58
+ export type TGrpcMethod = ValueOf<typeof GRPC.Methods>;
59
+ export type TGrpcResultCode = ValueOf<typeof GRPC.ResultCodes>;
60
+ //# sourceMappingURL=grpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grpc.d.ts","sourceRoot":"","sources":["../../../src/common/constants/grpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qBAAa,IAAI;IACf,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;MAKZ;IAEX,0DAA0D;IAC1D,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;;;;;;;;MAmBZ;IAEX,uCAAuC;IACvC,MAAM,CAAC,QAAQ,CAAC,YAAY;;;;;;;;MAQjB;IAEX,oDAAoD;IACpD,MAAM,CAAC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;MAkBhB;CACZ;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GRPC = void 0;
4
+ class GRPC {
5
+ /** Standard gRPC methods (lowercase). */
6
+ static { this.Methods = {
7
+ UNARY: 'unary',
8
+ SERVER_STREAMING: 'server_streaming',
9
+ CLIENT_STREAMING: 'client_streaming',
10
+ BIDI_STREAMING: 'bidi_streaming',
11
+ }; }
12
+ /** Standard gRPC protocol headers (PROTOCOL-HTTP2.md). */
13
+ static { this.Headers = {
14
+ CONTENT_TYPE: 'content-type',
15
+ TE: 'te',
16
+ USER_AGENT: 'user-agent',
17
+ GRPC_TIMEOUT: 'grpc-timeout',
18
+ GRPC_ENCODING: 'grpc-encoding',
19
+ GRPC_ACCEPT_ENCODING: 'grpc-accept-encoding',
20
+ GRPC_MESSAGE_TYPE: 'grpc-message-type',
21
+ GRPC_STATUS: 'grpc-status',
22
+ GRPC_MESSAGE: 'grpc-message',
23
+ GRPC_STATUS_DETAILS_BIN: 'grpc-status-details-bin',
24
+ GRPC_PREVIOUS_RPC_ATTEMPTS: 'grpc-previous-rpc-attempts',
25
+ GRPC_RETRY_PUSHBACK_MS: 'grpc-retry-pushback-ms',
26
+ GRPC_TRACE_BIN: 'grpc-trace-bin',
27
+ GRPC_TAGS_BIN: 'grpc-tags-bin',
28
+ }; }
29
+ /** gRPC MIME / Content-Type values. */
30
+ static { this.HeaderValues = {
31
+ GRPC: 'application/grpc',
32
+ GRPC_PROTO: 'application/grpc+proto',
33
+ GRPC_JSON: 'application/grpc+json',
34
+ GRPC_WEB: 'application/grpc-web',
35
+ GRPC_WEB_PROTO: 'application/grpc-web+proto',
36
+ GRPC_WEB_JSON: 'application/grpc-web+json',
37
+ GRPC_WEB_TEXT: 'application/grpc-web-text',
38
+ }; }
39
+ /** Standard gRPC status codes (google.rpc.Code). */
40
+ static { this.ResultCodes = {
41
+ OK: 0,
42
+ CANCELLED: 1,
43
+ UNKNOWN: 2,
44
+ INVALID_ARGUMENT: 3,
45
+ DEADLINE_EXCEEDED: 4,
46
+ NOT_FOUND: 5,
47
+ ALREADY_EXISTS: 6,
48
+ PERMISSION_DENIED: 7,
49
+ RESOURCE_EXHAUSTED: 8,
50
+ FAILED_PRECONDITION: 9,
51
+ ABORTED: 10,
52
+ OUT_OF_RANGE: 11,
53
+ UNIMPLEMENTED: 12,
54
+ INTERNAL: 13,
55
+ UNAVAILABLE: 14,
56
+ DATA_LOSS: 15,
57
+ UNAUTHENTICATED: 16,
58
+ }; }
59
+ }
60
+ exports.GRPC = GRPC;
61
+ //# sourceMappingURL=grpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grpc.js","sourceRoot":"","sources":["../../../src/common/constants/grpc.ts"],"names":[],"mappings":";;;AAEA,MAAa,IAAI;IACf,yCAAyC;aACzB,YAAO,GAAG;QACxB,KAAK,EAAE,OAAO;QACd,gBAAgB,EAAE,kBAAkB;QACpC,gBAAgB,EAAE,kBAAkB;QACpC,cAAc,EAAE,gBAAgB;KACxB,CAAC;IAEX,0DAA0D;aAC1C,YAAO,GAAG;QACxB,YAAY,EAAE,cAAc;QAC5B,EAAE,EAAE,IAAI;QACR,UAAU,EAAE,YAAY;QAExB,YAAY,EAAE,cAAc;QAC5B,aAAa,EAAE,eAAe;QAC9B,oBAAoB,EAAE,sBAAsB;QAC5C,iBAAiB,EAAE,mBAAmB;QAEtC,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,cAAc;QAC5B,uBAAuB,EAAE,yBAAyB;QAElD,0BAA0B,EAAE,4BAA4B;QACxD,sBAAsB,EAAE,wBAAwB;QAEhD,cAAc,EAAE,gBAAgB;QAChC,aAAa,EAAE,eAAe;KACtB,CAAC;IAEX,uCAAuC;aACvB,iBAAY,GAAG;QAC7B,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,wBAAwB;QACpC,SAAS,EAAE,uBAAuB;QAClC,QAAQ,EAAE,sBAAsB;QAChC,cAAc,EAAE,4BAA4B;QAC5C,aAAa,EAAE,2BAA2B;QAC1C,aAAa,EAAE,2BAA2B;KAClC,CAAC;IAEX,oDAAoD;aACpC,gBAAW,GAAG;QAC5B,EAAE,EAAE,CAAC;QACL,SAAS,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;QACV,gBAAgB,EAAE,CAAC;QACnB,iBAAiB,EAAE,CAAC;QACpB,SAAS,EAAE,CAAC;QACZ,cAAc,EAAE,CAAC;QACjB,iBAAiB,EAAE,CAAC;QACpB,kBAAkB,EAAE,CAAC;QACrB,mBAAmB,EAAE,CAAC;QACtB,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,EAAE;QACjB,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,EAAE;QACb,eAAe,EAAE,EAAE;KACX,CAAC;;AA7Db,oBA8DC"}
@@ -1,15 +1,54 @@
1
1
  import { ValueOf } from '../types';
2
2
  export declare class HTTP {
3
+ /** Standard and common HTTP headers (lowercase per HTTP/2 convention). */
3
4
  static readonly Headers: {
4
- readonly AUTHORIZATION: "authorization";
5
- readonly CACHE_CONTROL: "cache-control";
6
5
  readonly CONTENT_DISPOSITION: "content-disposition";
7
6
  readonly CONTENT_ENCODING: "content-encoding";
8
7
  readonly CONTENT_LENGTH: "content-length";
9
8
  readonly CONTENT_TYPE: "content-type";
10
9
  readonly CONTENT_RANGE: "content-range";
10
+ readonly CONTENT_SECURITY_POLICY: "content-security-policy";
11
+ readonly ACCEPT: "accept";
12
+ readonly ACCEPT_ENCODING: "accept-encoding";
13
+ readonly ACCEPT_LANGUAGE: "accept-language";
14
+ readonly AUTHORIZATION: "authorization";
15
+ readonly COOKIE: "cookie";
16
+ readonly HOST: "host";
17
+ readonly IF_MODIFIED_SINCE: "if-modified-since";
18
+ readonly IF_NONE_MATCH: "if-none-match";
19
+ readonly ORIGIN: "origin";
20
+ readonly REFERER: "referer";
21
+ readonly USER_AGENT: "user-agent";
22
+ readonly ALLOW: "allow";
23
+ readonly CACHE_CONTROL: "cache-control";
11
24
  readonly ETAG: "etag";
12
25
  readonly LAST_MODIFIED: "last-modified";
26
+ readonly LOCATION: "location";
27
+ readonly RETRY_AFTER: "retry-after";
28
+ readonly SET_COOKIE: "set-cookie";
29
+ readonly VARY: "vary";
30
+ readonly WWW_AUTHENTICATE: "www-authenticate";
31
+ readonly ACCESS_CONTROL_ALLOW_CREDENTIALS: "access-control-allow-credentials";
32
+ readonly ACCESS_CONTROL_ALLOW_HEADERS: "access-control-allow-headers";
33
+ readonly ACCESS_CONTROL_ALLOW_METHODS: "access-control-allow-methods";
34
+ readonly ACCESS_CONTROL_ALLOW_ORIGIN: "access-control-allow-origin";
35
+ readonly ACCESS_CONTROL_EXPOSE_HEADERS: "access-control-expose-headers";
36
+ readonly ACCESS_CONTROL_MAX_AGE: "access-control-max-age";
37
+ readonly ACCESS_CONTROL_REQUEST_HEADERS: "access-control-request-headers";
38
+ readonly ACCESS_CONTROL_REQUEST_METHOD: "access-control-request-method";
39
+ readonly CONNECTION: "connection";
40
+ readonly TRANSFER_ENCODING: "transfer-encoding";
41
+ readonly UPGRADE: "upgrade";
42
+ readonly STRICT_TRANSPORT_SECURITY: "strict-transport-security";
43
+ readonly X_CONTENT_TYPE_OPTIONS: "x-content-type-options";
44
+ readonly X_FRAME_OPTIONS: "x-frame-options";
45
+ readonly FORWARDED: "forwarded";
46
+ readonly X_FORWARDED_FOR: "x-forwarded-for";
47
+ readonly X_FORWARDED_HOST: "x-forwarded-host";
48
+ readonly X_FORWARDED_PROTO: "x-forwarded-proto";
49
+ readonly X_RATELIMIT_LIMIT: "x-ratelimit-limit";
50
+ readonly X_RATELIMIT_REMAINING: "x-ratelimit-remaining";
51
+ readonly X_RATELIMIT_RESET: "x-ratelimit-reset";
13
52
  readonly REQUEST_TRACING_ID: "x-request-id";
14
53
  readonly REQUEST_DEVICE_INFO: "x-device-info";
15
54
  readonly REQUEST_CHANNEL: "x-request-channel";
@@ -17,13 +56,34 @@ export declare class HTTP {
17
56
  readonly RESPONSE_COUNT_DATA: "x-response-count";
18
57
  readonly RESPONSE_FORMAT: "x-response-format";
19
58
  };
59
+ /** Common MIME / Content-Type values. */
20
60
  static readonly HeaderValues: {
21
61
  readonly APPLICATION_FORM_URLENCODED: "application/x-www-form-urlencoded";
62
+ readonly APPLICATION_GRAPHQL_JSON: "application/graphql+json";
63
+ readonly APPLICATION_GZIP: "application/gzip";
64
+ readonly APPLICATION_JAVASCRIPT: "application/javascript";
22
65
  readonly APPLICATION_JSON: "application/json";
23
- readonly APPPLICATION_OCTET_STREAM: "application/octet-stream";
66
+ readonly APPLICATION_MSGPACK: "application/msgpack";
67
+ readonly APPLICATION_NDJSON: "application/x-ndjson";
68
+ readonly APPLICATION_OCTET_STREAM: "application/octet-stream";
69
+ readonly APPLICATION_PDF: "application/pdf";
70
+ readonly APPLICATION_PROTOBUF: "application/x-protobuf";
71
+ readonly APPLICATION_XML: "application/xml";
72
+ readonly APPLICATION_ZIP: "application/zip";
24
73
  readonly MULTIPART_FORM_DATA: "multipart/form-data";
74
+ readonly TEXT_CSS: "text/css";
75
+ readonly TEXT_CSV: "text/csv";
76
+ readonly TEXT_EVENT_STREAM: "text/event-stream";
77
+ readonly TEXT_HTML: "text/html";
25
78
  readonly TEXT_PLAIN: "text/plain";
79
+ readonly TEXT_XML: "text/xml";
80
+ readonly IMAGE_GIF: "image/gif";
81
+ readonly IMAGE_JPEG: "image/jpeg";
82
+ readonly IMAGE_PNG: "image/png";
83
+ readonly IMAGE_SVG: "image/svg+xml";
84
+ readonly IMAGE_WEBP: "image/webp";
26
85
  };
86
+ /** Standard HTTP methods (lowercase). */
27
87
  static readonly Methods: {
28
88
  readonly GET: "get";
29
89
  readonly POST: "post";
@@ -33,10 +93,15 @@ export declare class HTTP {
33
93
  readonly HEAD: "head";
34
94
  readonly OPTIONS: "options";
35
95
  };
96
+ /** HTTP status codes grouped by class (1xx–5xx). */
36
97
  static readonly ResultCodes: {
37
- readonly RS_FAIL: 0;
38
- readonly RS_SUCCESS: 1;
39
- readonly RS_UNKNOWN_ERROR: -199;
98
+ /** 1xx — Informational. */
99
+ readonly RS_1: {
100
+ readonly Continue: 100;
101
+ readonly SwitchingProtocols: 101;
102
+ readonly EarlyHints: 103;
103
+ };
104
+ /** 2xx — Success. */
40
105
  readonly RS_2: {
41
106
  readonly Ok: 200;
42
107
  readonly Created: 201;
@@ -47,6 +112,7 @@ export declare class HTTP {
47
112
  readonly PartialContent: 206;
48
113
  readonly MultiStatus: 207;
49
114
  };
115
+ /** 3xx — Redirection. */
50
116
  readonly RS_3: {
51
117
  readonly MovedPermanently: 301;
52
118
  readonly Found: 302;
@@ -54,6 +120,7 @@ export declare class HTTP {
54
120
  readonly TemporaryRedirect: 307;
55
121
  readonly PermanentRedirect: 308;
56
122
  };
123
+ /** 4xx — Client error. */
57
124
  readonly RS_4: {
58
125
  readonly BadRequest: 400;
59
126
  readonly Unauthorized: 401;
@@ -82,6 +149,7 @@ export declare class HTTP {
82
149
  readonly RequestHeaderFieldsTooLarge: 431;
83
150
  readonly UnavailableForLegalReasons: 451;
84
151
  };
152
+ /** 5xx — Server error. */
85
153
  readonly RS_5: {
86
154
  readonly InternalServerError: 500;
87
155
  readonly NotImplemented: 501;
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/common/constants/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qBAAa,IAAI;IACf,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;;;;;;;;;MAoBZ;IAEX,MAAM,CAAC,QAAQ,CAAC,YAAY;;;;;;MAMjB;IAEX,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;MAQZ;IAEX,MAAM,CAAC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgEhB;CACZ;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/common/constants/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,qBAAa,IAAI;IACf,0EAA0E;IAC1E,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuEZ;IAEX,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;MAgCjB;IAEX,yCAAyC;IACzC,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;;MAQZ;IAEX,oDAAoD;IACpD,MAAM,CAAC,QAAQ,CAAC,WAAW;QACzB,2BAA2B;;;;;;QAO3B,qBAAqB;;;;;;;;;;;QAYrB,yBAAyB;;;;;;;;QASzB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8B1B,0BAA0B;;;;;;;;;;;;MAYjB;CACZ;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;AACvD,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC"}
@@ -2,16 +2,64 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HTTP = void 0;
4
4
  class HTTP {
5
+ /** Standard and common HTTP headers (lowercase per HTTP/2 convention). */
5
6
  static { this.Headers = {
6
- AUTHORIZATION: 'authorization',
7
- CACHE_CONTROL: 'cache-control',
7
+ // Content
8
8
  CONTENT_DISPOSITION: 'content-disposition',
9
9
  CONTENT_ENCODING: 'content-encoding',
10
10
  CONTENT_LENGTH: 'content-length',
11
11
  CONTENT_TYPE: 'content-type',
12
12
  CONTENT_RANGE: 'content-range',
13
+ CONTENT_SECURITY_POLICY: 'content-security-policy',
14
+ // Request — content negotiation & conditionals
15
+ ACCEPT: 'accept',
16
+ ACCEPT_ENCODING: 'accept-encoding',
17
+ ACCEPT_LANGUAGE: 'accept-language',
18
+ AUTHORIZATION: 'authorization',
19
+ COOKIE: 'cookie',
20
+ HOST: 'host',
21
+ IF_MODIFIED_SINCE: 'if-modified-since',
22
+ IF_NONE_MATCH: 'if-none-match',
23
+ ORIGIN: 'origin',
24
+ REFERER: 'referer',
25
+ USER_AGENT: 'user-agent',
26
+ // Response — caching, auth challenges & redirects
27
+ ALLOW: 'allow',
28
+ CACHE_CONTROL: 'cache-control',
13
29
  ETAG: 'etag',
14
30
  LAST_MODIFIED: 'last-modified',
31
+ LOCATION: 'location',
32
+ RETRY_AFTER: 'retry-after',
33
+ SET_COOKIE: 'set-cookie',
34
+ VARY: 'vary',
35
+ WWW_AUTHENTICATE: 'www-authenticate',
36
+ // CORS (RFC 6454 / Fetch spec)
37
+ ACCESS_CONTROL_ALLOW_CREDENTIALS: 'access-control-allow-credentials',
38
+ ACCESS_CONTROL_ALLOW_HEADERS: 'access-control-allow-headers',
39
+ ACCESS_CONTROL_ALLOW_METHODS: 'access-control-allow-methods',
40
+ ACCESS_CONTROL_ALLOW_ORIGIN: 'access-control-allow-origin',
41
+ ACCESS_CONTROL_EXPOSE_HEADERS: 'access-control-expose-headers',
42
+ ACCESS_CONTROL_MAX_AGE: 'access-control-max-age',
43
+ ACCESS_CONTROL_REQUEST_HEADERS: 'access-control-request-headers',
44
+ ACCESS_CONTROL_REQUEST_METHOD: 'access-control-request-method',
45
+ // Transport
46
+ CONNECTION: 'connection',
47
+ TRANSFER_ENCODING: 'transfer-encoding',
48
+ UPGRADE: 'upgrade',
49
+ // Security
50
+ STRICT_TRANSPORT_SECURITY: 'strict-transport-security',
51
+ X_CONTENT_TYPE_OPTIONS: 'x-content-type-options',
52
+ X_FRAME_OPTIONS: 'x-frame-options',
53
+ // Proxy / forwarding (de facto standard)
54
+ FORWARDED: 'forwarded',
55
+ X_FORWARDED_FOR: 'x-forwarded-for',
56
+ X_FORWARDED_HOST: 'x-forwarded-host',
57
+ X_FORWARDED_PROTO: 'x-forwarded-proto',
58
+ // Rate limiting (de facto standard)
59
+ X_RATELIMIT_LIMIT: 'x-ratelimit-limit',
60
+ X_RATELIMIT_REMAINING: 'x-ratelimit-remaining',
61
+ X_RATELIMIT_RESET: 'x-ratelimit-reset',
62
+ // Ignis custom
15
63
  REQUEST_TRACING_ID: 'x-request-id',
16
64
  REQUEST_DEVICE_INFO: 'x-device-info',
17
65
  REQUEST_CHANNEL: 'x-request-channel',
@@ -19,13 +67,38 @@ class HTTP {
19
67
  RESPONSE_COUNT_DATA: 'x-response-count',
20
68
  RESPONSE_FORMAT: 'x-response-format',
21
69
  }; }
70
+ /** Common MIME / Content-Type values. */
22
71
  static { this.HeaderValues = {
72
+ // Application
23
73
  APPLICATION_FORM_URLENCODED: 'application/x-www-form-urlencoded',
74
+ APPLICATION_GRAPHQL_JSON: 'application/graphql+json',
75
+ APPLICATION_GZIP: 'application/gzip',
76
+ APPLICATION_JAVASCRIPT: 'application/javascript',
24
77
  APPLICATION_JSON: 'application/json',
25
- APPPLICATION_OCTET_STREAM: 'application/octet-stream',
78
+ APPLICATION_MSGPACK: 'application/msgpack',
79
+ APPLICATION_NDJSON: 'application/x-ndjson',
80
+ APPLICATION_OCTET_STREAM: 'application/octet-stream',
81
+ APPLICATION_PDF: 'application/pdf',
82
+ APPLICATION_PROTOBUF: 'application/x-protobuf',
83
+ APPLICATION_XML: 'application/xml',
84
+ APPLICATION_ZIP: 'application/zip',
85
+ // Multipart
26
86
  MULTIPART_FORM_DATA: 'multipart/form-data',
87
+ // Text
88
+ TEXT_CSS: 'text/css',
89
+ TEXT_CSV: 'text/csv',
90
+ TEXT_EVENT_STREAM: 'text/event-stream',
91
+ TEXT_HTML: 'text/html',
27
92
  TEXT_PLAIN: 'text/plain',
93
+ TEXT_XML: 'text/xml',
94
+ // Image
95
+ IMAGE_GIF: 'image/gif',
96
+ IMAGE_JPEG: 'image/jpeg',
97
+ IMAGE_PNG: 'image/png',
98
+ IMAGE_SVG: 'image/svg+xml',
99
+ IMAGE_WEBP: 'image/webp',
28
100
  }; }
101
+ /** Standard HTTP methods (lowercase). */
29
102
  static { this.Methods = {
30
103
  GET: 'get',
31
104
  POST: 'post',
@@ -35,10 +108,15 @@ class HTTP {
35
108
  HEAD: 'head',
36
109
  OPTIONS: 'options',
37
110
  }; }
111
+ /** HTTP status codes grouped by class (1xx–5xx). */
38
112
  static { this.ResultCodes = {
39
- RS_FAIL: 0,
40
- RS_SUCCESS: 1,
41
- RS_UNKNOWN_ERROR: -199,
113
+ /** 1xx — Informational. */
114
+ RS_1: {
115
+ Continue: 100,
116
+ SwitchingProtocols: 101,
117
+ EarlyHints: 103,
118
+ },
119
+ /** 2xx — Success. */
42
120
  RS_2: {
43
121
  Ok: 200,
44
122
  Created: 201,
@@ -49,6 +127,7 @@ class HTTP {
49
127
  PartialContent: 206,
50
128
  MultiStatus: 207,
51
129
  },
130
+ /** 3xx — Redirection. */
52
131
  RS_3: {
53
132
  MovedPermanently: 301,
54
133
  Found: 302,
@@ -56,6 +135,7 @@ class HTTP {
56
135
  TemporaryRedirect: 307,
57
136
  PermanentRedirect: 308,
58
137
  },
138
+ /** 4xx — Client error. */
59
139
  RS_4: {
60
140
  BadRequest: 400,
61
141
  Unauthorized: 401,
@@ -84,6 +164,7 @@ class HTTP {
84
164
  RequestHeaderFieldsTooLarge: 431,
85
165
  UnavailableForLegalReasons: 451,
86
166
  },
167
+ /** 5xx — Server error. */
87
168
  RS_5: {
88
169
  InternalServerError: 500,
89
170
  NotImplemented: 501,
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/common/constants/http.ts"],"names":[],"mappings":";;;AAEA,MAAa,IAAI;aACC,YAAO,GAAG;QACxB,aAAa,EAAE,eAAe;QAC9B,aAAa,EAAE,eAAe;QAC9B,mBAAmB,EAAE,qBAAqB;QAC1C,gBAAgB,EAAE,kBAAkB;QACpC,cAAc,EAAE,gBA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ACd,QAAQ,EAAE,GAAG;YACb,gBAAgB,EAAE,GAAG;YACrB,aAAa,EAAE,GAAG;YAClB,cAAc,EAAE,GAAG;YACnB,QAAQ,EAAE,GAAG;YACb,IAAI,EAAE,GAAG;YACT,cAAc,EAAE,GAAG;YACnB,kBAAkB,EAAE,GAAG;YACvB,eAAe,EAAE,GAAG;YACpB,UAAU,EAAE,GAAG;YACf,oBAAoB,EAAE,GAAG;YACzB,mBAAmB,EAAE,GAAG;YACxB,iBAAiB,EAAE,GAAG;YACtB,mBAAmB,EAAE,GAAG;YACxB,MAAM,EAAE,GAAG;YACX,gBAAgB,EAAE,GAAG;YACrB,QAAQ,EAAE,GAAG;YACb,eAAe,EAAE,GAAG;YACpB,oBAAoB,EAAE,GAAG;YACzB,eAAe,EAAE,GAAG;YACpB,2BAA2B,EAAE,GAAG;YAChC,0BAA0B,EAAE,GAAG;SAChC;QAED,IAAI,EAAE;YACJ,mBAAmB,EAAE,GAAG;YACxB,cAAc,EAAE,GAAG;YACnB,UAAU,EAAE,GAAG;YACf,kBAAkB,EAAE,GAAG;YACvB,cAAc,EAAE,GAAG;YACnB,uBAAuB,EAAE,GAAG;YAC5B,mBAAmB,EAAE,GAAG;YACxB,YAAY,EAAE,GAAG;YACjB,6BAA6B,EAAE,GAAG;SACnC;KACO,CAAC;;AAzGb,oBA0GC"}
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/common/constants/http.ts"],"names":[],"mappings":";;;AAEA,MAAa,IAAI;IACf,0EAA0E;aAC1D,YAAO,GAAG;QACxB,UAAU;QACV,mBAAmB,EAAE,qBAAqB;QAC1C,gBAAgB,EAAE,kBAAkB;QACpC,cAAc,EAAE,gBAAgB;QAChC,YAAY,EAAE,cAAc;QAC5B,aAAa,EAAE,eAAe;QAC9B,uBAAuB,EAAE,yBAAyB;QAElD,+CAA+C;QAC/C,MAAM,EAAE,QAAQ;QAChB,eAAe,EAAE,iBAAiB;QAClC,eAAe,EAAE,iBAAiB;QAClC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AG;YACjB,6BAA6B,EAAE,GAAG;SACnC;KACO,CAAC;;AAjMb,oBAkMC"}
@@ -1,4 +1,5 @@
1
1
  export * from './app';
2
+ export * from './grpc';
2
3
  export * from './http';
3
4
  export * from './mime';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./app"), exports);
18
+ __exportStar(require("./grpc"), exports);
18
19
  __exportStar(require("./http"), exports);
19
20
  __exportStar(require("./mime"), exports);
20
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,yCAAuB;AACvB,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,yCAAuB;AACvB,yCAAuB;AACvB,yCAAuB"}
@@ -0,0 +1,32 @@
1
+ import { Admin } from '@platformatic/kafka';
2
+ import { BaseKafkaHelper } from './base';
3
+ import type { IKafkaAdminOptions } from './common/types';
4
+ /**
5
+ * KafkaAdminHelper — Wrapper around `@platformatic/kafka` Admin.
6
+ *
7
+ * Provides scoped logging, lifecycle management, and health tracking.
8
+ * Use `getAdmin()` to access the full Admin API directly.
9
+ *
10
+ * @example
11
+ * const helper = KafkaAdminHelper.newInstance({
12
+ * bootstrapBrokers: ['127.0.0.1:29092'],
13
+ * clientId: 'my-admin',
14
+ * onBrokerConnect: ({ broker }) => console.log(`Connected to ${broker.host}:${broker.port}`),
15
+ * });
16
+ *
17
+ * const admin = helper.getAdmin();
18
+ * await admin.createTopics({ topics: ['my-topic'], partitions: 3, replicas: 1 });
19
+ *
20
+ * helper.isHealthy(); // true when connected
21
+ *
22
+ * await helper.close();
23
+ */
24
+ export declare class KafkaAdminHelper extends BaseKafkaHelper<Admin> {
25
+ constructor(opts: IKafkaAdminOptions);
26
+ static newInstance(opts: IKafkaAdminOptions): KafkaAdminHelper;
27
+ getAdmin(): Admin;
28
+ close(opts?: {
29
+ isForce?: boolean;
30
+ }): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../../src/modules/queue/kafka/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAiB,SAAQ,eAAe,CAAC,KAAK,CAAC;gBAC9C,IAAI,EAAE,kBAAkB;IA6BpC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,gBAAgB;IAI9D,QAAQ,IAAI,KAAK;IAIX,KAAK,CAAC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBzD"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KafkaAdminHelper = void 0;
4
+ const kafka_1 = require("@platformatic/kafka");
5
+ const base_1 = require("./base");
6
+ const constants_1 = require("./common/constants");
7
+ /**
8
+ * KafkaAdminHelper — Wrapper around `@platformatic/kafka` Admin.
9
+ *
10
+ * Provides scoped logging, lifecycle management, and health tracking.
11
+ * Use `getAdmin()` to access the full Admin API directly.
12
+ *
13
+ * @example
14
+ * const helper = KafkaAdminHelper.newInstance({
15
+ * bootstrapBrokers: ['127.0.0.1:29092'],
16
+ * clientId: 'my-admin',
17
+ * onBrokerConnect: ({ broker }) => console.log(`Connected to ${broker.host}:${broker.port}`),
18
+ * });
19
+ *
20
+ * const admin = helper.getAdmin();
21
+ * await admin.createTopics({ topics: ['my-topic'], partitions: 3, replicas: 1 });
22
+ *
23
+ * helper.isHealthy(); // true when connected
24
+ *
25
+ * await helper.close();
26
+ */
27
+ class KafkaAdminHelper extends base_1.BaseKafkaHelper {
28
+ constructor(opts) {
29
+ super({
30
+ scope: KafkaAdminHelper.name,
31
+ identifier: opts.identifier ?? 'kafka-admin',
32
+ shutdownTimeout: opts.shutdownTimeout,
33
+ client: new kafka_1.Admin({
34
+ clientId: opts.clientId,
35
+ bootstrapBrokers: opts.bootstrapBrokers,
36
+ sasl: opts.sasl,
37
+ tls: opts.tls,
38
+ ssl: opts.ssl,
39
+ connectTimeout: opts.connectTimeout,
40
+ requestTimeout: opts.requestTimeout,
41
+ retries: opts.retries ?? constants_1.KafkaDefaults.RETRIES,
42
+ retryDelay: opts.retryDelay ?? constants_1.KafkaDefaults.RETRY_DELAY,
43
+ }),
44
+ onBrokerConnect: opts.onBrokerConnect,
45
+ onBrokerDisconnect: opts.onBrokerDisconnect,
46
+ });
47
+ this.configureBrokerEvents();
48
+ this.logger.info('[constructor] Kafka Admin CREATED | ClientId: %s | Brokers: %j', opts.clientId, opts.bootstrapBrokers);
49
+ }
50
+ static newInstance(opts) {
51
+ return new KafkaAdminHelper(opts);
52
+ }
53
+ getAdmin() {
54
+ return this.client;
55
+ }
56
+ async close(opts) {
57
+ const force = opts?.isForce ?? false;
58
+ if (force) {
59
+ await this.closeClient();
60
+ }
61
+ else {
62
+ try {
63
+ await this.gracefulCloseClient();
64
+ }
65
+ catch {
66
+ this.logger.warn('[close] Graceful shutdown timed out, forcing close');
67
+ await this.closeClient();
68
+ }
69
+ }
70
+ this.healthStatus = constants_1.KafkaHealthStatuses.DISCONNECTED;
71
+ this.logger.info('[close] Admin closed | Force: %s', force);
72
+ }
73
+ }
74
+ exports.KafkaAdminHelper = KafkaAdminHelper;
75
+ //# sourceMappingURL=admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../../src/modules/queue/kafka/admin.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAC5C,iCAAyC;AACzC,kDAAwE;AAGxE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,gBAAiB,SAAQ,sBAAsB;IAC1D,YAAY,IAAwB;QAClC,KAAK,CAAC;YACJ,KAAK,EAAE,gBAAgB,CAAC,IAAI;YAC5B,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,aAAa;YAC5C,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,MAAM,EAAE,IAAI,aAAK,CAAC;gBAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,yBAAa,CAAC,OAAO;gBAC9C,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,yBAAa,CAAC,WAAW;aACzD,CAAC;YACF,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAC;QAEH,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE7B,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,gEAAgE,EAChE,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,gBAAgB,CACtB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAAwB;QACzC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAA4B;QACtC,MAAM,KAAK,GAAG,IAAI,EAAE,OAAO,IAAI,KAAK,CAAC;QAErC,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACnC,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;gBACvE,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,IAAI,CAAC,YAAY,GAAG,+BAAmB,CAAC,YAAY,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CACF;AAvDD,4CAuDC"}
@@ -0,0 +1,38 @@
1
+ import type { Base, BaseOptions } from '@platformatic/kafka';
2
+ import { BaseHelper } from '@venizia/ignis-helpers';
3
+ import { type TKafkaHealthStatus } from './common/constants';
4
+ import type { TKafkaBrokerEventCallback } from './common/types';
5
+ export interface IKafkaBaseOptions<TClient extends Base<BaseOptions>> {
6
+ scope: string;
7
+ identifier: string;
8
+ client: TClient;
9
+ shutdownTimeout?: number;
10
+ onBrokerConnect?: TKafkaBrokerEventCallback;
11
+ onBrokerDisconnect?: TKafkaBrokerEventCallback;
12
+ }
13
+ /**
14
+ * BaseKafkaHelper — Shared health tracking and broker event wiring
15
+ * for all Kafka helpers (producer, consumer, admin).
16
+ *
17
+ * Generic `TClient` is the platformatic client type (Producer, Consumer, Admin).
18
+ * Subclasses create the client, pass it via `super({ client })`, and access it
19
+ * through `this.client`. Broker events are wired automatically in the constructor.
20
+ */
21
+ export declare abstract class BaseKafkaHelper<TClient extends Base<BaseOptions>> extends BaseHelper {
22
+ protected readonly client: TClient;
23
+ protected readonly shutdownTimeout: number;
24
+ protected healthStatus: TKafkaHealthStatus;
25
+ private readonly onBrokerConnect?;
26
+ private readonly onBrokerDisconnect?;
27
+ constructor(opts: IKafkaBaseOptions<TClient>);
28
+ isHealthy(): boolean;
29
+ isReady(): boolean;
30
+ getHealthStatus(): TKafkaHealthStatus;
31
+ protected configureBrokerConnect(): void;
32
+ protected configureBrokerDisconnect(): void;
33
+ protected configureBrokerFailed(): void;
34
+ protected configureBrokerEvents(): void;
35
+ protected closeClient(): Promise<void>;
36
+ protected gracefulCloseClient(): Promise<void>;
37
+ }
38
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/modules/queue/kafka/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAA8B,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,IAAI,CAAC,WAAW,CAAC;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAA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