@beseif-solutions/prow-core 0.3.0 → 0.3.1
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.
|
@@ -3,7 +3,7 @@ import { Core } from "../core";
|
|
|
3
3
|
export type CoreConfig = {
|
|
4
4
|
inputs?: Record<string, any>;
|
|
5
5
|
credentials?: Record<string, any>;
|
|
6
|
-
outputs?:
|
|
6
|
+
outputs?: any;
|
|
7
7
|
};
|
|
8
8
|
export type CoreFunction<Config extends CoreConfig = {}> = (core: Core, configuration: ({
|
|
9
9
|
sandbox: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Joi from "joi";
|
|
2
2
|
import { Field } from "../minified-utils/fields";
|
|
3
3
|
import { Common, CoreConfig, CoreFunction } from "./commons";
|
|
4
|
-
import {
|
|
4
|
+
import { ObjectOrArray } from "../minified-utils/types";
|
|
5
5
|
type CommonConnectableEvent<Keys extends string = string> = {
|
|
6
6
|
key: Keys;
|
|
7
7
|
};
|
|
@@ -155,7 +155,7 @@ export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config>
|
|
|
155
155
|
};
|
|
156
156
|
export type Trigger<Config extends EventConfig = {}> = ImmediateTrigger<Config> | ScheduledTrigger<Config>;
|
|
157
157
|
type StandardOutput<Config extends EventConfig> = {
|
|
158
|
-
output:
|
|
158
|
+
output: ObjectOrArray<Config[`outputs`]>;
|
|
159
159
|
flags: Partial<Record<Config[`flags`][`outputs`][number], true>>;
|
|
160
160
|
};
|
|
161
161
|
type MemoryOutput<Config extends MemoryEventConfig> = {
|
|
@@ -9,4 +9,4 @@ export type DeepPartial<T extends Record<string, any>> = {
|
|
|
9
9
|
[P in keyof T]?: T[P] extends Record<string, any> ? DeepPartial<T[P]> : T[P];
|
|
10
10
|
};
|
|
11
11
|
export type AsyncReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => Promise<infer U> ? U : T extends (...args: any[]) => infer U ? U : any;
|
|
12
|
-
export type
|
|
12
|
+
export type ObjectOrArray<T> = T extends any[] ? T : T extends Record<string, any> ? T | T[] : T[];
|
package/package.json
CHANGED
package/src/entities/commons.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Core } from "../core";
|
|
|
4
4
|
export type CoreConfig = {
|
|
5
5
|
inputs?: Record<string, any>,
|
|
6
6
|
credentials?: Record<string, any>,
|
|
7
|
-
outputs?:
|
|
7
|
+
outputs?: any,
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export type CoreFunction<Config extends CoreConfig = {}> = (core: Core, configuration: ({
|
package/src/entities/events.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Joi from "joi";
|
|
2
2
|
import { Field, fieldsSchema } from "../minified-utils/fields";
|
|
3
3
|
import { Common, commonSchema, CoreConfig, CoreFunction, idSchema } from "./commons";
|
|
4
|
-
import {
|
|
4
|
+
import { ObjectOrArray } from "../minified-utils/types";
|
|
5
5
|
|
|
6
6
|
type CommonConnectableEvent<Keys extends string = string> = {
|
|
7
7
|
key: Keys,
|
|
@@ -125,7 +125,7 @@ export type Trigger<Config extends EventConfig = {}> =
|
|
|
125
125
|
| ScheduledTrigger<Config>;
|
|
126
126
|
|
|
127
127
|
type StandardOutput<Config extends EventConfig> =
|
|
128
|
-
{ output:
|
|
128
|
+
{ output: ObjectOrArray<Config[`outputs`]>, flags: Partial<Record<Config[`flags`][`outputs`][number], true>> };
|
|
129
129
|
|
|
130
130
|
type MemoryOutput<Config extends MemoryEventConfig> = {
|
|
131
131
|
memory: Config[`memory`],
|
|
@@ -17,4 +17,7 @@ export type AsyncReturnType<T extends (...args: any[]) => any> =
|
|
|
17
17
|
T extends (...args: any[]) => infer U ? U :
|
|
18
18
|
any;
|
|
19
19
|
|
|
20
|
-
export type
|
|
20
|
+
export type ObjectOrArray<T> =
|
|
21
|
+
T extends any[] ? T
|
|
22
|
+
: T extends Record<string, any> ? T | T[]
|
|
23
|
+
: T[];
|