@openfn/language-khanacademy 0.3.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 +41 -0
- package/ast.json +370 -0
- package/configuration-schema.json +41 -0
- package/dist/index.cjs +231 -0
- package/dist/index.js +208 -0
- package/package.json +50 -0
- package/types/Adaptor.d.ts +55 -0
- package/types/index.d.ts +3 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
alterState: () => import_language_common2.alterState,
|
|
29
|
+
dataPath: () => import_language_common2.dataPath,
|
|
30
|
+
dataValue: () => import_language_common2.dataValue,
|
|
31
|
+
default: () => src_default,
|
|
32
|
+
execute: () => execute,
|
|
33
|
+
fetch: () => fetch,
|
|
34
|
+
field: () => import_language_common2.field,
|
|
35
|
+
fields: () => import_language_common2.fields,
|
|
36
|
+
fn: () => import_language_common2.fn,
|
|
37
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
38
|
+
merge: () => import_language_common2.merge,
|
|
39
|
+
sourceValue: () => import_language_common2.sourceValue
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(src_exports);
|
|
42
|
+
|
|
43
|
+
// src/Adaptor.js
|
|
44
|
+
var Adaptor_exports = {};
|
|
45
|
+
__export(Adaptor_exports, {
|
|
46
|
+
alterState: () => import_language_common2.alterState,
|
|
47
|
+
dataPath: () => import_language_common2.dataPath,
|
|
48
|
+
dataValue: () => import_language_common2.dataValue,
|
|
49
|
+
execute: () => execute,
|
|
50
|
+
fetch: () => fetch,
|
|
51
|
+
field: () => import_language_common2.field,
|
|
52
|
+
fields: () => import_language_common2.fields,
|
|
53
|
+
fn: () => import_language_common2.fn,
|
|
54
|
+
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
55
|
+
merge: () => import_language_common2.merge,
|
|
56
|
+
sourceValue: () => import_language_common2.sourceValue
|
|
57
|
+
});
|
|
58
|
+
var import_language_common = require("@openfn/language-common");
|
|
59
|
+
var import_url = require("url");
|
|
60
|
+
var import_request = __toESM(require("request"), 1);
|
|
61
|
+
var import_qs = __toESM(require("qs"), 1);
|
|
62
|
+
var import_language_common2 = require("@openfn/language-common");
|
|
63
|
+
function execute(...operations) {
|
|
64
|
+
const initialState = {
|
|
65
|
+
references: [],
|
|
66
|
+
data: null
|
|
67
|
+
};
|
|
68
|
+
return (state) => {
|
|
69
|
+
return (0, import_language_common.execute)(...operations)({ ...initialState, ...state });
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function fetch(params) {
|
|
73
|
+
function assembleError({ response, error }) {
|
|
74
|
+
if (response && [200, 201, 202].indexOf(response.statusCode) > -1)
|
|
75
|
+
return false;
|
|
76
|
+
if (error)
|
|
77
|
+
return error;
|
|
78
|
+
return new Error(`Server responded with ${response.statusCode}`);
|
|
79
|
+
}
|
|
80
|
+
return (state) => {
|
|
81
|
+
const { email, password, consumerKey, secretKey } = state.configuration;
|
|
82
|
+
const { getEndpoint, queryParams, postUrl } = (0, import_language_common.expandReferences)(params)(state);
|
|
83
|
+
const query = import_qs.default.stringify(queryParams);
|
|
84
|
+
const getUrl = (0, import_url.resolve)(
|
|
85
|
+
"https://www.khanacademy.org/api/v1/",
|
|
86
|
+
getEndpoint + "?" + query
|
|
87
|
+
);
|
|
88
|
+
console.log("Fetching data from URL: " + getUrl);
|
|
89
|
+
var getTokenURL = "https://www.khanacademy.org/api/auth2/request_token";
|
|
90
|
+
var authorizeURL = "https://www.khanacademy.org/api/auth2/authorize";
|
|
91
|
+
var accessTokenUrl = "https://www.khanacademy.org/api/auth2/access_token";
|
|
92
|
+
var nativeOAuthOptions = {
|
|
93
|
+
consumer_key: consumerKey,
|
|
94
|
+
consumer_secret: secretKey
|
|
95
|
+
};
|
|
96
|
+
return new Promise((resolve, reject) => {
|
|
97
|
+
import_request.default.post(
|
|
98
|
+
{
|
|
99
|
+
url: getTokenURL,
|
|
100
|
+
oauth: nativeOAuthOptions
|
|
101
|
+
},
|
|
102
|
+
function(error, response, body) {
|
|
103
|
+
error = assembleError({ error, response });
|
|
104
|
+
if (error) {
|
|
105
|
+
console.error("Token request failed.... KHAAAAAAN!");
|
|
106
|
+
reject(error);
|
|
107
|
+
} else {
|
|
108
|
+
console.log("Token request successful.");
|
|
109
|
+
resolve(import_qs.default.parse(body));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}).then((body) => {
|
|
114
|
+
var auth = {
|
|
115
|
+
oauth_token: body.oauth_token,
|
|
116
|
+
oauth_token_secret: body.oauth_token_secret
|
|
117
|
+
};
|
|
118
|
+
var bodyParams = {
|
|
119
|
+
oauth_token: body.oauth_token,
|
|
120
|
+
identifier: email,
|
|
121
|
+
password
|
|
122
|
+
};
|
|
123
|
+
return new Promise((resolve, reject) => {
|
|
124
|
+
import_request.default.post(
|
|
125
|
+
{
|
|
126
|
+
followAllRedirects: true,
|
|
127
|
+
url: authorizeURL,
|
|
128
|
+
form: bodyParams
|
|
129
|
+
},
|
|
130
|
+
function(error, response, body2) {
|
|
131
|
+
error = assembleError({ error, response });
|
|
132
|
+
if (error) {
|
|
133
|
+
console.error("Token authorization failed... KHAAAAAAN!");
|
|
134
|
+
reject(error);
|
|
135
|
+
} else {
|
|
136
|
+
console.log("Token auhorization successful.");
|
|
137
|
+
resolve(auth);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
}).then((auth) => {
|
|
143
|
+
var hasToken = {
|
|
144
|
+
consumer_key: consumerKey,
|
|
145
|
+
consumer_secret: secretKey,
|
|
146
|
+
token: auth.oauth_token,
|
|
147
|
+
token_secret: auth.oauth_token_secret
|
|
148
|
+
};
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
import_request.default.get(
|
|
151
|
+
{
|
|
152
|
+
url: accessTokenUrl,
|
|
153
|
+
oauth: hasToken
|
|
154
|
+
},
|
|
155
|
+
function(error, response, body) {
|
|
156
|
+
error = assembleError({ error, response });
|
|
157
|
+
if (error) {
|
|
158
|
+
console.error("Token exchange failed.... KHAAAAAAN!");
|
|
159
|
+
reject(error);
|
|
160
|
+
} else {
|
|
161
|
+
console.log("Token exchange successful.");
|
|
162
|
+
resolve(import_qs.default.parse(body));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
});
|
|
167
|
+
}).then((body) => {
|
|
168
|
+
var hasAccess = {
|
|
169
|
+
consumer_key: consumerKey,
|
|
170
|
+
consumer_secret: secretKey,
|
|
171
|
+
token: body.oauth_token,
|
|
172
|
+
token_secret: body.oauth_token_secret
|
|
173
|
+
};
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
import_request.default.get(
|
|
176
|
+
{
|
|
177
|
+
url: getUrl,
|
|
178
|
+
oauth: hasAccess
|
|
179
|
+
},
|
|
180
|
+
function(error, response, body2) {
|
|
181
|
+
error = assembleError({ error, response });
|
|
182
|
+
if (error) {
|
|
183
|
+
console.error("GET failed.... KHAAAAAAN!");
|
|
184
|
+
reject(error);
|
|
185
|
+
} else {
|
|
186
|
+
console.log("GET succeeded.");
|
|
187
|
+
console.log(body2);
|
|
188
|
+
resolve(body2);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
}).then((body) => {
|
|
194
|
+
return new Promise((resolve, reject) => {
|
|
195
|
+
import_request.default.post(
|
|
196
|
+
{
|
|
197
|
+
url: postUrl,
|
|
198
|
+
json: JSON.parse(body)
|
|
199
|
+
},
|
|
200
|
+
function(error, response, body2) {
|
|
201
|
+
error = assembleError({ error, response });
|
|
202
|
+
if (error) {
|
|
203
|
+
console.error("POST failed.... KHAAAAAAN!");
|
|
204
|
+
reject(error);
|
|
205
|
+
} else {
|
|
206
|
+
console.log("POST succeeded.");
|
|
207
|
+
resolve(body2);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/index.js
|
|
217
|
+
var src_default = Adaptor_exports;
|
|
218
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
219
|
+
0 && (module.exports = {
|
|
220
|
+
alterState,
|
|
221
|
+
dataPath,
|
|
222
|
+
dataValue,
|
|
223
|
+
execute,
|
|
224
|
+
fetch,
|
|
225
|
+
field,
|
|
226
|
+
fields,
|
|
227
|
+
fn,
|
|
228
|
+
lastReferenceValue,
|
|
229
|
+
merge,
|
|
230
|
+
sourceValue
|
|
231
|
+
});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
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
|
+
alterState: () => alterState,
|
|
11
|
+
dataPath: () => dataPath,
|
|
12
|
+
dataValue: () => dataValue,
|
|
13
|
+
execute: () => execute,
|
|
14
|
+
fetch: () => fetch,
|
|
15
|
+
field: () => field,
|
|
16
|
+
fields: () => fields,
|
|
17
|
+
fn: () => fn,
|
|
18
|
+
lastReferenceValue: () => lastReferenceValue,
|
|
19
|
+
merge: () => merge,
|
|
20
|
+
sourceValue: () => sourceValue
|
|
21
|
+
});
|
|
22
|
+
import {
|
|
23
|
+
execute as commonExecute,
|
|
24
|
+
expandReferences
|
|
25
|
+
} from "@openfn/language-common";
|
|
26
|
+
import { resolve as resolveUrl } from "url";
|
|
27
|
+
import request from "request";
|
|
28
|
+
import qs from "qs";
|
|
29
|
+
import {
|
|
30
|
+
fn,
|
|
31
|
+
field,
|
|
32
|
+
sourceValue,
|
|
33
|
+
fields,
|
|
34
|
+
alterState,
|
|
35
|
+
merge,
|
|
36
|
+
dataPath,
|
|
37
|
+
dataValue,
|
|
38
|
+
lastReferenceValue
|
|
39
|
+
} from "@openfn/language-common";
|
|
40
|
+
function execute(...operations) {
|
|
41
|
+
const initialState = {
|
|
42
|
+
references: [],
|
|
43
|
+
data: null
|
|
44
|
+
};
|
|
45
|
+
return (state) => {
|
|
46
|
+
return commonExecute(...operations)({ ...initialState, ...state });
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function fetch(params) {
|
|
50
|
+
function assembleError({ response, error }) {
|
|
51
|
+
if (response && [200, 201, 202].indexOf(response.statusCode) > -1)
|
|
52
|
+
return false;
|
|
53
|
+
if (error)
|
|
54
|
+
return error;
|
|
55
|
+
return new Error(`Server responded with ${response.statusCode}`);
|
|
56
|
+
}
|
|
57
|
+
return (state) => {
|
|
58
|
+
const { email, password, consumerKey, secretKey } = state.configuration;
|
|
59
|
+
const { getEndpoint, queryParams, postUrl } = expandReferences(params)(state);
|
|
60
|
+
const query = qs.stringify(queryParams);
|
|
61
|
+
const getUrl = resolveUrl(
|
|
62
|
+
"https://www.khanacademy.org/api/v1/",
|
|
63
|
+
getEndpoint + "?" + query
|
|
64
|
+
);
|
|
65
|
+
console.log("Fetching data from URL: " + getUrl);
|
|
66
|
+
var getTokenURL = "https://www.khanacademy.org/api/auth2/request_token";
|
|
67
|
+
var authorizeURL = "https://www.khanacademy.org/api/auth2/authorize";
|
|
68
|
+
var accessTokenUrl = "https://www.khanacademy.org/api/auth2/access_token";
|
|
69
|
+
var nativeOAuthOptions = {
|
|
70
|
+
consumer_key: consumerKey,
|
|
71
|
+
consumer_secret: secretKey
|
|
72
|
+
};
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
request.post(
|
|
75
|
+
{
|
|
76
|
+
url: getTokenURL,
|
|
77
|
+
oauth: nativeOAuthOptions
|
|
78
|
+
},
|
|
79
|
+
function(error, response, body) {
|
|
80
|
+
error = assembleError({ error, response });
|
|
81
|
+
if (error) {
|
|
82
|
+
console.error("Token request failed.... KHAAAAAAN!");
|
|
83
|
+
reject(error);
|
|
84
|
+
} else {
|
|
85
|
+
console.log("Token request successful.");
|
|
86
|
+
resolve(qs.parse(body));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}).then((body) => {
|
|
91
|
+
var auth = {
|
|
92
|
+
oauth_token: body.oauth_token,
|
|
93
|
+
oauth_token_secret: body.oauth_token_secret
|
|
94
|
+
};
|
|
95
|
+
var bodyParams = {
|
|
96
|
+
oauth_token: body.oauth_token,
|
|
97
|
+
identifier: email,
|
|
98
|
+
password
|
|
99
|
+
};
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
request.post(
|
|
102
|
+
{
|
|
103
|
+
followAllRedirects: true,
|
|
104
|
+
url: authorizeURL,
|
|
105
|
+
form: bodyParams
|
|
106
|
+
},
|
|
107
|
+
function(error, response, body2) {
|
|
108
|
+
error = assembleError({ error, response });
|
|
109
|
+
if (error) {
|
|
110
|
+
console.error("Token authorization failed... KHAAAAAAN!");
|
|
111
|
+
reject(error);
|
|
112
|
+
} else {
|
|
113
|
+
console.log("Token auhorization successful.");
|
|
114
|
+
resolve(auth);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
}).then((auth) => {
|
|
120
|
+
var hasToken = {
|
|
121
|
+
consumer_key: consumerKey,
|
|
122
|
+
consumer_secret: secretKey,
|
|
123
|
+
token: auth.oauth_token,
|
|
124
|
+
token_secret: auth.oauth_token_secret
|
|
125
|
+
};
|
|
126
|
+
return new Promise((resolve, reject) => {
|
|
127
|
+
request.get(
|
|
128
|
+
{
|
|
129
|
+
url: accessTokenUrl,
|
|
130
|
+
oauth: hasToken
|
|
131
|
+
},
|
|
132
|
+
function(error, response, body) {
|
|
133
|
+
error = assembleError({ error, response });
|
|
134
|
+
if (error) {
|
|
135
|
+
console.error("Token exchange failed.... KHAAAAAAN!");
|
|
136
|
+
reject(error);
|
|
137
|
+
} else {
|
|
138
|
+
console.log("Token exchange successful.");
|
|
139
|
+
resolve(qs.parse(body));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
}).then((body) => {
|
|
145
|
+
var hasAccess = {
|
|
146
|
+
consumer_key: consumerKey,
|
|
147
|
+
consumer_secret: secretKey,
|
|
148
|
+
token: body.oauth_token,
|
|
149
|
+
token_secret: body.oauth_token_secret
|
|
150
|
+
};
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
request.get(
|
|
153
|
+
{
|
|
154
|
+
url: getUrl,
|
|
155
|
+
oauth: hasAccess
|
|
156
|
+
},
|
|
157
|
+
function(error, response, body2) {
|
|
158
|
+
error = assembleError({ error, response });
|
|
159
|
+
if (error) {
|
|
160
|
+
console.error("GET failed.... KHAAAAAAN!");
|
|
161
|
+
reject(error);
|
|
162
|
+
} else {
|
|
163
|
+
console.log("GET succeeded.");
|
|
164
|
+
console.log(body2);
|
|
165
|
+
resolve(body2);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
});
|
|
170
|
+
}).then((body) => {
|
|
171
|
+
return new Promise((resolve, reject) => {
|
|
172
|
+
request.post(
|
|
173
|
+
{
|
|
174
|
+
url: postUrl,
|
|
175
|
+
json: JSON.parse(body)
|
|
176
|
+
},
|
|
177
|
+
function(error, response, body2) {
|
|
178
|
+
error = assembleError({ error, response });
|
|
179
|
+
if (error) {
|
|
180
|
+
console.error("POST failed.... KHAAAAAAN!");
|
|
181
|
+
reject(error);
|
|
182
|
+
} else {
|
|
183
|
+
console.log("POST succeeded.");
|
|
184
|
+
resolve(body2);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/index.js
|
|
194
|
+
var src_default = Adaptor_exports;
|
|
195
|
+
export {
|
|
196
|
+
alterState,
|
|
197
|
+
dataPath,
|
|
198
|
+
dataValue,
|
|
199
|
+
src_default as default,
|
|
200
|
+
execute,
|
|
201
|
+
fetch,
|
|
202
|
+
field,
|
|
203
|
+
fields,
|
|
204
|
+
fn,
|
|
205
|
+
lastReferenceValue,
|
|
206
|
+
merge,
|
|
207
|
+
sourceValue
|
|
208
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openfn/language-khanacademy",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A Khan Academy Language Pack for OpenFn",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"author": "Open Function Group",
|
|
7
|
+
"license": "LGPLv3",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"types/",
|
|
11
|
+
"ast.json",
|
|
12
|
+
"configuration-schema.json"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@openfn/language-common": "^1.7.5",
|
|
16
|
+
"qs": "^6.11.0",
|
|
17
|
+
"request": "^2.88.2"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@openfn/buildtools": "^1.0.2",
|
|
21
|
+
"@openfn/simple-ast": "0.4.1",
|
|
22
|
+
"assertion-error": "^2.0.0",
|
|
23
|
+
"chai": "^4.3.7",
|
|
24
|
+
"deep-eql": "^4.1.2",
|
|
25
|
+
"esno": "^0.16.3",
|
|
26
|
+
"mocha": "^10.1.0",
|
|
27
|
+
"nock": "^13.2.9",
|
|
28
|
+
"rimraf": "^3.0.2"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/openfn/adaptors.git"
|
|
33
|
+
},
|
|
34
|
+
"type": "module",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"require": "./dist/index.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"types": "types/index.d.ts",
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "pnpm clean && build-adaptor khanacademy",
|
|
45
|
+
"test": "mocha --experimental-specifier-resolution=node --no-warnings",
|
|
46
|
+
"test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
|
|
47
|
+
"clean": "rimraf dist types docs",
|
|
48
|
+
"pack": "pnpm pack --pack-destination ../../dist"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @module Adaptor */
|
|
2
|
+
/**
|
|
3
|
+
* Execute a sequence of operations.
|
|
4
|
+
* Wraps `@openfn/language-common/execute`, and prepends initial state for khanacademy.
|
|
5
|
+
* @example
|
|
6
|
+
* execute(
|
|
7
|
+
* create('foo'),
|
|
8
|
+
* delete('bar')
|
|
9
|
+
* )(state)
|
|
10
|
+
* @constructor
|
|
11
|
+
* @param {Operations} operations - Operations to be performed.
|
|
12
|
+
* @returns {Operation}
|
|
13
|
+
*/
|
|
14
|
+
export function execute(...operations: Operations): Operation;
|
|
15
|
+
export class execute {
|
|
16
|
+
/** @module Adaptor */
|
|
17
|
+
/**
|
|
18
|
+
* Execute a sequence of operations.
|
|
19
|
+
* Wraps `@openfn/language-common/execute`, and prepends initial state for khanacademy.
|
|
20
|
+
* @example
|
|
21
|
+
* execute(
|
|
22
|
+
* create('foo'),
|
|
23
|
+
* delete('bar')
|
|
24
|
+
* )(state)
|
|
25
|
+
* @constructor
|
|
26
|
+
* @param {Operations} operations - Operations to be performed.
|
|
27
|
+
* @returns {Operation}
|
|
28
|
+
*/
|
|
29
|
+
constructor(...operations: Operations);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Fetch data from the Khan Academy API
|
|
33
|
+
* @example
|
|
34
|
+
* execute(
|
|
35
|
+
* fetch(params)
|
|
36
|
+
* )(state)
|
|
37
|
+
* @constructor
|
|
38
|
+
* @param {object} params - data to make the query
|
|
39
|
+
* @returns {Operation}
|
|
40
|
+
*/
|
|
41
|
+
export function fetch(params: object): Operation;
|
|
42
|
+
export class fetch {
|
|
43
|
+
/**
|
|
44
|
+
* Fetch data from the Khan Academy API
|
|
45
|
+
* @example
|
|
46
|
+
* execute(
|
|
47
|
+
* fetch(params)
|
|
48
|
+
* )(state)
|
|
49
|
+
* @constructor
|
|
50
|
+
* @param {object} params - data to make the query
|
|
51
|
+
* @returns {Operation}
|
|
52
|
+
*/
|
|
53
|
+
constructor(params: object);
|
|
54
|
+
}
|
|
55
|
+
export { fn, field, sourceValue, fields, alterState, merge, dataPath, dataValue, lastReferenceValue } from "@openfn/language-common";
|
package/types/index.d.ts
ADDED