@tonytang99/integration-core 1.0.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.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # @tonytang99/integration-core
2
+
3
+ Core pipeline framework for building integration workflows.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @tonytang99/integration-core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { createContext, BasePhase } from '@tonytang99/integration-core';
15
+
16
+ // Create a custom phase
17
+ class MyPhase extends BasePhase {
18
+ // ... implementation
19
+ }
20
+ ```
@@ -0,0 +1,3 @@
1
+ export * from './pipeline/context';
2
+ export * from './pipeline/phase';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./pipeline/context"), exports);
18
+ __exportStar(require("./pipeline/phase"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,mDAAiC"}
@@ -0,0 +1,21 @@
1
+ export type SlotKey = string & {
2
+ readonly __brand: unique symbol;
3
+ };
4
+ export declare const createSlotKey: <T = unknown>(key: string) => SlotKey;
5
+ export interface PipelineContext {
6
+ readonly slots: Map<SlotKey, unknown>;
7
+ readonly config: Record<string, unknown>;
8
+ get<T>(key: SlotKey): T | undefined;
9
+ require<T>(key: SlotKey): T;
10
+ set<T>(key: SlotKey, value: T): PipelineContext;
11
+ }
12
+ export declare class PipelineContextImpl implements PipelineContext {
13
+ readonly slots: Map<SlotKey, unknown>;
14
+ readonly config: Record<string, unknown>;
15
+ constructor(slots: Map<SlotKey, unknown>, config: Record<string, unknown>);
16
+ get<T>(key: SlotKey): T | undefined;
17
+ require<T>(key: SlotKey): T;
18
+ set<T>(key: SlotKey, value: T): PipelineContext;
19
+ }
20
+ export declare function createContext(config: Record<string, unknown>): PipelineContext;
21
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/pipeline/context.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAEnE,eAAO,MAAM,aAAa,GAAI,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,KAAG,OAAyB,CAAC;AAEnF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEzC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC,GAAG,SAAS,CAAC;IACpC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC,CAAC;IAC5B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,eAAe,CAAC;CACjD;AAED,qBAAa,mBAAoB,YAAW,eAAe;aAEvC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC;aAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAD/B,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,EAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAGjD,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC,GAAG,SAAS;IAInC,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC;IAQ3B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,eAAe;CAKhD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAE9E"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PipelineContextImpl = exports.createSlotKey = void 0;
4
+ exports.createContext = createContext;
5
+ const createSlotKey = (key) => key;
6
+ exports.createSlotKey = createSlotKey;
7
+ class PipelineContextImpl {
8
+ slots;
9
+ config;
10
+ constructor(slots, config) {
11
+ this.slots = slots;
12
+ this.config = config;
13
+ }
14
+ get(key) {
15
+ return this.slots.get(key);
16
+ }
17
+ require(key) {
18
+ const value = this.get(key);
19
+ if (value === undefined) {
20
+ throw new Error(`Required slot "${key}" not found`);
21
+ }
22
+ return value;
23
+ }
24
+ set(key, value) {
25
+ const newSlots = new Map(this.slots);
26
+ newSlots.set(key, value);
27
+ return new PipelineContextImpl(newSlots, this.config);
28
+ }
29
+ }
30
+ exports.PipelineContextImpl = PipelineContextImpl;
31
+ function createContext(config) {
32
+ return new PipelineContextImpl(new Map(), config);
33
+ }
34
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/pipeline/context.ts"],"names":[],"mappings":";;;AAsCA,sCAEC;AAtCM,MAAM,aAAa,GAAG,CAAc,GAAW,EAAW,EAAE,CAAC,GAAc,CAAC;AAAtE,QAAA,aAAa,iBAAyD;AAWnF,MAAa,mBAAmB;IAEZ;IACA;IAFlB,YACkB,KAA4B,EAC5B,MAA+B;QAD/B,UAAK,GAAL,KAAK,CAAuB;QAC5B,WAAM,GAAN,MAAM,CAAyB;IAC9C,CAAC;IAEJ,GAAG,CAAI,GAAY;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAkB,CAAC;IAC9C,CAAC;IAED,OAAO,CAAI,GAAY;QACrB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAI,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,aAAa,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,GAAG,CAAI,GAAY,EAAE,KAAQ;QAC3B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACF;AAvBD,kDAuBC;AAED,SAAgB,aAAa,CAAC,MAA+B;IAC3D,OAAO,IAAI,mBAAmB,CAAC,IAAI,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { PipelineContext, SlotKey } from './context';
2
+ export interface Phase {
3
+ readonly name: string;
4
+ readonly description: string;
5
+ readonly requires: SlotKey[];
6
+ readonly produces: SlotKey[];
7
+ execute(ctx: PipelineContext): Promise<PipelineContext>;
8
+ }
9
+ export declare abstract class BasePhase implements Phase {
10
+ abstract readonly name: string;
11
+ abstract readonly description: string;
12
+ abstract readonly requires: SlotKey[];
13
+ abstract readonly produces: SlotKey[];
14
+ abstract execute(ctx: PipelineContext): Promise<PipelineContext>;
15
+ protected fail(code: string, message: string): never;
16
+ }
17
+ //# sourceMappingURL=phase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase.d.ts","sourceRoot":"","sources":["../../src/pipeline/phase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAErD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAE7B,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACzD;AAED,8BAAsB,SAAU,YAAW,KAAK;IAC9C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAEtC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAEhE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK;CAGrD"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasePhase = void 0;
4
+ class BasePhase {
5
+ fail(code, message) {
6
+ throw new Error(`[${this.name}] ${code}: ${message}`);
7
+ }
8
+ }
9
+ exports.BasePhase = BasePhase;
10
+ //# sourceMappingURL=phase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase.js","sourceRoot":"","sources":["../../src/pipeline/phase.ts"],"names":[],"mappings":";;;AAWA,MAAsB,SAAS;IAQnB,IAAI,CAAC,IAAY,EAAE,OAAe;QAC1C,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;IACxD,CAAC;CACF;AAXD,8BAWC"}
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@tonytang99/integration-core",
3
+ "version": "1.0.0",
4
+ "description": "Core pipeline framework for integration platform",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": ["dist"],
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "dev": "tsc --watch",
11
+ "clean": "rm -rf dist",
12
+ "prepublishOnly": "npm run build"
13
+ },
14
+ "keywords": ["integration", "pipeline", "etl"],
15
+ "author": "tonytang99",
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "zod": "^3.22.0"
19
+ },
20
+ "devDependencies": {
21
+ "typescript": "^5.2.0"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ }
26
+ }