@beseif-solutions/prow-core 0.0.39 → 0.2.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/core.d.ts +3 -3
- package/dist/entities/commons.d.ts +1 -1
- package/dist/entities/events.d.ts +118 -22
- package/dist/entities/events.js +33 -4
- package/dist/entities/source.d.ts +1 -0
- package/dist/entities/source.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/minified-utils/fields.d.ts +11 -10
- package/dist/minified-utils/fields.js +69 -43
- package/dist/minified-utils/protocol.js +6 -3
- package/dist/minified-utils/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/core.ts +3 -3
- package/src/entities/commons.ts +1 -1
- package/src/entities/events.ts +123 -26
- package/src/entities/source.ts +2 -0
- package/src/index.ts +2 -2
- package/src/minified-utils/fields.ts +79 -60
- package/src/minified-utils/protocol.ts +6 -3
- package/src/minified-utils/types.ts +3 -1
- package/tsconfig.json +1 -2
package/dist/core.d.ts
CHANGED
|
@@ -5,14 +5,14 @@ import moment from "moment-timezone";
|
|
|
5
5
|
import { FromCatalog, FromDirectory, T } from "./minified-utils/locales";
|
|
6
6
|
type SyncOrAsync<T> = T | Promise<T>;
|
|
7
7
|
export type SourceFunctions = {
|
|
8
|
-
register: <T>(source: string, data: T) => SyncOrAsync<{
|
|
8
|
+
register: <T>(source: string, sandbox: boolean, data: T) => SyncOrAsync<{
|
|
9
9
|
id: string;
|
|
10
10
|
}>;
|
|
11
|
-
consume: <T>(source: string) => SyncOrAsync<{
|
|
11
|
+
consume: <T>(source: string, sandbox: boolean) => SyncOrAsync<{
|
|
12
12
|
id: string;
|
|
13
13
|
data: T;
|
|
14
14
|
}[]>;
|
|
15
|
-
unregister: (source: string, id: string) => SyncOrAsync<void>;
|
|
15
|
+
unregister: (source: string, sandbox: boolean, id: string) => SyncOrAsync<void>;
|
|
16
16
|
};
|
|
17
17
|
export type Core = {
|
|
18
18
|
axios: AxiosStatic;
|
|
@@ -12,7 +12,7 @@ export type CoreFunction<Config extends CoreConfig = {}> = (core: Core, configur
|
|
|
12
12
|
inputs: Config[`inputs`];
|
|
13
13
|
}) & (Config[`credentials`] extends undefined ? {} : {
|
|
14
14
|
credentials: Config[`credentials`];
|
|
15
|
-
}))) => Promise<Config[`outputs`]
|
|
15
|
+
}))) => Promise<Config[`outputs`]> | Config[`outputs`];
|
|
16
16
|
type CommonConfig = Pick<CoreConfig, `credentials`>;
|
|
17
17
|
export type Common<Config extends CommonConfig = {}> = {
|
|
18
18
|
id: string;
|
|
@@ -1,6 +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 { OneOrArray } from "../minified-utils/types";
|
|
4
5
|
type CommonConnectableEvent<Keys extends string = string> = {
|
|
5
6
|
key: Keys;
|
|
6
7
|
};
|
|
@@ -26,8 +27,17 @@ type EventConfig = Pick<CoreConfig, `credentials` | `outputs`> & {
|
|
|
26
27
|
outputs: string[];
|
|
27
28
|
};
|
|
28
29
|
sources?: string[];
|
|
30
|
+
fields?: Record<string, any>;
|
|
29
31
|
};
|
|
30
|
-
type
|
|
32
|
+
type SetupEventConfig = EventConfig & {
|
|
33
|
+
setup?: Record<string, any>;
|
|
34
|
+
};
|
|
35
|
+
type MemoryEventConfig = EventConfig & {
|
|
36
|
+
memory?: Record<string, any>;
|
|
37
|
+
};
|
|
38
|
+
type CommonEvents<Config extends EventConfig = {
|
|
39
|
+
fields: Record<string, any>;
|
|
40
|
+
}> = Common<Config> & {
|
|
31
41
|
model: `event`;
|
|
32
42
|
categorization: {
|
|
33
43
|
department: string;
|
|
@@ -49,7 +59,10 @@ export type Request = {
|
|
|
49
59
|
query: Record<string, string>;
|
|
50
60
|
body: any;
|
|
51
61
|
};
|
|
52
|
-
export type ImmediateTrigger<Config extends
|
|
62
|
+
export type ImmediateTrigger<Config extends SetupEventConfig = {
|
|
63
|
+
fields: Record<string, any>;
|
|
64
|
+
setup: Record<string, any>;
|
|
65
|
+
}> = CommonEvents<Config> & {
|
|
53
66
|
type: `trigger`;
|
|
54
67
|
immediate: true;
|
|
55
68
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>];
|
|
@@ -57,20 +70,20 @@ export type ImmediateTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
57
70
|
mount?: CoreFunction<{
|
|
58
71
|
credentials: Config[`credentials`];
|
|
59
72
|
inputs: {
|
|
60
|
-
fields:
|
|
73
|
+
fields: Config[`fields`];
|
|
61
74
|
link: string;
|
|
62
75
|
};
|
|
63
76
|
outputs: {
|
|
64
77
|
done: boolean;
|
|
65
|
-
setup?:
|
|
78
|
+
setup?: Config[`setup`];
|
|
66
79
|
};
|
|
67
80
|
}>;
|
|
68
81
|
unmount?: CoreFunction<{
|
|
69
82
|
credentials: Config[`credentials`];
|
|
70
83
|
inputs: {
|
|
71
|
-
fields:
|
|
84
|
+
fields: Config[`fields`];
|
|
72
85
|
link: string;
|
|
73
|
-
setup?:
|
|
86
|
+
setup?: Config[`setup`];
|
|
74
87
|
};
|
|
75
88
|
outputs: {
|
|
76
89
|
done: boolean;
|
|
@@ -79,10 +92,10 @@ export type ImmediateTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
79
92
|
challenge?: CoreFunction<{
|
|
80
93
|
credentials: Config[`credentials`];
|
|
81
94
|
inputs: {
|
|
82
|
-
fields:
|
|
95
|
+
fields: Config[`fields`];
|
|
83
96
|
link: string;
|
|
84
97
|
request: Request;
|
|
85
|
-
setup?:
|
|
98
|
+
setup?: Config[`setup`];
|
|
86
99
|
};
|
|
87
100
|
outputs: {
|
|
88
101
|
done: boolean;
|
|
@@ -92,9 +105,9 @@ export type ImmediateTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
92
105
|
handle: CoreFunction<{
|
|
93
106
|
credentials: Config[`credentials`];
|
|
94
107
|
inputs: {
|
|
95
|
-
fields:
|
|
108
|
+
fields: Config[`fields`];
|
|
96
109
|
request: Request;
|
|
97
|
-
setup?:
|
|
110
|
+
setup?: Config[`setup`];
|
|
98
111
|
};
|
|
99
112
|
outputs: {
|
|
100
113
|
records: Config[`outputs`][];
|
|
@@ -104,7 +117,7 @@ export type ImmediateTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
104
117
|
fire?: CoreFunction<{
|
|
105
118
|
credentials: Config[`credentials`];
|
|
106
119
|
inputs: {
|
|
107
|
-
fields:
|
|
120
|
+
fields: Config[`fields`];
|
|
108
121
|
link: string;
|
|
109
122
|
setup?: any;
|
|
110
123
|
};
|
|
@@ -115,7 +128,7 @@ export type ImmediateTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
115
128
|
poll?: CoreFunction<{
|
|
116
129
|
credentials: Config[`credentials`];
|
|
117
130
|
inputs: {
|
|
118
|
-
fields:
|
|
131
|
+
fields: Config[`fields`];
|
|
119
132
|
last_schedule?: string;
|
|
120
133
|
limit?: number;
|
|
121
134
|
};
|
|
@@ -126,7 +139,9 @@ export type ImmediateTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
126
139
|
}>;
|
|
127
140
|
};
|
|
128
141
|
};
|
|
129
|
-
export type ScheduledTrigger<Config extends EventConfig = {
|
|
142
|
+
export type ScheduledTrigger<Config extends EventConfig = {
|
|
143
|
+
fields: Record<string, any>;
|
|
144
|
+
}> = CommonEvents<Config> & {
|
|
130
145
|
type: `trigger`;
|
|
131
146
|
immediate: false;
|
|
132
147
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>];
|
|
@@ -134,7 +149,7 @@ export type ScheduledTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
134
149
|
poll: CoreFunction<{
|
|
135
150
|
credentials: Config[`credentials`];
|
|
136
151
|
inputs: {
|
|
137
|
-
fields:
|
|
152
|
+
fields: Config[`fields`];
|
|
138
153
|
last_schedule?: string;
|
|
139
154
|
limit?: number;
|
|
140
155
|
};
|
|
@@ -145,8 +160,22 @@ export type ScheduledTrigger<Config extends EventConfig = {}> = CommonEvents<Con
|
|
|
145
160
|
}>;
|
|
146
161
|
};
|
|
147
162
|
};
|
|
148
|
-
export type Trigger<Config extends EventConfig = {
|
|
149
|
-
|
|
163
|
+
export type Trigger<Config extends EventConfig = {
|
|
164
|
+
fields: Record<string, any>;
|
|
165
|
+
}> = ImmediateTrigger<Config> | ScheduledTrigger<Config>;
|
|
166
|
+
type StandardOutput<Config extends EventConfig> = {
|
|
167
|
+
output: OneOrArray<Config[`outputs`]>;
|
|
168
|
+
flags: Partial<Record<Config[`flags`][`outputs`][number], true>>;
|
|
169
|
+
};
|
|
170
|
+
type MemoryOutput<Config extends MemoryEventConfig = {
|
|
171
|
+
memory: Record<string, any>;
|
|
172
|
+
}> = {
|
|
173
|
+
memory: Config[`memory`];
|
|
174
|
+
} & (StandardOutput<Config> | {});
|
|
175
|
+
export type Action<Config extends MemoryEventConfig = {
|
|
176
|
+
fields: Record<string, any>;
|
|
177
|
+
memory: Record<string, any>;
|
|
178
|
+
}> = CommonEvents<Config> & {
|
|
150
179
|
type: `action`;
|
|
151
180
|
inputs: [DefaultConnectableEvent<Config[`flags`][`inputs`][number]>, ...AdditionalConnectableEvent<Config[`flags`][`inputs`][number]>[]];
|
|
152
181
|
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>, ...(AdditionalConnectableEvent<Config[`flags`][`outputs`][number]> | ErrorConnectableEvent<Config[`flags`][`outputs`][number]>)[]];
|
|
@@ -154,22 +183,89 @@ export type Action<Config extends EventConfig = {}> = CommonEvents<Config> & {
|
|
|
154
183
|
execute: CoreFunction<{
|
|
155
184
|
credentials: Config[`credentials`];
|
|
156
185
|
inputs: {
|
|
157
|
-
fields:
|
|
186
|
+
fields: Config[`fields`];
|
|
158
187
|
flags: Partial<Record<Config[`flags`][`inputs`][number], true>>;
|
|
188
|
+
memory?: Config[`memory`];
|
|
189
|
+
};
|
|
190
|
+
outputs: StandardOutput<Config> | MemoryOutput<Config>;
|
|
191
|
+
}>;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
export type AsyncAction<Config extends SetupEventConfig = {
|
|
195
|
+
fields: Record<string, any>;
|
|
196
|
+
setup: Record<string, any>;
|
|
197
|
+
}> = CommonEvents<Config> & {
|
|
198
|
+
type: `action`;
|
|
199
|
+
inputs: [DefaultConnectableEvent<Config[`flags`][`inputs`][number]>, ...AdditionalConnectableEvent<Config[`flags`][`inputs`][number]>[]];
|
|
200
|
+
outputs: [DefaultConnectableEvent<Config[`flags`][`outputs`][number]>, ...(AdditionalConnectableEvent<Config[`flags`][`outputs`][number]> | ErrorConnectableEvent<Config[`flags`][`outputs`][number]>)[]];
|
|
201
|
+
async: true;
|
|
202
|
+
functions: {
|
|
203
|
+
mount?: CoreFunction<{
|
|
204
|
+
credentials: Config[`credentials`];
|
|
205
|
+
inputs: {
|
|
206
|
+
fields: Config[`fields`];
|
|
207
|
+
link: string;
|
|
159
208
|
};
|
|
160
209
|
outputs: {
|
|
161
|
-
|
|
162
|
-
|
|
210
|
+
done: boolean;
|
|
211
|
+
setup?: Config[`setup`];
|
|
212
|
+
};
|
|
213
|
+
}>;
|
|
214
|
+
unmount?: CoreFunction<{
|
|
215
|
+
credentials: Config[`credentials`];
|
|
216
|
+
inputs: {
|
|
217
|
+
fields: Config[`fields`];
|
|
218
|
+
link: string;
|
|
219
|
+
setup?: Config[`setup`];
|
|
220
|
+
};
|
|
221
|
+
outputs: {
|
|
222
|
+
done: boolean;
|
|
223
|
+
};
|
|
224
|
+
}>;
|
|
225
|
+
execute: CoreFunction<{
|
|
226
|
+
credentials: Config[`credentials`];
|
|
227
|
+
inputs: {
|
|
228
|
+
fields: Config[`fields`];
|
|
229
|
+
flags: Partial<Record<Config[`flags`][`inputs`][number], true>>;
|
|
230
|
+
setup?: Config[`setup`];
|
|
231
|
+
};
|
|
232
|
+
outputs: {
|
|
233
|
+
done: boolean;
|
|
234
|
+
setup?: Config[`setup`];
|
|
235
|
+
};
|
|
236
|
+
}>;
|
|
237
|
+
handle: CoreFunction<{
|
|
238
|
+
credentials: Config[`credentials`];
|
|
239
|
+
inputs: {
|
|
240
|
+
fields: Config[`fields`];
|
|
241
|
+
request: Request;
|
|
242
|
+
setup?: Config[`setup`];
|
|
243
|
+
};
|
|
244
|
+
outputs: StandardOutput<Config>;
|
|
245
|
+
}>;
|
|
246
|
+
fire?: CoreFunction<{
|
|
247
|
+
credentials: Config[`credentials`];
|
|
248
|
+
inputs: {
|
|
249
|
+
fields: Config[`fields`];
|
|
250
|
+
link: string;
|
|
251
|
+
setup?: Config[`setup`];
|
|
252
|
+
};
|
|
253
|
+
outputs: {
|
|
254
|
+
done: boolean;
|
|
163
255
|
};
|
|
164
256
|
}>;
|
|
165
257
|
};
|
|
166
258
|
};
|
|
167
|
-
export type Event<Config extends EventConfig = {
|
|
259
|
+
export type Event<Config extends EventConfig = {
|
|
260
|
+
fields: Record<string, any>;
|
|
261
|
+
}> = Action<Config> | Trigger<Config>;
|
|
168
262
|
export declare const scheduledTriggerSchema: () => Joi.ObjectSchema<any>;
|
|
169
263
|
export declare const immediateTriggerSchema: () => Joi.ObjectSchema<any>;
|
|
170
264
|
export declare const triggerSchema: () => Joi.AlternativesSchema<any>;
|
|
171
|
-
export declare const
|
|
265
|
+
export declare const syncActionSchema: () => Joi.ObjectSchema<any>;
|
|
266
|
+
export declare const asyncActionSchema: () => Joi.ObjectSchema<any>;
|
|
267
|
+
export declare const actionSchema: () => Joi.AlternativesSchema<any>;
|
|
172
268
|
export declare const eventSchema: () => Joi.AlternativesSchema<any>;
|
|
173
269
|
export declare const triggerOutputSchema: () => Joi.ObjectSchema<any>;
|
|
174
|
-
export declare const actionOutputSchema: () => Joi.
|
|
270
|
+
export declare const actionOutputSchema: () => Joi.AlternativesSchema<any>;
|
|
175
271
|
export {};
|
package/dist/entities/events.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.actionOutputSchema = exports.triggerOutputSchema = exports.eventSchema = exports.actionSchema = exports.triggerSchema = exports.immediateTriggerSchema = exports.scheduledTriggerSchema = void 0;
|
|
6
|
+
exports.actionOutputSchema = exports.triggerOutputSchema = exports.eventSchema = exports.actionSchema = exports.asyncActionSchema = exports.syncActionSchema = exports.triggerSchema = exports.immediateTriggerSchema = exports.scheduledTriggerSchema = void 0;
|
|
7
7
|
const joi_1 = __importDefault(require("joi"));
|
|
8
8
|
const fields_1 = require("../minified-utils/fields");
|
|
9
9
|
const commons_1 = require("./commons");
|
|
@@ -79,7 +79,7 @@ const immediateTriggerSchema = () => joi_1.default.object({
|
|
|
79
79
|
exports.immediateTriggerSchema = immediateTriggerSchema;
|
|
80
80
|
const triggerSchema = () => joi_1.default.alternatives((0, exports.scheduledTriggerSchema)(), (0, exports.immediateTriggerSchema)());
|
|
81
81
|
exports.triggerSchema = triggerSchema;
|
|
82
|
-
const
|
|
82
|
+
const syncActionSchema = () => joi_1.default.object({
|
|
83
83
|
type: joi_1.default.valid(`action`).required(),
|
|
84
84
|
inputs: joi_1.default.array()
|
|
85
85
|
.items(defaultConnectableEventSchema().required(), additionalConnectableEventSchema())
|
|
@@ -95,6 +95,30 @@ const actionSchema = () => joi_1.default.object({
|
|
|
95
95
|
})
|
|
96
96
|
.concat((0, commons_1.commonSchema)())
|
|
97
97
|
.concat(commonEventsSchema());
|
|
98
|
+
exports.syncActionSchema = syncActionSchema;
|
|
99
|
+
const asyncActionSchema = () => joi_1.default.object({
|
|
100
|
+
type: joi_1.default.valid(`action`).required(),
|
|
101
|
+
async: joi_1.default.valid(true).required(),
|
|
102
|
+
inputs: joi_1.default.array()
|
|
103
|
+
.items(defaultConnectableEventSchema().required(), additionalConnectableEventSchema())
|
|
104
|
+
.min(1)
|
|
105
|
+
.required(),
|
|
106
|
+
outputs: joi_1.default.array()
|
|
107
|
+
.items(defaultConnectableEventSchema().required(), errorConnectableEventSchema().optional(), additionalConnectableEventSchema().optional())
|
|
108
|
+
.min(1)
|
|
109
|
+
.required(),
|
|
110
|
+
functions: joi_1.default.object({
|
|
111
|
+
mount: joi_1.default.function(),
|
|
112
|
+
unmount: joi_1.default.function(),
|
|
113
|
+
execute: joi_1.default.function().required(),
|
|
114
|
+
handle: joi_1.default.function().required(),
|
|
115
|
+
fire: joi_1.default.function(),
|
|
116
|
+
}).required(),
|
|
117
|
+
})
|
|
118
|
+
.concat((0, commons_1.commonSchema)())
|
|
119
|
+
.concat(commonEventsSchema());
|
|
120
|
+
exports.asyncActionSchema = asyncActionSchema;
|
|
121
|
+
const actionSchema = () => joi_1.default.alternatives((0, exports.syncActionSchema)(), (0, exports.asyncActionSchema)());
|
|
98
122
|
exports.actionSchema = actionSchema;
|
|
99
123
|
const eventSchema = () => joi_1.default.alternatives((0, exports.triggerSchema)(), (0, exports.actionSchema)());
|
|
100
124
|
exports.eventSchema = eventSchema;
|
|
@@ -106,10 +130,15 @@ const triggerOutputSchema = () => joi_1.default.object({
|
|
|
106
130
|
.required(),
|
|
107
131
|
});
|
|
108
132
|
exports.triggerOutputSchema = triggerOutputSchema;
|
|
109
|
-
const actionOutputSchema = () => joi_1.default.object({
|
|
133
|
+
const actionOutputSchema = () => joi_1.default.alternatives(joi_1.default.object({
|
|
110
134
|
output: joi_1.default.alternatives(joi_1.default.array(), joi_1.default.object()).required(),
|
|
111
135
|
flags: joi_1.default.object()
|
|
112
136
|
.pattern(joi_1.default.string(), joi_1.default.valid(true))
|
|
113
137
|
.required(),
|
|
114
|
-
})
|
|
138
|
+
}), joi_1.default.object({
|
|
139
|
+
memory: joi_1.default.object().required(),
|
|
140
|
+
output: joi_1.default.alternatives(joi_1.default.array(), joi_1.default.object()),
|
|
141
|
+
flags: joi_1.default.object()
|
|
142
|
+
.pattern(joi_1.default.string(), joi_1.default.valid(true)),
|
|
143
|
+
}).and(`output`, `flags`));
|
|
115
144
|
exports.actionOutputSchema = actionOutputSchema;
|
package/dist/entities/source.js
CHANGED
|
@@ -9,6 +9,7 @@ const fields_1 = require("../minified-utils/fields");
|
|
|
9
9
|
const commons_1 = require("./commons");
|
|
10
10
|
const sourceSchema = () => joi_1.default.object({
|
|
11
11
|
model: joi_1.default.valid(`source`).required(),
|
|
12
|
+
sandbox: joi_1.default.boolean().required(),
|
|
12
13
|
fields: (0, fields_1.fieldsSchema)().required().min(1),
|
|
13
14
|
}).concat((0, commons_1.commonSchema)());
|
|
14
15
|
exports.sourceSchema = sourceSchema;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
4
|
+
export { Action, actionOutputSchema, actionSchema, AsyncAction, Event, eventSchema, ImmediateTrigger, immediateTriggerSchema, Request, ScheduledTrigger, scheduledTriggerSchema, syncActionSchema, Trigger, triggerOutputSchema, triggerSchema } from './entities/events';
|
|
5
5
|
export { Provider, providerSchema } from './entities/provider';
|
|
6
6
|
export { Source } from './entities/source';
|
|
7
|
-
export { extract, Field, fieldSchema, fieldsSchema, File, SelectFieldChoice, validate, ValidationResult } from './minified-utils/fields';
|
|
7
|
+
export { alter, extract, Field, fieldSchema, fieldsSchema, File, SelectFieldChoice, validate, ValidationResult } from './minified-utils/fields';
|
|
8
8
|
export { i18n, LocalizedField, LocalizedProperties, localizeFields, localizeGroup, localizeInputs, localizeOutputs, localizeProperties } from './minified-utils/locales';
|
|
9
9
|
export { Properties } from './minified-utils/properties';
|
|
10
10
|
export { Protocol } from './minified-utils/protocol';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Protocol = exports.Properties = exports.localizeProperties = exports.localizeOutputs = exports.localizeInputs = exports.localizeGroup = exports.localizeFields = exports.i18n = exports.validate = exports.fieldsSchema = exports.fieldSchema = exports.extract = exports.providerSchema = exports.triggerSchema = exports.triggerOutputSchema = exports.scheduledTriggerSchema = exports.immediateTriggerSchema = exports.eventSchema = exports.actionSchema = exports.actionOutputSchema = exports.staticCredentialsSchema = exports.sessionCredentialsSchema = exports.oauthCredentialsSchema = exports.credentialsSchema = exports.idSchema = exports.core = void 0;
|
|
3
|
+
exports.Protocol = exports.Properties = exports.localizeProperties = exports.localizeOutputs = exports.localizeInputs = exports.localizeGroup = exports.localizeFields = exports.i18n = exports.validate = exports.fieldsSchema = exports.fieldSchema = exports.extract = exports.alter = exports.providerSchema = exports.triggerSchema = exports.triggerOutputSchema = exports.syncActionSchema = exports.scheduledTriggerSchema = exports.immediateTriggerSchema = exports.eventSchema = exports.actionSchema = exports.actionOutputSchema = exports.staticCredentialsSchema = exports.sessionCredentialsSchema = exports.oauthCredentialsSchema = exports.credentialsSchema = exports.idSchema = exports.core = void 0;
|
|
4
4
|
var core_1 = require("./core");
|
|
5
5
|
Object.defineProperty(exports, "core", { enumerable: true, get: function () { return core_1.core; } });
|
|
6
6
|
var commons_1 = require("./entities/commons");
|
|
@@ -16,11 +16,13 @@ Object.defineProperty(exports, "actionSchema", { enumerable: true, get: function
|
|
|
16
16
|
Object.defineProperty(exports, "eventSchema", { enumerable: true, get: function () { return events_1.eventSchema; } });
|
|
17
17
|
Object.defineProperty(exports, "immediateTriggerSchema", { enumerable: true, get: function () { return events_1.immediateTriggerSchema; } });
|
|
18
18
|
Object.defineProperty(exports, "scheduledTriggerSchema", { enumerable: true, get: function () { return events_1.scheduledTriggerSchema; } });
|
|
19
|
+
Object.defineProperty(exports, "syncActionSchema", { enumerable: true, get: function () { return events_1.syncActionSchema; } });
|
|
19
20
|
Object.defineProperty(exports, "triggerOutputSchema", { enumerable: true, get: function () { return events_1.triggerOutputSchema; } });
|
|
20
21
|
Object.defineProperty(exports, "triggerSchema", { enumerable: true, get: function () { return events_1.triggerSchema; } });
|
|
21
22
|
var provider_1 = require("./entities/provider");
|
|
22
23
|
Object.defineProperty(exports, "providerSchema", { enumerable: true, get: function () { return provider_1.providerSchema; } });
|
|
23
24
|
var fields_1 = require("./minified-utils/fields");
|
|
25
|
+
Object.defineProperty(exports, "alter", { enumerable: true, get: function () { return fields_1.alter; } });
|
|
24
26
|
Object.defineProperty(exports, "extract", { enumerable: true, get: function () { return fields_1.extract; } });
|
|
25
27
|
Object.defineProperty(exports, "fieldSchema", { enumerable: true, get: function () { return fields_1.fieldSchema; } });
|
|
26
28
|
Object.defineProperty(exports, "fieldsSchema", { enumerable: true, get: function () { return fields_1.fieldsSchema; } });
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import Joi from "joi";
|
|
2
|
-
import { OneOf } from "./types";
|
|
3
2
|
import { Where } from "./where";
|
|
4
3
|
export type Condition = {
|
|
5
4
|
condition: Where;
|
|
6
|
-
} & OneOf<{
|
|
7
5
|
overrides: Partial<Field>;
|
|
8
|
-
|
|
9
|
-
}>;
|
|
6
|
+
};
|
|
10
7
|
type Common = {
|
|
11
8
|
key: string;
|
|
12
9
|
altered_by?: Condition[];
|
|
13
10
|
disabled?: boolean;
|
|
14
11
|
required?: boolean;
|
|
15
12
|
as_password?: boolean;
|
|
13
|
+
show?: boolean;
|
|
16
14
|
show_label?: boolean;
|
|
17
15
|
} & ({
|
|
18
16
|
as_array?: false;
|
|
@@ -30,6 +28,7 @@ type Any = string | number | boolean | Any[] | {
|
|
|
30
28
|
type AnyInputField<Extend = Record<never, never>> = {
|
|
31
29
|
type: `any`;
|
|
32
30
|
default?: Any | Any[];
|
|
31
|
+
allow_nullish?: boolean;
|
|
33
32
|
} & (SelectField<Any, Extend> | {});
|
|
34
33
|
type StringInputField<Extend = Record<never, never>> = {
|
|
35
34
|
type: `string`;
|
|
@@ -39,7 +38,7 @@ type StringInputField<Extend = Record<never, never>> = {
|
|
|
39
38
|
max?: number;
|
|
40
39
|
regexp?: string;
|
|
41
40
|
pattern?: `email` | `uri`;
|
|
42
|
-
} & (SelectField<string, Extend> |
|
|
41
|
+
} & (SelectField<string, Extend> | CustomDisplayTextField | IDETextField | {});
|
|
43
42
|
type NumberInputField<Extend = Record<never, never>> = {
|
|
44
43
|
type: `number`;
|
|
45
44
|
default?: number | number[];
|
|
@@ -49,7 +48,7 @@ type NumberInputField<Extend = Record<never, never>> = {
|
|
|
49
48
|
float: true;
|
|
50
49
|
decimals?: number;
|
|
51
50
|
} | {
|
|
52
|
-
float
|
|
51
|
+
float?: false;
|
|
53
52
|
}) & (SelectField<number, Extend> | {});
|
|
54
53
|
type BooleanInputField<Extend = Record<never, never>> = {
|
|
55
54
|
type: `boolean`;
|
|
@@ -102,11 +101,12 @@ export type SelectFieldChoice<Values = string | number | boolean | File, Extend
|
|
|
102
101
|
key: string;
|
|
103
102
|
value: Values;
|
|
104
103
|
} & Extend;
|
|
105
|
-
type
|
|
106
|
-
format: `textarea`;
|
|
104
|
+
type CustomDisplayTextField = {
|
|
105
|
+
format: `textarea` | `rich-text` | `markdown`;
|
|
107
106
|
};
|
|
108
|
-
type
|
|
109
|
-
format: `
|
|
107
|
+
type IDETextField = {
|
|
108
|
+
format: `code`;
|
|
109
|
+
language?: string;
|
|
110
110
|
};
|
|
111
111
|
type ValidationExtended = {
|
|
112
112
|
original: any;
|
|
@@ -127,6 +127,7 @@ export type ValidationResult<Extended = Record<string, never>> = {
|
|
|
127
127
|
valid: boolean;
|
|
128
128
|
fields: Field<Extended & ValidationExtended>[];
|
|
129
129
|
};
|
|
130
|
+
export declare const alter: (field: Field, relative: string, data: Record<string, any>) => Field<Record<never, never>>;
|
|
130
131
|
export declare const validate: <I>(fields: Field<I>[], data: Record<string, any>, options?: {
|
|
131
132
|
secure?: boolean;
|
|
132
133
|
break?: boolean;
|