@tonytang99/integration-core 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/index.d.ts +9 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +13 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/pipeline/builder.d.ts +83 -0
  6. package/dist/pipeline/builder.d.ts.map +1 -0
  7. package/dist/pipeline/builder.js +210 -0
  8. package/dist/pipeline/builder.js.map +1 -0
  9. package/dist/pipeline/context.d.ts +43 -16
  10. package/dist/pipeline/context.d.ts.map +1 -1
  11. package/dist/pipeline/context.js +80 -7
  12. package/dist/pipeline/context.js.map +1 -1
  13. package/dist/pipeline/executor.d.ts +24 -0
  14. package/dist/pipeline/executor.d.ts.map +1 -0
  15. package/dist/pipeline/executor.js +136 -0
  16. package/dist/pipeline/executor.js.map +1 -0
  17. package/dist/pipeline/iterators.d.ts +74 -0
  18. package/dist/pipeline/iterators.d.ts.map +1 -0
  19. package/dist/pipeline/iterators.js +244 -0
  20. package/dist/pipeline/iterators.js.map +1 -0
  21. package/dist/pipeline/middleware.d.ts +26 -0
  22. package/dist/pipeline/middleware.d.ts.map +1 -0
  23. package/dist/pipeline/middleware.js +69 -0
  24. package/dist/pipeline/middleware.js.map +1 -0
  25. package/dist/pipeline/phase.d.ts +25 -3
  26. package/dist/pipeline/phase.d.ts.map +1 -1
  27. package/dist/pipeline/phase.js +33 -3
  28. package/dist/pipeline/phase.js.map +1 -1
  29. package/dist/pipeline/retry.d.ts +57 -0
  30. package/dist/pipeline/retry.d.ts.map +1 -0
  31. package/dist/pipeline/retry.js +139 -0
  32. package/dist/pipeline/retry.js.map +1 -0
  33. package/dist/registry/phase-registry.d.ts +24 -0
  34. package/dist/registry/phase-registry.d.ts.map +1 -0
  35. package/dist/registry/phase-registry.js +69 -0
  36. package/dist/registry/phase-registry.js.map +1 -0
  37. package/dist/slots/well-known-slots.d.ts +27 -0
  38. package/dist/slots/well-known-slots.d.ts.map +1 -0
  39. package/dist/slots/well-known-slots.js +31 -0
  40. package/dist/slots/well-known-slots.js.map +1 -0
  41. package/dist/types/common.d.ts +45 -0
  42. package/dist/types/common.d.ts.map +1 -0
  43. package/dist/types/common.js +11 -0
  44. package/dist/types/common.js.map +1 -0
  45. package/dist/types/errors.d.ts +62 -0
  46. package/dist/types/errors.d.ts.map +1 -0
  47. package/dist/types/errors.js +262 -0
  48. package/dist/types/errors.js.map +1 -0
  49. package/package.json +1 -1
