@openfn/language-satusehat 1.1.1 → 1.1.3

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/ast.json CHANGED
@@ -62,6 +62,234 @@
62
62
  ]
63
63
  },
64
64
  "valid": true
65
+ },
66
+ {
67
+ "name": "post",
68
+ "params": [
69
+ "path",
70
+ "data",
71
+ "params",
72
+ "callback"
73
+ ],
74
+ "docs": {
75
+ "description": "Make a post request to satusehat",
76
+ "tags": [
77
+ {
78
+ "title": "example",
79
+ "description": "post(\n \"Organization\",\n { \"resourceType\": \"Organization\", \"active\": true,\n }\n);"
80
+ },
81
+ {
82
+ "title": "function",
83
+ "description": null,
84
+ "name": null
85
+ },
86
+ {
87
+ "title": "public",
88
+ "description": null,
89
+ "type": null
90
+ },
91
+ {
92
+ "title": "param",
93
+ "description": "Path to resource",
94
+ "type": {
95
+ "type": "NameExpression",
96
+ "name": "string"
97
+ },
98
+ "name": "path"
99
+ },
100
+ {
101
+ "title": "param",
102
+ "description": "Object or JSON which defines data that will be used to create a given instance of resource",
103
+ "type": {
104
+ "type": "NameExpression",
105
+ "name": "object"
106
+ },
107
+ "name": "data"
108
+ },
109
+ {
110
+ "title": "param",
111
+ "description": "Optional request params.",
112
+ "type": {
113
+ "type": "NameExpression",
114
+ "name": "Object"
115
+ },
116
+ "name": "params"
117
+ },
118
+ {
119
+ "title": "param",
120
+ "description": "Optional callback to handle the response",
121
+ "type": {
122
+ "type": "OptionalType",
123
+ "expression": {
124
+ "type": "NameExpression",
125
+ "name": "function"
126
+ }
127
+ },
128
+ "name": "callback"
129
+ },
130
+ {
131
+ "title": "returns",
132
+ "description": null,
133
+ "type": {
134
+ "type": "NameExpression",
135
+ "name": "Operation"
136
+ }
137
+ }
138
+ ]
139
+ },
140
+ "valid": true
141
+ },
142
+ {
143
+ "name": "put",
144
+ "params": [
145
+ "path",
146
+ "data",
147
+ "params",
148
+ "callback"
149
+ ],
150
+ "docs": {
151
+ "description": "Make a put request to satusehat",
152
+ "tags": [
153
+ {
154
+ "title": "example",
155
+ "description": "put(\n \"Organization/123\",\n { \"resourceType\": \"Organization\", \"active\": false,\n }\n);"
156
+ },
157
+ {
158
+ "title": "function",
159
+ "description": null,
160
+ "name": null
161
+ },
162
+ {
163
+ "title": "public",
164
+ "description": null,
165
+ "type": null
166
+ },
167
+ {
168
+ "title": "param",
169
+ "description": "Path to resource and exact item to be updated",
170
+ "type": {
171
+ "type": "NameExpression",
172
+ "name": "string"
173
+ },
174
+ "name": "path"
175
+ },
176
+ {
177
+ "title": "param",
178
+ "description": "Object or JSON which defines data that will be used to update a given instance of resource",
179
+ "type": {
180
+ "type": "NameExpression",
181
+ "name": "object"
182
+ },
183
+ "name": "data"
184
+ },
185
+ {
186
+ "title": "param",
187
+ "description": "Optional request params.",
188
+ "type": {
189
+ "type": "NameExpression",
190
+ "name": "Object"
191
+ },
192
+ "name": "params"
193
+ },
194
+ {
195
+ "title": "param",
196
+ "description": "Optional callback to handle the response",
197
+ "type": {
198
+ "type": "OptionalType",
199
+ "expression": {
200
+ "type": "NameExpression",
201
+ "name": "function"
202
+ }
203
+ },
204
+ "name": "callback"
205
+ },
206
+ {
207
+ "title": "returns",
208
+ "description": null,
209
+ "type": {
210
+ "type": "NameExpression",
211
+ "name": "Operation"
212
+ }
213
+ }
214
+ ]
215
+ },
216
+ "valid": true
217
+ },
218
+ {
219
+ "name": "patch",
220
+ "params": [
221
+ "path",
222
+ "data",
223
+ "params",
224
+ "callback"
225
+ ],
226
+ "docs": {
227
+ "description": "Make a patch request to satusehat",
228
+ "tags": [
229
+ {
230
+ "title": "example",
231
+ "description": "patch(\n \"Organization/123\",\n [{\n\"op\": \"replace\", // Operation - `replace` is the only one used to change a specific property or element\n \"path\": \"/language\", // Path - The name of property/element of resource to be replaced\n \"value\": \"id\" // Value- The value to be replaced\n}]\n\n);"
232
+ },
233
+ {
234
+ "title": "function",
235
+ "description": null,
236
+ "name": null
237
+ },
238
+ {
239
+ "title": "public",
240
+ "description": null,
241
+ "type": null
242
+ },
243
+ {
244
+ "title": "param",
245
+ "description": "Path to resource and exact item to be partially updated",
246
+ "type": {
247
+ "type": "NameExpression",
248
+ "name": "string"
249
+ },
250
+ "name": "path"
251
+ },
252
+ {
253
+ "title": "param",
254
+ "description": "An array of objects which defines data that will be used to partially update a given instance of resource",
255
+ "type": {
256
+ "type": "NameExpression",
257
+ "name": "Array"
258
+ },
259
+ "name": "data"
260
+ },
261
+ {
262
+ "title": "param",
263
+ "description": "Optional request params.",
264
+ "type": {
265
+ "type": "NameExpression",
266
+ "name": "Object"
267
+ },
268
+ "name": "params"
269
+ },
270
+ {
271
+ "title": "param",
272
+ "description": "Optional callback to handle the response",
273
+ "type": {
274
+ "type": "OptionalType",
275
+ "expression": {
276
+ "type": "NameExpression",
277
+ "name": "function"
278
+ }
279
+ },
280
+ "name": "callback"
281
+ },
282
+ {
283
+ "title": "returns",
284
+ "description": null,
285
+ "type": {
286
+ "type": "NameExpression",
287
+ "name": "Operation"
288
+ }
289
+ }
290
+ ]
291
+ },
292
+ "valid": true
65
293
  }
