quidproquo-core 0.0.37 → 0.0.38

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.
Files changed (227) hide show
  1. package/package.json +1 -4
  2. package/src/actions/config/ConfigActionType.ts +5 -0
  3. package/src/actions/config/ConfigGetParameterActionRequester.ts +6 -0
  4. package/{lib/actions/config/ConfigGetParameterActionTypes.d.ts → src/actions/config/ConfigGetParameterActionTypes.ts} +9 -3
  5. package/src/actions/config/ConfigGetParametersActionRequester.ts +8 -0
  6. package/{lib/actions/config/ConfigGetParametersActionTypes.d.ts → src/actions/config/ConfigGetParametersActionTypes.ts} +17 -5
  7. package/src/actions/config/ConfigGetSecretActionRequester.ts +6 -0
  8. package/{lib/actions/config/ConfigGetSecretActionTypes.d.ts → src/actions/config/ConfigGetSecretActionTypes.ts} +9 -3
  9. package/{lib/actions/config/index.d.ts → src/actions/config/index.ts} +3 -0
  10. package/src/actions/date/DateActionType.ts +3 -0
  11. package/src/actions/date/DateNowActionRequester.ts +6 -0
  12. package/{lib/actions/date/DateNowActionTypes.d.ts → src/actions/date/DateNowActionTypes.ts} +8 -3
  13. package/{lib/actions/date/index.d.ts → src/actions/date/index.ts} +1 -0
  14. package/src/actions/error/ErrorActionType.ts +3 -0
  15. package/src/actions/error/ErrorThrowErrorActionRequester.ts +14 -0
  16. package/{lib/actions/error/ErrorThrowErrorActionRequesterTypes.d.ts → src/actions/error/ErrorThrowErrorActionRequesterTypes.ts} +11 -5
  17. package/{lib/actions/error/index.d.ts → src/actions/error/index.ts} +1 -0
  18. package/src/actions/event/EventActionType.ts +6 -0
  19. package/src/actions/event/EventAutoRespondActionRequester.ts +11 -0
  20. package/{lib/actions/event/EventAutoRespondActionTypes.d.ts → src/actions/event/EventAutoRespondActionTypes.ts} +17 -11
  21. package/src/actions/event/EventMatchStoryActionRequester.ts +11 -0
  22. package/{lib/actions/event/EventMatchStoryActionTypes.d.ts → src/actions/event/EventMatchStoryActionTypes.ts} +30 -18
  23. package/src/actions/event/EventTransformEventParamsActionRequester.ts +12 -0
  24. package/src/actions/event/EventTransformEventParamsActionTypes.ts +24 -0
  25. package/src/actions/event/EventTransformResponseResultActionRequester.ts +12 -0
  26. package/src/actions/event/EventTransformResponseResultActionTypes.ts +25 -0
  27. package/{lib/actions/event/index.d.ts → src/actions/event/index.ts} +4 -0
  28. package/src/actions/file/FileActionType.ts +21 -0
  29. package/src/actions/file/FileDeleteActionRequester.ts +12 -0
  30. package/{lib/actions/file/FileDeleteActionTypes.d.ts → src/actions/file/FileDeleteActionTypes.ts} +10 -4
  31. package/src/actions/file/FileExistsActionRequester.ts +12 -0
  32. package/{lib/actions/file/FileExistsActionTypes.d.ts → src/actions/file/FileExistsActionTypes.ts} +10 -4
  33. package/src/actions/file/FileListDirectoryActionRequester.ts +42 -0
  34. package/src/actions/file/FileListDirectoryActionTypes.ts +26 -0
  35. package/src/actions/file/FileReadTextContentsActionRequester.ts +15 -0
  36. package/{lib/actions/file/FileReadTextContentsActionTypes.d.ts → src/actions/file/FileReadTextContentsActionTypes.ts} +18 -6
  37. package/src/actions/file/FileWriteTextContentsActionRequester.ts +17 -0
  38. package/{lib/actions/file/FileWriteTextContentsActionTypes.d.ts → src/actions/file/FileWriteTextContentsActionTypes.ts} +19 -7
  39. package/{lib/actions/file/index.d.ts → src/actions/file/index.ts} +5 -0
  40. package/src/actions/guid/GuidActionType.ts +3 -0
  41. package/src/actions/guid/GuidNewActionRequester.ts +6 -0
  42. package/{lib/actions/guid/GuidNewActionRequesterTypes.d.ts → src/actions/guid/GuidNewActionRequesterTypes.ts} +8 -3
  43. package/{lib/actions/guid/index.d.ts → src/actions/guid/index.ts} +1 -0
  44. package/{lib/actions/index.d.ts → src/actions/index.ts} +0 -0
  45. package/src/actions/log/LogActionType.ts +3 -0
  46. package/src/actions/log/LogCreateActionRequester.ts +18 -0
  47. package/{lib/actions/log/LogCreateActionTypes.d.ts → src/actions/log/LogCreateActionTypes.ts} +11 -5
  48. package/{lib/actions/log/index.d.ts → src/actions/log/index.ts} +1 -0
  49. package/src/actions/math/MathActionType.ts +3 -0
  50. package/src/actions/math/MathRandomNumberActionRequester.ts +6 -0
  51. package/{lib/actions/math/MathRandomNumberActionRequesterTypes.d.ts → src/actions/math/MathRandomNumberActionRequesterTypes.ts} +8 -3
  52. package/{lib/actions/math/index.d.ts → src/actions/math/index.ts} +1 -0
  53. package/src/actions/network/NetworkActionType.ts +27 -0
  54. package/src/actions/network/NetworkRequestActionRequester.ts +22 -0
  55. package/{lib/actions/network/NetworkRequestActionTypes.d.ts → src/actions/network/NetworkRequestActionTypes.ts} +23 -10
  56. package/{lib/actions/network/index.d.ts → src/actions/network/index.ts} +1 -0
  57. package/src/actions/platform/PlatformActionType.ts +3 -0
  58. package/src/actions/platform/PlatformDelayActionRequester.ts +6 -0
  59. package/{lib/actions/platform/PlatformDelayActionRequesterTypes.d.ts → src/actions/platform/PlatformDelayActionRequesterTypes.ts} +9 -3
  60. package/{lib/actions/platform/index.d.ts → src/actions/platform/index.ts} +1 -0
  61. package/src/actions/system/SystemActionType.ts +13 -0
  62. package/src/actions/system/SystemBatchActionRequester.ts +10 -0
  63. package/{lib/actions/system/SystemBatchActionTypes.d.ts → src/actions/system/SystemBatchActionTypes.ts} +23 -11
  64. package/src/actions/system/SystemExecuteStoryActionRequester.ts +19 -0
  65. package/src/actions/system/SystemExecuteStoryActionTypes.ts +27 -0
  66. package/src/actions/system/SystemRunParallelActionRequester.ts +40 -0
  67. package/src/actions/system/SystemRunParallelActionTypes.ts +9 -0
  68. package/{lib/actions/system/index.d.ts → src/actions/system/index.ts} +3 -0
  69. package/src/config/QPQConfig.ts +13 -0
  70. package/{lib/config/index.d.ts → src/config/index.ts} +0 -0
  71. package/src/config/settings/appName.ts +13 -0
  72. package/{lib/config/settings/index.d.ts → src/config/settings/index.ts} +0 -0
  73. package/src/config/settings/parameter.ts +15 -0
  74. package/src/config/settings/schedule.ts +27 -0
  75. package/src/config/settings/secret.ts +19 -0
  76. package/src/config/settings/storageDrive.ts +11 -0
  77. package/{lib/index.d.ts → src/index.ts} +6 -0
  78. package/src/logic/actionLogic.ts +34 -0
  79. package/src/qpqCoreUtils.ts +94 -0
  80. package/src/qpqRuntime.ts +145 -0
  81. package/src/stories/askProcessEvent.ts +30 -0
  82. package/{lib/stories/index.d.ts → src/stories/index.ts} +1 -1
  83. package/src/types/Action.ts +38 -0
  84. package/src/types/ErrorTypeEnum.ts +46 -0
  85. package/src/types/LogLevelEnum.ts +45 -0
  86. package/src/types/ScheduledEvent.ts +6 -0
  87. package/src/types/StorySession.ts +46 -0
  88. package/tsconfig.json +8 -0
  89. package/lib/actions/config/ConfigActionType.d.ts +0 -5
  90. package/lib/actions/config/ConfigActionType.js +0 -9
  91. package/lib/actions/config/ConfigGetParameterActionRequester.d.ts +0 -2
  92. package/lib/actions/config/ConfigGetParameterActionRequester.js +0 -8
  93. package/lib/actions/config/ConfigGetParameterActionTypes.js +0 -2
  94. package/lib/actions/config/ConfigGetParametersActionRequester.d.ts +0 -2
  95. package/lib/actions/config/ConfigGetParametersActionRequester.js +0 -8
  96. package/lib/actions/config/ConfigGetParametersActionTypes.js +0 -2
  97. package/lib/actions/config/ConfigGetSecretActionRequester.d.ts +0 -2
  98. package/lib/actions/config/ConfigGetSecretActionRequester.js +0 -8
  99. package/lib/actions/config/ConfigGetSecretActionTypes.js +0 -2
  100. package/lib/actions/config/index.js +0 -23
  101. package/lib/actions/date/DateActionType.d.ts +0 -3
  102. package/lib/actions/date/DateActionType.js +0 -7
  103. package/lib/actions/date/DateNowActionRequester.d.ts +0 -2
  104. package/lib/actions/date/DateNowActionRequester.js +0 -8
  105. package/lib/actions/date/DateNowActionTypes.js +0 -2
  106. package/lib/actions/date/index.js +0 -19
  107. package/lib/actions/error/ErrorActionType.d.ts +0 -3
  108. package/lib/actions/error/ErrorActionType.js +0 -7
  109. package/lib/actions/error/ErrorThrowErrorActionRequester.d.ts +0 -3
  110. package/lib/actions/error/ErrorThrowErrorActionRequester.js +0 -11
  111. package/lib/actions/error/ErrorThrowErrorActionRequesterTypes.js +0 -2
  112. package/lib/actions/error/index.js +0 -19
  113. package/lib/actions/event/EventActionType.d.ts +0 -6
  114. package/lib/actions/event/EventActionType.js +0 -10
  115. package/lib/actions/event/EventAutoRespondActionRequester.d.ts +0 -2
  116. package/lib/actions/event/EventAutoRespondActionRequester.js +0 -11
  117. package/lib/actions/event/EventAutoRespondActionTypes.js +0 -2
  118. package/lib/actions/event/EventMatchStoryActionRequester.d.ts +0 -2
  119. package/lib/actions/event/EventMatchStoryActionRequester.js +0 -11
  120. package/lib/actions/event/EventMatchStoryActionTypes.js +0 -2
  121. package/lib/actions/event/EventTransformEventParamsActionRequester.d.ts +0 -2
  122. package/lib/actions/event/EventTransformEventParamsActionRequester.js +0 -11
  123. package/lib/actions/event/EventTransformEventParamsActionTypes.d.ts +0 -11
  124. package/lib/actions/event/EventTransformEventParamsActionTypes.js +0 -2
  125. package/lib/actions/event/EventTransformResponseResultActionRequester.d.ts +0 -2
  126. package/lib/actions/event/EventTransformResponseResultActionRequester.js +0 -11
  127. package/lib/actions/event/EventTransformResponseResultActionTypes.d.ts +0 -12
  128. package/lib/actions/event/EventTransformResponseResultActionTypes.js +0 -2
  129. package/lib/actions/event/index.js +0 -25
  130. package/lib/actions/file/FileActionType.d.ts +0 -18
  131. package/lib/actions/file/FileActionType.js +0 -12
  132. package/lib/actions/file/FileDeleteActionRequester.d.ts +0 -2
  133. package/lib/actions/file/FileDeleteActionRequester.js +0 -14
  134. package/lib/actions/file/FileDeleteActionTypes.js +0 -2
  135. package/lib/actions/file/FileExistsActionRequester.d.ts +0 -2
  136. package/lib/actions/file/FileExistsActionRequester.js +0 -14
  137. package/lib/actions/file/FileExistsActionTypes.js +0 -2
  138. package/lib/actions/file/FileListDirectoryActionRequester.d.ts +0 -5
  139. package/lib/actions/file/FileListDirectoryActionRequester.js +0 -30
  140. package/lib/actions/file/FileListDirectoryActionTypes.d.ts +0 -14
  141. package/lib/actions/file/FileListDirectoryActionTypes.js +0 -2
  142. package/lib/actions/file/FileReadTextContentsActionRequester.d.ts +0 -2
  143. package/lib/actions/file/FileReadTextContentsActionRequester.js +0 -14
  144. package/lib/actions/file/FileReadTextContentsActionTypes.js +0 -2
  145. package/lib/actions/file/FileWriteTextContentsActionRequester.d.ts +0 -2
  146. package/lib/actions/file/FileWriteTextContentsActionRequester.js +0 -15
  147. package/lib/actions/file/FileWriteTextContentsActionTypes.js +0 -2
  148. package/lib/actions/file/index.js +0 -27
  149. package/lib/actions/guid/GuidActionType.d.ts +0 -3
  150. package/lib/actions/guid/GuidActionType.js +0 -7
  151. package/lib/actions/guid/GuidNewActionRequester.d.ts +0 -2
  152. package/lib/actions/guid/GuidNewActionRequester.js +0 -8
  153. package/lib/actions/guid/GuidNewActionRequesterTypes.js +0 -2
  154. package/lib/actions/guid/index.js +0 -19
  155. package/lib/actions/index.js +0 -27
  156. package/lib/actions/log/LogActionType.d.ts +0 -3
  157. package/lib/actions/log/LogActionType.js +0 -7
  158. package/lib/actions/log/LogCreateActionRequester.d.ts +0 -3
  159. package/lib/actions/log/LogCreateActionRequester.js +0 -15
  160. package/lib/actions/log/LogCreateActionTypes.js +0 -2
  161. package/lib/actions/log/index.js +0 -19
  162. package/lib/actions/math/MathActionType.d.ts +0 -3
  163. package/lib/actions/math/MathActionType.js +0 -7
  164. package/lib/actions/math/MathRandomNumberActionRequester.d.ts +0 -2
  165. package/lib/actions/math/MathRandomNumberActionRequester.js +0 -8
  166. package/lib/actions/math/MathRandomNumberActionRequesterTypes.js +0 -2
  167. package/lib/actions/math/index.js +0 -19
  168. package/lib/actions/network/NetworkActionType.d.ts +0 -16
  169. package/lib/actions/network/NetworkActionType.js +0 -7
  170. package/lib/actions/network/NetworkRequestActionRequester.d.ts +0 -3
  171. package/lib/actions/network/NetworkRequestActionRequester.js +0 -18
  172. package/lib/actions/network/NetworkRequestActionTypes.js +0 -2
  173. package/lib/actions/network/index.js +0 -19
  174. package/lib/actions/platform/PlatformActionType.d.ts +0 -3
  175. package/lib/actions/platform/PlatformActionType.js +0 -7
  176. package/lib/actions/platform/PlatformDelayActionRequester.d.ts +0 -2
  177. package/lib/actions/platform/PlatformDelayActionRequester.js +0 -8
  178. package/lib/actions/platform/PlatformDelayActionRequesterTypes.js +0 -2
  179. package/lib/actions/platform/index.js +0 -19
  180. package/lib/actions/system/SystemActionType.d.ts +0 -4
  181. package/lib/actions/system/SystemActionType.js +0 -15
  182. package/lib/actions/system/SystemBatchActionRequester.d.ts +0 -3
  183. package/lib/actions/system/SystemBatchActionRequester.js +0 -9
  184. package/lib/actions/system/SystemBatchActionTypes.js +0 -2
  185. package/lib/actions/system/SystemExecuteStoryActionRequester.d.ts +0 -2
  186. package/lib/actions/system/SystemExecuteStoryActionRequester.js +0 -16
  187. package/lib/actions/system/SystemExecuteStoryActionTypes.d.ts +0 -14
  188. package/lib/actions/system/SystemExecuteStoryActionTypes.js +0 -2
  189. package/lib/actions/system/SystemRunParallelActionRequester.d.ts +0 -2
  190. package/lib/actions/system/SystemRunParallelActionRequester.js +0 -37
  191. package/lib/actions/system/SystemRunParallelActionTypes.d.ts +0 -1
  192. package/lib/actions/system/SystemRunParallelActionTypes.js +0 -2
  193. package/lib/actions/system/index.js +0 -23
  194. package/lib/config/QPQConfig.d.ts +0 -11
  195. package/lib/config/QPQConfig.js +0 -11
  196. package/lib/config/index.js +0 -18
  197. package/lib/config/settings/appName.d.ts +0 -6
  198. package/lib/config/settings/appName.js +0 -10
  199. package/lib/config/settings/index.js +0 -21
  200. package/lib/config/settings/parameter.d.ts +0 -7
  201. package/lib/config/settings/parameter.js +0 -11
  202. package/lib/config/settings/schedule.d.ts +0 -11
  203. package/lib/config/settings/schedule.js +0 -16
  204. package/lib/config/settings/secret.d.ts +0 -7
  205. package/lib/config/settings/secret.js +0 -11
  206. package/lib/config/settings/storageDrive.d.ts +0 -5
  207. package/lib/config/settings/storageDrive.js +0 -9
  208. package/lib/index.js +0 -41
  209. package/lib/logic/actionLogic.d.ts +0 -8
  210. package/lib/logic/actionLogic.js +0 -30
  211. package/lib/qpqCoreUtils.d.ts +0 -12
  212. package/lib/qpqCoreUtils.js +0 -58
  213. package/lib/qpqRuntime.d.ts +0 -3
  214. package/lib/qpqRuntime.js +0 -88
  215. package/lib/stories/askProcessEvent.d.ts +0 -1
  216. package/lib/stories/askProcessEvent.js +0 -22
  217. package/lib/stories/index.js +0 -17
  218. package/lib/types/Action.d.ts +0 -12
  219. package/lib/types/Action.js +0 -2
  220. package/lib/types/ErrorTypeEnum.d.ts +0 -19
  221. package/lib/types/ErrorTypeEnum.js +0 -33
  222. package/lib/types/LogLevelEnum.d.ts +0 -8
  223. package/lib/types/LogLevelEnum.js +0 -44
  224. package/lib/types/ScheduledEvent.d.ts +0 -5
  225. package/lib/types/ScheduledEvent.js +0 -2
  226. package/lib/types/StorySession.d.ts +0 -28
  227. package/lib/types/StorySession.js +0 -2
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "quidproquo-core",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.js",
7
- "files": [
8
- "lib/**/*"
9
- ],
10
7
  "scripts": {
11
8
  "test": "echo \"Error: no test specified\" && exit 1",
12
9
  "clean": "npx rimraf lib",
@@ -0,0 +1,5 @@
1
+ export enum ConfigActionType {
2
+ GetSecret = '@quidproquo-core/Config/GetSecret',
3
+ GetParameter = '@quidproquo-core/Config/GetParameter',
4
+ GetParameters = '@quidproquo-core/Config/GetParameters',
5
+ }
@@ -0,0 +1,6 @@
1
+ import { ConfigGetParameterActionRequester } from './ConfigGetParameterActionTypes';
2
+ import { ConfigActionType } from './ConfigActionType';
3
+
4
+ export function* askConfigGetParameter(parameterName: string): ConfigGetParameterActionRequester {
5
+ return yield { type: ConfigActionType.GetParameter, payload: { parameterName } };
6
+ }
@@ -1,11 +1,17 @@
1
1
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
2
  import { ConfigActionType } from './ConfigActionType';
3
+
4
+ // Payload
3
5
  export interface ConfigGetParameterActionPayload {
4
- parameterName: string;
6
+ parameterName: string;
5
7
  }
8
+
9
+ // Action
6
10
  export interface ConfigGetParameterAction extends Action<ConfigGetParameterActionPayload> {
7
- type: ConfigActionType.GetParameter;
8
- payload: ConfigGetParameterActionPayload;
11
+ type: ConfigActionType.GetParameter;
12
+ payload: ConfigGetParameterActionPayload;
9
13
  }
14
+
15
+ // Function Types
10
16
  export type ConfigGetParameterActionProcessor = ActionProcessor<ConfigGetParameterAction, string>;
11
17
  export type ConfigGetParameterActionRequester = ActionRequester<ConfigGetParameterAction, string>;
@@ -0,0 +1,8 @@
1
+ import { ConfigGetParametersActionRequester } from './ConfigGetParametersActionTypes';
2
+ import { ConfigActionType } from './ConfigActionType';
3
+
4
+ export function* askConfigGetParameters(
5
+ parameterNames: string[],
6
+ ): ConfigGetParametersActionRequester {
7
+ return yield { type: ConfigActionType.GetParameters, payload: { parameterNames } };
8
+ }
@@ -1,11 +1,23 @@
1
1
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
2
  import { ConfigActionType } from './ConfigActionType';
3
+
4
+ // Payload
3
5
  export interface ConfigGetParametersActionPayload {
4
- parameterNames: string[];
6
+ parameterNames: string[];
5
7
  }
8
+
9
+ // Action
6
10
  export interface ConfigGetParametersAction extends Action<ConfigGetParametersActionPayload> {
7
- type: ConfigActionType.GetParameters;
8
- payload: ConfigGetParametersActionPayload;
11
+ type: ConfigActionType.GetParameters;
12
+ payload: ConfigGetParametersActionPayload;
9
13
  }
10
- export type ConfigGetParametersActionProcessor = ActionProcessor<ConfigGetParametersAction, string[]>;
11
- export type ConfigGetParametersActionRequester = ActionRequester<ConfigGetParametersAction, string[]>;
14
+
15
+ // Function Types
16
+ export type ConfigGetParametersActionProcessor = ActionProcessor<
17
+ ConfigGetParametersAction,
18
+ string[]
19
+ >;
20
+ export type ConfigGetParametersActionRequester = ActionRequester<
21
+ ConfigGetParametersAction,
22
+ string[]
23
+ >;
@@ -0,0 +1,6 @@
1
+ import { ConfigGetSecretActionRequester } from './ConfigGetSecretActionTypes';
2
+ import { ConfigActionType } from './ConfigActionType';
3
+
4
+ export function* askConfigGetSecret(secretName: string): ConfigGetSecretActionRequester {
5
+ return yield { type: ConfigActionType.GetSecret, payload: { secretName } };
6
+ }
@@ -1,11 +1,17 @@
1
1
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
2
  import { ConfigActionType } from './ConfigActionType';
3
+
4
+ // Payload
3
5
  export interface ConfigGetSecretActionPayload {
4
- secretName: string;
6
+ secretName: string;
5
7
  }
8
+
9
+ // Action
6
10
  export interface ConfigGetSecretAction extends Action<ConfigGetSecretActionPayload> {
7
- type: ConfigActionType.GetSecret;
8
- payload: ConfigGetSecretActionPayload;
11
+ type: ConfigActionType.GetSecret;
12
+ payload: ConfigGetSecretActionPayload;
9
13
  }
14
+
15
+ // Function Types
10
16
  export type ConfigGetSecretActionProcessor = ActionProcessor<ConfigGetSecretAction, string>;
11
17
  export type ConfigGetSecretActionRequester = ActionRequester<ConfigGetSecretAction, string>;
@@ -1,7 +1,10 @@
1
1
  export * from './ConfigActionType';
2
+
2
3
  export * from './ConfigGetParameterActionRequester';
3
4
  export * from './ConfigGetParameterActionTypes';
5
+
4
6
  export * from './ConfigGetParametersActionRequester';
5
7
  export * from './ConfigGetParametersActionTypes';
8
+
6
9
  export * from './ConfigGetSecretActionRequester';
7
10
  export * from './ConfigGetSecretActionTypes';
@@ -0,0 +1,3 @@
1
+ export enum DateActionType {
2
+ Now = '@quidproquo-core/Date/Now',
3
+ }
@@ -0,0 +1,6 @@
1
+ import { DateNowActionRequester } from './DateNowActionTypes';
2
+ import { DateActionType } from './DateActionType';
3
+
4
+ export function* askDateNow(): DateNowActionRequester {
5
+ return yield { type: DateActionType.Now };
6
+ }
@@ -1,9 +1,14 @@
1
1
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
2
  import { DateActionType } from './DateActionType';
3
- export interface DateNowActionPayload {
4
- }
3
+
4
+ // Payload
5
+ export interface DateNowActionPayload {}
6
+
7
+ // Action
5
8
  export interface DateNowAction extends Action<DateNowActionPayload> {
6
- type: DateActionType.Now;
9
+ type: DateActionType.Now;
7
10
  }
11
+
12
+ // Function Types
8
13
  export type DateNowActionProcessor = ActionProcessor<DateNowAction, string>;
9
14
  export type DateNowActionRequester = ActionRequester<DateNowAction, string>;
@@ -1,3 +1,4 @@
1
1
  export * from './DateActionType';
2
+
2
3
  export * from './DateNowActionRequester';
3
4
  export * from './DateNowActionTypes';
@@ -0,0 +1,3 @@
1
+ export enum ErrorActionType {
2
+ ThrowError = '@quidproquo-core/error/ThrowError',
3
+ }
@@ -0,0 +1,14 @@
1
+ import { ErrorThrowErrorActionRequester } from './ErrorThrowErrorActionRequesterTypes';
2
+ import { ErrorActionType } from './ErrorActionType';
3
+ import { ErrorTypeEnum } from '../../types/ErrorTypeEnum';
4
+
5
+ export function* askThrowError(
6
+ errorType: ErrorTypeEnum,
7
+ errorText: string,
8
+ errorStack?: string,
9
+ ): ErrorThrowErrorActionRequester {
10
+ yield {
11
+ type: ErrorActionType.ThrowError,
12
+ payload: { errorType, errorText, errorStack },
13
+ };
14
+ }
@@ -1,14 +1,20 @@
1
1
  import { ErrorActionType } from './ErrorActionType';
2
2
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
3
3
  import { ErrorTypeEnum } from '../../types/ErrorTypeEnum';
4
+
5
+ // Payload
4
6
  export interface ErrorThrowErrorActionPayload {
5
- errorType: ErrorTypeEnum;
6
- errorText: string;
7
- errorStack?: string;
7
+ errorType: ErrorTypeEnum;
8
+ errorText: string;
9
+ errorStack?: string;
8
10
  }
11
+
12
+ // Action
9
13
  export interface ErrorThrowErrorAction extends Action<ErrorThrowErrorActionPayload> {
10
- type: ErrorActionType.ThrowError;
11
- payload: ErrorThrowErrorActionPayload;
14
+ type: ErrorActionType.ThrowError;
15
+ payload: ErrorThrowErrorActionPayload;
12
16
  }
17
+
18
+ // Functions
13
19
  export type ErrorThrowErrorActionProcessor = ActionProcessor<ErrorThrowErrorAction, void>;
14
20
  export type ErrorThrowErrorActionRequester = ActionRequester<ErrorThrowErrorAction, void>;
@@ -1,3 +1,4 @@
1
1
  export * from './ErrorActionType';
2
+
2
3
  export * from './ErrorThrowErrorActionRequester';
3
4
  export * from './ErrorThrowErrorActionRequesterTypes';
@@ -0,0 +1,6 @@
1
+ export enum EventActionType {
2
+ TransformEventParams = '@quidproquo-core/event/TransformEventParams',
3
+ TransformResponseResult = '@quidproquo-core/event/TransformResponseResult',
4
+ AutoRespond = '@quidproquo-core/event/AutoRespond',
5
+ MatchStory = '@quidproquo-core/event/MatchStory',
6
+ }
@@ -0,0 +1,11 @@
1
+ import { EventAutoRespondActionRequester } from './EventAutoRespondActionTypes';
2
+ import { EventActionType } from './EventActionType';
3
+
4
+ export function* askEventAutoRespond<T>(
5
+ transformedEventParams: any,
6
+ ): EventAutoRespondActionRequester<T> {
7
+ return yield {
8
+ type: EventActionType.AutoRespond,
9
+ payload: { transformedEventParams },
10
+ };
11
+ }
@@ -1,11 +1,17 @@
1
- import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
- import { EventActionType } from './EventActionType';
3
- export interface EventAutoRespondActionPayload<T> {
4
- transformedEventParams: T;
5
- }
6
- export interface EventAutoRespondAction<T> extends Action<EventAutoRespondActionPayload<T>> {
7
- type: EventActionType.AutoRespond;
8
- payload: EventAutoRespondActionPayload<T>;
9
- }
10
- export type EventAutoRespondActionProcessor<T> = ActionProcessor<EventAutoRespondAction<T>, any>;
11
- export type EventAutoRespondActionRequester<T> = ActionRequester<EventAutoRespondAction<T>, any>;
1
+ import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
+ import { EventActionType } from './EventActionType';
3
+
4
+ // payload
5
+ export interface EventAutoRespondActionPayload<T> {
6
+ transformedEventParams: T;
7
+ }
8
+
9
+ // action
10
+ export interface EventAutoRespondAction<T> extends Action<EventAutoRespondActionPayload<T>> {
11
+ type: EventActionType.AutoRespond;
12
+ payload: EventAutoRespondActionPayload<T>;
13
+ }
14
+
15
+ // Functions
16
+ export type EventAutoRespondActionProcessor<T> = ActionProcessor<EventAutoRespondAction<T>, any>;
17
+ export type EventAutoRespondActionRequester<T> = ActionRequester<EventAutoRespondAction<T>, any>;
@@ -0,0 +1,11 @@
1
+ import { EventActionType } from './EventActionType';
2
+
3
+ import { EventMatchStoryActionRequester } from './EventMatchStoryActionTypes';
4
+ export function* askEventMatchStory<T>(
5
+ transformedEventParams: any,
6
+ ): EventMatchStoryActionRequester<T> {
7
+ return yield {
8
+ type: EventActionType.MatchStory,
9
+ payload: { transformedEventParams },
10
+ };
11
+ }
@@ -1,18 +1,30 @@
1
- import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
- import { EventActionType } from './EventActionType';
3
- export type MatchStoryResult = {
4
- src?: string;
5
- runtime?: string;
6
- options?: {
7
- [key: string]: string;
8
- };
9
- };
10
- export interface EventMatchStoryActionPayload<T> {
11
- transformedEventParams: T;
12
- }
13
- export interface EventMatchStoryAction<T> extends Action<EventMatchStoryActionPayload<T>> {
14
- type: EventActionType.MatchStory;
15
- payload: EventMatchStoryActionPayload<T>;
16
- }
17
- export type EventMatchStoryActionProcessor<T> = ActionProcessor<EventMatchStoryAction<T>, MatchStoryResult>;
18
- export type EventMatchStoryActionRequester<T> = ActionRequester<EventMatchStoryAction<T>, MatchStoryResult>;
1
+ import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
+ import { EventActionType } from './EventActionType';
3
+
4
+ // Custom return result
5
+ export type MatchStoryResult = {
6
+ src?: string;
7
+ runtime?: string;
8
+ options?: { [key: string]: string };
9
+ };
10
+
11
+ // Payload
12
+ export interface EventMatchStoryActionPayload<T> {
13
+ transformedEventParams: T;
14
+ }
15
+
16
+ // Action
17
+ export interface EventMatchStoryAction<T> extends Action<EventMatchStoryActionPayload<T>> {
18
+ type: EventActionType.MatchStory;
19
+ payload: EventMatchStoryActionPayload<T>;
20
+ }
21
+
22
+ // Functions
23
+ export type EventMatchStoryActionProcessor<T> = ActionProcessor<
24
+ EventMatchStoryAction<T>,
25
+ MatchStoryResult
26
+ >;
27
+ export type EventMatchStoryActionRequester<T> = ActionRequester<
28
+ EventMatchStoryAction<T>,
29
+ MatchStoryResult
30
+ >;
@@ -0,0 +1,12 @@
1
+ import { EventActionType } from './EventActionType';
2
+
3
+ import { EventTransformEventParamsActionRequester } from './EventTransformEventParamsActionTypes';
4
+
5
+ export function* askEventTransformEventParams<T extends Array<unknown>, TRes>(
6
+ ...eventParams: T
7
+ ): EventTransformEventParamsActionRequester<T, TRes> {
8
+ return yield {
9
+ type: EventActionType.TransformEventParams,
10
+ payload: { eventParams },
11
+ };
12
+ }
@@ -0,0 +1,24 @@
1
+ import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
+ import { EventActionType } from './EventActionType';
3
+
4
+ // Payload
5
+ export interface EventTransformEventParamsActionPayload<T extends Array<unknown>> {
6
+ eventParams: T;
7
+ }
8
+
9
+ // Action
10
+ export interface EventTransformEventParamsAction<T extends Array<unknown>>
11
+ extends Action<EventTransformEventParamsActionPayload<T>> {
12
+ type: EventActionType.TransformEventParams;
13
+ payload: EventTransformEventParamsActionPayload<T>;
14
+ }
15
+
16
+ // Functions
17
+ export type EventTransformEventParamsActionProcessor<
18
+ T extends Array<unknown>,
19
+ TRes,
20
+ > = ActionProcessor<EventTransformEventParamsAction<T>, TRes>;
21
+ export type EventTransformEventParamsActionRequester<
22
+ T extends Array<unknown>,
23
+ TRes,
24
+ > = ActionRequester<EventTransformEventParamsAction<T>, TRes>;
@@ -0,0 +1,12 @@
1
+ import { EventActionType } from './EventActionType';
2
+ import { EventTransformResponseResultActionRequester } from './EventTransformResponseResultActionTypes';
3
+
4
+ export function* askEventTransformResponseResult<TOutputRes, TInputRes, TTransformedEventParams>(
5
+ response: TInputRes,
6
+ transformedEventParams: TTransformedEventParams,
7
+ ): EventTransformResponseResultActionRequester<TOutputRes> {
8
+ return yield {
9
+ type: EventActionType.TransformResponseResult,
10
+ payload: { response, transformedEventParams },
11
+ };
12
+ }
@@ -0,0 +1,25 @@
1
+ import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
+ import { EventActionType } from './EventActionType';
3
+
4
+ // Payload
5
+ export interface EventTransformResponseResultActionPayload {
6
+ response: any;
7
+ transformedEventParams: any;
8
+ }
9
+
10
+ // Action
11
+ export interface EventTransformResponseResultAction
12
+ extends Action<EventTransformResponseResultActionPayload> {
13
+ type: EventActionType.TransformResponseResult;
14
+ payload: EventTransformResponseResultActionPayload;
15
+ }
16
+
17
+ // Functions
18
+ export type EventTransformResponseResultActionProcessor<TRes> = ActionProcessor<
19
+ EventTransformResponseResultAction,
20
+ TRes
21
+ >;
22
+ export type EventTransformResponseResultActionRequester<TRes> = ActionRequester<
23
+ EventTransformResponseResultAction,
24
+ TRes
25
+ >;
@@ -1,9 +1,13 @@
1
1
  export * from './EventActionType';
2
+
2
3
  export * from './EventAutoRespondActionRequester';
3
4
  export * from './EventAutoRespondActionTypes';
5
+
4
6
  export * from './EventMatchStoryActionRequester';
5
7
  export * from './EventMatchStoryActionTypes';
8
+
6
9
  export * from './EventTransformEventParamsActionRequester';
7
10
  export * from './EventTransformEventParamsActionTypes';
11
+
8
12
  export * from './EventTransformResponseResultActionRequester';
9
13
  export * from './EventTransformResponseResultActionTypes';
@@ -0,0 +1,21 @@
1
+ export enum FileActionType {
2
+ ReadTextContents = '@quidproquo-core/File/ReadTextContents',
3
+ WriteTextContents = '@quidproquo-core/File/WriteTextContents',
4
+ ListDirectory = '@quidproquo-core/File/ListDirectory',
5
+ Exists = '@quidproquo-core/File/Exists',
6
+ Delete = '@quidproquo-core/File/Delete',
7
+ }
8
+
9
+ export const filePathDelimiter = `/`;
10
+
11
+ export interface FileInfo {
12
+ filepath: string;
13
+ drive: string;
14
+ isDir: boolean;
15
+ hashMd5?: string;
16
+ }
17
+
18
+ export interface DirectoryList {
19
+ fileInfos: FileInfo[];
20
+ pageToken?: string;
21
+ }
@@ -0,0 +1,12 @@
1
+ import { FileDeleteActionRequester } from './FileDeleteActionTypes';
2
+ import { FileActionType } from './FileActionType';
3
+
4
+ export function* askFileDelete(drive: string, filepaths: string[]): FileDeleteActionRequester {
5
+ return yield {
6
+ type: FileActionType.Delete,
7
+ payload: {
8
+ drive,
9
+ filepaths,
10
+ },
11
+ };
12
+ }
@@ -1,12 +1,18 @@
1
1
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
2
  import { FileActionType } from './FileActionType';
3
+
4
+ // Payload
3
5
  export interface FileDeleteActionPayload {
4
- drive: string;
5
- filepaths: string[];
6
+ drive: string;
7
+ filepaths: string[];
6
8
  }
9
+
10
+ // Action
7
11
  export interface FileDeleteAction extends Action<FileDeleteActionPayload> {
8
- type: FileActionType.Delete;
9
- payload: FileDeleteActionPayload;
12
+ type: FileActionType.Delete;
13
+ payload: FileDeleteActionPayload;
10
14
  }
15
+
16
+ // Function Types
11
17
  export type FileDeleteActionProcessor = ActionProcessor<FileDeleteAction, string[]>;
12
18
  export type FileDeleteActionRequester = ActionRequester<FileDeleteAction, string[]>;
@@ -0,0 +1,12 @@
1
+ import { FileExistsActionRequester } from './FileExistsActionTypes';
2
+ import { FileActionType } from './FileActionType';
3
+
4
+ export function* askFileExists(drive: string, filepath: string): FileExistsActionRequester {
5
+ return yield {
6
+ type: FileActionType.Exists,
7
+ payload: {
8
+ drive,
9
+ filepath,
10
+ },
11
+ };
12
+ }
@@ -1,12 +1,18 @@
1
1
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
2
  import { FileActionType } from './FileActionType';
3
+
4
+ // Payload
3
5
  export interface FileExistsActionPayload {
4
- drive: string;
5
- filepath: string;
6
+ drive: string;
7
+ filepath: string;
6
8
  }
9
+
10
+ // Action
7
11
  export interface FileExistsAction extends Action<FileExistsActionPayload> {
8
- type: FileActionType.Exists;
9
- payload: FileExistsActionPayload;
12
+ type: FileActionType.Exists;
13
+ payload: FileExistsActionPayload;
10
14
  }
15
+
16
+ // Function Types
11
17
  export type FileExistsActionProcessor = ActionProcessor<FileExistsAction, boolean>;
12
18
  export type FileExistsActionRequester = ActionRequester<FileExistsAction, boolean>;
@@ -0,0 +1,42 @@
1
+ import { FileListDirectoryActionRequester } from './FileListDirectoryActionTypes';
2
+ import { FileActionType, FileInfo } from './FileActionType';
3
+ import { AskResponse } from '../../types/StorySession';
4
+
5
+ export function* askFileListDirectory(
6
+ drive: string,
7
+ folderPath: string,
8
+ maxFiles: number = 1000,
9
+ pageToken?: string,
10
+ ): FileListDirectoryActionRequester {
11
+ return yield {
12
+ type: FileActionType.ListDirectory,
13
+ payload: {
14
+ drive,
15
+ folderPath,
16
+ pageToken,
17
+ maxFiles,
18
+ },
19
+ };
20
+ }
21
+
22
+ export function* askFileListAllDirectory(
23
+ drive: string,
24
+ folderPath: string,
25
+ ): AskResponse<FileInfo[]> {
26
+ var pageToken: string | undefined;
27
+ let fileInfos: FileInfo[] = [];
28
+
29
+ while (true) {
30
+ const directoryInfo = yield* askFileListDirectory(drive, folderPath, 1000, pageToken);
31
+
32
+ fileInfos = [...fileInfos, ...directoryInfo.fileInfos];
33
+
34
+ if (!directoryInfo.pageToken) {
35
+ break;
36
+ }
37
+
38
+ pageToken = directoryInfo.pageToken;
39
+ }
40
+
41
+ return fileInfos;
42
+ }
@@ -0,0 +1,26 @@
1
+ import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
+ import { FileActionType, DirectoryList } from './FileActionType';
3
+
4
+ // Payload
5
+ export interface FileListDirectoryActionPayload {
6
+ drive: string;
7
+ folderPath: string;
8
+ maxFiles: number;
9
+ pageToken?: string;
10
+ }
11
+
12
+ // Action
13
+ export interface FileListDirectoryAction extends Action<FileListDirectoryActionPayload> {
14
+ type: FileActionType.ListDirectory;
15
+ payload: FileListDirectoryActionPayload;
16
+ }
17
+
18
+ // Function Types
19
+ export type FileListDirectoryActionProcessor = ActionProcessor<
20
+ FileListDirectoryAction,
21
+ DirectoryList
22
+ >;
23
+ export type FileListDirectoryActionRequester = ActionRequester<
24
+ FileListDirectoryAction,
25
+ DirectoryList
26
+ >;
@@ -0,0 +1,15 @@
1
+ import { FileReadTextContentsActionRequester } from './FileReadTextContentsActionTypes';
2
+ import { FileActionType } from './FileActionType';
3
+
4
+ export function* askFileReadTextContents(
5
+ drive: string,
6
+ filepath: string,
7
+ ): FileReadTextContentsActionRequester {
8
+ return yield {
9
+ type: FileActionType.ReadTextContents,
10
+ payload: {
11
+ drive,
12
+ filepath,
13
+ },
14
+ };
15
+ }
@@ -1,12 +1,24 @@
1
1
  import { Action, ActionProcessor, ActionRequester } from '../../types/Action';
2
2
  import { FileActionType } from './FileActionType';
3
+
4
+ // Payload
3
5
  export interface FileReadTextContentsActionPayload {
4
- drive: string;
5
- filepath: string;
6
+ drive: string;
7
+ filepath: string;
6
8
  }
9
+
10
+ // Action
7
11
  export interface FileReadTextContentsAction extends Action<FileReadTextContentsActionPayload> {
8
- type: FileActionType.ReadTextContents;
9
- payload: FileReadTextContentsActionPayload;
12
+ type: FileActionType.ReadTextContents;
13
+ payload: FileReadTextContentsActionPayload;
10
14
  }
11
- export type FileReadTextContentsActionProcessor = ActionProcessor<FileReadTextContentsAction, string>;
12
- export type FileReadTextContentsActionRequester = ActionRequester<FileReadTextContentsAction, string>;
15
+
16
+ // Function Types
17
+ export type FileReadTextContentsActionProcessor = ActionProcessor<
18
+ FileReadTextContentsAction,
19
+ string
20
+ >;
21
+ export type FileReadTextContentsActionRequester = ActionRequester<
22
+ FileReadTextContentsAction,
23
+ string
24
+ >;