quidproquo-actionprocessor-node 0.0.231 → 0.0.233

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 CHANGED
@@ -1,84 +1,106 @@
1
1
  # quidproquo-actionprocessor-node
2
2
 
3
- The `quidproquo-actionprocessor-node` library provides a set of generic action processors for the `quidproquo` framework, allowing you to easily integrate common functionality into your Node.js-based applications.
3
+ The `quidproquo-actionprocessor-node` library provides a set of generic action processors for the `quidproquo` framework, allowing you to easily
4
+ integrate common functionality into your Node.js-based applications.
4
5
 
5
6
  ## Key Features
6
7
 
7
- 1. **Comprehensive Action Processors**: This library includes a wide range of action processors that cover various common use cases, such as date/time operations, error handling, event processing, GUID generation, logging, math operations, network requests, platform-specific functionality (e.g., delays), and system-level actions.
8
+ 1. **Comprehensive Action Processors**: This library includes a wide range of action processors that cover various common use cases, such as date/time
9
+ operations, error handling, event processing, GUID generation, logging, math operations, network requests, platform-specific functionality (e.g.,
10
+ delays), and system-level actions.
8
11
 
9
- 2. **Extensibility**: The action processor architecture is designed to be highly extensible, allowing you to easily add custom action processors to meet your specific requirements.
12
+ 2. **Extensibility**: The action processor architecture is designed to be highly extensible, allowing you to easily add custom action processors to
13
+ meet your specific requirements.
10
14
 
11
- 3. **Dependency Injection**: The action processors are integrated with the `quidproquo` dependency injection system, making it easy to compose and test your application components.
15
+ 3. **Dependency Injection**: The action processors are integrated with the `quidproquo` dependency injection system, making it easy to compose and
16
+ test your application components.
12
17
 
13
- 4. **Testability**: The action-oriented architecture and asynchronous execution model of `quidproquo-actionprocessor-node` make it highly testable, with support for unit, integration, and end-to-end testing.
18
+ 4. **Testability**: The action-oriented architecture and asynchronous execution model of `quidproquo-actionprocessor-node` make it highly testable,
19
+ with support for unit, integration, and end-to-end testing.
14
20
 
15
- 5. **Portability**: While the `quidproquo-actionprocessor-node` library is designed to run on Node.js, the underlying `quidproquo-core` library is platform-agnostic, allowing you to potentially use these action processors in other environments as well.
21
+ 5. **Portability**: While the `quidproquo-actionprocessor-node` library is designed to run on Node.js, the underlying `quidproquo-core` library is
22
+ platform-agnostic, allowing you to potentially use these action processors in other environments as well.
16
23
 
17
24
  ## Getting Started
18
25
 
19
- To use the `quidproquo-actionprocessor-node` library, you'll need to install the package and its dependencies. You can do this using your preferred package manager, such as npm or yarn:
26
+ To use the `quidproquo-actionprocessor-node` library, you'll need to install the package and its dependencies. You can do this using your preferred
27
+ package manager, such as npm or yarn:
20
28
 
21
29
  ```
22
30
  npm install quidproquo-actionprocessor-node
23
31
  ```
24
32
 
25
- Once you have the package installed, you can start using the provided action processors in your `quidproquo`-based application. The library exports a set of action processors that you can import and use in your code.
33
+ Once you have the package installed, you can start using the provided action processors in your `quidproquo`-based application. The library exports a
34
+ set of action processors that you can import and use in your code.
26
35
 
27
36
  ## Action Processors
28
37
 
29
38
  The `quidproquo-actionprocessor-node` library provides the following action processors:
30
39
 
31
40
  1. **Date/Time Action Processors**:
41
+
32
42
  - `DateNowActionProcessor`: Retrieves the current date and time as an ISO string.
33
43
 
34
44
  2. **Error Action Processors**:
45
+
35
46
  - `ErrorThrowErrorActionProcessor`: Throws a custom error with a specified type, text, and stack trace.
36
47
 
37
48
  3. **Event Action Processors**:
49
+
38
50
  - (No event-specific action processors are currently implemented)
39
51
 
40
52
  4. **GUID Action Processors**:
53
+
41
54
  - `GuidNewActionProcessor`: Generates a new UUID.
42
55
 
43
56
  5. **Logging Action Processors**:
57
+
44
58
  - `LogCreateActionProcessor`: Logs a message with a specified log level and optional data.
45
59
 
46
60
  6. **Math Action Processors**:
61
+
47
62
  - `MathRandomNumberActionProcessor`: Generates a random number.
48
63
 
49
64
  7. **Network Action Processors**:
65
+
50
66
  - `NetworkRequestActionProcessor`: Performs an HTTP request with various options (method, headers, body, etc.).
