@memberjunction/realtime-widget 6.2.4 → 6.2.5

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UserViewEngine
3
- } from "./chunk-4FX3KCZD.js";
3
+ } from "./chunk-HWMIFTBL.js";
4
4
  import "./chunk-DIDGGUK7.js";
5
5
  export {
6
6
  UserViewEngine
@@ -33662,6 +33662,133 @@ var TransactionGroupBase = class {
33662
33662
  }
33663
33663
  };
33664
33664
 
33665
+ // ../../MJCore/dist/generic/constraintErrorRedaction.js
33666
+ var REDACTED_CONSTRAINT_VALUES = "(values withheld)";
33667
+ var VALUE_LIST_RULES = [
33668
+ { Label: "The duplicate key value is ", Open: "(", Close: ")" },
33669
+ { Label: "Truncated value: ", Open: "'", Close: "'" },
33670
+ { Label: "Key (", Open: "(", Close: ")", KeyColumns: true, Suffixes: ["already exists", "is not present", "is still referenced"] },
33671
+ { Label: "Failing row contains ", Open: "(", Close: ")" }
33672
+ ];
33673
+ function RedactConstraintValues(message) {
33674
+ if (!message) {
33675
+ return message;
33676
+ }
33677
+ const lines = message.split("\n");
33678
+ const out = [];
33679
+ for (const line of lines) {
33680
+ const redacted = VALUE_LIST_RULES.reduce((current, rule) => redactLine(current, rule), line);
33681
+ const unclosedAt = findUnclosedValueList(redacted);
33682
+ if (unclosedAt >= 0) {
33683
+ out.push(redacted.slice(0, unclosedAt) + REDACTED_CONSTRAINT_VALUES);
33684
+ break;
33685
+ }
33686
+ out.push(redacted);
33687
+ }
33688
+ return out.join("\n");
33689
+ }
33690
+ function findUnclosedValueList(line) {
33691
+ let first = -1;
33692
+ for (const rule of VALUE_LIST_RULES) {
33693
+ let searchFrom = 0;
33694
+ while (searchFrom < line.length) {
33695
+ const labelAt = line.indexOf(rule.Label, searchFrom);
33696
+ if (labelAt < 0) {
33697
+ break;
33698
+ }
33699
+ const opened = findValueListOpen(line, labelAt, rule);
33700
+ if (opened.OpenAt >= 0 && !line.startsWith(REDACTED_CONSTRAINT_VALUES, opened.OpenAt)) {
33701
+ if (first < 0 || opened.OpenAt < first) {
33702
+ first = opened.OpenAt;
33703
+ }
33704
+ break;
33705
+ }
33706
+ searchFrom = opened.ResumeAt;
33707
+ }
33708
+ }
33709
+ return first;
33710
+ }
33711
+ function redactLine(line, rule) {
33712
+ const closeAt = findLastValueListClose(line, rule);
33713
+ let searchFrom = 0;
33714
+ while (closeAt >= 0 && searchFrom < closeAt) {
33715
+ const labelAt = line.indexOf(rule.Label, searchFrom);
33716
+ if (labelAt < 0 || labelAt >= closeAt) {
33717
+ return line;
33718
+ }
33719
+ const opened = findValueListOpen(line, labelAt, rule);
33720
+ if (opened.OpenAt >= 0 && opened.OpenAt < closeAt) {
33721
+ return line.slice(0, opened.OpenAt) + REDACTED_CONSTRAINT_VALUES + line.slice(closeAt + 1);
33722
+ }
33723
+ if (opened.OpenAt >= closeAt) {
33724
+ return line;
33725
+ }
33726
+ searchFrom = opened.ResumeAt;
33727
+ }
33728
+ return line;
33729
+ }
33730
+ function findValueListOpen(line, labelAt, rule) {
33731
+ const afterLabel = labelAt + rule.Label.length;
33732
+ if (rule.KeyColumns) {
33733
+ const columnsClose = line.indexOf(")=" + rule.Open, afterLabel);
33734
+ if (columnsClose < 0) {
33735
+ return { OpenAt: -1, ResumeAt: line.length };
33736
+ }
33737
+ return { OpenAt: columnsClose + 2, ResumeAt: columnsClose + 1 };
33738
+ }
33739
+ return { OpenAt: line.startsWith(rule.Open, afterLabel) ? afterLabel : -1, ResumeAt: afterLabel };
33740
+ }
33741
+ function findLastValueListClose(line, rule) {
33742
+ let closeAt = line.lastIndexOf(rule.Close);
33743
+ while (closeAt >= 0) {
33744
+ if (!rule.Suffixes || closeIsFollowedBySuffix(line, closeAt, rule.Suffixes)) {
33745
+ return closeAt;
33746
+ }
33747
+ closeAt = closeAt > 0 ? line.lastIndexOf(rule.Close, closeAt - 1) : -1;
33748
+ }
33749
+ return -1;
33750
+ }
33751
+ function closeIsFollowedBySuffix(line, closeAt, suffixes) {
33752
+ let at = closeAt + 1;
33753
+ while (at < line.length && /\s/.test(line[at])) {
33754
+ at++;
33755
+ }
33756
+ if (at === closeAt + 1) {
33757
+ return false;
33758
+ }
33759
+ return suffixes.some((suffix) => line.startsWith(suffix, at));
33760
+ }
33761
+ function SaveErrorMessageForUser(message, entityInfo, user) {
33762
+ if (!entityInfo?.FieldLevelSecurityApplies) {
33763
+ return message;
33764
+ }
33765
+ if (user && entityInfo.GetDeniedReadFields(user).size === 0) {
33766
+ return message;
33767
+ }
33768
+ return RedactConstraintValues(StripExecutedSQL(message));
33769
+ }
33770
+ function StripExecutedSQL(message) {
33771
+ if (!message) {
33772
+ return message;
33773
+ }
33774
+ let cut = message.length;
33775
+ const match = /^[ \t]*(?:Query|Parameters):/m.exec(message);
33776
+ if (match) {
33777
+ cut = match.index;
33778
+ }
33779
+ for (const leadIn of INLINE_SQL_LEAD_INS) {
33780
+ const at = message.indexOf(leadIn);
33781
+ if (at >= 0 && at + leadIn.length < cut) {
33782
+ cut = at + leadIn.length;
33783
+ }
33784
+ }
33785
+ return cut < message.length ? message.slice(0, cut).trimEnd() : message;
33786
+ }
33787
+ var INLINE_SQL_LEAD_INS = [
33788
+ "no rows returned from SQL:",
33789
+ "no MATCHING rows found within the database:"
33790
+ ];
33791
+
33665
33792
  // ../../MJCore/dist/generic/databaseProviderBase.js
