eligius 1.0.17 → 1.0.19

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,5 +1,4 @@
1
- import { TOperationData } from '.';
2
- import { TOperation } from './types';
1
+ import { TOperation, TOperationData } from './types';
3
2
  /**
4
3
  * This operation checks if the current loop should end or start the next iteration.
5
4
  *
@@ -0,0 +1,35 @@
1
+ import { IResolvedOperation } from '../../configuration/types';
2
+ /**
3
+ * This function can be used to find the index of a matching operation within a list of operations.
4
+ *
5
+ * Given the array of operations:
6
+ * ```ts
7
+ * [
8
+ * {systemName:'name1'}, // index 0
9
+ * {systemName:'startLoop'}, // index 1
10
+ * {systemName:'name2'}, // index 2
11
+ * {systemName:'startLoop'} // index 3
12
+ * {systemName:'name3'} // index 4
13
+ * {systemName:'endLoop'} // index 5
14
+ * {systemName:'endLoop'} // index 6
15
+ * {systemName:'name3'} // index 7
16
+ * ]
17
+ * ```
18
+ *
19
+ * Given the startLoop instance at index 1, this function will return index 6. Given the startLoop at index 3, it will yield index 5.
20
+ *
21
+ * Returns true when the given operation.systemName equals the specified matchingName and the current counter value is zero.
22
+ *
23
+ * If the matchingName matches operation.systemName but the counter is greater than zero, the counter is decremented.
24
+ *
25
+ * If the operation.systemName equal self (the name of the operation that requires to find its match), then counter is incremented.
26
+ *
27
+ * @param this
28
+ * @param operation
29
+ * @returns
30
+ */
31
+ export declare function findMatchingOperationIndex(this: {
32
+ counter: number;
33
+ self: string;
34
+ matchingName: string;
35
+ }, operation: IResolvedOperation): boolean;
@@ -0,0 +1 @@
1
+ export declare function removeGlobal(name: string): void;
@@ -1,2 +1,2 @@
1
- import { TOperationData } from '../../operation/types';
2
- export declare function resolveEventArguments(operationData: TOperationData, eventArgs?: any[]): any[] | undefined;
1
+ import { IOperationContext, TOperationData } from '../../operation/types';
2
+ export declare function resolveEventArguments(operationData: TOperationData, operationContext: IOperationContext, eventArgs?: any[]): any[] | undefined;
@@ -1,3 +1,4 @@
1
+ import { IOperationContext } from '../types';
1
2
  /**
2
3
  * Resolves operation and global data property chains.
3
4
  *
@@ -10,4 +11,4 @@
10
11
  * @param propertyChainOrRegularObject A period delimited string, or just a regular object
11
12
  * @returns
12
13
  */
13
- export declare function resolveOperationOrGlobalDataPropertyChain(sourceObject: any, propertyChainOrRegularObject: any): any;
14
+ export declare function resolveExternalPropertyChain(sourceObject: any, operationContext: IOperationContext, propertyChainOrRegularObject: any): any;
@@ -1,2 +1,2 @@
1
- import { TOperationData } from '../../operation/types';
2
- export declare function resolvePropertyValues<T extends TOperationData>(operationData: T, properties: Record<string, any>): T;
1
+ import { IOperationContext, TOperationData } from '../../operation/types';
2
+ export declare function resolvePropertyValues<T extends TOperationData>(operationData: T, operationContext: IOperationContext, properties: Record<string, any>): T;
@@ -1,13 +1,12 @@
1
1
  import { TOperation } from './types';
2
2
  export declare type TStartLoopOperationData = {
3
3
  collection: any[] | string;
4
- currentItem: any;
5
4
  };
6
5
  /**
7
6
  * This operation starts a loop using the given collection.
8
7
  *
9
8
  * Each iteration the current item from the specified collection is
10
- * assigned to the `currentItem` property on the current operation data.
9
+ * assigned to the `currentItem` property on the operation context.
11
10
  *
12
11
  * @param operationData
13
12
  * @returns
@@ -1,13 +1,55 @@
1
+ import { IResolvedOperation } from '../configuration/types';
1
2
  import { IEventbus } from '../eventbus';
2
3
  export declare type TOperationData = Record<string, any>;
3
4
  export declare type TOperationResult<T = TOperationData> = Promise<T> | T;
4
5
  export interface IOperationContext {
6
+ /**
7
+ * When inside a loop, this is the current iteration of said loop
8
+ */
5
9
  loopIndex?: number;
10
+ /**
11
+ * The number of iterations for the current loop
12
+ */
6
13
  loopLength?: number;
7
- startIndex?: number;
14
+ /**
15
+ * The start index of the loop within the total number of operations
16
+ */
17
+ loopStartIndex?: number;
18
+ /**
19
+ * The end index of the loop within the total number of operations
20
+ */
21
+ loopEndIndex?: number;
22
+ /**
23
+ * Set this index to change the current item in the main operations loop
24
+ */
8
25
  newIndex?: number;
26
+ /**
27
+ * The current index with in the main operations loop
28
+ */
9
29
  currentIndex: number;
10
- skipNextOperation?: boolean;
30
+ /**
31
+ * The eventbus instance shared amongst actions and operations
32
+ */
11
33
  eventbus: IEventbus;
34
+ /**
35
+ * The list of operations that is currently being executed
36
+ */
37
+ operations: IResolvedOperation[];
38
+ /**
39
+ * The result of the last when evaluation, if any
40
+ */
41
+ whenEvaluation?: boolean;
42
+ /**
43
+ *
44
+ */
45
+ owner?: any;
46
+ /**
47
+ *
48
+ */
49
+ currentItem?: any;
50
+ /**
51
+ *
52
+ */
53
+ parent?: IOperationContext;
12
54
  }
13
55
  export declare type TOperation<T = TOperationData> = (this: IOperationContext, operationData: T) => TOperationResult<T>;
@@ -1,6 +1,6 @@
1
1
  import { TOperation } from './types';
2
2
  declare type TOperator = '!=' | '==' | '>=' | '<=' | '>' | '<';
3
- declare type TValue = `'${string}'` | number | `operationdata.${string}` | `globaldata.${string}`;
3
+ declare type TValue = `'${string}'` | number | `operationdata.${string}` | `globaldata.${string}` | `context.${string}`;
4
4
  declare type TExpression = `${TValue}${TOperator}${TValue}`;
5
5
  export interface IWhenOperationData {
6
6
  expression: TExpression;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.17",
2
+ "version": "1.0.19",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "homepage": "https://rolandzwaga.github.io/eligius/",
@@ -75,7 +75,7 @@
75
75
  "ts-node": "10.9.1",
76
76
  "tsconfig-paths": "4.1.0",
77
77
  "tslib": "2.4.1",
78
- "typedoc": "0.23.19",
78
+ "typedoc": "0.23.20",
79
79
  "typedoc-plugin-missing-exports": "1.0.0",
80
80
  "typescript": "4.8.4",
81
81
  "uvu": "0.5.6",