@openfn/language-mogli 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 +52 -0
- package/ast.json +781 -0
- package/configuration-schema.json +48 -0
- package/dist/index.cjs +394 -0
- package/dist/index.js +380 -0
- package/package.json +55 -0
- package/types/Adaptor.d.ts +28 -0
- package/types/FakeAdaptor.d.ts +9 -0
- package/types/index.d.ts +5 -0
- package/types/sourceHelpers.d.ts +24 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
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
|
+
arrayToString: () => arrayToString,
|
|
12
|
+
beta: () => beta,
|
|
13
|
+
combine: () => combine,
|
|
14
|
+
createSMS: () => createSMS,
|
|
15
|
+
dataPath: () => dataPath,
|
|
16
|
+
dataValue: () => dataValue,
|
|
17
|
+
each: () => each,
|
|
18
|
+
execute: () => execute,
|
|
19
|
+
field: () => field2,
|
|
20
|
+
fields: () => fields,
|
|
21
|
+
index: () => index,
|
|
22
|
+
join: () => join,
|
|
23
|
+
lastReferenceValue: () => lastReferenceValue,
|
|
24
|
+
lookup: () => lookup,
|
|
25
|
+
map: () => map,
|
|
26
|
+
merge: () => merge,
|
|
27
|
+
reference: () => reference,
|
|
28
|
+
referencePath: () => referencePath,
|
|
29
|
+
relationship: () => relationship,
|
|
30
|
+
source: () => source,
|
|
31
|
+
sourceValue: () => sourceValue2,
|
|
32
|
+
steps: () => steps,
|
|
33
|
+
toArray: () => toArray,
|
|
34
|
+
updateSMS: () => updateSMS
|
|
35
|
+
});
|
|
36
|
+
import { execute as commonExecute } from "@openfn/language-common";
|
|
37
|
+
import jsforce from "jsforce";
|
|
38
|
+
import request from "request";
|
|
39
|
+
import pkg from "lodash-fp";
|
|
40
|
+
|
|
41
|
+
// src/sourceHelpers.js
|
|
42
|
+
import { sourceValue, field } from "@openfn/language-common";
|
|
43
|
+
function lookup(relationshipName, externalId, path) {
|
|
44
|
+
return field(relationshipName, (state) => {
|
|
45
|
+
return { [externalId]: sourceValue(path)(state) };
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function relationship(relationshipName, externalId, dataSource) {
|
|
49
|
+
return field(relationshipName, (state) => {
|
|
50
|
+
if (typeof dataSource == "function") {
|
|
51
|
+
return { [externalId]: dataSource(state) };
|
|
52
|
+
}
|
|
53
|
+
return { [externalId]: dataSource };
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/Adaptor.js
|
|
58
|
+
import {
|
|
59
|
+
each,
|
|
60
|
+
join,
|
|
61
|
+
fields,
|
|
62
|
+
field as field2,
|
|
63
|
+
source,
|
|
64
|
+
sourceValue as sourceValue2,
|
|
65
|
+
map,
|
|
66
|
+
combine,
|
|
67
|
+
merge,
|
|
68
|
+
dataPath,
|
|
69
|
+
dataValue,
|
|
70
|
+
referencePath,
|
|
71
|
+
lastReferenceValue,
|
|
72
|
+
index,
|
|
73
|
+
beta,
|
|
74
|
+
toArray,
|
|
75
|
+
arrayToString,
|
|
76
|
+
alterState
|
|
77
|
+
} from "@openfn/language-common";
|
|
78
|
+
var { curry, mapValues, flatten } = pkg;
|
|
79
|
+
var createSMS = curry(function(params, state) {
|
|
80
|
+
function assembleError({ response, error }) {
|
|
81
|
+
if (response && [200, 201, 202].indexOf(response.statusCode) > -1)
|
|
82
|
+
return false;
|
|
83
|
+
if (error)
|
|
84
|
+
return error;
|
|
85
|
+
return new Error(`Server responded with ${response.statusCode}`);
|
|
86
|
+
}
|
|
87
|
+
let { connection, references } = state;
|
|
88
|
+
const { loginUrl, secret } = state.configuration;
|
|
89
|
+
const body = expandReferences(state, params);
|
|
90
|
+
body.type = "Inbound";
|
|
91
|
+
console.log("Creating new inbound message in Mogli:");
|
|
92
|
+
console.log("======================================");
|
|
93
|
+
console.log(" URL: " + url + '" \n');
|
|
94
|
+
console.log(" Sender phone number: " + body.sender);
|
|
95
|
+
console.log(' Message content: "' + body.message + '" \n');
|
|
96
|
+
const url = connection.instanceUrl.concat(
|
|
97
|
+
"/services/apexrest/Mogli_SMS/v1/sms"
|
|
98
|
+
);
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
request.post(
|
|
101
|
+
{
|
|
102
|
+
url,
|
|
103
|
+
auth: {
|
|
104
|
+
bearer: connection.accessToken
|
|
105
|
+
},
|
|
106
|
+
headers: {
|
|
107
|
+
"x-api-key": secret
|
|
108
|
+
},
|
|
109
|
+
json: body
|
|
110
|
+
},
|
|
111
|
+
function(error, response, postResponseBody) {
|
|
112
|
+
error = assembleError({ error, response });
|
|
113
|
+
if (error) {
|
|
114
|
+
console.error("POST failed.");
|
|
115
|
+
reject(error);
|
|
116
|
+
} else {
|
|
117
|
+
console.log("POST succeeded.");
|
|
118
|
+
resolve(body);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}).then(function(recordResult) {
|
|
123
|
+
console.log("Result : " + JSON.stringify(recordResult));
|
|
124
|
+
return {
|
|
125
|
+
...state,
|
|
126
|
+
references: [recordResult, ...state.references]
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
var updateSMS = curry(function(params, state) {
|
|
131
|
+
function assembleError({ response, error }) {
|
|
132
|
+
if (response && [200, 201, 202].indexOf(response.statusCode) > -1)
|
|
133
|
+
return false;
|
|
134
|
+
if (error)
|
|
135
|
+
return error;
|
|
136
|
+
return new Error(`Server responded with ${response.statusCode}`);
|
|
137
|
+
}
|
|
138
|
+
let { connection, references } = state;
|
|
139
|
+
const { loginUrl } = state.configuration;
|
|
140
|
+
const body = expandReferences(state, params);
|
|
141
|
+
console.log("Updating SMS message status in Mogli:");
|
|
142
|
+
console.log("=====================================");
|
|
143
|
+
console.log(" URL: " + url + '" \n');
|
|
144
|
+
console.log(" Message Id: " + body.Id);
|
|
145
|
+
console.log(' Message Status: "' + body.status + '" \n');
|
|
146
|
+
const url = connection.instanceUrl.concat(
|
|
147
|
+
"/services/apexrest/Mogli_SMS/v1/sms"
|
|
148
|
+
);
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
request.put(
|
|
151
|
+
{
|
|
152
|
+
url,
|
|
153
|
+
auth: {
|
|
154
|
+
bearer: connection.accessToken
|
|
155
|
+
},
|
|
156
|
+
json: body
|
|
157
|
+
},
|
|
158
|
+
function(error, response, postResponseBody) {
|
|
159
|
+
error = assembleError({ error, response });
|
|
160
|
+
if (error) {
|
|
161
|
+
console.error("POST failed.");
|
|
162
|
+
reject(error);
|
|
163
|
+
} else {
|
|
164
|
+
console.log("POST succeeded.");
|
|
165
|
+
resolve(body);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}).then(function(recordResult) {
|
|
170
|
+
console.log("Result : " + JSON.stringify(recordResult));
|
|
171
|
+
return {
|
|
172
|
+
...state,
|
|
173
|
+
references: [recordResult, ...state.references]
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
var reference = curry(function(position, { references }) {
|
|
178
|
+
return references[position].id;
|
|
179
|
+
});
|
|
180
|
+
function createConnection(state) {
|
|
181
|
+
const { loginUrl } = state.configuration;
|
|
182
|
+
if (!loginUrl) {
|
|
183
|
+
throw new Error("loginUrl missing from configuration.");
|
|
184
|
+
}
|
|
185
|
+
return { ...state, connection: new jsforce.Connection({ loginUrl }) };
|
|
186
|
+
}
|
|
187
|
+
function login(state) {
|
|
188
|
+
const { username, password, securityToken } = state.configuration;
|
|
189
|
+
let { connection } = state;
|
|
190
|
+
console.info(`Logging in as ${username}.`);
|
|
191
|
+
return connection.login(username, password + securityToken).then(() => state);
|
|
192
|
+
}
|
|
193
|
+
function execute(...operations) {
|
|
194
|
+
const initialState = {
|
|
195
|
+
logger: {
|
|
196
|
+
info: console.info.bind(console),
|
|
197
|
+
debug: console.log.bind(console)
|
|
198
|
+
},
|
|
199
|
+
references: [],
|
|
200
|
+
data: null,
|
|
201
|
+
configuration: {}
|
|
202
|
+
};
|
|
203
|
+
return (state) => {
|
|
204
|
+
return commonExecute(
|
|
205
|
+
createConnection,
|
|
206
|
+
login,
|
|
207
|
+
...flatten(operations),
|
|
208
|
+
cleanupState
|
|
209
|
+
)({ ...initialState, ...state });
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function cleanupState(state) {
|
|
213
|
+
delete state.connection;
|
|
214
|
+
return state;
|
|
215
|
+
}
|
|
216
|
+
function steps(...operations) {
|
|
217
|
+
return flatten(operations);
|
|
218
|
+
}
|
|
219
|
+
function expandReferences(state, attrs) {
|
|
220
|
+
return mapValues(function(value) {
|
|
221
|
+
return typeof value == "function" ? value(state) : value;
|
|
222
|
+
})(attrs);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// src/FakeAdaptor.js
|
|
226
|
+
var FakeAdaptor_exports = {};
|
|
227
|
+
__export(FakeAdaptor_exports, {
|
|
228
|
+
arrayToString: () => arrayToString2,
|
|
229
|
+
beta: () => beta2,
|
|
230
|
+
combine: () => combine2,
|
|
231
|
+
create: () => create,
|
|
232
|
+
dataPath: () => dataPath2,
|
|
233
|
+
dataValue: () => dataValue2,
|
|
234
|
+
each: () => each2,
|
|
235
|
+
execute: () => execute2,
|
|
236
|
+
field: () => field3,
|
|
237
|
+
fields: () => fields2,
|
|
238
|
+
index: () => index2,
|
|
239
|
+
join: () => join2,
|
|
240
|
+
lastReferenceValue: () => lastReferenceValue2,
|
|
241
|
+
lookup: () => lookup,
|
|
242
|
+
map: () => map2,
|
|
243
|
+
merge: () => merge2,
|
|
244
|
+
reference: () => reference2,
|
|
245
|
+
referencePath: () => referencePath2,
|
|
246
|
+
relationship: () => relationship,
|
|
247
|
+
source: () => source2,
|
|
248
|
+
sourceValue: () => sourceValue3,
|
|
249
|
+
steps: () => steps2,
|
|
250
|
+
toArray: () => toArray2,
|
|
251
|
+
update: () => update,
|
|
252
|
+
upsert: () => upsert
|
|
253
|
+
});
|
|
254
|
+
import { execute as commonExecute2 } from "@openfn/language-common";
|
|
255
|
+
import pkg2 from "lodash-fp";
|
|
256
|
+
import {
|
|
257
|
+
each as each2,
|
|
258
|
+
join as join2,
|
|
259
|
+
fields as fields2,
|
|
260
|
+
field as field3,
|
|
261
|
+
source as source2,
|
|
262
|
+
sourceValue as sourceValue3,
|
|
263
|
+
map as map2,
|
|
264
|
+
combine as combine2,
|
|
265
|
+
merge as merge2,
|
|
266
|
+
dataPath as dataPath2,
|
|
267
|
+
dataValue as dataValue2,
|
|
268
|
+
referencePath as referencePath2,
|
|
269
|
+
lastReferenceValue as lastReferenceValue2,
|
|
270
|
+
index as index2,
|
|
271
|
+
beta as beta2,
|
|
272
|
+
toArray as toArray2,
|
|
273
|
+
arrayToString as arrayToString2
|
|
274
|
+
} from "@openfn/language-common";
|
|
275
|
+
var { curry: curry2, mapValues: mapValues2, flatten: flatten2 } = pkg2;
|
|
276
|
+
function steps2(...operations) {
|
|
277
|
+
return flatten2(operations);
|
|
278
|
+
}
|
|
279
|
+
function expandReferences2(attrs, state) {
|
|
280
|
+
return mapValues2(function(value) {
|
|
281
|
+
return typeof value == "function" ? value(state) : value;
|
|
282
|
+
})(attrs);
|
|
283
|
+
}
|
|
284
|
+
function create(sObject, fields3) {
|
|
285
|
+
return (state) => {
|
|
286
|
+
state.logger.debug(`Creating ${sObject}`);
|
|
287
|
+
state.logger.debug(JSON.stringify(state.data, null, 2));
|
|
288
|
+
state.logger.debug("===================");
|
|
289
|
+
let id = state.references.length + 1;
|
|
290
|
+
let result = { sObject, fields: expandReferences2(fields3, state), id };
|
|
291
|
+
return {
|
|
292
|
+
...state,
|
|
293
|
+
references: [result, ...state.references]
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
function update(sObject, fields3) {
|
|
298
|
+
return (state) => {
|
|
299
|
+
state.logger.debug(`Updating ${sObject}`);
|
|
300
|
+
state.logger.debug(JSON.stringify(state.data, null, 2));
|
|
301
|
+
state.logger.debug("===================");
|
|
302
|
+
let id = state.references.length + 1;
|
|
303
|
+
let result = { sObject, fields: expandReferences2(fields3, state), id };
|
|
304
|
+
return {
|
|
305
|
+
...state,
|
|
306
|
+
references: [result, ...state.references]
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function upsert(sObject, externalId, fields3) {
|
|
311
|
+
return (state) => {
|
|
312
|
+
state.logger.debug(`Upserting ${sObject} with externalId:`, externalId);
|
|
313
|
+
state.logger.debug(JSON.stringify(state.data, null, 2));
|
|
314
|
+
state.logger.debug("===================");
|
|
315
|
+
let id = state.references.length + 1;
|
|
316
|
+
let result = { sObject, fields: expandReferences2(fields3, state), id };
|
|
317
|
+
return {
|
|
318
|
+
...state,
|
|
319
|
+
references: [result, ...state.references]
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
var reference2 = curry2(function(position, { references }) {
|
|
324
|
+
return references[position].id;
|
|
325
|
+
});
|
|
326
|
+
function execute2(...operations) {
|
|
327
|
+
const initialState = {
|
|
328
|
+
logger: {
|
|
329
|
+
info: console.info.bind(console),
|
|
330
|
+
debug: console.log.bind(console)
|
|
331
|
+
},
|
|
332
|
+
references: [],
|
|
333
|
+
data: null
|
|
334
|
+
};
|
|
335
|
+
return (state) => {
|
|
336
|
+
return commonExecute2(...flatten2(operations), function(state2) {
|
|
337
|
+
delete state2.connection;
|
|
338
|
+
return state2;
|
|
339
|
+
})({ ...initialState, ...state }).then(function(state2) {
|
|
340
|
+
state2.logger.info(JSON.stringify(state2.references, null, 2));
|
|
341
|
+
console.info("Finished Successfully");
|
|
342
|
+
return state2;
|
|
343
|
+
}).catch(function(err) {
|
|
344
|
+
console.error(err.stack);
|
|
345
|
+
console.info("Job failed.");
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// src/index.js
|
|
351
|
+
var src_default = Adaptor_exports;
|
|
352
|
+
export {
|
|
353
|
+
FakeAdaptor_exports as FakeAdaptor,
|
|
354
|
+
alterState,
|
|
355
|
+
arrayToString,
|
|
356
|
+
beta,
|
|
357
|
+
combine,
|
|
358
|
+
createSMS,
|
|
359
|
+
dataPath,
|
|
360
|
+
dataValue,
|
|
361
|
+
src_default as default,
|
|
362
|
+
each,
|
|
363
|
+
execute,
|
|
364
|
+
field2 as field,
|
|
365
|
+
fields,
|
|
366
|
+
index,
|
|
367
|
+
join,
|
|
368
|
+
lastReferenceValue,
|
|
369
|
+
lookup,
|
|
370
|
+
map,
|
|
371
|
+
merge,
|
|
372
|
+
reference,
|
|
373
|
+
referencePath,
|
|
374
|
+
relationship,
|
|
375
|
+
source,
|
|
376
|
+
sourceValue2 as sourceValue,
|
|
377
|
+
steps,
|
|
378
|
+
toArray,
|
|
379
|
+
updateSMS
|
|
380
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openfn/language-mogli",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A Mogli SMS 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
|
+
"JSONPath": "^0.10.0",
|
|
17
|
+
"jsforce": "1.5.1",
|
|
18
|
+
"lodash-fp": "^0.10.4",
|
|
19
|
+
"mustache": "^2.3.2",
|
|
20
|
+
"request": "^2.88.2",
|
|
21
|
+
"yargs": "^3.32.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@openfn/buildtools": "^1.0.2",
|
|
25
|
+
"@openfn/simple-ast": "0.4.1",
|
|
26
|
+
"assertion-error": "^2.0.0",
|
|
27
|
+
"chai": "^4.3.7",
|
|
28
|
+
"deep-eql": "^0.1.3",
|
|
29
|
+
"esno": "^0.16.3",
|
|
30
|
+
"mocha": "^10.1.0",
|
|
31
|
+
"rimraf": "^3.0.2",
|
|
32
|
+
"sinon": "^14.0.2",
|
|
33
|
+
"type-detect": "^4.0.8"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/openfn/adaptors.git"
|
|
38
|
+
},
|
|
39
|
+
"type": "module",
|
|
40
|
+
"exports": {
|
|
41
|
+
".": {
|
|
42
|
+
"import": "./dist/index.js",
|
|
43
|
+
"require": "./dist/index.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"types": "types/index.d.ts",
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "pnpm clean && build-adaptor mogli",
|
|
50
|
+
"test": "mocha --experimental-specifier-resolution=node --no-warnings",
|
|
51
|
+
"test:watch": "mocha -w --experimental-specifier-resolution=node --no-warnings",
|
|
52
|
+
"clean": "rimraf dist types docs",
|
|
53
|
+
"pack": "pnpm pack --pack-destination ../../dist"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function execute(...operations: any[]): (state: any) => any;
|
|
2
|
+
export function steps(...operations: any[]): any;
|
|
3
|
+
/** @module Adaptor */
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} State
|
|
6
|
+
* @property {object} data JSON Data.
|
|
7
|
+
* @property {Array<Reference>} references History of all previous operations.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Function} Operation
|
|
11
|
+
* @param {State} state
|
|
12
|
+
*/
|
|
13
|
+
export const createSMS: any;
|
|
14
|
+
export const updateSMS: any;
|
|
15
|
+
export const reference: any;
|
|
16
|
+
export type State = {
|
|
17
|
+
/**
|
|
18
|
+
* JSON Data.
|
|
19
|
+
*/
|
|
20
|
+
data: object;
|
|
21
|
+
/**
|
|
22
|
+
* History of all previous operations.
|
|
23
|
+
*/
|
|
24
|
+
references: Array<Reference>;
|
|
25
|
+
};
|
|
26
|
+
export type Operation = Function;
|
|
27
|
+
export { lookup, relationship } from "./sourceHelpers";
|
|
28
|
+
export { each, join, fields, field, source, sourceValue, map, combine, merge, dataPath, dataValue, referencePath, lastReferenceValue, index, beta, toArray, arrayToString, alterState } from "@openfn/language-common";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function create(sObject: any, fields: any): (state: any) => any;
|
|
2
|
+
export function execute(...operations: any[]): (state: any) => any;
|
|
3
|
+
export const reference: any;
|
|
4
|
+
/** @module FakeAdaptor */
|
|
5
|
+
export function steps(...operations: any[]): any;
|
|
6
|
+
export function update(sObject: any, fields: any): (state: any) => any;
|
|
7
|
+
export function upsert(sObject: any, externalId: any, fields: any): (state: any) => any;
|
|
8
|
+
export { lookup, relationship } from "./sourceHelpers";
|
|
9
|
+
export { each, join, fields, field, source, sourceValue, map, combine, merge, dataPath, dataValue, referencePath, lastReferenceValue, index, beta, toArray, arrayToString } from "@openfn/language-common";
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds a lookup or 'dome insert' to a record.
|
|
3
|
+
* @example <caption>Example</caption>
|
|
4
|
+
* lookup("relationship_name__r", "externalID on related object", "$.path")
|
|
5
|
+
* @function
|
|
6
|
+
* @param {string} relationshipName - `__r` relationship field on the record.
|
|
7
|
+
* @param {string} externalID - Salesforce ExternalID field.
|
|
8
|
+
* @param {string} path - JSONPath to data source.
|
|
9
|
+
* @returns {object}
|
|
10
|
+
*/
|
|
11
|
+
export function lookup(relationshipName: string, externalId: any, path: string): object;
|
|
12
|
+
/**
|
|
13
|
+
* Adds a lookup or 'dome insert' to a record.
|
|
14
|
+
* @example <caption>Data Sourced Value</caption>
|
|
15
|
+
* relationship("relationship_name__r", "externalID on related object", dataSource("path"))
|
|
16
|
+
* @example <caption>Fixed Value</caption>
|
|
17
|
+
* relationship("relationship_name__r", "externalID on related object", "hello world")
|
|
18
|
+
* @function
|
|
19
|
+
* @param {string} relationshipName - `__r` relationship field on the record.
|
|
20
|
+
* @param {string} externalID - Salesforce ExternalID field.
|
|
21
|
+
* @param {string} dataSource - resolvable source.
|
|
22
|
+
* @returns {object}
|
|
23
|
+
*/
|
|
24
|
+
export function relationship(relationshipName: string, externalId: any, dataSource: string): object;
|