@openfn/language-openboxes 1.0.18 → 1.1.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/ast.json +92 -0
- package/dist/index.cjs +16 -2
- package/dist/index.js +17 -3
- package/package.json +1 -1
- package/types/Adaptor.d.ts +1 -1
package/ast.json
CHANGED
|
@@ -480,6 +480,49 @@
|
|
|
480
480
|
},
|
|
481
481
|
"valid": true
|
|
482
482
|
},
|
|
483
|
+
{
|
|
484
|
+
"name": "combine",
|
|
485
|
+
"params": [
|
|
486
|
+
"operations"
|
|
487
|
+
],
|
|
488
|
+
"docs": {
|
|
489
|
+
"description": "Combines two operations into one",
|
|
490
|
+
"tags": [
|
|
491
|
+
{
|
|
492
|
+
"title": "public",
|
|
493
|
+
"description": null,
|
|
494
|
+
"type": null
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"title": "function",
|
|
498
|
+
"description": null,
|
|
499
|
+
"name": null
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"title": "example",
|
|
503
|
+
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"title": "param",
|
|
507
|
+
"description": "Operations to be performed.",
|
|
508
|
+
"type": {
|
|
509
|
+
"type": "NameExpression",
|
|
510
|
+
"name": "Operations"
|
|
511
|
+
},
|
|
512
|
+
"name": "operations"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"title": "returns",
|
|
516
|
+
"description": null,
|
|
517
|
+
"type": {
|
|
518
|
+
"type": "NameExpression",
|
|
519
|
+
"name": "Operation"
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
]
|
|
523
|
+
},
|
|
524
|
+
"valid": true
|
|
525
|
+
},
|
|
483
526
|
{
|
|
484
527
|
"name": "field",
|
|
485
528
|
"params": [
|
|
@@ -719,6 +762,55 @@
|
|
|
719
762
|
]
|
|
720
763
|
},
|
|
721
764
|
"valid": false
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
"name": "log",
|
|
768
|
+
"params": [
|
|
769
|
+
"args"
|
|
770
|
+
],
|
|
771
|
+
"docs": {
|
|
772
|
+
"description": "Outputs a message, like calling `console.log`. Use this at the top level of your job code, but not inside callbacks.",
|
|
773
|
+
"tags": [
|
|
774
|
+
{
|
|
775
|
+
"title": "public",
|
|
776
|
+
"description": null,
|
|
777
|
+
"type": null
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
"title": "function",
|
|
781
|
+
"description": null,
|
|
782
|
+
"name": null
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"title": "example",
|
|
786
|
+
"description": "log('Patient List::', $.patients);",
|
|
787
|
+
"caption": "Log values from state"
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
"title": "example",
|
|
791
|
+
"description": "fn((state) => {\n console.log(state.data);\n return state;\n})",
|
|
792
|
+
"caption": "Use console.log inside a callback or fn block"
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
"title": "param",
|
|
796
|
+
"description": "A value or message to display in the logs",
|
|
797
|
+
"type": {
|
|
798
|
+
"type": "NameExpression",
|
|
799
|
+
"name": "any"
|
|
800
|
+
},
|
|
801
|
+
"name": "args"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
"title": "returns",
|
|
805
|
+
"description": null,
|
|
806
|
+
"type": {
|
|
807
|
+
"type": "NameExpression",
|
|
808
|
+
"name": "Operation"
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
"valid": true
|
|
722
814
|
}
|
|
723
815
|
]
|
|
724
816
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
// src/index.js
|
|
26
26
|
var src_exports = {};
|
|
27
27
|
__export(src_exports, {
|
|
28
|
+
combine: () => import_language_common2.combine,
|
|
28
29
|
cursor: () => import_language_common2.cursor,
|
|
29
30
|
dataPath: () => import_language_common2.dataPath,
|
|
30
31
|
dataValue: () => import_language_common2.dataValue,
|
|
@@ -36,6 +37,7 @@ __export(src_exports, {
|
|
|
36
37
|
fn: () => import_language_common2.fn,
|
|
37
38
|
get: () => get,
|
|
38
39
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
40
|
+
log: () => import_language_common2.log,
|
|
39
41
|
merge: () => import_language_common2.merge,
|
|
40
42
|
post: () => post,
|
|
41
43
|
request: () => request2,
|
|
@@ -46,6 +48,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
46
48
|
// src/Adaptor.js
|
|
47
49
|
var Adaptor_exports = {};
|
|
48
50
|
__export(Adaptor_exports, {
|
|
51
|
+
combine: () => import_language_common2.combine,
|
|
49
52
|
cursor: () => import_language_common2.cursor,
|
|
50
53
|
dataPath: () => import_language_common2.dataPath,
|
|
51
54
|
dataValue: () => import_language_common2.dataValue,
|
|
@@ -56,6 +59,7 @@ __export(Adaptor_exports, {
|
|
|
56
59
|
fn: () => import_language_common2.fn,
|
|
57
60
|
get: () => get,
|
|
58
61
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
62
|
+
log: () => import_language_common2.log,
|
|
59
63
|
merge: () => import_language_common2.merge,
|
|
60
64
|
post: () => post,
|
|
61
65
|
request: () => request2,
|
|
@@ -115,13 +119,21 @@ function get(path, options) {
|
|
|
115
119
|
}
|
|
116
120
|
function post(path, body, options) {
|
|
117
121
|
return async (state) => {
|
|
118
|
-
const response = await request(state, "POST", path, {
|
|
122
|
+
const response = await request(state, "POST", path, {
|
|
123
|
+
...options,
|
|
124
|
+
body
|
|
125
|
+
});
|
|
119
126
|
return prepareNextState(state, response);
|
|
120
127
|
};
|
|
121
128
|
}
|
|
122
129
|
function request2(method, path, options = {}) {
|
|
123
130
|
return async (state) => {
|
|
124
|
-
const [resolvedMethod, resolvedPath, resolvedoptions] = (0, import_util2.expandReferences)(
|
|
131
|
+
const [resolvedMethod, resolvedPath, resolvedoptions] = (0, import_util2.expandReferences)(
|
|
132
|
+
state,
|
|
133
|
+
method,
|
|
134
|
+
path,
|
|
135
|
+
options
|
|
136
|
+
);
|
|
125
137
|
const response = await request(
|
|
126
138
|
state,
|
|
127
139
|
resolvedMethod,
|
|
@@ -136,6 +148,7 @@ function request2(method, path, options = {}) {
|
|
|
136
148
|
var src_default = Adaptor_exports;
|
|
137
149
|
// Annotate the CommonJS export names for ESM import in node:
|
|
138
150
|
0 && (module.exports = {
|
|
151
|
+
combine,
|
|
139
152
|
cursor,
|
|
140
153
|
dataPath,
|
|
141
154
|
dataValue,
|
|
@@ -146,6 +159,7 @@ var src_default = Adaptor_exports;
|
|
|
146
159
|
fn,
|
|
147
160
|
get,
|
|
148
161
|
lastReferenceValue,
|
|
162
|
+
log,
|
|
149
163
|
merge,
|
|
150
164
|
post,
|
|
151
165
|
request,
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var __export = (target, all) => {
|
|
|
7
7
|
// src/Adaptor.js
|
|
8
8
|
var Adaptor_exports = {};
|
|
9
9
|
__export(Adaptor_exports, {
|
|
10
|
+
combine: () => combine,
|
|
10
11
|
cursor: () => cursor,
|
|
11
12
|
dataPath: () => dataPath,
|
|
12
13
|
dataValue: () => dataValue,
|
|
@@ -17,6 +18,7 @@ __export(Adaptor_exports, {
|
|
|
17
18
|
fn: () => fn,
|
|
18
19
|
get: () => get,
|
|
19
20
|
lastReferenceValue: () => lastReferenceValue,
|
|
21
|
+
log: () => log,
|
|
20
22
|
merge: () => merge,
|
|
21
23
|
post: () => post,
|
|
22
24
|
request: () => request2,
|
|
@@ -68,15 +70,17 @@ var request = async (state, method, path, options = {}) => {
|
|
|
68
70
|
|
|
69
71
|
// src/Adaptor.js
|
|
70
72
|
import {
|
|
73
|
+
combine,
|
|
74
|
+
cursor,
|
|
71
75
|
dataPath,
|
|
72
76
|
dataValue,
|
|
73
77
|
dateFns,
|
|
74
|
-
cursor,
|
|
75
78
|
each,
|
|
76
79
|
field,
|
|
77
80
|
fields,
|
|
78
81
|
fn,
|
|
79
82
|
lastReferenceValue,
|
|
83
|
+
log,
|
|
80
84
|
merge,
|
|
81
85
|
sourceValue
|
|
82
86
|
} from "@openfn/language-common";
|
|
@@ -88,13 +92,21 @@ function get(path, options) {
|
|
|
88
92
|
}
|
|
89
93
|
function post(path, body, options) {
|
|
90
94
|
return async (state) => {
|
|
91
|
-
const response = await request(state, "POST", path, {
|
|
95
|
+
const response = await request(state, "POST", path, {
|
|
96
|
+
...options,
|
|
97
|
+
body
|
|
98
|
+
});
|
|
92
99
|
return prepareNextState(state, response);
|
|
93
100
|
};
|
|
94
101
|
}
|
|
95
102
|
function request2(method, path, options = {}) {
|
|
96
103
|
return async (state) => {
|
|
97
|
-
const [resolvedMethod, resolvedPath, resolvedoptions] = expandReferences(
|
|
104
|
+
const [resolvedMethod, resolvedPath, resolvedoptions] = expandReferences(
|
|
105
|
+
state,
|
|
106
|
+
method,
|
|
107
|
+
path,
|
|
108
|
+
options
|
|
109
|
+
);
|
|
98
110
|
const response = await request(
|
|
99
111
|
state,
|
|
100
112
|
resolvedMethod,
|
|
@@ -108,6 +120,7 @@ function request2(method, path, options = {}) {
|
|
|
108
120
|
// src/index.js
|
|
109
121
|
var src_default = Adaptor_exports;
|
|
110
122
|
export {
|
|
123
|
+
combine,
|
|
111
124
|
cursor,
|
|
112
125
|
dataPath,
|
|
113
126
|
dataValue,
|
|
@@ -119,6 +132,7 @@ export {
|
|
|
119
132
|
fn,
|
|
120
133
|
get,
|
|
121
134
|
lastReferenceValue,
|
|
135
|
+
log,
|
|
122
136
|
merge,
|
|
123
137
|
post,
|
|
124
138
|
request2 as request,
|
package/package.json
CHANGED
package/types/Adaptor.d.ts
CHANGED
|
@@ -98,4 +98,4 @@ export type HttpState = {
|
|
|
98
98
|
* Options provided to the HTTP request
|
|
99
99
|
*/
|
|
100
100
|
export type RequestOptions = any;
|
|
101
|
-
export { dataPath, dataValue, dateFns,
|
|
101
|
+
export { combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, lastReferenceValue, log, merge, sourceValue } from "@openfn/language-common";
|