@openmrs/esm-dispensing-app 1.9.2-pre.902 → 1.9.2-pre.903

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/.eslintrc CHANGED
@@ -7,6 +7,14 @@
7
7
  "plugin:@typescript-eslint/recommended",
8
8
  "plugin:@typescript-eslint/recommended-requiring-type-checking"
9
9
  ],
10
+ "overrides": [
11
+ {
12
+ "files": ["e2e/**/*.ts"],
13
+ "rules": {
14
+ "react-hooks/rules-of-hooks": "off"
15
+ }
16
+ }
17
+ ],
10
18
  "parser": "@typescript-eslint/parser",
11
19
  "parserOptions": {
12
20
  "project": true,
@@ -0,0 +1 @@
1
+ {"hash":"2355faddea0ea7e0","duration":43585}
@@ -40,4 +40,4 @@ Entrypoints:
40
40
  main (568 KiB)
41
41
  main.js
42
42
 
43
- webpack 5.99.9 compiled with 2 warnings in 41536 ms
43
+ webpack 5.99.9 compiled with 2 warnings in 41211 ms
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"patient-diagnoses","component":"patientDiagnoses","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"patient-conditions","component":"patientConditions","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}},{"name":"dispense-action-button","slot":"prescription-action-button-slot","component":"dispenseActionButton"},{"name":"pause-action-button","slot":"prescription-action-button-slot","component":"pauseActionButton"},{"name":"close-action-button","slot":"prescription-action-button-slot","component":"closeActionButton"}],"workspaces":[{"name":"close-dispense-workspace","component":"closeDispenseWorkspace","type":"dispense","title":"Close prescription"},{"name":"pause-dispense-workspace","component":"pauseDispenseWorkspace","type":"dispense","title":"Pause prescription"},{"name":"dispense-workspace","component":"dispenseWorkspace","type":"dispense","title":"Dispense prescription","width":"wider"}],"modals":[{"name":"prescription-print-preview-modal","component":"printPrescriptionPreviewModal"},{"name":"delete-confirm-modal","component":"deleteConfirmModal"}],"version":"1.9.2-pre.902"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.2.0"},"pages":[{"component":"dispensing","route":"dispensing","online":true,"offline":true}],"extensions":[{"name":"dispensing-link","slot":"app-menu-slot","component":"dispensingLink","online":true,"offline":true},{"name":"patient-diagnoses","component":"patientDiagnoses","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"patient-conditions","component":"patientConditions","slot":"dispensing-condition-and-diagnoses","online":true,"offline":true},{"name":"dispensing-dashboard","slot":"dispensing-dashboard-slot","component":"dispensingDashboard","online":true,"offline":true},{"name":"dispensing-dashboard-link","component":"dispensingDashboardLink","meta":{"name":"dispensing","slot":"dispensing-dashboard-slot","title":"Dispensing"}},{"name":"dispense-action-button","slot":"prescription-action-button-slot","component":"dispenseActionButton"},{"name":"pause-action-button","slot":"prescription-action-button-slot","component":"pauseActionButton"},{"name":"close-action-button","slot":"prescription-action-button-slot","component":"closeActionButton"}],"workspaces":[{"name":"close-dispense-workspace","component":"closeDispenseWorkspace","type":"dispense","title":"Close prescription"},{"name":"pause-dispense-workspace","component":"pauseDispenseWorkspace","type":"dispense","title":"Pause prescription"},{"name":"dispense-workspace","component":"dispenseWorkspace","type":"dispense","title":"Dispense prescription","width":"wider"}],"modals":[{"name":"prescription-print-preview-modal","component":"printPrescriptionPreviewModal"},{"name":"delete-confirm-modal","component":"deleteConfirmModal"}],"version":"1.9.2-pre.903"}
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/await-thenable */
2
1
  import { type APIRequestContext, expect } from '@playwright/test';
3
2
  import { type Order } from '@openmrs/esm-patient-common-lib';
4
3
  import { type Encounter } from './types';
@@ -35,10 +34,10 @@ export const generateRandomDrugOrder = async (
35
34
  orderReasonNonCoded: 'order reason',
36
35
  },
37
36
  });
38
- await expect(order.ok()).toBeTruthy();
37
+ expect(order.ok()).toBeTruthy();
39
38
  return await order.json();
40
39
  };
41
40
 
42
41
  export const deleteDrugOrder = async (api: APIRequestContext, uuid: string) => {
43
- await api.delete(`order/${uuid}`, { data: {} });
42
+ await api.delete(`order/${uuid}`);
44
43
  };
@@ -1,7 +1,6 @@
1
- /* eslint-disable @typescript-eslint/await-thenable */
2
1
  import { type APIRequestContext, expect } from '@playwright/test';
3
- import { type Encounter } from './types';
4
2
  import { type Visit } from '@openmrs/esm-framework';
3
+ import { type Encounter } from './types';
5
4
 
