@beseif-solutions/prow-core 0.3.15 → 0.4.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.
@@ -35,7 +35,7 @@ export type OAuthCredentials<Config extends CredentialsConfig = {}> = CommonCred
35
35
  inputs: {
36
36
  redirect: string;
37
37
  code: string;
38
- };
38
+ } & Record<string, any>;
39
39
  outputs: {
40
40
  username?: string;
41
41
  credentials: Config[`credentials`];
@@ -169,13 +169,14 @@ export type ScheduledTrigger<Config extends EventConfig> = CommonEvents<Config>
169
169
  };
170
170
  };
171
171
  export type Trigger<Config extends EventConfig = {}> = ImmediateTrigger<Config> | ScheduledTrigger<Config>;
172
- type StandardOutput<Config extends EventConfig> = {
172
+ type StandardOutputWithMemory<Config extends MemoryEventConfig> = {
173
173
  output: ObjectOrArray<Config[`outputs`]>;
174
174
  flags: Partial<Record<Config[`flags`][`outputs`][number], true>>;
175
+ memory?: Config[`memory`];
175
176
  };
176
- type MemoryOutput<Config extends MemoryEventConfig> = {
177
+ type OnlyMemoryOutput<Config extends MemoryEventConfig> = {
177
178
  memory: Config[`memory`];
178
- } & (StandardOutput<Config> | {});
179
+ };
179
180
  export type SyncAction<Config extends MemoryEventConfig> = CommonEvents<Config> & {
180
181
  type: `action`;
181
182
  inputs: [DefaultConnectableEvent<Config[`flags`][`inputs`][number]>, ...AdditionalConnectableEvent<Config[`flags`][`inputs`][number]>[]];
@@ -188,7 +189,7 @@ export type SyncAction<Config extends MemoryEventConfig> = CommonEvents<Config>
188
189
  flags: Partial<Record<Config[`flags`][`inputs`][number], true>>;
189
190
  memory?: Config[`memory`];
190
191
  } & SourcePreferences<Config>;
191
- outputs: StandardOutput<Config> | MemoryOutput<Config>;
192
+ outputs: StandardOutputWithMemory<Config> | OnlyMemoryOutput<Config>;
192
193
  }>;
193
194
  };
194
195
  };
@@ -209,7 +210,7 @@ export type AsyncAction<Config extends MemoryEventConfig> = CommonEvents<Config>
209
210
  outputs: {
210
211
  done: boolean;
211
212
  memory?: Config[`memory`];
212
- };
213
+ } | StandardOutputWithMemory<Config>;
213
214
  }>;
214
215
  handle: CoreFunction<{
215
216
  credentials: Config[`credentials`];
@@ -218,7 +219,7 @@ export type AsyncAction<Config extends MemoryEventConfig> = CommonEvents<Config>
218
219
  request: Request;
219
220
  memory?: Config[`memory`];
220
221
  } & SourcePreferences<Config>;
221
- outputs: StandardOutput<Config>;
222
+ outputs: StandardOutputWithMemory<Config>;
222
223
  }>;
223
224
  fire?: CoreFunction<{
224
225
  credentials: Config[`credentials`];
@@ -134,10 +134,8 @@ const actionOutputSchema = () => joi_1.default.alternatives(joi_1.default.object
134
134
  flags: joi_1.default.object()
135
135
  .pattern(joi_1.default.string(), joi_1.default.valid(true))
136
136
  .required(),
137
+ memory: joi_1.default.object(),
137
138
  }), joi_1.default.object({
138
139
  memory: joi_1.default.object().required(),
139
- output: joi_1.default.alternatives(joi_1.default.array(), joi_1.default.object()),
140
- flags: joi_1.default.object()
141
- .pattern(joi_1.default.string(), joi_1.default.valid(true)),
142
- }).and(`output`, `flags`));
140
+ }));
143
141
  exports.actionOutputSchema = actionOutputSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beseif-solutions/prow-core",
3
- "version": "0.3.15",
3
+ "version": "0.4.0",
4
4
  "description": "Prow core functionalities and classes",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -33,7 +33,7 @@ export type OAuthCredentials<Config extends CredentialsConfig = {}> = CommonCred
33
33
  }>,
