@fleetless/contracts 14.0.0 → 15.0.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.
Files changed (119) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/artifacts/openapi.json +19842 -11398
  3. package/artifacts/routes.json +1160 -39
  4. package/artifacts/schema/addon-catalogue-entry.schema.json +3 -1
  5. package/artifacts/schema/admin-plan-change-request.schema.json +26 -0
  6. package/artifacts/schema/app-deletion-summary.schema.json +15 -1
  7. package/artifacts/schema/asset-plan-limit-details.schema.json +3 -1
  8. package/artifacts/schema/cloud-config.schema.json +5 -5
  9. package/artifacts/schema/collection-actor.schema.json +35 -0
  10. package/artifacts/schema/collection-definitions-response.schema.json +612 -0
  11. package/artifacts/schema/collection-event.schema.json +216 -0
  12. package/artifacts/schema/collection-export-query.schema.json +56 -0
  13. package/artifacts/schema/collection-filter.schema.json +9 -0
  14. package/artifacts/schema/collection-import-preview.schema.json +143 -0
  15. package/artifacts/schema/collection-import-request.schema.json +105 -0
  16. package/artifacts/schema/collection-import-result.schema.json +38 -0
  17. package/artifacts/schema/collection-list-response.schema.json +119 -0
  18. package/artifacts/schema/collection-record-get-query.schema.json +12 -0
  19. package/artifacts/schema/collection-record-history-query.schema.json +35 -0
  20. package/artifacts/schema/collection-record-history-response.schema.json +389 -0
  21. package/artifacts/schema/collection-record-list-query.schema.json +67 -0
  22. package/artifacts/schema/collection-record-list-response.schema.json +212 -0
  23. package/artifacts/schema/collection-record-restore-request.schema.json +14 -0
  24. package/artifacts/schema/collection-record-write.schema.json +31 -0
  25. package/artifacts/schema/collection-record.schema.json +180 -0
  26. package/artifacts/schema/collection-revision.schema.json +295 -0
  27. package/artifacts/schema/collection-subscribe-error.schema.json +31 -0
  28. package/artifacts/schema/collection-subscribe.schema.json +48 -0
  29. package/artifacts/schema/collection-subscribed.schema.json +22 -0
  30. package/artifacts/schema/collection-summary.schema.json +92 -0
  31. package/artifacts/schema/collection-unsubscribe.schema.json +22 -0
  32. package/artifacts/schema/collections-access-change.schema.json +34 -0
  33. package/artifacts/schema/collections-document.schema.json +732 -0
  34. package/artifacts/schema/collections-draft-response.schema.json +845 -0
  35. package/artifacts/schema/collections-effect.schema.json +384 -0
  36. package/artifacts/schema/collections-issue.schema.json +36 -0
  37. package/artifacts/schema/collections-publish-request.schema.json +18 -0
  38. package/artifacts/schema/collections-publish-response.schema.json +450 -0
  39. package/artifacts/schema/collections-purge-preview.schema.json +60 -0
  40. package/artifacts/schema/collections-purge-request.schema.json +27 -0
  41. package/artifacts/schema/collections-purge-response.schema.json +30 -0
  42. package/artifacts/schema/collections-restore-preview-query.schema.json +20 -0
  43. package/artifacts/schema/collections-restore-preview.schema.json +581 -0
  44. package/artifacts/schema/collections-restore-request.schema.json +27 -0
  45. package/artifacts/schema/collections-restore-response.schema.json +455 -0
  46. package/artifacts/schema/collections-schema-preview.schema.json +519 -0
  47. package/artifacts/schema/collections-schema-published.schema.json +22 -0
  48. package/artifacts/schema/collections-version-response.schema.json +869 -0
  49. package/artifacts/schema/collections-version-summary.schema.json +139 -0
  50. package/artifacts/schema/collections-versions-response.schema.json +167 -0
  51. package/artifacts/schema/config-draft-response.schema.json +5 -5
  52. package/artifacts/schema/config-version-response.schema.json +5 -5
  53. package/artifacts/schema/confirmation-required-details.schema.json +13 -0
  54. package/artifacts/schema/dangling-reference.schema.json +7 -6
  55. package/artifacts/schema/datapoint-list-response.schema.json +2 -2
  56. package/artifacts/schema/effective-rights-response.schema.json +87 -1
  57. package/artifacts/schema/org-plan.schema.json +29 -1
  58. package/artifacts/schema/org-quota-usage-counts.schema.json +18 -0
  59. package/artifacts/schema/org-quota-usage.schema.json +47 -1
  60. package/artifacts/schema/org-quotas.schema.json +29 -1
  61. package/artifacts/schema/org-role-list-response.schema.json +8 -7
  62. package/artifacts/schema/org-role.schema.json +1 -1
  63. package/artifacts/schema/plan-catalogue-entry.schema.json +29 -1
  64. package/artifacts/schema/plan-change-decision-status-response.schema.json +29 -1
  65. package/artifacts/schema/plan-limit-details.schema.json +3 -1
  66. package/artifacts/schema/plan-limits.schema.json +29 -1
  67. package/artifacts/schema/plan-overrides.schema.json +26 -0
  68. package/artifacts/schema/put-collections-draft-request.schema.json +16 -0
  69. package/artifacts/schema/record-changed-details.schema.json +16 -0
  70. package/artifacts/schema/record-referenced-details.schema.json +35 -0
  71. package/artifacts/schema/reference-invalid-details.schema.json +25 -0
  72. package/artifacts/schema/reference-place.schema.json +7 -6
  73. package/artifacts/schema/required-missing-details.schema.json +19 -0
  74. package/artifacts/schema/robot-config-doc.schema.json +5 -5
  75. package/artifacts/schema/robot-deletion-summary.schema.json +33 -1
  76. package/artifacts/schema/role-collection-rights.schema.json +82 -0
  77. package/artifacts/schema/role-rename-preview.schema.json +7 -6
  78. package/dist/apps.d.ts +18 -2
  79. package/dist/apps.js +12 -2
  80. package/dist/audit.d.ts +32 -2
  81. package/dist/audit.js +40 -2
  82. package/dist/collections-issues.d.ts +67 -0
  83. package/dist/collections-issues.js +340 -0
  84. package/dist/collections-records.d.ts +562 -0
  85. package/dist/collections-records.js +525 -0
  86. package/dist/collections-rights.d.ts +17 -0
  87. package/dist/collections-rights.js +41 -0
  88. package/dist/collections-schema.d.ts +1064 -0
  89. package/dist/collections-schema.js +386 -0
  90. package/dist/collections-templates.d.ts +55 -0
  91. package/dist/collections-templates.js +137 -0
  92. package/dist/collections-transfer.d.ts +101 -0
  93. package/dist/collections-transfer.js +206 -0
  94. package/dist/collections-values.d.ts +67 -0
  95. package/dist/collections-values.js +284 -0
  96. package/dist/collections.d.ts +568 -0
  97. package/dist/collections.js +332 -0
  98. package/dist/config.d.ts +8 -8
  99. package/dist/config.js +13 -13
  100. package/dist/errors.d.ts +50 -1
  101. package/dist/errors.js +115 -0
  102. package/dist/index.d.ts +24 -8
  103. package/dist/index.js +13 -3
  104. package/dist/org-roles.d.ts +4 -0
  105. package/dist/org-roles.js +10 -9
  106. package/dist/plans.d.ts +19 -1
  107. package/dist/plans.js +21 -1
  108. package/dist/realtime.d.ts +166 -0
  109. package/dist/realtime.js +163 -0
  110. package/dist/rest.d.ts +28 -28
  111. package/dist/rest.js +39 -27
  112. package/dist/rights.d.ts +2 -2
  113. package/dist/rights.js +1 -1
  114. package/dist/routes.d.ts +1 -1
  115. package/dist/routes.js +495 -21
  116. package/package.json +1 -1
  117. package/artifacts/schema/put-robot-details-request.schema.json +0 -41
  118. package/artifacts/schema/put-robot-details-response.schema.json +0 -43
  119. package/artifacts/schema/robot-details-doc.schema.json +0 -33
