@nocobase/plugin-workflow 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/93d3f3f8ced1c194.js +10 -0
- package/dist/client/c46a9a8d11a5be44.js +10 -0
- package/dist/client/cd221313681d6736.js +10 -0
- package/dist/client/e9463c8cd2a45481.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client/nodes/create.d.ts +10 -0
- package/dist/client/nodes/destroy.d.ts +10 -0
- package/dist/client/nodes/query.d.ts +10 -0
- package/dist/client/nodes/update.d.ts +10 -0
- package/dist/client/triggers/collection.d.ts +14 -1
- package/dist/client/triggers/index.d.ts +4 -0
- package/dist/client/triggers/schedule/constants.d.ts +4 -0
- package/dist/client/triggers/schedule/index.d.ts +15 -0
- package/dist/externalVersion.js +12 -12
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/cron-parser/package.json +1 -1
- 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/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Plugin.d.ts +1 -0
- package/dist/server/Plugin.js +26 -0
- package/dist/server/actions/nodes.d.ts +5 -0
- package/dist/server/actions/nodes.js +34 -2
- package/dist/server/actions/workflows.d.ts +6 -0
- package/dist/server/actions/workflows.js +38 -0
- package/dist/server/instructions/CreateInstruction.d.ts +3 -0
- package/dist/server/instructions/CreateInstruction.js +21 -0
- package/dist/server/instructions/DestroyInstruction.d.ts +3 -0
- package/dist/server/instructions/DestroyInstruction.js +22 -0
- package/dist/server/instructions/EndInstruction.d.ts +2 -0
- package/dist/server/instructions/EndInstruction.js +4 -0
- package/dist/server/instructions/QueryInstruction.d.ts +3 -0
- package/dist/server/instructions/QueryInstruction.js +21 -0
- package/dist/server/instructions/UpdateInstruction.d.ts +3 -0
- package/dist/server/instructions/UpdateInstruction.js +22 -0
- package/dist/server/instructions/index.d.ts +4 -0
- package/dist/server/instructions/index.js +18 -0
- package/dist/server/triggers/CollectionTrigger.d.ts +3 -0
- package/dist/server/triggers/CollectionTrigger.js +23 -0
- package/dist/server/triggers/ScheduleTrigger/index.d.ts +3 -0
- package/dist/server/triggers/ScheduleTrigger/index.js +18 -3
- package/dist/server/triggers/index.d.ts +3 -0
- package/dist/server/triggers/index.js +18 -0
- package/dist/server/utils.d.ts +2 -0
- package/dist/server/utils.js +22 -2
- package/package.json +3 -2
- package/dist/client/0e7da88f89e15485.js +0 -10
- package/dist/client/37560b46d530bcf9.js +0 -10
- package/dist/client/4464fed3a8411375.js +0 -10
- package/dist/client/973723cf75f1e4e9.js +0 -10
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const Clone = require('@hapi/hoek/lib/clone');
|
|
4
|
+
|
|
5
|
+
const Common = require('./common');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const internals = {
|
|
9
|
+
annotations: Symbol('annotations')
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.error = function (stripColorCodes) {
|
|
14
|
+
|
|
15
|
+
if (!this._original ||
|
|
16
|
+
typeof this._original !== 'object') {
|
|
17
|
+
|
|
18
|
+
return this.details[0].message;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const redFgEscape = stripColorCodes ? '' : '\u001b[31m';
|
|
22
|
+
const redBgEscape = stripColorCodes ? '' : '\u001b[41m';
|
|
23
|
+
const endColor = stripColorCodes ? '' : '\u001b[0m';
|
|
24
|
+
|
|
25
|
+
const obj = Clone(this._original);
|
|
26
|
+
|
|
27
|
+
for (let i = this.details.length - 1; i >= 0; --i) { // Reverse order to process deepest child first
|
|
28
|
+
const pos = i + 1;
|
|
29
|
+
const error = this.details[i];
|
|
30
|
+
const path = error.path;
|
|
31
|
+
let node = obj;
|
|
32
|
+
for (let j = 0; ; ++j) {
|
|
33
|
+
const seg = path[j];
|
|
34
|
+
|
|
35
|
+
if (Common.isSchema(node)) {
|
|
36
|
+
node = node.clone(); // joi schemas are not cloned by hoek, we have to take this extra step
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (j + 1 < path.length &&
|
|
40
|
+
typeof node[seg] !== 'string') {
|
|
41
|
+
|
|
42
|
+
node = node[seg];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const refAnnotations = node[internals.annotations] || { errors: {}, missing: {} };
|
|
46
|
+
node[internals.annotations] = refAnnotations;
|
|
47
|
+
|
|
48
|
+
const cacheKey = seg || error.context.key;
|
|
49
|
+
|
|
50
|
+
if (node[seg] !== undefined) {
|
|
51
|
+
refAnnotations.errors[cacheKey] = refAnnotations.errors[cacheKey] || [];
|
|
52
|
+
refAnnotations.errors[cacheKey].push(pos);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
refAnnotations.missing[cacheKey] = pos;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const replacers = {
|
|
64
|
+
key: /_\$key\$_([, \d]+)_\$end\$_"/g,
|
|
65
|
+
missing: /"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,
|
|
66
|
+
arrayIndex: /\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,
|
|
67
|
+
specials: /"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
let message = internals.safeStringify(obj, 2)
|
|
71
|
+
.replace(replacers.key, ($0, $1) => `" ${redFgEscape}[${$1}]${endColor}`)
|
|
72
|
+
.replace(replacers.missing, ($0, $1, $2) => `${redBgEscape}"${$1}"${endColor}${redFgEscape} [${$2}]: -- missing --${endColor}`)
|
|
73
|
+
.replace(replacers.arrayIndex, ($0, $1, $2) => `\n${$2} ${redFgEscape}[${$1}]${endColor}`)
|
|
74
|
+
.replace(replacers.specials, ($0, $1) => $1);
|
|
75
|
+
|
|
76
|
+
message = `${message}\n${redFgEscape}`;
|
|
77
|
+
|
|
78
|
+
for (let i = 0; i < this.details.length; ++i) {
|
|
79
|
+
const pos = i + 1;
|
|
80
|
+
message = `${message}\n[${pos}] ${this.details[i].message}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message = message + endColor;
|
|
84
|
+
|
|
85
|
+
return message;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
// Inspired by json-stringify-safe
|
|
90
|
+
|
|
91
|
+
internals.safeStringify = function (obj, spaces) {
|
|
92
|
+
|
|
93
|
+
return JSON.stringify(obj, internals.serializer(), spaces);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
internals.serializer = function () {
|
|
98
|
+
|
|
99
|
+
const keys = [];
|
|
100
|
+
const stack = [];
|
|
101
|
+
|
|
102
|
+
const cycleReplacer = (key, value) => {
|
|
103
|
+
|
|
104
|
+
if (stack[0] === value) {
|
|
105
|
+
return '[Circular ~]';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return '[Circular ~.' + keys.slice(0, stack.indexOf(value)).join('.') + ']';
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return function (key, value) {
|
|
112
|
+
|
|
113
|
+
if (stack.length > 0) {
|
|
114
|
+
const thisPos = stack.indexOf(this);
|
|
115
|
+
if (~thisPos) {
|
|
116
|
+
stack.length = thisPos + 1;
|
|
117
|
+
keys.length = thisPos + 1;
|
|
118
|
+
keys[thisPos] = key;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
stack.push(this);
|
|
122
|
+
keys.push(key);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (~stack.indexOf(value)) {
|
|
126
|
+
value = cycleReplacer.call(this, key, value);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
stack.push(value);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (value) {
|
|
134
|
+
const annotations = value[internals.annotations];
|
|
135
|
+
if (annotations) {
|
|
136
|
+
if (Array.isArray(value)) {
|
|
137
|
+
const annotated = [];
|
|
138
|
+
|
|
139
|
+
for (let i = 0; i < value.length; ++i) {
|
|
140
|
+
if (annotations.errors[i]) {
|
|
141
|
+
annotated.push(`_$idx$_${annotations.errors[i].sort().join(', ')}_$end$_`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
annotated.push(value[i]);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
value = annotated;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
for (const errorKey in annotations.errors) {
|
|
151
|
+
value[`${errorKey}_$key$_${annotations.errors[errorKey].sort().join(', ')}_$end$_`] = value[errorKey];
|
|
152
|
+
value[errorKey] = undefined;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
for (const missingKey in annotations.missing) {
|
|
156
|
+
value[`_$miss$_${missingKey}|${annotations.missing[missingKey]}_$end$_`] = '__missing__';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (value === Infinity ||
|
|
165
|
+
value === -Infinity ||
|
|
166
|
+
Number.isNaN(value) ||
|
|
167
|
+
typeof value === 'function' ||
|
|
168
|
+
typeof value === 'symbol') {
|
|
169
|
+
|
|
170
|
+
return '[' + value.toString() + ']';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return value;
|
|
174
|
+
};
|
|
175
|
+
};
|