@bonsae/node-red-salesforce 0.3.0 → 0.4.1
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/index.d.ts +47 -36
- package/index.html +1 -1
- package/index.mjs +154 -154
- package/index.mjs.map +1 -1
- package/locales/de/index.html +18 -16
- package/locales/de/index.json +90 -34
- package/locales/en-US/index.html +18 -16
- package/locales/en-US/index.json +91 -35
- package/locales/es-ES/index.html +18 -16
- package/locales/es-ES/index.json +90 -34
- package/locales/fr/index.html +18 -16
- package/locales/fr/index.json +90 -34
- package/locales/ja/index.html +18 -16
- package/locales/ja/index.json +90 -34
- package/locales/ko/index.html +18 -16
- package/locales/ko/index.json +90 -34
- package/locales/pt-BR/index.html +18 -16
- package/locales/pt-BR/index.json +90 -34
- package/locales/ru/index.html +18 -16
- package/locales/ru/index.json +90 -34
- package/locales/zh-CN/index.html +18 -16
- package/locales/zh-CN/index.json +90 -34
- package/locales/zh-TW/index.html +18 -16
- package/locales/zh-TW/index.json +90 -34
- package/package.json +2 -2
- package/resources/index.FDBQSjT7.js +1 -0
- package/resources/index.e3npw131.js +0 -1
package/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (a, o) =>
|
|
4
|
-
var
|
|
1
|
+
var z = Object.defineProperty;
|
|
2
|
+
var H = (a, o, n) => o in a ? z(a, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[o] = n;
|
|
3
|
+
var f = (a, o) => z(a, "name", { value: o, configurable: !0 });
|
|
4
|
+
var r = (a, o, n) => H(a, typeof o != "symbol" ? o + "" : o, n);
|
|
5
5
|
import { fileURLToPath as q } from "url";
|
|
6
6
|
import { dirname as J } from "path";
|
|
7
7
|
import { registerTypes as G } from "@bonsae/nrg/server";
|
|
8
|
-
import { defineSchema as h, SchemaType as e, ConfigNode as Q, IONode as
|
|
8
|
+
import { defineSchema as h, SchemaType as e, ConfigNode as Q, IONode as k, defineModule as Y } from "@bonsae/nrg/server";
|
|
9
9
|
import K from "jsforce";
|
|
10
|
-
import
|
|
10
|
+
import N from "node:crypto";
|
|
11
11
|
var V = q(import.meta.url), Ae = J(V);
|
|
12
12
|
const W = h(
|
|
13
13
|
{
|
|
@@ -48,18 +48,18 @@ const W = h(
|
|
|
48
48
|
instanceUrl: e.String({ default: "" })
|
|
49
49
|
},
|
|
50
50
|
{ $id: "salesforce-connection:credentials" }
|
|
51
|
-
),
|
|
51
|
+
), B = 600 * 1e3, U = /* @__PURE__ */ new Map();
|
|
52
52
|
function Z() {
|
|
53
|
-
return
|
|
53
|
+
return N.randomBytes(32).toString("base64url");
|
|
54
54
|
}
|
|
55
55
|
f(Z, "generateCodeVerifier");
|
|
56
56
|
function D(a) {
|
|
57
|
-
return
|
|
57
|
+
return N.createHash("sha256").update(a).digest("base64url");
|
|
58
58
|
}
|
|
59
59
|
f(D, "generateCodeChallenge");
|
|
60
60
|
function _(a) {
|
|
61
|
-
const o =
|
|
62
|
-
|
|
61
|
+
const o = N.randomUUID(), n = Z(), t = D(n);
|
|
62
|
+
U.set(o, {
|
|
63
63
|
codeVerifier: n,
|
|
64
64
|
nodeId: a.nodeId,
|
|
65
65
|
clientId: a.clientId,
|
|
@@ -67,25 +67,25 @@ function _(a) {
|
|
|
67
67
|
callbackUrl: a.callbackUrl,
|
|
68
68
|
timestamp: Date.now()
|
|
69
69
|
});
|
|
70
|
-
for (const [
|
|
71
|
-
Date.now() -
|
|
70
|
+
for (const [s, i] of U)
|
|
71
|
+
Date.now() - i.timestamp > B && U.delete(s);
|
|
72
72
|
return { state: o, codeChallenge: t };
|
|
73
73
|
}
|
|
74
74
|
f(_, "createAuthState");
|
|
75
75
|
function ee(a) {
|
|
76
|
-
const o =
|
|
77
|
-
return !o || (
|
|
76
|
+
const o = U.get(a);
|
|
77
|
+
return !o || (U.delete(a), Date.now() - o.timestamp > B) ? null : o;
|
|
78
78
|
}
|
|
79
79
|
f(ee, "consumeAuthState");
|
|
80
80
|
function te(a) {
|
|
81
81
|
return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
82
82
|
}
|
|
83
83
|
f(te, "escapeHtml");
|
|
84
|
-
function
|
|
84
|
+
function A(a, o = !0) {
|
|
85
85
|
const n = o ? "<script>setTimeout(function(){window.close()},3000)</script>" : "";
|
|
86
86
|
return `<html><body><h2>Authorization Failed</h2><p>${te(a)}</p>${n}</body></html>`;
|
|
87
87
|
}
|
|
88
|
-
f(
|
|
88
|
+
f(A, "errorPage");
|
|
89
89
|
function ne(a) {
|
|
90
90
|
const o = (a.settings.httpAdminRoot || "").replace(
|
|
91
91
|
/\/$/,
|
|
@@ -94,19 +94,19 @@ function ne(a) {
|
|
|
94
94
|
a.httpAdmin.post("/salesforce/auth/start", (n, t) => {
|
|
95
95
|
try {
|
|
96
96
|
const {
|
|
97
|
-
nodeId:
|
|
98
|
-
loginUrl:
|
|
97
|
+
nodeId: s,
|
|
98
|
+
loginUrl: i,
|
|
99
99
|
clientId: l,
|
|
100
100
|
callbackUrl: d
|
|
101
101
|
} = n.body;
|
|
102
|
-
if (!
|
|
102
|
+
if (!s || !i || !l) {
|
|
103
103
|
t.status(400).json({ error: "nodeId, loginUrl, and clientId are required" });
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
const c = d || `${n.protocol}://${n.get("host")}${o}/salesforce/auth/callback`, { state: g, codeChallenge: u } = _({
|
|
107
|
-
nodeId:
|
|
107
|
+
nodeId: s,
|
|
108
108
|
clientId: l,
|
|
109
|
-
loginUrl:
|
|
109
|
+
loginUrl: i,
|
|
110
110
|
callbackUrl: c
|
|
111
111
|
}), m = new URLSearchParams({
|
|
112
112
|
response_type: "code",
|
|
@@ -117,30 +117,30 @@ function ne(a) {
|
|
|
117
117
|
code_challenge_method: "S256"
|
|
118
118
|
});
|
|
119
119
|
t.json({
|
|
120
|
-
authorizationUrl: `${
|
|
120
|
+
authorizationUrl: `${i}/services/oauth2/authorize?${m.toString()}`
|
|
121
121
|
});
|
|
122
|
-
} catch (
|
|
122
|
+
} catch (s) {
|
|
123
123
|
a.log.error(
|
|
124
|
-
`salesforce-connection: auth/start error: ${
|
|
124
|
+
`salesforce-connection: auth/start error: ${s instanceof Error ? s.message : String(s)}`
|
|
125
125
|
), t.status(500).json({ error: "Failed to start authorization" });
|
|
126
126
|
}
|
|
127
127
|
}), a.httpAdmin.get("/salesforce/auth/callback", async (n, t) => {
|
|
128
128
|
try {
|
|
129
|
-
const { code:
|
|
129
|
+
const { code: s, state: i, error: l, error_description: d } = n.query;
|
|
130
130
|
if (l) {
|
|
131
131
|
a.log.error(
|
|
132
132
|
`salesforce-connection: OAuth error: ${l} - ${d}`
|
|
133
|
-
), t.status(400).send(
|
|
133
|
+
), t.status(400).send(A(String(d || l)));
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
if (!
|
|
137
|
-
t.status(400).send(
|
|
136
|
+
if (!s || !i) {
|
|
137
|
+
t.status(400).send(A("Missing code or state parameter"));
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
const c = ee(
|
|
140
|
+
const c = ee(i);
|
|
141
141
|
if (!c) {
|
|
142
142
|
t.status(400).send(
|
|
143
|
-
|
|
143
|
+
A(
|
|
144
144
|
"Invalid or expired authorization state. Please try again."
|
|
145
145
|
)
|
|
146
146
|
);
|
|
@@ -153,7 +153,7 @@ function ne(a) {
|
|
|
153
153
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
154
154
|
body: new URLSearchParams({
|
|
155
155
|
grant_type: "authorization_code",
|
|
156
|
-
code:
|
|
156
|
+
code: s,
|
|
157
157
|
client_id: c.clientId,
|
|
158
158
|
redirect_uri: c.callbackUrl,
|
|
159
159
|
code_verifier: c.codeVerifier
|
|
@@ -165,7 +165,7 @@ function ne(a) {
|
|
|
165
165
|
a.log.error(
|
|
166
166
|
`salesforce-connection: Token exchange failed: ${p}`
|
|
167
167
|
), t.status(500).send(
|
|
168
|
-
|
|
168
|
+
A(
|
|
169
169
|
"Token exchange failed. Check the Node-RED logs for details."
|
|
170
170
|
)
|
|
171
171
|
);
|
|
@@ -199,17 +199,17 @@ function ne(a) {
|
|
|
199
199
|
</script>
|
|
200
200
|
</body>
|
|
201
201
|
</html>`);
|
|
202
|
-
} catch (
|
|
202
|
+
} catch (s) {
|
|
203
203
|
a.log.error(
|
|
204
|
-
`salesforce-connection: auth/callback error: ${
|
|
205
|
-
), t.status(500).send(
|
|
204
|
+
`salesforce-connection: auth/callback error: ${s instanceof Error ? s.message : String(s)}`
|
|
205
|
+
), t.status(500).send(A("An unexpected error occurred."));
|
|
206
206
|
}
|
|
207
207
|
}), a.httpAdmin.get("/salesforce/auth/status/:nodeId", (n, t) => {
|
|
208
208
|
try {
|
|
209
|
-
const
|
|
209
|
+
const s = a.nodes.getCredentials(n.params.nodeId), i = !!(s != null && s.accessToken && (s != null && s.instanceUrl));
|
|
210
210
|
t.json({
|
|
211
|
-
authenticated:
|
|
212
|
-
instanceUrl:
|
|
211
|
+
authenticated: i,
|
|
212
|
+
instanceUrl: i ? s.instanceUrl : void 0
|
|
213
213
|
});
|
|
214
214
|
} catch {
|
|
215
215
|
t.json({ authenticated: !1 });
|
|
@@ -224,7 +224,7 @@ f(oe, "initRoutes");
|
|
|
224
224
|
const L = class L extends Q {
|
|
225
225
|
constructor() {
|
|
226
226
|
super(...arguments);
|
|
227
|
-
|
|
227
|
+
r(this, "conn", null);
|
|
228
228
|
}
|
|
229
229
|
static async registered(n) {
|
|
230
230
|
oe(n);
|
|
@@ -264,9 +264,9 @@ const L = class L extends Q {
|
|
|
264
264
|
this.conn = null;
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
-
f(L, "SalesforceConnection"),
|
|
267
|
+
f(L, "SalesforceConnection"), r(L, "type", "salesforce-connection"), r(L, "configSchema", W), r(L, "credentialsSchema", X);
|
|
268
268
|
let $ = L;
|
|
269
|
-
const
|
|
269
|
+
const re = h(
|
|
270
270
|
{
|
|
271
271
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
272
272
|
connection: e.NodeRef($, {
|
|
@@ -277,7 +277,10 @@ const ie = h(
|
|
|
277
277
|
icon: "search",
|
|
278
278
|
typedInputTypes: ["str", "msg", "flow", "global"]
|
|
279
279
|
}
|
|
280
|
-
})
|
|
280
|
+
}),
|
|
281
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
282
|
+
completePort: e.Boolean({ default: !1 }),
|
|
283
|
+
statusPort: e.Boolean({ default: !1 })
|
|
281
284
|
},
|
|
282
285
|
{ $id: "salesforce-soql:config" }
|
|
283
286
|
), se = h(
|
|
@@ -285,14 +288,14 @@ const ie = h(
|
|
|
285
288
|
payload: e.Any()
|
|
286
289
|
},
|
|
287
290
|
{ $id: "salesforce-soql:input" }
|
|
288
|
-
),
|
|
291
|
+
), ie = h(
|
|
289
292
|
{
|
|
290
293
|
payload: e.Array(e.Any()),
|
|
291
294
|
totalSize: e.Number(),
|
|
292
295
|
done: e.Boolean()
|
|
293
296
|
},
|
|
294
297
|
{ $id: "salesforce-soql:output" }
|
|
295
|
-
), y = class y extends
|
|
298
|
+
), y = class y extends k {
|
|
296
299
|
async input(o) {
|
|
297
300
|
const n = this.config.connection;
|
|
298
301
|
if (!n) {
|
|
@@ -301,16 +304,16 @@ const ie = h(
|
|
|
301
304
|
}
|
|
302
305
|
try {
|
|
303
306
|
this.status({ fill: "green", shape: "dot", text: "querying..." });
|
|
304
|
-
const t = await n.getConnection(),
|
|
307
|
+
const t = await n.getConnection(), s = await this.config.query.resolve(o), i = await t.query(s);
|
|
305
308
|
this.status({
|
|
306
309
|
fill: "green",
|
|
307
310
|
shape: "dot",
|
|
308
|
-
text: `${
|
|
311
|
+
text: `${i.totalSize} records`
|
|
309
312
|
}), this.send({
|
|
310
313
|
...o,
|
|
311
|
-
payload:
|
|
312
|
-
totalSize:
|
|
313
|
-
done:
|
|
314
|
+
payload: i.records,
|
|
315
|
+
totalSize: i.totalSize,
|
|
316
|
+
done: i.done
|
|
314
317
|
});
|
|
315
318
|
} catch (t) {
|
|
316
319
|
this.status({
|
|
@@ -324,8 +327,8 @@ const ie = h(
|
|
|
324
327
|
}
|
|
325
328
|
}
|
|
326
329
|
};
|
|
327
|
-
f(y, "SalesforceSoql"),
|
|
328
|
-
let
|
|
330
|
+
f(y, "SalesforceSoql"), r(y, "type", "salesforce-soql"), r(y, "category", "salesforce"), r(y, "color", "#FFFFFF"), r(y, "configSchema", re), r(y, "inputSchema", se), r(y, "outputsSchema", ie);
|
|
331
|
+
let E = y;
|
|
329
332
|
const ae = h(
|
|
330
333
|
{
|
|
331
334
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
@@ -360,9 +363,9 @@ const ae = h(
|
|
|
360
363
|
"x-nrg-form": { icon: "key" }
|
|
361
364
|
})
|
|
362
365
|
),
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
367
|
+
completePort: e.Boolean({ default: !1 }),
|
|
368
|
+
statusPort: e.Boolean({ default: !1 })
|
|
366
369
|
},
|
|
367
370
|
{
|
|
368
371
|
$id: "salesforce-dml:config",
|
|
@@ -388,7 +391,7 @@ const ae = h(
|
|
|
388
391
|
payload: e.Any()
|
|
389
392
|
},
|
|
390
393
|
{ $id: "salesforce-dml:output" }
|
|
391
|
-
), x = class x extends
|
|
394
|
+
), x = class x extends k {
|
|
392
395
|
async input(o) {
|
|
393
396
|
const n = this.config.connection;
|
|
394
397
|
if (!n) {
|
|
@@ -398,7 +401,7 @@ const ae = h(
|
|
|
398
401
|
try {
|
|
399
402
|
const t = this.config.operation;
|
|
400
403
|
this.status({ fill: "green", shape: "dot", text: `${t}...` });
|
|
401
|
-
const
|
|
404
|
+
const s = await n.getConnection(), i = await this.config.sObjectType.resolve(o), l = s.sobject(i), d = await this.config.record.resolve(o) ?? o.payload;
|
|
402
405
|
let c;
|
|
403
406
|
switch (t) {
|
|
404
407
|
case "create":
|
|
@@ -432,8 +435,8 @@ const ae = h(
|
|
|
432
435
|
}
|
|
433
436
|
}
|
|
434
437
|
};
|
|
435
|
-
f(x, "SalesforceDml"),
|
|
436
|
-
let
|
|
438
|
+
f(x, "SalesforceDml"), r(x, "type", "salesforce-dml"), r(x, "category", "salesforce"), r(x, "color", "#FFFFFF"), r(x, "configSchema", ae), r(x, "inputSchema", ce), r(x, "outputsSchema", le);
|
|
439
|
+
let C = x;
|
|
437
440
|
const de = h(
|
|
438
441
|
{
|
|
439
442
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
@@ -493,14 +496,9 @@ const de = h(
|
|
|
493
496
|
minimum: 5e3,
|
|
494
497
|
"x-nrg-form": { icon: "hourglass" }
|
|
495
498
|
}),
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}),
|
|
500
|
-
outputs: e.Number({ default: 2 }),
|
|
501
|
-
emitError: e.Boolean({ default: !1 }),
|
|
502
|
-
emitComplete: e.Boolean({ default: !1 }),
|
|
503
|
-
emitStatus: e.Boolean({ default: !1 })
|
|
499
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
500
|
+
completePort: e.Boolean({ default: !0 }),
|
|
501
|
+
statusPort: e.Boolean({ default: !1 })
|
|
504
502
|
},
|
|
505
503
|
{
|
|
506
504
|
$id: "salesforce-bulk:config",
|
|
@@ -530,21 +528,19 @@ h(
|
|
|
530
528
|
);
|
|
531
529
|
const he = h(
|
|
532
530
|
{},
|
|
533
|
-
{ $id: "salesforce-bulk:output
|
|
531
|
+
{ $id: "salesforce-bulk:record-output" }
|
|
534
532
|
), pe = h(
|
|
535
533
|
{},
|
|
536
|
-
{ $id: "salesforce-bulk:
|
|
537
|
-
),
|
|
534
|
+
{ $id: "salesforce-bulk:job-created-output" }
|
|
535
|
+
), fe = {
|
|
536
|
+
record: he,
|
|
537
|
+
jobCreated: pe
|
|
538
|
+
}, b = class b extends k {
|
|
538
539
|
sendRecord(o, n) {
|
|
539
|
-
|
|
540
|
-
i[0] = { ...o, payload: n }, this.send(i);
|
|
540
|
+
this.sendToPort("record", { ...o, payload: n });
|
|
541
541
|
}
|
|
542
542
|
sendJobCreated(o, n) {
|
|
543
|
-
this.
|
|
544
|
-
}
|
|
545
|
-
sendComplete(o, n) {
|
|
546
|
-
const t = this.config.emitJobCreated ? 3 : 2, i = Array(t).fill(null);
|
|
547
|
-
i[1] = { ...o, payload: n }, this.send(i);
|
|
543
|
+
this.sendToPort("jobCreated", { ...o, payload: n });
|
|
548
544
|
}
|
|
549
545
|
async input(o) {
|
|
550
546
|
const n = this.config.connection;
|
|
@@ -559,10 +555,10 @@ const he = h(
|
|
|
559
555
|
shape: "dot",
|
|
560
556
|
text: `bulk ${t}...`
|
|
561
557
|
});
|
|
562
|
-
const
|
|
558
|
+
const s = await n.getConnection(), i = await this.config.sObjectType.resolve(o);
|
|
563
559
|
let l = 0;
|
|
564
560
|
if (t === "query") {
|
|
565
|
-
const d = await
|
|
561
|
+
const d = await s.bulk2.query(o.payload, {
|
|
566
562
|
pollTimeout: this.config.pollTimeout,
|
|
567
563
|
pollInterval: this.config.pollInterval,
|
|
568
564
|
columnDelimiter: this.config.columnDelimiter,
|
|
@@ -576,11 +572,14 @@ const he = h(
|
|
|
576
572
|
fill: "green",
|
|
577
573
|
shape: "dot",
|
|
578
574
|
text: `bulk ${t}: ${l} records`
|
|
579
|
-
}), this.
|
|
575
|
+
}), this.sendToPort("complete", {
|
|
576
|
+
...o,
|
|
577
|
+
payload: { operation: t, sObjectType: i, totalRecords: l }
|
|
578
|
+
});
|
|
580
579
|
} else {
|
|
581
|
-
const d = o.payload, c =
|
|
580
|
+
const d = o.payload, c = s.bulk2.createJob({
|
|
582
581
|
operation: t,
|
|
583
|
-
object:
|
|
582
|
+
object: i,
|
|
584
583
|
columnDelimiter: this.config.columnDelimiter,
|
|
585
584
|
lineEnding: this.config.lineEnding,
|
|
586
585
|
...t === "upsert" && this.config.externalIdField ? { externalIdFieldName: this.config.externalIdField } : {},
|
|
@@ -589,42 +588,42 @@ const he = h(
|
|
|
589
588
|
await c.open(), this.sendJobCreated(o, {
|
|
590
589
|
jobId: c.id,
|
|
591
590
|
operation: t,
|
|
592
|
-
sObjectType:
|
|
591
|
+
sObjectType: i,
|
|
593
592
|
state: "Open"
|
|
594
593
|
}), await c.uploadData(d), await c.close(), await c.poll(this.config.pollInterval, this.config.pollTimeout);
|
|
595
594
|
const g = await c.getAllResults(), u = g.successfulResults ?? [], m = g.failedResults ?? [], p = g.unprocessedRecords ?? [];
|
|
596
595
|
l = u.length + m.length + p.length;
|
|
597
|
-
for (const
|
|
598
|
-
this.sendRecord(o,
|
|
599
|
-
for (const
|
|
600
|
-
this.sendRecord(o,
|
|
601
|
-
const S = u.length,
|
|
596
|
+
for (const R of u)
|
|
597
|
+
this.sendRecord(o, R);
|
|
598
|
+
for (const R of m)
|
|
599
|
+
this.sendRecord(o, R);
|
|
600
|
+
const S = u.length, M = m.length;
|
|
602
601
|
this.status({
|
|
603
|
-
fill:
|
|
602
|
+
fill: M > 0 ? "red" : "green",
|
|
604
603
|
shape: "dot",
|
|
605
604
|
text: `bulk ${t}: ${l} records`
|
|
606
|
-
}), this.
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
605
|
+
}), this.sendToPort("complete", {
|
|
606
|
+
...o,
|
|
607
|
+
payload: {
|
|
608
|
+
jobId: c.id,
|
|
609
|
+
operation: t,
|
|
610
|
+
sObjectType: i,
|
|
611
|
+
totalRecords: l,
|
|
612
|
+
successCount: S,
|
|
613
|
+
failureCount: M,
|
|
614
|
+
unprocessedCount: p.length
|
|
615
|
+
}
|
|
614
616
|
});
|
|
615
617
|
}
|
|
616
618
|
} catch (t) {
|
|
617
|
-
const
|
|
618
|
-
this.status({ fill: "red", shape: "dot", text:
|
|
619
|
+
const s = t instanceof Error ? t.message : String(t);
|
|
620
|
+
this.status({ fill: "red", shape: "dot", text: s }), this.error(`Bulk ${this.config.operation} failed: ${s}`, o);
|
|
619
621
|
}
|
|
620
622
|
}
|
|
621
623
|
};
|
|
622
|
-
f(b, "SalesforceBulk"),
|
|
623
|
-
he,
|
|
624
|
-
pe
|
|
625
|
-
]);
|
|
624
|
+
f(b, "SalesforceBulk"), r(b, "type", "salesforce-bulk"), r(b, "category", "salesforce"), r(b, "color", "#FFFFFF"), r(b, "configSchema", de), r(b, "inputSchema", ue), r(b, "outputsSchema", fe);
|
|
626
625
|
let O = b;
|
|
627
|
-
const
|
|
626
|
+
const ge = h(
|
|
628
627
|
{
|
|
629
628
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
630
629
|
connection: e.NodeRef($, {
|
|
@@ -636,17 +635,17 @@ const fe = h(
|
|
|
636
635
|
typedInputTypes: ["str", "msg"]
|
|
637
636
|
}
|
|
638
637
|
}),
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
638
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
639
|
+
completePort: e.Boolean({ default: !1 }),
|
|
640
|
+
statusPort: e.Boolean({ default: !1 })
|
|
642
641
|
},
|
|
643
642
|
{ $id: "salesforce-describe:config" }
|
|
644
|
-
),
|
|
643
|
+
), me = h(
|
|
645
644
|
{
|
|
646
645
|
payload: e.Any()
|
|
647
646
|
},
|
|
648
647
|
{ $id: "salesforce-describe:input" }
|
|
649
|
-
),
|
|
648
|
+
), ye = h(
|
|
650
649
|
{
|
|
651
650
|
payload: e.Object({
|
|
652
651
|
name: e.String(),
|
|
@@ -656,7 +655,7 @@ const fe = h(
|
|
|
656
655
|
})
|
|
657
656
|
},
|
|
658
657
|
{ $id: "salesforce-describe:output" }
|
|
659
|
-
), T = class T extends
|
|
658
|
+
), T = class T extends k {
|
|
660
659
|
async input(o) {
|
|
661
660
|
const n = this.config.connection;
|
|
662
661
|
if (!n) {
|
|
@@ -665,18 +664,18 @@ const fe = h(
|
|
|
665
664
|
}
|
|
666
665
|
try {
|
|
667
666
|
this.status({ fill: "green", shape: "dot", text: "describing..." });
|
|
668
|
-
const t = await n.getConnection(),
|
|
667
|
+
const t = await n.getConnection(), s = await this.config.sObjectType.resolve(o), i = await t.sobject(s).describe();
|
|
669
668
|
this.status({
|
|
670
669
|
fill: "green",
|
|
671
670
|
shape: "dot",
|
|
672
|
-
text: `${
|
|
671
|
+
text: `${i.name}: ${i.fields.length} fields`
|
|
673
672
|
}), this.send({
|
|
674
673
|
...o,
|
|
675
674
|
payload: {
|
|
676
|
-
name:
|
|
677
|
-
fields:
|
|
678
|
-
childRelationships:
|
|
679
|
-
recordTypeInfos:
|
|
675
|
+
name: i.name,
|
|
676
|
+
fields: i.fields,
|
|
677
|
+
childRelationships: i.childRelationships,
|
|
678
|
+
recordTypeInfos: i.recordTypeInfos
|
|
680
679
|
}
|
|
681
680
|
});
|
|
682
681
|
} catch (t) {
|
|
@@ -691,9 +690,9 @@ const fe = h(
|
|
|
691
690
|
}
|
|
692
691
|
}
|
|
693
692
|
};
|
|
694
|
-
f(T, "SalesforceDescribe"),
|
|
695
|
-
let
|
|
696
|
-
const
|
|
693
|
+
f(T, "SalesforceDescribe"), r(T, "type", "salesforce-describe"), r(T, "category", "salesforce"), r(T, "color", "#FFFFFF"), r(T, "configSchema", ge), r(T, "inputSchema", me), r(T, "outputsSchema", ye);
|
|
694
|
+
let P = T;
|
|
695
|
+
const xe = h(
|
|
697
696
|
{
|
|
698
697
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
699
698
|
connection: e.NodeRef($, {
|
|
@@ -723,8 +722,9 @@ const ye = h(
|
|
|
723
722
|
maximum: 100,
|
|
724
723
|
"x-nrg-form": { icon: "sort-numeric-asc" }
|
|
725
724
|
}),
|
|
726
|
-
|
|
727
|
-
|
|
725
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
726
|
+
completePort: e.Boolean({ default: !1 }),
|
|
727
|
+
statusPort: e.Boolean({ default: !1 })
|
|
728
728
|
},
|
|
729
729
|
{
|
|
730
730
|
$id: "salesforce-streaming:config",
|
|
@@ -740,7 +740,7 @@ const ye = h(
|
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
|
-
),
|
|
743
|
+
), be = h(
|
|
744
744
|
{
|
|
745
745
|
payload: e.Any(),
|
|
746
746
|
replayId: e.Any(),
|
|
@@ -748,15 +748,15 @@ const ye = h(
|
|
|
748
748
|
topic: e.String()
|
|
749
749
|
},
|
|
750
750
|
{ $id: "salesforce-streaming:output" }
|
|
751
|
-
), w = class w extends
|
|
751
|
+
), w = class w extends k {
|
|
752
752
|
constructor() {
|
|
753
753
|
super(...arguments);
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
754
|
+
r(this, "client", null);
|
|
755
|
+
r(this, "reconnectAttempt", 0);
|
|
756
|
+
r(this, "maxReconnectDelay", 6e4);
|
|
757
|
+
r(this, "maxReconnectAttempts", 10);
|
|
758
|
+
r(this, "grpcErrorHandler", null);
|
|
759
|
+
r(this, "stopped", !1);
|
|
760
760
|
}
|
|
761
761
|
async created() {
|
|
762
762
|
const n = this.config.connection;
|
|
@@ -777,16 +777,16 @@ const ye = h(
|
|
|
777
777
|
this.status({ fill: "red", shape: "dot", text: "auth expired" }), this.error("Salesforce token expired. Re-authorize the connection.");
|
|
778
778
|
return;
|
|
779
779
|
}
|
|
780
|
-
const
|
|
781
|
-
if (!
|
|
780
|
+
const s = n.getAccessToken(), i = n.getInstanceUrl();
|
|
781
|
+
if (!s || !i) {
|
|
782
782
|
this.status({ fill: "red", shape: "dot", text: "not authorized" }), this.error("Salesforce connection not authorized");
|
|
783
783
|
return;
|
|
784
784
|
}
|
|
785
785
|
const l = (await import("salesforce-pubsub-api-client")).default;
|
|
786
786
|
this.client = new l({
|
|
787
787
|
authType: "user-supplied",
|
|
788
|
-
accessToken:
|
|
789
|
-
instanceUrl:
|
|
788
|
+
accessToken: s,
|
|
789
|
+
instanceUrl: i
|
|
790
790
|
}), await this.client.connect();
|
|
791
791
|
const d = this.config.numRequested || null, c = this.config.channelName, g = /* @__PURE__ */ f((u, m, p) => {
|
|
792
792
|
if (m === "event" || m === "lastevent")
|
|
@@ -889,9 +889,9 @@ const ye = h(
|
|
|
889
889
|
await this.cleanup();
|
|
890
890
|
}
|
|
891
891
|
};
|
|
892
|
-
f(w, "SalesforceStreaming"),
|
|
893
|
-
let
|
|
894
|
-
const
|
|
892
|
+
f(w, "SalesforceStreaming"), r(w, "type", "salesforce-streaming"), r(w, "category", "salesforce"), r(w, "color", "#FFFFFF"), r(w, "configSchema", xe), r(w, "outputsSchema", be);
|
|
893
|
+
let j = w;
|
|
894
|
+
const Te = h(
|
|
895
895
|
{
|
|
896
896
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
897
897
|
connection: e.NodeRef($, {
|
|
@@ -913,22 +913,22 @@ const be = h(
|
|
|
913
913
|
typedInputTypes: ["str", "msg"]
|
|
914
914
|
}
|
|
915
915
|
}),
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
916
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
917
|
+
completePort: e.Boolean({ default: !1 }),
|
|
918
|
+
statusPort: e.Boolean({ default: !1 })
|
|
919
919
|
},
|
|
920
920
|
{ $id: "salesforce-apex:config" }
|
|
921
|
-
),
|
|
921
|
+
), Ie = h(
|
|
922
922
|
{
|
|
923
923
|
payload: e.Any()
|
|
924
924
|
},
|
|
925
925
|
{ $id: "salesforce-apex:input" }
|
|
926
|
-
),
|
|
926
|
+
), $e = h(
|
|
927
927
|
{
|
|
928
928
|
payload: e.Any()
|
|
929
929
|
},
|
|
930
930
|
{ $id: "salesforce-apex:output" }
|
|
931
|
-
), I = class I extends
|
|
931
|
+
), I = class I extends k {
|
|
932
932
|
async input(o) {
|
|
933
933
|
const n = this.config.connection;
|
|
934
934
|
if (!n) {
|
|
@@ -938,10 +938,10 @@ const be = h(
|
|
|
938
938
|
try {
|
|
939
939
|
const t = this.config.method;
|
|
940
940
|
this.status({ fill: "green", shape: "dot", text: `${t}...` });
|
|
941
|
-
const
|
|
941
|
+
const s = await n.getConnection(), i = await this.config.path.resolve(o);
|
|
942
942
|
let l;
|
|
943
943
|
const d = t.toLowerCase();
|
|
944
|
-
d === "get" || d === "delete" ? l = await
|
|
944
|
+
d === "get" || d === "delete" ? l = await s.apex[d](i) : l = await s.apex[d](i, o.payload), this.status({ fill: "green", shape: "dot", text: `${t} done` }), this.send({ ...o, payload: l });
|
|
945
945
|
} catch (t) {
|
|
946
946
|
this.status({
|
|
947
947
|
fill: "red",
|
|
@@ -954,22 +954,22 @@ const be = h(
|
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
956
|
};
|
|
957
|
-
f(I, "SalesforceApex"),
|
|
958
|
-
let
|
|
959
|
-
const
|
|
957
|
+
f(I, "SalesforceApex"), r(I, "type", "salesforce-apex"), r(I, "category", "salesforce"), r(I, "color", "#FFFFFF"), r(I, "configSchema", Te), r(I, "inputSchema", Ie), r(I, "outputsSchema", $e);
|
|
958
|
+
let v = I;
|
|
959
|
+
const we = Y({
|
|
960
960
|
nodes: [
|
|
961
961
|
$,
|
|
962
|
-
|
|
963
|
-
|
|
962
|
+
E,
|
|
963
|
+
C,
|
|
964
964
|
O,
|
|
965
|
+
P,
|
|
965
966
|
j,
|
|
966
|
-
v
|
|
967
|
-
N
|
|
967
|
+
v
|
|
968
968
|
]
|
|
969
969
|
});
|
|
970
|
-
var
|
|
971
|
-
|
|
970
|
+
var F = we;
|
|
971
|
+
F && typeof F == "object" && Array.isArray(F.nodes) && (F = G(F.nodes));
|
|
972
972
|
export {
|
|
973
|
-
|
|
973
|
+
F as default
|
|
974
974
|
};
|
|
975
975
|
//# sourceMappingURL=index.mjs.map
|