@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 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 '@bonsae/nrg/server';
9
- import { TArray } from '@bonsae/nrg/server';
10
- import { TBoolean } from '@bonsae/nrg/server';
11
- import { TLiteral } from '@bonsae/nrg/server';
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 '@bonsae/nrg/server';
14
- import { TObject } from '@bonsae/nrg/server';
15
- import { TOptional } from '@bonsae/nrg/server';
16
- import { TString } from '@bonsae/nrg/server';
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 '@bonsae/nrg/server';
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.e3npw131.js" defer></script>
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 P = Object.defineProperty;
2
- var B = (a, o, n) => o in a ? P(a, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[o] = n;
3
- var f = (a, o) => P(a, "name", { value: o, configurable: !0 });
4
- var s = (a, o, n) => B(a, typeof o != "symbol" ? o + "" : o, n);
5
- import { fileURLToPath as q } from "url";
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 A, defineModule as Y } from "@bonsae/nrg/server";
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 = q(import.meta.url), Ae = J(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, F = /* @__PURE__ */ new Map();
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
- F.set(o, {
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 [i, r] of F)
71
- Date.now() - r.timestamp > H && F.delete(i);
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 = F.get(a);
77
- return !o || (F.delete(a), Date.now() - o.timestamp > H) ? null : 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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
82
82
  }
83
83
  f(te, "escapeHtml");
84
- function k(a, o = !0) {
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(k, "errorPage");
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: i,
98
- loginUrl: r,
97
+ nodeId: r,
98
+ loginUrl: s,
99
99
  clientId: l,
100
100
  callbackUrl: d
101
101
  } = n.body;
102
- if (!i || !r || !l) {
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: i,
107
+ nodeId: r,
108
108
  clientId: l,
109
- loginUrl: r,
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: `${r}/services/oauth2/authorize?${m.toString()}`
120
+ authorizationUrl: `${s}/services/oauth2/authorize?${m.toString()}`
121
121
  });
122
- } catch (i) {
122
+ } catch (r) {
123
123
  a.log.error(
124
- `salesforce-connection: auth/start error: ${i instanceof Error ? i.message : String(i)}`
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: i, state: r, error: l, error_description: d } = n.query;
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(k(String(d || l)));
133
+ ), t.status(400).send(A(String(d || l)));
134
134
  return;
135
135
  }
