quidproquo-core
Advanced tools
Comparing version 0.0.173 to 0.0.174
@@ -32,3 +32,7 @@ "use strict"; | ||
context: storyResult.session.context, | ||
}, storyActionProcessor, () => new Date().toISOString(), () => __awaiter(void 0, void 0, void 0, function* () { }), storyResult.correlation, storyResult.runtimeType); | ||
}, storyActionProcessor, () => new Date().toISOString(), { | ||
log: () => __awaiter(void 0, void 0, void 0, function* () { }), | ||
waitToFinishWriting: () => __awaiter(void 0, void 0, void 0, function* () { }), | ||
moveToPermanentStorage: () => __awaiter(void 0, void 0, void 0, function* () { }), | ||
}, storyResult.correlation, storyResult.runtimeType); | ||
// Execute it with the initial input | ||
@@ -35,0 +39,0 @@ debugger; |
import { Action, ActionProcessorList, ActionProcessorResult } from './types/Action'; | ||
import { StoryResult, StorySession, QpqRuntimeType, StorySessionUpdater } from './types/StorySession'; | ||
import { QPQConfig } from './config'; | ||
export declare function processAction(action: Action<any>, actionProcessors: ActionProcessorList, session: StorySession, logger: (res: StoryResult<any>) => Promise<void>, updateSession: StorySessionUpdater): Promise<ActionProcessorResult<any>>; | ||
export declare const createRuntime: (qpqConfig: QPQConfig, callerSession: StorySession, actionProcessors: ActionProcessorList, getTimeNow: () => string, logger: (res: StoryResult<any>) => Promise<void>, runtimeCorrelation: string, runtimeType: QpqRuntimeType, initialTags?: string[]) => <TArgs extends any[]>(story: (...args: TArgs) => Generator<any, any, Action<any>>, args: TArgs) => Promise<StoryResult<any>>; | ||
import { QpqLogger } from './types'; | ||
export declare function processAction(action: Action<any>, actionProcessors: ActionProcessorList, session: StorySession, logger: QpqLogger, updateSession: StorySessionUpdater): Promise<ActionProcessorResult<any>>; | ||
export declare const createRuntime: (qpqConfig: QPQConfig, callerSession: StorySession, actionProcessors: ActionProcessorList, getTimeNow: () => string, logger: QpqLogger, runtimeCorrelation: string, runtimeType: QpqRuntimeType, initialTags?: string[]) => <TArgs extends any[]>(story: (...args: TArgs) => Generator<any, any, Action<any>>, args: TArgs) => Promise<StoryResult<any>>; |
@@ -146,3 +146,3 @@ "use strict"; | ||
storyResult.logs = logs; | ||
yield logger(storyResult); | ||
yield logger.log(storyResult); | ||
return storyResult; | ||
@@ -149,0 +149,0 @@ } |
import { QPQError } from './ErrorTypeEnum'; | ||
import { ExtractGeneratorReturnType, StoryResult, StorySession, StorySessionUpdater } from './StorySession'; | ||
import { QpqLogger } from './QpqLogger'; | ||
import { ExtractGeneratorReturnType, StorySession, StorySessionUpdater } from './StorySession'; | ||
export interface Action<T> { | ||
@@ -19,3 +20,3 @@ type: string; | ||
}; | ||
export type ActionProcessor<TAction extends Action<any>, TReturn = any> = (payload: TAction['payload'], session: StorySession, actionProcessors: ActionProcessorList, logger: (result: StoryResult<any>) => Promise<void>, updateSession: StorySessionUpdater) => AsyncActionProcessorResult<TReturn>; | ||
export type ActionProcessor<TAction extends Action<any>, TReturn = any> = (payload: TAction['payload'], session: StorySession, actionProcessors: ActionProcessorList, logger: QpqLogger, updateSession: StorySessionUpdater) => AsyncActionProcessorResult<TReturn>; | ||
export type ActionRequester<TAction extends Action<any>, TReturn = undefined, TQPQReturn = TReturn> = Generator<TAction, TReturn, TQPQReturn>; | ||
@@ -22,0 +23,0 @@ export type ActionProcessorReturnType<T extends Generator<any, any, any>> = ExtractGeneratorReturnType<T>; |
@@ -17,1 +17,2 @@ export * from './Action'; | ||
export * from './KeyOf'; | ||
export * from './QpqLogger'; |
@@ -33,1 +33,2 @@ "use strict"; | ||
__exportStar(require("./KeyOf"), exports); | ||
__exportStar(require("./QpqLogger"), exports); |
{ | ||
"name": "quidproquo-core", | ||
"version": "0.0.173", | ||
"version": "0.0.174", | ||
"description": "", | ||
@@ -12,3 +12,3 @@ "main": "./lib/commonjs/index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"clean": "npx rimraf lib", | ||
"clean": "npx rimraf lib && npx rimraf node_modules", | ||
"build": "npm run clean && tsc -p tsconfig.commonjs.json", | ||
@@ -29,5 +29,5 @@ "watch": "tsc -p tsconfig.commonjs.json -w" | ||
"devDependencies": { | ||
"quidproquo-tsconfig": "0.0.173", | ||
"quidproquo-tsconfig": "0.0.174", | ||
"typescript": "^4.9.3" | ||
} | ||
} |
@@ -1,13 +0,61 @@ | ||
# quidproquo | ||
# quidproquo-core | ||
JS Library for building web servers using pure functions and generators. | ||
The `quidproquo-core` library is the heart of the quidproquo framework. It provides the fundamental building blocks and abstractions that enable the creation of scalable, event-driven web applications. This library is not intended to be used directly, but rather serves as a foundation for other quidproquo packages. | ||
## tsconfig | ||
## WARNING: NOT FOR PRODUCTION | ||
core for quidproquo library packages ~ Should probably not be used by itself | ||
**This project is currently under active development and should not be used in production environments. The APIs and functionality are subject to change without notice.** | ||
use `quidproquo` | ||
## Key Features | ||
### Note | ||
1. **Action-Oriented Architecture**: The core of quidproquo-core is an action-oriented architecture, where all application logic is encapsulated in small, reusable actions. These actions can be composed together to create complex workflows. | ||
Currently under development ~ Not for production | ||
2. **Asynchronous Execution**: Actions in quidproquo-core are executed asynchronously using generators, allowing for efficient and non-blocking execution of application logic. | ||
3. **Dependency Injection**: The framework provides a built-in dependency injection system, allowing for easy composition and testing of application components. | ||
4. **Extensibility**: The core library is designed to be highly extensible, with well-defined extension points and a modular architecture. | ||
5. **Error Handling**: The framework includes a robust error handling system, with support for different error types and the ability to handle errors at various levels of the application. | ||
6. **Logging and Observability**: The core library provides built-in support for logging and observability, making it easier to debug and monitor applications built with quidproquo. | ||
7. **Testability**: The action-oriented architecture and asynchronous execution model of quidproquo-core make it highly testable, with support for unit, integration, and end-to-end testing. | ||
## Key Concepts | ||
1. **Actions**: Actions are the fundamental building blocks of quidproquo-core. They represent small, reusable pieces of application logic that can be composed together to create complex workflows. | ||
2. **Generators**: Generators are used to implement the asynchronous execution model of quidproquo-core. Actions are defined as generator functions, which can yield other actions or return values. | ||
3. **Dependency Injection**: The core library provides a built-in dependency injection system, allowing for easy composition and testing of application components. | ||
4. **Contexts**: Contexts are used to manage the state and dependencies of a particular execution context, such as a user session or a background task. | ||
5. **Errors**: The framework includes a robust error handling system, with support for different error types and the ability to handle errors at various levels of the application. | ||
6. **Logging and Observability**: The core library provides built-in support for logging and observability, making it easier to debug and monitor applications built with quidproquo. | ||
7. **Testing**: The action-oriented architecture and asynchronous execution model of quidproquo-core make it highly testable, with support for unit, integration, and end-to-end testing. | ||
## Getting Started | ||
To use quidproquo-core, you'll need to install the package and its dependencies. You can do this using your preferred package manager, such as npm or yarn: | ||
``` | ||
npm install quidproquo-core | ||
``` | ||
Once you have the package installed, you can start building your application using the core concepts and features provided by the library. | ||
## Documentation | ||
For more detailed information on using quidproquo-core, please refer to the [quidproquo-core documentation](https://github.com/joe-coady/quidproquo/tree/main/packages/quidproquo-core). | ||
## Contributing | ||
If you'd like to contribute to the development of quidproquo-core, please refer to the [contributing guidelines](https://github.com/joe-coady/quidproquo/blob/main/CONTRIBUTING.md) for more information. | ||
## License | ||
quidproquo-core is licensed under the [MIT License](https://github.com/joe-coady/quidproquo/blob/main/LICENSE). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
286820
454
5524
61