@evergis/react 4.0.166 → 4.0.168
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/components/Dashboard/actions/components/TaskExecutionHost/index.d.ts +2 -0
- package/dist/components/Dashboard/actions/conditions/constants.d.ts +4 -0
- package/dist/components/Dashboard/actions/conditions/evaluateActionCondition.d.ts +6 -0
- package/dist/components/Dashboard/actions/conditions/operators.d.ts +4 -0
- package/dist/components/Dashboard/actions/conditions/parseActionCondition.d.ts +6 -0
- package/dist/components/Dashboard/actions/conditions/tokenizeActionCondition.d.ts +2 -0
- package/dist/components/Dashboard/actions/conditions/types.d.ts +43 -0
- package/dist/components/Dashboard/actions/constants.d.ts +4 -0
- package/dist/components/Dashboard/actions/context/ActionContextProvider.d.ts +8 -0
- package/dist/components/Dashboard/actions/context/ActionNodeProvider.d.ts +3 -0
- package/dist/components/Dashboard/actions/context/ActionScopeProvider.d.ts +5 -0
- package/dist/components/Dashboard/actions/context/WidgetActionsProvider/hooks/useActionExecutors.d.ts +3 -0
- package/dist/components/Dashboard/actions/context/WidgetActionsProvider/hooks/useActionFilters.d.ts +6 -0
- package/dist/components/Dashboard/actions/context/WidgetActionsProvider/index.d.ts +2 -0
- package/dist/components/Dashboard/actions/context/WidgetActionsProvider/types.d.ts +14 -0
- package/dist/components/Dashboard/actions/context/bindingTypes.d.ts +46 -0
- package/dist/components/Dashboard/actions/executors/ActionNavigationError.d.ts +4 -0
- package/dist/components/Dashboard/actions/executors/createActionNavigation.d.ts +5 -0
- package/dist/components/Dashboard/actions/executors/needsNavigationWindow.d.ts +2 -0
- package/dist/components/Dashboard/actions/hooks/useActionBindings.d.ts +2 -0
- package/dist/components/Dashboard/actions/hooks/useChartActions.d.ts +10 -0
- package/dist/components/Dashboard/actions/index.d.ts +20 -0
- package/dist/components/Dashboard/actions/modals/WidgetModalHost/ModalWindow.d.ts +2 -0
- package/dist/components/Dashboard/actions/modals/WidgetModalHost/index.d.ts +2 -0
- package/dist/components/Dashboard/actions/modals/WidgetModalHost/types.d.ts +6 -0
- package/dist/components/Dashboard/actions/modals/WidgetModalsProvider/index.d.ts +2 -0
- package/dist/components/Dashboard/actions/modals/hooks/useAvailableModals.d.ts +2 -0
- package/dist/components/Dashboard/actions/modals/hooks/useModalAutoSync.d.ts +2 -0
- package/dist/components/Dashboard/actions/modals/hooks/useModalSources.d.ts +8 -0
- package/dist/components/Dashboard/actions/modals/hooks/useWidgetModals.d.ts +2 -0
- package/dist/components/Dashboard/actions/modals/types.d.ts +26 -0
- package/dist/components/Dashboard/actions/modals/utils/createModalStore.d.ts +16 -0
- package/dist/components/Dashboard/actions/modals/utils/modalRequestKey.d.ts +4 -0
- package/dist/components/Dashboard/actions/parameters/resolveActionParameters.d.ts +3 -0
- package/dist/components/Dashboard/actions/registry/mergeActionParameters.d.ts +1 -0
- package/dist/components/Dashboard/actions/registry/resolveActionInvocation.d.ts +2 -0
- package/dist/components/Dashboard/actions/runtime/awaitActionStep.d.ts +2 -0
- package/dist/components/Dashboard/actions/runtime/createActionRuntime.d.ts +3 -0
- package/dist/components/Dashboard/actions/runtime/executeActionSequence.d.ts +3 -0
- package/dist/components/Dashboard/actions/runtime/types.d.ts +36 -0
- package/dist/components/Dashboard/actions/types.d.ts +81 -0
- package/dist/components/Dashboard/actions/validation/actionShape.d.ts +2 -0
- package/dist/components/Dashboard/actions/validation/isActionSelectedFilter.d.ts +1 -0
- package/dist/components/Dashboard/actions/validation/types.d.ts +15 -0
- package/dist/components/Dashboard/actions/validation/validateActionTree.d.ts +5 -0
- package/dist/components/Dashboard/actions/validation/validateDashboardActions.d.ts +3 -0
- package/dist/components/Dashboard/componentTypes.d.ts +27 -9
- package/dist/components/Dashboard/components/Chart/components/BarChartView.d.ts +2 -0
- package/dist/components/Dashboard/components/Chart/components/LineChartView.d.ts +2 -0
- package/dist/components/Dashboard/components/Chart/components/PieChartView.d.ts +2 -0
- package/dist/components/Dashboard/components/Chart/components/StackChartView.d.ts +2 -0
- package/dist/components/Dashboard/components/Chart/constants.d.ts +2 -0
- package/dist/components/Dashboard/components/Chart/hooks/index.d.ts +2 -0
- package/dist/components/Dashboard/components/Chart/hooks/useChartLayout.d.ts +71 -0
- package/dist/components/Dashboard/components/Chart/hooks/useChartPresentation.d.ts +30 -0
- package/dist/components/Dashboard/components/Chart/types.d.ts +6 -1
- package/dist/components/Dashboard/components/ContainerButton/index.d.ts +4 -0
- package/dist/components/Dashboard/components/StackBar/index.d.ts +2 -1
- package/dist/components/Dashboard/components/SvgImage/index.d.ts +2 -2
- package/dist/components/Dashboard/constants.d.ts +2 -19
- package/dist/components/Dashboard/containers/DataSourceInnerContainer/styled.d.ts +0 -1
- package/dist/components/Dashboard/containers/StructuredDataContainer/types.d.ts +3 -1
- package/dist/components/Dashboard/containers/TaskContainer/components/LogDialog/types.d.ts +1 -0
- package/dist/components/Dashboard/containers/TaskContainer/components/TaskLogButton.d.ts +5 -0
- package/dist/components/Dashboard/containers/TaskContainer/hooks/useTaskButtonState.d.ts +1 -1
- package/dist/components/Dashboard/containers/VoteContainer/components/VoteScreen.d.ts +2 -2
- package/dist/components/Dashboard/containers/VoteContainer/types.d.ts +10 -3
- package/dist/components/Dashboard/containers/styled.d.ts +1 -1
- package/dist/components/Dashboard/elements/ElementIcon/components/AttachmentIcon/types.d.ts +2 -2
- package/dist/components/Dashboard/elements/ElementImage/useElementImage.d.ts +3 -2
- package/dist/components/Dashboard/elements/ElementModal/hooks/useModalOpen.d.ts +2 -7
- package/dist/components/Dashboard/elements/ElementSvg/index.d.ts +0 -1
- package/dist/components/Dashboard/elements/ElementTable/components/ActionTableRow.d.ts +6 -0
- package/dist/components/Dashboard/elements/registry.d.ts +1 -1
- package/dist/components/Dashboard/hooks/dataSourceTypes.d.ts +15 -0
- package/dist/components/Dashboard/hooks/useDataSourceRequests.d.ts +4 -0
- package/dist/components/Dashboard/hooks/useDataSources.d.ts +6 -13
- package/dist/components/Dashboard/hooks/useWidgetContext.d.ts +7 -1
- package/dist/components/Dashboard/index.d.ts +1 -0
- package/dist/components/Dashboard/types.d.ts +18 -6
- package/dist/components/Dashboard/utils/applyQueryFilters.d.ts +5 -4
- package/dist/components/Dashboard/utils/checkEqualOrIncludes.d.ts +1 -1
- package/dist/components/Dashboard/utils/configString/constants.d.ts +19 -0
- package/dist/components/Dashboard/utils/configString/resolveActionToken.d.ts +3 -0
- package/dist/components/Dashboard/utils/configString/types.d.ts +10 -1
- package/dist/components/Dashboard/utils/findDashboardNode.d.ts +3 -0
- package/dist/components/Dashboard/utils/formatDataSourceCondition.d.ts +2 -1
- package/dist/components/Dashboard/utils/getButtonSlot.d.ts +4 -0
- package/dist/components/Dashboard/utils/getDataFromAttributes.d.ts +2 -2
- package/dist/components/Dashboard/utils/getSelectedFilterValue.d.ts +1 -1
- package/dist/components/Dashboard/utils/getUpdatedDataSources.d.ts +2 -0
- package/dist/components/Dashboard/utils/index.d.ts +1 -0
- package/dist/contexts/ActionContext/index.d.ts +3 -0
- package/dist/contexts/ActionNodeContext/index.d.ts +2 -0
- package/dist/contexts/ActionScopeContext/index.d.ts +3 -0
- package/dist/contexts/ChartActionsContext/index.d.ts +2 -0
- package/dist/contexts/DashboardContext/types.d.ts +15 -6
- package/dist/contexts/FeatureCardContext/types.d.ts +14 -1
- package/dist/{components/Dashboard/grid → contexts}/GridEditContext/index.d.ts +1 -1
- package/dist/contexts/ModalDataContext/index.d.ts +2 -0
- package/dist/{components/Dashboard/containers/StructuredDataContainer/StructuredDataContext.d.ts → contexts/StructuredDataContext/index.d.ts} +1 -1
- package/dist/contexts/TaskExecutionContext/TaskExecutionProvider.d.ts +2 -0
- package/dist/contexts/TaskExecutionContext/context.d.ts +2 -0
- package/dist/contexts/TaskExecutionContext/hooks/useTaskExecution.d.ts +17 -0
- package/dist/contexts/TaskExecutionContext/index.d.ts +4 -0
- package/dist/contexts/TaskExecutionContext/types.d.ts +14 -0
- package/dist/contexts/TaskExecutionContext/utils/createTaskNotification.d.ts +4 -0
- package/dist/contexts/WidgetActionsContext/index.d.ts +4 -0
- package/dist/contexts/WidgetModalsContext/index.d.ts +3 -0
- package/dist/contexts/index.d.ts +12 -0
- package/dist/dashboardActions/index.js +577 -0
- package/dist/dashboardActions/index.js.map +1 -0
- package/dist/dashboardActions/package.json +1 -0
- package/dist/dashboardActions.d.ts +3 -0
- package/dist/hooks/task/index.d.ts +2 -0
- package/dist/hooks/task/runtime/PythonExecutionError.d.ts +9 -0
- package/dist/hooks/task/runtime/constants.d.ts +2 -0
- package/dist/hooks/task/runtime/resolvePythonTaskDefinition.d.ts +2 -0
- package/dist/hooks/task/runtime/startPythonExecution.d.ts +2 -0
- package/dist/hooks/task/runtime/types.d.ts +53 -0
- package/dist/hooks/task/types.d.ts +7 -1
- package/dist/hooks/task/usePythonTask.d.ts +12 -14
- package/dist/hooks/task/utils/pollSubtaskCompletion.d.ts +4 -1
- package/dist/hooks/task/utils/startRemoteTask.d.ts +2 -0
- package/dist/index.js +15164 -13214
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +14860 -12954
- package/dist/react.esm.js.map +1 -1
- package/dist/taskParameters/index.js +329 -0
- package/dist/taskParameters/index.js.map +1 -0
- package/dist/taskParameters/package.json +1 -0
- package/dist/taskParameters.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/isObject.d.ts +1 -1
- package/dist/utils/taskParameters/SchemaResolver.d.ts +14 -0
- package/dist/utils/taskParameters/buildDefaultForSchema.d.ts +23 -0
- package/dist/utils/taskParameters/getPrimaryType.d.ts +2 -0
- package/dist/utils/taskParameters/index.d.ts +6 -0
- package/dist/utils/taskParameters/mergeHiddenFieldDefaults.d.ts +2 -0
- package/dist/utils/taskParameters/orderPropertyKeys.d.ts +2 -0
- package/dist/utils/taskParameters/types.d.ts +36 -0
- package/package.json +2 -2
- package/dist/components/Dashboard/containers/TaskContainer/useTaskNotifications.d.ts +0 -12
- /package/dist/{components/Dashboard/components/Chart/ChartPlotContext.d.ts → contexts/ChartPlotContext/index.d.ts} +0 -0
- /package/dist/{components/Dashboard/components/Chart/FillContext.d.ts → contexts/FillContext/index.d.ts} +0 -0
- /package/dist/{components/Dashboard/containers/TaskContainer → contexts/TaskExecutionContext}/utils/clampDescription.d.ts +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const compareByOrder = (left, right) => {
|
|
4
|
+
const leftOrder = left?.["x-order"];
|
|
5
|
+
const rightOrder = right?.["x-order"];
|
|
6
|
+
if (leftOrder !== undefined && rightOrder !== undefined) {
|
|
7
|
+
return leftOrder - rightOrder;
|
|
8
|
+
}
|
|
9
|
+
if (leftOrder !== undefined) {
|
|
10
|
+
return -1;
|
|
11
|
+
}
|
|
12
|
+
if (rightOrder !== undefined) {
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
return 0;
|
|
16
|
+
};
|
|
17
|
+
const orderPropertyKeys = (schema) => {
|
|
18
|
+
const keys = Object.keys(schema.properties ?? {});
|
|
19
|
+
const required = schema.required ?? [];
|
|
20
|
+
const properties = schema.properties ?? {};
|
|
21
|
+
const hasExplicitOrder = keys.some(key => properties[key]?.["x-order"] !== undefined);
|
|
22
|
+
if (hasExplicitOrder) {
|
|
23
|
+
return [...keys].sort((leftKey, rightKey) => compareByOrder(properties[leftKey], properties[rightKey]));
|
|
24
|
+
}
|
|
25
|
+
const requiredSet = new Set(required);
|
|
26
|
+
const requiredOrdered = required.filter(key => keys.includes(key));
|
|
27
|
+
const rest = keys.filter(key => !requiredSet.has(key));
|
|
28
|
+
return [...requiredOrdered, ...rest];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getPrimaryType = (schema) => {
|
|
32
|
+
if (!schema?.type) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(schema.type)) {
|
|
36
|
+
return schema.type.find(typeName => typeName !== "null") ?? schema.type[0];
|
|
37
|
+
}
|
|
38
|
+
return schema.type;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const FORM_DEFAULT_OPTIONS = {
|
|
42
|
+
stringDefault: undefined,
|
|
43
|
+
objectDepth: "recursive",
|
|
44
|
+
propertyKeys: "default",
|
|
45
|
+
emptyObject: "undefined",
|
|
46
|
+
ignoreSchemaDefault: false,
|
|
47
|
+
};
|
|
48
|
+
const ARRAY_ITEM_OBJECT_OPTIONS = {
|
|
49
|
+
stringDefault: "",
|
|
50
|
+
objectDepth: "shallow",
|
|
51
|
+
propertyKeys: "ordered",
|
|
52
|
+
emptyObject: "empty",
|
|
53
|
+
ignoreSchemaDefault: true,
|
|
54
|
+
};
|
|
55
|
+
const getPropertyKeys = (resolved, propertyKeys) => {
|
|
56
|
+
if (propertyKeys === "ordered") {
|
|
57
|
+
return orderPropertyKeys(resolved);
|
|
58
|
+
}
|
|
59
|
+
return Object.keys(resolved.properties ?? {});
|
|
60
|
+
};
|
|
61
|
+
const buildShallowChildDefault = (resolver, childSchema, options) => {
|
|
62
|
+
const childResolved = resolver.resolve(childSchema) ?? childSchema;
|
|
63
|
+
if (childResolved.default !== undefined) {
|
|
64
|
+
return childResolved.default;
|
|
65
|
+
}
|
|
66
|
+
const primaryType = getPrimaryType(childResolved);
|
|
67
|
+
if (primaryType === "boolean") {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (primaryType === "string" && options.stringDefault !== undefined) {
|
|
71
|
+
return options.stringDefault;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
};
|
|
75
|
+
const buildDefault = (resolver, schema, options, ignoreSchemaDefault) => {
|
|
76
|
+
const resolved = resolver.resolve(schema);
|
|
77
|
+
if (!resolved) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
if (!ignoreSchemaDefault && resolved.default !== undefined) {
|
|
81
|
+
return resolved.default;
|
|
82
|
+
}
|
|
83
|
+
const primaryType = getPrimaryType(resolved);
|
|
84
|
+
if (primaryType === "object" && resolved.properties) {
|
|
85
|
+
const result = {};
|
|
86
|
+
const keys = getPropertyKeys(resolved, options.propertyKeys);
|
|
87
|
+
for (const key of keys) {
|
|
88
|
+
const childSchema = resolved.properties[key];
|
|
89
|
+
const childDefault = options.objectDepth === "shallow"
|
|
90
|
+
? buildShallowChildDefault(resolver, childSchema, options)
|
|
91
|
+
: buildDefault(resolver, childSchema, options, false);
|
|
92
|
+
if (childDefault !== undefined) {
|
|
93
|
+
result[key] = childDefault;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (Object.keys(result).length === 0) {
|
|
97
|
+
return options.emptyObject === "empty" ? {} : undefined;
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
if (primaryType === "array" && options.objectDepth === "recursive") {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
if (primaryType === "boolean") {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (primaryType === "integer" || primaryType === "number") {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
if (primaryType === "string" && options.stringDefault !== undefined) {
|
|
111
|
+
return options.stringDefault;
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
};
|
|
115
|
+
const buildDefaultForSchema = (resolver, schema, options) => {
|
|
116
|
+
const mergedOptions = {
|
|
117
|
+
...FORM_DEFAULT_OPTIONS,
|
|
118
|
+
...options,
|
|
119
|
+
};
|
|
120
|
+
return buildDefault(resolver, schema, mergedOptions, mergedOptions.ignoreSchemaDefault);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const getHiddenDefaultValue = (resolver, propertySchema) => {
|
|
124
|
+
const resolved = resolver.resolve(propertySchema) ?? propertySchema;
|
|
125
|
+
if (resolved.default !== undefined) {
|
|
126
|
+
return resolved.default;
|
|
127
|
+
}
|
|
128
|
+
return undefined;
|
|
129
|
+
};
|
|
130
|
+
const mergeHiddenFieldsAtLevel = (resolver, schema, data) => {
|
|
131
|
+
const resolved = resolver.resolve(schema) ?? schema;
|
|
132
|
+
const properties = resolved.properties ?? {};
|
|
133
|
+
if (Object.keys(properties).length === 0) {
|
|
134
|
+
return data;
|
|
135
|
+
}
|
|
136
|
+
let result = { ...data };
|
|
137
|
+
for (const [propertyKey, propertySchema] of Object.entries(properties)) {
|
|
138
|
+
const propertyResolved = resolver.resolve(propertySchema) ?? propertySchema;
|
|
139
|
+
if (propertyResolved["x-hide"]) {
|
|
140
|
+
if (result[propertyKey] !== undefined) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const hiddenDefault = getHiddenDefaultValue(resolver, propertySchema);
|
|
144
|
+
if (hiddenDefault !== undefined) {
|
|
145
|
+
result = { ...result, [propertyKey]: hiddenDefault };
|
|
146
|
+
}
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const primaryType = getPrimaryType(propertyResolved);
|
|
150
|
+
if (primaryType === "object" && propertyResolved.properties) {
|
|
151
|
+
const nestedData = result[propertyKey] !== null && typeof result[propertyKey] === "object" && !Array.isArray(result[propertyKey])
|
|
152
|
+
? result[propertyKey]
|
|
153
|
+
: {};
|
|
154
|
+
const mergedNested = mergeHiddenFieldsAtLevel(resolver, propertySchema, nestedData);
|
|
155
|
+
if (mergedNested !== nestedData) {
|
|
156
|
+
result = { ...result, [propertyKey]: mergedNested };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
};
|
|
162
|
+
const mergeHiddenFieldDefaults = (resolver, formData) => {
|
|
163
|
+
return mergeHiddenFieldsAtLevel(resolver, resolver.rootSchema, formData);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const EVERGIS_TYPE_ATTRIBUTE = "Attribute";
|
|
167
|
+
const scopeToKeys = (scope) => {
|
|
168
|
+
if (!scope.startsWith("#/")) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
return scope
|
|
172
|
+
.slice(2)
|
|
173
|
+
.split("/")
|
|
174
|
+
.filter(segment => segment !== "properties");
|
|
175
|
+
};
|
|
176
|
+
const isAttributeStringSchema = (schema) => getPrimaryType(schema) === "string" && schema["x-evergis-type"] === EVERGIS_TYPE_ATTRIBUTE;
|
|
177
|
+
class SchemaResolver {
|
|
178
|
+
root;
|
|
179
|
+
constructor(rootSchema) {
|
|
180
|
+
this.root = rootSchema;
|
|
181
|
+
}
|
|
182
|
+
get rootSchema() {
|
|
183
|
+
return this.root;
|
|
184
|
+
}
|
|
185
|
+
resolve(schema) {
|
|
186
|
+
if (!schema) {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
if (schema.$ref) {
|
|
190
|
+
return this.resolve(this.resolveRef(schema.$ref));
|
|
191
|
+
}
|
|
192
|
+
if (schema.allOf?.length) {
|
|
193
|
+
return this.mergeAllOf(schema.allOf);
|
|
194
|
+
}
|
|
195
|
+
if (schema.oneOf?.length) {
|
|
196
|
+
return this.resolve(schema.oneOf[0]);
|
|
197
|
+
}
|
|
198
|
+
if (schema.anyOf?.length) {
|
|
199
|
+
return this.resolve(schema.anyOf[0]);
|
|
200
|
+
}
|
|
201
|
+
return schema;
|
|
202
|
+
}
|
|
203
|
+
oneOfBranches(schema) {
|
|
204
|
+
if (!schema) {
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
if (schema.$ref) {
|
|
208
|
+
return this.oneOfBranches(this.resolveRef(schema.$ref));
|
|
209
|
+
}
|
|
210
|
+
if (schema.allOf?.length) {
|
|
211
|
+
return [this.mergeAllOf(schema.allOf)];
|
|
212
|
+
}
|
|
213
|
+
if (schema.oneOf?.length) {
|
|
214
|
+
return schema.oneOf.map(branch => this.resolve(branch)).filter(Boolean);
|
|
215
|
+
}
|
|
216
|
+
if (schema.anyOf?.length) {
|
|
217
|
+
return schema.anyOf.map(branch => this.resolve(branch)).filter(Boolean);
|
|
218
|
+
}
|
|
219
|
+
return [schema];
|
|
220
|
+
}
|
|
221
|
+
schemaAtScope(scope) {
|
|
222
|
+
const keys = scopeToKeys(scope);
|
|
223
|
+
let current = this.resolve(this.root);
|
|
224
|
+
for (const key of keys) {
|
|
225
|
+
if (!current) {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
const resolved = this.resolve(current);
|
|
229
|
+
const properties = resolved?.properties;
|
|
230
|
+
if (!properties?.[key]) {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
current = properties[key];
|
|
234
|
+
}
|
|
235
|
+
return this.resolve(current);
|
|
236
|
+
}
|
|
237
|
+
isScopeRequired(scope) {
|
|
238
|
+
const keys = scopeToKeys(scope);
|
|
239
|
+
if (keys.length === 0) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
let current = this.resolve(this.root);
|
|
243
|
+
for (let index = 0; index < keys.length; index += 1) {
|
|
244
|
+
const key = keys[index];
|
|
245
|
+
const resolved = this.resolve(current);
|
|
246
|
+
const required = resolved?.required ?? [];
|
|
247
|
+
if (index === keys.length - 1) {
|
|
248
|
+
return required.includes(key);
|
|
249
|
+
}
|
|
250
|
+
current = resolved?.properties?.[key];
|
|
251
|
+
}
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
arrayItemSchema(itemsSchema) {
|
|
255
|
+
if (!itemsSchema) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
const branches = this.oneOfBranches(itemsSchema);
|
|
259
|
+
if (branches.length === 1) {
|
|
260
|
+
return this.resolve(branches[0]);
|
|
261
|
+
}
|
|
262
|
+
return this.resolve(itemsSchema);
|
|
263
|
+
}
|
|
264
|
+
arrayItemKind(arraySchema) {
|
|
265
|
+
const resolvedArray = this.resolve(arraySchema) ?? arraySchema;
|
|
266
|
+
const itemSchema = this.arrayItemSchema(resolvedArray.items);
|
|
267
|
+
if (!itemSchema) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const itemResolved = this.resolve(itemSchema) ?? itemSchema;
|
|
271
|
+
const branches = this.oneOfBranches(resolvedArray.items ?? itemSchema);
|
|
272
|
+
if (branches.length === 1 && isAttributeStringSchema(branches[0])) {
|
|
273
|
+
return { kind: "attribute", itemSchema: branches[0] };
|
|
274
|
+
}
|
|
275
|
+
if (isAttributeStringSchema(itemResolved)) {
|
|
276
|
+
return { kind: "attribute", itemSchema: itemResolved };
|
|
277
|
+
}
|
|
278
|
+
const primaryType = getPrimaryType(itemResolved);
|
|
279
|
+
if (primaryType === "string") {
|
|
280
|
+
return { kind: "string", itemSchema: itemResolved };
|
|
281
|
+
}
|
|
282
|
+
if (primaryType === "object" && itemResolved.properties) {
|
|
283
|
+
return { kind: "composite", itemSchema: itemResolved };
|
|
284
|
+
}
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
resolveRef(ref) {
|
|
288
|
+
if (!ref.startsWith("#/")) {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
const segments = ref.slice(2).split("/");
|
|
292
|
+
let current = this.root;
|
|
293
|
+
for (const segment of segments) {
|
|
294
|
+
if (!current) {
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
current = current[segment];
|
|
298
|
+
}
|
|
299
|
+
return current;
|
|
300
|
+
}
|
|
301
|
+
mergeAllOf(schemas) {
|
|
302
|
+
const merged = { type: "object", properties: {} };
|
|
303
|
+
for (const part of schemas) {
|
|
304
|
+
const resolved = this.resolve(part);
|
|
305
|
+
if (resolved?.properties) {
|
|
306
|
+
merged.properties = { ...merged.properties, ...resolved.properties };
|
|
307
|
+
}
|
|
308
|
+
if (resolved?.type && !merged.type) {
|
|
309
|
+
merged.type = resolved.type;
|
|
310
|
+
}
|
|
311
|
+
if (resolved?.description && !merged.description) {
|
|
312
|
+
merged.description = resolved.description;
|
|
313
|
+
}
|
|
314
|
+
if (resolved?.["x-evergis-type"] && !merged["x-evergis-type"]) {
|
|
315
|
+
merged["x-evergis-type"] = resolved["x-evergis-type"];
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return merged;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
exports.ARRAY_ITEM_OBJECT_OPTIONS = ARRAY_ITEM_OBJECT_OPTIONS;
|
|
323
|
+
exports.FORM_DEFAULT_OPTIONS = FORM_DEFAULT_OPTIONS;
|
|
324
|
+
exports.SchemaResolver = SchemaResolver;
|
|
325
|
+
exports.buildDefaultForSchema = buildDefaultForSchema;
|
|
326
|
+
exports.getPrimaryType = getPrimaryType;
|
|
327
|
+
exports.mergeHiddenFieldDefaults = mergeHiddenFieldDefaults;
|
|
328
|
+
exports.orderPropertyKeys = orderPropertyKeys;
|
|
329
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs","main":"index.js","types":"../taskParameters.d.ts"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/isObject.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isObject<T>(value: T | object): value is object
|
|
1
|
+
export declare function isObject<T>(value: T | object): value is T & object & Record<string, unknown>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ArrayItemDetection, JsonSchemaNode } from './types';
|
|
2
|
+
export declare class SchemaResolver {
|
|
3
|
+
private readonly root;
|
|
4
|
+
constructor(rootSchema: JsonSchemaNode);
|
|
5
|
+
get rootSchema(): JsonSchemaNode;
|
|
6
|
+
resolve(schema?: JsonSchemaNode): JsonSchemaNode | undefined;
|
|
7
|
+
oneOfBranches(schema?: JsonSchemaNode): JsonSchemaNode[];
|
|
8
|
+
schemaAtScope(scope: string): JsonSchemaNode | undefined;
|
|
9
|
+
isScopeRequired(scope: string): boolean;
|
|
10
|
+
arrayItemSchema(itemsSchema?: JsonSchemaNode): JsonSchemaNode | undefined;
|
|
11
|
+
arrayItemKind(arraySchema: JsonSchemaNode): ArrayItemDetection | null;
|
|
12
|
+
private resolveRef;
|
|
13
|
+
private mergeAllOf;
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SchemaResolver } from './SchemaResolver';
|
|
2
|
+
import { JsonSchemaNode } from './types';
|
|
3
|
+
type ObjectDepth = "recursive" | "shallow";
|
|
4
|
+
type PropertyKeysOrder = "default" | "ordered";
|
|
5
|
+
type EmptyObjectResult = "undefined" | "empty";
|
|
6
|
+
export type BuildDefaultForSchemaOptions = {
|
|
7
|
+
stringDefault?: string;
|
|
8
|
+
objectDepth?: ObjectDepth;
|
|
9
|
+
propertyKeys?: PropertyKeysOrder;
|
|
10
|
+
emptyObject?: EmptyObjectResult;
|
|
11
|
+
ignoreSchemaDefault?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type ResolvedBuildDefaultOptions = {
|
|
14
|
+
stringDefault: string | undefined;
|
|
15
|
+
objectDepth: ObjectDepth;
|
|
16
|
+
propertyKeys: PropertyKeysOrder;
|
|
17
|
+
emptyObject: EmptyObjectResult;
|
|
18
|
+
ignoreSchemaDefault: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const FORM_DEFAULT_OPTIONS: ResolvedBuildDefaultOptions;
|
|
21
|
+
export declare const ARRAY_ITEM_OBJECT_OPTIONS: ResolvedBuildDefaultOptions;
|
|
22
|
+
export declare const buildDefaultForSchema: (resolver: SchemaResolver, schema?: JsonSchemaNode, options?: BuildDefaultForSchemaOptions) => unknown;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface JsonSchemaNode {
|
|
2
|
+
$schema?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
type?: string | string[];
|
|
5
|
+
description?: string;
|
|
6
|
+
properties?: Record<string, JsonSchemaNode>;
|
|
7
|
+
items?: JsonSchemaNode;
|
|
8
|
+
required?: string[];
|
|
9
|
+
enum?: unknown[];
|
|
10
|
+
default?: unknown;
|
|
11
|
+
format?: string;
|
|
12
|
+
oneOf?: JsonSchemaNode[];
|
|
13
|
+
allOf?: JsonSchemaNode[];
|
|
14
|
+
anyOf?: JsonSchemaNode[];
|
|
15
|
+
$ref?: string;
|
|
16
|
+
definitions?: Record<string, JsonSchemaNode>;
|
|
17
|
+
additionalProperties?: boolean | JsonSchemaNode;
|
|
18
|
+
"x-evergis-type"?: string;
|
|
19
|
+
"x-source"?: string;
|
|
20
|
+
"x-order"?: number;
|
|
21
|
+
"x-abstract"?: boolean;
|
|
22
|
+
"x-hide"?: boolean;
|
|
23
|
+
minItems?: number;
|
|
24
|
+
maxItems?: number;
|
|
25
|
+
nullable?: boolean;
|
|
26
|
+
minimum?: number;
|
|
27
|
+
maximum?: number;
|
|
28
|
+
minLength?: number;
|
|
29
|
+
methodName?: string;
|
|
30
|
+
fileName?: string;
|
|
31
|
+
}
|
|
32
|
+
export type ArrayItemKind = "string" | "attribute" | "composite";
|
|
33
|
+
export interface ArrayItemDetection {
|
|
34
|
+
kind: ArrayItemKind;
|
|
35
|
+
itemSchema: JsonSchemaNode;
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.0.
|
|
2
|
+
"version": "4.0.168",
|
|
3
3
|
"name": "@evergis/react",
|
|
4
4
|
"author": "Everpoint",
|
|
5
5
|
"license": "MIT",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"uuid": "^13.0.0",
|
|
97
97
|
"wkt": "^0.1.1"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "2c3ed788cb461fa2ec163d695ead272005d9309f"
|
|
100
100
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RemoteTaskStatus } from '@evergis/api';
|
|
2
|
-
interface UseTaskNotificationsParams {
|
|
3
|
-
enabled: boolean;
|
|
4
|
-
suppressed: boolean;
|
|
5
|
-
status: RemoteTaskStatus;
|
|
6
|
-
lastMessage: string | null;
|
|
7
|
-
openLog: () => void;
|
|
8
|
-
}
|
|
9
|
-
export declare const useTaskNotifications: ({ enabled, suppressed, status, lastMessage, openLog, }: UseTaskNotificationsParams) => {
|
|
10
|
-
setNotificationDismissed: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
File without changes
|
|
File without changes
|