136
- if (!i || !r) {
137
- t.status(400).send(k("Missing code or state parameter"));
136
+ if (!r || !s) {
137
+ t.status(400).send(A("Missing code or state parameter"));
138
138
  return;
139
139
  }
140
- const c = ee(r);
140
+ const c = ee(s);
141
141
  if (!c) {
142
142
  t.status(400).send(
143
- k(
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: i,
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
- k(
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 (i) {
202
+ } catch (r) {
203
203
  a.log.error(
204
- `salesforce-connection: auth/callback error: ${i instanceof Error ? i.message : String(i)}`
205
- ), t.status(500).send(k("An unexpected error occurred."));
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 i = a.nodes.getCredentials(n.params.nodeId), r = !!(i != null && i.accessToken && (i != null && i.instanceUrl));
209
+ const r = a.nodes.getCredentials(n.params.nodeId), s = !!(r != null && r.accessToken && (r != null && r.instanceUrl));
210
210
  t.json({
211
- authenticated: r,
212
- instanceUrl: r ? i.instanceUrl : void 0
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
- s(this, "conn", null);
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"), s(L, "type", "salesforce-connection"), s(L, "configSchema", W), s(L, "credentialsSchema", X);
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
- ), se = h(
283
+ ), re = h(
284
284
  {
285
285
  payload: e.Any()
286
286
  },
287
287
  { $id: "salesforce-soql:input" }
288
- ), re = h(
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 A {
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(), i = await this.config.query.resolve(o), r = await t.query(i);
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: `${r.totalSize} records`
308
+ text: `${s.totalSize} records`
309
309
  }), this.send({
310
310
  ...o,
311
- payload: r.records,
312
- totalSize: r.totalSize,
313
- done: r.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"), s(y, "type", "salesforce-soql"), s(y, "category", "salesforce"), s(y, "color", "#FFFFFF"), s(y, "configSchema", ie), s(y, "inputSchema", se), s(y, "outputsSchema", re);
328
- let U = y;
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 A {
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 i = await n.getConnection(), r = await this.config.sObjectType.resolve(o), l = i.sobject(r), d = await this.config.record.resolve(o) ?? o.payload;
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"), s(x, "type", "salesforce-dml"), s(x, "category", "salesforce"), s(x, "color", "#FFFFFF"), s(x, "configSchema", ae), s(x, "inputSchema", ce), s(x, "outputsSchema", le);
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: !1 }),
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-port-1" }
528
+ { $id: "salesforce-bulk:record-output" }
534
529
  ), pe = h(
535
530
  {},
536
- { $id: "salesforce-bulk:output-port-2" }
537
- ), b = class b extends A {
531
+ { $id: "salesforce-bulk:job-created-output" }
532
+ ), b = class b extends k {
538
533
  sendRecord(o, n) {
539
- const t = this.config.emitJobCreated ? 3 : 2, i = Array(t).fill(null);
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.config.emitJobCreated && this.send([null, null, { ...o, payload: n }]);
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 i = await n.getConnection(), r = await this.config.sObjectType.resolve(o);
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 i.bulk2.query(o.payload, {
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.sendComplete(o, { operation: t, sObjectType: r, totalRecords: l });
569
+ }), this.sendToPort("complete", {
570
+ ...o,
571
+ payload: { operation: t, sObjectType: s, totalRecords: l }
572
+ });
580
573
  } else {
581
- const d = o.payload, c = i.bulk2.createJob({
574
+ const d = o.payload, c = r.bulk2.createJob({
582
575
  operation: t,
583
- object: r,
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: r,
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 E of u)
598
- this.sendRecord(o, E);
599
- for (const E of m)
600
- this.sendRecord(o, E);
601
- const S = u.length, z = m.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: z > 0 ? "red" : "green",
596
+ fill: P > 0 ? "red" : "green",
604
597
  shape: "dot",
605
598
  text: `bulk ${t}: ${l} records`
606
- }), this.sendComplete(o, {
607
- jobId: c.id,
608
- operation: t,
609
- sObjectType: r,
610
- totalRecords: l,
611
- successCount: S,
612
- failureCount: z,
613
- unprocessedCount: p.length
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 i = t instanceof Error ? t.message : String(t);
618
- this.status({ fill: "red", shape: "dot", text: i }), this.error(`Bulk ${this.config.operation} failed: ${i}`, o);
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"), s(b, "type", "salesforce-bulk"), s(b, "category", "salesforce"), s(b, "color", "#FFFFFF"), s(b, "configSchema", de), s(b, "inputSchema", ue), s(b, "outputsSchema", [
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 A {
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(), i = await this.config.sObjectType.resolve(o), r = await t.sobject(i).describe();
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: `${r.name}: ${r.fields.length} fields`
668
+ text: `${s.name}: ${s.fields.length} fields`
673
669
  }), this.send({
674
670
  ...o,
675
671
  payload: {
676
- name: r.name,
677
- fields: r.fields,
678
- childRelationships: r.childRelationships,
679
- recordTypeInfos: r.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"), s(T, "type", "salesforce-describe"), s(T, "category", "salesforce"), s(T, "color", "#FFFFFF"), s(T, "configSchema", fe), s(T, "inputSchema", ge), s(T, "outputsSchema", me);
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 A {
747
+ ), w = class w extends k {
752
748
  constructor() {
753
749
  super(...arguments);
754
- s(this, "client", null);
755
- s(this, "reconnectAttempt", 0);
756
- s(this, "maxReconnectDelay", 6e4);
757
- s(this, "maxReconnectAttempts", 10);
758
- s(this, "grpcErrorHandler", null);
759
- s(this, "stopped", !1);
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 i = n.getAccessToken(), r = n.getInstanceUrl();
781
- if (!i || !r) {
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: i,
789
- instanceUrl: r
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"), s(w, "type", "salesforce-streaming"), s(w, "category", "salesforce"), s(w, "color", "#FFFFFF"), s(w, "configSchema", ye), s(w, "outputsSchema", xe);
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 A {
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 i = await n.getConnection(), r = await this.config.path.resolve(o);
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 i.apex[d](r) : l = await i.apex[d](r, o.payload), this.status({ fill: "green", shape: "dot", text: `${t} done` }), this.send({ ...o, payload: l });
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"), s(I, "type", "salesforce-apex"), s(I, "category", "salesforce"), s(I, "color", "#FFFFFF"), s(I, "configSchema", be), s(I, "inputSchema", Te), s(I, "outputsSchema", Ie);
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
- U,
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 C = $e;
971
- C && typeof C == "object" && Array.isArray(C.nodes) && (C = G(C.nodes));
966
+ var F = $e;
967
+ F && typeof F == "object" && Array.isArray(F.nodes) && (F = G(F.nodes));
972
968
  export {
973
- C as default
969
+ F as default
974
970
  };
975
971
  //# sourceMappingURL=index.mjs.map