Skip to content

Commit

Permalink
chore(deps-dev): bump dev dependencies (#147)
Browse files Browse the repository at this point in the history
typescript from 5.1.6 to 5.6.2
vite from 4.4.9 to 5.4.7
xo from 0.56.0 to 0.59.3

Apply new lint rules.
  • Loading branch information
tbouffard authored Sep 24, 2024
1 parent a62fbed commit 652e389
Show file tree
Hide file tree
Showing 11 changed files with 4,517 additions and 2,734 deletions.
7,152 changes: 4,466 additions & 2,686 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"tippy.js": "~6.3.7"
},
"devDependencies": {
"typescript": "~5.1.6",
"vite": "~4.4.9",
"xo": "~0.56.0"
"typescript": "~5.6.2",
"vite": "~5.4.7",
"xo": "~0.59.3"
}
}
8 changes: 4 additions & 4 deletions src/case-monitoring/abstract.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type {BpmnElement, BpmnElementsRegistry, BpmnSemantic, BpmnVisualization} from 'bpmn-visualization';
import type {
BpmnElement, BpmnElementsRegistry, BpmnSemantic, BpmnVisualization,
} from 'bpmn-visualization';
import tippy, {type Instance, type Props, type ReferenceElement} from 'tippy.js';
import {type CaseMonitoringData, fetchCaseMonitoringData} from './data-case.js';

Expand Down Expand Up @@ -26,9 +28,7 @@ export abstract class AbstractCaseMonitoring {
}

protected getCaseMonitoringData() {
if (!this.caseMonitoringData) {
this.caseMonitoringData = fetchCaseMonitoringData(this.processId, this.bpmnVisualization);
}
this.caseMonitoringData ||= fetchCaseMonitoringData(this.processId, this.bpmnVisualization);

return this.caseMonitoringData;
}
Expand Down
3 changes: 2 additions & 1 deletion src/case-monitoring/data-recommendation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ recommendationData.set('SRM subprocess', [{
{
id: 'contact-supplier',
title: 'Contact Supplier',
description: 'Notify a delay'}],
description: 'Notify a delay',
}],
);

