@openfn/language-msupply 1.0.0
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/LICENSE +674 -0
- package/LICENSE.LESSER +165 -0
- package/README.md +27 -0
- package/ast.json +953 -0
- package/configuration-schema.json +28 -0
- package/dist/index.cjs +606 -0
- package/dist/index.js +580 -0
- package/package.json +49 -0
- package/types/Adaptor.d.ts +150 -0
- package/types/Utils.d.ts +3 -0
- package/types/index.d.ts +3 -0
- package/types/queries.d.ts +3 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"properties": {
|
|
4
|
+
"baseUrl": {
|
|
5
|
+
"title": "Base URL",
|
|
6
|
+
"description": "The base URL (http://www.example.com)",
|
|
7
|
+
"format": "uri",
|
|
8
|
+
"minLength": 1,
|
|
9
|
+
"examples": ["https://example.com"]
|
|
10
|
+
},
|
|
11
|
+
"username": {
|
|
12
|
+
"title": "Username",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Username",
|
|
15
|
+
"examples": ["test@openfn.org"]
|
|
16
|
+
},
|
|
17
|
+
"password": {
|
|
18
|
+
"title": "Password",
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Password",
|
|
21
|
+
"writeOnly": true,
|
|
22
|
+
"examples": ["@some(!)Str0ngp4ss0w0rd"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": true,
|
|
27
|
+
"required": ["password", "username", "baseUrl"]
|
|
28
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
|
|
25
|
+
// src/index.js
|
|
26
|
+
var src_exports = {};
|
|
27
|
+
__export(src_exports, {
|
|
28
|
+
combine: () => import_language_common2.combine,
|
|
29
|
+
cursor: () => import_language_common2.cursor,
|
|
30
|
+
dataPath: () => import_language_common2.dataPath,
|
|
31
|
+
dataValue: () => import_language_common2.dataValue,
|
|
32
|
+
dateFns: () => import_language_common2.dateFns,
|
|
33
|
+
default: () => src_default,
|
|
34
|
+
each: () => import_language_common2.each,
|
|
35
|
+
field: () => import_language_common2.field,
|
|
36
|
+
fields: () => import_language_common2.fields,
|
|
37
|
+
fn: () => import_language_common2.fn,
|
|
38
|
+
fnIf: () => import_language_common2.fnIf,
|
|
39
|
+
getItemsWithStats: () => getItemsWithStats,
|
|
40
|
+
group: () => import_language_common2.group,
|
|
41
|
+
insertOutboundShipment: () => insertOutboundShipment,
|
|
42
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
43
|
+
merge: () => import_language_common2.merge,
|
|
44
|
+
query: () => query,
|
|
45
|
+
scrubEmojis: () => import_language_common2.scrubEmojis,
|
|
46
|
+
sourceValue: () => import_language_common2.sourceValue,
|
|
47
|
+
upsertOutboundShipment: () => upsertOutboundShipment,
|
|
48
|
+
util: () => import_language_common2.util
|
|
49
|
+
});
|
|
50
|
+
module.exports = __toCommonJS(src_exports);
|
|
51
|
+
|
|
52
|
+
// src/Adaptor.js
|
|
53
|
+
var Adaptor_exports = {};
|
|
54
|
+
__export(Adaptor_exports, {
|
|
55
|
+
combine: () => import_language_common2.combine,
|
|
56
|
+
cursor: () => import_language_common2.cursor,
|
|
57
|
+
dataPath: () => import_language_common2.dataPath,
|
|
58
|
+
dataValue: () => import_language_common2.dataValue,
|
|
59
|
+
dateFns: () => import_language_common2.dateFns,
|
|
60
|
+
each: () => import_language_common2.each,
|
|
61
|
+
field: () => import_language_common2.field,
|
|
62
|
+
fields: () => import_language_common2.fields,
|
|
63
|
+
fn: () => import_language_common2.fn,
|
|
64
|
+
fnIf: () => import_language_common2.fnIf,
|
|
65
|
+
getItemsWithStats: () => getItemsWithStats,
|
|
66
|
+
group: () => import_language_common2.group,
|
|
67
|
+
insertOutboundShipment: () => insertOutboundShipment,
|
|
68
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
69
|
+
merge: () => import_language_common2.merge,
|
|
70
|
+
query: () => query,
|
|
71
|
+
scrubEmojis: () => import_language_common2.scrubEmojis,
|
|
72
|
+
sourceValue: () => import_language_common2.sourceValue,
|
|
73
|
+
upsertOutboundShipment: () => upsertOutboundShipment,
|
|
74
|
+
util: () => import_language_common2.util
|
|
75
|
+
});
|
|
76
|
+
var import_util2 = require("@openfn/language-common/util");
|
|
77
|
+
|
|
78
|
+
// src/Utils.js
|
|
79
|
+
var import_language_common = require("@openfn/language-common");
|
|
80
|
+
var import_util = require("@openfn/language-common/util");
|
|
81
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
82
|
+
var bearerToken = "";
|
|
83
|
+
var prepareNextState = (state, response) => {
|
|
84
|
+
const { body, ...responseWithoutBody } = response;
|
|
85
|
+
if (!state.references) {
|
|
86
|
+
state.references = [];
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
...(0, import_language_common.composeNextState)(state, response.body),
|
|
90
|
+
response: responseWithoutBody
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
var login = async (state) => {
|
|
94
|
+
const { username, password, baseUrl } = state.configuration;
|
|
95
|
+
const opts = {
|
|
96
|
+
headers: {
|
|
97
|
+
"content-type": "application/json"
|
|
98
|
+
},
|
|
99
|
+
baseUrl,
|
|
100
|
+
body: {
|
|
101
|
+
query: `
|
|
102
|
+
query AuthToken ($username: String!, $password: String!) {
|
|
103
|
+
authToken(username: $username, password: $password) {
|
|
104
|
+
... on AuthToken {
|
|
105
|
+
token
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
`,
|
|
110
|
+
variables: {
|
|
111
|
+
username,
|
|
112
|
+
password
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const { body } = await (0, import_util.request)("POST", "graphql", opts);
|
|
117
|
+
bearerToken = body.data.authToken.token;
|
|
118
|
+
return body.data.authToken.token;
|
|
119
|
+
};
|
|
120
|
+
var request = async (state, options) => {
|
|
121
|
+
const { baseUrl, token = "" } = state.configuration;
|
|
122
|
+
if (token) {
|
|
123
|
+
bearerToken = token;
|
|
124
|
+
}
|
|
125
|
+
const errors = {
|
|
126
|
+
404: "Page not found"
|
|
127
|
+
};
|
|
128
|
+
let opts = {
|
|
129
|
+
parseAs: "json",
|
|
130
|
+
errors,
|
|
131
|
+
baseUrl,
|
|
132
|
+
...options,
|
|
133
|
+
headers: {
|
|
134
|
+
"content-type": "application/json",
|
|
135
|
+
...options.headers
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
if (!bearerToken)
|
|
139
|
+
await login(state);
|
|
140
|
+
opts.headers = { ...opts.headers, "Authorization": `Bearer ${bearerToken}` };
|
|
141
|
+
return (0, import_util.request)("POST", "graphql", opts).then(import_util.logResponse);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// src/queries.js
|
|
145
|
+
var getItemsQueryString = `
|
|
146
|
+
query itemsWithStats($storeId: String!, $key: ItemSortFieldInput!, $isDesc: Boolean, $filter: ItemFilterInput, $first: Int, $offset: Int) {
|
|
147
|
+
items(storeId: $storeId, sort: {key: $key, desc: $isDesc}, filter: $filter, page: {first: $first, offset: $offset}) {
|
|
148
|
+
... on ItemConnector {
|
|
149
|
+
__typename
|
|
150
|
+
nodes {
|
|
151
|
+
code
|
|
152
|
+
id
|
|
153
|
+
name
|
|
154
|
+
unitName
|
|
155
|
+
defaultPackSize
|
|
156
|
+
availableStockOnHand(storeId: $storeId)
|
|
157
|
+
stats(storeId: $storeId) {
|
|
158
|
+
averageMonthlyConsumption
|
|
159
|
+
availableStockOnHand
|
|
160
|
+
availableMonthsOfStockOnHand
|
|
161
|
+
monthsOfStockOnHand
|
|
162
|
+
totalConsumption
|
|
163
|
+
stockOnHand
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
totalCount
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}`;
|
|
170
|
+
var insertOutboundShipmentQuery = `mutation insertOutboundShipment($id: String!, $otherPartyId: String!, $storeId: String!) {
|
|
171
|
+
insertOutboundShipment(
|
|
172
|
+
storeId: $storeId
|
|
173
|
+
input: {id: $id, otherPartyId: $otherPartyId}
|
|
174
|
+
) {
|
|
175
|
+
__typename
|
|
176
|
+
... on InvoiceNode {
|
|
177
|
+
id
|
|
178
|
+
invoiceNumber
|
|
179
|
+
}
|
|
180
|
+
... on InsertOutboundShipmentError {
|
|
181
|
+
__typename
|
|
182
|
+
error {
|
|
183
|
+
description
|
|
184
|
+
... on OtherPartyNotACustomer {
|
|
185
|
+
__typename
|
|
186
|
+
description
|
|
187
|
+
}
|
|
188
|
+
... on OtherPartyNotVisible {
|
|
189
|
+
__typename
|
|
190
|
+
description
|
|
191
|
+
}
|
|
192
|
+
description
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
... on NodeError {
|
|
196
|
+
__typename
|
|
197
|
+
error {
|
|
198
|
+
description
|
|
199
|
+
... on DatabaseError {
|
|
200
|
+
__typename
|
|
201
|
+
description
|
|
202
|
+
fullError
|
|
203
|
+
}
|
|
204
|
+
... on RecordNotFound {
|
|
205
|
+
__typename
|
|
206
|
+
description
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}`;
|
|
212
|
+
var upsertOutboundShipmentQuery = `mutation upsertOutboundShipment($storeId: String!, $input: BatchOutboundShipmentInput!) {
|
|
213
|
+
batchOutboundShipment(storeId: $storeId, input: $input) {
|
|
214
|
+
__typename
|
|
215
|
+
insertOutboundShipmentUnallocatedLines {
|
|
216
|
+
id
|
|
217
|
+
response {
|
|
218
|
+
... on InsertOutboundShipmentUnallocatedLineError {
|
|
219
|
+
__typename
|
|
220
|
+
error {
|
|
221
|
+
description
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
... on InvoiceLineNode {
|
|
225
|
+
id
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
deleteOutboundShipmentLines {
|
|
230
|
+
id
|
|
231
|
+
response {
|
|
232
|
+
... on DeleteOutboundShipmentLineError {
|
|
233
|
+
__typename
|
|
234
|
+
error {
|
|
235
|
+
description
|
|
236
|
+
... on RecordNotFound {
|
|
237
|
+
__typename
|
|
238
|
+
description
|
|
239
|
+
}
|
|
240
|
+
... on CannotEditInvoice {
|
|
241
|
+
__typename
|
|
242
|
+
description
|
|
243
|
+
}
|
|
244
|
+
... on ForeignKeyError {
|
|
245
|
+
__typename
|
|
246
|
+
description
|
|
247
|
+
key
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
... on DeleteResponse {
|
|
252
|
+
id
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
deleteOutboundShipmentServiceLines {
|
|
257
|
+
id
|
|
258
|
+
response {
|
|
259
|
+
... on DeleteResponse {
|
|
260
|
+
id
|
|
261
|
+
}
|
|
262
|
+
... on DeleteOutboundShipmentServiceLineError {
|
|
263
|
+
__typename
|
|
264
|
+
error {
|
|
265
|
+
description
|
|
266
|
+
... on RecordNotFound {
|
|
267
|
+
__typename
|
|
268
|
+
description
|
|
269
|
+
}
|
|
270
|
+
... on CannotEditInvoice {
|
|
271
|
+
__typename
|
|
272
|
+
description
|
|
273
|
+
}
|
|
274
|
+
... on ForeignKeyError {
|
|
275
|
+
__typename
|
|
276
|
+
description
|
|
277
|
+
key
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
deleteOutboundShipmentUnallocatedLines {
|
|
284
|
+
id
|
|
285
|
+
response {
|
|
286
|
+
... on DeleteResponse {
|
|
287
|
+
id
|
|
288
|
+
}
|
|
289
|
+
... on DeleteOutboundShipmentUnallocatedLineError {
|
|
290
|
+
__typename
|
|
291
|
+
error {
|
|
292
|
+
description
|
|
293
|
+
... on RecordNotFound {
|
|
294
|
+
__typename
|
|
295
|
+
description
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
deleteOutboundShipments {
|
|
302
|
+
id
|
|
303
|
+
response {
|
|
304
|
+
... on DeleteResponse {
|
|
305
|
+
id
|
|
306
|
+
}
|
|
307
|
+
... on DeleteOutboundShipmentError {
|
|
308
|
+
__typename
|
|
309
|
+
error {
|
|
310
|
+
description
|
|
311
|
+
... on RecordNotFound {
|
|
312
|
+
__typename
|
|
313
|
+
description
|
|
314
|
+
}
|
|
315
|
+
... on CannotDeleteInvoiceWithLines {
|
|
316
|
+
__typename
|
|
317
|
+
description
|
|
318
|
+
}
|
|
319
|
+
... on CannotEditInvoice {
|
|
320
|
+
__typename
|
|
321
|
+
description
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
insertOutboundShipmentLines {
|
|
328
|
+
id
|
|
329
|
+
response {
|
|
330
|
+
... on InsertOutboundShipmentLineError {
|
|
331
|
+
__typename
|
|
332
|
+
error {
|
|
333
|
+
description
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
insertOutboundShipmentServiceLines {
|
|
339
|
+
id
|
|
340
|
+
response {
|
|
341
|
+
... on InsertOutboundShipmentServiceLineError {
|
|
342
|
+
__typename
|
|
343
|
+
error {
|
|
344
|
+
description
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
insertOutboundShipments {
|
|
350
|
+
id
|
|
351
|
+
response {
|
|
352
|
+
... on InsertOutboundShipmentError {
|
|
353
|
+
__typename
|
|
354
|
+
error {
|
|
355
|
+
description
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
... on NodeError {
|
|
359
|
+
__typename
|
|
360
|
+
error {
|
|
361
|
+
description
|
|
362
|
+
... on RecordNotFound {
|
|
363
|
+
__typename
|
|
364
|
+
description
|
|
365
|
+
}
|
|
366
|
+
... on DatabaseError {
|
|
367
|
+
__typename
|
|
368
|
+
description
|
|
369
|
+
fullError
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
updateOutboundShipmentLines {
|
|
376
|
+
id
|
|
377
|
+
response {
|
|
378
|
+
... on UpdateOutboundShipmentLineError {
|
|
379
|
+
__typename
|
|
380
|
+
error {
|
|
381
|
+
description
|
|
382
|
+
... on RecordNotFound {
|
|
383
|
+
__typename
|
|
384
|
+
description
|
|
385
|
+
}
|
|
386
|
+
... on CannotEditInvoice {
|
|
387
|
+
__typename
|
|
388
|
+
description
|
|
389
|
+
}
|
|
390
|
+
... on ForeignKeyError {
|
|
391
|
+
__typename
|
|
392
|
+
description
|
|
393
|
+
key
|
|
394
|
+
}
|
|
395
|
+
... on LocationIsOnHold {
|
|
396
|
+
__typename
|
|
397
|
+
description
|
|
398
|
+
}
|
|
399
|
+
... on LocationNotFound {
|
|
400
|
+
__typename
|
|
401
|
+
description
|
|
402
|
+
}
|
|
403
|
+
... on NotEnoughStockForReduction {
|
|
404
|
+
__typename
|
|
405
|
+
batch {
|
|
406
|
+
... on NodeError {
|
|
407
|
+
__typename
|
|
408
|
+
error {
|
|
409
|
+
description
|
|
410
|
+
... on RecordNotFound {
|
|
411
|
+
__typename
|
|
412
|
+
description
|
|
413
|
+
}
|
|
414
|
+
... on DatabaseError {
|
|
415
|
+
__typename
|
|
416
|
+
description
|
|
417
|
+
fullError
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
... on StockLineAlreadyExistsInInvoice {
|
|
424
|
+
__typename
|
|
425
|
+
description
|
|
426
|
+
}
|
|
427
|
+
... on StockLineIsOnHold {
|
|
428
|
+
__typename
|
|
429
|
+
description
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
updateOutboundShipmentServiceLines {
|
|
436
|
+
id
|
|
437
|
+
response {
|
|
438
|
+
... on UpdateOutboundShipmentServiceLineError {
|
|
439
|
+
__typename
|
|
440
|
+
error {
|
|
441
|
+
description
|
|
442
|
+
... on RecordNotFound {
|
|
443
|
+
__typename
|
|
444
|
+
description
|
|
445
|
+
}
|
|
446
|
+
... on CannotEditInvoice {
|
|
447
|
+
__typename
|
|
448
|
+
description
|
|
449
|
+
}
|
|
450
|
+
... on ForeignKeyError {
|
|
451
|
+
__typename
|
|
452
|
+
description
|
|
453
|
+
key
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
updateOutboundShipmentUnallocatedLines {
|
|
460
|
+
id
|
|
461
|
+
response {
|
|
462
|
+
... on UpdateOutboundShipmentUnallocatedLineError {
|
|
463
|
+
__typename
|
|
464
|
+
error {
|
|
465
|
+
description
|
|
466
|
+
... on RecordNotFound {
|
|
467
|
+
__typename
|
|
468
|
+
description
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
updateOutboundShipments {
|
|
475
|
+
id
|
|
476
|
+
response {
|
|
477
|
+
... on UpdateOutboundShipmentError {
|
|
478
|
+
__typename
|
|
479
|
+
error {
|
|
480
|
+
description
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
... on NodeError {
|
|
484
|
+
__typename
|
|
485
|
+
error {
|
|
486
|
+
description
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
allocateOutboundShipmentUnallocatedLines {
|
|
492
|
+
id
|
|
493
|
+
response {
|
|
494
|
+
... on AllocateOutboundShipmentUnallocatedLineError {
|
|
495
|
+
__typename
|
|
496
|
+
error {
|
|
497
|
+
description
|
|
498
|
+
... on RecordNotFound {
|
|
499
|
+
__typename
|
|
500
|
+
description
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
... on AllocateOutboundShipmentUnallocatedLineNode {
|
|
505
|
+
__typename
|
|
506
|
+
deletes {
|
|
507
|
+
id
|
|
508
|
+
}
|
|
509
|
+
inserts {
|
|
510
|
+
totalCount
|
|
511
|
+
}
|
|
512
|
+
updates {
|
|
513
|
+
totalCount
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}`;
|
|
520
|
+
|
|
521
|
+
// src/Adaptor.js
|
|
522
|
+
var import_uuid = require("uuid");
|
|
523
|
+
var import_language_common2 = require("@openfn/language-common");
|
|
524
|
+
function getItemsWithStats(variables) {
|
|
525
|
+
return async (state) => {
|
|
526
|
+
const [resolvedVariables] = (0, import_util2.expandReferences)(state, variables);
|
|
527
|
+
let opts = {
|
|
528
|
+
body: {
|
|
529
|
+
query: getItemsQueryString,
|
|
530
|
+
variables: resolvedVariables
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
const response = await request(state, opts);
|
|
534
|
+
return prepareNextState(state, response);
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function insertOutboundShipment(variables) {
|
|
538
|
+
return async (state) => {
|
|
539
|
+
const [resolvedVariables] = (0, import_util2.expandReferences)(state, variables);
|
|
540
|
+
let opts = {
|
|
541
|
+
body: {
|
|
542
|
+
query: insertOutboundShipmentQuery,
|
|
543
|
+
variables: {
|
|
544
|
+
id: (0, import_uuid.v4)(),
|
|
545
|
+
...resolvedVariables
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const response = await request(state, opts);
|
|
550
|
+
return prepareNextState(state, response);
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function upsertOutboundShipment(variables) {
|
|
554
|
+
return async (state) => {
|
|
555
|
+
const [resolvedVariables] = (0, import_util2.expandReferences)(state, variables);
|
|
556
|
+
let opts = {
|
|
557
|
+
body: {
|
|
558
|
+
query: upsertOutboundShipmentQuery,
|
|
559
|
+
variables: resolvedVariables
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
const response = await request(state, opts);
|
|
563
|
+
return prepareNextState(state, response);
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function query(query2, variables = {}) {
|
|
567
|
+
return async (state) => {
|
|
568
|
+
const [resolvedQuery, resolvedVariables] = (0, import_util2.expandReferences)(state, query2, variables);
|
|
569
|
+
const response = await request(
|
|
570
|
+
state,
|
|
571
|
+
{
|
|
572
|
+
body: {
|
|
573
|
+
query: resolvedQuery,
|
|
574
|
+
variables: resolvedVariables
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
return prepareNextState(state, response);
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// src/index.js
|
|
583
|
+
var src_default = Adaptor_exports;
|
|
584
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
585
|
+
0 && (module.exports = {
|
|
586
|
+
combine,
|
|
587
|
+
cursor,
|
|
588
|
+
dataPath,
|
|
589
|
+
dataValue,
|
|
590
|
+
dateFns,
|
|
591
|
+
each,
|
|
592
|
+
field,
|
|
593
|
+
fields,
|
|
594
|
+
fn,
|
|
595
|
+
fnIf,
|
|
596
|
+
getItemsWithStats,
|
|
597
|
+
group,
|
|
598
|
+
insertOutboundShipment,
|
|
599
|
+
lastReferenceValue,
|
|
600
|
+
merge,
|
|
601
|
+
query,
|
|
602
|
+
scrubEmojis,
|
|
603
|
+
sourceValue,
|
|
604
|
+
upsertOutboundShipment,
|
|
605
|
+
util
|
|
606
|
+
});
|