33666
33793
  var DatabaseProviderBase = class _DatabaseProviderBase extends ProviderBase {
33667
33794
  constructor() {
@@ -35280,7 +35407,7 @@ var DatabaseProviderBase = class _DatabaseProviderBase extends ProviderBase {
35280
35407
  } else {
35281
35408
  entityResult.Success = false;
35282
35409
  if (!entityResult.Message) {
35283
- entityResult.Message = transactionResult instanceof Error ? transactionResult.message : "Transaction Failed";
35410
+ entityResult.Message = transactionResult instanceof Error ? SaveErrorMessageForUser(transactionResult.message, entity.EntityInfo, user) : "Transaction Failed";
35284
35411
  }
35285
35412
  }
35286
35413
  }));
@@ -35359,7 +35486,7 @@ var DatabaseProviderBase = class _DatabaseProviderBase extends ProviderBase {
35359
35486
  } catch (e) {
35360
35487
  resumeRefresh();
35361
35488
  entityResult.EndedAt = /* @__PURE__ */ new Date();
35362
- entityResult.Message = e.message;
35489
+ entityResult.Message = SaveErrorMessageForUser(e.message, entity.EntityInfo, user);
35363
35490
  LogError(e);
35364
35491
  throw e;
35365
35492
  } finally {
@@ -35437,7 +35564,7 @@ var DatabaseProviderBase = class _DatabaseProviderBase extends ProviderBase {
35437
35564
  } else {
35438
35565
  entityResult.Success = false;
35439
35566
  if (!entityResult.Message) {
35440
- entityResult.Message = transactionResult instanceof Error ? transactionResult.message : "Transaction failed to commit";
35567
+ entityResult.Message = transactionResult instanceof Error ? SaveErrorMessageForUser(transactionResult.message, entity.EntityInfo, user) : "Transaction failed to commit";
35441
35568
  }
35442
35569
  }
35443
35570
  }));
@@ -35467,7 +35594,7 @@ var DatabaseProviderBase = class _DatabaseProviderBase extends ProviderBase {
35467
35594
  }