export function getActivityRecommendationData(activityName: string): ActivityRecommendations[] {
Expand Down
18 changes: 9 additions & 9 deletions src/case-monitoring/main-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class MainProcessTippySupport extends AbstractTippySupport {
showContactSupplierAction(this.mainProcessCaseMonitoring!).then(() => {
console.info('Contact supplier action complete!');
})
.catch(error => {
.catch((error: unknown) => {
console.error('Error in contact supplier action:', error);
});
};
Expand All @@ -99,24 +99,24 @@ class MainProcessTippySupport extends AbstractTippySupport {
// may still exist in the DOM of the subprocess view

// the "button id" comes from the recommendation data
const allocateActorBtn = document.querySelector(`#${instance.popper.id} #reassign-actor`);
if (allocateActorBtn) {
const allocateActorButton = document.querySelector(`#${instance.popper.id} #reassign-actor`);
if (allocateActorButton) {
if (register) {
allocateActorBtn.addEventListener('click', showResourceAllocationAction);
allocateActorButton.addEventListener('click', showResourceAllocationAction);
} else {
allocateActorBtn.removeEventListener('click', showResourceAllocationAction);
allocateActorButton.removeEventListener('click', showResourceAllocationAction);
}
} else {
console.warn('NO "allocate actor" btn');
}

// The "button id" comes from the recommendation data
const contactSupplierBtn = document.querySelector(`#${instance.popper.id} #contact-supplier`);
if (contactSupplierBtn) {
const contactSupplierButton = document.querySelector(`#${instance.popper.id} #contact-supplier`);
if (contactSupplierButton) {
if (register) {
contactSupplierBtn.addEventListener('click', this.contactSupplierBtnListener);
contactSupplierButton.addEventListener('click', this.contactSupplierBtnListener);
} else {
contactSupplierBtn.removeEventListener('click', this.contactSupplierBtnListener);
contactSupplierButton.removeEventListener('click', this.contactSupplierBtnListener);
}
} else {
console.warn('NO "supplier contact" btn');
Expand Down
10 changes: 5 additions & 5 deletions src/case-monitoring/sub-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ class SubProcessTippySupport extends AbstractTippySupport {
// may still exist in the DOM of the subprocess view
const rows = document.querySelectorAll(`#${instance.popper.id} #popover-resources-available > tbody > tr`);
for (const [index, row] of rows.entries()) {
const assignBtn = document.querySelector(`#${instance.popper.id} #popover-resources-available > tbody > tr #btn-assign-${index}`);
const assignButton = document.querySelector(`#${instance.popper.id} #popover-resources-available > tbody > tr #btn-assign-${index}`);
if (register) {
row.addEventListener('mouseenter', this.rowMouseEnterListener);
row.addEventListener('mouseleave', this.rowMouseLeaveListener);
// Assign button
if (assignBtn) {
assignBtn.addEventListener('click', this.assignResource);
if (assignButton) {
assignButton.addEventListener('click', this.assignResource);
} else {
console.warn('NO "assign" btn');
}
} else {
row.removeEventListener('mouseenter', this.rowMouseEnterListener);
row.removeEventListener('mouseleave', this.rowMouseLeaveListener);
if (assignBtn) {
assignBtn.removeEventListener('click', this.assignResource);
if (assignButton) {
assignButton.removeEventListener('click', this.assignResource);
} else {
console.warn('NO "assign" btn');
}
Expand Down
12 changes: 8 additions & 4 deletions src/case-monitoring/supplier-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const executionSteps = new Map<string, ExecutionStep>([
// Gateway_19radi6 merge start and loop
['Gateway_19radi6', {id: 'Gateway_19radi6', incomingEdgeId: 'Flow_0i8gykc', nextExecutionStep: 'Activity_04d6t36'}],
// Activity_04d6t36 chatGPT activity
['Activity_04d6t36', {id: 'Activity_04d6t36', incomingEdgeId: 'Flow_06y94ol',
['Activity_04d6t36', {
id: 'Activity_04d6t36', incomingEdgeId: 'Flow_06y94ol',
innerAction: {
functionToCall() {
console.info('#### action on Activity_04d6t36');
Expand All @@ -45,7 +46,8 @@ const executionSteps = new Map<string, ExecutionStep>([
},
}],
// Activity_1oxewnq review email. Stop here, next step chosen by user
['Activity_1oxewnq', {id: 'Activity_1oxewnq', incomingEdgeId: 'Flow_092it75',
['Activity_1oxewnq', {
id: 'Activity_1oxewnq', incomingEdgeId: 'Flow_092it75',
innerAction: {
functionToCall() {
console.info('#### action on Activity_1oxewnq');
Expand Down Expand Up @@ -83,7 +85,9 @@ export type ReviewEmailDecision = 'abort' | 'generate' | 'validate';
const reviewEmailChoices = new Map<ReviewEmailDecision, string | ExecutionStep>([
['validate', 'Activity_0tb47yw'],
// ExecutionStep to manage the loop, as the gateway has more than one incoming edge
['generate', {id: 'Gateway_19radi6', incomingEdgeId: 'Flow_1glx5xw', nextExecutionStep: 'Activity_04d6t36', incomingEdgeDisplayExecutionCount: true}],
['generate', {
id: 'Gateway_19radi6', incomingEdgeId: 'Flow_1glx5xw', nextExecutionStep: 'Activity_04d6t36', incomingEdgeDisplayExecutionCount: true,
}],
['abort', 'Event_13tn0ty'],
]);

Expand Down Expand Up @@ -221,7 +225,7 @@ export class ProcessExecutor {
elementId,
executionCount,
resume: async (input?: string) => this.execute(innerAction.getElementIdToResume(input))
.catch(error => {
.catch((error: unknown) => {
console.error('Error while resuming from action on element %s', elementId, error);
}),
};
Expand Down
12 changes: 6 additions & 6 deletions src/case-monitoring/supplier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SupplierProcessTippySupport extends AbstractTippySupport {
// Activity_04d6t36 chatGPT activity
// Activity_1oxewnq review email
const isChatGptActivity = elementId === 'Activity_04d6t36';
const tippyProps: Partial<Props> = {
const tippyProperties: Partial<Props> = {
theme: isChatGptActivity ? 'light' : '',
trigger: 'manual',
arrow: !isChatGptActivity,
Expand All @@ -52,19 +52,19 @@ class SupplierProcessTippySupport extends AbstractTippySupport {
// TODO temp find a better way
// eslint-disable-next-line @typescript-eslint/no-this-alias,unicorn/no-this-assignment -- temp
const thisInstance = this;
tippyProps.onShown = (instance: Instance) => {
tippyProperties.onShown = (instance: Instance) => {
// Kind of duplication with AbstractTippySupport but we cannot use the regular registerEventListeners/unregisterEventListeners and the getContent methods.
// We must pass more parameters to the related methods.
instance.setContent(thisInstance.getEmailReviewContent(parameters));
thisInstance.manageEmailReviewEventListeners(instance, true, parameters);
};

tippyProps.onHide = (instance: Instance) => {
tippyProperties.onHide = (instance: Instance) => {
thisInstance.manageEmailReviewEventListeners(instance, false, parameters);
};
}

tippyInstance.setProps(tippyProps);
tippyInstance.setProps(tippyProperties);
return tippyInstance;
}

Expand All @@ -91,7 +91,7 @@ class SupplierProcessTippySupport extends AbstractTippySupport {
.then(() => {
console.info('manageEmailReviewEventListeners, end of call resume with decision', decision);
})
.catch(error => {
.catch((error: unknown) => {
console.error('manageEmailReviewEventListeners, end of call resume with decision "%s"', decision, error);
});
};
Expand Down Expand Up @@ -234,7 +234,7 @@ class SupplierContact {
})
.then(() => {
parameters.resume()
.catch(error => {
.catch((error: unknown) => {
console.error('Error while resuming %s', parameters.elementId, error);
});
})
Expand Down
10 changes: 4 additions & 6 deletions src/diagram.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {type BpmnElementsRegistry, BpmnVisualization, FitType, type LoadOptions} from 'bpmn-visualization';
// eslint-disable-next-line n/file-extension-in-import -- Vite syntax
import {
type BpmnElementsRegistry, BpmnVisualization, FitType, type LoadOptions,
} from 'bpmn-visualization';
import mainDiagram from './diagrams/EC-purchase-orders-collapsed.bpmn?raw';
// eslint-disable-next-line n/file-extension-in-import -- Vite syntax
import subDiagram from './diagrams/SRM-subprocess.bpmn?raw';
import {removeSectionInBreadcrumb, addSectionInBreadcrumb} from './breadcrumb.js';

Expand Down Expand Up @@ -128,9 +128,7 @@ export class SubProcessNavigator {
}

private getSubProcessHtmlElement() {
if (!this.subProcessHtmlElement) {
this.subProcessHtmlElement = this.bpmnElementsRegistry.getElementsByIds(subProcessId)[0].htmlElement;
}
this.subProcessHtmlElement ||= this.bpmnElementsRegistry.getElementsByIds(subProcessId)[0].htmlElement;

return this.subProcessHtmlElement;
}
Expand Down
16 changes: 8 additions & 8 deletions src/process-monitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ export class ProcessMonitoring {
}

private configureResetButton(enable = true) {
const btnElement = document.querySelector<HTMLButtonElement>('#' + this.getGraphContainer().id + ' #btn-reset');
if (btnElement) {
const buttonElement = document.querySelector<HTMLButtonElement>('#' + this.getGraphContainer().id + ' #btn-reset');
if (buttonElement) {
if (enable) {
btnElement.classList.remove('d-hide');
btnElement.addEventListener('click', this.resetHappyPath);
buttonElement.classList.remove('d-hide');
buttonElement.addEventListener('click', this.resetHappyPath);
} else {
btnElement.classList.add('d-hide');
btnElement.removeEventListener('click', this.resetHappyPath);
buttonElement.classList.add('d-hide');
buttonElement.removeEventListener('click', this.resetHappyPath);
}
}
}
Expand Down Expand Up @@ -126,7 +126,7 @@ export class ProcessMonitoring {
delay(delayBeforeShowingPopover).then(() => {
tippyInstance.show();
})
.catch(error => {
.catch((error: unknown) => {
console.error('Error showing popover:', error);
});
}
Expand All @@ -146,7 +146,7 @@ export class ProcessMonitoring {
.then(() => {
this.showHappyPath();
})
.catch(error => {
.catch((error: unknown) => {
console.error('Error while resetting the happy path', error);
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/utils/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ limitations under the License.
import {Notyf} from 'notyf';

// To improve, we may use existing libraries like the ones listed in https://geshan.com.np/blog/2022/08/javascript-wait-1-second/
export const delay = async (ms: number, args?: any) =>
export const delay = async (ms: number, arguments_?: any) =>
// eslint-disable-next-line no-promise-executor-return -- cannot be managed now
new Promise(timeup => setTimeout(timeup, ms, args));
new Promise(resolve => setTimeout(resolve, ms, arguments_));

// Notification configuration
export type NotificationType = 'success' | 'warning';
Expand Down

0 comments on commit 652e389

Please # to comment.