6
5
  export interface Observation {
7
6
  uuid: string;
@@ -52,10 +51,10 @@ export const createEncounter = async (
52
51
  encounterType: '39da3525-afe4-45ff-8977-c53b7b359158',
53
52
  },
54
53
  });
55
- await expect(encounterRes.ok()).toBeTruthy();
54
+ expect(encounterRes.ok()).toBeTruthy();
56
55
  return await encounterRes.json();
57
56
  };
58
57
 
59
58
  export const deleteEncounter = async (api: APIRequestContext, uuid: string) => {
60
- await api.delete(`encounter/${uuid}`, { data: {} });
59
+ await api.delete(`encounter/${uuid}`);
61
60
  };
@@ -1,5 +1,5 @@
1
- export * from './patient-operations';
2
- export * from './visit-operations';
3
- export * from './encounter-operations';
4
1
  export * from './drug-order-operations';
2
+ export * from './encounter-operations';
3
+ export * from './patient-operations';
5
4
  export * from './provider-operations';
5
+ export * from './visit-operations';
@@ -105,5 +105,5 @@ export const getPatient = async (api: APIRequestContext, uuid: string): Promise<
105
105
  };
106
106
 
107
107
  export const deletePatient = async (api: APIRequestContext, uuid: string) => {
108
- await api.delete(`patient/${uuid}`, { data: {} });
108
+ await api.delete(`patient/${uuid}`);
109
109
  };
@@ -1,12 +1,9 @@
1
- /* eslint-disable @typescript-eslint/await-thenable */
2
1
  import { type APIRequestContext, expect } from '@playwright/test';
3
2
  import { type Provider } from './types';
4
3
 
5
4
  export const getProvider = async (api: APIRequestContext): Promise<Provider> => {
6
- const providerRes = await api.get('provider?q=admin', {
7
- data: {},
8
- });
9
- await expect(providerRes.ok()).toBeTruthy();
5
+ const providerRes = await api.get('provider?q=admin');
6
+ expect(providerRes.ok()).toBeTruthy();
10
7
  const { results } = await providerRes.json();
11
8
  return await results[0];
12
9
  };
@@ -1,6 +1,6 @@
1
+ import dayjs from 'dayjs';
1
2
  import { type APIRequestContext, expect } from '@playwright/test';
2
3
  import { type Visit } from '@openmrs/esm-framework';
3
- import dayjs from 'dayjs';
4
4
 
5
5
  export const visitStartDatetime = dayjs().subtract(1, 'D');
6
6
 
@@ -23,5 +23,5 @@ export const api: WorkerFixture<APIRequestContext, PlaywrightWorkerArgs> = async
23
23
  },
24
24
  });
25
25
 
26
- await use(ctx);
26
+ use(ctx);
27
27
  };
@@ -1,5 +1,5 @@
1
1
  # syntax=docker/dockerfile:1.3
2
- FROM --platform=$BUILDPLATFORM node:18-alpine as dev
2
+ FROM --platform=$BUILDPLATFORM node:22-alpine as dev
3
3
 
4
4
  ARG APP_SHELL_VERSION=next
5
5
 
@@ -4,45 +4,39 @@
4
4
  script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
5
5
  # create a temporary working directory
6
6
  working_dir=$(mktemp -d "${TMPDIR:-/tmp/}openmrs-e2e-frontends.XXXXXXXXXX")
7
- # get a list of all the apps in this workspace
8
- apps=$(yarn workspaces list --json | jq -r 'select(.name | test("-app")) | .name')
9
- # this array will hold all of the packed app names
10
- app_names=()
7
+ # cleanup temp directory on exit
8
+ trap 'rm -rf "$working_dir"' EXIT
9
+ # get the app name
10
+ app_name=$(jq -r '.name' "$script_dir/../../../package.json")
11
11
 
12
- echo "Packing local dispensing app..."
13
- yarn workspace "@openmrs/esm-dispensing-app" pack -o "$working_dir/_openmrs_esm_dispensing_app.tgz" >/dev/null
14
- app_names+=("_openmrs_esm_dispensing_app.tgz")
12
+ echo "Creating packed archive of the app for Docker build..."
13
+ # @openmrs/esm-whatever -> _openmrs_esm_whatever
14
+ packed_app_name=$(echo "$app_name" | tr '[:punct:]' '_');
15
+ # run yarn pack for our app and add it to the working directory
16
+ yarn pack -o "$working_dir/$packed_app_name.tgz" >/dev/null;
17
+ echo "Successfully created packed app archive: $packed_app_name.tgz"
15
18
 
16
- echo "Packing other apps..."
17
- for app in $apps; do
18
- if [ "$app" != "@openmrs/esm-dispensing-app" ]; then
19
- app_name=$(echo "$app" | tr '[:punct:]' '_')
20
- app_names+=("$app_name.tgz")
21
- yarn workspace "$app" pack -o "$working_dir/$app_name.tgz" >/dev/null
22
- fi
23
- done
24
-
25
- echo "Generating spa-assemble-config.json..."
19
+ echo "Creating dynamic spa-assemble-config.json with frontend modules..."
20
+ # dynamically assemble our list of frontend modules, prepending the primary navigation
21
+ # and patient banner apps; apps will all be in the /app directory of the Docker
22
+ # container
26
23
  jq -n \