35468
35595
  } catch (e) {
35469
35596
  LogError(e);
35470
- entityResult.Message = e.message;
35597
+ entityResult.Message = SaveErrorMessageForUser(e.message, entity.EntityInfo, user);
35471
35598
  entityResult.Success = false;
35472
35599
  entityResult.EndedAt = /* @__PURE__ */ new Date();
35473
35600
  return false;
@@ -61,7 +61,7 @@ import {
61
61
  ValidateUserViewProperties,
62
62
  WellKnownUserSource,
63
63
  getGraphQLTypeNameBase
64
- } from "./chunk-4FX3KCZD.js";
64
+ } from "./chunk-HWMIFTBL.js";
65
65
  import {
66
66
  BehaviorSubject,
67
67
  CleanAndParseJSON,
@@ -143211,7 +143211,7 @@ var ViewInfo = class {
143211
143211
  * @async
143212
143212
  */
143213
143213
  static async GetViewEntity(viewId, contextUser) {
143214
- const { UserViewEngine } = await import("./UserViewEngine-UL2SXGFT.js");
143214
+ const { UserViewEngine } = await import("./UserViewEngine-B6GZRDY2.js");
143215
143215
  await UserViewEngine.Instance.Config(false, contextUser);
143216
143216
  const view = UserViewEngine.Instance.GetViewById(viewId);
143217
143217
  if (view) {
@@ -143230,7 +143230,7 @@ var ViewInfo = class {
143230
143230
  * @async
143231
143231
  */
143232
143232
  static async GetViewEntityByName(viewName, contextUser) {
143233
- const { UserViewEngine } = await import("./UserViewEngine-UL2SXGFT.js");
143233
+ const { UserViewEngine } = await import("./UserViewEngine-B6GZRDY2.js");
143234
143234
  await UserViewEngine.Instance.Config(false, contextUser);
143235
143235
  const view = UserViewEngine.Instance.GetViewByName(viewName);
143236
143236
  if (view) {
@@ -163309,7 +163309,7 @@ var Fe = class {
163309
163309
  return LogError(`Error checking for a duplicate entry: ${t}`), { Status: "Failed", ErrorMessage: t || "Unknown error occurred", Candidates: [] };
163310
163310
  }
163311
163311
  };
163312
- var H = "6.2.4";
163312
+ var H = "6.2.5";
163313
163313
  var F = "default";
163314
163314
  var _e = class {
163315
163315
  static {
@@ -11,7 +11,7 @@ import {
11
11
  S,
12
12
  TemplateEngineBase,
13
13
  coerceFailedExecuteAgentResult
14
- } from "./chunk-CCHOUKBG.js";
14
+ } from "./chunk-SIGYFYNM.js";
15
15
  import {
16
16
  BaseEngine,
17
17
  BaseEntity,
@@ -22,7 +22,7 @@ import {
22
22
  PermissionConstrainedError,
23
23
  RegisterForStartup,
24
24
  RunView
25
- } from "./chunk-4FX3KCZD.js";
25
+ } from "./chunk-HWMIFTBL.js";
26
26
  import {
27
27
  ParseModelConfiguration,
28
28
  ParseVendorConfiguration,
@@ -28,9 +28,9 @@ import {
28
28
  SessionCardStatusChip,
29
29
  SessionCardTitle,
30
30
  SessionsObserver
31
- } from "./chunk-HOTWHK6Z.js";
32
- import "./chunk-CCHOUKBG.js";
33
- import "./chunk-4FX3KCZD.js";
31
+ } from "./chunk-SWX3RAGO.js";
32
+ import "./chunk-SIGYFYNM.js";
33
+ import "./chunk-HWMIFTBL.js";
34
34
  import "./chunk-JOGHPRST.js";
35
35
  import "./chunk-DIDGGUK7.js";
36
36
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  S
3
- } from "./chunk-CCHOUKBG.js";
4
- import "./chunk-4FX3KCZD.js";
3
+ } from "./chunk-SIGYFYNM.js";
4
+ import "./chunk-HWMIFTBL.js";
5
5
  import "./chunk-JOGHPRST.js";
6
6
  import "./chunk-DIDGGUK7.js";
7
7
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  S
3
- } from "./chunk-CCHOUKBG.js";
4
- import "./chunk-4FX3KCZD.js";
3
+ } from "./chunk-SIGYFYNM.js";
4
+ import "./chunk-HWMIFTBL.js";
5
5
  import {
6
6
  ParseRealtimeClientTransport
7
7
  } from "./chunk-JOGHPRST.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  ConversationsRuntime
3
- } from "./chunk-HOTWHK6Z.js";
3
+ } from "./chunk-SWX3RAGO.js";
4
4
  import {
5
5
  Bt,
6
6
  ConversationEngine,
7
7
  Ot,
8
8
  agentFailureMessage
9
- } from "./chunk-CCHOUKBG.js";
9
+ } from "./chunk-SIGYFYNM.js";
10
10
  import {
11
11
  RunView
12
- } from "./chunk-4FX3KCZD.js";
12
+ } from "./chunk-HWMIFTBL.js";
13
13
  import "./chunk-JOGHPRST.js";
