@nocobase/plugin-workflow-custom-action-trigger 2.1.0-alpha.10 → 2.1.0-alpha.12
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/client/CustomActionTrigger.d.ts +39 -2
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +10 -10
- package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
- package/dist/node_modules/joi/lib/annotate.js +175 -0
- package/dist/node_modules/joi/lib/base.js +1069 -0
- package/dist/node_modules/joi/lib/cache.js +143 -0
- package/dist/node_modules/joi/lib/common.js +216 -0
- package/dist/node_modules/joi/lib/compile.js +283 -0
- package/dist/node_modules/joi/lib/errors.js +271 -0
- package/dist/node_modules/joi/lib/extend.js +312 -0
- package/dist/node_modules/joi/lib/index.d.ts +2365 -0
- package/dist/node_modules/joi/lib/index.js +1 -0
- package/dist/node_modules/joi/lib/manifest.js +476 -0
- package/dist/node_modules/joi/lib/messages.js +178 -0
- package/dist/node_modules/joi/lib/modify.js +267 -0
- package/dist/node_modules/joi/lib/ref.js +414 -0
- package/dist/node_modules/joi/lib/schemas.js +302 -0
- package/dist/node_modules/joi/lib/state.js +166 -0
- package/dist/node_modules/joi/lib/template.js +463 -0
- package/dist/node_modules/joi/lib/trace.js +346 -0
- package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
- package/dist/node_modules/joi/lib/types/any.js +174 -0
- package/dist/node_modules/joi/lib/types/array.js +809 -0
- package/dist/node_modules/joi/lib/types/binary.js +100 -0
- package/dist/node_modules/joi/lib/types/boolean.js +150 -0
- package/dist/node_modules/joi/lib/types/date.js +233 -0
- package/dist/node_modules/joi/lib/types/function.js +93 -0
- package/dist/node_modules/joi/lib/types/keys.js +1067 -0
- package/dist/node_modules/joi/lib/types/link.js +168 -0
- package/dist/node_modules/joi/lib/types/number.js +363 -0
- package/dist/node_modules/joi/lib/types/object.js +22 -0
- package/dist/node_modules/joi/lib/types/string.js +850 -0
- package/dist/node_modules/joi/lib/types/symbol.js +102 -0
- package/dist/node_modules/joi/lib/validator.js +750 -0
- package/dist/node_modules/joi/lib/values.js +263 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
- package/dist/node_modules/joi/package.json +1 -0
- package/dist/server/CustomActionTrigger.d.ts +11 -0
- package/dist/server/CustomActionTrigger.js +19 -0
- package/package.json +5 -2
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Joi = require('./index');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const internals = {};
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Preferences
|
|
10
|
+
|
|
11
|
+
internals.wrap = Joi.string()
|
|
12
|
+
.min(1)
|
|
13
|
+
.max(2)
|
|
14
|
+
.allow(false);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
exports.preferences = Joi.object({
|
|
18
|
+
allowUnknown: Joi.boolean(),
|
|
19
|
+
abortEarly: Joi.boolean(),
|
|
20
|
+
artifacts: Joi.boolean(),
|
|
21
|
+
cache: Joi.boolean(),
|
|
22
|
+
context: Joi.object(),
|
|
23
|
+
convert: Joi.boolean(),
|
|
24
|
+
dateFormat: Joi.valid('date', 'iso', 'string', 'time', 'utc'),
|
|
25
|
+
debug: Joi.boolean(),
|
|
26
|
+
errors: {
|
|
27
|
+
escapeHtml: Joi.boolean(),
|
|
28
|
+
label: Joi.valid('path', 'key', false),
|
|
29
|
+
language: [
|
|
30
|
+
Joi.string(),
|
|
31
|
+
Joi.object().ref()
|
|
32
|
+
],
|
|
33
|
+
render: Joi.boolean(),
|
|
34
|
+
stack: Joi.boolean(),
|
|
35
|
+
wrap: {
|
|
36
|
+
label: internals.wrap,
|
|
37
|
+
array: internals.wrap,
|
|
38
|
+
string: internals.wrap
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
externals: Joi.boolean(),
|
|
42
|
+
messages: Joi.object(),
|
|
43
|
+
noDefaults: Joi.boolean(),
|
|
44
|
+
nonEnumerables: Joi.boolean(),
|
|
45
|
+
presence: Joi.valid('required', 'optional', 'forbidden'),
|
|
46
|
+
skipFunctions: Joi.boolean(),
|
|
47
|
+
stripUnknown: Joi.object({
|
|
48
|
+
arrays: Joi.boolean(),
|
|
49
|
+
objects: Joi.boolean()
|
|
50
|
+
})
|
|
51
|
+
.or('arrays', 'objects')
|
|
52
|
+
.allow(true, false),
|
|
53
|
+
warnings: Joi.boolean()
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// Extensions
|
|
59
|
+
|
|
60
|
+
internals.nameRx = /^[a-zA-Z0-9]\w*$/;
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
internals.rule = Joi.object({
|
|
64
|
+
alias: Joi.array().items(Joi.string().pattern(internals.nameRx)).single(),
|
|
65
|
+
args: Joi.array().items(
|
|
66
|
+
Joi.string(),
|
|
67
|
+
Joi.object({
|
|
68
|
+
name: Joi.string().pattern(internals.nameRx).required(),
|
|
69
|
+
ref: Joi.boolean(),
|
|
70
|
+
assert: Joi.alternatives([
|
|
71
|
+
Joi.function(),
|
|
72
|
+
Joi.object().schema()
|
|
73
|
+
])
|
|
74
|
+
.conditional('ref', { is: true, then: Joi.required() }),
|
|
75
|
+
normalize: Joi.function(),
|
|
76
|
+
message: Joi.string().when('assert', { is: Joi.function(), then: Joi.required() })
|
|
77
|
+
})
|
|
78
|
+
),
|
|
79
|
+
convert: Joi.boolean(),
|
|
80
|
+
manifest: Joi.boolean(),
|
|
81
|
+
method: Joi.function().allow(false),
|
|
82
|
+
multi: Joi.boolean(),
|
|
83
|
+
validate: Joi.function()
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
exports.extension = Joi.object({
|
|
88
|
+
type: Joi.alternatives([
|
|
89
|
+
Joi.string(),
|
|
90
|
+
Joi.object().regex()
|
|
91
|
+
])
|
|
92
|
+
.required(),
|
|
93
|
+
args: Joi.function(),
|
|
94
|
+
cast: Joi.object().pattern(internals.nameRx, Joi.object({
|
|
95
|
+
from: Joi.function().maxArity(1).required(),
|
|
96
|
+
to: Joi.function().minArity(1).maxArity(2).required()
|
|
97
|
+
})),
|
|
98
|
+
base: Joi.object().schema()
|
|
99
|
+
.when('type', { is: Joi.object().regex(), then: Joi.forbidden() }),
|
|
100
|
+
coerce: [
|
|
101
|
+
Joi.function().maxArity(3),
|
|
102
|
+
Joi.object({ method: Joi.function().maxArity(3).required(), from: Joi.array().items(Joi.string()).single() })
|
|
103
|
+
],
|
|
104
|
+
flags: Joi.object().pattern(internals.nameRx, Joi.object({
|
|
105
|
+
setter: Joi.string(),
|
|
106
|
+
default: Joi.any()
|
|
107
|
+
})),
|
|
108
|
+
manifest: {
|
|
109
|
+
build: Joi.function().arity(2)
|
|
110
|
+
},
|
|
111
|
+
messages: [Joi.object(), Joi.string()],
|
|
112
|
+
modifiers: Joi.object().pattern(internals.nameRx, Joi.function().minArity(1).maxArity(2)),
|
|
113
|
+
overrides: Joi.object().pattern(internals.nameRx, Joi.function()),
|
|
114
|
+
prepare: Joi.function().maxArity(3),
|
|
115
|
+
rebuild: Joi.function().arity(1),
|
|
116
|
+
rules: Joi.object().pattern(internals.nameRx, internals.rule),
|
|
117
|
+
terms: Joi.object().pattern(internals.nameRx, Joi.object({
|
|
118
|
+
init: Joi.array().allow(null).required(),
|
|
119
|
+
manifest: Joi.object().pattern(/.+/, [
|
|
120
|
+
Joi.valid('schema', 'single'),
|
|
121
|
+
Joi.object({
|
|
122
|
+
mapped: Joi.object({
|
|
123
|
+
from: Joi.string().required(),
|
|
124
|
+
to: Joi.string().required()
|
|
125
|
+
})
|
|
126
|
+
.required()
|
|
127
|
+
})
|
|
128
|
+
])
|
|
129
|
+
})),
|
|
130
|
+
validate: Joi.function().maxArity(3)
|
|
131
|
+
})
|
|
132
|
+
.strict();
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
exports.extensions = Joi.array().items(Joi.object(), Joi.function().arity(1)).strict();
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
// Manifest
|
|
139
|
+
|
|
140
|
+
internals.desc = {
|
|
141
|
+
|
|
142
|
+
buffer: Joi.object({
|
|
143
|
+
buffer: Joi.string()
|
|
144
|
+
}),
|
|
145
|
+
|
|
146
|
+
func: Joi.object({
|
|
147
|
+
function: Joi.function().required(),
|
|
148
|
+
options: {
|
|
149
|
+
literal: true
|
|
150
|
+
}
|
|
151
|
+
}),
|
|
152
|
+
|
|
153
|
+
override: Joi.object({
|
|
154
|
+
override: true
|
|
155
|
+
}),
|
|
156
|
+
|
|
157
|
+
ref: Joi.object({
|
|
158
|
+
ref: Joi.object({
|
|
159
|
+
type: Joi.valid('value', 'global', 'local'),
|
|
160
|
+
path: Joi.array().required(),
|
|
161
|
+
separator: Joi.string().length(1).allow(false),
|
|
162
|
+
ancestor: Joi.number().min(0).integer().allow('root'),
|
|
163
|
+
map: Joi.array().items(Joi.array().length(2)).min(1),
|
|
164
|
+
adjust: Joi.function(),
|
|
165
|
+
iterables: Joi.boolean(),
|
|
166
|
+
in: Joi.boolean(),
|
|
167
|
+
render: Joi.boolean()
|
|
168
|
+
})
|
|
169
|
+
.required()
|
|
170
|
+
}),
|
|
171
|
+
|
|
172
|
+
regex: Joi.object({
|
|
173
|
+
regex: Joi.string().min(3)
|
|
174
|
+
}),
|
|
175
|
+
|
|
176
|
+
special: Joi.object({
|
|
177
|
+
special: Joi.valid('deep').required()
|
|
178
|
+
}),
|
|
179
|
+
|
|
180
|
+
template: Joi.object({
|
|
181
|
+
template: Joi.string().required(),
|
|
182
|
+
options: Joi.object()
|
|
183
|
+
}),
|
|
184
|
+
|
|
185
|
+
value: Joi.object({
|
|
186
|
+
value: Joi.alternatives([Joi.object(), Joi.array()]).required()
|
|
187
|
+
})
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
internals.desc.entity = Joi.alternatives([
|
|
192
|
+
Joi.array().items(Joi.link('...')),
|
|
193
|
+
Joi.boolean(),
|
|
194
|
+
Joi.function(),
|
|
195
|
+
Joi.number(),
|
|
196
|
+
Joi.string(),
|
|
197
|
+
internals.desc.buffer,
|
|
198
|
+
internals.desc.func,
|
|
199
|
+
internals.desc.ref,
|
|
200
|
+
internals.desc.regex,
|
|
201
|
+
internals.desc.special,
|
|
202
|
+
internals.desc.template,
|
|
203
|
+
internals.desc.value,
|
|
204
|
+
Joi.link('/')
|
|
205
|
+
]);
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
internals.desc.values = Joi.array()
|
|
209
|
+
.items(
|
|
210
|
+
null,
|
|
211
|
+
Joi.boolean(),
|
|
212
|
+
Joi.function(),
|
|
213
|
+
Joi.number().allow(Infinity, -Infinity),
|
|
214
|
+
Joi.string().allow(''),
|
|
215
|
+
Joi.symbol(),
|
|
216
|
+
internals.desc.buffer,
|
|
217
|
+
internals.desc.func,
|
|
218
|
+
internals.desc.override,
|
|
219
|
+
internals.desc.ref,
|
|
220
|
+
internals.desc.regex,
|
|
221
|
+
internals.desc.template,
|
|
222
|
+
internals.desc.value
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
internals.desc.messages = Joi.object()
|
|
227
|
+
.pattern(/.+/, [
|
|
228
|
+
Joi.string(),
|
|
229
|
+
internals.desc.template,
|
|
230
|
+
Joi.object().pattern(/.+/, [Joi.string(), internals.desc.template])
|
|
231
|
+
]);
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
exports.description = Joi.object({
|
|
235
|
+
type: Joi.string().required(),
|
|
236
|
+
flags: Joi.object({
|
|
237
|
+
cast: Joi.string(),
|
|
238
|
+
default: Joi.any(),
|
|
239
|
+
description: Joi.string(),
|
|
240
|
+
empty: Joi.link('/'),
|
|
241
|
+
failover: internals.desc.entity,
|
|
242
|
+
id: Joi.string(),
|
|
243
|
+
label: Joi.string(),
|
|
244
|
+
only: true,
|
|
245
|
+
presence: ['optional', 'required', 'forbidden'],
|
|
246
|
+
result: ['raw', 'strip'],
|
|
247
|
+
strip: Joi.boolean(),
|
|
248
|
+
unit: Joi.string()
|
|
249
|
+
})
|
|
250
|
+
.unknown(),
|
|
251
|
+
preferences: {
|
|
252
|
+
allowUnknown: Joi.boolean(),
|
|
253
|
+
abortEarly: Joi.boolean(),
|
|
254
|
+
artifacts: Joi.boolean(),
|
|
255
|
+
cache: Joi.boolean(),
|
|
256
|
+
convert: Joi.boolean(),
|
|
257
|
+
dateFormat: ['date', 'iso', 'string', 'time', 'utc'],
|
|
258
|
+
errors: {
|
|
259
|
+
escapeHtml: Joi.boolean(),
|
|
260
|
+
label: ['path', 'key'],
|
|
261
|
+
language: [
|
|
262
|
+
Joi.string(),
|
|
263
|
+
internals.desc.ref
|
|
264
|
+
],
|
|
265
|
+
wrap: {
|
|
266
|
+
label: internals.wrap,
|
|
267
|
+
array: internals.wrap
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
externals: Joi.boolean(),
|
|
271
|
+
messages: internals.desc.messages,
|
|
272
|
+
noDefaults: Joi.boolean(),
|
|
273
|
+
nonEnumerables: Joi.boolean(),
|
|
274
|
+
presence: ['required', 'optional', 'forbidden'],
|
|
275
|
+
skipFunctions: Joi.boolean(),
|
|
276
|
+
stripUnknown: Joi.object({
|
|
277
|
+
arrays: Joi.boolean(),
|
|
278
|
+
objects: Joi.boolean()
|
|
279
|
+
})
|
|
280
|
+
.or('arrays', 'objects')
|
|
281
|
+
.allow(true, false),
|
|
282
|
+
warnings: Joi.boolean()
|
|
283
|
+
},
|
|
284
|
+
allow: internals.desc.values,
|
|
285
|
+
invalid: internals.desc.values,
|
|
286
|
+
rules: Joi.array().min(1).items({
|
|
287
|
+
name: Joi.string().required(),
|
|
288
|
+
args: Joi.object().min(1),
|
|
289
|
+
keep: Joi.boolean(),
|
|
290
|
+
message: [
|
|
291
|
+
Joi.string(),
|
|
292
|
+
internals.desc.messages
|
|
293
|
+
],
|
|
294
|
+
warn: Joi.boolean()
|
|
295
|
+
}),
|
|
296
|
+
|
|
297
|
+
// Terms
|
|
298
|
+
|
|
299
|
+
keys: Joi.object().pattern(/.*/, Joi.link('/')),
|
|
300
|
+
link: internals.desc.ref
|
|
301
|
+
})
|
|
302
|
+
.pattern(/^[a-z]\w*$/, Joi.any());
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Clone = require('@hapi/hoek/lib/clone');
|
|
4
|
+
const Reach = require('@hapi/hoek/lib/reach');
|
|
5
|
+
|
|
6
|
+
const Common = require('./common');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const internals = {
|
|
10
|
+
value: Symbol('value')
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
module.exports = internals.State = class {
|
|
15
|
+
|
|
16
|
+
constructor(path, ancestors, state) {
|
|
17
|
+
|
|
18
|
+
this.path = path;
|
|
19
|
+
this.ancestors = ancestors; // [parent, ..., root]
|
|
20
|
+
|
|
21
|
+
this.mainstay = state.mainstay;
|
|
22
|
+
this.schemas = state.schemas; // [current, ..., root]
|
|
23
|
+
this.debug = null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
localize(path, ancestors = null, schema = null) {
|
|
27
|
+
|
|
28
|
+
const state = new internals.State(path, ancestors, this);
|
|
29
|
+
|
|
30
|
+
if (schema &&
|
|
31
|
+
state.schemas) {
|
|
32
|
+
|
|
33
|
+
state.schemas = [internals.schemas(schema), ...state.schemas];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return state;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
nest(schema, debug) {
|
|
40
|
+
|
|
41
|
+
const state = new internals.State(this.path, this.ancestors, this);
|
|
42
|
+
state.schemas = state.schemas && [internals.schemas(schema), ...state.schemas];
|
|
43
|
+
state.debug = debug;
|
|
44
|
+
return state;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
shadow(value, reason) {
|
|
48
|
+
|
|
49
|
+
this.mainstay.shadow = this.mainstay.shadow || new internals.Shadow();
|
|
50
|
+
this.mainstay.shadow.set(this.path, value, reason);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
snapshot() {
|
|
54
|
+
|
|
55
|
+
if (this.mainstay.shadow) {
|
|
56
|
+
this._snapshot = Clone(this.mainstay.shadow.node(this.path));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this.mainstay.snapshot();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
restore() {
|
|
63
|
+
|
|
64
|
+
if (this.mainstay.shadow) {
|
|
65
|
+
this.mainstay.shadow.override(this.path, this._snapshot);
|
|
66
|
+
this._snapshot = undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
this.mainstay.restore();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
commit() {
|
|
73
|
+
|
|
74
|
+
if (this.mainstay.shadow) {
|
|
75
|
+
this.mainstay.shadow.override(this.path, this._snapshot);
|
|
76
|
+
this._snapshot = undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.mainstay.commit();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
internals.schemas = function (schema) {
|
|
85
|
+
|
|
86
|
+
if (Common.isSchema(schema)) {
|
|
87
|
+
return { schema };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return schema;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
internals.Shadow = class {
|
|
95
|
+
|
|
96
|
+
constructor() {
|
|
97
|
+
|
|
98
|
+
this._values = null;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
set(path, value, reason) {
|
|
102
|
+
|
|
103
|
+
if (!path.length) { // No need to store root value
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (reason === 'strip' &&
|
|
108
|
+
typeof path[path.length - 1] === 'number') { // Cannot store stripped array values (due to shift)
|
|
109
|
+
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this._values = this._values || new Map();
|
|
114
|
+
|
|
115
|
+
let node = this._values;
|
|
116
|
+
for (let i = 0; i < path.length; ++i) {
|
|
117
|
+
const segment = path[i];
|
|
118
|
+
let next = node.get(segment);
|
|
119
|
+
if (!next) {
|
|
120
|
+
next = new Map();
|
|
121
|
+
node.set(segment, next);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
node = next;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
node[internals.value] = value;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
get(path) {
|
|
131
|
+
|
|
132
|
+
const node = this.node(path);
|
|
133
|
+
if (node) {
|
|
134
|
+
return node[internals.value];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
node(path) {
|
|
139
|
+
|
|
140
|
+
if (!this._values) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return Reach(this._values, path, { iterables: true });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
override(path, node) {
|
|
148
|
+
|
|
149
|
+
if (!this._values) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const parents = path.slice(0, -1);
|
|
154
|
+
const own = path[path.length - 1];
|
|
155
|
+
const parent = Reach(this._values, parents, { iterables: true });
|
|
156
|
+
|
|
157
|
+
if (node) {
|
|
158
|
+
parent.set(own, node);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (parent) {
|
|
163
|
+
parent.delete(own);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|