@evergis/react 4.0.168 → 4.0.170

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.
@@ -5,6 +5,8 @@ export type ActionParameters = Record<string, unknown>;
5
5
  export interface ActionOptionsMap {
6
6
  runTask: {
7
7
  taskName: string;
8
+ fileName?: string;
9
+ methodName?: string;
8
10
  parameters?: ActionParameters;
9
11
  };
10
12
  setFilters: {
@@ -833,6 +833,8 @@ export interface ConfigTask {
833
833
  params?: Record<string, unknown>;
834
834
  subType?: string;
835
835
  resourceId?: string;
836
+ fileName?: string;
837
+ methodName?: string;
836
838
  owner?: string;
837
839
  updateDate?: string;
838
840
  id?: string;
@@ -355,6 +355,12 @@ function getActionOptionsError(type, value) {
355
355
  return "Options must be an object";
356
356
  if (type === "runTask" && (typeof value.taskName !== "string" || !value.taskName))
357
357
  return "runTask requires taskName";
358
+ if (type === "runTask") {
359
+ for (const field of ["fileName", "methodName"]) {
360
+ if (value[field] !== undefined && (typeof value[field] !== "string" || !value[field].trim()))
361
+ return `runTask ${field} must be a non-empty string`;
362
+ }
363
+ }
358
364
  if (type === "openModal" && (typeof value.modalId !== "string" || !value.modalId))
359
365
  return "openModal requires modalId";
360
366
  if (type === "openUrl" && (typeof value.url !== "string" || !value.url))
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ import { PythonExecutionDependencies } from './types';
2
+ export declare const getPythonTaskConfiguration: (resourceId: string, manager: Pick<PythonExecutionDependencies["manager"], "getTaskResource">, hasExplicitTarget: boolean) => Promise<import('@evergis/api').TaskConfigurationDc>;
package/dist/index.js CHANGED
@@ -6469,6 +6469,12 @@ function getActionOptionsError(type, value) {
6469
6469
  return "Options must be an object";
6470
6470
  if (type === "runTask" && (typeof value.taskName !== "string" || !value.taskName))
6471
6471
  return "runTask requires taskName";
6472
+ if (type === "runTask") {
6473
+ for (const field of ["fileName", "methodName"]) {
6474
+ if (value[field] !== undefined && (typeof value[field] !== "string" || !value[field].trim()))
6475
+ return `runTask ${field} must be a non-empty string`;
6476
+ }
6477
+ }
6472
6478
  if (type === "openModal" && (typeof value.modalId !== "string" || !value.modalId))
6473
6479
  return "openModal requires modalId";
6474
6480
  if (type === "openUrl" && (typeof value.url !== "string" || !value.url))
@@ -9037,6 +9043,22 @@ class PythonExecutionError extends Error {
9037
9043
  const RUN_ID_RADIX = 36;
9038
9044
  const TASK_OBSERVATION_TIMEOUT_MS = 86_400_000;
9039
9045
 
9046
+ const BAD_REQUEST_STATUS = 400;
9047
+ const getPythonTaskConfiguration = async (resourceId, manager, hasExplicitTarget) => {
9048
+ try {
9049
+ return await manager.getTaskResource({ id: resourceId });
9050
+ }
9051
+ catch (error) {
9052
+ if (!hasExplicitTarget || !(error instanceof api.HTTPError) || error.response.status !== BAD_REQUEST_STATUS)
9053
+ throw error;
9054
+ // Clone the response so a propagated error retains its body for the caller.
9055
+ const body = await error.response.clone().text().catch(() => "");
9056
+ if (!body.includes("Python importMethod is required"))
9057
+ throw error;
9058
+ return undefined;
9059
+ }
9060
+ };
9061
+
9040
9062
  const resolvePythonTaskDefinition = async (request, manager) => {
9041
9063
  const task = request.taskName ? request.tasks?.find(({ name }) => name === request.taskName) : undefined;
9042
9064
  if (request.taskName && !task)
@@ -9044,20 +9066,23 @@ const resolvePythonTaskDefinition = async (request, manager) => {
9044
9066
  const resourceId = task?.resourceId ?? request.resourceId;
9045
9067
  if (!resourceId)
9046
9068
  throw new Error(`Task resourceId is missing: ${request.taskName ?? ""}`);
9047
- const configuration = await manager.getTaskResource({ id: resourceId });
9048
- if (!["pythonService", "PythonTask"].includes(configuration?.taskType)) {
9069
+ const fileName = request.fileName ?? task?.fileName;
9070
+ const methodName = request.methodName ?? task?.methodName;
9071
+ const hasExplicitTarget = typeof fileName === "string" && !!fileName.trim() && typeof methodName === "string" && !!methodName.trim();
9072
+ const configuration = await getPythonTaskConfiguration(resourceId, manager, hasExplicitTarget);
9073
+ if (configuration && configuration.taskResourceSubType !== api.TaskResourceSubType.PythonTask && !["pythonService", "PythonTask"].includes(configuration.taskType)) {
9049
9074
  throw new Error(`Task ${request.taskName ?? resourceId} is not a Python task`);
9050
9075
  }
9051
- const schema = configuration.defaultConfiguration ?? {};
9076
+ const schema = configuration?.defaultConfiguration ?? {};
9052
9077
  const defaults = buildDefaultForSchema(new SchemaResolver(schema), schema);
9053
- const parameters = [defaults, configuration.userConfiguration, task?.params, request.parameters]
9078
+ const parameters = [defaults, configuration?.userConfiguration, task?.params, request.parameters]
9054
9079
  .filter(isObject)
9055
9080
  .reduce((base, override) => mergeActionParameters(base, override), {});
9056
9081
  return {
9057
9082
  resourceId,
9058
9083
  parameters,
9059
- fileName: request.fileName ?? schema.fileName,
9060
- methodName: request.methodName ?? schema.methodName,
9084
+ fileName: fileName ?? schema.fileName,
9085
+ methodName: methodName ?? schema.methodName,
9061
9086
  script: request.script,
9062
9087
  };
9063
9088
  };
@@ -19959,7 +19984,7 @@ const FeatureCardBackgroundHeader = () => {
19959
19984
  const { header } = config || {};
19960
19985
  const { options } = header || {};
19961
19986
  const { fontColor, bgColor, height, overlay, bigIcon, withPadding, bottomBlur, themeName, column } = options || {};
19962
- const renderElement = useHeaderRender(header);
19987
+ const renderElement = useHeaderRender(header, exports.WidgetType.FeatureCard);
19963
19988
  return (jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: getThemeByName(themeName ?? pageThemeName), children: jsxRuntime.jsx(BackgroundHeaderWrapper, { "$fontColor": fontColor, "$bgColor": bgColor, "$height": height, "$bigIcon": bigIcon, "$withPadding": withPadding, "$bottomBlur": bottomBlur, children: jsxRuntime.jsxs(Header, { "$overlay": overlay, "$isRow": !column, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { column: column, children: [jsxRuntime.jsx(HeaderLayerIcon, {}), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
19964
19989
  id: "title",
19965
19990
  wrap: false,
@@ -20040,7 +20065,7 @@ const FeatureCardSlideshowHeader = () => {
20040
20065
  const { header } = config || {};
20041
20066
  const { options } = header || {};
20042
20067
  const { height, fontColor, withPadding, themeName, column, overlay } = options || {};
20043
- const renderElement = useHeaderRender(header);
20068
+ const renderElement = useHeaderRender(header, exports.WidgetType.FeatureCard);
20044
20069
  return (jsxRuntime.jsx(uilibGl.ThemeProvider, { theme: getThemeByName(themeName), children: jsxRuntime.jsx(SlideshowHeaderWrapper, { fontColor: fontColor, withPadding: withPadding, height: height, big: true, children: jsxRuntime.jsxs(Header, { "$overlay": overlay, "$isRow": !column, children: [jsxRuntime.jsxs(HeaderFrontView, { children: [jsxRuntime.jsxs(HeaderContainer, { column: column, children: [jsxRuntime.jsx(HeaderLayerIcon, {}), jsxRuntime.jsx(FeatureCardTitle, { title: renderElement({
20045
20070
  id: "title",
20046
20071
  wrap: false,