-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from hyperse-io/feat/track
Feat/track
- Loading branch information
Showing
30 changed files
with
613 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hyperse/track": patch | ||
--- | ||
|
||
perfect track pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,5 @@ | |
}, | ||
"[jsonc]": { | ||
"editor.formatOnSave": false | ||
}, | ||
"commentTranslate.multiLineMerge": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from './default-constant.js'; | ||
export * from './track-func.js'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
import { executeFunction } from '../helpers/helper-execute.js'; | ||
import { TrackContext, TrackCreateOptions } from '../types/types-create.js'; | ||
import { TrackEventDataBase } from '../types/types-track.js'; | ||
import { TrackBuilder } from './track-builder.js'; | ||
|
||
/** | ||
* Creates a track builder function. | ||
* Creates a track builder instance. | ||
* | ||
* @param options - The track global options. | ||
* @returns A promise that resolves to the initialized track builder. | ||
* @template Context - The type of the track context. | ||
* @template EventData - The type of the track event value. | ||
* @template EventData - The type of the track event data. | ||
* @param options - The options for creating the track builder. | ||
* @returns A new instance of the TrackBuilder class. | ||
*/ | ||
export const createTrackBuilder = async < | ||
export const createTrackBuilder = < | ||
Context extends TrackContext<any>, | ||
EventData extends TrackEventDataBase, | ||
>( | ||
options: TrackCreateOptions<Context, EventData> = {} | ||
) => { | ||
const { eventData, logger, createData } = options; | ||
|
||
const ctx = { | ||
data: {}, | ||
logger: logger, | ||
}; | ||
|
||
if (createData) { | ||
const data = await executeFunction(createData, eventData); | ||
ctx.data = data || {}; | ||
} | ||
|
||
return new TrackBuilder<Context, EventData>(ctx as Context, eventData); | ||
return new TrackBuilder<Context, EventData>(options); | ||
}; |
Oops, something went wrong.