quidproquo-core 0.0.161 → 0.0.162

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.
@@ -1,3 +1,3 @@
1
- import { KeyValueStoreQueryActionRequester } from './KeyValueStoreQueryActionTypes';
1
+ import { KeyValueStoreQueryActionRequester, KeyValueStoreQueryOptions } from './KeyValueStoreQueryActionTypes';
2
2
  import { KvsQueryOperation } from './types';
3
- export declare function askKeyValueStoreQuery<KvsItem>(keyValueStoreName: string, keyCondition: KvsQueryOperation, filterCondition?: KvsQueryOperation, nextPageKey?: string): KeyValueStoreQueryActionRequester<KvsItem>;
3
+ export declare function askKeyValueStoreQuery<KvsItem>(keyValueStoreName: string, keyCondition: KvsQueryOperation, options?: KeyValueStoreQueryOptions): KeyValueStoreQueryActionRequester<KvsItem>;
@@ -2,14 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.askKeyValueStoreQuery = void 0;
4
4
  const KeyValueStoreActionType_1 = require("./KeyValueStoreActionType");
5
- function* askKeyValueStoreQuery(keyValueStoreName, keyCondition, filterCondition, nextPageKey) {
5
+ function* askKeyValueStoreQuery(keyValueStoreName, keyCondition, options) {
6
6
  return yield {
7
7
  type: KeyValueStoreActionType_1.KeyValueStoreActionType.Query,
8
8
  payload: {
9
9
  keyValueStoreName,
10
10
  keyCondition,
11
- filterCondition,
12
- nextPageKey,
11
+ options,
13
12
  },
14
13
  };
15
14
  }
@@ -4,12 +4,15 @@ import { KvsQueryOperation } from './types';
4
4
  import { QpqPagedData } from '../../types';
5
5
  export interface KeyValueStoreQueryOptions {
6
6
  ttlInSeconds?: number;
7
+ sortAscending?: boolean;
8
+ limit?: number;
9
+ nextPageKey?: string;
10
+ filter?: KvsQueryOperation;
7
11
  }
8
12
  export interface KeyValueStoreQueryActionPayload {
9
13
  keyValueStoreName: string;
10
14
  keyCondition: KvsQueryOperation;
11
- filterCondition?: KvsQueryOperation;
12
- nextPageKey?: string;
15
+ options?: KeyValueStoreQueryOptions;
13
16
  }
14
17
  export interface KeyValueStoreQueryAction extends Action<KeyValueStoreQueryActionPayload> {
15
18
  type: KeyValueStoreActionType.Query;
@@ -4,6 +4,12 @@ exports.askBatch = void 0;
4
4
  const SystemActionType_1 = require("./SystemActionType");
5
5
  // TODO: Make typings better
6
6
  function* askBatch(actions) {
7
+ // If we only have one action, just execute it directly
8
+ // No need to batch it
9
+ if (actions.length === 1) {
10
+ return [yield actions[0]];
11
+ }
12
+ // Otherwise, batch the actions
7
13
  return yield { type: SystemActionType_1.SystemActionType.Batch, payload: { actions } };
8
14
  }
9
15
  exports.askBatch = askBatch;
@@ -7,5 +7,5 @@ export interface SystemBatchAction extends Action<SystemBatchActionPayload> {
7
7
  type: SystemActionType.Batch;
8
8
  payload: SystemBatchActionPayload;
9
9
  }
10
- export type SystemBatchActionProcessor<TReturn extends Array<any>> = ActionProcessor<SystemBatchAction, TReturn>;
11
- export type SystemBatchActionRequester<TReturn extends Array<any>> = ActionRequester<SystemBatchAction, TReturn>;
10
+ export type SystemBatchActionProcessor<TReturn extends Array<any>> = ActionProcessor<SystemBatchAction | Action<any>, TReturn>;
11
+ export type SystemBatchActionRequester<TReturn extends Array<any>> = ActionRequester<SystemBatchAction | Action<any>, TReturn>;
@@ -8,3 +8,4 @@ export * from './logic/actionLogic';
8
8
  export * from './qpqExecuteLog';
9
9
  export * from './logic';
10
10
  export * from './serviceConfig';
11
+ export * from './utils';
@@ -37,3 +37,4 @@ __exportStar(require("./logic/actionLogic"), exports);
37
37
  __exportStar(require("./qpqExecuteLog"), exports);
38
38
  __exportStar(require("./logic"), exports);
39
39
  __exportStar(require("./serviceConfig"), exports);
40
+ __exportStar(require("./utils"), exports);
@@ -3,10 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.askRunParallel = void 0;
4
4
  const actions_1 = require("../../actions");
5
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
6
  // Begin executing the stories
11
7
  const storyProgress = storyRuntimes.map((input) => ({
12
8
  iterator: input,
@@ -0,0 +1,2 @@
1
+ import { AskResponse } from './StorySession';
2
+ export type BoundLogicStory<Func> = Func extends (arg: any, ...args: infer Args) => AskResponse<infer R> ? (...args: Args) => AskResponse<R> : never;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { AskResponse } from './StorySession';
2
+ export type UnboundLogicStory<ApiDeps, Args extends any[], R> = (dependencies: ApiDeps, ...args: Args) => AskResponse<R>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -11,3 +11,5 @@ export * from './QpqPagedData';
11
11
  export * from './QpqContextIdentifier';
12
12
  export * from './DeployEvent';
13
13
  export * from './FullyQualifiedResource';
14
+ export * from './BoundLogicStory';
15
+ export * from './UnboundLogicStory';
@@ -27,3 +27,5 @@ __exportStar(require("./QpqPagedData"), exports);
27
27
  __exportStar(require("./QpqContextIdentifier"), exports);
28
28
  __exportStar(require("./DeployEvent"), exports);
29
29
  __exportStar(require("./FullyQualifiedResource"), exports);
30
+ __exportStar(require("./BoundLogicStory"), exports);
31
+ __exportStar(require("./UnboundLogicStory"), exports);
@@ -0,0 +1,4 @@
1
+ import { AskResponse, BoundLogicStory } from '../../types';
2
+ export declare function bindApi<ApiDeps, ApiFunctions extends Record<string, (...args: any) => AskResponse<any>>>(dependencies: ApiDeps, apiFunctions: ApiFunctions): {
3
+ [K in keyof ApiFunctions]: BoundLogicStory<ApiFunctions[K]>;
4
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bindApi = void 0;
4
+ const bindApiFunction_1 = require("./bindApiFunction");
5
+ function bindApi(dependencies, apiFunctions) {
6
+ const boundFunctions = Object.keys(apiFunctions).reduce((acc, key) => {
7
+ const func = apiFunctions[key];
8
+ acc[key] = (0, bindApiFunction_1.bindApiFunction)(dependencies, func);
9
+ return acc;
10
+ }, {});
11
+ return boundFunctions;
12
+ }
13
+ exports.bindApi = bindApi;
@@ -0,0 +1,2 @@
1
+ import { BoundLogicStory, UnboundLogicStory } from '../../types';
2
+ export declare function bindApiFunction<ApiDeps, Args extends any[], R>(dependencies: ApiDeps, askFunction: UnboundLogicStory<ApiDeps, Args, R>): BoundLogicStory<UnboundLogicStory<ApiDeps, Args, R>>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bindApiFunction = void 0;
4
+ function bindApiFunction(dependencies, askFunction) {
5
+ return function (...args) {
6
+ return askFunction(dependencies, ...args);
7
+ };
8
+ }
9
+ exports.bindApiFunction = bindApiFunction;
@@ -0,0 +1,2 @@
1
+ export * from './bindApi';
2
+ export * from './bindApiFunction';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./bindApi"), exports);
18
+ __exportStar(require("./bindApiFunction"), exports);
@@ -0,0 +1 @@
1
+ export * from './functions';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./functions"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-core",
3
- "version": "0.0.161",
3
+ "version": "0.0.162",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "types": "./lib/commonjs/index.d.js",