34
34
  connect: CoreFunction<{
35
35
  credentials: undefined,
36
- inputs: { redirect: string, code: string },
36
+ inputs: { redirect: string, code: string } & Record<string, any>,
37
37
  outputs: {
38
38
  username?: string,
39
39
  credentials: Config[`credentials`],
@@ -135,12 +135,15 @@ export type Trigger<Config extends EventConfig = {}> =
135
135
  | ImmediateTrigger<Config>
136
136
  | ScheduledTrigger<Config>;
137
137
 
138
- type StandardOutput<Config extends EventConfig> =
139
- { output: ObjectOrArray<Config[`outputs`]>, flags: Partial<Record<Config[`flags`][`outputs`][number], true>> };
138
+ type StandardOutputWithMemory<Config extends MemoryEventConfig> = {
139
+ output: ObjectOrArray<Config[`outputs`]>,
140
+ flags: Partial<Record<Config[`flags`][`outputs`][number], true>>,
141
+ memory?: Config[`memory`],
142
+ };
140
143
 
141
- type MemoryOutput<Config extends MemoryEventConfig> = {
144
+ type OnlyMemoryOutput<Config extends MemoryEventConfig> = {
142
145
  memory: Config[`memory`],
143
- } & (StandardOutput<Config> | {});
146
+ };
144
147
 
145
148
  export type SyncAction<Config extends MemoryEventConfig> = CommonEvents<Config> & {
146
149
  type: `action`,
@@ -150,7 +153,7 @@ export type SyncAction<Config extends MemoryEventConfig> = CommonEvents<Config>
150
153
  execute: CoreFunction<{
151
154
  credentials: Config[`credentials`],
152
155
  inputs: { fields: Config[`fields`], flags: Partial<Record<Config[`flags`][`inputs`][number], true>>, memory?: Config[`memory`] } & SourcePreferences<Config>,
153
- outputs: StandardOutput<Config> | MemoryOutput<Config>,
156
+ outputs: StandardOutputWithMemory<Config> | OnlyMemoryOutput<Config>,
154
157
  }>,
155
158
  },
156
159
  };
@@ -164,12 +167,12 @@ export type AsyncAction<Config extends MemoryEventConfig> = CommonEvents<Config>
164
167
  execute: CoreFunction<{
165
168
  credentials: Config[`credentials`],
166
169
  inputs: { fields: Config[`fields`], flags: Partial<Record<Config[`flags`][`inputs`][number], true>>, link: string, memory?: Config[`memory`] } & SourcePreferences<Config>,
167
- outputs: { done: boolean, memory?: Config[`memory`] },
170
+ outputs: { done: boolean, memory?: Config[`memory`] } | StandardOutputWithMemory<Config>,
168
171
  }>,
169
172
  handle: CoreFunction<{
170
173
  credentials: Config[`credentials`],
171
174
  inputs: { fields: Config[`fields`], request: Request, memory?: Config[`memory`] } & SourcePreferences<Config>,
172
- outputs: StandardOutput<Config>,
175
+ outputs: StandardOutputWithMemory<Config>,
173
176
  }>,
174
177
  fire?: CoreFunction<{
175
178
  credentials: Config[`credentials`],
@@ -346,7 +349,7 @@ export const triggerOutputSchema = () =>
346
349
 
347
350
  export const actionOutputSchema = () =>
348
351
  Joi.alternatives(
349
- // standard output
352
+ // standard output + memory
350
353
  Joi.object({
351
354
  output: Joi.alternatives(
352
355
  Joi.array(),
@@ -355,15 +358,10 @@ export const actionOutputSchema = () =>
355
358
  flags: Joi.object()
356
359
  .pattern(Joi.string(), Joi.valid(true))
357
360
  .required(),
361
+ memory: Joi.object(),
358
362
  }),
359
- // memory output
363
+ // only memory output
360
364
  Joi.object({
361
365
  memory: Joi.object().required(),
362
- output: Joi.alternatives(
363
- Joi.array(),
364
- Joi.object(),
365
- ),
366
- flags: Joi.object()
367
- .pattern(Joi.string(), Joi.valid(true)),
368
- }).and(`output`, `flags`),
366
+ }),
369
367
  );