66
294
  ],
67
295
  "exports": [],
@@ -79,15 +307,15 @@
79
307
  "description": null,
80
308
  "type": null
81
309
  },
82
- {
83
- "title": "example",
84
- "description": "fn(state => {\n // do some things to state\n return state;\n});"
85
- },
86
310
  {
87
311
  "title": "function",
88
312
  "description": null,
89
313
  "name": null
90
314
  },
315
+ {
316
+ "title": "example",
317
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
318
+ },
91
319
  {
92
320
  "title": "param",
93
321
  "description": "is the function",
@@ -123,15 +351,15 @@
123
351
  "description": null,
124
352
  "type": null
125
353
  },
126
- {
127
- "title": "example",
128
- "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
129
- },
130
354
  {
131
355
  "title": "function",
132
356
  "description": null,
133
357
  "name": null
134
358
  },
359
+ {
360
+ "title": "example",
361
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
362
+ },
135
363
  {
136
364
  "title": "param",
137
365
  "description": "The condition that returns true",
@@ -175,15 +403,15 @@
175
403
  "description": null,
176
404
  "type": null
177
405
  },
178
- {
179
- "title": "example",
180
- "description": "sourceValue('$.key')"
181
- },
182
406
  {
183
407
  "title": "function",
184
408
  "description": null,
185
409
  "name": null
186
410
  },
411
+ {
412
+ "title": "example",
413
+ "description": "sourceValue('$.key')"
414
+ },
187
415
  {
188
416
  "title": "param",
189
417
  "description": "JSONPath referencing a point in `state`.",
@@ -218,15 +446,15 @@
218
446
  "description": null,
219
447
  "type": null
220
448
  },
221
- {
222
- "title": "example",
223
- "description": "dataPath('key')"
224
- },
225
449
  {
226
450
  "title": "function",
227
451
  "description": null,
228
452
  "name": null
229
453
  },
454
+ {
455
+ "title": "example",
456
+ "description": "dataPath('key')"
457
+ },
230
458
  {
231
459
  "title": "param",
232
460
  "description": "JSONPath referencing a point in `data`.",
@@ -261,15 +489,15 @@
261
489
  "description": null,
262
490
  "type": null
263
491
  },
