quidproquo-core 0.0.159 → 0.0.161
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/lib/commonjs/actions/keyValueStore/KeyValueStoreUpdateActionTypes.d.ts +2 -2
- package/lib/commonjs/actions/system/SystemRunParallelActionRequester.d.ts +10 -1
- package/lib/commonjs/actions/system/SystemRunParallelActionRequester.js +12 -6
- package/lib/commonjs/stories/array/askFilter.d.ts +1 -1
- package/lib/commonjs/stories/array/askMapParallel.d.ts +2 -0
- package/lib/commonjs/stories/array/askMapParallel.js +9 -0
- package/lib/commonjs/stories/array/index.d.ts +1 -0
- package/lib/commonjs/stories/array/index.js +1 -0
- package/lib/commonjs/stories/system/askCatch.d.ts +1 -1
- package/lib/commonjs/stories/system/askCatch.js +1 -1
- package/lib/commonjs/stories/system/askRunParallel.d.ts +4 -0
- package/lib/commonjs/stories/system/askRunParallel.js +31 -0
- package/lib/commonjs/stories/system/index.d.ts +2 -1
- package/lib/commonjs/stories/system/index.js +1 -0
- package/package.json +1 -1
|
@@ -14,5 +14,5 @@ export interface KeyValueStoreUpdateAction<Value> extends Action<KeyValueStoreUp
|
|
|
14
14
|
type: KeyValueStoreActionType.Update;
|
|
15
15
|
payload: KeyValueStoreUpdateActionPayload<Value>;
|
|
16
16
|
}
|
|
17
|
-
export type KeyValueStoreUpdateActionProcessor<Value> = ActionProcessor<KeyValueStoreUpdateAction<Value>,
|
|
18
|
-
export type KeyValueStoreUpdateActionRequester<Value> = ActionRequester<KeyValueStoreUpdateAction<Value>,
|
|
17
|
+
export type KeyValueStoreUpdateActionProcessor<Value> = ActionProcessor<KeyValueStoreUpdateAction<Value>, Value>;
|
|
18
|
+
export type KeyValueStoreUpdateActionRequester<Value> = ActionRequester<KeyValueStoreUpdateAction<Value>, Value>;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import { SystemRunParallelActionRequester } from './SystemRunParallelActionTypes';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated since version X.X. Please use {@link askRunParallel} instead.
|
|
4
|
+
* Runs n number of stories in parallel. This function is deprecated and has been replaced
|
|
5
|
+
* by a more efficient and type-supported version. The replacement function provides
|
|
6
|
+
* improved performance and better type support.
|
|
7
|
+
*
|
|
8
|
+
* @param {Array<any>} stories - An array of stories to be run in parallel.
|
|
9
|
+
* @returns {SystemRunParallelActionRequester} A requester for running actions in parallel.
|
|
10
|
+
*/
|
|
11
|
+
export declare function askParallelDEPRECATED(stories: Array<any>): SystemRunParallelActionRequester;
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
// NOTE: System actions have no platform specific processors and/or requestors
|
|
3
3
|
// and therefore do not need to implement a SystemActionProcessor.ts
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.askParallelDEPRECATED = void 0;
|
|
6
6
|
const SystemBatchActionRequester_1 = require("./SystemBatchActionRequester");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated since version X.X. Please use {@link askRunParallel} instead.
|
|
9
|
+
* Runs n number of stories in parallel. This function is deprecated and has been replaced
|
|
10
|
+
* by a more efficient and type-supported version. The replacement function provides
|
|
11
|
+
* improved performance and better type support.
|
|
12
|
+
*
|
|
13
|
+
* @param {Array<any>} stories - An array of stories to be run in parallel.
|
|
14
|
+
* @returns {SystemRunParallelActionRequester} A requester for running actions in parallel.
|
|
15
|
+
*/
|
|
16
|
+
function* askParallelDEPRECATED(stories) {
|
|
11
17
|
const itt = stories.map((s) => s[0](...s.slice(1)));
|
|
12
18
|
let actions = itt.map((i) => i.next());
|
|
13
19
|
let values = actions.map((a) => a.value);
|
|
@@ -34,4 +40,4 @@ function* askParallel(stories) {
|
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
|
-
exports.
|
|
43
|
+
exports.askParallelDEPRECATED = askParallelDEPRECATED;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { AskResponse } from '../../types';
|
|
2
|
-
export declare function askFilter<T>(items: T[], askCallback: (item: T, index: number, srcArray: T[]) => AskResponse<
|
|
2
|
+
export declare function askFilter<T>(items: T[], askCallback: (item: T, index: number, srcArray: T[]) => AskResponse<boolean>): AskResponse<T[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askMapParallel = void 0;
|
|
4
|
+
const askRunParallel_1 = require("../system/askRunParallel");
|
|
5
|
+
function* askMapParallel(items, askCallback) {
|
|
6
|
+
const results = yield* (0, askRunParallel_1.askRunParallel)(items.map((item, index) => askCallback(item, index, items)));
|
|
7
|
+
return results;
|
|
8
|
+
}
|
|
9
|
+
exports.askMapParallel = askMapParallel;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AskResponse, AskResponseReturnType, EitherActionResult } from
|
|
1
|
+
import { AskResponse, AskResponseReturnType, EitherActionResult } from '../../types';
|
|
2
2
|
export declare function askCatch<T extends AskResponse<any>>(storyIterator: T): AskResponse<EitherActionResult<AskResponseReturnType<T>>>;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.askCatch = void 0;
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
function* askCatch(storyIterator) {
|
|
6
|
-
let nextResult = storyIterator.next();
|
|
7
6
|
try {
|
|
7
|
+
let nextResult = storyIterator.next();
|
|
8
8
|
while (!nextResult.done) {
|
|
9
9
|
// Add returnErrors to the action, so we can "catch" errors
|
|
10
10
|
const nextInput = yield Object.assign(Object.assign({}, nextResult.value), { returnErrors: true });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.askRunParallel = void 0;
|
|
4
|
+
const actions_1 = require("../../actions");
|
|
5
|
+
function* askRunParallel(storyRuntimes) {
|
|
6
|
+
// No need to batch if we only have one story
|
|
7
|
+
if (storyRuntimes.length === 1) {
|
|
8
|
+
return [yield* storyRuntimes[0]];
|
|
9
|
+
}
|
|
10
|
+
// Begin executing the stories
|
|
11
|
+
const storyProgress = storyRuntimes.map((input) => ({
|
|
12
|
+
iterator: input,
|
|
13
|
+
iteratorResult: input.next(),
|
|
14
|
+
}));
|
|
15
|
+
while (true) {
|
|
16
|
+
// Get all the stories that are not done
|
|
17
|
+
const activeStoryProgress = storyProgress.filter((a) => !a.iteratorResult.done);
|
|
18
|
+
if (activeStoryProgress.length === 0) {
|
|
19
|
+
return storyProgress.map((a) => a.iteratorResult.value);
|
|
20
|
+
}
|
|
21
|
+
// Get the active story actions and batch them for results
|
|
22
|
+
const batchActions = activeStoryProgress.map((a) => a.iteratorResult.value);
|
|
23
|
+
const actionResults = yield* (0, actions_1.askBatch)(batchActions);
|
|
24
|
+
// continue each story with that new value
|
|
25
|
+
for (let i = 0; i < activeStoryProgress.length; i++) {
|
|
26
|
+
const storyIterator = activeStoryProgress[i];
|
|
27
|
+
storyIterator.iteratorResult = storyIterator.iterator.next(actionResults[i]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.askRunParallel = askRunParallel;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './askCatch';
|
|
2
|
+
export * from './askRunParallel';
|