14
14
  import "./chunk-DIDGGUK7.js";
15
15
 
@@ -960,14 +960,14 @@ function defaultSessionClient(apiUrl, widgetKey) {
960
960
  return new WidgetSessionClient(apiUrl, widgetKey);
961
961
  }
962
962
  async function defaultTransport(apiUrl) {
963
- const { RuntimeWidgetTransport } = await import("./chunks/runtime-widget-transport-FBTIKZRU.js");
963
+ const { RuntimeWidgetTransport } = await import("./chunks/runtime-widget-transport-WUZTIMVH.js");
964
964
  return new RuntimeWidgetTransport(apiUrl);
965
965
  }
966
966
  async function defaultVoiceController(session) {
967
967
  const [{ RealtimeVoiceController }, { createGuestVoiceMint }, { createGuestToolRelay }] = await Promise.all([
968
968
  import("./chunks/realtime-voice-controller-76SVXCXJ.js"),
969
- import("./chunks/guest-voice-mint-AHN4J57R.js"),
970
- import("./chunks/guest-tool-relay-QFRDH3RT.js")
969
+ import("./chunks/guest-voice-mint-BM6NADRA.js"),
970
+ import("./chunks/guest-tool-relay-LZFRGXZL.js")
971
971
  ]);
972
972
  return new RealtimeVoiceController(
973
973
  createGuestVoiceMint(session),
@@ -998,7 +998,7 @@ function resolveMountTarget(target) {
998
998
  return document.body;
999
999
  }
1000
1000
  function registerNotificationAdapter(element) {
1001
- void import("./chunks/dist-VKJDJCDN.js").then(({ ConversationsRuntime }) => {
1001
+ void import("./chunks/dist-UWSRMRCO.js").then(({ ConversationsRuntime }) => {
1002
1002
  ConversationsRuntime.Instance.UseNotificationAdapter({
1003
1003
  Notify: (level, message) => {
1004
1004
  if (level === "error" || level === "warning") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/realtime-widget",
3
3
  "type": "module",
4
- "version": "6.2.4",
4
+ "version": "6.2.5",
5
5
  "description": "MemberJunction: Droppable, embeddable public customer-support widget (text + voice). A shadow-DOM web component that reuses ConversationsRuntime + the realtime client stack against MJAPI with a guest session JWT. No MJ login required.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -11,14 +11,14 @@
11
11
  "author": "MemberJunction.com",
12
12
  "license": "BUSL-1.1",
13
13
  "dependencies": {
14
- "@memberjunction/global": "6.2.4",
15
- "@memberjunction/core": "6.2.4",
16
- "@memberjunction/core-entities": "6.2.4",
17
- "@memberjunction/ai": "6.2.4",
18
- "@memberjunction/ai-core-plus": "6.2.4",
19
- "@memberjunction/ai-realtime-client": "6.2.4",
20
- "@memberjunction/conversations-runtime": "6.2.4",
21
- "@memberjunction/graphql-dataprovider": "6.2.4"
14
+ "@memberjunction/global": "6.2.5",
15
+ "@memberjunction/core": "6.2.5",
16
+ "@memberjunction/core-entities": "6.2.5",
17
+ "@memberjunction/ai": "6.2.5",
18
+ "@memberjunction/ai-core-plus": "6.2.5",
19
+ "@memberjunction/ai-realtime-client": "6.2.5",
20
+ "@memberjunction/conversations-runtime": "6.2.5",
21
+ "@memberjunction/graphql-dataprovider": "6.2.5"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "24.10.11",