@bonsae/node-red-salesforce 0.3.0 → 0.4.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/index.d.ts +9 -12
- package/index.html +1 -1
- package/index.mjs +115 -119
- package/index.mjs.map +1 -1
- package/locales/de/index.html +1 -3
- package/locales/de/index.json +90 -34
- package/locales/en-US/index.html +1 -3
- package/locales/en-US/index.json +91 -35
- package/locales/es-ES/index.html +1 -3
- package/locales/es-ES/index.json +90 -34
- package/locales/fr/index.html +1 -3
- package/locales/fr/index.json +90 -34
- package/locales/ja/index.html +1 -3
- package/locales/ja/index.json +90 -34
- package/locales/ko/index.html +1 -3
- package/locales/ko/index.json +90 -34
- package/locales/pt-BR/index.html +1 -3
- package/locales/pt-BR/index.json +90 -34
- package/locales/ru/index.html +1 -3
- package/locales/ru/index.json +90 -34
- package/locales/zh-CN/index.html +1 -3
- package/locales/zh-CN/index.json +90 -34
- package/locales/zh-TW/index.html +1 -3
- package/locales/zh-TW/index.json +90 -34
- package/package.json +2 -2
- package/resources/index.BmVSYWAa.js +1 -0
- package/resources/index.e3npw131.js +0 -1
package/index.d.ts
CHANGED
|
@@ -5,17 +5,17 @@ import { IONode } from '@bonsae/nrg/server';
|
|
|
5
5
|
import { ModuleDefinition } from '@bonsae/nrg/server';
|
|
6
6
|
import { RED } from '@bonsae/nrg/server';
|
|
7
7
|
import { Schema } from '@bonsae/nrg/server';
|
|
8
|
-
import { TAny } from '@
|
|
9
|
-
import { TArray } from '@
|
|
10
|
-
import { TBoolean } from '@
|
|
11
|
-
import { TLiteral } from '@
|
|
8
|
+
import { TAny } from '@sinclair/typebox';
|
|
9
|
+
import { TArray } from '@sinclair/typebox';
|
|
10
|
+
import { TBoolean } from '@sinclair/typebox';
|
|
11
|
+
import { TLiteral } from '@sinclair/typebox';
|
|
12
12
|
import { TNodeRef } from '@bonsae/nrg/server';
|
|
13
|
-
import { TNumber } from '@
|
|
14
|
-
import { TObject } from '@
|
|
15
|
-
import { TOptional } from '@
|
|
16
|
-
import { TString } from '@
|
|
13
|
+
import { TNumber } from '@sinclair/typebox';
|
|
14
|
+
import { TObject } from '@sinclair/typebox';
|
|
15
|
+
import { TOptional } from '@sinclair/typebox';
|
|
16
|
+
import { TString } from '@sinclair/typebox';
|
|
17
17
|
import { TTypedInput } from '@bonsae/nrg/server';
|
|
18
|
-
import { TUnion } from '@
|
|
18
|
+
import { TUnion } from '@sinclair/typebox';
|
|
19
19
|
|
|
20
20
|
declare type Config = Infer<typeof SalesforceApexConfigSchema>;
|
|
21
21
|
|
|
@@ -93,7 +93,6 @@ export declare class SalesforceBulk extends IONode<Config_3> {
|
|
|
93
93
|
static readonly outputsSchema: Schema[];
|
|
94
94
|
private sendRecord;
|
|
95
95
|
private sendJobCreated;
|
|
96
|
-
private sendComplete;
|
|
97
96
|
input(msg: Input_2): Promise<void>;
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -108,8 +107,6 @@ columnDelimiter: TUnion<[TLiteral<"COMMA">, TLiteral<"TAB">, TLiteral<"PIPE">, T
|
|
|
108
107
|
lineEnding: TUnion<[TLiteral<"LF">, TLiteral<"CRLF">]>;
|
|
109
108
|
pollInterval: TNumber;
|
|
110
109
|
pollTimeout: TNumber;
|
|
111
|
-
emitJobCreated: TBoolean;
|
|
112
|
-
outputs: TNumber;
|
|
113
110
|
emitError: TBoolean;
|
|
114
111
|
emitComplete: TBoolean;
|
|
115
112
|
emitStatus: TBoolean;
|
package/index.html
CHANGED
|
@@ -63,4 +63,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
63
63
|
LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
|
|
64
64
|
|
|
65
65
|
-->
|
|
66
|
-
<script type="module" src="resources/@bonsae/node-red-salesforce/index.
|
|
66
|
+
<script type="module" src="resources/@bonsae/node-red-salesforce/index.BmVSYWAa.js" defer></script>
|
package/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (a, o) =>
|
|
4
|
-
var
|
|
5
|
-
import { fileURLToPath as
|
|
1
|
+
var z = Object.defineProperty;
|
|
2
|
+
var q = (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 i = (a, o, n) => q(a, typeof o != "symbol" ? o + "" : o, n);
|
|
5
|
+
import { fileURLToPath as B } 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
10
|
import M from "node:crypto";
|
|
11
|
-
var V =
|
|
11
|
+
var V = B(import.meta.url), ke = J(V);
|
|
12
12
|
const W = h(
|
|
13
13
|
{
|
|
14
14
|
name: e.String({ default: "" }),
|
|
@@ -48,7 +48,7 @@ const W = h(
|
|
|
48
48
|
instanceUrl: e.String({ default: "" })
|
|
49
49
|
},
|
|
50
50
|
{ $id: "salesforce-connection:credentials" }
|
|
51
|
-
), H = 600 * 1e3,
|
|
51
|
+
), H = 600 * 1e3, E = /* @__PURE__ */ new Map();
|
|
52
52
|
function Z() {
|
|
53
53
|
return M.randomBytes(32).toString("base64url");
|
|
54
54
|
}
|
|
@@ -59,7 +59,7 @@ function D(a) {
|
|
|
59
59
|
f(D, "generateCodeChallenge");
|
|
60
60
|
function _(a) {
|
|
61
61
|
const o = M.randomUUID(), n = Z(), t = D(n);
|
|
62
|
-
|
|
62
|
+
E.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 [r, s] of E)
|
|
71
|
+
Date.now() - s.timestamp > H && E.delete(r);
|
|
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 = E.get(a);
|
|
77
|
+
return !o || (E.delete(a), Date.now() - o.timestamp > H) ? 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: r,
|
|
98
|
+
loginUrl: s,
|
|
99
99
|
clientId: l,
|
|
100
100
|
callbackUrl: d
|
|
101
101
|
} = n.body;
|
|
102
|
-
if (!
|
|
102
|
+
if (!r || !s || !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: r,
|
|
108
108
|
clientId: l,
|
|
109
|
-
loginUrl:
|
|
109
|
+
loginUrl: s,
|
|
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: `${s}/services/oauth2/authorize?${m.toString()}`
|
|
121
121
|
});
|
|
122
|
-
} catch (
|
|
122
|
+
} catch (r) {
|
|
123
123
|
a.log.error(
|
|
124
|
-
`salesforce-connection: auth/start error: ${
|
|
124
|
+
`salesforce-connection: auth/start error: ${r instanceof Error ? r.message : String(r)}`
|
|
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: r, state: s, 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 (!r || !s) {
|
|
137
|
+
t.status(400).send(A("Missing code or state parameter"));
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
const c = ee(
|
|
140
|
+
const c = ee(s);
|
|
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: r,
|
|
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 (r) {
|
|
203
203
|
a.log.error(
|
|
204
|
-
`salesforce-connection: auth/callback error: ${
|
|
205
|
-
), t.status(500).send(
|
|
204
|
+
`salesforce-connection: auth/callback error: ${r instanceof Error ? r.message : String(r)}`
|
|
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 r = a.nodes.getCredentials(n.params.nodeId), s = !!(r != null && r.accessToken && (r != null && r.instanceUrl));
|
|
210
210
|
t.json({
|
|
211
|
-
authenticated:
|
|
212
|
-
instanceUrl:
|
|
211
|
+
authenticated: s,
|
|
212
|
+
instanceUrl: s ? r.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
|
+
i(this, "conn", null);
|
|
228
228
|
}
|
|
229
229
|
static async registered(n) {
|
|
230
230
|
oe(n);
|
|
@@ -264,7 +264,7 @@ const L = class L extends Q {
|
|
|
264
264
|
this.conn = null;
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
-
f(L, "SalesforceConnection"),
|
|
267
|
+
f(L, "SalesforceConnection"), i(L, "type", "salesforce-connection"), i(L, "configSchema", W), i(L, "credentialsSchema", X);
|
|
268
268
|
let $ = L;
|
|
269
269
|
const ie = h(
|
|
270
270
|
{
|
|
@@ -280,19 +280,19 @@ const ie = h(
|
|
|
280
280
|
})
|
|
281
281
|
},
|
|
282
282
|
{ $id: "salesforce-soql:config" }
|
|
283
|
-
),
|
|
283
|
+
), re = h(
|
|
284
284
|
{
|
|
285
285
|
payload: e.Any()
|
|
286
286
|
},
|
|
287
287
|
{ $id: "salesforce-soql:input" }
|
|
288
|
-
),
|
|
288
|
+
), se = h(
|
|
289
289
|
{
|
|
290
290
|
payload: e.Array(e.Any()),
|
|
291
291
|
totalSize: e.Number(),
|
|
292
292
|
done: e.Boolean()
|
|
293
293
|
},
|
|
294
294
|
{ $id: "salesforce-soql:output" }
|
|
295
|
-
), y = class y extends
|
|
295
|
+
), y = class y extends k {
|
|
296
296
|
async input(o) {
|
|
297
297
|
const n = this.config.connection;
|
|
298
298
|
if (!n) {
|
|
@@ -301,16 +301,16 @@ const ie = h(
|
|
|
301
301
|
}
|
|
302
302
|
try {
|
|
303
303
|
this.status({ fill: "green", shape: "dot", text: "querying..." });
|
|
304
|
-
const t = await n.getConnection(),
|
|
304
|
+
const t = await n.getConnection(), r = await this.config.query.resolve(o), s = await t.query(r);
|
|
305
305
|
this.status({
|
|
306
306
|
fill: "green",
|
|
307
307
|
shape: "dot",
|
|
308
|
-
text: `${
|
|
308
|
+
text: `${s.totalSize} records`
|
|
309
309
|
}), this.send({
|
|
310
310
|
...o,
|
|
311
|
-
payload:
|
|
312
|
-
totalSize:
|
|
313
|
-
done:
|
|
311
|
+
payload: s.records,
|
|
312
|
+
totalSize: s.totalSize,
|
|
313
|
+
done: s.done
|
|
314
314
|
});
|
|
315
315
|
} catch (t) {
|
|
316
316
|
this.status({
|
|
@@ -324,8 +324,8 @@ const ie = h(
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
|
-
f(y, "SalesforceSoql"),
|
|
328
|
-
let
|
|
327
|
+
f(y, "SalesforceSoql"), i(y, "type", "salesforce-soql"), i(y, "category", "salesforce"), i(y, "color", "#FFFFFF"), i(y, "configSchema", ie), i(y, "inputSchema", re), i(y, "outputsSchema", se);
|
|
328
|
+
let C = y;
|
|
329
329
|
const ae = h(
|
|
330
330
|
{
|
|
331
331
|
name: e.String({ default: "", "x-nrg-form": { icon: "tag" } }),
|
|
@@ -388,7 +388,7 @@ const ae = h(
|
|
|
388
388
|
payload: e.Any()
|
|
389
389
|
},
|
|
390
390
|
{ $id: "salesforce-dml:output" }
|
|
391
|
-
), x = class x extends
|
|
391
|
+
), x = class x extends k {
|
|
392
392
|
async input(o) {
|
|
393
393
|
const n = this.config.connection;
|
|
394
394
|
if (!n) {
|
|
@@ -398,7 +398,7 @@ const ae = h(
|
|
|
398
398
|
try {
|
|
399
399
|
const t = this.config.operation;
|
|
400
400
|
this.status({ fill: "green", shape: "dot", text: `${t}...` });
|
|
401
|
-
const
|
|
401
|
+
const r = await n.getConnection(), s = await this.config.sObjectType.resolve(o), l = r.sobject(s), d = await this.config.record.resolve(o) ?? o.payload;
|
|
402
402
|
let c;
|
|
403
403
|
switch (t) {
|
|
404
404
|
case "create":
|
|
@@ -432,7 +432,7 @@ const ae = h(
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
};
|
|
435
|
-
f(x, "SalesforceDml"),
|
|
435
|
+
f(x, "SalesforceDml"), i(x, "type", "salesforce-dml"), i(x, "category", "salesforce"), i(x, "color", "#FFFFFF"), i(x, "configSchema", ae), i(x, "inputSchema", ce), i(x, "outputsSchema", le);
|
|
436
436
|
let R = x;
|
|
437
437
|
const de = h(
|
|
438
438
|
{
|
|
@@ -493,13 +493,8 @@ const de = h(
|
|
|
493
493
|
minimum: 5e3,
|
|
494
494
|
"x-nrg-form": { icon: "hourglass" }
|
|
495
495
|
}),
|
|
496
|
-
emitJobCreated: e.Boolean({
|
|
497
|
-
default: !1,
|
|
498
|
-
"x-nrg-form": { icon: "flag", toggle: !0 }
|
|
499
|
-
}),
|
|
500
|
-
outputs: e.Number({ default: 2 }),
|
|
501
496
|
emitError: e.Boolean({ default: !1 }),
|
|
502
|
-
emitComplete: e.Boolean({ default: !
|
|
497
|
+
emitComplete: e.Boolean({ default: !0 }),
|
|
503
498
|
emitStatus: e.Boolean({ default: !1 })
|
|
504
499
|
},
|
|
505
500
|
{
|
|
@@ -530,21 +525,16 @@ h(
|
|
|
530
525
|
);
|
|
531
526
|
const he = h(
|
|
532
527
|
{},
|
|
533
|
-
{ $id: "salesforce-bulk:output
|
|
528
|
+
{ $id: "salesforce-bulk:record-output" }
|
|
534
529
|
), pe = h(
|
|
535
530
|
{},
|
|
536
|
-
{ $id: "salesforce-bulk:
|
|
537
|
-
), b = class b extends
|
|
531
|
+
{ $id: "salesforce-bulk:job-created-output" }
|
|
532
|
+
), b = class b extends k {
|
|
538
533
|
sendRecord(o, n) {
|
|
539
|
-
|
|
540
|
-
i[0] = { ...o, payload: n }, this.send(i);
|
|
534
|
+
this.sendToPort(0, { ...o, payload: n });
|
|
541
535
|
}
|
|
542
536
|
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);
|
|
537
|
+
this.sendToPort(1, { ...o, payload: n });
|
|
548
538
|
}
|
|
549
539
|
async input(o) {
|
|
550
540
|
const n = this.config.connection;
|
|
@@ -559,10 +549,10 @@ const he = h(
|
|
|
559
549
|
shape: "dot",
|
|
560
550
|
text: `bulk ${t}...`
|
|
561
551
|
});
|
|
562
|
-
const
|
|
552
|
+
const r = await n.getConnection(), s = await this.config.sObjectType.resolve(o);
|
|
563
553
|
let l = 0;
|
|
564
554
|
if (t === "query") {
|
|
565
|
-
const d = await
|
|
555
|
+
const d = await r.bulk2.query(o.payload, {
|
|
566
556
|
pollTimeout: this.config.pollTimeout,
|
|
567
557
|
pollInterval: this.config.pollInterval,
|
|
568
558
|
columnDelimiter: this.config.columnDelimiter,
|
|
@@ -576,11 +566,14 @@ const he = h(
|
|
|
576
566
|
fill: "green",
|
|
577
567
|
shape: "dot",
|
|
578
568
|
text: `bulk ${t}: ${l} records`
|
|
579
|
-
}), this.
|
|
569
|
+
}), this.sendToPort("complete", {
|
|
570
|
+
...o,
|
|
571
|
+
payload: { operation: t, sObjectType: s, totalRecords: l }
|
|
572
|
+
});
|
|
580
573
|
} else {
|
|
581
|
-
const d = o.payload, c =
|
|
574
|
+
const d = o.payload, c = r.bulk2.createJob({
|
|
582
575
|
operation: t,
|
|
583
|
-
object:
|
|
576
|
+
object: s,
|
|
584
577
|
columnDelimiter: this.config.columnDelimiter,
|
|
585
578
|
lineEnding: this.config.lineEnding,
|
|
586
579
|
...t === "upsert" && this.config.externalIdField ? { externalIdFieldName: this.config.externalIdField } : {},
|
|
@@ -589,37 +582,40 @@ const he = h(
|
|
|
589
582
|
await c.open(), this.sendJobCreated(o, {
|
|
590
583
|
jobId: c.id,
|
|
591
584
|
operation: t,
|
|
592
|
-
sObjectType:
|
|
585
|
+
sObjectType: s,
|
|
593
586
|
state: "Open"
|
|
594
587
|
}), await c.uploadData(d), await c.close(), await c.poll(this.config.pollInterval, this.config.pollTimeout);
|
|
595
588
|
const g = await c.getAllResults(), u = g.successfulResults ?? [], m = g.failedResults ?? [], p = g.unprocessedRecords ?? [];
|
|
596
589
|
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,
|
|
590
|
+
for (const U of u)
|
|
591
|
+
this.sendRecord(o, U);
|
|
592
|
+
for (const U of m)
|
|
593
|
+
this.sendRecord(o, U);
|
|
594
|
+
const S = u.length, P = m.length;
|
|
602
595
|
this.status({
|
|
603
|
-
fill:
|
|
596
|
+
fill: P > 0 ? "red" : "green",
|
|
604
597
|
shape: "dot",
|
|
605
598
|
text: `bulk ${t}: ${l} records`
|
|
606
|
-
}), this.
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
599
|
+
}), this.sendToPort("complete", {
|
|
600
|
+
...o,
|
|
601
|
+
payload: {
|
|
602
|
+
jobId: c.id,
|
|
603
|
+
operation: t,
|
|
604
|
+
sObjectType: s,
|
|
605
|
+
totalRecords: l,
|
|
606
|
+
successCount: S,
|
|
607
|
+
failureCount: P,
|
|
608
|
+
unprocessedCount: p.length
|
|
609
|
+
}
|
|
614
610
|
});
|
|
615
611
|
}
|
|
616
612
|
} catch (t) {
|
|
617
|
-
const
|
|
618
|
-
this.status({ fill: "red", shape: "dot", text:
|
|
613
|
+
const r = t instanceof Error ? t.message : String(t);
|
|
614
|
+
this.status({ fill: "red", shape: "dot", text: r }), this.error(`Bulk ${this.config.operation} failed: ${r}`, o);
|
|
619
615
|
}
|
|
620
616
|
}
|
|
621
617
|
};
|
|
622
|
-
f(b, "SalesforceBulk"),
|
|
618
|
+
f(b, "SalesforceBulk"), i(b, "type", "salesforce-bulk"), i(b, "category", "salesforce"), i(b, "color", "#FFFFFF"), i(b, "configSchema", de), i(b, "inputSchema", ue), i(b, "outputsSchema", [
|
|
623
619
|
he,
|
|
624
620
|
pe
|
|
625
621
|
]);
|
|
@@ -656,7 +652,7 @@ const fe = h(
|
|
|
656
652
|
})
|
|
657
653
|
},
|
|
658
654
|
{ $id: "salesforce-describe:output" }
|
|
659
|
-
), T = class T extends
|
|
655
|
+
), T = class T extends k {
|
|
660
656
|
async input(o) {
|
|
661
657
|
const n = this.config.connection;
|
|
662
658
|
if (!n) {
|
|
@@ -665,18 +661,18 @@ const fe = h(
|
|
|
665
661
|
}
|
|
666
662
|
try {
|
|
667
663
|
this.status({ fill: "green", shape: "dot", text: "describing..." });
|
|
668
|
-
const t = await n.getConnection(),
|
|
664
|
+
const t = await n.getConnection(), r = await this.config.sObjectType.resolve(o), s = await t.sobject(r).describe();
|
|
669
665
|
this.status({
|
|
670
666
|
fill: "green",
|
|
671
667
|
shape: "dot",
|
|
672
|
-
text: `${
|
|
668
|
+
text: `${s.name}: ${s.fields.length} fields`
|
|
673
669
|
}), this.send({
|
|
674
670
|
...o,
|
|
675
671
|
payload: {
|
|
676
|
-
name:
|
|
677
|
-
fields:
|
|
678
|
-
childRelationships:
|
|
679
|
-
recordTypeInfos:
|
|
672
|
+
name: s.name,
|
|
673
|
+
fields: s.fields,
|
|
674
|
+
childRelationships: s.childRelationships,
|
|
675
|
+
recordTypeInfos: s.recordTypeInfos
|
|
680
676
|
}
|
|
681
677
|
});
|
|
682
678
|
} catch (t) {
|
|
@@ -691,7 +687,7 @@ const fe = h(
|
|
|
691
687
|
}
|
|
692
688
|
}
|
|
693
689
|
};
|
|
694
|
-
f(T, "SalesforceDescribe"),
|
|
690
|
+
f(T, "SalesforceDescribe"), i(T, "type", "salesforce-describe"), i(T, "category", "salesforce"), i(T, "color", "#FFFFFF"), i(T, "configSchema", fe), i(T, "inputSchema", ge), i(T, "outputsSchema", me);
|
|
695
691
|
let j = T;
|
|
696
692
|
const ye = h(
|
|
697
693
|
{
|
|
@@ -748,15 +744,15 @@ const ye = h(
|
|
|
748
744
|
topic: e.String()
|
|
749
745
|
},
|
|
750
746
|
{ $id: "salesforce-streaming:output" }
|
|
751
|
-
), w = class w extends
|
|
747
|
+
), w = class w extends k {
|
|
752
748
|
constructor() {
|
|
753
749
|
super(...arguments);
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
750
|
+
i(this, "client", null);
|
|
751
|
+
i(this, "reconnectAttempt", 0);
|
|
752
|
+
i(this, "maxReconnectDelay", 6e4);
|
|
753
|
+
i(this, "maxReconnectAttempts", 10);
|
|
754
|
+
i(this, "grpcErrorHandler", null);
|
|
755
|
+
i(this, "stopped", !1);
|
|
760
756
|
}
|
|
761
757
|
async created() {
|
|
762
758
|
const n = this.config.connection;
|
|
@@ -777,16 +773,16 @@ const ye = h(
|
|
|
777
773
|
this.status({ fill: "red", shape: "dot", text: "auth expired" }), this.error("Salesforce token expired. Re-authorize the connection.");
|
|
778
774
|
return;
|
|
779
775
|
}
|
|
780
|
-
const
|
|
781
|
-
if (!
|
|
776
|
+
const r = n.getAccessToken(), s = n.getInstanceUrl();
|
|
777
|
+
if (!r || !s) {
|
|
782
778
|
this.status({ fill: "red", shape: "dot", text: "not authorized" }), this.error("Salesforce connection not authorized");
|
|
783
779
|
return;
|
|
784
780
|
}
|
|
785
781
|
const l = (await import("salesforce-pubsub-api-client")).default;
|
|
786
782
|
this.client = new l({
|
|
787
783
|
authType: "user-supplied",
|
|
788
|
-
accessToken:
|
|
789
|
-
instanceUrl:
|
|
784
|
+
accessToken: r,
|
|
785
|
+
instanceUrl: s
|
|
790
786
|
}), await this.client.connect();
|
|
791
787
|
const d = this.config.numRequested || null, c = this.config.channelName, g = /* @__PURE__ */ f((u, m, p) => {
|
|
792
788
|
if (m === "event" || m === "lastevent")
|
|
@@ -889,7 +885,7 @@ const ye = h(
|
|
|
889
885
|
await this.cleanup();
|
|
890
886
|
}
|
|
891
887
|
};
|
|
892
|
-
f(w, "SalesforceStreaming"),
|
|
888
|
+
f(w, "SalesforceStreaming"), i(w, "type", "salesforce-streaming"), i(w, "category", "salesforce"), i(w, "color", "#FFFFFF"), i(w, "configSchema", ye), i(w, "outputsSchema", xe);
|
|
893
889
|
let v = w;
|
|
894
890
|
const be = h(
|
|
895
891
|
{
|
|
@@ -928,7 +924,7 @@ const be = h(
|
|
|
928
924
|
payload: e.Any()
|
|
929
925
|
},
|
|
930
926
|
{ $id: "salesforce-apex:output" }
|
|
931
|
-
), I = class I extends
|
|
927
|
+
), I = class I extends k {
|
|
932
928
|
async input(o) {
|
|
933
929
|
const n = this.config.connection;
|
|
934
930
|
if (!n) {
|
|
@@ -938,10 +934,10 @@ const be = h(
|
|
|
938
934
|
try {
|
|
939
935
|
const t = this.config.method;
|
|
940
936
|
this.status({ fill: "green", shape: "dot", text: `${t}...` });
|
|
941
|
-
const
|
|
937
|
+
const r = await n.getConnection(), s = await this.config.path.resolve(o);
|
|
942
938
|
let l;
|
|
943
939
|
const d = t.toLowerCase();
|
|
944
|
-
d === "get" || d === "delete" ? l = await
|
|
940
|
+
d === "get" || d === "delete" ? l = await r.apex[d](s) : l = await r.apex[d](s, o.payload), this.status({ fill: "green", shape: "dot", text: `${t} done` }), this.send({ ...o, payload: l });
|
|
945
941
|
} catch (t) {
|
|
946
942
|
this.status({
|
|
947
943
|
fill: "red",
|
|
@@ -954,12 +950,12 @@ const be = h(
|
|
|
954
950
|
}
|
|
955
951
|
}
|
|
956
952
|
};
|
|
957
|
-
f(I, "SalesforceApex"),
|
|
953
|
+
f(I, "SalesforceApex"), i(I, "type", "salesforce-apex"), i(I, "category", "salesforce"), i(I, "color", "#FFFFFF"), i(I, "configSchema", be), i(I, "inputSchema", Te), i(I, "outputsSchema", Ie);
|
|
958
954
|
let N = I;
|
|
959
955
|
const $e = Y({
|
|
960
956
|
nodes: [
|
|
961
957
|
$,
|
|
962
|
-
|
|
958
|
+
C,
|
|
963
959
|
R,
|
|
964
960
|
O,
|
|
965
961
|
j,
|
|
@@ -967,9 +963,9 @@ const $e = Y({
|
|
|
967
963
|
N
|
|
968
964
|
]
|
|
969
965
|
});
|
|
970
|
-
var
|
|
971
|
-
|
|
966
|
+
var F = $e;
|
|
967
|
+
F && typeof F == "object" && Array.isArray(F.nodes) && (F = G(F.nodes));
|
|
972
968
|
export {
|
|
973
|
-
|
|
969
|
+
F as default
|
|
974
970
|
};
|
|
975
971
|
//# sourceMappingURL=index.mjs.map
|