@beseif-solutions/prow-core 1.3.0 → 1.5.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.
@@ -149,6 +149,106 @@ export type ImmediateTrigger<Config extends SetupEventConfig> = CommonEvents<Con
149
149
  }>;
150
150
  };
151
151
  };
152
+ export type DebounceableImmediateTrigger<Config extends SetupEventConfig> = CommonEvents<Config> & {
153
+ type: `trigger`;
154
+ immediate: true;
155
+ outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>];
156
+ functions: {
157
+ mount?: CoreFunction<{
158
+ credentials: Config[`credentials`];
159
+ inputs: {
160
+ fields: Config[`fields`];
161
+ link: string;
162
+ };
163
+ outputs: {
164
+ done: boolean;
165
+ setup?: Config[`setup`];
166
+ };
167
+ }>;
168
+ check?: CoreFunction<{
169
+ credentials: Config[`credentials`];
170
+ inputs: {
171
+ fields: Config[`fields`];
172
+ link: string;
173
+ setup?: Config[`setup`];
174
+ };
175
+ outputs: {
176
+ done: boolean;
177
+ };
178
+ }>;
179
+ unmount?: CoreFunction<{
180
+ credentials: Config[`credentials`];
181
+ inputs: {
182
+ fields: Config[`fields`];
183
+ link: string;
184
+ setup?: Config[`setup`];
185
+ };
186
+ outputs: {
187
+ done: boolean;
188
+ };
189
+ }>;
190
+ challenge?: CoreFunction<{
191
+ credentials: Config[`credentials`];
192
+ inputs: {
193
+ fields: Config[`fields`];
194
+ link: string;
195
+ request: Request;
196
+ setup?: Config[`setup`];
197
+ };
198
+ outputs: {
199
+ done: boolean;
200
+ response?: any;
201
+ };
202
+ }>;
203
+ debounce: CoreFunction<{
204
+ credentials: Config[`credentials`];
205
+ inputs: {
206
+ fields: Config[`fields`];
207
+ request: Request;
208
+ setup?: Config[`setup`];
209
+ };
210
+ outputs: {
211
+ done: boolean;
212
+ response?: any;
213
+ };
214
+ }>;
215
+ handle: CoreFunction<{
216
+ credentials: Config[`credentials`];
217
+ inputs: {
218
+ fields: Config[`fields`];
219
+ requests: Request[];
220
+ setup?: Config[`setup`];
221
+ } & SourcePreferences<Config>;
222
+ outputs: {
223
+ records: Config[`outputs`][];
224
+ flags: Partial<Record<Config[`flags`][`outputs`][number], true>>;
225
+ };
226
+ }>;
227
+ fire?: CoreFunction<{
228
+ credentials: Config[`credentials`];
229
+ inputs: {
230
+ fields: Config[`fields`];
231
+ link: string;
232
+ setup?: any;
233
+ } & SourcePreferences<Config>;
234
+ outputs: {
235
+ done: boolean;
236
+ };
237
+ }>;
238
+ poll?: CoreFunction<{
239
+ credentials: Config[`credentials`];
240
+ inputs: {
241
+ fields: Config[`fields`];
242
+ last_schedule: string;
243
+ limit?: number;
244
+ } & SourcePreferences<Config>;
245
+ outputs: {
246
+ records: Config[`outputs`][];
247
+ flags: Partial<Record<Config[`flags`][`outputs`][number], true>>;
248
+ };
249
+ }>;
250
+ };
251
+ };
152
252
  export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config> & {
153
253
  type: `trigger`;
154
254
  immediate: false;
@@ -168,7 +268,7 @@ export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config>
168
268
  }>;
169
269
  };
170
270
  };