27
- --arg apps "$apps" \
28
- --arg app_names "$(echo ${app_names[@]})" \
24
+ --arg app_name "$app_name" \
25
+ --arg app_file "/app/$packed_app_name.tgz" \
29
26
  '{
30
27
  "@openmrs/esm-primary-navigation-app": "next",
31
28
  "@openmrs/esm-patient-banner-app": "next"
32
- } + (
33
- ($apps | split("\n")) as $apps |
34
- ($app_names | split(" ") | map("/app/" + .)) as $app_files
35
- | [$apps, $app_files]
36
- | transpose
37
- | map({"key": .[0], "value": .[1]})
38
- | from_entries
39
- )' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json"
29
+ } + {
30
+ ($app_name): $app_file
31
+ }' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json"
32
+ echo "Successfully created spa-assemble-config.json with frontend modules"
40
33
 
41
- echo "Setting up Docker..."
34
+ echo "Copying Docker configuration files to working directory..."
42
35
  cp "$script_dir/Dockerfile" "$working_dir/Dockerfile"
43
36
  cp "$script_dir/docker-compose.yml" "$working_dir/docker-compose.yml"
44
37
 
45
38
  cd "$working_dir"
39
+ echo "Building and starting Docker containers for e2e testing..."
40
+ # CACHE_BUST to ensure the assemble step is always run
46
41
  docker compose build --build-arg CACHE_BUST=$(date +%s) frontend
47
42
  docker compose up -d
48
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-dispensing-app",
3
- "version": "1.9.2-pre.902",
3
+ "version": "1.9.2-pre.903",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Medication dispensing application",
6
6
  "browser": "dist/openmrs-esm-dispensing-app.js",
@@ -1 +0,0 @@
1
- {"hash":"c12da28d78393da6","duration":44199}
@@ -1,97 +0,0 @@
1
- /* eslint-disable @typescript-eslint/await-thenable */
2
- import { type APIRequestContext, expect } from '@playwright/test';
3
- import { type Order } from '@openmrs/esm-patient-common-lib';
4
- import { type Patient } from '../commands';
5
- import { type Encounter } from './types';
6
- import { type MedicationRequest } from '../../src/types';
7
-
8
- export const generateRandomMedicationRequest = async (
9
- fhirApi: APIRequestContext,
10
- patient: Patient,
11
- encounter: Encounter,
12
- providerUuid: string,
13
- drugOrder: Order,
14
- ): Promise<MedicationRequest> => {
15
- const dispense = await fhirApi.post('MedicationRequest?_summary=data', {
16
- data: {
17
- resourceType: 'MedicationDispense',
18
- medicationReference: {
19
- reference: 'Medication/',
20
- },
21
- encounter: encounter,
22
- intent: String,
23
- priority: String,
24
- subject: patient,
25
- requester: [
26
- {
27
- actor: {
28
- reference: providerUuid,
29
- },
30
- },
31
- ],
32
- quantity: {
33
- value: 1,
34
- unit: 'Tablet',
35
- code: '1513AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
36
- },
37
- asNeededBoolean: false,
38
- location: process.env.E2E_LOGIN_DEFAULT_LOCATION_UUID,
39
- dosageInstruction: [
40
- {
41
- timing: {
42
- code: {
43
- coding: [
44
- {
45
- code: '160862AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
46
- display: 'Once daily',
47
- },
48
- {
49
- system: 'https://cielterminology.org',
50
- code: '160862',
51
- },
52
- {
53
- system: 'http://snomed.info/sct/',
54
- code: '229797004',
55
- },
56
- ],
57
- text: 'Once daily',
58
- },
59
- },
60
- asNeededBoolean: false,
61
- route: {
62
- coding: [
63
- {
64
- code: '160240AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
65
- display: 'Oral',
66
- },
67
- {
68
- system: 'https://cielterminology.org',
69
- code: '160240',
70
- },
71
- {
72
- system: 'http://snomed.info/sct/',
73
- code: '26643006',
74
- },
75
- ],
76
- text: 'Oral',
77
- },
78
- doseAndRate: [
79
- {
80
- doseQuantity: {
81
- value: 1,
82
- unit: 'Milligram',
83
- code: '161553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
84
- },
85
- },
86
- ],
87
- },
88
- ],
89
- },
90
- });
91
- await expect(dispense.ok()).toBeTruthy();
92
- return await dispense.json();
93
- };
94
-
95
- export const deleteMedicationRequest = async (fhirApi: APIRequestContext, uuid: string) => {
96
- await fhirApi.delete(`MedicationDispense/${uuid}`, { data: {} });
97
- };