@xrystal/dto 26.6.27-v12

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 (87) hide show
  1. package/README.md +724 -0
  2. package/dist/adapters/elysia.cjs +820 -0
  3. package/dist/adapters/elysia.d.ts +138 -0
  4. package/dist/adapters/elysia.js +816 -0
  5. package/dist/adapters/express.cjs +789 -0
  6. package/dist/adapters/express.d.ts +49 -0
  7. package/dist/adapters/express.js +785 -0
  8. package/dist/adapters/index.d.ts +7 -0
  9. package/dist/adapters/node.cjs +790 -0
  10. package/dist/adapters/node.d.ts +27 -0
  11. package/dist/adapters/node.js +786 -0
  12. package/dist/adapters/shared.d.ts +11 -0
  13. package/dist/adapters/socketio.cjs +767 -0
  14. package/dist/adapters/socketio.d.ts +31 -0
  15. package/dist/adapters/socketio.js +763 -0
  16. package/dist/adapters/websocket.cjs +759 -0
  17. package/dist/adapters/websocket.d.ts +31 -0
  18. package/dist/adapters/websocket.js +754 -0
  19. package/dist/core/assemble-log.d.ts +1 -0
  20. package/dist/core/assemble-queue.d.ts +1 -0
  21. package/dist/core/assemble.d.ts +9 -0
  22. package/dist/core/builder.d.ts +49 -0
  23. package/dist/core/config.d.ts +10 -0
  24. package/dist/core/context.d.ts +5 -0
  25. package/dist/core/hooks.d.ts +8 -0
  26. package/dist/core/index.cjs +1002 -0
  27. package/dist/core/index.d.ts +14 -0
  28. package/dist/core/index.js +986 -0
  29. package/dist/core/log-dto.d.ts +1 -0
  30. package/dist/core/metadata.d.ts +6 -0
  31. package/dist/core/plugins.d.ts +10 -0
  32. package/dist/core/presets.d.ts +32 -0
  33. package/dist/core/queue-dto.d.ts +1 -0
  34. package/dist/core/response-dto.d.ts +1 -0
  35. package/dist/core/schema-utils.d.ts +1 -0
  36. package/dist/dto/index.cjs +909 -0
  37. package/dist/dto/index.d.ts +6 -0
  38. package/dist/dto/index.js +898 -0
  39. package/dist/dto/log/assemble.d.ts +3 -0
  40. package/dist/dto/log/builder.d.ts +41 -0
  41. package/dist/dto/log/index.cjs +152 -0
  42. package/dist/dto/log/index.d.ts +3 -0
  43. package/dist/dto/log/index.js +149 -0
  44. package/dist/dto/log/types.d.ts +26 -0
  45. package/dist/dto/queue/assemble.d.ts +2 -0
  46. package/dist/dto/queue/builder.d.ts +35 -0
  47. package/dist/dto/queue/index.cjs +154 -0
  48. package/dist/dto/queue/index.d.ts +3 -0
  49. package/dist/dto/queue/index.js +151 -0
  50. package/dist/dto/queue/types.d.ts +34 -0
  51. package/dist/dto/response/assemble.d.ts +1 -0
  52. package/dist/dto/response/dto.d.ts +39 -0
  53. package/dist/dto/response/index.cjs +179 -0
  54. package/dist/dto/response/index.d.ts +2 -0
  55. package/dist/dto/response/index.js +176 -0
  56. package/dist/dto/runtime/dto.cjs +1318 -0
  57. package/dist/dto/runtime/dto.d.ts +64 -0
  58. package/dist/dto/runtime/dto.js +1315 -0
  59. package/dist/dto/shared/base-dto.d.ts +12 -0
  60. package/dist/dto/shared/schema-utils.d.ts +1 -0
  61. package/dist/enums/node-env.d.ts +5 -0
  62. package/dist/errors/codes.d.ts +15 -0
  63. package/dist/errors/error.d.ts +32 -0
  64. package/dist/errors/index.d.ts +2 -0
  65. package/dist/index.cjs +1482 -0
  66. package/dist/index.d.ts +22 -0
  67. package/dist/index.js +1433 -0
  68. package/dist/types/builder.d.ts +15 -0
  69. package/dist/types/codes.d.ts +7 -0
  70. package/dist/types/context.d.ts +16 -0
  71. package/dist/types/hooks.d.ts +7 -0
  72. package/dist/types/index.d.ts +10 -0
  73. package/dist/types/log.d.ts +1 -0
  74. package/dist/types/metadata.d.ts +7 -0
  75. package/dist/types/options.d.ts +24 -0
  76. package/dist/types/plugin.d.ts +35 -0
  77. package/dist/types/queue.d.ts +1 -0
  78. package/dist/types/response.d.ts +43 -0
  79. package/dist/utils/constants/http.d.ts +2 -0
  80. package/dist/utils/constants/index.d.ts +3 -0
  81. package/dist/utils/constants/security-headers.d.ts +1 -0
  82. package/dist/utils/constants/status-codes.d.ts +35 -0
  83. package/dist/utils/helpers/index.d.ts +2 -0
  84. package/dist/utils/helpers/request-id.d.ts +3 -0
  85. package/dist/utils/helpers/uuid.d.ts +2 -0
  86. package/dist/utils/index.d.ts +2 -0
  87. package/package.json +130 -0
