@bonsae/node-red-salesforce 0.4.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 +38 -24
- package/index.html +1 -1
- package/index.mjs +125 -121
- package/index.mjs.map +1 -1
- package/locales/de/index.html +18 -14
- package/locales/en-US/index.html +18 -14
- package/locales/es-ES/index.html +18 -14
- package/locales/fr/index.html +18 -14
- package/locales/ja/index.html +18 -14
- package/locales/ko/index.html +18 -14
- package/locales/pt-BR/index.html +18 -14
- package/locales/ru/index.html +18 -14
- package/locales/zh-CN/index.html +18 -14
- package/locales/zh-TW/index.html +18 -14
- package/package.json +2 -2
- package/resources/index.FDBQSjT7.js +1 -0
- package/resources/index.BmVSYWAa.js +0 -1
package/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var z = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var H = (a, o, n) => o in a ? z(a, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[o] = n;
|
|
3
3
|
var f = (a, o) => z(a, "name", { value: o, configurable: !0 });
|
|
4
|
-
var
|
|
5
|
-
import { fileURLToPath as
|
|
4
|
+
var r = (a, o, n) => H(a, typeof o != "symbol" ? o + "" : o, n);
|
|
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
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
|
|
11
|
-
var V =
|
|
10
|
+
import N from "node:crypto";
|
|
11
|
+
var V = q(import.meta.url), Ae = J(V);
|
|
12
12
|
const W = h(
|
|
13
13
|
{
|
|
14
14
|
name: e.String({ default: "" }),
|
|
@@ -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,14 +67,14 @@ 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) {
|
|
@@ -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,27 +117,27 @@ 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
133
|
), t.status(400).send(A(String(d || l)));
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
if (!
|
|
136
|
+
if (!s || !i) {
|
|
137
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(
|
|
@@ -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
|
|
@@ -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: ${
|
|
204
|
+
`salesforce-connection: auth/callback error: ${s instanceof Error ? s.message : String(s)}`
|
|
205
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,15 +277,18 @@ 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(
|
|
284
287
|
{
|
|
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(),
|
|
@@ -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",
|
|
@@ -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,9 +496,9 @@ const de = h(
|
|
|
493
496
|
minimum: 5e3,
|
|
494
497
|
"x-nrg-form": { icon: "hourglass" }
|
|
495
498
|
}),
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
500
|
+
completePort: e.Boolean({ default: !0 }),
|
|
501
|
+
statusPort: e.Boolean({ default: !1 })
|
|
499
502
|
},
|
|
500
503
|
{
|
|
501
504
|
$id: "salesforce-bulk:config",
|
|
@@ -529,12 +532,15 @@ const he = h(
|
|
|
529
532
|
), pe = h(
|
|
530
533
|
{},
|
|
531
534
|
{ $id: "salesforce-bulk:job-created-output" }
|
|
532
|
-
),
|
|
535
|
+
), fe = {
|
|
536
|
+
record: he,
|
|
537
|
+
jobCreated: pe
|
|
538
|
+
}, b = class b extends k {
|
|
533
539
|
sendRecord(o, n) {
|
|
534
|
-
this.sendToPort(
|
|
540
|
+
this.sendToPort("record", { ...o, payload: n });
|
|
535
541
|
}
|
|
536
542
|
sendJobCreated(o, n) {
|
|
537
|
-
this.sendToPort(
|
|
543
|
+
this.sendToPort("jobCreated", { ...o, payload: n });
|
|
538
544
|
}
|
|
539
545
|
async input(o) {
|
|
540
546
|
const n = this.config.connection;
|
|
@@ -549,10 +555,10 @@ const he = h(
|
|
|
549
555
|
shape: "dot",
|
|
550
556
|
text: `bulk ${t}...`
|
|
551
557
|
});
|
|
552
|
-
const
|
|
558
|
+
const s = await n.getConnection(), i = await this.config.sObjectType.resolve(o);
|
|
553
559
|
let l = 0;
|
|
554
560
|
if (t === "query") {
|
|
555
|
-
const d = await
|
|
561
|
+
const d = await s.bulk2.query(o.payload, {
|
|
556
562
|
pollTimeout: this.config.pollTimeout,
|
|
557
563
|
pollInterval: this.config.pollInterval,
|
|
558
564
|
columnDelimiter: this.config.columnDelimiter,
|
|
@@ -568,12 +574,12 @@ const he = h(
|
|
|
568
574
|
text: `bulk ${t}: ${l} records`
|
|
569
575
|
}), this.sendToPort("complete", {
|
|
570
576
|
...o,
|
|
571
|
-
payload: { operation: t, sObjectType:
|
|
577
|
+
payload: { operation: t, sObjectType: i, totalRecords: l }
|
|
572
578
|
});
|
|
573
579
|
} else {
|
|
574
|
-
const d = o.payload, c =
|
|
580
|
+
const d = o.payload, c = s.bulk2.createJob({
|
|
575
581
|
operation: t,
|
|
576
|
-
object:
|
|
582
|
+
object: i,
|
|
577
583
|
columnDelimiter: this.config.columnDelimiter,
|
|
578
584
|
lineEnding: this.config.lineEnding,
|
|
579
585
|
...t === "upsert" && this.config.externalIdField ? { externalIdFieldName: this.config.externalIdField } : {},
|
|
@@ -582,18 +588,18 @@ const he = h(
|
|
|
582
588
|
await c.open(), this.sendJobCreated(o, {
|
|
583
589
|
jobId: c.id,
|
|
584
590
|
operation: t,
|
|
585
|
-
sObjectType:
|
|
591
|
+
sObjectType: i,
|
|
586
592
|
state: "Open"
|
|
587
593
|
}), await c.uploadData(d), await c.close(), await c.poll(this.config.pollInterval, this.config.pollTimeout);
|
|
588
594
|
const g = await c.getAllResults(), u = g.successfulResults ?? [], m = g.failedResults ?? [], p = g.unprocessedRecords ?? [];
|
|
589
595
|
l = u.length + m.length + p.length;
|
|
590
|
-
for (const
|
|
591
|
-
this.sendRecord(o,
|
|
592
|
-
for (const
|
|
593
|
-
this.sendRecord(o,
|
|
594
|
-
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;
|
|
595
601
|
this.status({
|
|
596
|
-
fill:
|
|
602
|
+
fill: M > 0 ? "red" : "green",
|
|
597
603
|
shape: "dot",
|
|
598
604
|
text: `bulk ${t}: ${l} records`
|
|
599
605
|
}), this.sendToPort("complete", {
|
|
@@ -601,26 +607,23 @@ const he = h(
|
|
|
601
607
|
payload: {
|
|
602
608
|
jobId: c.id,
|
|
603
609
|
operation: t,
|
|
604
|
-
sObjectType:
|
|
610
|
+
sObjectType: i,
|
|
605
611
|
totalRecords: l,
|
|
606
612
|
successCount: S,
|
|
607
|
-
failureCount:
|
|
613
|
+
failureCount: M,
|
|
608
614
|
unprocessedCount: p.length
|
|
609
615
|
}
|
|
610
616
|
});
|
|
611
617
|
}
|
|
612
618
|
} catch (t) {
|
|
613
|
-
const
|
|
614
|
-
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);
|
|
615
621
|
}
|
|
616
622
|
}
|
|
617
623
|
};
|
|
618
|
-
f(b, "SalesforceBulk"),
|
|
619
|
-
he,
|
|
620
|
-
pe
|
|
621
|
-
]);
|
|
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);
|
|
622
625
|
let O = b;
|
|
623
|
-
const
|
|
626
|
+
const ge = h(
|
|
624
627
|
{
|
|
625
628
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
626
629
|
connection: e.NodeRef($, {
|
|
@@ -632,17 +635,17 @@ const fe = h(
|
|
|
632
635
|
typedInputTypes: ["str", "msg"]
|
|
633
636
|
}
|
|
634
637
|
}),
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
639
|
+
completePort: e.Boolean({ default: !1 }),
|
|
640
|
+
statusPort: e.Boolean({ default: !1 })
|
|
638
641
|
},
|
|
639
642
|
{ $id: "salesforce-describe:config" }
|
|
640
|
-
),
|
|
643
|
+
), me = h(
|
|
641
644
|
{
|
|
642
645
|
payload: e.Any()
|
|
643
646
|
},
|
|
644
647
|
{ $id: "salesforce-describe:input" }
|
|
645
|
-
),
|
|
648
|
+
), ye = h(
|
|
646
649
|
{
|
|
647
650
|
payload: e.Object({
|
|
648
651
|
name: e.String(),
|
|
@@ -661,18 +664,18 @@ const fe = h(
|
|
|
661
664
|
}
|
|
662
665
|
try {
|
|
663
666
|
this.status({ fill: "green", shape: "dot", text: "describing..." });
|
|
664
|
-
const t = await n.getConnection(),
|
|
667
|
+
const t = await n.getConnection(), s = await this.config.sObjectType.resolve(o), i = await t.sobject(s).describe();
|
|
665
668
|
this.status({
|
|
666
669
|
fill: "green",
|
|
667
670
|
shape: "dot",
|
|
668
|
-
text: `${
|
|
671
|
+
text: `${i.name}: ${i.fields.length} fields`
|
|
669
672
|
}), this.send({
|
|
670
673
|
...o,
|
|
671
674
|
payload: {
|
|
672
|
-
name:
|
|
673
|
-
fields:
|
|
674
|
-
childRelationships:
|
|
675
|
-
recordTypeInfos:
|
|
675
|
+
name: i.name,
|
|
676
|
+
fields: i.fields,
|
|
677
|
+
childRelationships: i.childRelationships,
|
|
678
|
+
recordTypeInfos: i.recordTypeInfos
|
|
676
679
|
}
|
|
677
680
|
});
|
|
678
681
|
} catch (t) {
|
|
@@ -687,9 +690,9 @@ const fe = h(
|
|
|
687
690
|
}
|
|
688
691
|
}
|
|
689
692
|
};
|
|
690
|
-
f(T, "SalesforceDescribe"),
|
|
691
|
-
let
|
|
692
|
-
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(
|
|
693
696
|
{
|
|
694
697
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
695
698
|
connection: e.NodeRef($, {
|
|
@@ -719,8 +722,9 @@ const ye = h(
|
|
|
719
722
|
maximum: 100,
|
|
720
723
|
"x-nrg-form": { icon: "sort-numeric-asc" }
|
|
721
724
|
}),
|
|
722
|
-
|
|
723
|
-
|
|
725
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
726
|
+
completePort: e.Boolean({ default: !1 }),
|
|
727
|
+
statusPort: e.Boolean({ default: !1 })
|
|
724
728
|
},
|
|
725
729
|
{
|
|
726
730
|
$id: "salesforce-streaming:config",
|
|
@@ -736,7 +740,7 @@ const ye = h(
|
|
|
736
740
|
}
|
|
737
741
|
}
|
|
738
742
|
}
|
|
739
|
-
),
|
|
743
|
+
), be = h(
|
|
740
744
|
{
|
|
741
745
|
payload: e.Any(),
|
|
742
746
|
replayId: e.Any(),
|
|
@@ -747,12 +751,12 @@ const ye = h(
|
|
|
747
751
|
), w = class w extends k {
|
|
748
752
|
constructor() {
|
|
749
753
|
super(...arguments);
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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);
|
|
756
760
|
}
|
|
757
761
|
async created() {
|
|
758
762
|
const n = this.config.connection;
|
|
@@ -773,16 +777,16 @@ const ye = h(
|
|
|
773
777
|
this.status({ fill: "red", shape: "dot", text: "auth expired" }), this.error("Salesforce token expired. Re-authorize the connection.");
|
|
774
778
|
return;
|
|
775
779
|
}
|
|
776
|
-
const
|
|
777
|
-
if (!
|
|
780
|
+
const s = n.getAccessToken(), i = n.getInstanceUrl();
|
|
781
|
+
if (!s || !i) {
|
|
778
782
|
this.status({ fill: "red", shape: "dot", text: "not authorized" }), this.error("Salesforce connection not authorized");
|
|
779
783
|
return;
|
|
780
784
|
}
|
|
781
785
|
const l = (await import("salesforce-pubsub-api-client")).default;
|
|
782
786
|
this.client = new l({
|
|
783
787
|
authType: "user-supplied",
|
|
784
|
-
accessToken:
|
|
785
|
-
instanceUrl:
|
|
788
|
+
accessToken: s,
|
|
789
|
+
instanceUrl: i
|
|
786
790
|
}), await this.client.connect();
|
|
787
791
|
const d = this.config.numRequested || null, c = this.config.channelName, g = /* @__PURE__ */ f((u, m, p) => {
|
|
788
792
|
if (m === "event" || m === "lastevent")
|
|
@@ -885,9 +889,9 @@ const ye = h(
|
|
|
885
889
|
await this.cleanup();
|
|
886
890
|
}
|
|
887
891
|
};
|
|
888
|
-
f(w, "SalesforceStreaming"),
|
|
889
|
-
let
|
|
890
|
-
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(
|
|
891
895
|
{
|
|
892
896
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
893
897
|
connection: e.NodeRef($, {
|
|
@@ -909,17 +913,17 @@ const be = h(
|
|
|
909
913
|
typedInputTypes: ["str", "msg"]
|
|
910
914
|
}
|
|
911
915
|
}),
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
916
|
+
errorPort: e.Boolean({ default: !1 }),
|
|
917
|
+
completePort: e.Boolean({ default: !1 }),
|
|
918
|
+
statusPort: e.Boolean({ default: !1 })
|
|
915
919
|
},
|
|
916
920
|
{ $id: "salesforce-apex:config" }
|
|
917
|
-
),
|
|
921
|
+
), Ie = h(
|
|
918
922
|
{
|
|
919
923
|
payload: e.Any()
|
|
920
924
|
},
|
|
921
925
|
{ $id: "salesforce-apex:input" }
|
|
922
|
-
),
|
|
926
|
+
), $e = h(
|
|
923
927
|
{
|
|
924
928
|
payload: e.Any()
|
|
925
929
|
},
|
|
@@ -934,10 +938,10 @@ const be = h(
|
|
|
934
938
|
try {
|
|
935
939
|
const t = this.config.method;
|
|
936
940
|
this.status({ fill: "green", shape: "dot", text: `${t}...` });
|
|
937
|
-
const
|
|
941
|
+
const s = await n.getConnection(), i = await this.config.path.resolve(o);
|
|
938
942
|
let l;
|
|
939
943
|
const d = t.toLowerCase();
|
|
940
|
-
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 });
|
|
941
945
|
} catch (t) {
|
|
942
946
|
this.status({
|
|
943
947
|
fill: "red",
|
|
@@ -950,20 +954,20 @@ const be = h(
|
|
|
950
954
|
}
|
|
951
955
|
}
|
|
952
956
|
};
|
|
953
|
-
f(I, "SalesforceApex"),
|
|
954
|
-
let
|
|
955
|
-
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({
|
|
956
960
|
nodes: [
|
|
957
961
|
$,
|
|
962
|
+
E,
|
|
958
963
|
C,
|
|
959
|
-
R,
|
|
960
964
|
O,
|
|
965
|
+
P,
|
|
961
966
|
j,
|
|
962
|
-
v
|
|
963
|
-
N
|
|
967
|
+
v
|
|
964
968
|
]
|
|
965
969
|
});
|
|
966
|
-
var F =
|
|
970
|
+
var F = we;
|
|
967
971
|
F && typeof F == "object" && Array.isArray(F.nodes) && (F = G(F.nodes));
|
|
968
972
|
export {
|
|
969
973
|
F as default
|