@openfn/language-mtn-momo 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 +31 -0
- package/ast.json +835 -0
- package/configuration-schema.json +43 -0
- package/dist/index.cjs +166 -0
- package/dist/index.js +145 -0
- package/package.json +47 -0
- package/types/Adaptor.d.ts +78 -0
- package/types/Utils.d.ts +3 -0
- package/types/index.d.ts +3 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"properties": {
|
|
4
|
+
"baseUrl": {
|
|
5
|
+
"title": "Base URL",
|
|
6
|
+
"anyOf": [
|
|
7
|
+
{
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "null"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"description": "",
|
|
15
|
+
"format": "uri",
|
|
16
|
+
"minLength": 1,
|
|
17
|
+
"examples": ["https://sandbox.momodeveloper.mtn.com/"]
|
|
18
|
+
},
|
|
19
|
+
"subscription_key": {
|
|
20
|
+
"title": "subscription Key",
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "The subscription key is part of the header of all requests sent to the API Manager",
|
|
23
|
+
"examples": ["630ee209443d787927b08b3c57902"]
|
|
24
|
+
},
|
|
25
|
+
"api_key": {
|
|
26
|
+
"title": "API Key",
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "",
|
|
29
|
+
"writeOnly": true,
|
|
30
|
+
"examples": ["630ee209443d787927b08b3c57902"]
|
|
31
|
+
},
|
|
32
|
+
"api_user": {
|
|
33
|
+
"title": "API User",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "",
|
|
36
|
+
"writeOnly": true,
|
|
37
|
+
"examples": ["630ee209443d787927b08b3c57902"]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"type": "object",
|
|
41
|
+
"additionalProperties": true,
|
|
42
|
+
"required": ["api_key", "api_user", "subscription_key", "baseUrl"]
|
|
43
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
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
|
+
group: () => import_language_common2.group,
|
|
40
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
41
|
+
merge: () => import_language_common2.merge,
|
|
42
|
+
request: () => request2,
|
|
43
|
+
scrubEmojis: () => import_language_common2.scrubEmojis,
|
|
44
|
+
sourceValue: () => import_language_common2.sourceValue,
|
|
45
|
+
util: () => import_language_common2.util
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(src_exports);
|
|
48
|
+
|
|
49
|
+
// src/Adaptor.js
|
|
50
|
+
var Adaptor_exports = {};
|
|
51
|
+
__export(Adaptor_exports, {
|
|
52
|
+
combine: () => import_language_common2.combine,
|
|
53
|
+
cursor: () => import_language_common2.cursor,
|
|
54
|
+
dataPath: () => import_language_common2.dataPath,
|
|
55
|
+
dataValue: () => import_language_common2.dataValue,
|
|
56
|
+
dateFns: () => import_language_common2.dateFns,
|
|
57
|
+
each: () => import_language_common2.each,
|
|
58
|
+
field: () => import_language_common2.field,
|
|
59
|
+
fields: () => import_language_common2.fields,
|
|
60
|
+
fn: () => import_language_common2.fn,
|
|
61
|
+
fnIf: () => import_language_common2.fnIf,
|
|
62
|
+
group: () => import_language_common2.group,
|
|
63
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
64
|
+
merge: () => import_language_common2.merge,
|
|
65
|
+
request: () => request2,
|
|
66
|
+
scrubEmojis: () => import_language_common2.scrubEmojis,
|
|
67
|
+
sourceValue: () => import_language_common2.sourceValue,
|
|
68
|
+
util: () => import_language_common2.util
|
|
69
|
+
});
|
|
70
|
+
var import_util2 = require("@openfn/language-common/util");
|
|
71
|
+
|
|
72
|
+
// src/Utils.js
|
|
73
|
+
var import_language_common = require("@openfn/language-common");
|
|
74
|
+
var import_util = require("@openfn/language-common/util");
|
|
75
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
76
|
+
var prepareNextState = (state, response) => {
|
|
77
|
+
const { body, ...responseWithoutBody } = response;
|
|
78
|
+
if (!state.references) {
|
|
79
|
+
state.references = [];
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
...(0, import_language_common.composeNextState)(state, response.body),
|
|
83
|
+
response: responseWithoutBody
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
var getAccessToken = async (configuration) => {
|
|
87
|
+
const { api_user, api_key, subscription_key, baseUrl } = configuration;
|
|
88
|
+
const auth_header = (0, import_util.makeBasicAuthHeader)(api_user, api_key);
|
|
89
|
+
const { body: { access_token } } = await (0, import_util.request)("POST", "/collection/token/", {
|
|
90
|
+
headers: {
|
|
91
|
+
...auth_header,
|
|
92
|
+
"Cache-Control": "no-cache",
|
|
93
|
+
"Ocp-Apim-Subscription-Key": subscription_key,
|
|
94
|
+
"Content-Type": "application/json"
|
|
95
|
+
},
|
|
96
|
+
baseUrl
|
|
97
|
+
});
|
|
98
|
+
return access_token;
|
|
99
|
+
};
|
|
100
|
+
var request = async (state, method, path, options) => {
|
|
101
|
+
var _a;
|
|
102
|
+
const { baseUrl, subscription_key, access_token: savedToken } = state.configuration;
|
|
103
|
+
const errors = {
|
|
104
|
+
404: "Page not found"
|
|
105
|
+
};
|
|
106
|
+
let token = savedToken;
|
|
107
|
+
if (!token && !((_a = options.headers) == null ? void 0 : _a.Authorization)) {
|
|
108
|
+
token = await getAccessToken(state.configuration);
|
|
109
|
+
state.configuration.access_token = token;
|
|
110
|
+
}
|
|
111
|
+
let opts = {
|
|
112
|
+
parseAs: "json",
|
|
113
|
+
errors,
|
|
114
|
+
baseUrl,
|
|
115
|
+
...options,
|
|
116
|
+
headers: {
|
|
117
|
+
"Cache-Control": "no-cache",
|
|
118
|
+
"Ocp-Apim-Subscription-Key": subscription_key,
|
|
119
|
+
"Authorization": `Bearer ${token}`,
|
|
120
|
+
...options.headers
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const safePath = import_node_path.default.join(path);
|
|
124
|
+
return (0, import_util.request)(method, safePath, opts).then(import_util.logResponse);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// src/Adaptor.js
|
|
128
|
+
var import_language_common2 = require("@openfn/language-common");
|
|
129
|
+
function request2(method, path, body, options = {}) {
|
|
130
|
+
return async (state) => {
|
|
131
|
+
const [resolvedMethod, resolvedPath, resolvedBody, resolvedoptions] = (0, import_util2.expandReferences)(state, method, path, body, options);
|
|
132
|
+
const response = await request(
|
|
133
|
+
state,
|
|
134
|
+
resolvedMethod,
|
|
135
|
+
resolvedPath,
|
|
136
|
+
{
|
|
137
|
+
body: resolvedBody,
|
|
138
|
+
...resolvedoptions
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
return prepareNextState(state, response);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/index.js
|
|
146
|
+
var src_default = Adaptor_exports;
|
|
147
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
148
|
+
0 && (module.exports = {
|
|
149
|
+
combine,
|
|
150
|
+
cursor,
|
|
151
|
+
dataPath,
|
|
152
|
+
dataValue,
|
|
153
|
+
dateFns,
|
|
154
|
+
each,
|
|
155
|
+
field,
|
|
156
|
+
fields,
|
|
157
|
+
fn,
|
|
158
|
+
fnIf,
|
|
159
|
+
group,
|
|
160
|
+
lastReferenceValue,
|
|
161
|
+
merge,
|
|
162
|
+
request,
|
|
163
|
+
scrubEmojis,
|
|
164
|
+
sourceValue,
|
|
165
|
+
util
|
|
166
|
+
});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/Adaptor.js
|
|
8
|
+
var Adaptor_exports = {};
|
|
9
|
+
__export(Adaptor_exports, {
|
|
10
|
+
combine: () => combine,
|
|
11
|
+
cursor: () => cursor,
|
|
12
|
+
dataPath: () => dataPath,
|
|
13
|
+
dataValue: () => dataValue,
|
|
14
|
+
dateFns: () => dateFns,
|
|
15
|
+
each: () => each,
|
|
16
|
+
field: () => field,
|
|
17
|
+
fields: () => fields,
|
|
18
|
+
fn: () => fn,
|
|
19
|
+
fnIf: () => fnIf,
|
|
20
|
+
group: () => group,
|
|
21
|
+
lastReferenceValue: () => lastReferenceValue,
|
|
22
|
+
merge: () => merge,
|
|
23
|
+
request: () => request2,
|
|
24
|
+
scrubEmojis: () => scrubEmojis,
|
|
25
|
+
sourceValue: () => sourceValue,
|
|
26
|
+
util: () => util
|
|
27
|
+
});
|
|
28
|
+
import { expandReferences } from "@openfn/language-common/util";
|
|
29
|
+
|
|
30
|
+
// src/Utils.js
|
|
31
|
+
import { composeNextState } from "@openfn/language-common";
|
|
32
|
+
import {
|
|
33
|
+
request as commonRequest,
|
|
34
|
+
makeBasicAuthHeader,
|
|
35
|
+
logResponse
|
|
36
|
+
} from "@openfn/language-common/util";
|
|
37
|
+
import nodepath from "path";
|
|
38
|
+
var prepareNextState = (state, response) => {
|
|
39
|
+
const { body, ...responseWithoutBody } = response;
|
|
40
|
+
if (!state.references) {
|
|
41
|
+
state.references = [];
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
...composeNextState(state, response.body),
|
|
45
|
+
response: responseWithoutBody
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
var getAccessToken = async (configuration) => {
|
|
49
|
+
const { api_user, api_key, subscription_key, baseUrl } = configuration;
|
|
50
|
+
const auth_header = makeBasicAuthHeader(api_user, api_key);
|
|
51
|
+
const { body: { access_token } } = await commonRequest("POST", "/collection/token/", {
|
|
52
|
+
headers: {
|
|
53
|
+
...auth_header,
|
|
54
|
+
"Cache-Control": "no-cache",
|
|
55
|
+
"Ocp-Apim-Subscription-Key": subscription_key,
|
|
56
|
+
"Content-Type": "application/json"
|
|
57
|
+
},
|
|
58
|
+
baseUrl
|
|
59
|
+
});
|
|
60
|
+
return access_token;
|
|
61
|
+
};
|
|
62
|
+
var request = async (state, method, path, options) => {
|
|
63
|
+
var _a;
|
|
64
|
+
const { baseUrl, subscription_key, access_token: savedToken } = state.configuration;
|
|
65
|
+
const errors = {
|
|
66
|
+
404: "Page not found"
|
|
67
|
+
};
|
|
68
|
+
let token = savedToken;
|
|
69
|
+
if (!token && !((_a = options.headers) == null ? void 0 : _a.Authorization)) {
|
|
70
|
+
token = await getAccessToken(state.configuration);
|
|
71
|
+
state.configuration.access_token = token;
|
|
72
|
+
}
|
|
73
|
+
let opts = {
|
|
74
|
+
parseAs: "json",
|
|
75
|
+
errors,
|
|
76
|
+
baseUrl,
|
|
77
|
+
...options,
|
|
78
|
+
headers: {
|
|
79
|
+
"Cache-Control": "no-cache",
|
|
80
|
+
"Ocp-Apim-Subscription-Key": subscription_key,
|
|
81
|
+
"Authorization": `Bearer ${token}`,
|
|
82
|
+
...options.headers
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const safePath = nodepath.join(path);
|
|
86
|
+
return commonRequest(method, safePath, opts).then(logResponse);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/Adaptor.js
|
|
90
|
+
import {
|
|
91
|
+
combine,
|
|
92
|
+
cursor,
|
|
93
|
+
dataPath,
|
|
94
|
+
dataValue,
|
|
95
|
+
dateFns,
|
|
96
|
+
each,
|
|
97
|
+
field,
|
|
98
|
+
fields,
|
|
99
|
+
fn,
|
|
100
|
+
fnIf,
|
|
101
|
+
group,
|
|
102
|
+
lastReferenceValue,
|
|
103
|
+
merge,
|
|
104
|
+
scrubEmojis,
|
|
105
|
+
sourceValue,
|
|
106
|
+
util
|
|
107
|
+
} from "@openfn/language-common";
|
|
108
|
+
function request2(method, path, body, options = {}) {
|
|
109
|
+
return async (state) => {
|
|
110
|
+
const [resolvedMethod, resolvedPath, resolvedBody, resolvedoptions] = expandReferences(state, method, path, body, options);
|
|
111
|
+
const response = await request(
|
|
112
|
+
state,
|
|
113
|
+
resolvedMethod,
|
|
114
|
+
resolvedPath,
|
|
115
|
+
{
|
|
116
|
+
body: resolvedBody,
|
|
117
|
+
...resolvedoptions
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
return prepareNextState(state, response);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/index.js
|
|
125
|
+
var src_default = Adaptor_exports;
|
|
126
|
+
export {
|
|
127
|
+
combine,
|
|
128
|
+
cursor,
|
|
129
|
+
dataPath,
|
|
130
|
+
dataValue,
|
|
131
|
+
dateFns,
|
|
132
|
+
src_default as default,
|
|
133
|
+
each,
|
|
134
|
+
field,
|
|
135
|
+
fields,
|
|
136
|
+
fn,
|
|
137
|
+
fnIf,
|
|
138
|
+
group,
|
|
139
|
+
lastReferenceValue,
|
|
140
|
+
merge,
|
|
141
|
+
request2 as request,
|
|
142
|
+
scrubEmojis,
|
|
143
|
+
sourceValue,
|
|
144
|
+
util
|
|
145
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openfn/language-mtn-momo",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OpenFn mtn-momo adaptor",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/index.js",
|
|
9
|
+
"types": "./types/index.d.ts",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"author": "Open Function Group",
|
|
15
|
+
"license": "LGPLv3",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/",
|
|
18
|
+
"types/",
|
|
19
|
+
"ast.json",
|
|
20
|
+
"configuration-schema.json"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@openfn/language-common": "2.4.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"assertion-error": "2.0.0",
|
|
27
|
+
"chai": "4.3.6",
|
|
28
|
+
"deep-eql": "4.1.1",
|
|
29
|
+
"mocha": "^10.7.3",
|
|
30
|
+
"rimraf": "3.0.2",
|
|
31
|
+
"undici": "^5.22.1"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/openfn/adaptors.git"
|
|
36
|
+
},
|
|
37
|
+
"types": "types/index.d.ts",
|
|
38
|
+
"main": "dist/index.cjs",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "pnpm clean && build-adaptor mtn-momo",
|
|
41
|
+
"test": "mocha --experimental-specifier-resolution=node --no-warnings",
|
|
42
|
+
"test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
|
|
43
|
+
"clean": "rimraf dist types docs",
|
|
44
|
+
"pack": "pnpm pack --pack-destination ../../dist",
|
|
45
|
+
"lint": "eslint src"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State object
|
|
3
|
+
* @typedef {Object} HttpState
|
|
4
|
+
* @property data - the parsed response body
|
|
5
|
+
* @property response - the response from the HTTP server, including headers, statusCode, body, etc
|
|
6
|
+
* @property references - an array of all previous data objects used in the Job
|
|
7
|
+
**/
|
|
8
|
+
/**
|
|
9
|
+
* Options provided to the HTTP request
|
|
10
|
+
* @typedef {Object} RequestOptions
|
|
11
|
+
* @public
|
|
12
|
+
* @property {object} errors - Map of errorCodes -> error messages, ie, `{ 404: 'Resource not found;' }`. Pass `false` to suppress errors for this code.
|
|
13
|
+
* @property {object} form - Pass a JSON object to be serialised into a multipart HTML form (as FormData) in the body.
|
|
14
|
+
* @property {object} query - An object of query parameters to be encoded into the URL.
|
|
15
|
+
* @property {object} headers - An object of headers to append to the request.
|
|
16
|
+
* @property {string} parseAs - Parse the response body as json, text or stream. By default will use the response headers.
|
|
17
|
+
* @property {number} timeout - Request timeout in ms. Default: 300 seconds.
|
|
18
|
+
* @property {object} tls - TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Make a HTTP request to the [MTN MoMo API ](https://momodeveloper.mtn.com/API-collections#api=collection&operation=bc-authorize)
|
|
22
|
+
* @example <caption>Get basic user information</caption>
|
|
23
|
+
* request("GET", "/collection/v1_0/accountholder/MSISDN/46733123451/basicuserinfo", {}, { headers: { "X-Target-Environment": "sandbox" } });
|
|
24
|
+
* @example <caption>Create an invoice</caption>
|
|
25
|
+
* request("POST", "/collection/v2_0/invoice",
|
|
26
|
+
* {
|
|
27
|
+
* "externalId": "996b82e6-d498-4c7c-87ee-7b0654350a2c",
|
|
28
|
+
* "amount": "100",
|
|
29
|
+
* "currency": "EUR",
|
|
30
|
+
* "validityDuration": "3600",
|
|
31
|
+
* "intendedPayer": {
|
|
32
|
+
* "partyIdType": "MSISDN",
|
|
33
|
+
* "partyId": "46733123450"
|
|
34
|
+
* },
|
|
35
|
+
* "payee": {
|
|
36
|
+
* "partyIdType": "MSISDN",
|
|
37
|
+
* "partyId": "46733123452"
|
|
38
|
+
* }
|
|
39
|
+
* "description": ""
|
|
40
|
+
* },
|
|
41
|
+
* {
|
|
42
|
+
* "headers": {
|
|
43
|
+
* "X-Target-Environment": "sandbox",
|
|
44
|
+
* "X-Reference-Id": "ceb46c4f-1523-405b-9d16-dd9ad45e202c"
|
|
45
|
+
* }
|
|
46
|
+
* });
|
|
47
|
+
* @function
|
|
48
|
+
* @public
|
|
49
|
+
* @param {string} method - HTTP method to use
|
|
50
|
+
* @param {string} path - Path to resource
|
|
51
|
+
* @param {object} body - Object which will be attached to the HTTP request body
|
|
52
|
+
* @param {RequestOptions} options - Optional request options
|
|
53
|
+
* @returns {Operation}
|
|
54
|
+
* @state {HttpState}
|
|
55
|
+
*/
|
|
56
|
+
export function request(method: string, path: string, body: object, options?: RequestOptions): Operation;
|
|
57
|
+
/**
|
|
58
|
+
* State object
|
|
59
|
+
*/
|
|
60
|
+
export type HttpState = {
|
|
61
|
+
/**
|
|
62
|
+
* - the parsed response body
|
|
63
|
+
*/
|
|
64
|
+
data: any;
|
|
65
|
+
/**
|
|
66
|
+
* - the response from the HTTP server, including headers, statusCode, body, etc
|
|
67
|
+
*/
|
|
68
|
+
response: any;
|
|
69
|
+
/**
|
|
70
|
+
* - an array of all previous data objects used in the Job
|
|
71
|
+
*/
|
|
72
|
+
references: any;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Options provided to the HTTP request
|
|
76
|
+
*/
|
|
77
|
+
export type RequestOptions = any;
|
|
78
|
+
export { combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, group, lastReferenceValue, merge, scrubEmojis, sourceValue, util } from "@openfn/language-common";
|
package/types/Utils.d.ts
ADDED
package/types/index.d.ts
ADDED