51
67
 
52
68
  8. **Platform Action Processors**:
69
+
53
70
  - `PlatformDelayActionProcessor`: Delays the execution for a specified number of milliseconds.
54
71
 
55
72
  9. **System Action Processors**:
73
+
56
74
  - `SystemBatchActionProcessor`: Executes a batch of actions and returns the results.
57
75
 
58
76
  10. **User Directory Action Processors**:
77
+
59
78
  - (No user directory-specific action processors are currently implemented)
60
79
 
61
80
  ## Usage
62
81
 
63
- To use the action processors provided by `quidproquo-actionprocessor-node`, you can import them into your `quidproquo`-based application and integrate them with your action processor configuration. Here's an example of how you might use the `DateNowActionProcessor`:
82
+ To use the action processors provided by `quidproquo-actionprocessor-node`, you can import them into your `quidproquo`-based application and integrate
83
+ them with your action processor configuration. Here's an example of how you might use the `DateNowActionProcessor`:
64
84
 
65
85
  ```typescript
66
86
  import { DateNowActionProcessor, actionResult, DateActionType } from 'quidproquo-actionprocessor-node';
67
87
 
68
88
  const processDateNow: DateNowActionProcessor = async () => {
69
- return actionResult(new Date().toISOString());
89
+ return actionResult(new Date().toISOString());
70
90
  };
71
91
 
72
92
  export default {
73
- [DateActionType.Now]: processDateNow,
93
+ [DateActionType.Now]: processDateNow,
74
94
  };
75
95
  ```
76
96
 
77
- In this example, we define a `DateNowActionProcessor` function that returns the current date and time as an ISO string. We then export this processor under the `DateActionType.Now` action type, which can be used in our `quidproquo`-based application.
97
+ In this example, we define a `DateNowActionProcessor` function that returns the current date and time as an ISO string. We then export this processor
98
+ under the `DateActionType.Now` action type, which can be used in our `quidproquo`-based application.
78
99
 
79
100
  ## Contribution and Development
80
101
 
