@beseif-solutions/prow-core 0.2.7 → 0.3.0
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/dist/entities/events.d.ts +15 -33
- package/package.json +1 -1
- package/src/entities/events.ts +15 -15
|
@@ -35,9 +35,7 @@ type SetupEventConfig = EventConfig & {
|
|
|
35
35
|
type MemoryEventConfig = EventConfig & {
|
|
36
36
|
memory?: Record<string, any>;
|
|
37
37
|
};
|
|
38
|
-
type CommonEvents<Config extends EventConfig = {
|
|
39
|
-
fields: Record<string, any>;
|
|
40
|
-
}> = Common<Config> & {
|
|
38
|
+
type CommonEvents<Config extends EventConfig> = Common<Config> & {
|
|
41
39
|
model: `event`;
|
|
42
40
|
categorization: {
|
|
43
41
|
department: string;
|
|
@@ -55,14 +53,11 @@ type CommonEvents<Config extends EventConfig = {
|
|
|
55
53
|
};
|
|
56
54
|
export type Request = {
|
|
57
55
|
method: string;
|
|
58
|
-
headers: Record<string,
|
|
59
|
-
query: Record<string,
|
|
56
|
+
headers: Record<string, any>;
|
|
57
|
+
query: Record<string, any>;
|
|
60
58
|
body: any;
|
|
61
59
|
};
|
|
62
|
-
export type ImmediateTrigger<Config extends SetupEventConfig = {
|
|
63
|
-
fields: Record<string, any>;
|
|
64
|
-
setup: Record<string, any>;
|
|
65
|
-
}> = CommonEvents<Config> & {
|
|
60
|
+
export type ImmediateTrigger<Config extends SetupEventConfig> = CommonEvents<Config> & {
|
|
66
61
|
type: `trigger`;
|
|
67
62
|
immediate: true;
|
|
68
63
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>];
|
|
@@ -139,9 +134,7 @@ export type ImmediateTrigger<Config extends SetupEventConfig = {
|
|
|
139
134
|
}>;
|
|
140
135
|
};
|
|
141
136
|
};
|
|
142
|
-
export type ScheduledTrigger<Config extends EventConfig = {
|
|
143
|
-
fields: Record<string, any>;
|
|
144
|
-
}> = CommonEvents<Config> & {
|
|
137
|
+
export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config> & {
|
|
145
138
|
type: `trigger`;
|
|
146
139
|
immediate: false;
|
|
147
140
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>];
|
|
@@ -160,22 +153,15 @@ export type ScheduledTrigger<Config extends EventConfig = {
|
|
|
160
153
|
}>;
|
|
161
154
|
};
|
|
162
155
|
};
|
|
163
|
-
export type Trigger<Config extends EventConfig = {
|
|
164
|
-
fields: Record<string, any>;
|
|
165
|
-
}> = ImmediateTrigger<Config> | ScheduledTrigger<Config>;
|
|
156
|
+
export type Trigger<Config extends EventConfig = {}> = ImmediateTrigger<Config> | ScheduledTrigger<Config>;
|
|
166
157
|
type StandardOutput<Config extends EventConfig> = {
|
|
167
158
|
output: OneOrArray<Config[`outputs`]>;
|
|
168
159
|
flags: Partial<Record<Config[`flags`][`outputs`][number], true>>;
|
|
169
160
|
};
|
|
170
|
-
type MemoryOutput<Config extends MemoryEventConfig = {
|
|
171
|
-
memory: Record<string, any>;
|
|
172
|
-
}> = {
|
|
161
|
+
type MemoryOutput<Config extends MemoryEventConfig> = {
|
|
173
162
|
memory: Config[`memory`];
|
|
174
163
|
} & (StandardOutput<Config> | {});
|
|
175
|
-
export type SyncAction<Config extends MemoryEventConfig = {
|
|
176
|
-
fields: Record<string, any>;
|
|
177
|
-
memory: Record<string, any>;
|
|
178
|
-
}> = CommonEvents<Config> & {
|
|
164
|
+
export type SyncAction<Config extends MemoryEventConfig> = CommonEvents<Config> & {
|
|
179
165
|
type: `action`;
|
|
180
166
|
inputs: [DefaultConnectableEvent<Config[`flags`][`inputs`][number]>, ...AdditionalConnectableEvent<Config[`flags`][`inputs`][number]>[]];
|
|
181
167
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>, ...(AdditionalConnectableEvent<Config[`flags`][`outputs`][number]> | ErrorConnectableEvent<Config[`flags`][`outputs`][number]>)[]];
|
|
@@ -191,10 +177,7 @@ export type SyncAction<Config extends MemoryEventConfig = {
|
|
|
191
177
|
}>;
|
|
192
178
|
};
|
|
193
179
|
};
|
|
194
|
-
export type AsyncAction<Config extends SetupEventConfig = {
|
|
195
|
-
fields: Record<string, any>;
|
|
196
|
-
setup: Record<string, any>;
|
|
197
|
-
}> = CommonEvents<Config> & {
|
|
180
|
+
export type AsyncAction<Config extends SetupEventConfig & MemoryEventConfig> = CommonEvents<Config> & {
|
|
198
181
|
type: `action`;
|
|
199
182
|
inputs: [DefaultConnectableEvent<Config[`flags`][`inputs`][number]>, ...AdditionalConnectableEvent<Config[`flags`][`inputs`][number]>[]];
|
|
200
183
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>, ...(AdditionalConnectableEvent<Config[`flags`][`outputs`][number]> | ErrorConnectableEvent<Config[`flags`][`outputs`][number]>)[]];
|
|
@@ -229,10 +212,11 @@ export type AsyncAction<Config extends SetupEventConfig = {
|
|
|
229
212
|
flags: Partial<Record<Config[`flags`][`inputs`][number], true>>;
|
|
230
213
|
link: string;
|
|
231
214
|
setup?: Config[`setup`];
|
|
215
|
+
memory?: Config[`memory`];
|
|
232
216
|
};
|
|
233
217
|
outputs: {
|
|
234
218
|
done: boolean;
|
|
235
|
-
|
|
219
|
+
memory?: Config[`memory`];
|
|
236
220
|
};
|
|
237
221
|
}>;
|
|
238
222
|
handle: CoreFunction<{
|
|
@@ -241,6 +225,7 @@ export type AsyncAction<Config extends SetupEventConfig = {
|
|
|
241
225
|
fields: Config[`fields`];
|
|
242
226
|
request: Request;
|
|
243
227
|
setup?: Config[`setup`];
|
|
228
|
+
memory?: Config[`memory`];
|
|
244
229
|
};
|
|
245
230
|
outputs: StandardOutput<Config>;
|
|
246
231
|
}>;
|
|
@@ -250,6 +235,7 @@ export type AsyncAction<Config extends SetupEventConfig = {
|
|
|
250
235
|
fields: Config[`fields`];
|
|
251
236
|
link: string;
|
|
252
237
|
setup?: Config[`setup`];
|
|
238
|
+
memory?: Config[`memory`];
|
|
253
239
|
};
|
|
254
240
|
outputs: {
|
|
255
241
|
done: boolean;
|
|
@@ -257,12 +243,8 @@ export type AsyncAction<Config extends SetupEventConfig = {
|
|
|
257
243
|
}>;
|
|
258
244
|
};
|
|
259
245
|
};
|
|
260
|
-
export type Action<Config extends EventConfig = {
|
|
261
|
-
|
|
262
|
-
}> = SyncAction<Config> | AsyncAction<Config>;
|
|
263
|
-
export type Event<Config extends EventConfig = {
|
|
264
|
-
fields: Record<string, any>;
|
|
265
|
-
}> = Action<Config> | Trigger<Config>;
|
|
246
|
+
export type Action<Config extends EventConfig = {}> = SyncAction<Config> | AsyncAction<Config>;
|
|
247
|
+
export type Event<Config extends EventConfig = {}> = Action<Config> | Trigger<Config>;
|
|
266
248
|
export declare const scheduledTriggerSchema: () => Joi.ObjectSchema<any>;
|
|
267
249
|
export declare const immediateTriggerSchema: () => Joi.ObjectSchema<any>;
|
|
268
250
|
export declare const triggerSchema: () => Joi.AlternativesSchema<any>;
|
package/package.json
CHANGED
package/src/entities/events.ts
CHANGED
|
@@ -45,7 +45,7 @@ type MemoryEventConfig = EventConfig & {
|
|
|
45
45
|
memory?: Record<string, any>,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
type CommonEvents<Config extends EventConfig
|
|
48
|
+
type CommonEvents<Config extends EventConfig> = Common<Config> & {
|
|
49
49
|
model: `event`,
|
|
50
50
|
categorization: {
|
|
51
51
|
department: string,
|
|
@@ -64,12 +64,12 @@ type CommonEvents<Config extends EventConfig = { fields: Record<string, any> }>
|
|
|
64
64
|
|
|
65
65
|
export type Request = {
|
|
66
66
|
method: string,
|
|
67
|
-
headers: Record<string,
|
|
68
|
-
query: Record<string,
|
|
67
|
+
headers: Record<string, any>,
|
|
68
|
+
query: Record<string, any>,
|
|
69
69
|
body: any,
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
export type ImmediateTrigger<Config extends SetupEventConfig
|
|
72
|
+
export type ImmediateTrigger<Config extends SetupEventConfig> = CommonEvents<Config> & {
|
|
73
73
|
type: `trigger`,
|
|
74
74
|
immediate: true,
|
|
75
75
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>],
|
|
@@ -107,7 +107,7 @@ export type ImmediateTrigger<Config extends SetupEventConfig = { fields: Record<
|
|
|
107
107
|
},
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
export type ScheduledTrigger<Config extends EventConfig
|
|
110
|
+
export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config> & {
|
|
111
111
|
type: `trigger`,
|
|
112
112
|
immediate: false,
|
|
113
113
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>],
|
|
@@ -120,18 +120,18 @@ export type ScheduledTrigger<Config extends EventConfig = { fields: Record<strin
|
|
|
120
120
|
},
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
-
export type Trigger<Config extends EventConfig = {
|
|
123
|
+
export type Trigger<Config extends EventConfig = {}> =
|
|
124
124
|
| ImmediateTrigger<Config>
|
|
125
125
|
| ScheduledTrigger<Config>;
|
|
126
126
|
|
|
127
127
|
type StandardOutput<Config extends EventConfig> =
|
|
128
128
|
{ output: OneOrArray<Config[`outputs`]>, flags: Partial<Record<Config[`flags`][`outputs`][number], true>> };
|
|
129
129
|
|
|
130
|
-
type MemoryOutput<Config extends MemoryEventConfig
|
|
130
|
+
type MemoryOutput<Config extends MemoryEventConfig> = {
|
|
131
131
|
memory: Config[`memory`],
|
|
132
132
|
} & (StandardOutput<Config> | {});
|
|
133
133
|
|
|
134
|
-
export type SyncAction<Config extends MemoryEventConfig
|
|
134
|
+
export type SyncAction<Config extends MemoryEventConfig> = CommonEvents<Config> & {
|
|
135
135
|
type: `action`,
|
|
136
136
|
inputs: [DefaultConnectableEvent<Config[`flags`][`inputs`][number]>, ...AdditionalConnectableEvent<Config[`flags`][`inputs`][number]>[]],
|
|
137
137
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>, ...(AdditionalConnectableEvent<Config[`flags`][`outputs`][number]> | ErrorConnectableEvent<Config[`flags`][`outputs`][number]>)[]],
|
|
@@ -144,7 +144,7 @@ export type SyncAction<Config extends MemoryEventConfig = { fields: Record<strin
|
|
|
144
144
|
},
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
export type AsyncAction<Config extends SetupEventConfig
|
|
147
|
+
export type AsyncAction<Config extends SetupEventConfig & MemoryEventConfig> = CommonEvents<Config> & {
|
|
148
148
|
type: `action`,
|
|
149
149
|
inputs: [DefaultConnectableEvent<Config[`flags`][`inputs`][number]>, ...AdditionalConnectableEvent<Config[`flags`][`inputs`][number]>[]],
|
|
150
150
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>, ...(AdditionalConnectableEvent<Config[`flags`][`outputs`][number]> | ErrorConnectableEvent<Config[`flags`][`outputs`][number]>)[]],
|
|
@@ -162,26 +162,26 @@ export type AsyncAction<Config extends SetupEventConfig = { fields: Record<strin
|
|
|
162
162
|
}>,
|
|
163
163
|
execute: CoreFunction<{
|
|
164
164
|
credentials: Config[`credentials`],
|
|
165
|
-
inputs: { fields: Config[`fields`], flags: Partial<Record<Config[`flags`][`inputs`][number], true>>, link: string, setup?: Config[`setup`] },
|
|
166
|
-
outputs: { done: boolean,
|
|
165
|
+
inputs: { fields: Config[`fields`], flags: Partial<Record<Config[`flags`][`inputs`][number], true>>, link: string, setup?: Config[`setup`], memory?: Config[`memory`] },
|
|
166
|
+
outputs: { done: boolean, memory?: Config[`memory`] },
|
|
167
167
|
}>,
|
|
168
168
|
handle: CoreFunction<{
|
|
169
169
|
credentials: Config[`credentials`],
|
|
170
|
-
inputs: { fields: Config[`fields`], request: Request, setup?: Config[`setup`] },
|
|
170
|
+
inputs: { fields: Config[`fields`], request: Request, setup?: Config[`setup`], memory?: Config[`memory`] },
|
|
171
171
|
outputs: StandardOutput<Config>,
|
|
172
172
|
}>,
|
|
173
173
|
fire?: CoreFunction<{
|
|
174
174
|
credentials: Config[`credentials`],
|
|
175
|
-
inputs: { fields: Config[`fields`], link: string, setup?: Config[`setup`] },
|
|
175
|
+
inputs: { fields: Config[`fields`], link: string, setup?: Config[`setup`], memory?: Config[`memory`] },
|
|
176
176
|
outputs: { done: boolean },
|
|
177
177
|
}>,
|
|
178
178
|
},
|
|
179
179
|
};
|
|
180
|
-
export type Action<Config extends EventConfig = {
|
|
180
|
+
export type Action<Config extends EventConfig = {}> =
|
|
181
181
|
| SyncAction<Config>
|
|
182
182
|
| AsyncAction<Config>;
|
|
183
183
|
|
|
184
|
-
export type Event<Config extends EventConfig = {
|
|
184
|
+
export type Event<Config extends EventConfig = {}> =
|
|
185
185
|
| Action<Config>
|
|
186
186
|
| Trigger<Config>;
|
|
187
187
|
|