-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f798821
commit ec871d6
Showing
8 changed files
with
202 additions
and
206 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./webhooks/webhooks"; | ||
export * from "./entitlement/entitlement"; | ||
export * from './usage/usage' | ||
export * from "./usage/usage"; |
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,15 +1,15 @@ | ||
export type Transformer<T> = (ctx: T) => Promise<void>; | ||
|
||
export class UsageEngine<T> { | ||
transformers: Transformer<T>[] = []; | ||
transformers: Transformer<T>[] = []; | ||
|
||
public pipe(transformer: Transformer<T>) { | ||
this.transformers.push(transformer); | ||
public pipe(transformer: Transformer<T>) { | ||
this.transformers.push(transformer); | ||
|
||
return this; | ||
} | ||
return this; | ||
} | ||
|
||
public async run(ctx: T) { | ||
await Promise.all(this.transformers.map((transformer) => transformer(ctx))); | ||
} | ||
public async run(ctx: T) { | ||
await Promise.all(this.transformers.map((transformer) => transformer(ctx))); | ||
} | ||
} |
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
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 +1 @@ | ||
export * from "./usage/LLMStrategy/LLMStrategy"; | ||
export * from "./usage/LLMStrategy/LLMStrategy"; |
Oops, something went wrong.