wowok_agent 2.1.40 → 2.2.1
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/index.d.ts +2064 -177
- package/dist/index.js +1284 -1
- package/dist/schema/call/allocation.js +24 -1
- package/dist/schema/call/arbitration.js +92 -1
- package/dist/schema/call/base.d.ts +1 -1
- package/dist/schema/call/base.js +138 -1
- package/dist/schema/call/contact.js +37 -1
- package/dist/schema/call/demand.js +47 -1
- package/dist/schema/call/guard.js +58 -1
- package/dist/schema/call/handler.js +171 -1
- package/dist/schema/call/index.js +18 -1
- package/dist/schema/call/machine.d.ts +32 -32
- package/dist/schema/call/machine.js +152 -1
- package/dist/schema/call/order.js +34 -1
- package/dist/schema/call/payment.js +17 -1
- package/dist/schema/call/permission.js +105 -1
- package/dist/schema/call/personal.js +68 -1
- package/dist/schema/call/progress.js +26 -1
- package/dist/schema/call/proof.js +27 -1
- package/dist/schema/call/repository.js +76 -1
- package/dist/schema/call/reward.js +42 -1
- package/dist/schema/call/service.js +82 -1
- package/dist/schema/call/treasury.js +71 -1
- package/dist/schema/common/index.js +345 -1
- package/dist/schema/index.js +7 -1
- package/dist/schema/local/index.js +855 -1
- package/dist/schema/local/wip.js +187 -1
- package/dist/schema/messenger/index.js +446 -1
- package/dist/schema/query/index.d.ts +43 -43
- package/dist/schema/query/index.js +1265 -1
- package/dist/schema/utils/guard-parser.js +401 -1
- package/dist/schema/utils/guard-query-utils.js +22 -1
- package/dist/schema/utils/node-parser.js +353 -1
- package/dist/schema/utils/permission-index-utils.js +7 -1
- package/package.json +3 -6
|
@@ -1 +1,401 @@
|
|
|
1
|
-
import{GuardNodeSchema}from'../query/index.js';
|
|
1
|
+
import { GuardNodeSchema } from '../query/index.js';
|
|
2
|
+
import { CallGuard_DataSchema } from '../call/guard.js';
|
|
3
|
+
function detectFormat(text) {
|
|
4
|
+
const trimmed = text.trim();
|
|
5
|
+
if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
|
|
6
|
+
return 'json';
|
|
7
|
+
}
|
|
8
|
+
return 'markdown';
|
|
9
|
+
}
|
|
10
|
+
function extractJsonFromMarkdown(markdown) {
|
|
11
|
+
const codeBlockRegex = /```(?:json)?\s*\n([\s\S]*?)```/g;
|
|
12
|
+
let match;
|
|
13
|
+
let lastMatch = null;
|
|
14
|
+
while ((match = codeBlockRegex.exec(markdown)) !== null) {
|
|
15
|
+
const jsonContent = match[1].trim();
|
|
16
|
+
if (jsonContent.startsWith('{')) {
|
|
17
|
+
const beforeMatch = markdown.substring(0, match.index);
|
|
18
|
+
const lineOffset = (beforeMatch.match(/\n/g) || []).length + 1;
|
|
19
|
+
lastMatch = { json: jsonContent, lineOffset };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return lastMatch;
|
|
23
|
+
}
|
|
24
|
+
function parseMarkdownToGuardData(markdown) {
|
|
25
|
+
const errors = [];
|
|
26
|
+
const jsonMatch = extractJsonFromMarkdown(markdown);
|
|
27
|
+
if (jsonMatch) {
|
|
28
|
+
return { data: jsonMatch.json, errors: [] };
|
|
29
|
+
}
|
|
30
|
+
const result = {};
|
|
31
|
+
const descriptionMatch = markdown.match(/(?:^|\n)#+\s*(?:Description|描述)[^\n]*\n+([^\n#]+)/i);
|
|
32
|
+
if (descriptionMatch) {
|
|
33
|
+
result.description = descriptionMatch[1].trim();
|
|
34
|
+
}
|
|
35
|
+
const tableMatch = markdown.match(/(?:^|\n)#+\s*(?:Table|数据表)[^\n]*\n+[\s\S]*?(?=(?:\n#+|$))/i);
|
|
36
|
+
if (tableMatch) {
|
|
37
|
+
const tableSection = tableMatch[0];
|
|
38
|
+
const tableRows = tableSection.match(/\|[^\n]+\|/g);
|
|
39
|
+
if (tableRows && tableRows.length > 2) {
|
|
40
|
+
const rows = tableRows.slice(2).map(row => {
|
|
41
|
+
const cells = row.split('|').filter(c => c.trim()).map(c => c.trim());
|
|
42
|
+
const valueTypeCell = cells[2];
|
|
43
|
+
let value_type;
|
|
44
|
+
const numericMatch = valueTypeCell.match(/\d+/);
|
|
45
|
+
if (numericMatch) {
|
|
46
|
+
value_type = parseInt(numericMatch[0], 10);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const typeNameMatch = valueTypeCell.match(/^([A-Za-z]+)/);
|
|
50
|
+
if (typeNameMatch) {
|
|
51
|
+
value_type = typeNameMatch[1];
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
throw new Error(`Invalid value_type in table row: "${valueTypeCell}". Expected a number (0-19) or type name (e.g., "U64", "Address")`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
identifier: parseInt(cells[0], 10),
|
|
59
|
+
b_submission: cells[1].toLowerCase() === 'true',
|
|
60
|
+
value_type,
|
|
61
|
+
value: cells[3] === '-' ? undefined : cells[3],
|
|
62
|
+
name: cells[4] === '-' ? undefined : cells[4]
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
result.table = rows;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
result.table = [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
result.table = [];
|
|
73
|
+
}
|
|
74
|
+
const rootMatch = markdown.match(/(?:^|\n)#+\s*(?:Root|根节点)[^\n]*\n+([\s\S]*?)(?=(?:\n#+|$))/i);
|
|
75
|
+
if (rootMatch) {
|
|
76
|
+
const rootSection = rootMatch[1];
|
|
77
|
+
const rootJsonMatch = rootSection.match(/```(?:json)?\s*\n([\s\S]*?)```/);
|
|
78
|
+
if (rootJsonMatch) {
|
|
79
|
+
try {
|
|
80
|
+
result.root = JSON.parse(rootJsonMatch[1]);
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
errors.push({
|
|
84
|
+
message: `Failed to parse root JSON: ${e.message}`,
|
|
85
|
+
path: '/root',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const relyMatch = markdown.match(/(?:^|\n)#+\s*(?:Rely|依赖)[^\n]*\n+([\s\S]*?)(?=(?:\n#+|$))/i);
|
|
91
|
+
if (relyMatch) {
|
|
92
|
+
const relySection = relyMatch[1];
|
|
93
|
+
const logicMatch = relySection.match(/\*\*Logic:\*\*\s*(AND|OR)/i);
|
|
94
|
+
const guardListMatches = relySection.match(/^\s*[-*]\s*(\S+)$/gm);
|
|
95
|
+
if (logicMatch || guardListMatches) {
|
|
96
|
+
const logic_and = logicMatch ? logicMatch[1].toUpperCase() === 'AND' : true;
|
|
97
|
+
const guards = guardListMatches
|
|
98
|
+
? guardListMatches.map(g => g.replace(/^\s*[-*]\s*/, '').trim())
|
|
99
|
+
: [];
|
|
100
|
+
result.rely = {
|
|
101
|
+
guards,
|
|
102
|
+
logic_or: !logic_and
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const guardsMatch = relySection.match(/[-*]\s*guards?\s*:\s*\[([^\]]+)\]/i);
|
|
107
|
+
const logicOrMatch = relySection.match(/[-*]\s*logic_or\s*:\s*(true|false)/i);
|
|
108
|
+
if (guardsMatch || logicOrMatch) {
|
|
109
|
+
result.rely = {
|
|
110
|
+
guards: guardsMatch
|
|
111
|
+
? guardsMatch[1].split(',').map(g => g.trim().replace(/['"]/g, ''))
|
|
112
|
+
: [],
|
|
113
|
+
logic_or: logicOrMatch ? logicOrMatch[1].toLowerCase() === 'true' : undefined
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return { data: result, errors };
|
|
119
|
+
}
|
|
120
|
+
function parseJsonWithSourceMap(text, lineOffset = 0) {
|
|
121
|
+
let pointers = {};
|
|
122
|
+
let data;
|
|
123
|
+
try {
|
|
124
|
+
const lines = text.split('\n');
|
|
125
|
+
const lineStarts = [0];
|
|
126
|
+
for (let i = 0; i < lines.length; i++) {
|
|
127
|
+
lineStarts.push(lineStarts[i] + lines[i].length + 1);
|
|
128
|
+
}
|
|
129
|
+
data = JSON.parse(text);
|
|
130
|
+
buildPointers(data, '', pointers, text, lineStarts, lineOffset);
|
|
131
|
+
return { data, map: { pointers } };
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function buildPointers(data, path, pointers, text, lineStarts, lineOffset) {
|
|
138
|
+
if (typeof data !== 'object' || data === null) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const pos = findValuePosition(text, path, lineStarts);
|
|
142
|
+
if (pos !== undefined) {
|
|
143
|
+
pointers[path] = {
|
|
144
|
+
value: { line: pos.line + lineOffset, column: pos.column, pos: pos.pos }
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (Array.isArray(data)) {
|
|
148
|
+
data.forEach((item, index) => {
|
|
149
|
+
buildPointers(item, `${path}/${index}`, pointers, text, lineStarts, lineOffset);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
Object.keys(data).forEach(key => {
|
|
154
|
+
const escapedKey = key.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
155
|
+
buildPointers(data[key], `${path}/${escapedKey}`, pointers, text, lineStarts, lineOffset);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function findValuePosition(text, path, lineStarts) {
|
|
160
|
+
if (path === '') {
|
|
161
|
+
const match = text.match(/\S/);
|
|
162
|
+
if (match && match.index !== undefined) {
|
|
163
|
+
return getPosition(text, match.index, lineStarts);
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
const parts = path.split('/').slice(1);
|
|
168
|
+
let searchPos = 0;
|
|
169
|
+
let depth = 0;
|
|
170
|
+
let inString = false;
|
|
171
|
+
let escape = false;
|
|
172
|
+
for (let i = 0; i < parts.length; i++) {
|
|
173
|
+
const part = parts[i].replace(/~0/g, '~').replace(/~1/g, '/');
|
|
174
|
+
let found = false;
|
|
175
|
+
while (searchPos < text.length) {
|
|
176
|
+
const char = text[searchPos];
|
|
177
|
+
if (escape) {
|
|
178
|
+
escape = false;
|
|
179
|
+
searchPos++;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (char === '\\') {
|
|
183
|
+
escape = true;
|
|
184
|
+
searchPos++;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (char === '"') {
|
|
188
|
+
inString = !inString;
|
|
189
|
+
searchPos++;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (inString) {
|
|
193
|
+
searchPos++;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (char === '{' || char === '[') {
|
|
197
|
+
depth++;
|
|
198
|
+
searchPos++;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (char === '}' || char === ']') {
|
|
202
|
+
depth--;
|
|
203
|
+
searchPos++;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (i < parts.length - 1 || !isNaN(Number(part))) {
|
|
207
|
+
if (char === '"' && depth === i + 1) {
|
|
208
|
+
const endQuote = text.indexOf('"', searchPos + 1);
|
|
209
|
+
if (endQuote !== -1) {
|
|
210
|
+
const key = text.slice(searchPos + 1, endQuote);
|
|
211
|
+
if (key === part || (!isNaN(Number(part)) && key === parts[i - 1])) {
|
|
212
|
+
searchPos = endQuote + 1;
|
|
213
|
+
while (searchPos < text.length && (text[searchPos] === ' ' || text[searchPos] === ':' || text[searchPos] === '\n' || text[searchPos] === '\r' || text[searchPos] === '\t')) {
|
|
214
|
+
searchPos++;
|
|
215
|
+
}
|
|
216
|
+
found = true;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (!isNaN(Number(part)) && char === '[') {
|
|
222
|
+
const arrayStart = searchPos;
|
|
223
|
+
let arrayDepth = 1;
|
|
224
|
+
let itemIndex = 0;
|
|
225
|
+
let itemStart = searchPos + 1;
|
|
226
|
+
for (let j = searchPos + 1; j < text.length; j++) {
|
|
227
|
+
const c = text[j];
|
|
228
|
+
if (c === '[')
|
|
229
|
+
arrayDepth++;
|
|
230
|
+
if (c === ']') {
|
|
231
|
+
arrayDepth--;
|
|
232
|
+
if (arrayDepth === 0)
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
if (c === ',' && arrayDepth === 1) {
|
|
236
|
+
if (itemIndex === Number(part)) {
|
|
237
|
+
searchPos = itemStart;
|
|
238
|
+
while (searchPos < text.length && (text[searchPos] === ' ' || text[searchPos] === '\n' || text[searchPos] === '\r' || text[searchPos] === '\t')) {
|
|
239
|
+
searchPos++;
|
|
240
|
+
}
|
|
241
|
+
found = true;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
itemIndex++;
|
|
245
|
+
itemStart = j + 1;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (found)
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
searchPos++;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
while (searchPos < text.length && (text[searchPos] === ' ' || text[searchPos] === '\n' || text[searchPos] === '\r' || text[searchPos] === '\t')) {
|
|
256
|
+
searchPos++;
|
|
257
|
+
}
|
|
258
|
+
return getPosition(text, searchPos, lineStarts);
|
|
259
|
+
}
|
|
260
|
+
function getPosition(text, pos, lineStarts) {
|
|
261
|
+
let line = 1;
|
|
262
|
+
for (let i = 0; i < lineStarts.length; i++) {
|
|
263
|
+
if (lineStarts[i] > pos)
|
|
264
|
+
break;
|
|
265
|
+
line = i + 1;
|
|
266
|
+
}
|
|
267
|
+
const column = pos - lineStarts[line - 1] + 1;
|
|
268
|
+
return { line, column, pos };
|
|
269
|
+
}
|
|
270
|
+
function formatZodPath(path) {
|
|
271
|
+
return '/' + path.map(p => String(p).replace(/~/g, '~0').replace(/\//g, '~1')).join('/');
|
|
272
|
+
}
|
|
273
|
+
export function parseGuardFromText(text) {
|
|
274
|
+
const errors = [];
|
|
275
|
+
const trimmed = text.trim();
|
|
276
|
+
const format = detectFormat(trimmed);
|
|
277
|
+
let parsedData;
|
|
278
|
+
let sourceMap = null;
|
|
279
|
+
let lineOffset = 0;
|
|
280
|
+
if (format === 'markdown') {
|
|
281
|
+
const mdResult = parseMarkdownToGuardData(trimmed);
|
|
282
|
+
if (mdResult.errors.length > 0) {
|
|
283
|
+
return { success: false, errors: mdResult.errors };
|
|
284
|
+
}
|
|
285
|
+
if (typeof mdResult.data === 'string') {
|
|
286
|
+
const jsonMatch = extractJsonFromMarkdown(trimmed);
|
|
287
|
+
if (jsonMatch) {
|
|
288
|
+
lineOffset = jsonMatch.lineOffset;
|
|
289
|
+
const parsed = parseJsonWithSourceMap(mdResult.data, lineOffset);
|
|
290
|
+
if (parsed) {
|
|
291
|
+
parsedData = parsed.data;
|
|
292
|
+
sourceMap = parsed.map;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
errors.push({
|
|
296
|
+
message: 'Failed to parse JSON from markdown code block',
|
|
297
|
+
path: '/',
|
|
298
|
+
});
|
|
299
|
+
return { success: false, errors };
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
parsedData = mdResult.data;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
parsedData = mdResult.data;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
try {
|
|
312
|
+
const parsed = parseJsonWithSourceMap(trimmed, 0);
|
|
313
|
+
if (parsed) {
|
|
314
|
+
parsedData = parsed.data;
|
|
315
|
+
sourceMap = parsed.map;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
errors.push({
|
|
319
|
+
message: 'Failed to parse JSON with source mapping',
|
|
320
|
+
path: '/',
|
|
321
|
+
});
|
|
322
|
+
return { success: false, errors };
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (e) {
|
|
326
|
+
const jsonError = e;
|
|
327
|
+
const lineMatch = jsonError.message.match(/position\s+(\d+)/);
|
|
328
|
+
let line = 1;
|
|
329
|
+
let column = 1;
|
|
330
|
+
if (lineMatch) {
|
|
331
|
+
const pos = parseInt(lineMatch[1], 10);
|
|
332
|
+
const lines = trimmed.substring(0, pos).split('\n');
|
|
333
|
+
line = lines.length;
|
|
334
|
+
column = lines[lines.length - 1].length + 1;
|
|
335
|
+
}
|
|
336
|
+
errors.push({
|
|
337
|
+
message: `JSON parse error: ${jsonError.message}`,
|
|
338
|
+
path: '/',
|
|
339
|
+
line,
|
|
340
|
+
column,
|
|
341
|
+
});
|
|
342
|
+
return { success: false, errors };
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const result = CallGuard_DataSchema.safeParse(parsedData);
|
|
346
|
+
if (result.success) {
|
|
347
|
+
return { success: true, data: result.data, errors: [] };
|
|
348
|
+
}
|
|
349
|
+
for (const issue of result.error.issues) {
|
|
350
|
+
const path = formatZodPath(issue.path);
|
|
351
|
+
let line;
|
|
352
|
+
let column;
|
|
353
|
+
if (sourceMap?.pointers[path]) {
|
|
354
|
+
const pointer = sourceMap.pointers[path];
|
|
355
|
+
if (pointer.value) {
|
|
356
|
+
line = pointer.value.line;
|
|
357
|
+
column = pointer.value.column;
|
|
358
|
+
}
|
|
359
|
+
else if (pointer.key) {
|
|
360
|
+
line = pointer.key.line;
|
|
361
|
+
column = pointer.key.column;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
let message = issue.message;
|
|
365
|
+
if (issue.code === 'invalid_union') {
|
|
366
|
+
const unionIssue = issue;
|
|
367
|
+
if (unionIssue.errors) {
|
|
368
|
+
const unionErrors = unionIssue.errors.map((e) => e.issues?.map((i) => i.message).join('; ') || e.message).join(' | ');
|
|
369
|
+
message = `${message}. Alternatives: ${unionErrors}`;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
errors.push({
|
|
373
|
+
message,
|
|
374
|
+
path,
|
|
375
|
+
line,
|
|
376
|
+
column,
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
return { success: false, errors };
|
|
380
|
+
}
|
|
381
|
+
export function formatGuardErrors(errors) {
|
|
382
|
+
return errors.map(e => {
|
|
383
|
+
let msg = `Path: ${e.path}`;
|
|
384
|
+
if (e.line !== undefined && e.column !== undefined) {
|
|
385
|
+
msg += ` (line ${e.line}, column ${e.column})`;
|
|
386
|
+
}
|
|
387
|
+
msg += `\n Error: ${e.message}`;
|
|
388
|
+
return msg;
|
|
389
|
+
}).join('\n\n');
|
|
390
|
+
}
|
|
391
|
+
export function validateGuardNode(node) {
|
|
392
|
+
const result = GuardNodeSchema.safeParse(node);
|
|
393
|
+
if (result.success) {
|
|
394
|
+
return { success: true, errors: [] };
|
|
395
|
+
}
|
|
396
|
+
const errors = result.error.issues.map(issue => ({
|
|
397
|
+
message: issue.message,
|
|
398
|
+
path: formatZodPath(issue.path),
|
|
399
|
+
}));
|
|
400
|
+
return { success: false, errors };
|
|
401
|
+
}
|
|
@@ -1 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GUARDQUERY } from "wowok";
|
|
2
|
+
const validGuardQueryIds = new Set(GUARDQUERY.map(item => item.id));
|
|
3
|
+
const validGuardQueryNames = new Set(GUARDQUERY.map(item => item.name.toLowerCase()));
|
|
4
|
+
export const isValidGuardQueryId = (id) => {
|
|
5
|
+
return validGuardQueryIds.has(id);
|
|
6
|
+
};
|
|
7
|
+
export const isValidGuardQueryName = (name) => {
|
|
8
|
+
return validGuardQueryNames.has(name.toLowerCase());
|
|
9
|
+
};
|
|
10
|
+
export const isValidGuardQueryIdOrName = (input) => {
|
|
11
|
+
if (typeof input === 'number') {
|
|
12
|
+
return isValidGuardQueryId(input);
|
|
13
|
+
}
|
|
14
|
+
return isValidGuardQueryName(input);
|
|
15
|
+
};
|
|
16
|
+
export const getGuardQueryByIdOrName = (input) => {
|
|
17
|
+
if (typeof input === 'number') {
|
|
18
|
+
return GUARDQUERY.find(item => item.id === input);
|
|
19
|
+
}
|
|
20
|
+
return GUARDQUERY.find(item => item.name.toLowerCase() === input.toLowerCase());
|
|
21
|
+
};
|
|
22
|
+
export const GUARD_QUERY_NAMES = GUARDQUERY.map(item => item.name);
|