@hazeljs/data 0.2.0-beta.68 → 0.2.0-beta.69
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/README.md +175 -61
- package/dist/connectors/connector.interface.d.ts +29 -0
- package/dist/connectors/connector.interface.d.ts.map +1 -0
- package/dist/connectors/connector.interface.js +6 -0
- package/dist/connectors/csv.connector.d.ts +63 -0
- package/dist/connectors/csv.connector.d.ts.map +1 -0
- package/dist/connectors/csv.connector.js +147 -0
- package/dist/connectors/http.connector.d.ts +68 -0
- package/dist/connectors/http.connector.d.ts.map +1 -0
- package/dist/connectors/http.connector.js +131 -0
- package/dist/connectors/index.d.ts +7 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/index.js +12 -0
- package/dist/connectors/memory.connector.d.ts +38 -0
- package/dist/connectors/memory.connector.d.ts.map +1 -0
- package/dist/connectors/memory.connector.js +56 -0
- package/dist/connectors/memory.connector.test.d.ts +2 -0
- package/dist/connectors/memory.connector.test.d.ts.map +1 -0
- package/dist/connectors/memory.connector.test.js +43 -0
- package/dist/data.types.d.ts +16 -0
- package/dist/data.types.d.ts.map +1 -1
- package/dist/decorators/index.d.ts +1 -0
- package/dist/decorators/index.d.ts.map +1 -1
- package/dist/decorators/index.js +8 -1
- package/dist/decorators/pii.decorator.d.ts +59 -0
- package/dist/decorators/pii.decorator.d.ts.map +1 -0
- package/dist/decorators/pii.decorator.js +197 -0
- package/dist/decorators/pii.decorator.test.d.ts +2 -0
- package/dist/decorators/pii.decorator.test.d.ts.map +1 -0
- package/dist/decorators/pii.decorator.test.js +150 -0
- package/dist/decorators/pipeline.decorator.js +1 -1
- package/dist/decorators/pipeline.decorator.test.js +8 -0
- package/dist/decorators/transform.decorator.d.ts +9 -1
- package/dist/decorators/transform.decorator.d.ts.map +1 -1
- package/dist/decorators/transform.decorator.js +4 -0
- package/dist/decorators/validate.decorator.d.ts +5 -1
- package/dist/decorators/validate.decorator.d.ts.map +1 -1
- package/dist/decorators/validate.decorator.js +4 -0
- package/dist/flink.service.d.ts +30 -0
- package/dist/flink.service.d.ts.map +1 -1
- package/dist/flink.service.js +50 -2
- package/dist/index.d.ts +13 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -8
- package/dist/pipelines/etl.service.d.ts +41 -2
- package/dist/pipelines/etl.service.d.ts.map +1 -1
- package/dist/pipelines/etl.service.js +143 -6
- package/dist/pipelines/etl.service.test.js +215 -0
- package/dist/pipelines/pipeline.builder.d.ts +86 -13
- package/dist/pipelines/pipeline.builder.d.ts.map +1 -1
- package/dist/pipelines/pipeline.builder.js +177 -27
- package/dist/pipelines/pipeline.builder.test.js +160 -12
- package/dist/pipelines/stream.service.test.js +49 -0
- package/dist/quality/quality.service.d.ts +67 -5
- package/dist/quality/quality.service.d.ts.map +1 -1
- package/dist/quality/quality.service.js +259 -20
- package/dist/quality/quality.service.test.js +94 -0
- package/dist/schema/schema.d.ts +92 -12
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +395 -83
- package/dist/schema/schema.test.js +292 -0
- package/dist/streaming/flink/flink.client.d.ts +41 -3
- package/dist/streaming/flink/flink.client.d.ts.map +1 -1
- package/dist/streaming/flink/flink.client.js +171 -8
- package/dist/streaming/flink/flink.client.test.js +2 -2
- package/dist/streaming/flink/flink.job.d.ts +2 -1
- package/dist/streaming/flink/flink.job.d.ts.map +1 -1
- package/dist/streaming/flink/flink.job.js +2 -2
- package/dist/streaming/stream.processor.d.ts +56 -2
- package/dist/streaming/stream.processor.d.ts.map +1 -1
- package/dist/streaming/stream.processor.js +149 -2
- package/dist/streaming/stream.processor.test.js +99 -0
- package/dist/streaming/stream.processor.windowing.test.d.ts +2 -0
- package/dist/streaming/stream.processor.windowing.test.d.ts.map +1 -0
- package/dist/streaming/stream.processor.windowing.test.js +69 -0
- package/dist/telemetry/telemetry.d.ts +124 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -0
- package/dist/telemetry/telemetry.js +259 -0
- package/dist/telemetry/telemetry.test.d.ts +2 -0
- package/dist/telemetry/telemetry.test.d.ts.map +1 -0
- package/dist/telemetry/telemetry.test.js +51 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +18 -0
- package/dist/testing/pipeline-test-harness.d.ts +40 -0
- package/dist/testing/pipeline-test-harness.d.ts.map +1 -0
- package/dist/testing/pipeline-test-harness.js +55 -0
- package/dist/testing/pipeline-test-harness.test.d.ts +2 -0
- package/dist/testing/pipeline-test-harness.test.d.ts.map +1 -0
- package/dist/testing/pipeline-test-harness.test.js +102 -0
- package/dist/testing/schema-faker.d.ts +32 -0
- package/dist/testing/schema-faker.d.ts.map +1 -0
- package/dist/testing/schema-faker.js +91 -0
- package/dist/testing/schema-faker.test.d.ts +2 -0
- package/dist/testing/schema-faker.test.d.ts.map +1 -0
- package/dist/testing/schema-faker.test.js +66 -0
- package/dist/transformers/built-in.transformers.test.js +28 -0
- package/dist/transformers/transformer.service.test.js +10 -0
- package/package.json +2 -2
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const pipeline_decorator_1 = require("./pipeline.decorator");
|
|
13
|
+
const transform_decorator_1 = require("./transform.decorator");
|
|
14
|
+
const pii_decorator_1 = require("./pii.decorator");
|
|
15
|
+
const etl_service_1 = require("../pipelines/etl.service");
|
|
16
|
+
const schema_validator_1 = require("../validators/schema.validator");
|
|
17
|
+
let MaskPipeline = class MaskPipeline {
|
|
18
|
+
mask(data) {
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, transform_decorator_1.Transform)({ step: 1, name: 'mask' }),
|
|
24
|
+
(0, pii_decorator_1.Mask)({ fields: ['email', 'ssn'] }),
|
|
25
|
+
__metadata("design:type", Function),
|
|
26
|
+
__metadata("design:paramtypes", [Object]),
|
|
27
|
+
__metadata("design:returntype", void 0)
|
|
28
|
+
], MaskPipeline.prototype, "mask", null);
|
|
29
|
+
MaskPipeline = __decorate([
|
|
30
|
+
(0, pipeline_decorator_1.Pipeline)('mask-pipeline')
|
|
31
|
+
], MaskPipeline);
|
|
32
|
+
let MaskShowLastPipeline = class MaskShowLastPipeline {
|
|
33
|
+
mask(data) {
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, transform_decorator_1.Transform)({ step: 1, name: 'mask' }),
|
|
39
|
+
(0, pii_decorator_1.Mask)({ fields: ['phone'], replacement: '***', showLast: 4 }),
|
|
40
|
+
__metadata("design:type", Function),
|
|
41
|
+
__metadata("design:paramtypes", [Object]),
|
|
42
|
+
__metadata("design:returntype", void 0)
|
|
43
|
+
], MaskShowLastPipeline.prototype, "mask", null);
|
|
44
|
+
MaskShowLastPipeline = __decorate([
|
|
45
|
+
(0, pipeline_decorator_1.Pipeline)('mask-showlast')
|
|
46
|
+
], MaskShowLastPipeline);
|
|
47
|
+
let RedactPipeline = class RedactPipeline {
|
|
48
|
+
redact(data) {
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, transform_decorator_1.Transform)({ step: 1, name: 'redact' }),
|
|
54
|
+
(0, pii_decorator_1.Redact)({ fields: ['password', 'secret'] }),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", [Object]),
|
|
57
|
+
__metadata("design:returntype", void 0)
|
|
58
|
+
], RedactPipeline.prototype, "redact", null);
|
|
59
|
+
RedactPipeline = __decorate([
|
|
60
|
+
(0, pipeline_decorator_1.Pipeline)('redact-pipeline')
|
|
61
|
+
], RedactPipeline);
|
|
62
|
+
describe('@Mask decorator', () => {
|
|
63
|
+
it('masks specified fields', async () => {
|
|
64
|
+
const etl = new etl_service_1.ETLService(new schema_validator_1.SchemaValidator());
|
|
65
|
+
const pipeline = new MaskPipeline();
|
|
66
|
+
const result = await etl.execute(pipeline, {
|
|
67
|
+
email: 'user@example.com',
|
|
68
|
+
ssn: '123-45-6789',
|
|
69
|
+
name: 'John',
|
|
70
|
+
});
|
|
71
|
+
expect(result.email).toBe('****');
|
|
72
|
+
expect(result.ssn).toBe('****');
|
|
73
|
+
expect(result.name).toBe('John');
|
|
74
|
+
});
|
|
75
|
+
it('showLast shows last N chars', async () => {
|
|
76
|
+
const etl = new etl_service_1.ETLService(new schema_validator_1.SchemaValidator());
|
|
77
|
+
const pipeline = new MaskShowLastPipeline();
|
|
78
|
+
const result = await etl.execute(pipeline, {
|
|
79
|
+
phone: '1234567890',
|
|
80
|
+
});
|
|
81
|
+
expect(result.phone).toBe('***7890');
|
|
82
|
+
});
|
|
83
|
+
it('getMaskMetadata returns options', () => {
|
|
84
|
+
const meta = (0, pii_decorator_1.getMaskMetadata)(MaskPipeline.prototype, 'mask');
|
|
85
|
+
expect(meta?.fields).toContain('email');
|
|
86
|
+
expect(meta?.fields).toContain('ssn');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe('@Redact decorator', () => {
|
|
90
|
+
it('removes specified fields', async () => {
|
|
91
|
+
const etl = new etl_service_1.ETLService(new schema_validator_1.SchemaValidator());
|
|
92
|
+
const pipeline = new RedactPipeline();
|
|
93
|
+
const result = await etl.execute(pipeline, {
|
|
94
|
+
password: 'secret123',
|
|
95
|
+
secret: 'key',
|
|
96
|
+
name: 'John',
|
|
97
|
+
});
|
|
98
|
+
expect(result.password).toBeUndefined();
|
|
99
|
+
expect(result.secret).toBeUndefined();
|
|
100
|
+
expect(result.name).toBe('John');
|
|
101
|
+
});
|
|
102
|
+
it('getRedactMetadata returns options', () => {
|
|
103
|
+
const meta = (0, pii_decorator_1.getRedactMetadata)(RedactPipeline.prototype, 'redact');
|
|
104
|
+
expect(meta?.fields).toContain('password');
|
|
105
|
+
});
|
|
106
|
+
it('Mask with array shorthand', async () => {
|
|
107
|
+
let MaskArrayPipeline = class MaskArrayPipeline {
|
|
108
|
+
mask(data) {
|
|
109
|
+
return data;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, transform_decorator_1.Transform)({ step: 1, name: 'mask' }),
|
|
114
|
+
(0, pii_decorator_1.Mask)(['secret']),
|
|
115
|
+
__metadata("design:type", Function),
|
|
116
|
+
__metadata("design:paramtypes", [Object]),
|
|
117
|
+
__metadata("design:returntype", void 0)
|
|
118
|
+
], MaskArrayPipeline.prototype, "mask", null);
|
|
119
|
+
MaskArrayPipeline = __decorate([
|
|
120
|
+
(0, pipeline_decorator_1.Pipeline)('mask-array')
|
|
121
|
+
], MaskArrayPipeline);
|
|
122
|
+
const etl = new etl_service_1.ETLService(new schema_validator_1.SchemaValidator());
|
|
123
|
+
const result = await etl.execute(new MaskArrayPipeline(), {
|
|
124
|
+
secret: 'x',
|
|
125
|
+
ok: 1,
|
|
126
|
+
});
|
|
127
|
+
expect(result.secret).toBe('****');
|
|
128
|
+
expect(result.ok).toBe(1);
|
|
129
|
+
});
|
|
130
|
+
it('Mask leaves non-object unchanged', async () => {
|
|
131
|
+
let MaskNonObjPipeline = class MaskNonObjPipeline {
|
|
132
|
+
mask(data) {
|
|
133
|
+
return data;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, transform_decorator_1.Transform)({ step: 1, name: 'mask' }),
|
|
138
|
+
(0, pii_decorator_1.Mask)(['x']),
|
|
139
|
+
__metadata("design:type", Function),
|
|
140
|
+
__metadata("design:paramtypes", [Object]),
|
|
141
|
+
__metadata("design:returntype", void 0)
|
|
142
|
+
], MaskNonObjPipeline.prototype, "mask", null);
|
|
143
|
+
MaskNonObjPipeline = __decorate([
|
|
144
|
+
(0, pipeline_decorator_1.Pipeline)('mask-nonobj')
|
|
145
|
+
], MaskNonObjPipeline);
|
|
146
|
+
const etl = new etl_service_1.ETLService(new schema_validator_1.SchemaValidator());
|
|
147
|
+
const result = await etl.execute(new MaskNonObjPipeline(), 'string');
|
|
148
|
+
expect(result).toBe('string');
|
|
149
|
+
});
|
|
150
|
+
});
|
|
@@ -27,7 +27,7 @@ function Pipeline(nameOrOptions) {
|
|
|
27
27
|
return (target) => {
|
|
28
28
|
const options = typeof nameOrOptions === 'string' ? { name: nameOrOptions } : nameOrOptions || {};
|
|
29
29
|
const metadata = {
|
|
30
|
-
name: options.name ?? target.
|
|
30
|
+
name: options.name ?? target.name ?? 'unknown',
|
|
31
31
|
...options,
|
|
32
32
|
};
|
|
33
33
|
Reflect.defineMetadata(PIPELINE_METADATA_KEY, metadata, target);
|
|
@@ -34,6 +34,14 @@ describe('Pipeline decorator', () => {
|
|
|
34
34
|
], CustomPipeline);
|
|
35
35
|
expect((0, pipeline_decorator_1.getPipelineMetadata)(CustomPipeline)?.name).toBe('custom');
|
|
36
36
|
});
|
|
37
|
+
it('applies metadata with no args (uses class name)', () => {
|
|
38
|
+
let DefaultPipeline = class DefaultPipeline {
|
|
39
|
+
};
|
|
40
|
+
DefaultPipeline = __decorate([
|
|
41
|
+
(0, pipeline_decorator_1.Pipeline)()
|
|
42
|
+
], DefaultPipeline);
|
|
43
|
+
expect((0, pipeline_decorator_1.getPipelineMetadata)(DefaultPipeline)?.name).toBe('DefaultPipeline');
|
|
44
|
+
});
|
|
37
45
|
});
|
|
38
46
|
describe('Transform decorator', () => {
|
|
39
47
|
it('applies step metadata', () => {
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import type { PipelineStepMetadata } from '../data.types';
|
|
2
|
+
import type { PipelineStepMetadata, RetryConfig, DLQConfig } from '../data.types';
|
|
3
3
|
export interface TransformOptions {
|
|
4
4
|
step: number;
|
|
5
5
|
name: string;
|
|
6
|
+
/** Execute step only when this predicate returns true */
|
|
7
|
+
when?: (data: unknown) => boolean;
|
|
8
|
+
/** Retry failed step with backoff */
|
|
9
|
+
retry?: RetryConfig;
|
|
10
|
+
/** Per-step execution timeout in milliseconds */
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
/** Dead letter queue — called on failure instead of throwing */
|
|
13
|
+
dlq?: DLQConfig;
|
|
6
14
|
}
|
|
7
15
|
/**
|
|
8
16
|
* @Transform decorator - Data transformation with step ordering
|
|
@@ -1 +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;
|
|
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,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAIlF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;IAClC,qCAAqC;IACrC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAiBpE;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,oBAAoB,GAAG,SAAS,CAElC"}
|
|
@@ -26,6 +26,10 @@ function Transform(options) {
|
|
|
26
26
|
step: options.step,
|
|
27
27
|
name: options.name,
|
|
28
28
|
type: 'transform',
|
|
29
|
+
when: options.when,
|
|
30
|
+
retry: options.retry,
|
|
31
|
+
timeoutMs: options.timeoutMs,
|
|
32
|
+
dlq: options.dlq,
|
|
29
33
|
};
|
|
30
34
|
Reflect.defineMetadata(TRANSFORM_METADATA_KEY, metadata, target, propertyKey);
|
|
31
35
|
core_1.default.debug(`Transform decorator applied: ${target.constructor.name}.${String(propertyKey)} step=${options.step}`);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import type { PipelineStepMetadata } from '../data.types';
|
|
2
|
+
import type { PipelineStepMetadata, RetryConfig, DLQConfig } from '../data.types';
|
|
3
3
|
import type { BaseSchema } from '../schema/schema';
|
|
4
4
|
export interface ValidateOptions {
|
|
5
5
|
step: number;
|
|
6
6
|
name: string;
|
|
7
7
|
schema: BaseSchema;
|
|
8
|
+
when?: (data: unknown) => boolean;
|
|
9
|
+
retry?: RetryConfig;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
dlq?: DLQConfig;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
14
|
* @Validate decorator - Schema validation with step ordering
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/validate.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/validate.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CAkBlE;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,oBAAoB,GAAG,SAAS,CAElC"}
|
|
@@ -34,6 +34,10 @@ function Validate(options) {
|
|
|
34
34
|
name: options.name,
|
|
35
35
|
type: 'validate',
|
|
36
36
|
schema: options.schema,
|
|
37
|
+
when: options.when,
|
|
38
|
+
retry: options.retry,
|
|
39
|
+
timeoutMs: options.timeoutMs,
|
|
40
|
+
dlq: options.dlq,
|
|
37
41
|
};
|
|
38
42
|
Reflect.defineMetadata(VALIDATE_METADATA_KEY, metadata, target, propertyKey);
|
|
39
43
|
core_1.default.debug(`Validate decorator applied: ${target.constructor.name}.${String(propertyKey)} step=${options.step}`);
|
package/dist/flink.service.d.ts
CHANGED
|
@@ -46,5 +46,35 @@ export declare class FlinkService {
|
|
|
46
46
|
endTime?: number;
|
|
47
47
|
duration?: number;
|
|
48
48
|
}[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Deploy a stream pipeline by uploading a JAR and running it.
|
|
51
|
+
* @param pipeline The @Stream-decorated pipeline instance
|
|
52
|
+
* @param jarFile Local path to the compiled pipeline JAR
|
|
53
|
+
* @param config Optional Flink job config overrides
|
|
54
|
+
*/
|
|
55
|
+
deployStreamWithJar(pipeline: object, jarFile: string, config?: Partial<FlinkJobConfig>): Promise<DeployStreamResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Deploy a streaming pipeline using Flink SQL Gateway.
|
|
58
|
+
* @param sql The SQL DDL+DML to submit (CREATE TABLE + INSERT INTO)
|
|
59
|
+
* @param sessionId Optional existing session ID; a new session is created if omitted
|
|
60
|
+
*/
|
|
61
|
+
deployStreamWithSql(sql: string, sessionId?: string): Promise<{
|
|
62
|
+
operationId: string;
|
|
63
|
+
sessionId: string;
|
|
64
|
+
}>;
|
|
65
|
+
uploadJar(jarFile: string): Promise<string>;
|
|
66
|
+
runJar(jarId: string, options?: {
|
|
67
|
+
jobName?: string;
|
|
68
|
+
parallelism?: number;
|
|
69
|
+
entryClass?: string;
|
|
70
|
+
programArgs?: string;
|
|
71
|
+
}): Promise<string>;
|
|
72
|
+
listJars(): Promise<Array<{
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
uploaded: number;
|
|
76
|
+
}>>;
|
|
77
|
+
deleteJar(jarId: string): Promise<void>;
|
|
78
|
+
createSqlSession(properties?: Record<string, string>): Promise<string>;
|
|
49
79
|
}
|
|
50
80
|
//# sourceMappingURL=flink.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flink.service.d.ts","sourceRoot":"","sources":["../src/flink.service.ts"],"names":[],"mappings":"AACA,OAAO,E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G;IACG,mBAAmB,CACvB,GAAG,EAAE,MAAM,EACX,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAOhD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI3C,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;KACjB,GACL,OAAO,CAAC,MAAM,CAAC;IAIZ,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAI1E,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,gBAAgB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAG7E"}
|
package/dist/flink.service.js
CHANGED
|
@@ -37,7 +37,7 @@ let FlinkService = class FlinkService {
|
|
|
37
37
|
const { jobConfig, jobGraph } = this.streamBuilder.buildConfig(pipeline, config);
|
|
38
38
|
const client = this.getClient();
|
|
39
39
|
try {
|
|
40
|
-
const jobId = await client.submitJob(jobConfig
|
|
40
|
+
const jobId = await client.submitJob(jobConfig);
|
|
41
41
|
return {
|
|
42
42
|
jobId,
|
|
43
43
|
status: 'submitted',
|
|
@@ -47,7 +47,7 @@ let FlinkService = class FlinkService {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
catch {
|
|
50
|
-
// submitJob throws - return config for manual deployment
|
|
50
|
+
// submitJob throws without jarFile - return config for manual deployment
|
|
51
51
|
return {
|
|
52
52
|
status: 'config_generated',
|
|
53
53
|
jobConfig,
|
|
@@ -77,6 +77,54 @@ let FlinkService = class FlinkService {
|
|
|
77
77
|
async listJobs() {
|
|
78
78
|
return this.getClient().listJobs();
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Deploy a stream pipeline by uploading a JAR and running it.
|
|
82
|
+
* @param pipeline The @Stream-decorated pipeline instance
|
|
83
|
+
* @param jarFile Local path to the compiled pipeline JAR
|
|
84
|
+
* @param config Optional Flink job config overrides
|
|
85
|
+
*/
|
|
86
|
+
async deployStreamWithJar(pipeline, jarFile, config) {
|
|
87
|
+
const { jobConfig, jobGraph } = this.streamBuilder.buildConfig(pipeline, config);
|
|
88
|
+
const client = this.getClient();
|
|
89
|
+
const jobId = await client.submitJob(jobConfig, {
|
|
90
|
+
jarFile,
|
|
91
|
+
jobName: jobConfig.jobName,
|
|
92
|
+
parallelism: jobConfig.parallelism,
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
jobId,
|
|
96
|
+
status: 'submitted',
|
|
97
|
+
webUI: `${client.url}/#/job/${jobId}`,
|
|
98
|
+
jobConfig,
|
|
99
|
+
jobGraph,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Deploy a streaming pipeline using Flink SQL Gateway.
|
|
104
|
+
* @param sql The SQL DDL+DML to submit (CREATE TABLE + INSERT INTO)
|
|
105
|
+
* @param sessionId Optional existing session ID; a new session is created if omitted
|
|
106
|
+
*/
|
|
107
|
+
async deployStreamWithSql(sql, sessionId) {
|
|
108
|
+
const client = this.getClient();
|
|
109
|
+
const sid = sessionId ?? (await client.createSqlSession());
|
|
110
|
+
const operationId = await client.submitSql(sql, sid);
|
|
111
|
+
return { operationId, sessionId: sid };
|
|
112
|
+
}
|
|
113
|
+
async uploadJar(jarFile) {
|
|
114
|
+
return this.getClient().uploadJar(jarFile);
|
|
115
|
+
}
|
|
116
|
+
async runJar(jarId, options = {}) {
|
|
117
|
+
return this.getClient().runJar(jarId, options);
|
|
118
|
+
}
|
|
119
|
+
async listJars() {
|
|
120
|
+
return this.getClient().listJars();
|
|
121
|
+
}
|
|
122
|
+
async deleteJar(jarId) {
|
|
123
|
+
return this.getClient().deleteJar(jarId);
|
|
124
|
+
}
|
|
125
|
+
async createSqlSession(properties) {
|
|
126
|
+
return this.getClient().createSqlSession(properties);
|
|
127
|
+
}
|
|
80
128
|
};
|
|
81
129
|
exports.FlinkService = FlinkService;
|
|
82
130
|
exports.FlinkService = FlinkService = __decorate([
|
package/dist/index.d.ts
CHANGED
|
@@ -4,23 +4,29 @@
|
|
|
4
4
|
import 'reflect-metadata';
|
|
5
5
|
export { DataModule, type DataModuleOptions } from './data.module';
|
|
6
6
|
export { Schema } from './schema/schema';
|
|
7
|
-
export type { BaseSchema, StringSchema, NumberSchema, ObjectSchema, SchemaValidationError, } from './schema/schema';
|
|
8
|
-
export { Pipeline, Transform, Validate, Stream, getPipelineMetadata, hasPipelineMetadata, getTransformMetadata, getValidateMetadata, getStreamMetadata, hasStreamMetadata, type PipelineOptions, type TransformOptions, type ValidateOptions, type StreamOptions, } from './decorators';
|
|
9
|
-
export { ETLService, type PipelineStep } from './pipelines/etl.service';
|
|
7
|
+
export type { BaseSchema, StringSchema, NumberSchema, BooleanSchema, DateSchema, ObjectSchema, ArraySchema, LiteralSchema, UnionSchema, SchemaValidationError, SchemaValidator as SchemaValidatorFn, Infer, } from './schema/schema';
|
|
8
|
+
export { Pipeline, Transform, Validate, Stream, Mask, Redact, Encrypt, Decrypt, getPipelineMetadata, hasPipelineMetadata, getTransformMetadata, getValidateMetadata, getStreamMetadata, hasStreamMetadata, getMaskMetadata, getRedactMetadata, type PipelineOptions, type TransformOptions, type ValidateOptions, type StreamOptions, type MaskOptions, type RedactOptions, type EncryptOptions, type DecryptOptions, } from './decorators';
|
|
9
|
+
export { ETLService, type PipelineStep, type PipelineExecutionEvent, type PipelineEventHandler, } from './pipelines/etl.service';
|
|
10
10
|
export { PipelineBase } from './pipelines/pipeline.base';
|
|
11
|
-
export { PipelineBuilder, type PipelineStepConfig } from './pipelines/pipeline.builder';
|
|
11
|
+
export { PipelineBuilder, type PipelineStepConfig, type PipelineDefinition, type SerializedStep, } from './pipelines/pipeline.builder';
|
|
12
12
|
export { StreamService } from './pipelines/stream.service';
|
|
13
13
|
export { FlinkClient } from './streaming/flink/flink.client';
|
|
14
14
|
export { FlinkJob } from './streaming/flink/flink.job';
|
|
15
15
|
export { mapToFlinkOperator, createFlinkJobGraph, type FlinkOperator, type FlinkOperatorType, } from './streaming/flink/flink.operators';
|
|
16
16
|
export { StreamBuilder } from './streaming/stream.builder';
|
|
17
|
-
export { StreamProcessor } from './streaming/stream.processor';
|
|
17
|
+
export { StreamProcessor, type WindowedBatch } from './streaming/stream.processor';
|
|
18
18
|
export { FlinkService, type DeployStreamResult } from './flink.service';
|
|
19
19
|
export { SchemaValidator, SchemaValidationException } from './validators/schema.validator';
|
|
20
20
|
export { TransformerService } from './transformers/transformer.service';
|
|
21
21
|
export { trimString, toLowerCase, toUpperCase, parseJson, stringifyJson, pick, omit, renameKeys, } from './transformers/built-in.transformers';
|
|
22
|
-
export { QualityService, type QualityCheckResult, type DataQualityReport, } from './quality/quality.service';
|
|
22
|
+
export { QualityService, type QualityCheckResult, type DataQualityReport, type DataProfile, type FieldProfile, type AnomalyResult, } from './quality/quality.service';
|
|
23
|
+
export type { DataSource, DataSink, ConnectorOptions } from './connectors/connector.interface';
|
|
24
|
+
export { CsvSource, CsvSink, type CsvSourceOptions, type CsvSinkOptions, } from './connectors/csv.connector';
|
|
25
|
+
export { HttpSource, HttpSink, type HttpSourceOptions, type HttpSinkOptions, } from './connectors/http.connector';
|
|
26
|
+
export { MemorySource, MemorySink } from './connectors/memory.connector';
|
|
27
|
+
export { TelemetryService, createPrometheusExporter, type PipelineSpan, type MetricPoint, type LineageEntry, type SpanExporter, type MetricExporter, } from './telemetry/telemetry';
|
|
28
|
+
export { SchemaFaker, PipelineTestHarness, MockSource, MockSink, type StepSnapshot, type PipelineRunResult, } from './testing';
|
|
23
29
|
export { Injectable } from '@hazeljs/core';
|
|
24
|
-
export type { PipelineStepMetadata, StreamMetadata, FlinkJobConfig, FlinkAuthConfig, } from './data.types';
|
|
30
|
+
export type { PipelineStepMetadata, StreamMetadata, FlinkJobConfig, FlinkAuthConfig, RetryConfig, DLQConfig, } from './data.types';
|
|
25
31
|
export type { FlinkClientConfig, FlinkJobInfo } from './streaming/flink/flink.client';
|
|
26
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,kBAAkB,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,eAAe,IAAI,iBAAiB,EACpC,KAAK,GACN,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EAEN,IAAI,EACJ,MAAM,E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I,EACJ,UAAU,GACX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,2BAA2B,CAAC;AAGnC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,KAAK,iBAAiB,EACtB,KAAK,eAAe,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGzE,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,iBAAiB,GACvB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,YAAY,EACV,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,eAAe,EACf,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,27 +3,36 @@
|
|
|
3
3
|
* @hazeljs/data - Data Processing & ETL for HazelJS
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.SchemaFaker = exports.createPrometheusExporter = exports.TelemetryService = exports.MemorySink = exports.MemorySource = exports.HttpSink = exports.HttpSource = exports.CsvSink = exports.CsvSource = exports.QualityService = exports.renameKeys = exports.omit = exports.pick = exports.stringifyJson = exports.parseJson = exports.toUpperCase = exports.toLowerCase = exports.trimString = exports.TransformerService = exports.SchemaValidationException = exports.SchemaValidator = exports.FlinkService = exports.StreamProcessor = exports.StreamBuilder = exports.createFlinkJobGraph = exports.mapToFlinkOperator = exports.FlinkJob = exports.FlinkClient = exports.StreamService = exports.PipelineBuilder = exports.PipelineBase = exports.ETLService = exports.getRedactMetadata = exports.getMaskMetadata = exports.hasStreamMetadata = exports.getStreamMetadata = exports.getValidateMetadata = exports.getTransformMetadata = exports.hasPipelineMetadata = exports.getPipelineMetadata = exports.Decrypt = exports.Encrypt = exports.Redact = exports.Mask = exports.Stream = exports.Validate = exports.Transform = exports.Pipeline = exports.Schema = exports.DataModule = void 0;
|
|
7
|
+
exports.Injectable = exports.MockSink = exports.MockSource = exports.PipelineTestHarness = void 0;
|
|
7
8
|
require("reflect-metadata");
|
|
8
|
-
// Module
|
|
9
|
+
// ─── Module ──────────────────────────────────────────────────────────────────
|
|
9
10
|
var data_module_1 = require("./data.module");
|
|
10
11
|
Object.defineProperty(exports, "DataModule", { enumerable: true, get: function () { return data_module_1.DataModule; } });
|
|
11
|
-
// Schema
|
|
12
|
+
// ─── Schema ──────────────────────────────────────────────────────────────────
|
|
12
13
|
var schema_1 = require("./schema/schema");
|
|
13
14
|
Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return schema_1.Schema; } });
|
|
14
|
-
// Decorators
|
|
15
|
+
// ─── Decorators ───────────────────────────────────────────────────────────────
|
|
15
16
|
var decorators_1 = require("./decorators");
|
|
16
17
|
Object.defineProperty(exports, "Pipeline", { enumerable: true, get: function () { return decorators_1.Pipeline; } });
|
|
17
18
|
Object.defineProperty(exports, "Transform", { enumerable: true, get: function () { return decorators_1.Transform; } });
|
|
18
19
|
Object.defineProperty(exports, "Validate", { enumerable: true, get: function () { return decorators_1.Validate; } });
|
|
19
20
|
Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return decorators_1.Stream; } });
|
|
21
|
+
// PII decorators
|
|
22
|
+
Object.defineProperty(exports, "Mask", { enumerable: true, get: function () { return decorators_1.Mask; } });
|
|
23
|
+
Object.defineProperty(exports, "Redact", { enumerable: true, get: function () { return decorators_1.Redact; } });
|
|
24
|
+
Object.defineProperty(exports, "Encrypt", { enumerable: true, get: function () { return decorators_1.Encrypt; } });
|
|
25
|
+
Object.defineProperty(exports, "Decrypt", { enumerable: true, get: function () { return decorators_1.Decrypt; } });
|
|
26
|
+
// Metadata helpers
|
|
20
27
|
Object.defineProperty(exports, "getPipelineMetadata", { enumerable: true, get: function () { return decorators_1.getPipelineMetadata; } });
|
|
21
28
|
Object.defineProperty(exports, "hasPipelineMetadata", { enumerable: true, get: function () { return decorators_1.hasPipelineMetadata; } });
|
|
22
29
|
Object.defineProperty(exports, "getTransformMetadata", { enumerable: true, get: function () { return decorators_1.getTransformMetadata; } });
|
|
23
30
|
Object.defineProperty(exports, "getValidateMetadata", { enumerable: true, get: function () { return decorators_1.getValidateMetadata; } });
|
|
24
31
|
Object.defineProperty(exports, "getStreamMetadata", { enumerable: true, get: function () { return decorators_1.getStreamMetadata; } });
|
|
25
32
|
Object.defineProperty(exports, "hasStreamMetadata", { enumerable: true, get: function () { return decorators_1.hasStreamMetadata; } });
|
|
26
|
-
|
|
33
|
+
Object.defineProperty(exports, "getMaskMetadata", { enumerable: true, get: function () { return decorators_1.getMaskMetadata; } });
|
|
34
|
+
Object.defineProperty(exports, "getRedactMetadata", { enumerable: true, get: function () { return decorators_1.getRedactMetadata; } });
|
|
35
|
+
// ─── Pipelines ────────────────────────────────────────────────────────────────
|
|
27
36
|
var etl_service_1 = require("./pipelines/etl.service");
|
|
28
37
|
Object.defineProperty(exports, "ETLService", { enumerable: true, get: function () { return etl_service_1.ETLService; } });
|
|
29
38
|
var pipeline_base_1 = require("./pipelines/pipeline.base");
|
|
@@ -32,7 +41,7 @@ var pipeline_builder_1 = require("./pipelines/pipeline.builder");
|
|
|
32
41
|
Object.defineProperty(exports, "PipelineBuilder", { enumerable: true, get: function () { return pipeline_builder_1.PipelineBuilder; } });
|
|
33
42
|
var stream_service_1 = require("./pipelines/stream.service");
|
|
34
43
|
Object.defineProperty(exports, "StreamService", { enumerable: true, get: function () { return stream_service_1.StreamService; } });
|
|
35
|
-
// Streaming
|
|
44
|
+
// ─── Streaming ────────────────────────────────────────────────────────────────
|
|
36
45
|
var flink_client_1 = require("./streaming/flink/flink.client");
|
|
37
46
|
Object.defineProperty(exports, "FlinkClient", { enumerable: true, get: function () { return flink_client_1.FlinkClient; } });
|
|
38
47
|
var flink_job_1 = require("./streaming/flink/flink.job");
|
|
@@ -44,7 +53,7 @@ var stream_builder_1 = require("./streaming/stream.builder");
|
|
|
44
53
|
Object.defineProperty(exports, "StreamBuilder", { enumerable: true, get: function () { return stream_builder_1.StreamBuilder; } });
|
|
45
54
|
var stream_processor_1 = require("./streaming/stream.processor");
|
|
46
55
|
Object.defineProperty(exports, "StreamProcessor", { enumerable: true, get: function () { return stream_processor_1.StreamProcessor; } });
|
|
47
|
-
// Services
|
|
56
|
+
// ─── Services ─────────────────────────────────────────────────────────────────
|
|
48
57
|
var flink_service_1 = require("./flink.service");
|
|
49
58
|
Object.defineProperty(exports, "FlinkService", { enumerable: true, get: function () { return flink_service_1.FlinkService; } });
|
|
50
59
|
var schema_validator_1 = require("./validators/schema.validator");
|
|
@@ -63,6 +72,25 @@ Object.defineProperty(exports, "omit", { enumerable: true, get: function () { re
|
|
|
63
72
|
Object.defineProperty(exports, "renameKeys", { enumerable: true, get: function () { return built_in_transformers_1.renameKeys; } });
|
|
64
73
|
var quality_service_1 = require("./quality/quality.service");
|
|
65
74
|
Object.defineProperty(exports, "QualityService", { enumerable: true, get: function () { return quality_service_1.QualityService; } });
|
|
66
|
-
|
|
75
|
+
var csv_connector_1 = require("./connectors/csv.connector");
|
|
76
|
+
Object.defineProperty(exports, "CsvSource", { enumerable: true, get: function () { return csv_connector_1.CsvSource; } });
|
|
77
|
+
Object.defineProperty(exports, "CsvSink", { enumerable: true, get: function () { return csv_connector_1.CsvSink; } });
|
|
78
|
+
var http_connector_1 = require("./connectors/http.connector");
|
|
79
|
+
Object.defineProperty(exports, "HttpSource", { enumerable: true, get: function () { return http_connector_1.HttpSource; } });
|
|
80
|
+
Object.defineProperty(exports, "HttpSink", { enumerable: true, get: function () { return http_connector_1.HttpSink; } });
|
|
81
|
+
var memory_connector_1 = require("./connectors/memory.connector");
|
|
82
|
+
Object.defineProperty(exports, "MemorySource", { enumerable: true, get: function () { return memory_connector_1.MemorySource; } });
|
|
83
|
+
Object.defineProperty(exports, "MemorySink", { enumerable: true, get: function () { return memory_connector_1.MemorySink; } });
|
|
84
|
+
// ─── Telemetry ────────────────────────────────────────────────────────────────
|
|
85
|
+
var telemetry_1 = require("./telemetry/telemetry");
|
|
86
|
+
Object.defineProperty(exports, "TelemetryService", { enumerable: true, get: function () { return telemetry_1.TelemetryService; } });
|
|
87
|
+
Object.defineProperty(exports, "createPrometheusExporter", { enumerable: true, get: function () { return telemetry_1.createPrometheusExporter; } });
|
|
88
|
+
// ─── Testing Utilities ────────────────────────────────────────────────────────
|
|
89
|
+
var testing_1 = require("./testing");
|
|
90
|
+
Object.defineProperty(exports, "SchemaFaker", { enumerable: true, get: function () { return testing_1.SchemaFaker; } });
|
|
91
|
+
Object.defineProperty(exports, "PipelineTestHarness", { enumerable: true, get: function () { return testing_1.PipelineTestHarness; } });
|
|
92
|
+
Object.defineProperty(exports, "MockSource", { enumerable: true, get: function () { return testing_1.MockSource; } });
|
|
93
|
+
Object.defineProperty(exports, "MockSink", { enumerable: true, get: function () { return testing_1.MockSink; } });
|
|
94
|
+
// ─── Re-exports ───────────────────────────────────────────────────────────────
|
|
67
95
|
var core_1 = require("@hazeljs/core");
|
|
68
96
|
Object.defineProperty(exports, "Injectable", { enumerable: true, get: function () { return core_1.Injectable; } });
|
|
@@ -1,20 +1,59 @@
|
|
|
1
1
|
import { SchemaValidator } from '../validators/schema.validator';
|
|
2
2
|
import type { BaseSchema } from '../schema/schema';
|
|
3
|
+
import type { RetryConfig, DLQConfig } from '../data.types';
|
|
3
4
|
export interface PipelineStep {
|
|
4
5
|
step: number;
|
|
5
6
|
name: string;
|
|
6
7
|
type: 'transform' | 'validate';
|
|
7
8
|
method: string;
|
|
8
9
|
schema?: BaseSchema;
|
|
10
|
+
when?: (data: unknown) => boolean;
|
|
11
|
+
retry?: RetryConfig;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
dlq?: DLQConfig;
|
|
9
14
|
}
|
|
15
|
+
export interface PipelineExecutionEvent {
|
|
16
|
+
pipeline: string;
|
|
17
|
+
step: number;
|
|
18
|
+
stepName: string;
|
|
19
|
+
durationMs: number;
|
|
20
|
+
success: boolean;
|
|
21
|
+
skipped?: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
export type PipelineEventHandler = (event: PipelineExecutionEvent) => void;
|
|
10
25
|
/**
|
|
11
|
-
* ETL Service
|
|
12
|
-
*
|
|
26
|
+
* ETL Service — orchestrates pipeline execution.
|
|
27
|
+
*
|
|
28
|
+
* Features:
|
|
29
|
+
* - Sequential step execution (output N → input N+1)
|
|
30
|
+
* - Conditional steps via `when` predicate
|
|
31
|
+
* - Per-step retry with fixed/exponential backoff
|
|
32
|
+
* - Per-step execution timeout
|
|
33
|
+
* - Dead letter queue (DLQ) for graceful failure handling
|
|
34
|
+
* - Pipeline event hooks for observability
|
|
13
35
|
*/
|
|
14
36
|
export declare class ETLService {
|
|
15
37
|
private readonly schemaValidator;
|
|
38
|
+
private eventHandlers;
|
|
16
39
|
constructor(schemaValidator: SchemaValidator);
|
|
40
|
+
/** Register a handler called after each step completes or fails. */
|
|
41
|
+
onStepComplete(handler: PipelineEventHandler): void;
|
|
42
|
+
private emit;
|
|
17
43
|
extractSteps(instance: object): PipelineStep[];
|
|
18
44
|
execute<T = unknown>(pipelineInstance: object, input: unknown): Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Execute multiple items through the pipeline in parallel.
|
|
47
|
+
* Items that fail are routed to the DLQ if configured, otherwise they propagate.
|
|
48
|
+
*/
|
|
49
|
+
executeBatch<T = unknown>(pipelineInstance: object, items: unknown[], options?: {
|
|
50
|
+
concurrency?: number;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
results: T[];
|
|
53
|
+
errors: Array<{
|
|
54
|
+
item: unknown;
|
|
55
|
+
error: Error;
|
|
56
|
+
}>;
|
|
57
|
+
}>;
|
|
19
58
|
}
|
|
20
59
|
//# sourceMappingURL=etl.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"etl.service.d.ts","sourceRoot":"","sources":["../../src/pipelines/etl.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"etl.service.d.ts","sourceRoot":"","sources":["../../src/pipelines/etl.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG5D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM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