Skip to content

Commit 9b0b746

Browse files
authored
Msupply: use randomUUID() (#1653)
* remove uuid dep from msupply * versions * update release date
1 parent 2a54116 commit 9b0b746

4 files changed

Lines changed: 38 additions & 42 deletions

File tree

packages/msupply/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @openfn/language-msupply
22

3+
## 1.0.17 - 14 May 2026
4+
5+
### Patch Changes
6+
7+
- 427da5c: Remove uuid package dependency in favour of native node.js solution
8+
39
## 1.0.16 - 07 April 2026
410

511
### Patch Changes

packages/msupply/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@openfn/language-msupply",
33
"label": "mSupply",
4-
"version": "1.0.16",
4+
"version": "1.0.17",
55
"description": "OpenFn adaptor for mSupply",
66
"type": "module",
77
"exports": {
@@ -29,8 +29,7 @@
2929
"configuration-schema.json"
3030
],
3131
"dependencies": {
32-
"@openfn/language-common": "workspace:*",
33-
"uuid": "^11.1.0"
32+
"@openfn/language-common": "workspace:*"
3433
},
3534
"devDependencies": {
3635
"assertion-error": "2.0.0",

packages/msupply/src/Adaptor.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
import crypto from 'node:crypto';
12
import { expandReferences } from '@openfn/language-common/util';
23
import * as util from './Utils.js';
3-
import { getItemsQueryString, insertOutboundShipmentQuery, upsertOutboundShipmentQuery } from './queries.js'
4-
import { v4 as uuidv4 } from 'uuid';
4+
import {
5+
getItemsQueryString,
6+
insertOutboundShipmentQuery,
7+
upsertOutboundShipmentQuery,
8+
} from './queries.js';
59

610
/**
711
* State object
@@ -12,7 +16,6 @@ import { v4 as uuidv4 } from 'uuid';
1216
* @private
1317
**/
1418

15-
1619
/**
1720
* @typedef {Object} RequestBody
1821
* @property {string} query - The GraphQL query string
@@ -25,7 +28,6 @@ import { v4 as uuidv4 } from 'uuid';
2528
* @property {string} storeId - The msupply store id the list is being fetched from
2629
*/
2730

28-
2931
/**
3032
* @typedef {Object} InsertOutboundShipmentvariables
3133
* @property {string} otherPartyId - The recieving party id
@@ -38,7 +40,6 @@ import { v4 as uuidv4 } from 'uuid';
3840
* @property {string} storeId - The id of the store the shipment is being made from
3941
*/
4042

41-
4243
/**
4344
* Get the list of items in the catalogue
4445
* @public
@@ -59,15 +60,14 @@ export function getItemsWithStats(variables) {
5960
let opts = {
6061
body: {
6162
query: getItemsQueryString,
62-
variables: resolvedVariables
63+
variables: resolvedVariables,
6364
},
64-
}
65+
};
6566
const response = await util.request(state, opts);
66-
return util.prepareNextState(state, response)
67-
}
67+
return util.prepareNextState(state, response);
68+
};
6869
}
6970

70-
7171
/**
7272
* Create an outbound shipment.
7373
* @public
@@ -89,14 +89,14 @@ export function insertOutboundShipment(variables) {
8989
body: {
9090
query: insertOutboundShipmentQuery,
9191
variables: {
92-
id: uuidv4(),
93-
...resolvedVariables
94-
}
92+
id: crypto.randomUUID(),
93+
...resolvedVariables,
94+
},
9595
},
96-
}
96+
};
9797
const response = await util.request(state, opts);
98-
return util.prepareNextState(state, response)
99-
}
98+
return util.prepareNextState(state, response);
99+
};
100100
}
101101

102102
/**
@@ -126,16 +126,15 @@ export function upsertOutboundShipment(variables) {
126126
let opts = {
127127
body: {
128128
query: upsertOutboundShipmentQuery,
129-
variables: resolvedVariables
129+
variables: resolvedVariables,
130130
},
131-
}
131+
};
132132

133133
const response = await util.request(state, opts);
134-
return util.prepareNextState(state, response)
135-
}
134+
return util.prepareNextState(state, response);
135+
};
136136
}
137137

138-
139138
/**
140139
* Make a generic GraphQL request
141140
* @public
@@ -153,18 +152,19 @@ export function upsertOutboundShipment(variables) {
153152
*/
154153
export function query(query, variables = {}) {
155154
return async state => {
156-
const [resolvedQuery, resolvedVariables] = expandReferences(state, query, variables);
157-
158-
const response = await util.request(
155+
const [resolvedQuery, resolvedVariables] = expandReferences(
159156
state,
160-
{
161-
body: {
162-
query: resolvedQuery,
163-
variables: resolvedVariables,
164-
},
165-
}
157+
query,
158+
variables,
166159
);
167160

161+
const response = await util.request(state, {
162+
body: {
163+
query: resolvedQuery,
164+
variables: resolvedVariables,
165+
},
166+
});
167+
168168
return util.prepareNextState(state, response);
169169
};
170170
}

pnpm-lock.yaml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)