264
- {
265
- "title": "example",
266
- "description": "dataValue('key')"
267
- },
268
492
  {
269
493
  "title": "function",
270
494
  "description": null,
271
495
  "name": null
272
496
  },
497
+ {
498
+ "title": "example",
499
+ "description": "dataValue('key')"
500
+ },
273
501
  {
274
502
  "title": "param",
275
503
  "description": "JSONPath referencing a point in `data`.",
@@ -304,15 +532,15 @@
304
532
  "description": null,
305
533
  "type": null
306
534
  },
307
- {
308
- "title": "example",
309
- "description": "lastReferenceValue('key')"
310
- },
311
535
  {
312
536
  "title": "function",
313
537
  "description": null,
314
538
  "name": null
315
539
  },
540
+ {
541
+ "title": "example",
542
+ "description": "lastReferenceValue('key')"
543
+ },
316
544
  {
317
545
  "title": "param",
318
546
  "description": "JSONPath referencing a point in `references`.",
@@ -348,15 +576,15 @@
348
576
  "description": null,
349
577
  "type": null
350
578
  },
351
- {
352
- "title": "example",
353
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
354
- },
355
579
  {
356
580
  "title": "function",
357
581
  "description": null,
358
582
  "name": null
359
583
  },
584
+ {
585
+ "title": "example",
586
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
587
+ },
360
588
  {
361
589
  "title": "param",
362
590
  "description": "JSONPath referencing a point in `state`.",
@@ -400,15 +628,15 @@
400
628
  "description": null,
401
629
  "type": null
402
630
  },
403
- {
404
- "title": "example",
405
- "description": "combine(\n create('foo'),\n delete('bar')\n)"
406
- },
407
631
  {
408
632
  "title": "function",
409
633
  "description": null,
410
634
  "name": null
411
635
  },
636
+ {
637
+ "title": "example",
638
+ "description": "combine(\n create('foo'),\n delete('bar')\n)"
639
+ },
412
640
  {
413
641
  "title": "param",
414
642
  "description": "Operations to be performed.",
@@ -444,15 +672,15 @@
444
672
  "description": null,
445
673
  "type": null
446
674
  },
447
- {
448
- "title": "example",
449
- "description": "field('destination_field_name__c', 'value')"
450
- },
451
675
  {
452
676
  "title": "function",
453
677
  "description": null,
454
678
  "name": null
455
679
  },
680
+ {
681
+ "title": "example",
682
+ "description": "field('destination_field_name__c', 'value')"
683
+ },
456
684
  {
457
685
  "title": "param",
458
686
  "description": "Name of the field",
@@ -496,15 +724,15 @@
496
724
  "description": null,
497
725
  "type": null
498
726
  },
499
- {
500
- "title": "example",
501
- "description": "fields(list_of_fields)"
502
- },
503
727
  {
504
728
  "title": "function",
505
729
  "description": null,
506
730
  "name": null
507
731
  },
732
+ {
733
+ "title": "example",
734
+ "description": "fields(list_of_fields)"
735
+ },
508
736
  {
509
737
  "title": "param",
510
738
  "description": "a list of fields",
@@ -549,6 +777,11 @@
549
777
  "description": null,
550
778
  "name": null
551
779
  },
780
+ {
781
+ "title": "public",
782
+ "description": null,
783
+ "type": null
784
+ },
552
785
  {
553
786
  "title": "param",
554
787
  "description": null,
@@ -593,15 +826,15 @@
593
826
  "description": null,
594
827
  "type": null
595
828
  },
596
- {
597
- "title": "example",
598
- "description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
599
- },
600
829
  {
601
830
  "title": "function",
602
831
  "description": null,
603
832
  "name": null
604
833
  },
834
+ {
835
+ "title": "example",
836
+ "description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
837
+ },
605
838
  {
606
839
  "title": "param",
607
840
  "description": "Array of toString'able primatives.",
package/dist/index.cjs CHANGED
@@ -182,7 +182,8 @@ function get(path, params = {}, callback = (s) => s) {
182
182
  });
183
183
  return prepareNextState(state, response, callback);
184
184
  } catch (e) {
185
- throw e.body ?? e;
185
+ console.error(JSON.stringify(e.body, null, 2));
186
+ throw e;
186
187
  }
