@beseif-solutions/prow-core 0.2.1 → 0.2.3
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.
|
@@ -172,7 +172,7 @@ type MemoryOutput<Config extends MemoryEventConfig = {
|
|
|
172
172
|
}> = {
|
|
173
173
|
memory: Config[`memory`];
|
|
174
174
|
} & (StandardOutput<Config> | {});
|
|
175
|
-
export type
|
|
175
|
+
export type SyncAction<Config extends MemoryEventConfig = {
|
|
176
176
|
fields: Record<string, any>;
|
|
177
177
|
memory: Record<string, any>;
|
|
178
178
|
}> = CommonEvents<Config> & {
|
|
@@ -227,6 +227,7 @@ export type AsyncAction<Config extends SetupEventConfig = {
|
|
|
227
227
|
inputs: {
|
|
228
228
|
fields: Config[`fields`];
|
|
229
229
|
flags: Partial<Record<Config[`flags`][`inputs`][number], true>>;
|
|
230
|
+
link: string;
|
|
230
231
|
setup?: Config[`setup`];
|
|
231
232
|
};
|
|
232
233
|
outputs: {
|
|
@@ -256,6 +257,9 @@ export type AsyncAction<Config extends SetupEventConfig = {
|
|
|
256
257
|
}>;
|
|
257
258
|
};
|
|
258
259
|
};
|
|
260
|
+
export type Action<Config extends EventConfig = {
|
|
261
|
+
fields: Record<string, any>;
|
|
262
|
+
}> = SyncAction<Config> | AsyncAction<Config>;
|
|
259
263
|
export type Event<Config extends EventConfig = {
|
|
260
264
|
fields: Record<string, any>;
|
|
261
265
|
}> = Action<Config> | Trigger<Config>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Core, core } from './core';
|
|
2
2
|
export { CoreFunction, idSchema } from './entities/commons';
|
|
3
3
|
export { Credentials, credentialsSchema, OAuthCredentials, oauthCredentialsSchema, SessionCredentials, sessionCredentialsSchema, StaticCredentials, staticCredentialsSchema } from './entities/credentials';
|
|
4
|
-
export { Action, actionOutputSchema, actionSchema, AsyncAction, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, syncActionSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
4
|
+
export { Action, actionOutputSchema, actionSchema, AsyncAction, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, SyncAction, syncActionSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
5
5
|
export { Provider, providerSchema } from './entities/provider';
|
|
6
6
|
export { Source } from './entities/source';
|
|
7
7
|
export { alter, extract, Field, fieldSchema, fieldsSchema, File, SelectFieldChoice, validate, ValidationResult } from './minified-utils/fields';
|
|
@@ -422,6 +422,9 @@ const recursive_schema = async (field, data, options) => {
|
|
|
422
422
|
if (options.alter) {
|
|
423
423
|
delete newField.altered_by;
|
|
424
424
|
}
|
|
425
|
+
if (typeof newField.show === `boolean` && !newField.show) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
425
428
|
}
|
|
426
429
|
const alteredField = lodash_1.default.cloneDeep(newField);
|
|
427
430
|
if (newField.type === `file`) {
|
|
@@ -467,11 +470,7 @@ const recursive_schema = async (field, data, options) => {
|
|
|
467
470
|
if (!calculatedSchema) {
|
|
468
471
|
throw new Error(`Could not resolve schema for field ${newField.key}`);
|
|
469
472
|
}
|
|
470
|
-
if (
|
|
471
|
-
lodash_1.default.unset(data, relativeKey);
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
else if (newField.disabled) {
|
|
473
|
+
if (newField.disabled) {
|
|
475
474
|
lodash_1.default.unset(data, relativeKey);
|
|
476
475
|
}
|
|
477
476
|
return { schema: calculatedSchema, field: field.type === `file` ? alteredField : newField };
|
package/package.json
CHANGED
package/src/entities/events.ts
CHANGED
|
@@ -131,7 +131,7 @@ type MemoryOutput<Config extends MemoryEventConfig = { memory: Record<string, an
|
|
|
131
131
|
memory: Config[`memory`],
|
|
132
132
|
} & (StandardOutput<Config> | {});
|
|
133
133
|
|
|
134
|
-
export type
|
|
134
|
+
export type SyncAction<Config extends MemoryEventConfig = { fields: Record<string, any>, memory: Record<string, any> }> = 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]>)[]],
|
|
@@ -162,7 +162,7 @@ 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>>, setup?: Config[`setup`] },
|
|
165
|
+
inputs: { fields: Config[`fields`], flags: Partial<Record<Config[`flags`][`inputs`][number], true>>, link: string, setup?: Config[`setup`] },
|
|
166
166
|
outputs: { done: boolean, setup?: Config[`setup`] },
|
|
167
167
|
}>,
|
|
168
168
|
handle: CoreFunction<{
|
|
@@ -177,6 +177,9 @@ export type AsyncAction<Config extends SetupEventConfig = { fields: Record<strin
|
|
|
177
177
|
}>,
|
|
178
178
|
},
|
|
179
179
|
};
|
|
180
|
+
export type Action<Config extends EventConfig = { fields: Record<string, any> }> =
|
|
181
|
+
| SyncAction<Config>
|
|
182
|
+
| AsyncAction<Config>;
|
|
180
183
|
|
|
181
184
|
export type Event<Config extends EventConfig = { fields: Record<string, any> }> =
|
|
182
185
|
| Action<Config>
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Core, core } from './core';
|
|
2
2
|
export { CoreFunction, idSchema } from './entities/commons';
|
|
3
3
|
export { Credentials, credentialsSchema, OAuthCredentials, oauthCredentialsSchema, SessionCredentials, sessionCredentialsSchema, StaticCredentials, staticCredentialsSchema } from './entities/credentials';
|
|
4
|
-
export { Action, actionOutputSchema, actionSchema, AsyncAction, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, syncActionSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
4
|
+
export { Action, actionOutputSchema, actionSchema, AsyncAction, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, SyncAction, syncActionSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
5
5
|
export { Provider, providerSchema } from './entities/provider';
|
|
6
6
|
export { Source } from './entities/source';
|
|
7
7
|
export { alter, extract, Field, fieldSchema, fieldsSchema, File, SelectFieldChoice, validate, ValidationResult } from './minified-utils/fields';
|
|
@@ -625,6 +625,8 @@ const recursive_schema = async (field: Field, data: Record<string, any>, options
|
|
|
625
625
|
|
|
626
626
|
// remove altered_by only if it's not an array -> array alterations must be kept for front-end rendering
|
|
627
627
|
if (options.alter) { delete newField.altered_by; }
|
|
628
|
+
|
|
629
|
+
if (typeof newField.show === `boolean` && !newField.show) { return; }
|
|
628
630
|
}
|
|
629
631
|
|
|
630
632
|
const alteredField: Field = _.cloneDeep(newField);
|
|
@@ -676,14 +678,8 @@ const recursive_schema = async (field: Field, data: Record<string, any>, options
|
|
|
676
678
|
|
|
677
679
|
if (!calculatedSchema) { throw new Error(`Could not resolve schema for field ${newField.key}`); }
|
|
678
680
|
|
|
679
|
-
if
|
|
680
|
-
|
|
681
|
-
_.unset(data, relativeKey);
|
|
682
|
-
return;
|
|
683
|
-
} else if (newField.disabled) {
|
|
684
|
-
// TODO: check this
|
|
685
|
-
_.unset(data, relativeKey);
|
|
686
|
-
}
|
|
681
|
+
// if disabled schema validation is done but the value is not set
|
|
682
|
+
if (newField.disabled) { _.unset(data, relativeKey); }
|
|
687
683
|
|
|
688
684
|
return { schema: calculatedSchema, field: field.type === `file` ? alteredField : newField };
|
|
689
685
|
} catch (e) { throw e; }
|