@@ -0,0 +1,3 @@
1
+ import type { LogBody, LogInput } from './types.js';
2
+ /** Guarantees JSON key order: level → service → message? → payload? → code? → timestamp → id? → env */
3
+ export declare function assembleLogBody(input: LogInput): LogBody;
@@ -0,0 +1,41 @@
1
+ import type { NodeEnvEnum } from '../../enums/node-env.js';
2
+ import type { LogBody, LogSchemaInput } from './types.js';
3
+ import { BaseDTO } from '../shared/base-dto.js';
4
+ /**
5
+ * Log DTO — static chain entry points mirror field order: level → service → … → env
6
+ *
7
+ * ```typescript
8
+ * DTO.Log.level('info').service('api').env(NodeEnvEnum.PROD).build()
9
+ * LogDTO.level('info').service('api').env(NodeEnvEnum.PROD).build()
10
+ * ```
11
+ */
12
+ export declare class LogDTO extends BaseDTO<LogBody, LogSchemaInput> {
13
+ private _level?;
14
+ private _service?;
15
+ private _env?;
16
+ private _message?;
17
+ private _payload;
18
+ private _code?;
19
+ private _timestamp?;
20
+ private _id?;
21
+ static level(value: string): LogDTO;
22
+ static service(value: string): LogDTO;
23
+ static env(value: NodeEnvEnum): LogDTO;
24
+ static message(value: string): LogDTO;
25
+ static code(value: string | number): LogDTO;
26
+ static timestamp(value: string): LogDTO;
27
+ static id(value: string | number): LogDTO;
28
+ static payload(partial: Record<string, unknown>): LogDTO;
29
+ /** One-shot body input — same last-wins rules as the instance `.schema()`. */
30
+ static schema(input?: LogSchemaInput): LogDTO;
31
+ level(value: string): this;
32
+ service(value: string): this;
33
+ env(value: NodeEnvEnum): this;
34
+ message(value: string): this;
35
+ code(value: string | number): this;
36
+ timestamp(value: string): this;
37
+ id(value: string | number): this;
38
+ payload(partial: Record<string, unknown>): this;
39
+ schema(input?: LogSchemaInput): this;
40
+ build(): LogBody;
41
+ }
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ // src/dto/log/assemble.ts
4
+ function assembleLogBody(input) {
5
+ const ordered = {
6
+ level: input.level,
7
+ service: input.service
8
+ };
9
+ if (input.message !== void 0) {
10
+ ordered.message = input.message;
11
+ }
12
+ if (input.payload !== void 0 && Object.keys(input.payload).length > 0) {
13
+ ordered.payload = input.payload;
14
+ }
15
+ if (input.code !== void 0) {
16
+ ordered.code = input.code;
17
+ }
18
+ ordered.timestamp = input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
19
+ if (input.id !== void 0) {
20
+ ordered.id = input.id;
21
+ }
22
+ ordered.env = input.env;
23
+ return ordered;
24
+ }
25
+
26
+ // src/dto/shared/schema-utils.ts
27
+ function assertRequiredFields(input, fields, label = "Missing required fields") {
28
+ const missing = fields.filter((field) => {
29
+ const value = input[field];
30
+ return value === void 0 || value === null || value === "";
31
+ });
32
+ if (missing.length > 0) {
33
+ throw new Error(`${label}: ${missing.join(", ")}`);
34
+ }
35
+ }
36
+
37
+ // src/dto/shared/base-dto.ts
38
+ var BaseDTO = class {
39
+ };
40
+
41
+ // src/dto/log/builder.ts
42
+ var LogDTO = class _LogDTO extends BaseDTO {
43
+ _level;
44
+ _service;
45
+ _env;
46
+ _message;
47
+ _payload = {};
48
+ _code;
49
+ _timestamp;
50
+ _id;
51
+ static level(value) {
52
+ return new _LogDTO().level(value);
53
+ }
54
+ static service(value) {
55
+ return new _LogDTO().service(value);
56
+ }
57
+ static env(value) {
58
+ return new _LogDTO().env(value);
59
+ }
60
+ static message(value) {
61
+ return new _LogDTO().message(value);
62
+ }
63
+ static code(value) {
64
+ return new _LogDTO().code(value);
65
+ }
66
+ static timestamp(value) {
67
+ return new _LogDTO().timestamp(value);
68
+ }
69
+ static id(value) {
70
+ return new _LogDTO().id(value);
71
+ }
72
+ static payload(partial) {
73
+ return new _LogDTO().payload(partial);
74
+ }
75
+ /** One-shot body input — same last-wins rules as the instance `.schema()`. */
76
+ static schema(input = {}) {
77
+ return new _LogDTO().schema(input);
78
+ }
79
+ level(value) {
80
+ this._level = value;
81
+ return this;
82
+ }
83
+ service(value) {
84
+ this._service = value;
85
+ return this;
86
+ }
87
+ env(value) {
88
+ this._env = value;
89
+ return this;
90
+ }
91
+ message(value) {
92
+ this._message = value;
93
+ return this;
94
+ }
95
+ code(value) {
96
+ this._code = value;
97
+ return this;
98
+ }
99
+ timestamp(value) {
100
+ this._timestamp = value;
101
+ return this;
102
+ }
103
+ id(value) {
104
+ this._id = value;
105
+ return this;
106
+ }
107
+ payload(partial) {
108
+ this._payload = { ...this._payload, ...partial };
109
+ return this;
110
+ }
111
+ schema(input = {}) {
112
+ const { level, service, message, env, code, timestamp, id, payload } = input;
113
+ if (level !== void 0) this.level(level);
114
+ if (service !== void 0) this.service(service);
115
+ if (env !== void 0) this.env(env);
116
+ if (message !== void 0) this.message(message);
117
+ if (code !== void 0) this.code(code);
118
+ if (timestamp !== void 0) this.timestamp(timestamp);
119
+ if (id !== void 0) this.id(id);
120
+ if (payload !== void 0) {
121
+ this._payload = { ...payload };
122
+ }
123
+ return this;
124
+ }
125
+ build() {
126
+ assertRequiredFields(
127
+ {
128
+ level: this._level,
129
+ service: this._service,
130
+ env: this._env
131
+ },
132
+ ["level", "service", "env"],
133
+ "Missing log fields"
134
+ );
135
+ const input = {
136
+ level: this._level,
137
+ service: this._service,
138
+ env: this._env,
139
+ message: this._message,
140
+ code: this._code,
141
+ timestamp: this._timestamp,
142
+ id: this._id
143
+ };
144
+ if (Object.keys(this._payload).length > 0) {
145
+ input.payload = this._payload;
146
+ }
147
+ return assembleLogBody(input);
148
+ }
149
+ };
150
+
151
+ exports.LogDTO = LogDTO;
152
+ exports.assembleLogBody = assembleLogBody;
@@ -0,0 +1,3 @@
1
+ export type { LogInput, LogBody, LogSchemaInput, ILogDTO, } from './types.js';
2
+ export { assembleLogBody } from './assemble.js';
3
+ export { LogDTO } from './builder.js';
@@ -0,0 +1,149 @@
1
+ // src/dto/log/assemble.ts
2
+ function assembleLogBody(input) {
3
+ const ordered = {
4
+ level: input.level,
5
+ service: input.service
6
+ };
7
+ if (input.message !== void 0) {
8
+ ordered.message = input.message;
9
+ }
10
+ if (input.payload !== void 0 && Object.keys(input.payload).length > 0) {
11
+ ordered.payload = input.payload;
12
+ }
13
+ if (input.code !== void 0) {
14
+ ordered.code = input.code;
15
+ }
16
+ ordered.timestamp = input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString();
17
+ if (input.id !== void 0) {
18
+ ordered.id = input.id;
19
+ }
20
+ ordered.env = input.env;
21
+ return ordered;
22
+ }
23
+
24
+ // src/dto/shared/schema-utils.ts
25
+ function assertRequiredFields(input, fields, label = "Missing required fields") {
26
+ const missing = fields.filter((field) => {
27
+ const value = input[field];
28
+ return value === void 0 || value === null || value === "";
29
+ });
30
+ if (missing.length > 0) {
31
+ throw new Error(`${label}: ${missing.join(", ")}`);
32
+ }
33
+ }
34
+
35
+ // src/dto/shared/base-dto.ts
36
+ var BaseDTO = class {
37
+ };
38
+
39
+ // src/dto/log/builder.ts
40
+ var LogDTO = class _LogDTO extends BaseDTO {
41
+ _level;
42
+ _service;
43
+ _env;
44
+ _message;
45
+ _payload = {};
46
+ _code;
47
+ _timestamp;
48
+ _id;
49
+ static level(value) {
50
+ return new _LogDTO().level(value);
51
+ }
52
+ static service(value) {
53
+ return new _LogDTO().service(value);
54
+ }
55
+ static env(value) {
56
+ return new _LogDTO().env(value);
57
+ }
58
+ static message(value) {
59
+ return new _LogDTO().message(value);
60
+ }
61
+ static code(value) {
62
+ return new _LogDTO().code(value);
63
+ }
64
+ static timestamp(value) {
65
+ return new _LogDTO().timestamp(value);
66
+ }
67
+ static id(value) {
68
+ return new _LogDTO().id(value);
69
+ }
70
+ static payload(partial) {
71
+ return new _LogDTO().payload(partial);
72
+ }
73
+ /** One-shot body input — same last-wins rules as the instance `.schema()`. */
74
+ static schema(input = {}) {
75
+ return new _LogDTO().schema(input);
76
+ }
77
+ level(value) {
78
+ this._level = value;
79
+ return this;
80
+ }
81
+ service(value) {
82
+ this._service = value;
83
+ return this;
84
+ }
85
+ env(value) {
86
+ this._env = value;
87
+ return this;
88
+ }
89
+ message(value) {
90
+ this._message = value;
91
+ return this;
92
+ }
93
+ code(value) {
94
+ this._code = value;
95
+ return this;
96
+ }
97
+ timestamp(value) {
98
+ this._timestamp = value;
99
+ return this;
100
+ }
101
+ id(value) {
102
+ this._id = value;
103
+ return this;
104
+ }
105
+ payload(partial) {
106
+ this._payload = { ...this._payload, ...partial };
107
+ return this;
108
+ }
109
+ schema(input = {}) {
110
+ const { level, service, message, env, code, timestamp, id, payload } = input;
111
+ if (level !== void 0) this.level(level);
112
+ if (service !== void 0) this.service(service);
113
+ if (env !== void 0) this.env(env);
114
+ if (message !== void 0) this.message(message);
115
+ if (code !== void 0) this.code(code);
116
+ if (timestamp !== void 0) this.timestamp(timestamp);
117
+ if (id !== void 0) this.id(id);
118
+ if (payload !== void 0) {
119
+ this._payload = { ...payload };
120
+ }
121
+ return this;
122
+ }
123
+ build() {
124
+ assertRequiredFields(
125
+ {
126
+ level: this._level,
127
+ service: this._service,
128
+ env: this._env
129
+ },
130
+ ["level", "service", "env"],
131
+ "Missing log fields"
132
+ );
133
+ const input = {
134
+ level: this._level,
135
+ service: this._service,
136
+ env: this._env,
137
+ message: this._message,
138
+ code: this._code,
139
+ timestamp: this._timestamp,
140
+ id: this._id
141
+ };
142
+ if (Object.keys(this._payload).length > 0) {
143
+ input.payload = this._payload;
144
+ }
145
+ return assembleLogBody(input);
146
+ }
147
+ };
148
+
149
+ export { LogDTO, assembleLogBody };
@@ -0,0 +1,26 @@
1
+ import type { NodeEnvEnum } from '../../enums/node-env.js';
2
+ export interface LogInput {
3
+ level: string;
4
+ service: string;
5
+ message?: string;
6
+ payload?: Record<string, unknown>;
7
+ code?: string | number;
8
+ timestamp?: string;
9
+ id?: string | number;
10
+ env: NodeEnvEnum;
11
+ }
12
+ export type LogSchemaInput = Partial<Pick<LogInput, 'level' | 'service' | 'message' | 'env' | 'code' | 'timestamp' | 'id'>> & {
13
+ payload?: Record<string, unknown>;
14
+ };
15
+ export type ILogDTO = LogInput;
16
+ /** Fixed field order: level → service → message? → payload? → code? → timestamp → id? → env */
17
+ export interface LogBody {
18
+ level: string;
19
+ service: string;
20
+ message?: string;
21
+ payload?: Record<string, unknown>;
22
+ code?: string | number;
23
+ timestamp: string;
24
+ id?: string | number;
25
+ env: NodeEnvEnum;
26
+ }
@@ -0,0 +1,2 @@
1
+ import type { QueueMessage, QueueMetadata } from './types.js';
2
+ export declare function assembleQueueMessage<P, E>(metadata: QueueMetadata<E>, payload: P): QueueMessage<P, E>;
@@ -0,0 +1,35 @@
1
+ import type { QueueMessage, QueueSchemaInput } from './types.js';
2
+ import { BaseDTO } from '../shared/base-dto.js';
3
+ /**
4
+ * Queue DTO — static chain entry points mirror metadata field order.
5
+ *
6
+ * ```typescript
7
+ * DTO.Queue.source('users-api').eventType('user.created').build()
8
+ * ```
9
+ */
10
+ export declare class QueueDTO<P = unknown, E = unknown> extends BaseDTO<QueueMessage<P, E>, QueueSchemaInput<P, E>> {
11
+ private _source?;
12
+ private _eventType?;
13
+ private _userId?;
14
+ private _correlationId?;
15
+ private _extraData?;
16
+ private _payload?;
17
+ private _timestamp?;
18
+ static source<P = unknown, E = unknown>(value: string): QueueDTO<P, E>;
19
+ static eventType<P = unknown, E = unknown>(value: string): QueueDTO<P, E>;
20
+ static userId<P = unknown, E = unknown>(value: string): QueueDTO<P, E>;
21
+ static correlationId<P = unknown, E = unknown>(value: string): QueueDTO<P, E>;
22
+ static extraData<P = unknown, E = unknown>(value: E): QueueDTO<P, E>;
23
+ static timestamp<P = unknown, E = unknown>(value: number): QueueDTO<P, E>;
24
+ static payload<P = unknown, E = unknown>(value: P): QueueDTO<P, E>;
25
+ static schema<P = unknown, E = unknown>(input?: QueueSchemaInput<P, E>): QueueDTO<P, E>;
26
+ source(value: string): this;
27
+ eventType(value: string): this;
28
+ userId(value: string): this;
29
+ correlationId(value: string): this;
30
+ extraData(value: E): this;
31
+ timestamp(value: number): this;
32
+ payload(value: P): this;
33
+ schema(input?: QueueSchemaInput<P, E>): this;
34
+ build(): QueueMessage<P, E>;
35
+ }
@@ -0,0 +1,154 @@
1
+ 'use strict';
2
+
3
+ // src/dto/queue/assemble.ts
4
+ function assembleQueueMessage(metadata, payload) {
5
+ const orderedMetadata = {
6
+ source: metadata.source,
7
+ eventType: metadata.eventType,
8
+ timestamp: metadata.timestamp,
9
+ correlationId: metadata.correlationId
10
+ };
11
+ if (metadata.userId !== void 0) {
12
+ orderedMetadata.userId = metadata.userId;
13
+ }
14
+ if (metadata.extraData !== void 0) {
15
+ orderedMetadata.extraData = metadata.extraData;
16
+ }
17
+ return {
18
+ metadata: orderedMetadata,
19
+ payload
20
+ };
21
+ }
22
+
23
+ // src/utils/helpers/uuid.ts
24
+ function generateUUID() {
25
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
26
+ return crypto.randomUUID();
27
+ }
28
+ const bytes = new Uint8Array(16);
29
+ if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
30
+ crypto.getRandomValues(bytes);
31
+ } else {
32
+ for (let i = 0; i < bytes.length; i++) {
33
+ bytes[i] = Math.floor(Math.random() * 256);
34
+ }
35
+ }
36
+ bytes[6] = bytes[6] & 15 | 64;
37
+ bytes[8] = bytes[8] & 63 | 128;
38
+ const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
39
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
40
+ }
41
+
42
+ // src/dto/shared/schema-utils.ts
43
+ function assertRequiredFields(input, fields, label = "Missing required fields") {
44
+ const missing = fields.filter((field) => {
45
+ const value = input[field];
46
+ return value === void 0 || value === null || value === "";
47
+ });
48
+ if (missing.length > 0) {
49
+ throw new Error(`${label}: ${missing.join(", ")}`);
50
+ }
51
+ }
52
+
53
+ // src/dto/shared/base-dto.ts
54
+ var BaseDTO = class {
55
+ };
56
+
57
+ // src/dto/queue/builder.ts
58
+ var QueueDTO = class _QueueDTO extends BaseDTO {
59
+ _source;
60
+ _eventType;
61
+ _userId;
62
+ _correlationId;
63
+ _extraData;
64
+ _payload;
65
+ _timestamp;
66
+ static source(value) {
67
+ return new _QueueDTO().source(value);
68
+ }
69
+ static eventType(value) {
70
+ return new _QueueDTO().eventType(value);
71
+ }
72
+ static userId(value) {
73
+ return new _QueueDTO().userId(value);
74
+ }
75
+ static correlationId(value) {
76
+ return new _QueueDTO().correlationId(value);
77
+ }
78
+ static extraData(value) {
79
+ return new _QueueDTO().extraData(value);
80
+ }
81
+ static timestamp(value) {
82
+ return new _QueueDTO().timestamp(value);
83
+ }
84
+ static payload(value) {
85
+ return new _QueueDTO().payload(value);
86
+ }
87
+ static schema(input = {}) {
88
+ return new _QueueDTO().schema(input);
89
+ }
90
+ source(value) {
91
+ this._source = value;
92
+ return this;
93
+ }
94
+ eventType(value) {
95
+ this._eventType = value;
96
+ return this;
97
+ }
98
+ userId(value) {
99
+ this._userId = value;
100
+ return this;
101
+ }
102
+ correlationId(value) {
103
+ this._correlationId = value;
104
+ return this;
105
+ }
106
+ extraData(value) {
107
+ this._extraData = value;
108
+ return this;
109
+ }
110
+ timestamp(value) {
111
+ this._timestamp = value;
112
+ return this;
113
+ }
114
+ payload(value) {
115
+ this._payload = value;
116
+ return this;
117
+ }
118
+ schema(input = {}) {
119
+ const { metadata, payload } = input;
120
+ if (metadata?.source !== void 0) this.source(metadata.source);
121
+ if (metadata?.eventType !== void 0) this.eventType(metadata.eventType);
122
+ if (metadata?.userId !== void 0) this.userId(metadata.userId);
123
+ if (metadata?.correlationId !== void 0) this.correlationId(metadata.correlationId);
124
+ if (metadata?.extraData !== void 0) this.extraData(metadata.extraData);
125
+ if (payload !== void 0) {
126
+ this._payload = payload;
127
+ }
128
+ return this;
129
+ }
130
+ build() {
131
+ assertRequiredFields(
132
+ {
133
+ source: this._source,
134
+ eventType: this._eventType
135
+ },
136
+ ["source", "eventType"],
137
+ "Missing queue metadata fields"
138
+ );
139
+ return assembleQueueMessage(
140
+ {
141
+ source: this._source,
142
+ eventType: this._eventType,
143
+ timestamp: this._timestamp ?? Date.now(),
144
+ correlationId: this._correlationId ?? generateUUID(),
145
+ userId: this._userId,
146
+ extraData: this._extraData
147
+ },
148
+ this._payload
149
+ );
150
+ }
151
+ };
152
+
153
+ exports.QueueDTO = QueueDTO;
154
+ exports.assembleQueueMessage = assembleQueueMessage;
@@ -0,0 +1,3 @@
1
+ export type { QueueMetadata, QueueMessageInput, QueueMessage, QueueSchemaInput, IMetadata, IMessageInput, } from './types.js';
2
+ export { assembleQueueMessage } from './assemble.js';
3
+ export { QueueDTO } from './builder.js';