@@ -1,10 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BasePhase = void 0;
3
+ exports.PhaseError = exports.BasePhase = void 0;
4
4
  class BasePhase {
5
- fail(code, message) {
6
- throw new Error(`[${this.name}] ${code}: ${message}`);
5
+ optionalReads;
6
+ dependsOn;
7
+ tags;
8
+ async shouldSkip(ctx) {
9
+ return false;
10
+ }
11
+ async rollback(ctx, error) {
12
+ // Default: no rollback action
13
+ }
14
+ fail(code, message, recoverable = false, data) {
15
+ throw new PhaseError(this.name, code, message, recoverable, data);
16
+ }
17
+ warn(ctx, message) {
18
+ return ctx.addWarning(`[${this.name}] ${message}`);
7
19
  }
8
20
  }
9
21
  exports.BasePhase = BasePhase;
22
+ class PhaseError extends Error {
23
+ phase;
24
+ code;
25
+ recoverable;
26
+ data;
27
+ cause;
28
+ constructor(phase, code, message, recoverable, data, cause) {
29
+ super(message);
30
+ this.phase = phase;
31
+ this.code = code;
32
+ this.recoverable = recoverable;
33
+ this.data = data;
34
+ this.cause = cause;
35
+ this.name = 'PhaseError';
36
+ Object.setPrototypeOf(this, PhaseError.prototype);
37
+ }
38
+ }
39
+ exports.PhaseError = PhaseError;
10
40
  //# sourceMappingURL=phase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"phase.js","sourceRoot":"","sources":["../../src/pipeline/phase.ts"],"names":[],"mappings":";;;AAWA,MAAsB,SAAS;IAQnB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E,UAAU,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAbD,gCAaC"}
@@ -0,0 +1,57 @@
1
+ import { Phase } from './phase';
2
+ import { PipelineContext } from './context';
3
+ import { SlotKey, PipelineError } from '../types/common';
4
+ /**
5
+ * Configuration for retry behavior
6
+ */
7
+ export interface RetryPolicy {
8
+ /** Maximum number of retry attempts (not including initial attempt) */
9
+ maxAttempts: number;
10
+ /** Base delay in milliseconds before first retry */
11
+ baseDelayMs: number;
12
+ /** Maximum delay in milliseconds (caps exponential backoff) */
13
+ maxDelayMs: number;
14
+ /** Multiplier for exponential backoff (default: 2) */
15
+ backoffMultiplier?: number;
16
+ /** Error codes that should trigger a retry */
17
+ retryableErrors?: string[];
18
+ /** HTTP status codes that should trigger a retry */
19
+ retryableStatuses?: number[];
20
+ /** Callback invoked before each retry attempt */
21
+ onRetry?: (attempt: number, error: PipelineError, delayMs: number) => void;
22
+ /** Whether to add jitter to delays to prevent thundering herd */
23
+ jitter?: boolean;
24
+ }
25
+ /**
26
+ * Default retry policy with sensible defaults
27
+ */
28
+ export declare const DefaultRetryPolicy: RetryPolicy;
29
+ /**
30
+ * Wraps a phase with retry logic
31
+ */
32
+ export declare function withRetry(phase: Phase, policy?: RetryPolicy): Phase;
33
+ /**
34
+ * Phase wrapper that implements retry logic with exponential backoff
35
+ */
36
+ declare class RetryPhase implements Phase {
37
+ private inner;
38
+ private readonly policy;
39
+ constructor(inner: Phase, policy: RetryPolicy);
40
+ get name(): string;
41
+ get description(): string;
42
+ get requires(): SlotKey<unknown>[];
43
+ get produces(): SlotKey<unknown>[];
44
+ get optionalReads(): SlotKey[] | undefined;
45
+ get dependsOn(): string[] | undefined;
46
+ get tags(): string[] | undefined;
47
+ execute(ctx: PipelineContext): Promise<PipelineContext>;
48
+ shouldSkip(ctx: PipelineContext): Promise<boolean>;
49
+ rollback(ctx: PipelineContext, error: PipelineError): Promise<void>;
50
+ private shouldRetry;
51
+ private calculateDelay;
52
+ private toPipelineError;
53
+ private isPipelineError;
54
+ private sleep;
55
+ }
56
+ export { RetryPhase };
57
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/pipeline/retry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,iDAAiD;IACjD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAQhC,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,WAAgC,GAAG,KAAK,CAEvF;AAED;;GAEG;AACH,cAAM,UAAW,YAAW,KAAK;IAI7B,OAAO,CAAC,KAAK;IAHf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;gBAGrC,KAAK,EAAE,KAAK,EACpB,MAAM,EAAE,WAAW;IAcrB,IAAI,IAAI,WAAyC;IACjD,IAAI,WAAW,WAAuD;IACtE,IAAI,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAgC;IAClE,IAAI,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAgC;IAClE,IAAI,aAAa,0BAAuC;IACxD,IAAI,SAAS,yBAAmC;IAChD,IAAI,IAAI,yBAA8B;IAEhC,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IA4BvD,UAAU,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlD,QAAQ,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzE,OAAO,CAAC,WAAW;IA0BnB,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,KAAK;CAGd;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryPhase = exports.DefaultRetryPolicy = void 0;
4
+ exports.withRetry = withRetry;
5
+ /**
6
+ * Default retry policy with sensible defaults
7
+ */
8
+ exports.DefaultRetryPolicy = {
9
+ maxAttempts: 3,
10
+ baseDelayMs: 1000,
11
+ maxDelayMs: 30000,
12
+ backoffMultiplier: 2,
13
+ retryableErrors: ['RATE_LIMITED', 'TIMEOUT', 'CONNECTION_ERROR', 'SERVICE_UNAVAILABLE'],
14
+ retryableStatuses: [408, 429, 500, 502, 503, 504],
15
+ jitter: true,
16
+ };
17
+ /**
18
+ * Wraps a phase with retry logic
19
+ */
20
+ function withRetry(phase, policy = exports.DefaultRetryPolicy) {
21
+ return new RetryPhase(phase, policy);
22
+ }
23
+ /**
24
+ * Phase wrapper that implements retry logic with exponential backoff
25
+ */
26
+ class RetryPhase {
27
+ inner;
28
+ policy;
29
+ constructor(inner, policy) {
30
+ this.inner = inner;
31
+ this.policy = {
32
+ maxAttempts: policy.maxAttempts,
33
+ baseDelayMs: policy.baseDelayMs,
34
+ maxDelayMs: policy.maxDelayMs,
35
+ backoffMultiplier: policy.backoffMultiplier ?? 2,
36
+ retryableErrors: policy.retryableErrors ?? [],
37
+ retryableStatuses: policy.retryableStatuses ?? [],
38
+ onRetry: policy.onRetry ?? (() => { }),
39
+ jitter: policy.jitter ?? true,
40
+ };
41
+ }
42
+ get name() { return `retry:${this.inner.name}`; }
43
+ get description() { return `${this.inner.description} (with retry)`; }
44
+ get requires() { return this.inner.requires; }
45
+ get produces() { return this.inner.produces; }
46
+ get optionalReads() { return this.inner.optionalReads; }
47
+ get dependsOn() { return this.inner.dependsOn; }
48
+ get tags() { return this.inner.tags; }
49
+ async execute(ctx) {
50
+ let lastError;
51
+ let attempt = 0;
52
+ while (attempt <= this.policy.maxAttempts) {
53
+ try {
54
+ return await this.inner.execute(ctx);
55
+ }
56
+ catch (error) {
57
+ const pipelineError = this.toPipelineError(error);
58
+ lastError = pipelineError;
59
+ if (!this.shouldRetry(pipelineError, attempt)) {
60
+ throw error;
61
+ }
62
+ attempt++;
63
+ if (attempt <= this.policy.maxAttempts) {
64
+ const delay = this.calculateDelay(attempt);
65
+ this.policy.onRetry(attempt, pipelineError, delay);
66
+ await this.sleep(delay);
67
+ }
68
+ }
69
+ }
70
+ // Should not reach here, but throw last error if we do
71
+ throw lastError;
72
+ }
73
+ async shouldSkip(ctx) {
74
+ return this.inner.shouldSkip ? await this.inner.shouldSkip(ctx) : false;
75
+ }
76
+ async rollback(ctx, error) {
77
+ if (this.inner.rollback) {
78
+ await this.inner.rollback(ctx, error);
79
+ }
80
+ }
81
+ shouldRetry(error, currentAttempt) {
82
+ // Don't retry if we've exhausted attempts
83
+ if (currentAttempt >= this.policy.maxAttempts) {
84
+ return false;
85
+ }
86
+ // Don't retry non-recoverable errors
87
+ if (!error.recoverable) {
88
+ return false;
89
+ }
90
+ // Check if error code is in retryable list
91
+ if (this.policy.retryableErrors.includes(error.code)) {
92
+ return true;
93
+ }
94
+ // Check if HTTP status is in retryable list
95
+ const httpStatus = error.data?.httpStatus ?? 0;
96
+ if (this.policy.retryableStatuses.includes(httpStatus)) {
97
+ return true;
98
+ }
99
+ // Default: retry all recoverable errors
100
+ return error.recoverable;
101
+ }
102
+ calculateDelay(attempt) {
103
+ // Exponential backoff: baseDelay * multiplier^(attempt-1)
104
+ let delay = this.policy.baseDelayMs * Math.pow(this.policy.backoffMultiplier, attempt - 1);
105
+ // Cap at max delay
106
+ delay = Math.min(delay, this.policy.maxDelayMs);
107
+ // Add jitter (0-25% of delay)
108
+ if (this.policy.jitter) {
109
+ const jitter = delay * 0.25 * Math.random();
110
+ delay = delay + jitter;
111
+ }
112
+ return Math.floor(delay);
113
+ }
114
+ toPipelineError(error) {
115
+ if (this.isPipelineError(error)) {
116
+ return error;
117
+ }
118
+ const err = error;
119
+ return {
120
+ phase: this.inner.name,
121
+ code: 'UNKNOWN_ERROR',
122
+ message: err?.message ?? String(error),
123
+ recoverable: true,
124
+ stack: err?.stack,
125
+ };
126
+ }
127
+ isPipelineError(error) {
128
+ return (typeof error === 'object' &&
129
+ error !== null &&
130
+ 'phase' in error &&
131
+ 'code' in error &&
132
+ 'message' in error);
133
+ }
134
+ sleep(ms) {
135
+ return new Promise(resolve => setTimeout(resolve, ms));
136
+ }
137
+ }
138
+ exports.RetryPhase = RetryPhase;
139
+ //# sourceMappingURL=retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/pipeline/retry.ts"],"names":[],"mappings":";;;AA2CA,8BAEC;AAlBD;;GAEG;AACU,QAAA,kBAAkB,GAAgB;IAC7C,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,KAAK;IACjB,iBAAiB,EAAE,CAAC;IACpB,eAAe,EAAE,CAAC,cAAc,EAAE,SAAS,EAAE,kBAAkB,EAAE,qBAAqB,CA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CAAC;QAEhD,8BAA8B;QAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC5C,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;QACzB,CAAC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAEO,eAAe,CAAC,KAAc;QACpC,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,GAAG,GAAG,KAAc,CAAC;QAC3B,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACtB,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC;YACtC,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,GAAG,EAAE,KAAK;SAClB,CAAC;IACJ,CAAC;IAEO,eAAe,CAAC,KAAc;QACpC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,KAAK,IAAI;YACd,OAAO,IAAI,KAAK;YAChB,MAAM,IAAI,KAAK;YACf,SAAS,IAAI,KAAK,CACnB,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAEQ,gCAAU"}
@@ -0,0 +1,24 @@
1
+ import { Phase, PhaseContract } from '../pipeline/phase';
2
+ export type PhaseFactory = (config?: Record<string, unknown>) => Phase;
3
+ export declare class PhaseRegistry {
4
+ private phases;
5
+ private tagIndex;
6
+ private metadata;
7
+ register(name: string, factory: PhaseFactory, metadata?: PhaseMetadata): this;
8
+ get(name: string, config?: Record<string, unknown>): Phase;
9
+ has(name: string): boolean;
10
+ findByTags(...tags: string[]): Phase[];
11
+ list(): string[];
12
+ listByTag(tag: string): string[];
13
+ describe(name: string): PhaseContract & PhaseMetadata | undefined;
14
+ describeAll(): Array<PhaseContract & PhaseMetadata>;
15
+ }
16
+ export interface PhaseMetadata {
17
+ tags?: string[];
18
+ category?: string;
19
+ author?: string;
20
+ version?: string;
21
+ deprecated?: boolean;
22
+ deprecationMessage?: string;
23
+ }
24
+ //# sourceMappingURL=phase-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-registry.d.ts","sourceRoot":"","sources":["../../src/registry/phase-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC;AAEvE,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAmC;IACjD,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,QAAQ,CAAoC;IAEpD,QAAQ,CACN,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,EACrB,QAAQ,GAAE,aAAkB,GAC3B,IAAI;IAeP,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK;IAQ1D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,UAAU,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE;IAWtC,IAAI,IAAI,MAAM,EAAE;IAIhB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAIhC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS;IAmBjE,WAAW,IAAI,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC;CAGpD;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // packages/core/src/registry/phase-registry.ts
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PhaseRegistry = void 0;
7
+ class PhaseRegistry {
8
+ phases = new Map();
9
+ tagIndex = new Map();
10
+ metadata = new Map();
11
+ register(name, factory, metadata = {}) {
12
+ this.phases.set(name, factory);
13
+ this.metadata.set(name, metadata);
14
+ // Index by tags
15
+ for (const tag of metadata.tags ?? []) {
16
+ if (!this.tagIndex.has(tag)) {
17
+ this.tagIndex.set(tag, new Set());
18
+ }
19
+ this.tagIndex.get(tag).add(name);
20
+ }
21
+ return this;
22
+ }
23
+ get(name, config) {
24
+ const factory = this.phases.get(name);
25
+ if (!factory) {
26
+ throw new Error(`Phase "${name}" not found in registry`);
27
+ }
28
+ return factory(config);
29
+ }
30
+ has(name) {
31
+ return this.phases.has(name);
32
+ }
33
+ findByTags(...tags) {
34
+ if (tags.length === 0)
35
+ return [];
36
+ const matchingSets = tags.map(t => this.tagIndex.get(t) ?? new Set());
37
+ const intersection = matchingSets.reduce((acc, set) => new Set([...acc].filter(x => set.has(x))));
38
+ return [...intersection].map(name => this.get(name));
39
+ }
40
+ list() {
41
+ return [...this.phases.keys()];
42
+ }
43
+ listByTag(tag) {
44
+ return [...(this.tagIndex.get(tag) ?? [])];
45
+ }
46
+ describe(name) {
47
+ const factory = this.phases.get(name);
48
+ const metadata = this.metadata.get(name);
49
+ if (!factory)
50
+ return undefined;
51
+ // Create instance to read contract
52
+ const instance = factory({});
53
+ return {
54
+ name: instance.name,
55
+ description: instance.description,
56
+ requires: instance.requires,
57
+ produces: instance.produces,
58
+ optionalReads: instance.optionalReads,
59
+ dependsOn: instance.dependsOn,
60
+ tags: instance.tags,
61
+ ...metadata,
62
+ };
63
+ }
64
+ describeAll() {
65
+ return this.list().map(name => this.describe(name)).filter(Boolean);
66
+ }
67
+ }
68
+ exports.PhaseRegistry = PhaseRegistry;
69
+ //# sourceMappingURL=phase-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-registry.js","sourceRoot":"","sources":["../../src/registry/phase-registry.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,+CAA+C;AAC/C,+EAA+E;;;AAM/E,MAAa,aAAa;IAChB,MAAM,GAAG,IAAI,GAAG,EAAwB,CAAC;IACzC,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC1C,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEpD,QAAQ,CACN,IAAY,EACZ,OAAqB,EACrB,WAA0B,EAAE;QAE5B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAElC,gBAAgB;QAChB,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;YACpC,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAA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,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAE/B,mCAAmC;QACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7B,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,WAAW,EAAE,QAAQ,CAAC,WAAW;YACjC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,aAAa,EAAE,QAAQ,CAAC,aAAa;YACrC,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,GAAG,QAAQ;SACZ,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvE,CAAC;CACF;AA7ED,sCA6EC"}
@@ -0,0 +1,27 @@
1
+ export interface ValidationIssue {
2
+ field: string;
3
+ code: string;
4
+ message: string;
5
+ severity: 'error' | 'warning';
6
+ }
7
+ export interface SourceMetadata {
8
+ system: string;
9
+ originalId: string;
10
+ fetchedAt: Date;
11
+ version?: string;
12
+ }
13
+ /**
14
+ * Core Infrastructure Slots
15
+ */
16
+ export declare const CoreSlots: {
17
+ readonly SOURCE_RAW: import("../types/common").SlotKey<unknown>;
18
+ readonly SOURCE_METADATA: import("../types/common").SlotKey<SourceMetadata>;
19
+ readonly TARGET_PAYLOAD: import("../types/common").SlotKey<unknown>;
20
+ readonly TARGET_RESPONSE: import("../types/common").SlotKey<unknown>;
21
+ readonly CONTROL_SHOULD_HALT: import("../types/common").SlotKey<boolean>;
22
+ readonly CONTROL_HALT_REASON: import("../types/common").SlotKey<string>;
23
+ readonly CONTROL_DRY_RUN: import("../types/common").SlotKey<boolean>;
24
+ readonly PROCESSING_BATCH_ID: import("../types/common").SlotKey<string>;
25
+ readonly VALIDATION_ISSUES: import("../types/common").SlotKey<ValidationIssue[]>;
26
+ };
27
+ //# sourceMappingURL=well-known-slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"well-known-slots.d.ts","sourceRoot":"","sources":["../../src/slots/well-known-slots.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;CA0BZ,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CoreSlots = void 0;
4
+ const common_1 = require("../types/common");
5
+ /**
6
+ * Core Infrastructure Slots
7
+ */
8
+ exports.CoreSlots = {
9
+ // ─────────────────────────────────────
10
+ // GENERIC SOURCE DATA
11
+ // ─────────────────────────────────────
12
+ SOURCE_RAW: (0, common_1.createSlotKey)('source.raw'),
13
+ SOURCE_METADATA: (0, common_1.createSlotKey)('source.metadata'),
14
+ // ─────────────────────────────────────
15
+ // GENERIC TARGET DATA
16
+ // ─────────────────────────────────────
17
+ TARGET_PAYLOAD: (0, common_1.createSlotKey)('target.payload'),
18
+ TARGET_RESPONSE: (0, common_1.createSlotKey)('target.response'),
19
+ // ─────────────────────────────────────
20
+ // CONTROL FLOW & META
21
+ // ─────────────────────────────────────
22
+ CONTROL_SHOULD_HALT: (0, common_1.createSlotKey)('control.shouldHalt'),
23
+ CONTROL_HALT_REASON: (0, common_1.createSlotKey)('control.haltReason'),
24
+ CONTROL_DRY_RUN: (0, common_1.createSlotKey)('control.dryRun'),
25
+ PROCESSING_BATCH_ID: (0, common_1.createSlotKey)('processing.batchId'),
26
+ // ─────────────────────────────────────
27
+ // VALIDATION
28
+ // ─────────────────────────────────────
29
+ VALIDATION_ISSUES: (0, common_1.createSlotKey)('validation.issues'),
30
+ };
31
+ //# sourceMappingURL=well-known-slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"well-known-slots.js","sourceRoot":"","sources":["../../src/slots/well-known-slots.ts"],"names":[],"mappings":";;;AAAA,4CAAgD;AAiBhD;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,wCAAwC;IACxC,sBAAsB;IACtB,wCAAwC;IACxC,UAAU,EAAE,IAAA,sBAAa,EAAU,YAAY,CAAC;IAChD,eAAe,EAAE,IAAA,sBAAa,EAAiB,iBAAiB,CAAC;IAEjE,wCAAwC;IACxC,sBAAsB;IACtB,wCAAwC;IACxC,cAAc,EAAE,IAAA,sBAAa,EAAU,gBAAgB,CAAC;IACxD,eAAe,EAAE,IAAA,sBAAa,EAAU,iBAAiB,CAAC;IAE1D,wCAAwC;IACxC,sBAAsB;IACtB,wCAAwC;IACxC,mBAAmB,EAAE,IAAA,sBAAa,EAAU,oBAAoB,CAAC;IACjE,mBAAmB,EAAE,IAAA,sBAAa,EAAS,oBAAoB,CAAC;IAChE,eAAe,EAAE,IAAA,sBAAa,EAAU,gBAAgB,CAAC;IAEzD,mBAAmB,EAAE,IAAA,sBAAa,EAAS,oBAAoB,CAAC;IAEhE,wCAAwC;IACxC,aAAa;IACb,wCAAwC;IACxC,iBAAiB,EAAE,IAAA,sBAAa,EAAoB,mBAAmB,CAAC;CAChE,CAAC"}
@@ -0,0 +1,45 @@
1
+ export type SlotKey<T = unknown> = string & {
2
+ __brand: 'SlotKey';
3
+ __type: T;
4
+ };
5
+ /**
6
+ * Creates a typed slot key.
7
+ * Usage: const MY_SLOT = createSlotKey<MyType>('my-slot');
8
+ */
9
+ export declare const createSlotKey: <T = unknown>(key: string) => SlotKey<T>;
10
+ export interface ClientConfig {
11
+ clientId: string;
12
+ environment: 'dev' | 'staging' | 'prod';
13
+ features?: Record<string, boolean>;
14
+ settings?: Record<string, unknown>;
15
+ }
16
+ export interface PipelineError {
17
+ phase: string;
18
+ code: string;
19
+ message: string;
20
+ recoverable: boolean;
21
+ data?: Record<string, unknown>;
22
+ cause?: unknown;
23
+ stack?: string;
24
+ timestamp?: Date;
25
+ }
26
+ export interface PhaseExecution {
27
+ phaseName: string;
28
+ startedAt: Date;
29
+ completedAt?: Date;
30
+ duration?: number;
31
+ status: 'running' | 'completed' | 'skipped' | 'failed';
32
+ error?: PipelineError;
33
+ slotsRead: string[];
34
+ slotsWritten: string[];
35
+ }
36
+ export interface ExecutionMetadata {
37
+ pipelineId: string;
38
+ executionId: string;
39
+ traceId: string;
40
+ startedAt: Date;
41
+ phaseHistory: PhaseExecution[];
42
+ currentPhase?: string;
43
+ [key: string]: unknown;
44
+ }
45
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,GAAG;IAC1C,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC;CACX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,KAAG,OAAO,CAAC,CAAC,CACpC,CAAC;AAE/B,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAA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+ exports.createSlotKey = void 0;
5
+ /**
6
+ * Creates a typed slot key.
7
+ * Usage: const MY_SLOT = createSlotKey<MyType>('my-slot');
8
+ */
9
+ const createSlotKey = (key) => key;
10
+ exports.createSlotKey = createSlotKey;
11
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;AAYpC;;;GAGG;AACI,MAAM,aAAa,GAAG,CAAc,GAAW,EAAc,EAAE,CACpE,GAA4B,CAAC;AADlB,QAAA,aAAa,iBACK"}
@@ -0,0 +1,62 @@
1
+ import { PipelineError } from './common';
2
+ /**
3
+ * Categories of errors for classification and handling decisions
4
+ */
5
+ export declare enum ErrorCategory {
6
+ /** Input validation failures */
7
+ VALIDATION = "VALIDATION",
8
+ /** Network connectivity issues */
9
+ NETWORK = "NETWORK",
10
+ /** Authentication failures (invalid credentials, expired tokens) */
11
+ AUTHENTICATION = "AUTHENTICATION",
12
+ /** Authorization failures (insufficient permissions) */
13
+ AUTHORIZATION = "AUTHORIZATION",
14
+ /** Rate limiting / throttling */
15
+ RATE_LIMIT = "RATE_LIMIT",
16
+ /** Resource not found */
17
+ NOT_FOUND = "NOT_FOUND",
18
+ /** Conflict (e.g., duplicate, optimistic lock failure) */
19
+ CONFLICT = "CONFLICT",
20
+ /** Business logic errors */
21
+ BUSINESS_LOGIC = "BUSINESS_LOGIC",
22
+ /** External service errors (5xx from APIs) */
23
+ SERVICE_ERROR = "SERVICE_ERROR",
24
+ /** Timeout errors */
25
+ TIMEOUT = "TIMEOUT",
26
+ /** Internal system errors */
27
+ SYSTEM = "SYSTEM",
28
+ /** Unknown/unclassified errors */
29
+ UNKNOWN = "UNKNOWN"
30
+ }
31
+ /**
32
+ * Extended error interface with categorization
33
+ */
34
+ export interface CategorizedError extends PipelineError {
35
+ /** Error category for handling decisions */
36
+ category: ErrorCategory;
37
+ /** HTTP status code if applicable */
38
+ httpStatus?: number;
39
+ /** Suggested retry delay in milliseconds */
40
+ retryAfterMs?: number;
41
+ }
42
+ /**
43
+ * Categorizes an error for handling decisions
44
+ */
45
+ export declare function categorizeError(error: unknown, phaseName?: string): CategorizedError;
46
+ /**
47
+ * Helper to check if an error category is retryable
48
+ */
49
+ export declare function isRetryableCategory(category: ErrorCategory): boolean;
50
+ /**
51
+ * Helper to create a validation error
52
+ */
53
+ export declare function validationError(phase: string, message: string, field?: string): CategorizedError;
54
+ /**
55
+ * Helper to create a not found error
56
+ */
57
+ export declare function notFoundError(phase: string, resource: string, id?: string): CategorizedError;
58
+ /**
59
+ * Helper to create a rate limit error
60
+ */
61
+ export declare function rateLimitError(phase: string, retryAfterMs?: number): CategorizedError;
62
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;GAEG;AACH,oBAAY,aAAa;IACvB,gCAAgC;IAChC,UAAU,eAAe;IACzB,kCAAkC;IAClC,OAAO,YAAY;IACnB,oEAAoE;IACpE,cAAc,mBAAmB;IACjC,wDAAwD;IACxD,aAAa,kBAAkB;IAC/B,iCAAiC;IACjC,UAAU,eAAe;IACzB,yBAAyB;IACzB,SAAS,cAAc;IACvB,0DAA0D;IAC1D,QAAQ,aAAa;IACrB,4BAA4B;IAC5B,cAAc,mBAAmB;IACjC,8CAA8C;IAC9C,aAAa,kBAAkB;IAC/B,qBAAqB;IACrB,OAAO,YAAY;IACnB,6BAA6B;IAC7B,MAAM,WAAW;IACjB,kCAAkC;IAClC,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,4CAA4C;IAC5C,QAAQ,EAAE,aAAa,CAAC;IACxB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IA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