@hazeljs/data 0.2.0-beta.37
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.
- package/LICENSE +192 -0
- package/dist/data.module.d.ts +30 -0
- package/dist/data.module.d.ts.map +1 -0
- package/dist/data.module.js +120 -0
- package/dist/data.types.d.ts +51 -0
- package/dist/data.types.d.ts.map +1 -0
- package/dist/data.types.js +5 -0
- package/dist/decorators/index.d.ts +5 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/dist/decorators/index.js +17 -0
- package/dist/decorators/pipeline.decorator.d.ts +22 -0
- package/dist/decorators/pipeline.decorator.d.ts.map +1 -0
- package/dist/decorators/pipeline.decorator.js +42 -0
- package/dist/decorators/stream.decorator.d.ts +31 -0
- package/dist/decorators/stream.decorator.d.ts.map +1 -0
- package/dist/decorators/stream.decorator.js +48 -0
- package/dist/decorators/transform.decorator.d.ts +21 -0
- package/dist/decorators/transform.decorator.d.ts.map +1 -0
- package/dist/decorators/transform.decorator.js +37 -0
- package/dist/decorators/validate.decorator.d.ts +30 -0
- package/dist/decorators/validate.decorator.d.ts.map +1 -0
- package/dist/decorators/validate.decorator.js +45 -0
- package/dist/flink.service.d.ts +50 -0
- package/dist/flink.service.d.ts.map +1 -0
- package/dist/flink.service.js +86 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -0
- package/dist/pipelines/etl.service.d.ts +20 -0
- package/dist/pipelines/etl.service.d.ts.map +1 -0
- package/dist/pipelines/etl.service.js +86 -0
- package/dist/pipelines/pipeline.base.d.ts +24 -0
- package/dist/pipelines/pipeline.base.d.ts.map +1 -0
- package/dist/pipelines/pipeline.base.js +29 -0
- package/dist/pipelines/pipeline.builder.d.ts +22 -0
- package/dist/pipelines/pipeline.builder.d.ts.map +1 -0
- package/dist/pipelines/pipeline.builder.js +62 -0
- package/dist/pipelines/stream.service.d.ts +12 -0
- package/dist/pipelines/stream.service.d.ts.map +1 -0
- package/dist/pipelines/stream.service.js +58 -0
- package/dist/quality/quality.service.d.ts +25 -0
- package/dist/quality/quality.service.d.ts.map +1 -0
- package/dist/quality/quality.service.js +87 -0
- package/dist/schema/schema.d.ts +47 -0
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/schema/schema.js +175 -0
- package/dist/streaming/flink/flink.client.d.ts +58 -0
- package/dist/streaming/flink/flink.client.d.ts.map +1 -0
- package/dist/streaming/flink/flink.client.js +104 -0
- package/dist/streaming/flink/flink.job.d.ts +28 -0
- package/dist/streaming/flink/flink.job.d.ts.map +1 -0
- package/dist/streaming/flink/flink.job.js +27 -0
- package/dist/streaming/flink/flink.operators.d.ts +35 -0
- package/dist/streaming/flink/flink.operators.d.ts.map +1 -0
- package/dist/streaming/flink/flink.operators.js +43 -0
- package/dist/streaming/stream.builder.d.ts +22 -0
- package/dist/streaming/stream.builder.d.ts.map +1 -0
- package/dist/streaming/stream.builder.js +50 -0
- package/dist/streaming/stream.processor.d.ts +12 -0
- package/dist/streaming/stream.processor.d.ts.map +1 -0
- package/dist/streaming/stream.processor.js +31 -0
- package/dist/transformers/built-in.transformers.d.ts +12 -0
- package/dist/transformers/built-in.transformers.d.ts.map +1 -0
- package/dist/transformers/built-in.transformers.js +75 -0
- package/dist/transformers/transformer.service.d.ts +14 -0
- package/dist/transformers/transformer.service.d.ts.map +1 -0
- package/dist/transformers/transformer.service.js +65 -0
- package/dist/validators/schema.validator.d.ts +21 -0
- package/dist/validators/schema.validator.d.ts.map +1 -0
- package/dist/validators/schema.validator.js +40 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2024 HazelJS Team
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
22
|
+
|
|
23
|
+
1. Definitions.
|
|
24
|
+
|
|
25
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
26
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
27
|
+
|
|
28
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
29
|
+
the copyright owner that is granting the License.
|
|
30
|
+
|
|
31
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
32
|
+
other entities that control, are controlled by, or are under common
|
|
33
|
+
control with that entity. For the purposes of this definition,
|
|
34
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
35
|
+
direction or management of such entity, whether by contract or
|
|
36
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
37
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
38
|
+
|
|
39
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
40
|
+
exercising permissions granted by this License.
|
|
41
|
+
|
|
42
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
43
|
+
including but not limited to software source code, documentation
|
|
44
|
+
source, and configuration files.
|
|
45
|
+
|
|
46
|
+
"Object" form shall mean any form resulting from mechanical
|
|
47
|
+
transformation or translation of a Source form, including but
|
|
48
|
+
not limited to compiled object code, generated documentation,
|
|
49
|
+
and conversions to other media types.
|
|
50
|
+
|
|
51
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
52
|
+
Object form, made available under the License, as indicated by a
|
|
53
|
+
copyright notice that is included in or attached to the work
|
|
54
|
+
(an example is provided in the Appendix below).
|
|
55
|
+
|
|
56
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
57
|
+
form, that is based on (or derived from) the Work and for which the
|
|
58
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
59
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
60
|
+
of this License, Derivative Works shall not include works that remain
|
|
61
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
62
|
+
the Work and Derivative Works thereof.
|
|
63
|
+
|
|
64
|
+
"Contribution" shall mean any work of authorship, including
|
|
65
|
+
the original version of the Work and any modifications or additions
|
|
66
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
67
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
68
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
69
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
70
|
+
means any form of electronic, verbal, or written communication sent
|
|
71
|
+
to the Licensor or its representatives, including but not limited to
|
|
72
|
+
communication on electronic mailing lists, source code control systems,
|
|
73
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
74
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
75
|
+
excluding communication that is conspicuously marked or otherwise
|
|
76
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
77
|
+
|
|
78
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
79
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
80
|
+
subsequently incorporated within the Work.
|
|
81
|
+
|
|
82
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
83
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
84
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
85
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
86
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
87
|
+
Work and such Derivative Works in Source or Object form.
|
|
88
|
+
|
|
89
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
90
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
91
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
92
|
+
(except as stated in this section) patent license to make, have made,
|
|
93
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
94
|
+
where such license applies only to those patent claims licensable
|
|
95
|
+
by such Contributor that are necessarily infringed by their
|
|
96
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
97
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
98
|
+
institute patent litigation against any entity (including a
|
|
99
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
100
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
101
|
+
or contributory patent infringement, then any patent licenses
|
|
102
|
+
granted to You under this License for that Work shall terminate
|
|
103
|
+
as of the date such litigation is filed.
|
|
104
|
+
|
|
105
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
106
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
107
|
+
modifications, and in Source or Object form, provided that You
|
|
108
|
+
meet the following conditions:
|
|
109
|
+
|
|
110
|
+
(a) You must give any other recipients of the Work or
|
|
111
|
+
Derivative Works a copy of this License; and
|
|
112
|
+
|
|
113
|
+
(b) You must cause any modified files to carry prominent notices
|
|
114
|
+
stating that You changed the files; and
|
|
115
|
+
|
|
116
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
117
|
+
that You distribute, all copyright, patent, trademark, and
|
|
118
|
+
attribution notices from the Source form of the Work,
|
|
119
|
+
excluding those notices that do not pertain to any part of
|
|
120
|
+
the Derivative Works; and
|
|
121
|
+
|
|
122
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
123
|
+
distribution, then any Derivative Works that You distribute must
|
|
124
|
+
include a readable copy of the attribution notices contained
|
|
125
|
+
within such NOTICE file, excluding those notices that do not
|
|
126
|
+
pertain to any part of the Derivative Works, in at least one
|
|
127
|
+
of the following places: within a NOTICE text file distributed
|
|
128
|
+
as part of the Derivative Works; within the Source form or
|
|
129
|
+
documentation, if provided along with the Derivative Works; or,
|
|
130
|
+
within a display generated by the Derivative Works, if and
|
|
131
|
+
wherever such third-party notices normally appear. The contents
|
|
132
|
+
of the NOTICE file are for informational purposes only and
|
|
133
|
+
do not modify the License. You may add Your own attribution
|
|
134
|
+
notices within Derivative Works that You distribute, alongside
|
|
135
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
136
|
+
that such additional attribution notices cannot be construed
|
|
137
|
+
as modifying the License.
|
|
138
|
+
|
|
139
|
+
You may add Your own copyright statement to Your modifications and
|
|
140
|
+
may provide additional or different license terms and conditions
|
|
141
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
142
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
143
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
144
|
+
the conditions stated in this License.
|
|
145
|
+
|
|
146
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
147
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
148
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
149
|
+
this License, without any additional terms or conditions.
|
|
150
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
151
|
+
the terms of any separate license agreement you may have executed
|
|
152
|
+
with Licensor regarding such Contributions.
|
|
153
|
+
|
|
154
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
155
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
156
|
+
except as required for reasonable and customary use in describing the
|
|
157
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
158
|
+
|
|
159
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
160
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
161
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
162
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
163
|
+
implied, including, without limitation, any warranties or conditions
|
|
164
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
165
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
166
|
+
appropriateness of using or redistributing the Work and assume any
|
|
167
|
+
risks associated with Your exercise of permissions under this License.
|
|
168
|
+
|
|
169
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
170
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
171
|
+
unless required by applicable law (such as deliberate and grossly
|
|
172
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
173
|
+
liable to You for damages, including any direct, indirect, special,
|
|
174
|
+
incidental, or consequential damages of any character arising as a
|
|
175
|
+
result of this License or out of the use or inability to use the
|
|
176
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
177
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
178
|
+
other commercial damages or losses), even if such Contributor
|
|
179
|
+
has been advised of the possibility of such damages.
|
|
180
|
+
|
|
181
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
182
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
183
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
184
|
+
or other liability obligations and/or rights consistent with this
|
|
185
|
+
License. However, in accepting such obligations, You may act only
|
|
186
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
187
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
188
|
+
defend, and hold each Contributor harmless for any liability
|
|
189
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
190
|
+
of your accepting any such warranty or additional liability.
|
|
191
|
+
|
|
192
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FlinkClientConfig } from './streaming/flink/flink.client';
|
|
2
|
+
export declare const DATA_FLINK_CONFIG: unique symbol;
|
|
3
|
+
export interface DataModuleOptions {
|
|
4
|
+
flink?: FlinkClientConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare class DataModule {
|
|
7
|
+
private static options;
|
|
8
|
+
/**
|
|
9
|
+
* Configure DataModule with optional Flink connection
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* imports: [
|
|
14
|
+
* DataModule.forRoot({
|
|
15
|
+
* flink: {
|
|
16
|
+
* url: process.env.FLINK_REST_URL || 'http://localhost:8081',
|
|
17
|
+
* timeout: 30000,
|
|
18
|
+
* },
|
|
19
|
+
* }),
|
|
20
|
+
* ]
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
static forRoot(options?: DataModuleOptions): {
|
|
24
|
+
module: typeof DataModule;
|
|
25
|
+
providers: unknown[];
|
|
26
|
+
exports: unknown[];
|
|
27
|
+
};
|
|
28
|
+
static getOptions(): DataModuleOptions;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=data.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.module.d.ts","sourceRoot":"","sources":["../src/data.module.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE,eAAO,MAAM,iBAAiB,eAAoC,CAAC;AAEnE,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAcD,qBAwBa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAyB;IAE/C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,iBAAsB,GAAG;QAC/C,MAAM,EAAE,OAAO,UAAU,CAAC;QAC1B,SAAS,EAAE,OAAO,EAAE,CAAC;QACrB,OAAO,EAAE,OAAO,EAAE,CAAC;KACpB;IAkCD,MAAM,CAAC,UAAU,IAAI,iBAAiB;CAGvC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var DataModule_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.DataModule = exports.DATA_FLINK_CONFIG = void 0;
|
|
17
|
+
const core_1 = require("@hazeljs/core");
|
|
18
|
+
const schema_validator_1 = require("./validators/schema.validator");
|
|
19
|
+
const etl_service_1 = require("./pipelines/etl.service");
|
|
20
|
+
const pipeline_builder_1 = require("./pipelines/pipeline.builder");
|
|
21
|
+
const stream_service_1 = require("./pipelines/stream.service");
|
|
22
|
+
const stream_builder_1 = require("./streaming/stream.builder");
|
|
23
|
+
const stream_processor_1 = require("./streaming/stream.processor");
|
|
24
|
+
const transformer_service_1 = require("./transformers/transformer.service");
|
|
25
|
+
const quality_service_1 = require("./quality/quality.service");
|
|
26
|
+
const flink_service_1 = require("./flink.service");
|
|
27
|
+
exports.DATA_FLINK_CONFIG = Symbol('hazel:data:flink-config');
|
|
28
|
+
let DataFlinkBootstrap = class DataFlinkBootstrap {
|
|
29
|
+
constructor(flinkService, config) {
|
|
30
|
+
this.flinkService = flinkService;
|
|
31
|
+
this.config = config;
|
|
32
|
+
if (this.config) {
|
|
33
|
+
this.flinkService.configure(this.config);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
DataFlinkBootstrap = __decorate([
|
|
38
|
+
(0, core_1.Injectable)(),
|
|
39
|
+
__param(1, (0, core_1.Inject)(exports.DATA_FLINK_CONFIG)),
|
|
40
|
+
__metadata("design:paramtypes", [flink_service_1.FlinkService, Object])
|
|
41
|
+
], DataFlinkBootstrap);
|
|
42
|
+
let DataModule = DataModule_1 = class DataModule {
|
|
43
|
+
/**
|
|
44
|
+
* Configure DataModule with optional Flink connection
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* imports: [
|
|
49
|
+
* DataModule.forRoot({
|
|
50
|
+
* flink: {
|
|
51
|
+
* url: process.env.FLINK_REST_URL || 'http://localhost:8081',
|
|
52
|
+
* timeout: 30000,
|
|
53
|
+
* },
|
|
54
|
+
* }),
|
|
55
|
+
* ]
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
static forRoot(options = {}) {
|
|
59
|
+
DataModule_1.options = options;
|
|
60
|
+
const providers = [
|
|
61
|
+
schema_validator_1.SchemaValidator,
|
|
62
|
+
etl_service_1.ETLService,
|
|
63
|
+
pipeline_builder_1.PipelineBuilder,
|
|
64
|
+
stream_service_1.StreamService,
|
|
65
|
+
stream_builder_1.StreamBuilder,
|
|
66
|
+
stream_processor_1.StreamProcessor,
|
|
67
|
+
transformer_service_1.TransformerService,
|
|
68
|
+
quality_service_1.QualityService,
|
|
69
|
+
flink_service_1.FlinkService,
|
|
70
|
+
{ provide: exports.DATA_FLINK_CONFIG, useValue: options.flink ?? null },
|
|
71
|
+
DataFlinkBootstrap,
|
|
72
|
+
];
|
|
73
|
+
return {
|
|
74
|
+
module: DataModule_1,
|
|
75
|
+
providers,
|
|
76
|
+
exports: [
|
|
77
|
+
schema_validator_1.SchemaValidator,
|
|
78
|
+
etl_service_1.ETLService,
|
|
79
|
+
pipeline_builder_1.PipelineBuilder,
|
|
80
|
+
stream_service_1.StreamService,
|
|
81
|
+
stream_builder_1.StreamBuilder,
|
|
82
|
+
stream_processor_1.StreamProcessor,
|
|
83
|
+
transformer_service_1.TransformerService,
|
|
84
|
+
quality_service_1.QualityService,
|
|
85
|
+
flink_service_1.FlinkService,
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
static getOptions() {
|
|
90
|
+
return DataModule_1.options;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
exports.DataModule = DataModule;
|
|
94
|
+
DataModule.options = {};
|
|
95
|
+
exports.DataModule = DataModule = DataModule_1 = __decorate([
|
|
96
|
+
(0, core_1.HazelModule)({
|
|
97
|
+
providers: [
|
|
98
|
+
schema_validator_1.SchemaValidator,
|
|
99
|
+
etl_service_1.ETLService,
|
|
100
|
+
pipeline_builder_1.PipelineBuilder,
|
|
101
|
+
stream_service_1.StreamService,
|
|
102
|
+
stream_builder_1.StreamBuilder,
|
|
103
|
+
stream_processor_1.StreamProcessor,
|
|
104
|
+
transformer_service_1.TransformerService,
|
|
105
|
+
quality_service_1.QualityService,
|
|
106
|
+
flink_service_1.FlinkService,
|
|
107
|
+
],
|
|
108
|
+
exports: [
|
|
109
|
+
schema_validator_1.SchemaValidator,
|
|
110
|
+
etl_service_1.ETLService,
|
|
111
|
+
pipeline_builder_1.PipelineBuilder,
|
|
112
|
+
stream_service_1.StreamService,
|
|
113
|
+
stream_builder_1.StreamBuilder,
|
|
114
|
+
stream_processor_1.StreamProcessor,
|
|
115
|
+
transformer_service_1.TransformerService,
|
|
116
|
+
quality_service_1.QualityService,
|
|
117
|
+
flink_service_1.FlinkService,
|
|
118
|
+
],
|
|
119
|
+
})
|
|
120
|
+
], DataModule);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hazeljs/data - Type definitions for ETL and streaming
|
|
3
|
+
*/
|
|
4
|
+
export interface PipelineStepMetadata {
|
|
5
|
+
step: number;
|
|
6
|
+
name: string;
|
|
7
|
+
type: 'transform' | 'validate';
|
|
8
|
+
schema?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface StreamMetadata {
|
|
11
|
+
name: string;
|
|
12
|
+
source: string;
|
|
13
|
+
sink: string;
|
|
14
|
+
parallelism?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface FlinkJobConfig {
|
|
17
|
+
jobName?: string;
|
|
18
|
+
parallelism?: number;
|
|
19
|
+
checkpointInterval?: number;
|
|
20
|
+
restartStrategy?: {
|
|
21
|
+
type: string;
|
|
22
|
+
attempts?: number;
|
|
23
|
+
delay?: number;
|
|
24
|
+
};
|
|
25
|
+
resources?: {
|
|
26
|
+
taskManagerMemory?: string;
|
|
27
|
+
jobManagerMemory?: string;
|
|
28
|
+
cpuCores?: number;
|
|
29
|
+
};
|
|
30
|
+
stateBackend?: {
|
|
31
|
+
type: string;
|
|
32
|
+
checkpointPath?: string;
|
|
33
|
+
savepointPath?: string;
|
|
34
|
+
};
|
|
35
|
+
highAvailability?: {
|
|
36
|
+
type: string;
|
|
37
|
+
zookeeperQuorum?: string;
|
|
38
|
+
clusterId?: string;
|
|
39
|
+
};
|
|
40
|
+
metrics?: {
|
|
41
|
+
reporters?: string[];
|
|
42
|
+
interval?: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface FlinkAuthConfig {
|
|
46
|
+
type: 'basic' | 'token' | 'oauth';
|
|
47
|
+
username?: string;
|
|
48
|
+
password?: string;
|
|
49
|
+
token?: string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=data.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.types.d.ts","sourceRoot":"","sources":["../src/data.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,SAAS,CAAC,EAAE;QACV,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,YAAY,CAAC,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,gBAAgB,CAAC,EAAE;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Pipeline, getPipelineMetadata, hasPipelineMetadata, type PipelineOptions, } from './pipeline.decorator';
|
|
2
|
+
export { Transform, getTransformMetadata, type TransformOptions } from './transform.decorator';
|
|
3
|
+
export { Validate, getValidateMetadata, type ValidateOptions } from './validate.decorator';
|
|
4
|
+
export { Stream, getStreamMetadata, hasStreamMetadata, type StreamOptions, } from './stream.decorator';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasStreamMetadata = exports.getStreamMetadata = exports.Stream = exports.getValidateMetadata = exports.Validate = exports.getTransformMetadata = exports.Transform = exports.hasPipelineMetadata = exports.getPipelineMetadata = exports.Pipeline = void 0;
|
|
4
|
+
var pipeline_decorator_1 = require("./pipeline.decorator");
|
|
5
|
+
Object.defineProperty(exports, "Pipeline", { enumerable: true, get: function () { return pipeline_decorator_1.Pipeline; } });
|
|
6
|
+
Object.defineProperty(exports, "getPipelineMetadata", { enumerable: true, get: function () { return pipeline_decorator_1.getPipelineMetadata; } });
|
|
7
|
+
Object.defineProperty(exports, "hasPipelineMetadata", { enumerable: true, get: function () { return pipeline_decorator_1.hasPipelineMetadata; } });
|
|
8
|
+
var transform_decorator_1 = require("./transform.decorator");
|
|
9
|
+
Object.defineProperty(exports, "Transform", { enumerable: true, get: function () { return transform_decorator_1.Transform; } });
|
|
10
|
+
Object.defineProperty(exports, "getTransformMetadata", { enumerable: true, get: function () { return transform_decorator_1.getTransformMetadata; } });
|
|
11
|
+
var validate_decorator_1 = require("./validate.decorator");
|
|
12
|
+
Object.defineProperty(exports, "Validate", { enumerable: true, get: function () { return validate_decorator_1.Validate; } });
|
|
13
|
+
Object.defineProperty(exports, "getValidateMetadata", { enumerable: true, get: function () { return validate_decorator_1.getValidateMetadata; } });
|
|
14
|
+
var stream_decorator_1 = require("./stream.decorator");
|
|
15
|
+
Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return stream_decorator_1.Stream; } });
|
|
16
|
+
Object.defineProperty(exports, "getStreamMetadata", { enumerable: true, get: function () { return stream_decorator_1.getStreamMetadata; } });
|
|
17
|
+
Object.defineProperty(exports, "hasStreamMetadata", { enumerable: true, get: function () { return stream_decorator_1.hasStreamMetadata; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
export interface PipelineOptions {
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @Pipeline decorator - Mark a class as an ETL pipeline with sequential step execution
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Pipeline('user-enrichment')
|
|
11
|
+
* @Injectable()
|
|
12
|
+
* export class UserEnrichmentPipeline {
|
|
13
|
+
* @Transform({ step: 1, name: 'normalize' }) async normalize(data) { ... }
|
|
14
|
+
* @Validate({ step: 2, name: 'validate', schema: Schema.object({...}) }) async validate(data) { ... }
|
|
15
|
+
* @Transform({ step: 3, name: 'enrich' }) async enrich(data) { ... }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function Pipeline(nameOrOptions?: string | PipelineOptions): ClassDecorator;
|
|
20
|
+
export declare function getPipelineMetadata(target: object): PipelineOptions | undefined;
|
|
21
|
+
export declare function hasPipelineMetadata(target: object): boolean;
|
|
22
|
+
//# sourceMappingURL=pipeline.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/pipeline.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,cAAc,CAWjF;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAE/E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Pipeline = Pipeline;
|
|
7
|
+
exports.getPipelineMetadata = getPipelineMetadata;
|
|
8
|
+
exports.hasPipelineMetadata = hasPipelineMetadata;
|
|
9
|
+
require("reflect-metadata");
|
|
10
|
+
const core_1 = __importDefault(require("@hazeljs/core"));
|
|
11
|
+
const PIPELINE_METADATA_KEY = 'hazel:data:pipeline';
|
|
12
|
+
/**
|
|
13
|
+
* @Pipeline decorator - Mark a class as an ETL pipeline with sequential step execution
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* @Pipeline('user-enrichment')
|
|
18
|
+
* @Injectable()
|
|
19
|
+
* export class UserEnrichmentPipeline {
|
|
20
|
+
* @Transform({ step: 1, name: 'normalize' }) async normalize(data) { ... }
|
|
21
|
+
* @Validate({ step: 2, name: 'validate', schema: Schema.object({...}) }) async validate(data) { ... }
|
|
22
|
+
* @Transform({ step: 3, name: 'enrich' }) async enrich(data) { ... }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function Pipeline(nameOrOptions) {
|
|
27
|
+
return (target) => {
|
|
28
|
+
const options = typeof nameOrOptions === 'string' ? { name: nameOrOptions } : nameOrOptions || {};
|
|
29
|
+
const metadata = {
|
|
30
|
+
name: options.name ?? target.constructor.name,
|
|
31
|
+
...options,
|
|
32
|
+
};
|
|
33
|
+
Reflect.defineMetadata(PIPELINE_METADATA_KEY, metadata, target);
|
|
34
|
+
core_1.default.debug(`Pipeline decorator applied: ${metadata.name}`);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getPipelineMetadata(target) {
|
|
38
|
+
return Reflect.getMetadata(PIPELINE_METADATA_KEY, target);
|
|
39
|
+
}
|
|
40
|
+
function hasPipelineMetadata(target) {
|
|
41
|
+
return Reflect.hasMetadata(PIPELINE_METADATA_KEY, target);
|
|
42
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { StreamMetadata } from '../data.types';
|
|
3
|
+
export interface StreamOptions {
|
|
4
|
+
name: string;
|
|
5
|
+
source: string;
|
|
6
|
+
sink: string;
|
|
7
|
+
parallelism?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @Stream decorator - Streaming pipeline with Flink
|
|
11
|
+
* For real-time stream processing
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* @Stream({
|
|
16
|
+
* name: 'user-events-stream',
|
|
17
|
+
* source: 'kafka://user-events',
|
|
18
|
+
* sink: 'kafka://processed-events',
|
|
19
|
+
* parallelism: 4,
|
|
20
|
+
* })
|
|
21
|
+
* @Injectable()
|
|
22
|
+
* export class UserEventsStreamPipeline {
|
|
23
|
+
* @Transform({ step: 1, name: 'parse' }) async parseEvent(event) { ... }
|
|
24
|
+
* @Transform({ step: 2, name: 'enrich' }) async enrich(event) { ... }
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function Stream(options: StreamOptions): ClassDecorator;
|
|
29
|
+
export declare function getStreamMetadata(target: object): StreamMetadata | undefined;
|
|
30
|
+
export declare function hasStreamMetadata(target: object): boolean;
|
|
31
|
+
//# sourceMappingURL=stream.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/stream.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAW7D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE5E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Stream = Stream;
|
|
7
|
+
exports.getStreamMetadata = getStreamMetadata;
|
|
8
|
+
exports.hasStreamMetadata = hasStreamMetadata;
|
|
9
|
+
require("reflect-metadata");
|
|
10
|
+
const core_1 = __importDefault(require("@hazeljs/core"));
|
|
11
|
+
const STREAM_METADATA_KEY = 'hazel:data:stream';
|
|
12
|
+
/**
|
|
13
|
+
* @Stream decorator - Streaming pipeline with Flink
|
|
14
|
+
* For real-time stream processing
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* @Stream({
|
|
19
|
+
* name: 'user-events-stream',
|
|
20
|
+
* source: 'kafka://user-events',
|
|
21
|
+
* sink: 'kafka://processed-events',
|
|
22
|
+
* parallelism: 4,
|
|
23
|
+
* })
|
|
24
|
+
* @Injectable()
|
|
25
|
+
* export class UserEventsStreamPipeline {
|
|
26
|
+
* @Transform({ step: 1, name: 'parse' }) async parseEvent(event) { ... }
|
|
27
|
+
* @Transform({ step: 2, name: 'enrich' }) async enrich(event) { ... }
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
function Stream(options) {
|
|
32
|
+
return (target) => {
|
|
33
|
+
const metadata = {
|
|
34
|
+
name: options.name,
|
|
35
|
+
source: options.source,
|
|
36
|
+
sink: options.sink,
|
|
37
|
+
parallelism: options.parallelism ?? 4,
|
|
38
|
+
};
|
|
39
|
+
Reflect.defineMetadata(STREAM_METADATA_KEY, metadata, target);
|
|
40
|
+
core_1.default.debug(`Stream decorator applied: ${metadata.name}`);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function getStreamMetadata(target) {
|
|
44
|
+
return Reflect.getMetadata(STREAM_METADATA_KEY, target);
|
|
45
|
+
}
|
|
46
|
+
function hasStreamMetadata(target) {
|
|
47
|
+
return Reflect.hasMetadata(STREAM_METADATA_KEY, target);
|
|
48
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import type { PipelineStepMetadata } from '../data.types';
|
|
3
|
+
export interface TransformOptions {
|
|
4
|
+
step: number;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @Transform decorator - Data transformation with step ordering
|
|
9
|
+
* Output from step N feeds as input to step N+1
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* @Transform({ step: 1, name: 'normalize' })
|
|
14
|
+
* async normalize(data: any) {
|
|
15
|
+
* return { ...data, email: data.email.toLowerCase() };
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function Transform(options: TransformOptions): MethodDecorator;
|
|
20
|
+
export declare function getTransformMetadata(target: object, propertyKey: string | symbol): PipelineStepMetadata | undefined;
|
|
21
|
+
//# sourceMappingURL=transform.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/transform.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAI1D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAapE;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,oBAAoB,GAAG,SAAS,CAElC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Transform = Transform;
|
|
7
|
+
exports.getTransformMetadata = getTransformMetadata;
|
|
8
|
+
require("reflect-metadata");
|
|
9
|
+
const core_1 = __importDefault(require("@hazeljs/core"));
|
|
10
|
+
const TRANSFORM_METADATA_KEY = 'hazel:data:transform';
|
|
11
|
+
/**
|
|
12
|
+
* @Transform decorator - Data transformation with step ordering
|
|
13
|
+
* Output from step N feeds as input to step N+1
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* @Transform({ step: 1, name: 'normalize' })
|
|
18
|
+
* async normalize(data: any) {
|
|
19
|
+
* return { ...data, email: data.email.toLowerCase() };
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function Transform(options) {
|
|
24
|
+
return (target, propertyKey, descriptor) => {
|
|
25
|
+
const metadata = {
|
|
26
|
+
step: options.step,
|
|
27
|
+
name: options.name,
|
|
28
|
+
type: 'transform',
|
|
29
|
+
};
|
|
30
|
+
Reflect.defineMetadata(TRANSFORM_METADATA_KEY, metadata, target, propertyKey);
|
|
31
|
+
core_1.default.debug(`Transform decorator applied: ${target.constructor.name}.${String(propertyKey)} step=${options.step}`);
|
|
32
|
+
return descriptor;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function getTransformMetadata(target, propertyKey) {
|
|
36
|
+
return Reflect.getMetadata(TRANSFORM_METADATA_KEY, target, propertyKey);
|
|
37
|
+
}
|