187
188
  };
188
189
  }
@@ -202,7 +203,8 @@ function post(path, data, params = {}, callback = (s) => s) {
202
203
  });
203
204
  return prepareNextState(state, response, callback);
204
205
  } catch (e) {
205
- throw e.body.error ?? e;
206
+ console.error(JSON.stringify(e.body, null, 2));
207
+ throw e;
206
208
  }
207
209
  };
208
210
  }
@@ -222,7 +224,8 @@ function put(path, data, params = {}, callback = (s) => s) {
222
224
  });
223
225
  return prepareNextState(state, response, callback);
224
226
  } catch (e) {
225
- throw e.body.error ?? e;
227
+ console.error(JSON.stringify(e.body, null, 2));
228
+ throw e;
226
229
  }
227
230
  };
228
231
  }
@@ -243,7 +246,8 @@ function patch(path, data, params = {}, callback = (s) => s) {
243
246
  });
244
247
  return prepareNextState(state, response, callback);
245
248
  } catch (e) {
246
- throw e.body ?? e;
249
+ console.error(JSON.stringify(e.body, null, 2));
250
+ throw e;
247
251
  }
248
252
  };
249
253
  }
package/dist/index.js CHANGED
@@ -162,7 +162,8 @@ function get(path, params = {}, callback = (s) => s) {
162
162
  });
163
163
  return prepareNextState(state, response, callback);
164
164
  } catch (e) {
165
- throw e.body ?? e;
165
+ console.error(JSON.stringify(e.body, null, 2));
166
+ throw e;
166
167
  }
167
168
  };
168
169
  }
@@ -182,7 +183,8 @@ function post(path, data, params = {}, callback = (s) => s) {
182
183
  });
183
184
  return prepareNextState(state, response, callback);
184
185
  } catch (e) {
185
- throw e.body.error ?? e;
186
+ console.error(JSON.stringify(e.body, null, 2));
187
+ throw e;
186
188
  }
187
189
  };
188
190
  }
@@ -202,7 +204,8 @@ function put(path, data, params = {}, callback = (s) => s) {
202
204
  });
203
205
  return prepareNextState(state, response, callback);
204
206
  } catch (e) {
205
- throw e.body.error ?? e;
207
+ console.error(JSON.stringify(e.body, null, 2));
208
+ throw e;
206
209
  }
207
210
  };
208
211
  }
@@ -223,7 +226,8 @@ function patch(path, data, params = {}, callback = (s) => s) {
223
226
  });
224
227
  return prepareNextState(state, response, callback);
225
228
  } catch (e) {
226
- throw e.body ?? e;
229
+ console.error(JSON.stringify(e.body, null, 2));
230
+ throw e;
227
231
  }
228
232
  };
229
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-satusehat",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "OpenFn satusehat adaptor",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@
19
19
  "configuration-schema.json"
20
20
  ],
21
21
  "dependencies": {
22
- "@openfn/language-common": "1.15.0"
22
+ "@openfn/language-common": "1.15.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "assertion-error": "2.0.0",
@@ -32,6 +32,7 @@ export function get(path: string, params?: object, callback?: Function): Operati
32
32
  * }
33
33
  * );
34
34
  * @function
35
+ * @public
35
36
  * @param {string} path - Path to resource
36
37
  * @param {object} data - Object or JSON which defines data that will be used to create a given instance of resource
37
38
  * @param {Object} params - Optional request params.
@@ -48,6 +49,7 @@ export function post(path: string, data: object, params?: any, callback?: Functi
48
49
  * }
49
50
  * );
50
51
  * @function
52
+ * @public
51
53
  * @param {string} path - Path to resource and exact item to be updated
52
54
  * @param {object} data - Object or JSON which defines data that will be used to update a given instance of resource
53
55
  * @param {Object} params - Optional request params.
@@ -68,6 +70,7 @@ export function put(path: string, data: object, params?: any, callback?: Functio
68
70
  *
69
71
  * );
70
72
  * @function
73
+ * @public
71
74
  * @param {string} path - Path to resource and exact item to be partially updated
72
75
  * @param {Array} data - An array of objects which defines data that will be used to partially update a given instance of resource
73
76
  * @param {Object} params - Optional request params.