@@ -0,0 +1,340 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ import { z } from 'zod';
3
+ import { COLLECTION_LIMITS, COLLECTION_RESERVED_KEYS, } from './collections.js';
4
+ import { COLLECTION_JSON_TEMPLATES, parseDisplayTemplate } from './collections-templates.js';
5
+ import { checkCollectionValue } from './collections-values.js';
6
+ /**
7
+ * Everything wrong with a collections document that only the whole document
8
+ * can tell: the questions a zod schema cannot ask because they compare one
9
+ * part with another (does the reference point at a collection? does the
10
+ * default fit?) or count (how many collections?).
11
+ *
12
+ * It lives in contracts, as a pure function, so the cloud that refuses a
13
+ * document, the console that shows its problems while someone types, and the
14
+ * tools that write documents give the same answer in the same words.
15
+ */
16
+ /** One finding about a document. */
17
+ export const collectionsIssue = z
18
+ .object({
19
+ path: z.string().min(1).meta({ description: 'Where in the document, with dots between the keys: `collections.chargers.fields.location.to`.' }),
20
+ code: z.string().meta({ description: 'A stable name for the kind of finding, for code to branch on.' }),
21
+ message: z.string().meta({ description: 'What is wrong, in a sentence for a person.' }),
22
+ severity: z.enum(['error', 'warning', 'info']).meta({
23
+ description: 'An error makes the document invalid and it cannot be saved or published. A warning and information leave it valid.',
24
+ }),
25
+ })
26
+ .meta({ description: 'One finding about a collections document.' });
27
+ /** The keys every record has, for display placeholders and references. */
28
+ const SYSTEM_KEYS = ['id', 'created_at', 'created_by', 'updated_at', 'updated_by', 'revision'];
29
+ const RESERVED_KEYS = COLLECTION_RESERVED_KEYS;
30
+ const ACTIONS = ['read', 'create', 'update', 'delete'];
31
+ const isRobotBound = (collection) => collection.binding !== 'global';
32
+ /** The most unresolved display placeholders listed for one collection; the last issue counts the rest. */
33
+ const MAX_UNRESOLVED_LISTED = 20;
34
+ /** A piece of the document for a message: a very long one is cut, so a message never repeats a megabyte back. */
35
+ const clip = (text) => (text.length > 80 ? `${text.slice(0, 80)}…` : text);
36
+ /** Does a record of `collection` have a field or system value called `key`? */
37
+ function hasKey(collection, key) {
38
+ return (Object.hasOwn(collection.fields, key) ||
39
+ SYSTEM_KEYS.includes(key) ||
40
+ (key === 'robot_id' && isRobotBound(collection)));
41
+ }
42
+ /**
43
+ * Why a pattern cannot be used, or `null`.
44
+ *
45
+ * Patterns are written in the RE2 subset, and the server matches values with
46
+ * an RE2 engine, whose running time does not depend on the pattern (see
47
+ * `matchPattern` in `checkCollectionValue`). This function reads a pattern with
48
+ * the JavaScript engine in unicode mode, which agrees with RE2 on everything an
49
+ * author normally writes, and refuses the constructs RE2 lacks so that a
50
+ * pattern means the same in both: lookahead, lookbehind and backreferences.
51
+ * Finding them means reading the pattern the way the engine does, because the
52
+ * same characters are plain text inside a character class or after a backslash.
53
+ *
54
+ * It does not make matching with the JavaScript engine safe: a pattern such as
55
+ * `(a+)+$` is valid RE2 and slow there.
56
+ */
57
+ function patternProblem(pattern) {
58
+ let inClass = false;
59
+ for (let i = 0; i < pattern.length; i += 1) {
60
+ const char = pattern[i];
61
+ if (char === '\\') {
62
+ const next = pattern[i + 1];
63
+ if (!inClass && next !== undefined) {
64
+ if (next >= '1' && next <= '9')
65
+ return 'The pattern uses a backreference, which is not supported.';
66
+ if (next === 'k' && pattern[i + 2] === '<')
67
+ return 'The pattern uses a named backreference, which is not supported.';
68
+ }
69
+ i += 1;
70
+ }
71
+ else if (inClass) {
72
+ if (char === ']')
73
+ inClass = false;
74
+ }
75
+ else if (char === '[') {
76
+ inClass = true;
77
+ }
78
+ else if (char === '(' && pattern[i + 1] === '?') {
79
+ const kind = pattern.slice(i + 2, i + 4);
80
+ if (kind.startsWith('=') || kind.startsWith('!'))
81
+ return 'The pattern uses lookahead, which is not supported.';
82
+ if (kind === '<=' || kind === '<!')
83
+ return 'The pattern uses lookbehind, which is not supported.';
84
+ }
85
+ }
86
+ try {
87
+ new RegExp(pattern, 'u');
88
+ }
89
+ catch (error) {
90
+ return `The pattern is not a valid regular expression: ${error instanceof Error ? error.message : String(error)}`;
91
+ }
92
+ return null;
93
+ }
94
+ /**
95
+ * Why the engine that will match a pattern cannot use it, or `null`. `patternProblem`
96
+ * reads a pattern with the JavaScript engine; the server matches with another,
97
+ * and a pattern one compiles can be refused by the other (RE2 caps a repeat
98
+ * count at 1,000, for one). Asking the matcher once, with an empty value, turns
99
+ * that refusal into a finding at publish and not into an error on every write.
100
+ */
101
+ function engineProblem(pattern, matchPattern) {
102
+ if (matchPattern === undefined)
103
+ return null;
104
+ try {
105
+ matchPattern(pattern, '');
106
+ return null;
107
+ }
108
+ catch (error) {
109
+ return `The pattern is not a valid regular expression for the engine that matches it: ${clip(error instanceof Error ? error.message : String(error))}`;
110
+ }
111
+ }
112
+ /** Does the role value name at least one role? */
113
+ function namesARole(value) {
114
+ return typeof value === 'string' ? value.length > 0 : value !== undefined && value.length > 0;
115
+ }
116
+ /**
117
+ * Finds every way a document is invalid, and the things worth knowing about a
118
+ * valid one.
119
+ *
120
+ * **Errors** make the document invalid: `too_many_collections`,
121
+ * `too_many_fields`, `reserved_key`, `unknown_reference_target`,
122
+ * `robot_reference_from_global`, `unknown_template`, `invalid_json_schema`,
123
+ * `invalid_pattern`, `display_template_invalid`,
124
+ * `display_placeholder_unresolved`, `duplicate_option`, `invalid_default`,
125
+ * `required_without_default` and `unique_not_allowed`.
126
+ *
127
+ * **Warnings** (`access_ignored`) and **information** (`no_role_has_access`)
128
+ * leave it valid. Nothing about stored data is judged here: a document is
129
+ * never invalid because of the records it would affect.
130
+ *
131
+ * Issues come in document order: each collection's fields, then its display,
132
+ * then its access. A field that is wrong in one way is not also reported for
133
+ * the knock-on effects of that (an unknown template does not also make its
134
+ * default invalid).
135
+ */
136
+ export function collectionsDocumentIssues(document, options = {}) {
137
+ const issues = [];
138
+ const add = (severity, path, code, message) => {
139
+ issues.push({ path, code, message, severity });
140
+ };
141
+ const collections = Object.entries(document.collections);
142
+ function checkField(collectionKey, collection, fieldKey, field) {
143
+ const path = `collections.${collectionKey}.fields.${fieldKey}`;
144
+ if (RESERVED_KEYS.includes(fieldKey)) {
145
+ add('error', path, 'reserved_key', `"${fieldKey}" is reserved for the record itself and cannot be the key of a field. Reserved keys: ${COLLECTION_RESERVED_KEYS.join(', ')}.`);
146
+ }
147
+ if (field.unique && (field.type === 'boolean' || field.type === 'json')) {
148
+ add('error', `${path}.unique`, 'unique_not_allowed', `A ${field.type} field cannot be unique.`);
149
+ }
150
+ // Set when the field is already reported for something that makes its
151
+ // default meaningless to judge.
152
+ let defaultCheckable = true;
153
+ // The field as the default is judged against: a pattern that cannot be used is reported once, as itself.
154
+ let judged = field;
155
+ switch (field.type) {
156
+ case 'text': {
157
+ if (field.pattern !== undefined) {
158
+ const why = patternProblem(field.pattern) ?? engineProblem(field.pattern, options.matchPattern);
159
+ if (why !== null) {
160
+ add('error', `${path}.pattern`, 'invalid_pattern', why);
161
+ const { pattern: _unusable, ...withoutPattern } = field;
162
+ judged = withoutPattern;
163
+ }
164
+ }
165
+ break;
166
+ }
167
+ case 'select': {
168
+ const seen = new Set();
169
+ field.options.forEach((option, index) => {
170
+ if (seen.has(option.value)) {
171
+ add('error', `${path}.options.${index}.value`, 'duplicate_option', `The option value "${option.value}" is used more than once.`);
172
+ }
173
+ seen.add(option.value);
174
+ });
175
+ break;
176
+ }
177
+ case 'json': {
178
+ if (typeof field.schema === 'string') {
179
+ if (!Object.hasOwn(COLLECTION_JSON_TEMPLATES, field.schema)) {
180
+ defaultCheckable = false;
181
+ add('error', `${path}.schema`, 'unknown_template', `"${field.schema}" is not a JSON template. The templates are ${Object.keys(COLLECTION_JSON_TEMPLATES).join(', ')}; or write an inline JSON Schema.`);
182
+ }
183
+ }
184
+ else if (field.schema !== undefined && options.validateJsonSchema !== undefined) {
185
+ const why = options.validateJsonSchema(field.schema);
186
+ if (why !== null) {
187
+ defaultCheckable = false;
188
+ add('error', `${path}.schema`, 'invalid_json_schema', `The schema is not a valid JSON Schema: ${why}`);
189
+ }
190
+ }
191
+ break;
192
+ }
193
+ case 'reference': {
194
+ const hasTarget = Object.hasOwn(document.collections, field.to);
195
+ if (!hasTarget) {
196
+ add('error', `${path}.to`, 'unknown_reference_target', `"${field.to}" is not a collection of this document.`);
197
+ }
198
+ else if (!isRobotBound(collection) && isRobotBound(document.collections[field.to])) {
199
+ add('error', `${path}.to`, 'robot_reference_from_global', `A global collection cannot point at "${field.to}", which holds records of robots. Make ${collectionKey} per_robot, or point at a global collection.`);
200
+ }
201
+ break;
202
+ }
203
+ default:
204
+ break;
205
+ }
206
+ if (field.default !== undefined && defaultCheckable) {
207
+ const found = checkCollectionValue(judged, field.default, {
208
+ validateJsonValue: options.validateJsonValue,
209
+ matchPattern: options.matchPattern,
210
+ });
211
+ if (found !== null) {
212
+ add('error', `${path}.default`, 'invalid_default', `The default is not a valid value for this ${field.type} field: ${found.message}`);
213
+ }
214
+ }
215
+ if (collection.binding === 'one_per_robot' && field.required === true && field.default === undefined) {
216
+ add('error', `${path}.required`, 'required_without_default', `${fieldKey} is required, but Fleetless creates the records of a one_per_robot collection itself and cannot fill it. Give it a default or make it optional.`);
217
+ }
218
+ }
219
+ function checkDisplay(collectionKey, collection) {
220
+ if (collection.display === undefined)
221
+ return;
222
+ const path = `collections.${collectionKey}.display`;
223
+ const parsed = parseDisplayTemplate(collection.display);
224
+ if (!parsed.ok) {
225
+ add('error', path, 'display_template_invalid', parsed.message);
226
+ return;
227
+ }
228
+ // A placeholder used again is the same problem again: say it once for each collection.
229
+ // And a template full of different wrong ones is one problem told at length: the first
230
+ // few are listed and the last says how many more there are.
231
+ const reported = new Set();
232
+ let more = 0;
233
+ for (const placeholder of parsed.placeholders) {
234
+ if (!resolves(collection, placeholder.path)) {
235
+ const name = placeholder.path.join('.');
236
+ if (reported.has(name))
237
+ continue;
238
+ reported.add(name);
239
+ if (reported.size > MAX_UNRESOLVED_LISTED) {
240
+ more += 1;
241
+ continue;
242
+ }
243
+ const hint = placeholder.path[0] === 'robot'
244
+ ? ' robot.name is only available on collections of robots (per_robot and one_per_robot).'
245
+ : '';
246
+ add('error', path, 'display_placeholder_unresolved', `${clip(placeholder.raw)} does not name a field of this collection, a system field or a field reached through a reference.${hint}`);
247
+ }
248
+ }
249
+ if (more > 0) {
250
+ const last = issues[issues.length - 1];
251
+ last.message += ` ${more} more ${more === 1 ? 'placeholder does' : 'placeholders do'} not resolve either.`;
252
+ }
253
+ }
254
+ /** Can `path` (one or two keys of a display placeholder) be looked up on a record of `collection`? */
255
+ function resolves(collection, path) {
256
+ const [head, tail] = path;
257
+ if (tail === undefined)
258
+ return hasKey(collection, head);
259
+ if (head === 'robot')
260
+ return tail === 'name' && isRobotBound(collection);
261
+ const reference = Object.hasOwn(collection.fields, head) ? collection.fields[head] : undefined;
262
+ if (reference === undefined || reference.type !== 'reference')
263
+ return false;
264
+ // A missing target is already an error of its own; reporting the placeholder as well would say it twice.
265
+ if (!Object.hasOwn(document.collections, reference.to))
266
+ return true;
267
+ return hasKey(document.collections[reference.to], tail);
268
+ }
269
+ function checkAccess(collectionKey, collection) {
270
+ const access = collection.access;
271
+ const base = `collections.${collectionKey}.access`;
272
+ if (collection.binding === 'one_per_robot' && access !== undefined) {
273
+ for (const action of ['create', 'delete']) {
274
+ if (access[action] !== undefined) {
275
+ add('warning', `${base}.${action}`, 'access_ignored', `Records of a one_per_robot collection are never ${action === 'create' ? 'created' : 'deleted'} through the API, so access.${action} grants nothing.`);
276
+ }
277
+ }
278
+ }
279
+ if (!namesARole(access?.read)) {
280
+ add('info', `${base}.read`, 'no_role_has_access', `No role can read ${collectionKey}. Only developers and server keys reach its records.`);
281
+ }
282
+ }
283
+ if (collections.length > COLLECTION_LIMITS.collections) {
284
+ add('error', 'collections', 'too_many_collections', `A document holds at most ${COLLECTION_LIMITS.collections} collections; this one has ${collections.length}.`);
285
+ }
286
+ for (const [collectionKey, collection] of collections) {
287
+ const base = `collections.${collectionKey}`;
288
+ const fields = Object.entries(collection.fields);
289
+ if (fields.length > COLLECTION_LIMITS.fields) {
290
+ add('error', `${base}.fields`, 'too_many_fields', `A collection holds at most ${COLLECTION_LIMITS.fields} fields; ${collectionKey} has ${fields.length}.`);
291
+ }
292
+ for (const [fieldKey, field] of fields) {
293
+ checkField(collectionKey, collection, fieldKey, field);
294
+ }
295
+ checkDisplay(collectionKey, collection);
296
+ checkAccess(collectionKey, collection);
297
+ }
298
+ return issues;
299
+ }
300
+ /**
301
+ * The role keys in an access value, in the order they are written.
302
+ * `{ all, own }` is flattened, so a role named in both is one role.
303
+ */
304
+ function rolesIn(value) {
305
+ if (typeof value === 'string')
306
+ return [value];
307
+ if (Array.isArray(value))
308
+ return value.filter((role) => typeof role === 'string');
309
+ if (value !== null && typeof value === 'object') {
310
+ const { all, own } = value;
311
+ return [...rolesIn(all), ...rolesIn(own)];
312
+ }
313
+ return [];
314
+ }
315
+ /**
316
+ * One warning for each role key in `access` that the organization does not
317
+ * have, per collection and action. The document stays valid: renaming or
318
+ * deleting a role never makes a published document fail, and a key that names
319
+ * no role grants nothing. `roleKeys` is the set of the organization's role
320
+ * keys.
321
+ */
322
+ export function collectionsAccessWarnings(document, roleKeys) {
323
+ const warnings = [];
324
+ for (const [collectionKey, collection] of Object.entries(document.collections)) {
325
+ if (collection.access === undefined)
326
+ continue;
327
+ for (const action of ACTIONS) {
328
+ const unknown = new Set(rolesIn(collection.access[action]).filter((role) => !roleKeys.has(role)));
329
+ for (const role of unknown) {
330
+ warnings.push({
331
+ path: `collections.${collectionKey}.access.${action}`,
332
+ code: 'unknown_role',
333
+ message: `The role "${role}" is not a role of the organization, so it grants nothing.`,
334
+ severity: 'warning',
335
+ });
336
+ }
337
+ }
338
+ }
339
+ return warnings;
340
+ }