81
- If you'd like to contribute to the development of `quidproquo-actionprocessor-node`, please refer to the [contributing guidelines](https://github.com/joe-coady/quidproquo/blob/main/CONTRIBUTING.md) for more information.
102
+ If you'd like to contribute to the development of `quidproquo-actionprocessor-node`, please refer to the
103
+ [contributing guidelines](https://github.com/joe-coady/quidproquo/blob/main/CONTRIBUTING.md) for more information.
82
104
 
83
105
  ## License
84
106
 
@@ -86,4 +108,5 @@ If you'd like to contribute to the development of `quidproquo-actionprocessor-no
86
108
 
87
109
  ## Warning: Not for Production
88
110
 
89
- **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.**
111
+ **This project is currently under active development and should not be used in production environments. The APIs and functionality are subject to
112
+ change without notice.**
@@ -33,8 +33,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  exports.getClaudeAiMessagesApiActionProcessor = void 0;
36
- const sdk_1 = __importStar(require("@anthropic-ai/sdk"));
37
36
  const quidproquo_core_1 = require("quidproquo-core");
37
+ const sdk_1 = __importStar(require("@anthropic-ai/sdk"));
38
38
  const getProcessMessagesApi = (qpqConfig) => {
39
39
  return ({ body, apiKey }) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  const anthropic = new sdk_1.default({ apiKey });
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getGuidNewActionProcessor = void 0;
13
- const uuid_1 = require("uuid");
14
13
  const quidproquo_core_1 = require("quidproquo-core");
14
+ const uuid_1 = require("uuid");
15
15
  const getProcessGuidNew = (qpqConfig) => {
16
16
  return () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  return (0, quidproquo_core_1.actionResult)((0, uuid_1.v4)());
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getGuidNewSortableActionProcessor = void 0;
13
- const uuidv7_1 = require("uuidv7");
14
13
  const quidproquo_core_1 = require("quidproquo-core");
14
+ const uuidv7_1 = require("uuidv7");
15
15
  const getProcessGuidNewSortable = (qpqConfig) => {
16
16
  return () => __awaiter(void 0, void 0, void 0, function* () {
17
17
  return (0, quidproquo_core_1.actionResult)((0, uuidv7_1.uuidv7)());
@@ -1,5 +1,7 @@
1
1
  import { ActionProcessorListResolver } from 'quidproquo-core';
2
2
  export * from './claudeAi';
3
+ export * from './config';
4
+ export * from './context';
3
5
  export * from './date';
4
6
  export * from './error';
5
7
  export * from './guid';
@@ -8,7 +10,5 @@ export * from './math';
8
10
  export * from './network';
9
11
  export * from './platform';
10
12
  export * from './system';
11
- export * from './config';
12
- export * from './context';
13
13
  export * from './customActions';
14
14
  export declare const getCoreActionProcessor: ActionProcessorListResolver;
@@ -25,6 +25,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getCoreActionProcessor = void 0;
27
27
  const claudeAi_1 = require("./claudeAi");
28
+ const config_1 = require("./config");
29
+ const context_1 = require("./context");
28
30
  const date_1 = require("./date");
29
31
  const error_1 = require("./error");
30
32
  const guid_1 = require("./guid");
@@ -33,9 +35,9 @@ const math_1 = require("./math");
33
35
  const network_1 = require("./network");
34
36
  const platform_1 = require("./platform");
35
37
  const system_1 = require("./system");
36
- const config_1 = require("./config");
37
- const context_1 = require("./context");
38
38
  __exportStar(require("./claudeAi"), exports);
39
+ __exportStar(require("./config"), exports);
40
+ __exportStar(require("./context"), exports);
39
41
  __exportStar(require("./date"), exports);
40
42
  __exportStar(require("./error"), exports);
41
43
  __exportStar(require("./guid"), exports);
@@ -44,8 +46,6 @@ __exportStar(require("./math"), exports);
44
46
  __exportStar(require("./network"), exports);
45
47
  __exportStar(require("./platform"), exports);
46
48
  __exportStar(require("./system"), exports);
47
- __exportStar(require("./config"), exports);
48
- __exportStar(require("./context"), exports);
49
49
  // Custom actions is not done here, as it has to be done last after all
50
50
  __exportStar(require("./customActions"), exports);
51
51
  const getCoreActionProcessor = (qpqConfig, dynamicModuleLoader) => __awaiter(void 0, void 0, void 0, function* () {
@@ -14,8 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getNetworkRequestActionProcessor = void 0;
16
16
  const quidproquo_core_1 = require("quidproquo-core");
17
- const mime_types_1 = require("mime-types");
18
17
  const axios_1 = __importDefault(require("axios"));
18
+ const mime_types_1 = require("mime-types");
19
19
  const getAxiosResponseType = (responseType) => {
20
20
  if (responseType === 'binary') {
21
21
  return 'arraybuffer';
@@ -1,5 +1,5 @@
1
+ import { actionResult, actionResultError, ClaudeAiActionType, ErrorTypeEnum, } from 'quidproquo-core';
1
2
  import Anthropic, { AuthenticationError } from '@anthropic-ai/sdk';
2
- import { ErrorTypeEnum, actionResult, ClaudeAiActionType, actionResultError, } from 'quidproquo-core';
3
3
  const getProcessMessagesApi = (qpqConfig) => {
4
4
  return async ({ body, apiKey }) => {
5
5
  const anthropic = new Anthropic({ apiKey });
@@ -1,4 +1,4 @@
1
- import { ErrorActionType, actionResultError, } from 'quidproquo-core';
1
+ import { actionResultError, ErrorActionType, } from 'quidproquo-core';
2
2
  const getProcessErrorThrowError = (qpqConfig) => {
3
3
  return async ({ errorStack, errorText, errorType }) => {
4
4
  return actionResultError(errorType, errorText, errorStack);
@@ -1,5 +1,5 @@
1
+ import { actionResult, GuidActionType } from 'quidproquo-core';
1
2
  import { v4 as uuidV4 } from 'uuid';
2
- import { GuidActionType, actionResult } from 'quidproquo-core';
3
3
  const getProcessGuidNew = (qpqConfig) => {
4
4
  return async () => {
5
5
  return actionResult(uuidV4());
@@ -1,5 +1,5 @@
1
+ import { actionResult, GuidActionType, } from 'quidproquo-core';
1
2
  import { uuidv7 } from 'uuidv7';
2
- import { GuidActionType, actionResult, } from 'quidproquo-core';
3
3
  const getProcessGuidNewSortable = (qpqConfig) => {
4
4
  return async () => {
5
5
  return actionResult(uuidv7());
@@ -1,5 +1,7 @@
1
1
  import { ActionProcessorListResolver } from 'quidproquo-core';
2
2
  export * from './claudeAi';
3
+ export * from './config';
4
+ export * from './context';
3
5
  export * from './date';
4
6
  export * from './error';
5
7
  export * from './guid';
@@ -8,7 +10,5 @@ export * from './math';
8
10
  export * from './network';
9
11
  export * from './platform';
10
12
  export * from './system';
11
- export * from './config';
12
- export * from './context';
13
13
  export * from './customActions';
14
14
  export declare const getCoreActionProcessor: ActionProcessorListResolver;
@@ -1,4 +1,6 @@
1
1
  import { getClaudeAiActionProcessor } from './claudeAi';
2
+ import { getConfigActionProcessor } from './config';
3
+ import { getContextActionProcessor } from './context';
2
4
  import { getDateActionProcessor } from './date';
3
5
  import { getErrorActionProcessor } from './error';
4
6
  import { getGuidProcessor } from './guid';
@@ -7,9 +9,9 @@ import { getMathActionProcessor } from './math';
7
9
  import { getNetworkActionProcessor } from './network';
8
10
  import { getPlatformActionProcessor } from './platform';
9
11
  import { getSystemActionProcessor } from './system';
10
- import { getConfigActionProcessor } from './config';
11
- import { getContextActionProcessor } from './context';
12
12
  export * from './claudeAi';
13
+ export * from './config';
14
+ export * from './context';
13
15
  export * from './date';
14
16
  export * from './error';
15
17
  export * from './guid';
@@ -18,8 +20,6 @@ export * from './math';
18
20
  export * from './network';
19
21
  export * from './platform';
20
22
  export * from './system';
21
- export * from './config';
22
- export * from './context';
23
23
  // Custom actions is not done here, as it has to be done last after all
24
24
  export * from './customActions';
25
25
  export const getCoreActionProcessor = async (qpqConfig, dynamicModuleLoader) => ({
@@ -1,4 +1,4 @@
1
- import { MathActionType, actionResult, } from 'quidproquo-core';
1
+ import { actionResult, MathActionType, } from 'quidproquo-core';
2
2
  const getProcessMathRandomNumber = (qpqConfig) => {
3
3
  return async () => {
4
4
  return actionResult(Math.random());
@@ -1,6 +1,6 @@
1
- import { actionResult, NetworkActionType, actionResultError, ErrorTypeEnum, } from 'quidproquo-core';
2
- import { extension } from 'mime-types';
1
+ import { actionResult, actionResultError, ErrorTypeEnum, NetworkActionType, } from 'quidproquo-core';
3
2
  import axios from 'axios';
3
+ import { extension } from 'mime-types';
4
4
  const getAxiosResponseType = (responseType) => {
5
5
  if (responseType === 'binary') {
6
6
  return 'arraybuffer';
@@ -1,4 +1,4 @@
1
- import { PlatformActionType, actionResult, } from 'quidproquo-core';
1
+ import { actionResult, PlatformActionType, } from 'quidproquo-core';
2
2
  const getProcessPlatformDelay = (qpqConfig) => {
3
3
  return async ({ timeMs }) => {
4
4
  return new Promise((resolve) => setTimeout(() => resolve(actionResult(undefined)), timeMs));
@@ -1,4 +1,4 @@
1
- import { SystemActionType, actionResult, actionResultError, isErroredActionResult, processAction, resolveActionResult, resolveActionResultError, } from 'quidproquo-core';
1
+ import { actionResult, actionResultError, isErroredActionResult, processAction, resolveActionResult, resolveActionResultError, SystemActionType, } from 'quidproquo-core';
2
2
  const getProcessSystemBatch = (qpqConfig) => {
3
3
  return async (payload, session, actionProcessors, logger, updateSession, dynamicModuleLoader) => {
4
4
  // console.log('~~~~~~~~~~~ RUNNING BATCH ~~~~~~~~~: ', payload);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-actionprocessor-node",
3
- "version": "0.0.231",
3
+ "version": "0.0.233",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -15,7 +15,10 @@
15
15
  "build": "npm run clean && npm run build:esm && npm run build:cjs",
16
16
  "watch": "tsc -p tsconfig.commonjs.json -w",
17
17
  "build:cjs": "tsc -p tsconfig.commonjs.json",
18
- "build:esm": "tsc -p tsconfig.esm.json"
18
+ "build:esm": "tsc -p tsconfig.esm.json",
19
+ "lint": "npx eslint .",
20
+ "lint:fix": "npx eslint . --fix",
21
+ "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
19
22
  },
20
23
  "repository": {
21
24
  "type": "git",
@@ -32,14 +35,14 @@
32
35
  "@anthropic-ai/sdk": "^0.19.1",
33
36
  "axios": "^1.2.1",
34
37
  "mime-types": "^2.1.35",
35
- "quidproquo-core": "0.0.231",
38
+ "quidproquo-core": "0.0.233",
36
39
  "uuid": "^9.0.0",
37
40
  "uuidv7": "^1.0.1"
38
41
  },
39
42
  "devDependencies": {
40
43
  "@types/mime-types": "^2.1.1",
41
44
  "@types/uuid": "^9.0.0",
42
- "quidproquo-tsconfig": "0.0.231",
45
+ "quidproquo-tsconfig": "0.0.233",
43
46
  "typescript": "^4.9.3"
44
47
  }
45
48
  }