171
- export type Trigger<Config extends EventConfig = {}> = ImmediateTrigger<Config> | ScheduledTrigger<Config>;
271
+ export type Trigger<Config extends EventConfig = {}> = ImmediateTrigger<Config> | DebounceableImmediateTrigger<Config> | ScheduledTrigger<Config>;
172
272
  type StandardOutputWithMemory<Config extends MemoryEventConfig> = {
173
273
  output: ObjectOrArray<Config[`outputs`]>;
174
274
  flags: Partial<Record<Config[`flags`][`outputs`][number], true>>;
@@ -70,6 +70,7 @@ const immediateTriggerSchema = () => joi_1.default.object({
70
70
  check: joi_1.default.function(),
71
71
  unmount: joi_1.default.function(),
72
72
  challenge: joi_1.default.function(),
73
+ debounce: joi_1.default.function(),
73
74
  handle: joi_1.default.function().required(),
74
75
  poll: joi_1.default.function(),
75
76
  fire: joi_1.default.function(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beseif-solutions/prow-core",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Prow core functionalities and classes",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -119,6 +119,54 @@ export type ImmediateTrigger<Config extends SetupEventConfig> = CommonEvents<Con
119
119
  },
120
120
  };
121
121
 
122
+ export type DebounceableImmediateTrigger<Config extends SetupEventConfig> = CommonEvents<Config> & {
123
+ type: `trigger`,
124
+ immediate: true,
125
+ outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>],
126
+ functions: {
127
+ mount?: CoreFunction<{
128
+ credentials: Config[`credentials`],
129
+ inputs: { fields: Config[`fields`], link: string },
130
+ outputs: { done: boolean, setup?: Config[`setup`] },
131
+ }>,
132
+ check?: CoreFunction<{
133
+ credentials: Config[`credentials`],
134
+ inputs: { fields: Config[`fields`], link: string, setup?: Config[`setup`] },
135
+ outputs: { done: boolean },
136
+ }>,
137
+ unmount?: CoreFunction<{
138
+ credentials: Config[`credentials`],
139
+ inputs: { fields: Config[`fields`], link: string, setup?: Config[`setup`] },
140
+ outputs: { done: boolean },
141
+ }>,
142
+ challenge?: CoreFunction<{
143
+ credentials: Config[`credentials`],
144
+ inputs: { fields: Config[`fields`], link: string, request: Request, setup?: Config[`setup`] },
145
+ outputs: { done: boolean, response?: any },
146
+ }>,
147
+ debounce: CoreFunction<{
148
+ credentials: Config[`credentials`],
149
+ inputs: { fields: Config[`fields`], request: Request, setup?: Config[`setup`] },
150
+ outputs: { done: boolean, response?: any },
151
+ }>,
152
+ handle: CoreFunction<{
153
+ credentials: Config[`credentials`],
154
+ inputs: { fields: Config[`fields`], requests: Request[], setup?: Config[`setup`] } & SourcePreferences<Config>,
155
+ outputs: { records: Config[`outputs`][], flags: Partial<Record<Config[`flags`][`outputs`][number], true>> },
156
+ }>,
157
+ fire?: CoreFunction<{
158
+ credentials: Config[`credentials`],
159
+ inputs: { fields: Config[`fields`], link: string, setup?: any } & SourcePreferences<Config>,
160
+ outputs: { done: boolean },
161
+ }>,
162
+ poll?: CoreFunction<{
163
+ credentials: Config[`credentials`],
164
+ inputs: { fields: Config[`fields`], last_schedule: string, limit?: number } & SourcePreferences<Config>,
165
+ outputs: { records: Config[`outputs`][], flags: Partial<Record<Config[`flags`][`outputs`][number], true>> },
166
+ }>,
167
+ },
168
+ };
169
+
122
170
  export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config> & {
123
171
  type: `trigger`,
124
172
  immediate: false,
@@ -134,6 +182,7 @@ export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config>
134
182
 
135
183
  export type Trigger<Config extends EventConfig = {}> =
136
184
  | ImmediateTrigger<Config>
185
+ | DebounceableImmediateTrigger<Config>
137
186
  | ScheduledTrigger<Config>;
138
187
 
139
188
  type StandardOutputWithMemory<Config extends MemoryEventConfig> = {
@@ -267,6 +316,7 @@ export const immediateTriggerSchema = () =>
267
316
  check: Joi.function(),
268
317
  unmount: Joi.function(),
269
318
  challenge: Joi.function(),
319
+ debounce: Joi.function(),
270
320
  handle: Joi.function().required(),
271
321
  poll: Joi.function(),
272
322
  fire: Joi.function(),