@memberjunction/react-runtime 5.34.1 → 5.35.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.
@@ -1,31 +1,31 @@
1
1
 
2
- > @memberjunction/react-runtime@5.34.1 build
2
+ > @memberjunction/react-runtime@5.35.0 build
3
3
  > npm run build:node && npm run build:umd
4
4
 
5
5
 
6
- > @memberjunction/react-runtime@5.34.1 build:node
6
+ > @memberjunction/react-runtime@5.35.0 build:node
7
7
  > tsc
8
8
 
9
9
 
10
- > @memberjunction/react-runtime@5.34.1 build:umd
10
+ > @memberjunction/react-runtime@5.35.0 build:umd
11
11
  > webpack --config webpack.umd.config.cjs
12
12
 
13
13
  [BABEL] Note: The code generator has deoptimised the styling of /home/runner/work/MJ/MJ/packages/MJCoreEntities/dist/generated/entity_subclasses.js as it exceeds the max of 500KB.
14
- asset runtime.umd.js 7.29 MiB [compared for emit] [big] (name: main)
14
+ asset runtime.umd.js 7.31 MiB [compared for emit] [big] (name: main)
15
15
  asset 324.runtime.umd.js 190 KiB [compared for emit]
16
16
  asset 490.runtime.umd.js 182 KiB [compared for emit] (id hint: vendors)
17
- orphan modules 7.31 MiB [orphan] 529 modules
17
+ orphan modules 7.33 MiB [orphan] 531 modules
18
18
  runtime modules 6.94 KiB 10 modules
19
- cacheable modules 7.44 MiB
19
+ cacheable modules 7.46 MiB
20
20
  modules by path ../../../node_modules/ 781 KiB
21
21
  modules by path ../../../node_modules/rxjs/dist/esm5/internal/ 30.4 KiB 15 modules
22
22
  modules by path ../../../node_modules/debug/src/*.js 12.7 KiB 2 modules
23
23
  + 7 modules
24
- modules by path ../../MJCoreEntities/dist/ 4.34 MiB
25
- ../../MJCoreEntities/dist/index.js + 47 modules 4.32 MiB [built] [code generated]
24
+ modules by path ../../MJCoreEntities/dist/ 4.36 MiB
25
+ ../../MJCoreEntities/dist/index.js + 49 modules 4.34 MiB [built] [code generated]
26
26
  ../../MJCoreEntities/dist/engines/UserViewEngine.js 19.6 KiB [built] [code generated]
27
27
  ./dist/index.js + 27 modules 426 KiB [built] [code generated]
28
28
  ../../MJCore/dist/index.js + 81 modules 1.53 MiB [built] [code generated]
29
29
  ../../MJGlobal/dist/index.js + 17 modules 236 KiB [built] [code generated]
30
30
  ../../GraphQLDataProvider/dist/index.mjs 170 KiB [built] [code generated]
31
- webpack 5.105.0 compiled successfully in 74582 ms
31
+ webpack 5.105.0 compiled successfully in 77588 ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @memberjunction/react-runtime
2
2
 
3
+ ## 5.35.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6fa8e13]
8
+ - Updated dependencies [31f2a7f]
9
+ - Updated dependencies [c1f1cad]
10
+ - Updated dependencies [77e4782]
11
+ - Updated dependencies [32c4a02]
12
+ - Updated dependencies [9580189]
13
+ - Updated dependencies [207cba4]
14
+ - Updated dependencies [aedd4dc]
15
+ - Updated dependencies [ac4b9a5]
16
+ - @memberjunction/core@5.35.0
17
+ - @memberjunction/core-entities@5.35.0
18
+ - @memberjunction/graphql-dataprovider@5.35.0
19
+ - @memberjunction/global@5.35.0
20
+ - @memberjunction/interactive-component-types@5.35.0
21
+
3
22
  ## 5.34.1
4
23
 
5
24
  ### Patch Changes
@@ -42,7 +42,7 @@ __webpack_require__.r(__webpack_exports__);
42
42
  /* harmony import */ var graphql_request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(215);
43
43
  /* harmony import */ var _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(310);
44
44
  /* harmony import */ var _memberjunction_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(232);
45
- /* harmony import */ var _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(346);
45
+ /* harmony import */ var _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(760);
46
46
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(600);
47
47
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
48
48
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(156);
@@ -58,7 +58,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
58
58
  ResultsJSON
59
59
  }
60
60
  }
61
- `,t=[];for(const n of this.PendingTransactions)t.push({EntityName:n.BaseEntity.EntityInfo.Name,EntityObjectJSON:await n.BaseEntity.GetDataObjectJSON(),OperationType:n.OperationType});const r={group:{Items:t,Variables:this.Variables.map(n=>({Name:n.Name,ItemIndex:this.MapVariableEntityObjectToPosition(n),FieldName:n.FieldName,Type:n.Type}))}},s=await this._provider.ExecuteGQL(e,r);if(s&&s.ExecuteTransactionGroup){const n=s.ExecuteTransactionGroup,a=[];for(let i=0;i<this.PendingTransactions.length;i++){const o=n.ResultsJSON[i],u=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(o),l=this.PendingTransactions[i];a.push(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionResult */ .qTq(l,u,u!==null))}return a}else throw new Error("Failed to execute transaction group")}}const he=900*1e3;class P{static{y(this,"FireAndForgetHelper")}static async Execute(e){const t=e.operationLabel??e.mutationFieldName;let r,s;try{const{promise:n,resolve:a,reject:i}=P.createCompletionPromise();s=P.setupTimeout(i,e.timeoutMs,e.timeoutErrorMessage),r=P.subscribeToPubSub(e,a,s);const o=await P.executeMutation(e);if(!e.validateAck(o)){s&&clearTimeout(s);const u=o?.errorMessage??"Server rejected the request";return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Server rejected: ${u}`),e.createErrorResult(u)}return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Server accepted, waiting for completion via WebSocket`),await n}catch(n){throw s&&clearTimeout(s),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Error: ${n.message}`),n}finally{s&&clearTimeout(s),r&&r.unsubscribe()}}static createCompletionPromise(){let e,t;return{promise:new Promise((s,n)=>{e=s,t=n}),resolve:e,reject:t}}static setupTimeout(e,t,r){const s=t??he,n=r??"The operation may still be running on the server but the client timed out after 15 minutes. Please refresh the page to check the latest status.";return setTimeout(()=>{e(new Error(n))},s)}static subscribeToPubSub(e,t,r){const s=e.dataProvider.sessionId,n=e.operationLabel??e.mutationFieldName;return e.dataProvider.PushStatusUpdates(s).subscribe(a=>{try{const i=JSON.parse(a);e.onMessage&&e.onMessage(i),e.isCompletionEvent(i)&&(clearTimeout(r),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${n}] Completion event received`),t(e.extractResult(i)))}catch(i){console.error(`[FireAndForget:${n}] Failed to parse PubSub message:`,i)}})}static async executeMutation(e){return(await e.dataProvider.ExecuteGQL(e.mutation,e.variables))[e.mutationFieldName]}}class B{static{y(this,"GraphQLAIClient")}constructor(e){this._dataProvider=e}async RunAIPrompt(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
61
+ `,t=[];for(const n of this.PendingTransactions)t.push({EntityName:n.BaseEntity.EntityInfo.Name,EntityObjectJSON:await n.BaseEntity.GetDataObjectJSON(),OperationType:n.OperationType});const r={group:{Items:t,Variables:this.Variables.map(n=>({Name:n.Name,ItemIndex:this.MapVariableEntityObjectToPosition(n),FieldName:n.FieldName,Type:n.Type}))}},s=await this._provider.ExecuteGQL(e,r);if(s&&s.ExecuteTransactionGroup){const n=s.ExecuteTransactionGroup,a=[];for(let i=0;i<this.PendingTransactions.length;i++){const o=n.ResultsJSON[i],l=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(o),u=this.PendingTransactions[i];a.push(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionResult */ .qTq(u,l,l!==null))}return a}else throw new Error("Failed to execute transaction group")}}const he=900*1e3;class P{static{y(this,"FireAndForgetHelper")}static async Execute(e){const t=e.operationLabel??e.mutationFieldName;let r,s;try{const{promise:n,resolve:a,reject:i}=P.createCompletionPromise();s=P.setupTimeout(i,e.timeoutMs,e.timeoutErrorMessage),r=P.subscribeToPubSub(e,a,s);const o=await P.executeMutation(e);if(!e.validateAck(o)){s&&clearTimeout(s);const l=o?.errorMessage??"Server rejected the request";return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Server rejected: ${l}`),e.createErrorResult(l)}return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Server accepted, waiting for completion via WebSocket`),await n}catch(n){throw s&&clearTimeout(s),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Error: ${n.message}`),n}finally{s&&clearTimeout(s),r&&r.unsubscribe()}}static createCompletionPromise(){let e,t;return{promise:new Promise((s,n)=>{e=s,t=n}),resolve:e,reject:t}}static setupTimeout(e,t,r){const s=t??he,n=r??"The operation may still be running on the server but the client timed out after 15 minutes. Please refresh the page to check the latest status.";return setTimeout(()=>{e(new Error(n))},s)}static subscribeToPubSub(e,t,r){const s=e.dataProvider.sessionId,n=e.operationLabel??e.mutationFieldName;return e.dataProvider.PushStatusUpdates(s).subscribe(a=>{try{const i=JSON.parse(a);e.onMessage&&e.onMessage(i),e.isCompletionEvent(i)&&(clearTimeout(r),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${n}] Completion event received`),t(e.extractResult(i)))}catch(i){console.error(`[FireAndForget:${n}] Failed to parse PubSub message:`,i)}})}static async executeMutation(e){return(await e.dataProvider.ExecuteGQL(e.mutation,e.variables))[e.mutationFieldName]}}class B{static{y(this,"GraphQLAIClient")}constructor(e){this._dataProvider=e}async RunAIPrompt(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
62
62
  mutation RunAIPrompt(
63
63
  $promptId: String!,
64
64
  $data: String,
@@ -349,7 +349,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
349
349
  }
350
350
  }
351
351
  }
352
- `,r={entityDocumentID:e.entityDocumentID};e.maxRecords!==void 0&&(r.maxRecords=e.maxRecords),e.filter!==void 0&&(r.filter=e.filter);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.FetchEntityVectors)throw new Error("Invalid response from server");return s.FetchEntityVectors}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.FetchEntityVectors failed",void 0,r),{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,ErrorMessage:r.message||"Unknown error"}}}}const F="5.34.1",$="default";class K{static{y(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}getCategoryMap(e){const t=e||$;let r=this._storage.get(t);return r||(r=new Map,this._storage.set(t,r)),r}async GetItem(e,t){const s=this.getCategoryMap(t||$).get(e);return s===void 0?null:s}async GetItems(e,t){const r=new Map;if(e.length===0)return r;const s=this.getCategoryMap(t||$);for(const n of new Set(e)){const a=s.get(n);r.set(n,a===void 0?null:a)}return r}async SetItem(e,t,r){this.getCategoryMap(r||$).set(e,t)}async Remove(e,t){this.getCategoryMap(t||$).delete(e)}async ClearCategory(e){const t=e||$;this._storage.delete(t)}async GetCategoryKeys(e){const t=this._storage.get(e||$);return t?Array.from(t.keys()):[]}}const Ie="MJ_Metadata",fe=0;function Re(){try{const I=F.split("."),e=parseInt(I[0],10),t=parseInt(I[1],10);if(!Number.isFinite(e)||!Number.isFinite(t))throw new Error(`Could not parse major.minor from version "${F}"`);return e*1e3+t+fe}catch(I){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:I,message:"Failed to derive IDB version from PACKAGE_VERSION; using fallback 99999"}),99999}}y(Re,"computeIdbVersion");const De=Re(),j=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"];class J extends K{static{y(this,"BrowserIndexedDBStorageProvider")}constructor(){super(),this._dbReady=!1,this.dbPromise=(0,_tempfix_idb__WEBPACK_IMPORTED_MODULE_10__/* .openDB */ .P2)(Ie,De,{upgrade:y((e,t,r)=>{try{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[IDBCache] Upgrading IndexedDB schema v${t} \u2192 v${r} (package ${F}). Dropping all stores; caches will repopulate on first use.`);for(const s of Array.from(e.objectStoreNames))e.deleteObjectStore(s);for(const s of j)e.objectStoreNames.contains(s)||e.createObjectStore(s)}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:s,message:s?.message})}},"upgrade"),blocked:y((e,t)=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[IDBCache] Upgrade from v${e} to v${t} blocked by another tab. Close other tabs to allow the upgrade to proceed.`)},"blocked")}),this.dbPromise.then(e=>{this._dbReady=!0,e.onversionchange=()=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)("[IDBCache] DB schema upgraded in another tab \u2014 closing local connection."),e.close(),this._dbReady=!1}}).catch(e=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:e,message:"IndexedDB initialization failed: "+e?.message})})}get IsReady(){return this._dbReady}isKnownCategory(e){const t=`mj:${e}`;return j.includes(t)}getStoreName(e){const t=e||$;return this.isKnownCategory(t)?`mj:${t}`:"mj:default"}getStoreKey(e,t){const r=t||$;return this.isKnownCategory(r)?e:`[${r}]:${e}`}async SetItem(e,t,r){try{const s=await this.dbPromise,n=this.getStoreName(r),a=this.getStoreKey(e,r),i=s.transaction(n,"readwrite");await i.objectStore(n).put(t,a),await i.done}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:s,message:s?.message})}}async GetItem(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),n=this.getStoreKey(e,t),a=await r.transaction(s).objectStore(s).get(n);return a===void 0?null:a}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:r,message:r?.message}),null}}async GetItems(e,t){const r=new Map;if(e.length===0)return r;try{const s=await this.dbPromise,n=this.getStoreName(t),a=Array.from(new Set(e)),i=a.map(R=>this.getStoreKey(R,t)),o=s.transaction(n,"readonly"),u=o.objectStore(n),l=i.map(R=>u.get(R)),f=await Promise.all(l);await o.done;for(let R=0;R<a.length;R++){const S=f[R];r.set(a[R],S===void 0?null:S)}return r}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:s,message:s?.message});for(const n of new Set(e))r.set(n,null);return r}}async Remove(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),n=this.getStoreKey(e,t),a=r.transaction(s,"readwrite");await a.objectStore(s).delete(n),await a.done}catch(r){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:r,message:r?.message})}}async ClearCategory(e){try{const t=await this.dbPromise,r=e||$,s=this.getStoreName(e);if(this.isKnownCategory(r)){const n=t.transaction(s,"readwrite");await n.objectStore(s).clear(),await n.done}else{const n=`[${r}]:`,a=t.transaction("mj:default","readwrite"),i=a.objectStore("mj:default"),o=await i.getAllKeys();for(const u of o)typeof u=="string"&&u.startsWith(n)&&await i.delete(u);await a.done}}catch(t){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:t,message:t?.message})}}async GetCategoryKeys(e){try{const t=await this.dbPromise,r=e||$,s=this.getStoreName(e),i=await t.transaction(s,"readonly").objectStore(s).getAllKeys();if(this.isKnownCategory(r))return i.map(u=>String(u));const o=`[${r}]:`;return i.map(u=>String(u)).filter(u=>u.startsWith(o)).map(u=>u.slice(o.length))}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:t,message:t?.message}),[]}}}class Ee extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderConfigDataBase */ .dZq{static{y(this,"GraphQLProviderConfigData")}get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get MJAPIKey(){return this.Data.MJAPIKey}set MJAPIKey(e){this.Data.MJAPIKey=e}get UserAPIKey(){return this.Data.UserAPIKey}set UserAPIKey(e){this.Data.UserAPIKey=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}get OnAuthenticationError(){return this.Data.OnAuthenticationError}set OnAuthenticationError(e){this.Data.OnAuthenticationError=e}constructor(e,t,r,s,n,a,i,o,u,l){super({Token:e,URL:t,WSURL:r,MJAPIKey:o,UserAPIKey:u,RefreshTokenFunction:s,OnAuthenticationError:l},n,a,i)}}class p extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderBase */ .Dny{static{y(this,"GraphQLDataProvider")}constructor(){super(),this._refreshPromise=null,this._dynamicHeaders=new Map,this._innerCurrentUserQueryString=`CurrentUser {
352
+ `,r={entityDocumentID:e.entityDocumentID};e.maxRecords!==void 0&&(r.maxRecords=e.maxRecords),e.filter!==void 0&&(r.filter=e.filter);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.FetchEntityVectors)throw new Error("Invalid response from server");return s.FetchEntityVectors}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.FetchEntityVectors failed",void 0,r),{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,ErrorMessage:r.message||"Unknown error"}}}}const F="5.35.0",$="default";class K{static{y(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}getCategoryMap(e){const t=e||$;let r=this._storage.get(t);return r||(r=new Map,this._storage.set(t,r)),r}async GetItem(e,t){const s=this.getCategoryMap(t||$).get(e);return s===void 0?null:s}async GetItems(e,t){const r=new Map;if(e.length===0)return r;const s=this.getCategoryMap(t||$);for(const n of new Set(e)){const a=s.get(n);r.set(n,a===void 0?null:a)}return r}async SetItem(e,t,r){this.getCategoryMap(r||$).set(e,t)}async Remove(e,t){this.getCategoryMap(t||$).delete(e)}async ClearCategory(e){const t=e||$;this._storage.delete(t)}async GetCategoryKeys(e){const t=this._storage.get(e||$);return t?Array.from(t.keys()):[]}}const Ie="MJ_Metadata",fe=0;function Re(){try{const I=F.split("."),e=parseInt(I[0],10),t=parseInt(I[1],10);if(!Number.isFinite(e)||!Number.isFinite(t))throw new Error(`Could not parse major.minor from version "${F}"`);return e*1e3+t+fe}catch(I){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:I,message:"Failed to derive IDB version from PACKAGE_VERSION; using fallback 99999"}),99999}}y(Re,"computeIdbVersion");const De=Re(),j=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"];class J extends K{static{y(this,"BrowserIndexedDBStorageProvider")}constructor(){super(),this._dbReady=!1,this.dbPromise=(0,_tempfix_idb__WEBPACK_IMPORTED_MODULE_10__/* .openDB */ .P2)(Ie,De,{upgrade:y((e,t,r)=>{try{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[IDBCache] Upgrading IndexedDB schema v${t} \u2192 v${r} (package ${F}). Dropping all stores; caches will repopulate on first use.`);for(const s of Array.from(e.objectStoreNames))e.deleteObjectStore(s);for(const s of j)e.objectStoreNames.contains(s)||e.createObjectStore(s)}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:s,message:s?.message})}},"upgrade"),blocked:y((e,t)=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[IDBCache] Upgrade from v${e} to v${t} blocked by another tab. Close other tabs to allow the upgrade to proceed.`)},"blocked")}),this.dbPromise.then(e=>{this._dbReady=!0,e.onversionchange=()=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)("[IDBCache] DB schema upgraded in another tab \u2014 closing local connection."),e.close(),this._dbReady=!1}}).catch(e=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:e,message:"IndexedDB initialization failed: "+e?.message})})}get IsReady(){return this._dbReady}isKnownCategory(e){const t=`mj:${e}`;return j.includes(t)}getStoreName(e){const t=e||$;return this.isKnownCategory(t)?`mj:${t}`:"mj:default"}getStoreKey(e,t){const r=t||$;return this.isKnownCategory(r)?e:`[${r}]:${e}`}async SetItem(e,t,r){try{const s=await this.dbPromise,n=this.getStoreName(r),a=this.getStoreKey(e,r),i=s.transaction(n,"readwrite");await i.objectStore(n).put(t,a),await i.done}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:s,message:s?.message})}}async GetItem(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),n=this.getStoreKey(e,t),a=await r.transaction(s).objectStore(s).get(n);return a===void 0?null:a}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:r,message:r?.message}),null}}async GetItems(e,t){const r=new Map;if(e.length===0)return r;try{const s=await this.dbPromise,n=this.getStoreName(t),a=Array.from(new Set(e)),i=a.map(R=>this.getStoreKey(R,t)),o=s.transaction(n,"readonly"),l=o.objectStore(n),u=i.map(R=>l.get(R)),f=await Promise.all(u);await o.done;for(let R=0;R<a.length;R++){const m=f[R];r.set(a[R],m===void 0?null:m)}return r}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:s,message:s?.message});for(const n of new Set(e))r.set(n,null);return r}}async Remove(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),n=this.getStoreKey(e,t),a=r.transaction(s,"readwrite");await a.objectStore(s).delete(n),await a.done}catch(r){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:r,message:r?.message})}}async ClearCategory(e){try{const t=await this.dbPromise,r=e||$,s=this.getStoreName(e);if(this.isKnownCategory(r)){const n=t.transaction(s,"readwrite");await n.objectStore(s).clear(),await n.done}else{const n=`[${r}]:`,a=t.transaction("mj:default","readwrite"),i=a.objectStore("mj:default"),o=await i.getAllKeys();for(const l of o)typeof l=="string"&&l.startsWith(n)&&await i.delete(l);await a.done}}catch(t){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:t,message:t?.message})}}async GetCategoryKeys(e){try{const t=await this.dbPromise,r=e||$,s=this.getStoreName(e),i=await t.transaction(s,"readonly").objectStore(s).getAllKeys();if(this.isKnownCategory(r))return i.map(l=>String(l));const o=`[${r}]:`;return i.map(l=>String(l)).filter(l=>l.startsWith(o)).map(l=>l.slice(o.length))}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:t,message:t?.message}),[]}}}class Ee extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderConfigDataBase */ .dZq{static{y(this,"GraphQLProviderConfigData")}get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get MJAPIKey(){return this.Data.MJAPIKey}set MJAPIKey(e){this.Data.MJAPIKey=e}get UserAPIKey(){return this.Data.UserAPIKey}set UserAPIKey(e){this.Data.UserAPIKey=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}get OnAuthenticationError(){return this.Data.OnAuthenticationError}set OnAuthenticationError(e){this.Data.OnAuthenticationError=e}constructor(e,t,r,s,n,a,i,o,l,u){super({Token:e,URL:t,WSURL:r,MJAPIKey:o,UserAPIKey:l,RefreshTokenFunction:s,OnAuthenticationError:u},n,a,i)}}class p extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderBase */ .Dny{static{y(this,"GraphQLDataProvider")}constructor(){super(),this._refreshPromise=null,this._dynamicHeaders=new Map,this._innerCurrentUserQueryString=`CurrentUser {
353
353
  ${this.userInfoString()}
354
354
  MJUserRoles_UserIDArray {
355
355
  ${this.userRoleInfoString()}
@@ -385,13 +385,13 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
385
385
  ${this.QueryReturnFieldList}
386
386
  }
387
387
  }
388
- `,u={QueryID:e};t!==void 0&&(u.CategoryID=t),r!==void 0&&(u.CategoryPath=r),n!==void 0&&(u.Parameters=n),a!==void 0&&(u.MaxRows=a),i!==void 0&&(u.StartRow=i);const l=await this.ExecuteGQL(o,u);if(l&&l.GetQueryData)return this.TransformQueryPayload(l.GetQueryData)}async RunQueryByName(e,t,r,s,n,a,i){const o=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
388
+ `,l={QueryID:e};t!==void 0&&(l.CategoryID=t),r!==void 0&&(l.CategoryPath=r),n!==void 0&&(l.Parameters=n),a!==void 0&&(l.MaxRows=a),i!==void 0&&(l.StartRow=i);const u=await this.ExecuteGQL(o,l);if(u&&u.GetQueryData)return this.TransformQueryPayload(u.GetQueryData)}async RunQueryByName(e,t,r,s,n,a,i){const o=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
389
389
  query GetQueryDataByNameQuery($QueryName: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
390
390
  GetQueryDataByName(QueryName: $QueryName, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
391
391
  ${this.QueryReturnFieldList}
392
392
  }
393
393
  }
394
- `,u={QueryName:e};t!==void 0&&(u.CategoryID=t),r!==void 0&&(u.CategoryPath=r),n!==void 0&&(u.Parameters=n),a!==void 0&&(u.MaxRows=a),i!==void 0&&(u.StartRow=i);const l=await this.ExecuteGQL(o,u);if(l&&l.GetQueryDataByName)return this.TransformQueryPayload(l.GetQueryDataByName)}get QueryReturnFieldList(){return`
394
+ `,l={QueryName:e};t!==void 0&&(l.CategoryID=t),r!==void 0&&(l.CategoryPath=r),n!==void 0&&(l.Parameters=n),a!==void 0&&(l.MaxRows=a),i!==void 0&&(l.StartRow=i);const u=await this.ExecuteGQL(o,l);if(u&&u.GetQueryDataByName)return this.TransformQueryPayload(u.GetQueryDataByName)}get QueryReturnFieldList(){return`
395
395
  Success
396
396
  QueryID
397
397
  QueryName
@@ -416,14 +416,14 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
416
416
  }
417
417
  }
418
418
  }
419
- `,a=(await this.ExecuteGQL(s,{input:r}))?.RunQueriesWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map(o=>{if((o.status==="stale"||o.status==="no_validation")&&o.Results){const u=JSON.parse(o.Results);return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,results:u,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}});return{success:a.success,results:i,errorMessage:a.errorMessage}}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error in RunQueriesWithCacheCheck: ${r}`),{success:!1,results:[],errorMessage:r instanceof Error?r.message:String(r)}}}async InternalRunView(e,t){try{let r="",s="";if(e){const n={};let a,i;if(e.ViewEntity)i=e.ViewEntity,a=i.Entity;else{const{entityName:m,v:h}=await this.getEntityNameAndUserView(e,t);i=h,a=m}const o=this.Entities.find(m=>m.Name===a);if(!o)throw new Error(`Entity ${a} not found in metadata`);let u=!1;const l=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(o);e.ViewID?(r=`Run${l}ViewByID`,s="RunViewByIDInput",n.ViewID=e.ViewID):e.ViewName?(r=`Run${l}ViewByName`,s="RunViewByNameInput",n.ViewName=e.ViewName):(u=!0,r=`Run${l}DynamicView`,s="RunDynamicViewInput",n.EntityName=e.EntityName),n.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",n.OrderBy=e.OrderBy?e.OrderBy:"",n.UserSearchString=e.UserSearchString?e.UserSearchString:"",n.Fields=e.Fields,n.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,e.MaxRows!==void 0&&(n.MaxRows=e.MaxRows),e.StartRow!==void 0&&(n.StartRow=e.StartRow),n.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,n.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(n.AuditLogDescription=e.AuditLogDescription),u||(n.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",n.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,n.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",n.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1),e.Aggregates&&e.Aggregates.length>0&&(n.Aggregates=e.Aggregates.map(m=>({expression:m.expression,alias:m.alias})));const f=this.getViewRunTimeFieldList(o,i,e,u),R=e.Aggregates&&e.Aggregates.length>0?`
419
+ `,a=(await this.ExecuteGQL(s,{input:r}))?.RunQueriesWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map(o=>{if((o.status==="stale"||o.status==="no_validation")&&o.Results){const l=JSON.parse(o.Results);return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,results:l,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}});return{success:a.success,results:i,errorMessage:a.errorMessage}}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error in RunQueriesWithCacheCheck: ${r}`),{success:!1,results:[],errorMessage:r instanceof Error?r.message:String(r)}}}async InternalRunView(e,t){try{let r="",s="";if(e){const n={};let a,i;if(e.ViewEntity)i=e.ViewEntity,a=i.Entity;else{const{entityName:S,v:h}=await this.getEntityNameAndUserView(e,t);i=h,a=S}const o=this.Entities.find(S=>S.Name===a);if(!o)throw new Error(`Entity ${a} not found in metadata`);let l=!1;const u=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(o);e.ViewID?(r=`Run${u}ViewByID`,s="RunViewByIDInput",n.ViewID=e.ViewID):e.ViewName?(r=`Run${u}ViewByName`,s="RunViewByNameInput",n.ViewName=e.ViewName):(l=!0,r=`Run${u}DynamicView`,s="RunDynamicViewInput",n.EntityName=e.EntityName),n.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",n.OrderBy=e.OrderBy?e.OrderBy:"",n.UserSearchString=e.UserSearchString?e.UserSearchString:"",n.Fields=e.Fields,n.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,e.MaxRows!==void 0&&(n.MaxRows=e.MaxRows),e.StartRow!==void 0&&(n.StartRow=e.StartRow),n.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,n.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(n.AuditLogDescription=e.AuditLogDescription),e.BypassCache!==void 0&&(n.BypassCache=e.BypassCache),l||(n.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",n.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,n.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",n.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1),e.Aggregates&&e.Aggregates.length>0&&(n.Aggregates=e.Aggregates.map(S=>({expression:S.expression,alias:S.alias})));const f=this.getViewRunTimeFieldList(o,i,e,l),R=e.Aggregates&&e.Aggregates.length>0?`
420
420
  AggregateResults {
421
421
  alias
422
422
  expression
423
423
  value
424
424
  error
425
425
  }
426
- AggregateExecutionTime`:"",S=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
426
+ AggregateExecutionTime`:"",m=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
427
427
  query RunViewQuery ($input: ${s}!) {
428
428
  ${r}(input: $input) {
429
429
  Results {
@@ -437,7 +437,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
437
437
  Success
438
438
  ErrorMessage${R}
439
439
  }
440
- }`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const g=await this.ExecuteGQL(S,{input:n});if(g&&g[r]){const m=g[r].AggregateResults;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Received aggregate results:",{entityName:a,aggregateResultCount:m?.length||0,aggregateResults:m,aggregateExecutionTime:g[r].AggregateExecutionTime});const h=g[r].Results;if(h&&h.length>0){const w=o.Fields.filter(E=>E.CodeName!==E.Name&&E.CodeName!==void 0);h.forEach(E=>{this.ConvertBackToMJFields(E),w.forEach(T=>{E[T.Name]=E[T.CodeName]})})}return g[r]}}else throw"No parameters passed to RunView";return null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async InternalRunViews(e,t){try{let r=[],s=[],n=[];for(const l of e){let f="",R="";const S={};let g=null,m=null;if(l.ViewEntity)m=l.ViewEntity,g=m.Get("Entity");else{const{entityName:E,v:T}=await this.getEntityNameAndUserView(l,t);m=T,g=E}const h=this.Entities.find(E=>E.Name===g);if(!h)throw new Error(`Entity ${g} not found in metadata`);s.push(h);let D=!1;const w=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(h);l.ViewID?(f=`Run${w}ViewByID`,R="RunViewByIDInput",S.ViewID=l.ViewID):l.ViewName?(f=`Run${w}ViewByName`,R="RunViewByNameInput",S.ViewName=l.ViewName):(D=!0,f=`Run${w}DynamicView`,R="RunDynamicViewInput",S.EntityName=l.EntityName),S.ExtraFilter=l.ExtraFilter||"",S.OrderBy=l.OrderBy||"",S.UserSearchString=l.UserSearchString||"",S.Fields=l.Fields,S.IgnoreMaxRows=l.IgnoreMaxRows||!1,l.MaxRows!==void 0&&(S.MaxRows=l.MaxRows),l.StartRow!==void 0&&(S.StartRow=l.StartRow),l.AfterKey&&(S.AfterKey={KeyValuePairs:l.AfterKey.KeyValuePairs}),S.ForceAuditLog=l.ForceAuditLog||!1,S.ResultType=l.ResultType||"simple",l.AuditLogDescription&&l.AuditLogDescription.length>0&&(S.AuditLogDescription=l.AuditLogDescription),D||(S.ExcludeUserViewRunID=l.ExcludeUserViewRunID||"",S.ExcludeDataFromAllPriorViewRuns=l.ExcludeDataFromAllPriorViewRuns||!1,S.OverrideExcludeFilter=l.OverrideExcludeFilter||"",S.SaveViewResults=l.SaveViewResults||!1),l.Aggregates&&l.Aggregates.length>0&&(S.Aggregates=l.Aggregates.map(E=>({expression:E.expression,alias:E.alias}))),r.push(S),n.push(...this.getViewRunTimeFieldList(h,m,l,D))}const i=e.some(l=>l.Aggregates&&l.Aggregates.length>0)?`
440
+ }`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const g=await this.ExecuteGQL(m,{input:n});if(g&&g[r]){const S=g[r].AggregateResults;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Received aggregate results:",{entityName:a,aggregateResultCount:S?.length||0,aggregateResults:S,aggregateExecutionTime:g[r].AggregateExecutionTime});const h=g[r].Results;if(h&&h.length>0){const w=o.Fields.filter(E=>E.CodeName!==E.Name&&E.CodeName!==void 0);h.forEach(E=>{this.ConvertBackToMJFields(E),w.forEach(T=>{E[T.Name]=E[T.CodeName]})})}return g[r]}}else throw"No parameters passed to RunView";return null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async InternalRunViews(e,t){try{let r=[],s=[],n=[];for(const u of e){let f="",R="";const m={};let g=null,S=null;if(u.ViewEntity)S=u.ViewEntity,g=S.Get("Entity");else{const{entityName:E,v:T}=await this.getEntityNameAndUserView(u,t);S=T,g=E}const h=this.Entities.find(E=>E.Name===g);if(!h)throw new Error(`Entity ${g} not found in metadata`);s.push(h);let D=!1;const w=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(h);u.ViewID?(f=`Run${w}ViewByID`,R="RunViewByIDInput",m.ViewID=u.ViewID):u.ViewName?(f=`Run${w}ViewByName`,R="RunViewByNameInput",m.ViewName=u.ViewName):(D=!0,f=`Run${w}DynamicView`,R="RunDynamicViewInput",m.EntityName=u.EntityName),m.ExtraFilter=u.ExtraFilter||"",m.OrderBy=u.OrderBy||"",m.UserSearchString=u.UserSearchString||"",m.Fields=u.Fields,m.IgnoreMaxRows=u.IgnoreMaxRows||!1,u.MaxRows!==void 0&&(m.MaxRows=u.MaxRows),u.StartRow!==void 0&&(m.StartRow=u.StartRow),u.AfterKey&&(m.AfterKey={KeyValuePairs:u.AfterKey.KeyValuePairs}),m.ForceAuditLog=u.ForceAuditLog||!1,m.ResultType=u.ResultType||"simple",u.AuditLogDescription&&u.AuditLogDescription.length>0&&(m.AuditLogDescription=u.AuditLogDescription),u.BypassCache!==void 0&&(m.BypassCache=u.BypassCache),D||(m.ExcludeUserViewRunID=u.ExcludeUserViewRunID||"",m.ExcludeDataFromAllPriorViewRuns=u.ExcludeDataFromAllPriorViewRuns||!1,m.OverrideExcludeFilter=u.OverrideExcludeFilter||"",m.SaveViewResults=u.SaveViewResults||!1),u.Aggregates&&u.Aggregates.length>0&&(m.Aggregates=u.Aggregates.map(E=>({expression:E.expression,alias:E.alias}))),r.push(m),n.push(...this.getViewRunTimeFieldList(h,S,u,D))}const i=e.some(u=>u.Aggregates&&u.Aggregates.length>0)?`
441
441
  AggregateResults {
442
442
  alias
443
443
  expression
@@ -462,7 +462,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
462
462
  Success
463
463
  ErrorMessage${i}
464
464
  }
465
- }`,u=await this.ExecuteGQL(o,{input:r});if(u&&u.RunViews){const l=u.RunViews;for(const[f,R]of l.entries())R.Results=R.Results.map(S=>{let g=JSON.parse(S.Data);return this.ConvertBackToMJFields(g),g});return l}return null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async RunViewsWithCacheCheck(e,t){try{const r=e.map(o=>({params:{EntityName:o.params.EntityName||"",ExtraFilter:o.params.ExtraFilter||"",OrderBy:o.params.OrderBy||"",Fields:o.params.Fields,UserSearchString:o.params.UserSearchString||"",IgnoreMaxRows:o.params.IgnoreMaxRows||!1,MaxRows:o.params.MaxRows,StartRow:o.params.StartRow,AfterKey:o.params.AfterKey?{KeyValuePairs:o.params.AfterKey.KeyValuePairs}:null,ForceAuditLog:o.params.ForceAuditLog||!1,AuditLogDescription:o.params.AuditLogDescription||"",ResultType:o.params.ResultType||"simple"},cacheStatus:o.cacheStatus?{maxUpdatedAt:o.cacheStatus.maxUpdatedAt,rowCount:o.cacheStatus.rowCount}:null})),s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
465
+ }`,l=await this.ExecuteGQL(o,{input:r});if(l&&l.RunViews){const u=l.RunViews;for(const[f,R]of u.entries())R.Results=R.Results.map(m=>{let g=JSON.parse(m.Data);return this.ConvertBackToMJFields(g),g});return u}return null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async RunViewsWithCacheCheck(e,t){try{const r=e.map(o=>({params:{EntityName:o.params.EntityName||"",ExtraFilter:o.params.ExtraFilter||"",OrderBy:o.params.OrderBy||"",Fields:o.params.Fields,UserSearchString:o.params.UserSearchString||"",IgnoreMaxRows:o.params.IgnoreMaxRows||!1,MaxRows:o.params.MaxRows,StartRow:o.params.StartRow,AfterKey:o.params.AfterKey?{KeyValuePairs:o.params.AfterKey.KeyValuePairs}:null,ForceAuditLog:o.params.ForceAuditLog||!1,AuditLogDescription:o.params.AuditLogDescription||"",ResultType:o.params.ResultType||"simple"},cacheStatus:o.cacheStatus?{maxUpdatedAt:o.cacheStatus.maxUpdatedAt,rowCount:o.cacheStatus.rowCount}:null})),s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
466
466
  query RunViewsWithCacheCheckQuery($input: [RunViewWithCacheCheckInput!]!) {
467
467
  RunViewsWithCacheCheck(input: $input) {
468
468
  success
@@ -495,7 +495,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
495
495
  }
496
496
  }
497
497
  }
498
- `,a=(await this.ExecuteGQL(s,{input:r}))?.RunViewsWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map((o,u)=>{const l=e[u];if(o.status==="differential"&&o.differentialData){const f=o.differentialData.updatedRows.map(R=>{const S=JSON.parse(R.Data);return this.ConvertBackToMJFields(S),S});return{viewIndex:o.viewIndex,status:o.status,results:void 0,differentialData:{updatedRows:f,deletedRecordIDs:o.differentialData.deletedRecordIDs},maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}if(o.status==="stale"&&o.Results){const f=o.Results.map(R=>{const S=JSON.parse(R.Data);return this.ConvertBackToMJFields(S),S});return{viewIndex:o.viewIndex,status:o.status,results:f,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}return{viewIndex:o.viewIndex,status:o.status,results:void 0,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}});return{success:a.success,results:i,errorMessage:a.errorMessage}}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),{success:!1,results:[],errorMessage:r instanceof Error?r.message:String(r)}}}async getEntityNameAndUserView(e,t){let r,s;if(e.EntityName)r=e.EntityName;else if(e.ViewID)s=await _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__/* .ViewInfo */ .o1C.GetViewEntity(e.ViewID,t),r=s.Entity;else if(e.ViewName)s=await _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__/* .ViewInfo */ .o1C.GetViewEntityByName(e.ViewName,t),r=s.Entity;else throw new Error("No EntityName, ViewID or ViewName passed to RunView");return{entityName:r,v:s}}getViewRunTimeFieldList(e,t,r,s){const n=[],a=new v;if(r.Fields){for(const i of e.PrimaryKeys)r.Fields.find(o=>o.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&n.push(i.Name);r.Fields.forEach(i=>{n.push(a.MapFieldName(i))})}else if(s)e.Fields.forEach(i=>{i.IsBinaryFieldType||n.push(a.MapFieldName(i.CodeName))});else{for(const i of e.PrimaryKeys)n.find(o=>o.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&n.push(i.Name);t.Columns.forEach(i=>{i.hidden===!1&&!n.find(o=>o.trim().toLowerCase()===i.EntityField?.Name.trim().toLowerCase())&&i.EntityField&&n.push(a.MapFieldName(i.EntityField.CodeName))})}return n}get ProviderType(){return _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderType */ .cpK.Network}async GetRecordChanges(e,t){try{const r={EntityName:"MJ: Record Changes",ExtraFilter:`RecordID = '${t.Values()}' AND Entity = '${e}'`},s=await this.RunView(r);return s?s.Results.sort((n,a)=>n.ChangedAt>a.ChangedAt?-1:1):null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async GetRecordDependencies(e,t){try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
498
+ `,a=(await this.ExecuteGQL(s,{input:r}))?.RunViewsWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map((o,l)=>{const u=e[l];if(o.status==="differential"&&o.differentialData){const f=o.differentialData.updatedRows.map(R=>{const m=JSON.parse(R.Data);return this.ConvertBackToMJFields(m),m});return{viewIndex:o.viewIndex,status:o.status,results:void 0,differentialData:{updatedRows:f,deletedRecordIDs:o.differentialData.deletedRecordIDs},maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}if(o.status==="stale"&&o.Results){const f=o.Results.map(R=>{const m=JSON.parse(R.Data);return this.ConvertBackToMJFields(m),m});return{viewIndex:o.viewIndex,status:o.status,results:f,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}return{viewIndex:o.viewIndex,status:o.status,results:void 0,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}});return{success:a.success,results:i,errorMessage:a.errorMessage}}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),{success:!1,results:[],errorMessage:r instanceof Error?r.message:String(r)}}}async getEntityNameAndUserView(e,t){let r,s;if(e.EntityName)r=e.EntityName;else if(e.ViewID)s=await _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__/* .ViewInfo */ .o1C.GetViewEntity(e.ViewID,t),r=s.Entity;else if(e.ViewName)s=await _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__/* .ViewInfo */ .o1C.GetViewEntityByName(e.ViewName,t),r=s.Entity;else throw new Error("No EntityName, ViewID or ViewName passed to RunView");return{entityName:r,v:s}}getViewRunTimeFieldList(e,t,r,s){const n=[],a=new v;if(r.Fields){for(const i of e.PrimaryKeys)r.Fields.find(o=>o.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&n.push(i.Name);r.Fields.forEach(i=>{n.push(a.MapFieldName(i))})}else if(s)e.Fields.forEach(i=>{i.IsBinaryFieldType||n.push(a.MapFieldName(i.CodeName))});else{for(const i of e.PrimaryKeys)n.find(o=>o.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&n.push(i.Name);t.Columns.forEach(i=>{i.hidden===!1&&!n.find(o=>o.trim().toLowerCase()===i.EntityField?.Name.trim().toLowerCase())&&i.EntityField&&n.push(a.MapFieldName(i.EntityField.CodeName))})}return n}get ProviderType(){return _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderType */ .cpK.Network}async GetRecordChanges(e,t){try{const r={EntityName:"MJ: Record Changes",ExtraFilter:`RecordID = '${t.Values()}' AND Entity = '${e}'`},s=await this.RunView(r);return s?s.Results.sort((n,a)=>n.ChangedAt>a.ChangedAt?-1:1):null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async GetRecordDependencies(e,t){try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
499
499
  GetRecordDependencies(entityName: $entityName, CompositeKey: $CompositeKey) {
500
500
  EntityName
501
501
  RelatedEntityName
@@ -546,32 +546,32 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
546
546
  Message
547
547
  }
548
548
  }
549
- }`,a={EntityName:e.EntityName,SurvivingRecordCompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(e.SurvivingRecordCompositeKey.KeyValuePairs)},FieldMap:e.FieldMap?.map(o=>({FieldName:o.FieldName,Value:o.Value.toString()})),RecordsToMerge:e.RecordsToMerge.map(o=>o.Copy())};return(await this.ExecuteGQL(n,{request:a}))?.MergeRecords}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),{Success:!1,OverallStatus:n&&n.message?n.message:n,RecordStatus:[],RecordMergeLogID:"",Request:e}}}async Save(e,t,r){if(r?.IsParentEntitySave){const n=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;return n.StartedAt=new Date,n.EndedAt=new Date,n.Type=e.IsSaved?"update":"create",n.Success=!0,n.NewValues=e.GetAll(),e.RegisterResultHistoryEntry(n),n.NewValues}const s=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;try{e.RegisterTransactionPreprocessing();const n={input:{}},a=e.IsSaved?"Update":"Create";s.StartedAt=new Date,s.Type=e.IsSaved?"update":"create",s.OriginalValues=e.Fields.map(g=>({FieldName:g.CodeName,Value:g.Value})),e.RegisterResultHistoryEntry(s);const i=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),o=`${a}${i}`,u=e.Fields.filter(g=>!g.ReadOnly||g.IsPrimaryKey&&e.IsSaved),l=new v,f=` ${o}(input: $input) {
550
- ${e.Fields.map(g=>l.MapFieldName(g.CodeName)).join(`
549
+ }`,a={EntityName:e.EntityName,SurvivingRecordCompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(e.SurvivingRecordCompositeKey.KeyValuePairs)},FieldMap:e.FieldMap?.map(o=>({FieldName:o.FieldName,Value:o.Value.toString()})),RecordsToMerge:e.RecordsToMerge.map(o=>o.Copy())};return(await this.ExecuteGQL(n,{request:a}))?.MergeRecords}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),{Success:!1,OverallStatus:n&&n.message?n.message:n,RecordStatus:[],RecordMergeLogID:"",Request:e}}}async Save(e,t,r){if(r?.IsParentEntitySave){const n=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;return n.StartedAt=new Date,n.EndedAt=new Date,n.Type=e.IsSaved?"update":"create",n.Success=!0,n.NewValues=e.GetAll(),e.RegisterResultHistoryEntry(n),n.NewValues}const s=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;try{e.RegisterTransactionPreprocessing();const n={input:{}},a=e.IsSaved?"Update":"Create";s.StartedAt=new Date,s.Type=e.IsSaved?"update":"create",s.OriginalValues=e.Fields.map(g=>({FieldName:g.CodeName,Value:g.Value})),e.RegisterResultHistoryEntry(s);const i=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),o=`${a}${i}`,l=e.Fields.filter(g=>!g.ReadOnly||g.IsPrimaryKey&&e.IsSaved),u=new v,f=` ${o}(input: $input) {
550
+ ${e.Fields.map(g=>u.MapFieldName(g.CodeName)).join(`
551
551
  `)}
552
552
  }`,R=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation ${a}${i} ($input: ${o}Input!) {
553
553
  ${f}
554
554
  }
555
- `;for(let g=0;g<u.length;g++){const m=u[g];let h=e.Get(m.Name);if(h)switch(m.EntityFieldInfo.TSType){case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date:h=h.getTime();break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean:typeof h!="boolean"&&(h=parseInt(h)!==0);break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number:if(typeof h!="number"){const D=Number(h);isNaN(D)||(h=D)}break}h===null&&m.EntityFieldInfo.AllowsNull===!1&&(m.EntityFieldInfo.DefaultValue!==null?h=m.EntityFieldInfo.DefaultValue:m.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number||m.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?h=0:h=""),n.input[l.MapFieldName(m.CodeName)]=h}const S=e.RestoreContext;if(S&&(n.input.RestoreContext___={SourceChangeID:S.SourceChangeID,Reason:S.Reason}),a.trim().toLowerCase()==="update"&&r.SkipOldValuesCheck===!1){const g=[];e.Fields.forEach(m=>{let h=null;m.OldValue!==null&&m.OldValue!==void 0&&(m.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date?h=m.OldValue.getTime().toString():m.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?h=m.OldValue===!0?"1":"0":typeof m.OldValue!="string"?h=m.OldValue.toString():h=m.OldValue),g.push({Key:l.MapFieldName(m.CodeName),Value:h})}),n.input.OldValues___=g}if(e.TransactionGroup){const g=[{varName:"input",inputType:o+"Input!"}];return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,s.Type==="create"?"Create":"Update",f,n,{mutationName:o,mutationInputTypes:g},(m,h)=>{s.EndedAt=new Date,h&&m?(s.Success=!0,s.NewValues=this.ConvertBackToMJFields(m)):(s.Success=!1,s.Message="Transaction failed")})),!0}else{const g=await this.ExecuteGQL(R,n);if(g&&g[o])return s.Success=!0,s.EndedAt=new Date,s.NewValues=this.ConvertBackToMJFields(g[o]),s.NewValues;throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(n){return s.Success=!1,s.EndedAt=new Date,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message,(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),null}}async Load(e,t,r=null,s){try{const n={};let a="",i="";for(let S=0;S<t.KeyValuePairs.length;S++){const g=e.Fields.find(D=>D.Name.trim().toLowerCase()===t.KeyValuePairs[S].FieldName.trim().toLowerCase()).EntityFieldInfo,m=t.GetValueByIndex(S),h=g.GraphQLType;if(i.length>0&&(i+=", "),i+=`$${g.CodeName}: ${h}!`,a.length>0&&(a+=", "),a+=`${g.CodeName}: $${g.CodeName}`,g.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number){if(isNaN(t.GetValueByIndex(S)))throw new Error(`Primary Key value ${m} (${g.Name}) is not a valid number`);n[g.CodeName]=parseInt(m)}else n[g.CodeName]=m}const o=r&&r.length>0?this.getRelatedEntityString(e.EntityInfo,r):"",u=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),l=new v,f=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query Single${u}${o.length>0?"Full":""} (${i}) {
556
- ${u}(${a}) {
557
- ${e.Fields.filter(S=>!S.EntityFieldInfo.IsBinaryFieldType).map(S=>S.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?S.CodeName.replace("__mj_","_mj__"):S.CodeName).join(`
555
+ `;for(let g=0;g<l.length;g++){const S=l[g];let h=e.Get(S.Name);if(h)switch(S.EntityFieldInfo.TSType){case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date:h=h.getTime();break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean:typeof h!="boolean"&&(h=parseInt(h)!==0);break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number:if(typeof h!="number"){const D=Number(h);isNaN(D)||(h=D)}break}h===null&&S.EntityFieldInfo.AllowsNull===!1&&(S.EntityFieldInfo.DefaultValue!==null?h=S.EntityFieldInfo.DefaultValue:S.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number||S.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?h=0:h=""),n.input[u.MapFieldName(S.CodeName)]=h}const m=e.RestoreContext;if(m&&(n.input.RestoreContext___={SourceChangeID:m.SourceChangeID,Reason:m.Reason}),a.trim().toLowerCase()==="update"&&r.SkipOldValuesCheck===!1){const g=[];e.Fields.forEach(S=>{let h=null;S.OldValue!==null&&S.OldValue!==void 0&&(S.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date?h=S.OldValue.getTime().toString():S.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?h=S.OldValue===!0?"1":"0":typeof S.OldValue!="string"?h=S.OldValue.toString():h=S.OldValue),g.push({Key:u.MapFieldName(S.CodeName),Value:h})}),n.input.OldValues___=g}if(e.TransactionGroup){const g=[{varName:"input",inputType:o+"Input!"}];return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,s.Type==="create"?"Create":"Update",f,n,{mutationName:o,mutationInputTypes:g},(S,h)=>{s.EndedAt=new Date,h&&S?(s.Success=!0,s.NewValues=this.ConvertBackToMJFields(S)):(s.Success=!1,s.Message="Transaction failed")})),!0}else{const g=await this.ExecuteGQL(R,n);if(g&&g[o])return s.Success=!0,s.EndedAt=new Date,s.NewValues=this.ConvertBackToMJFields(g[o]),s.NewValues;throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(n){return s.Success=!1,s.EndedAt=new Date,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message,(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),null}}async Load(e,t,r=null,s){try{const n={};let a="",i="";for(let m=0;m<t.KeyValuePairs.length;m++){const g=e.Fields.find(D=>D.Name.trim().toLowerCase()===t.KeyValuePairs[m].FieldName.trim().toLowerCase()).EntityFieldInfo,S=t.GetValueByIndex(m),h=g.GraphQLType;if(i.length>0&&(i+=", "),i+=`$${g.CodeName}: ${h}!`,a.length>0&&(a+=", "),a+=`${g.CodeName}: $${g.CodeName}`,g.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number){if(isNaN(t.GetValueByIndex(m)))throw new Error(`Primary Key value ${S} (${g.Name}) is not a valid number`);n[g.CodeName]=parseInt(S)}else n[g.CodeName]=S}const o=r&&r.length>0?this.getRelatedEntityString(e.EntityInfo,r):"",l=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),u=new v,f=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query Single${l}${o.length>0?"Full":""} (${i}) {
556
+ ${l}(${a}) {
557
+ ${e.Fields.filter(m=>!m.EntityFieldInfo.IsBinaryFieldType).map(m=>m.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?m.CodeName.replace("__mj_","_mj__"):m.CodeName).join(`
558
558
  `)}
559
559
  ${o}
560
560
  }
561
561
  }
562
- `,R=await this.ExecuteGQL(f,n);return R&&R[u]?this.ConvertBackToMJFields(R[u]):null}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),null}}ConvertBackToMJFields(e){return new v().ReverseMapFields(e),e}getRelatedEntityString(e,t){let r="";for(let s=0;s<e.RelatedEntities.length;s++)if(t.indexOf(e.RelatedEntities[s].RelatedEntity)>=0){const n=e.RelatedEntities[s],a=this.Entities.find(o=>(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .UUIDsEqual */ .jd)(o.ID,n.RelatedEntityID));let i="";n.Type.toLowerCase().trim()==="many to many"?i=`${n.RelatedEntityCodeName}_${n.JoinEntityJoinField.replace(/\s/g,"")}`:i=`${n.RelatedEntityCodeName}_${n.RelatedEntityJoinField.replace(/\s/g,"")}`,r+=`
562
+ `,R=await this.ExecuteGQL(f,n);return R&&R[l]?this.ConvertBackToMJFields(R[l]):null}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),null}}ConvertBackToMJFields(e){return new v().ReverseMapFields(e),e}getRelatedEntityString(e,t){let r="";for(let s=0;s<e.RelatedEntities.length;s++)if(t.indexOf(e.RelatedEntities[s].RelatedEntity)>=0){const n=e.RelatedEntities[s],a=this.Entities.find(o=>(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .UUIDsEqual */ .jd)(o.ID,n.RelatedEntityID));let i="";n.Type.toLowerCase().trim()==="many to many"?i=`${n.RelatedEntityCodeName}_${n.JoinEntityJoinField.replace(/\s/g,"")}`:i=`${n.RelatedEntityCodeName}_${n.RelatedEntityJoinField.replace(/\s/g,"")}`,r+=`
563
563
  ${i} {
564
564
  ${a.Fields.map(o=>o.CodeName).join(`
565
565
  `)}
566
566
  }
567
- `}return r}async Delete(e,t,r){const s=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;try{e.RegisterTransactionPreprocessing(),s.StartedAt=new Date,s.Type="delete",s.OriginalValues=e.Fields.map(g=>({FieldName:g.CodeName,Value:g.Value})),e.RegisterResultHistoryEntry(s);const n={},a=[];let i="",o="",u="";for(let g of e.PrimaryKey.KeyValuePairs){const m=e.Fields.find(h=>h.Name.trim().toLowerCase()===g.FieldName.trim().toLowerCase());n[m.CodeName]=m.Value,a.push({varName:m.CodeName,inputType:m.EntityFieldInfo.GraphQLType+"!"}),i.length>0&&(i+=", "),i+=`${m.CodeName}: $${m.CodeName}`,o.length>0&&(o+=", "),o+=`$${m.CodeName}: ${m.EntityFieldInfo.GraphQLType}!`,u.length>0&&(u+=`
568
- `),u+=`${m.CodeName}`}a.push({varName:"options___",inputType:"DeleteOptionsInput!"}),n.options___={SkipEntityAIActions:t?.SkipEntityAIActions??!1,SkipEntityActions:t?.SkipEntityActions??!1,ReplayOnly:t?.ReplayOnly??!1,IsParentEntityDelete:t?.IsParentEntityDelete??!1};const f="Delete"+(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),R=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`${f}(${i}, options___: $options___) {
569
- ${u}
567
+ `}return r}async Delete(e,t,r){const s=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;try{e.RegisterTransactionPreprocessing(),s.StartedAt=new Date,s.Type="delete",s.OriginalValues=e.Fields.map(g=>({FieldName:g.CodeName,Value:g.Value})),e.RegisterResultHistoryEntry(s);const n={},a=[];let i="",o="",l="";for(let g of e.PrimaryKey.KeyValuePairs){const S=e.Fields.find(h=>h.Name.trim().toLowerCase()===g.FieldName.trim().toLowerCase());n[S.CodeName]=S.Value,a.push({varName:S.CodeName,inputType:S.EntityFieldInfo.GraphQLType+"!"}),i.length>0&&(i+=", "),i+=`${S.CodeName}: $${S.CodeName}`,o.length>0&&(o+=", "),o+=`$${S.CodeName}: ${S.EntityFieldInfo.GraphQLType}!`,l.length>0&&(l+=`
568
+ `),l+=`${S.CodeName}`}a.push({varName:"options___",inputType:"DeleteOptionsInput!"}),n.options___={SkipEntityAIActions:t?.SkipEntityAIActions??!1,SkipEntityActions:t?.SkipEntityActions??!1,ReplayOnly:t?.ReplayOnly??!1,IsParentEntityDelete:t?.IsParentEntityDelete??!1};const f="Delete"+(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),R=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`${f}(${i}, options___: $options___) {
569
+ ${l}
570
570
  }
571
- `,S=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation ${f} (${o}, $options___: DeleteOptionsInput!) {
571
+ `,m=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation ${f} (${o}, $options___: DeleteOptionsInput!) {
572
572
  ${R}
573
573
  }
574
- `;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,"Delete",R,n,{mutationName:f,mutationInputTypes:a},(g,m)=>{if(s.EndedAt=new Date,m&&g){let h=!0;for(const D of e.PrimaryKey.KeyValuePairs)D.Value!==g[D.FieldName]&&(h=!1);h?s.Success=!0:(s.Success=!1,s.Message="Transaction failed to commit")}else s.Success=!1,s.Message="Transaction failed to commit"})),!0;{const g=await this.ExecuteGQL(S,n);if(g&&g[f]){const m=g[f];for(let h of e.PrimaryKey.KeyValuePairs){let D=m[h.FieldName],w=h.Value;if(typeof w=="number"&&(w=w.toString()),typeof D=="number"&&(D=D.toString()),w!==D)throw new Error(`Primary key value mismatch in server Delete response. Field: ${h.FieldName}, Original: ${w}, Returned: ${D}`)}return s.Success=!0,s.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(n){return s.EndedAt=new Date,s.Success=!1,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message,(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),!1}}async GetDatasetByName(e,t){const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
574
+ `;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,"Delete",R,n,{mutationName:f,mutationInputTypes:a},(g,S)=>{if(s.EndedAt=new Date,S&&g){let h=!0;for(const D of e.PrimaryKey.KeyValuePairs)D.Value!==g[D.FieldName]&&(h=!1);h?s.Success=!0:(s.Success=!1,s.Message="Transaction failed to commit")}else s.Success=!1,s.Message="Transaction failed to commit"})),!0;{const g=await this.ExecuteGQL(m,n);if(g&&g[f]){const S=g[f];for(let h of e.PrimaryKey.KeyValuePairs){let D=S[h.FieldName],w=h.Value;if(typeof w=="number"&&(w=w.toString()),typeof D=="number"&&(D=D.toString()),w!==D)throw new Error(`Primary key value mismatch in server Delete response. Field: ${h.FieldName}, Original: ${w}, Returned: ${D}`)}return s.Success=!0,s.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(n){return s.EndedAt=new Date,s.Success=!1,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message,(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),!1}}async GetDatasetByName(e,t){const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
575
575
  GetDatasetByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
576
576
  DatasetID
577
577
  DatasetName
@@ -603,7 +603,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
603
603
  Success
604
604
  IsFavorite
605
605
  }
606
- }`,i=await this.ExecuteGQL(a,{params:{UserID:e,EntityID:n.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)}}});if(i&&i.GetRecordFavoriteStatus&&i.GetRecordFavoriteStatus.Success)return i.GetRecordFavoriteStatus.IsFavorite}async SetRecordFavoriteStatus(e,t,r,s,n){const a=this.Entities.find(u=>u.Name===t);if(!a)throw new Error(`Entity ${t} not found in metadata`);const i=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation SetRecordFavoriteStatus($params: UserFavoriteSetParams!) {
606
+ }`,i=await this.ExecuteGQL(a,{params:{UserID:e,EntityID:n.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)}}});if(i&&i.GetRecordFavoriteStatus&&i.GetRecordFavoriteStatus.Success)return i.GetRecordFavoriteStatus.IsFavorite}async SetRecordFavoriteStatus(e,t,r,s,n){const a=this.Entities.find(l=>l.Name===t);if(!a)throw new Error(`Entity ${t} not found in metadata`);const i=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation SetRecordFavoriteStatus($params: UserFavoriteSetParams!) {
607
607
  SetRecordFavoriteStatus(params: $params){
608
608
  Success
609
609
  }
@@ -638,16 +638,16 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
638
638
  ErrorMessage
639
639
  Result
640
640
  }
641
- }`,r=await this.ExecuteGQL(t,{DataContextItemID:e});if(r&&r.GetDataContextItemData){if(r.GetDataContextItemData.Success)return JSON.parse(r.GetDataContextItemData.Result);throw new Error(r.GetDataContextItemData.ErrorMessage)}else throw new Error("GraphQL query failed")}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),t}}static async ExecuteGQL(e,t,r=!0){return p.Instance.ExecuteGQL(e,t,r)}async ExecuteGQL(e,t,r=!0){try{return await this._client.request(e,t)}catch(s){if(console.error("[GraphQL] ExecuteGQL error caught:",{hasResponse:!!s?.response,hasErrors:!!s?.response?.errors,errorCount:s?.response?.errors?.length,firstError:s?.response?.errors?.[0],errorCode:s?.response?.errors?.[0]?.extensions?.code,errorMessage:s?.response?.errors?.[0]?.message,fullError:s}),s&&s.response&&s.response.errors?.length>0)if(s.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(r)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("JWT_EXPIRED and refreshTokenIfNeeded is false"),s}else throw s;else throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(s),s}}async RefreshToken(){const e=p.Instance&&p.Instance._configData===this._configData;if(e&&p.Instance._refreshPromise)return p.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(p.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&p.Instance&&(p.Instance._refreshPromise=null)}}async performTokenRefresh(){if(this._configData.Data.RefreshTokenFunction)try{const e=await this._configData.Data.RefreshTokenFunction();if(e){this._configData.Token=e;const t=this.CreateNewGraphQLClient(this._configData.URL,this._configData.Token,this._sessionId,this._configData.MJAPIKey,this._configData.UserAPIKey);this._client=t,p.Instance&&p.Instance._configData===this._configData&&(p.Instance._client=t)}else{const t=new Error("Refresh token function returned null or undefined token");throw this.notifyAuthenticationError(t),t}}catch(e){const t=e instanceof Error?e:new Error(String(e));throw this.notifyAuthenticationError(t),e}else{const e=new Error("No refresh token function provided");throw this.notifyAuthenticationError(e),e}}notifyAuthenticationError(e){try{const t=this._configData?.OnAuthenticationError;t&&t(e)}catch(t){console.error("[GraphQLDataProvider] Error in OnAuthenticationError callback:",t)}}static async RefreshToken(){return p.Instance.RefreshToken()}static async clearClientCache(e=new Set){const t=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);s&&!e.has(s)&&t.push(s)}t.forEach(r=>localStorage.removeItem(r)),await new Promise(r=>{const s=indexedDB.deleteDatabase("MJ_Metadata");s.onsuccess=()=>r(),s.onerror=()=>r(),s.onblocked=()=>r()})}CreateNewGraphQLClient(e,t,r,s,n){const a={"x-session-id":r};t&&(a.authorization="Bearer "+t),s&&(a["x-mj-api-key"]=s),n&&(a["x-api-key"]=n);const i=new graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .GraphQLClient */ .l4(e,{headers:a});for(const[o,u]of this._dynamicHeaders)i.setHeader(o,u);return i}userInfoString(){return this.infoString(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserInfo */ .oqB(null,null))}userRoleInfoString(){return this.infoString(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserRoleInfo */ .St$(null))}infoString(e){let t="";const r=Object.keys(e);for(const s of r)s.startsWith("__mj_")?t+=s.replace("__mj_","_mj__")+`
641
+ }`,r=await this.ExecuteGQL(t,{DataContextItemID:e});if(r&&r.GetDataContextItemData){if(r.GetDataContextItemData.Success)return JSON.parse(r.GetDataContextItemData.Result);throw new Error(r.GetDataContextItemData.ErrorMessage)}else throw new Error("GraphQL query failed")}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),t}}static async ExecuteGQL(e,t,r=!0){return p.Instance.ExecuteGQL(e,t,r)}async ExecuteGQL(e,t,r=!0){try{return await this._client.request(e,t)}catch(s){if(console.error("[GraphQL] ExecuteGQL error caught:",{hasResponse:!!s?.response,hasErrors:!!s?.response?.errors,errorCount:s?.response?.errors?.length,firstError:s?.response?.errors?.[0],errorCode:s?.response?.errors?.[0]?.extensions?.code,errorMessage:s?.response?.errors?.[0]?.message,fullError:s}),s&&s.response&&s.response.errors?.length>0)if(s.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(r)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("JWT_EXPIRED and refreshTokenIfNeeded is false"),s}else throw s;else throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(s),s}}async RefreshToken(){const e=p.Instance&&p.Instance._configData===this._configData;if(e&&p.Instance._refreshPromise)return p.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(p.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&p.Instance&&(p.Instance._refreshPromise=null)}}async performTokenRefresh(){if(this._configData.Data.RefreshTokenFunction)try{const e=await this._configData.Data.RefreshTokenFunction();if(e){this._configData.Token=e;const t=this.CreateNewGraphQLClient(this._configData.URL,this._configData.Token,this._sessionId,this._configData.MJAPIKey,this._configData.UserAPIKey);this._client=t,p.Instance&&p.Instance._configData===this._configData&&(p.Instance._client=t)}else{const t=new Error("Refresh token function returned null or undefined token");throw this.notifyAuthenticationError(t),t}}catch(e){const t=e instanceof Error?e:new Error(String(e));throw this.notifyAuthenticationError(t),e}else{const e=new Error("No refresh token function provided");throw this.notifyAuthenticationError(e),e}}notifyAuthenticationError(e){try{const t=this._configData?.OnAuthenticationError;t&&t(e)}catch(t){console.error("[GraphQLDataProvider] Error in OnAuthenticationError callback:",t)}}static async RefreshToken(){return p.Instance.RefreshToken()}static async clearClientCache(e=new Set){const t=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);s&&!e.has(s)&&t.push(s)}t.forEach(r=>localStorage.removeItem(r)),await new Promise(r=>{const s=indexedDB.deleteDatabase("MJ_Metadata");s.onsuccess=()=>r(),s.onerror=()=>r(),s.onblocked=()=>r()})}CreateNewGraphQLClient(e,t,r,s,n){const a={"x-session-id":r};t&&(a.authorization="Bearer "+t),s&&(a["x-mj-api-key"]=s),n&&(a["x-api-key"]=n);const i=new graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .GraphQLClient */ .l4(e,{headers:a});for(const[o,l]of this._dynamicHeaders)i.setHeader(o,l);return i}userInfoString(){return this.infoString(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserInfo */ .oqB(null,null))}userRoleInfoString(){return this.infoString(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserRoleInfo */ .St$(null))}infoString(e){let t="";const r=Object.keys(e);for(const s of r)s.startsWith("__mj_")?t+=s.replace("__mj_","_mj__")+`
642
642
  `:s.startsWith("_")||(t+=s+`
643
- `);return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new J:this._localStorageProvider=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .InMemoryLocalStorageProvider */ .KWg),this._localStorageProvider}get Metadata(){return this}get SocketConnectivity$(){return this._socketStateSubject.asObservable()}get SocketConnectionState(){return this._socketStateSubject.value}ForceSocketReconnect(){this.disposeWSClient()}getOrCreateWSClient(){const e=Date.now();return this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&this._activeSubscriptionCount===0&&this.disposeWSClient(),this._wsClient||(this._isDisposingSocketIntentionally=!1,this._wsClient=(0,graphql_ws__WEBPACK_IMPORTED_MODULE_8__/* .createClient */ .UU)({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token},keepAlive:3e4,retryAttempts:3,shouldRetry:y(()=>!0,"shouldRetry")}),this._wsClientCreatedAt=e,this._wsClient.on("connected",()=>{this._socketStateSubject.next("connected")}),this._wsClient.on("closed",()=>{this._isDisposingSocketIntentionally||this._socketStateSubject.next("disconnected")}),this._subscriptionCleanupTimer||(this._subscriptionCleanupTimer=setInterval(()=>{this.cleanupStaleSubscriptions()},this.SUBSCRIPTION_CLEANUP_INTERVAL_MS))),this._wsClient}disposeWSClient(){if(this._wsClient){this._isDisposingSocketIntentionally=!0;try{this._wsClient.dispose()}catch(e){console.error("[GraphQLDataProvider] Error disposing WebSocket client:",e)}this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject.next("unknown")}}completeAllSubjects(){this._pushStatusSubjects.forEach((e,t)=>{try{e.subject.complete(),e.subscription.unsubscribe()}catch(r){console.error(`[GraphQLDataProvider] Error cleaning up subject for ${t}:`,r)}}),this._pushStatusSubjects.clear()}cleanupStaleSubscriptions(){if(!this._isCleaningUp){this._isCleaningUp=!0;try{const e=Date.now(),t=this._pushStatusSubjects.size,r=Array.from(this._pushStatusSubjects.entries()),s=[];r.forEach(([n,a])=>{const i=e-a.lastRequestedAt,o=e-a.lastEmissionAt;a.activeSubscribers===0&&i>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&o>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&(console.log(`[GraphQLDataProvider] Marking session ${n} for cleanup: activeSubscribers=${a.activeSubscribers}, timeSinceRequested=${Math.round(i/1e3)}s, timeSinceEmission=${Math.round(o/1e3)}s`),s.push(n))}),s.forEach(n=>{const a=this._pushStatusSubjects.get(n);if(a)try{a.subject.complete(),a.subscription.unsubscribe(),this._pushStatusSubjects.delete(n),console.log(`[GraphQLDataProvider] Cleaned up stale subscription for session: ${n}`)}catch(i){console.error(`[GraphQLDataProvider] Error cleaning up subscription for ${n}:`,i)}}),s.length>0&&console.log(`[GraphQLDataProvider] Cleaned up ${s.length} stale subscription(s)`),this._pushStatusSubjects.size===0&&this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&(console.log("[GraphQLDataProvider] Disposing of idle WebSocket client"),this.disposeWSClient())}finally{this._isCleaningUp=!1}}}subscribe(e,t){return new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(r=>{const s=this.getOrCreateWSClient();this._activeSubscriptionCount++;const n=s.subscribe({query:e,variables:t},{next:y(a=>{r.next(a.data)},"next"),error:y(async a=>{const i=a;if(i?.extensions?.code==="JWT_EXPIRED"||i?.message?.includes("token has expired")||i?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] WebSocket JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),r.complete()}catch(u){console.error("[GraphQLDataProvider] Failed to refresh token for WebSocket:",u),r.error(u)}}else r.error(a)},"error"),complete:y(()=>{r.complete()},"complete")});return()=>{this._activeSubscriptionCount--,n()}})}PushStatusUpdates(e=null){e||(e=this.sessionId);const t=Date.now(),r=this._pushStatusSubjects.get(e);if(r)return r.lastRequestedAt=t,new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{r.activeSubscribers++;const u=r.subject.subscribe(o);return()=>{const l=this._pushStatusSubjects.get(e);l&&l.activeSubscribers>0&&l.activeSubscribers--,u.unsubscribe()}});const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`subscription StatusUpdates($sessionId: String!) {
643
+ `);return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new J:this._localStorageProvider=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .InMemoryLocalStorageProvider */ .KWg),this._localStorageProvider}get Metadata(){return this}get SocketConnectivity$(){return this._socketStateSubject.asObservable()}get SocketConnectionState(){return this._socketStateSubject.value}ForceSocketReconnect(){this.disposeWSClient()}getOrCreateWSClient(){const e=Date.now();return this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&this._activeSubscriptionCount===0&&this.disposeWSClient(),this._wsClient||(this._isDisposingSocketIntentionally=!1,this._wsClient=(0,graphql_ws__WEBPACK_IMPORTED_MODULE_8__/* .createClient */ .UU)({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token},keepAlive:3e4,retryAttempts:3,shouldRetry:y(()=>!0,"shouldRetry")}),this._wsClientCreatedAt=e,this._wsClient.on("connected",()=>{this._socketStateSubject.next("connected")}),this._wsClient.on("closed",()=>{this._isDisposingSocketIntentionally||this._socketStateSubject.next("disconnected")}),this._subscriptionCleanupTimer||(this._subscriptionCleanupTimer=setInterval(()=>{this.cleanupStaleSubscriptions()},this.SUBSCRIPTION_CLEANUP_INTERVAL_MS))),this._wsClient}disposeWSClient(){if(this._wsClient){this._isDisposingSocketIntentionally=!0;try{this._wsClient.dispose()}catch(e){console.error("[GraphQLDataProvider] Error disposing WebSocket client:",e)}this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject.next("unknown")}}completeAllSubjects(){this._pushStatusSubjects.forEach((e,t)=>{try{e.subject.complete(),e.subscription.unsubscribe()}catch(r){console.error(`[GraphQLDataProvider] Error cleaning up subject for ${t}:`,r)}}),this._pushStatusSubjects.clear()}cleanupStaleSubscriptions(){if(!this._isCleaningUp){this._isCleaningUp=!0;try{const e=Date.now(),t=this._pushStatusSubjects.size,r=Array.from(this._pushStatusSubjects.entries()),s=[];r.forEach(([n,a])=>{const i=e-a.lastRequestedAt,o=e-a.lastEmissionAt;a.activeSubscribers===0&&i>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&o>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&(console.log(`[GraphQLDataProvider] Marking session ${n} for cleanup: activeSubscribers=${a.activeSubscribers}, timeSinceRequested=${Math.round(i/1e3)}s, timeSinceEmission=${Math.round(o/1e3)}s`),s.push(n))}),s.forEach(n=>{const a=this._pushStatusSubjects.get(n);if(a)try{a.subject.complete(),a.subscription.unsubscribe(),this._pushStatusSubjects.delete(n),console.log(`[GraphQLDataProvider] Cleaned up stale subscription for session: ${n}`)}catch(i){console.error(`[GraphQLDataProvider] Error cleaning up subscription for ${n}:`,i)}}),s.length>0&&console.log(`[GraphQLDataProvider] Cleaned up ${s.length} stale subscription(s)`),this._pushStatusSubjects.size===0&&this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&(console.log("[GraphQLDataProvider] Disposing of idle WebSocket client"),this.disposeWSClient())}finally{this._isCleaningUp=!1}}}subscribe(e,t){return new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(r=>{const s=this.getOrCreateWSClient();this._activeSubscriptionCount++;const n=s.subscribe({query:e,variables:t},{next:y(a=>{r.next(a.data)},"next"),error:y(async a=>{const i=a;if(i?.extensions?.code==="JWT_EXPIRED"||i?.message?.includes("token has expired")||i?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] WebSocket JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),r.complete()}catch(l){console.error("[GraphQLDataProvider] Failed to refresh token for WebSocket:",l),r.error(l)}}else r.error(a)},"error"),complete:y(()=>{r.complete()},"complete")});return()=>{this._activeSubscriptionCount--,n()}})}PushStatusUpdates(e=null){e||(e=this.sessionId);const t=Date.now(),r=this._pushStatusSubjects.get(e);if(r)return r.lastRequestedAt=t,new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{r.activeSubscribers++;const l=r.subject.subscribe(o);return()=>{const u=this._pushStatusSubjects.get(e);u&&u.activeSubscribers>0&&u.activeSubscribers--,l.unsubscribe()}});const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`subscription StatusUpdates($sessionId: String!) {
644
644
  statusUpdates(sessionId: $sessionId) {
645
645
  date
646
646
  message
647
647
  sessionId
648
648
  }
649
649
  }
650
- `,n=new rxjs__WEBPACK_IMPORTED_MODULE_5__/* .Subject */ .B,a=this.getOrCreateWSClient(),i=new rxjs__WEBPACK_IMPORTED_MODULE_7__/* .Subscription */ .yU;return i.add(new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{const u=a.subscribe({query:s,variables:{sessionId:e}},{next:y(l=>{const f=this._pushStatusSubjects.get(e);f&&(f.lastEmissionAt=Date.now()),o.next(l.data.statusUpdates.message)},"next"),error:y(async l=>{const f=l;if(f?.extensions?.code==="JWT_EXPIRED"||f?.message?.includes("token has expired")||f?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] PushStatusUpdates JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),o.complete()}catch(S){console.error("[GraphQLDataProvider] Failed to refresh token for PushStatusUpdates:",S),o.error(S)}}else o.error(l)},"error"),complete:y(()=>{o.complete()},"complete")});return this._activeSubscriptionCount++,()=>{this._activeSubscriptionCount--,u()}}).subscribe({next:y(o=>n.next(o),"next"),error:y(o=>{n.error(o),this._pushStatusSubjects.delete(e)},"error"),complete:y(()=>{n.complete(),this._pushStatusSubjects.delete(e)},"complete")})),this._pushStatusSubjects.set(e,{subject:n,subscription:i,createdAt:t,lastRequestedAt:t,lastEmissionAt:t,activeSubscribers:0}),new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{const u=this._pushStatusSubjects.get(e);u&&u.activeSubscribers++;const l=n.subscribe(o);return()=>{const f=this._pushStatusSubjects.get(e);f&&f.activeSubscribers>0&&f.activeSubscribers--,l.unsubscribe()}})}disposeWebSocketResources(){this._subscriptionCleanupTimer&&(clearInterval(this._subscriptionCleanupTimer),this._subscriptionCleanupTimer=null),this.UnsubscribeFromCacheInvalidation(),this.completeAllSubjects(),this._activeSubscriptionCount=0,this.disposeWSClient()}ClientToolRequests(e){return this.subscribe(`
650
+ `,n=new rxjs__WEBPACK_IMPORTED_MODULE_5__/* .Subject */ .B,a=this.getOrCreateWSClient(),i=new rxjs__WEBPACK_IMPORTED_MODULE_7__/* .Subscription */ .yU;return i.add(new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{const l=a.subscribe({query:s,variables:{sessionId:e}},{next:y(u=>{const f=this._pushStatusSubjects.get(e);f&&(f.lastEmissionAt=Date.now()),o.next(u.data.statusUpdates.message)},"next"),error:y(async u=>{const f=u;if(f?.extensions?.code==="JWT_EXPIRED"||f?.message?.includes("token has expired")||f?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] PushStatusUpdates JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),o.complete()}catch(m){console.error("[GraphQLDataProvider] Failed to refresh token for PushStatusUpdates:",m),o.error(m)}}else o.error(u)},"error"),complete:y(()=>{o.complete()},"complete")});return this._activeSubscriptionCount++,()=>{this._activeSubscriptionCount--,l()}}).subscribe({next:y(o=>n.next(o),"next"),error:y(o=>{n.error(o),this._pushStatusSubjects.delete(e)},"error"),complete:y(()=>{n.complete(),this._pushStatusSubjects.delete(e)},"complete")})),this._pushStatusSubjects.set(e,{subject:n,subscription:i,createdAt:t,lastRequestedAt:t,lastEmissionAt:t,activeSubscribers:0}),new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{const l=this._pushStatusSubjects.get(e);l&&l.activeSubscribers++;const u=n.subscribe(o);return()=>{const f=this._pushStatusSubjects.get(e);f&&f.activeSubscribers>0&&f.activeSubscribers--,u.unsubscribe()}})}disposeWebSocketResources(){this._subscriptionCleanupTimer&&(clearInterval(this._subscriptionCleanupTimer),this._subscriptionCleanupTimer=null),this.UnsubscribeFromCacheInvalidation(),this.completeAllSubjects(),this._activeSubscriptionCount=0,this.disposeWSClient()}ClientToolRequests(e){return this.subscribe(`
651
651
  subscription ClientToolRequest($sessionID: String!) {
652
652
  ClientToolRequest(sessionID: $sessionID) {
653
653
  AgentRunID
@@ -1458,7 +1458,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
1458
1458
  failedAccounts
1459
1459
  }
1460
1460
  }
1461
- `,n={input:{AccountIDs:e,Query:t,MaxResultsPerAccount:r?.maxResultsPerAccount,FileTypes:r?.fileTypes,SearchContent:r?.searchContent}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.SearchAcrossAccounts)throw new Error("Invalid response from server");const i=a.SearchAcrossAccounts;return{accountResults:i.accountResults.map(o=>({accountId:o.accountID,accountName:o.accountName,success:o.success,errorMessage:o.errorMessage,results:o.results.map(u=>({path:u.path,name:u.name,size:u.size,contentType:u.contentType,lastModified:new Date(u.lastModified),relevance:u.relevance,excerpt:u.excerpt,matchInFilename:u.matchInFilename,objectId:u.objectId})),totalMatches:o.totalMatches,hasMore:o.hasMore,nextPageToken:o.nextPageToken})),totalResultsReturned:i.totalResultsReturned,successfulAccounts:i.successfulAccounts,failedAccounts:i.failedAccounts}}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error searching across accounts: ${s}`),{accountResults:[],totalResultsReturned:0,successfulAccounts:0,failedAccounts:e.length}}}}class Oe{static{y(this,"GraphQLSearchClient")}constructor(e){this._dataProvider=e}async ExecuteSearch(e){try{const t=this.buildSearchKnowledgeMutation(),r=this.prepareSearchVariables(e),s=await this._dataProvider.ExecuteGQL(t,r);return this.processSearchKnowledgeResult(s)}catch(t){return this.handleSearchError(t)}}async PreviewSearch(e,t){try{const r=this.buildPreviewSearchMutation(),s=this.preparePreviewVariables(e,t),n=await this._dataProvider.ExecuteGQL(r,s);return this.processPreviewSearchResult(n)}catch(r){return this.handleSearchError(r)}}buildSearchKnowledgeMutation(){return (0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
1461
+ `,n={input:{AccountIDs:e,Query:t,MaxResultsPerAccount:r?.maxResultsPerAccount,FileTypes:r?.fileTypes,SearchContent:r?.searchContent}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.SearchAcrossAccounts)throw new Error("Invalid response from server");const i=a.SearchAcrossAccounts;return{accountResults:i.accountResults.map(o=>({accountId:o.accountID,accountName:o.accountName,success:o.success,errorMessage:o.errorMessage,results:o.results.map(l=>({path:l.path,name:l.name,size:l.size,contentType:l.contentType,lastModified:new Date(l.lastModified),relevance:l.relevance,excerpt:l.excerpt,matchInFilename:l.matchInFilename,objectId:l.objectId})),totalMatches:o.totalMatches,hasMore:o.hasMore,nextPageToken:o.nextPageToken})),totalResultsReturned:i.totalResultsReturned,successfulAccounts:i.successfulAccounts,failedAccounts:i.failedAccounts}}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error searching across accounts: ${s}`),{accountResults:[],totalResultsReturned:0,successfulAccounts:0,failedAccounts:e.length}}}}class Oe{static{y(this,"GraphQLSearchClient")}constructor(e){this._dataProvider=e}async ExecuteSearch(e){try{const t=this.buildSearchKnowledgeMutation(),r=this.prepareSearchVariables(e),s=await this._dataProvider.ExecuteGQL(t,r);return this.processSearchKnowledgeResult(s)}catch(t){return this.handleSearchError(t)}}async PreviewSearch(e,t){try{const r=this.buildPreviewSearchMutation(),s=this.preparePreviewVariables(e,t),n=await this._dataProvider.ExecuteGQL(r,s);return this.processPreviewSearchResult(n)}catch(r){return this.handleSearchError(r)}}buildSearchKnowledgeMutation(){return (0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
1462
1462
  mutation SearchKnowledge($query: String!, $maxResults: Float, $filters: SearchFiltersInput, $minScore: Float, $scopeIDs: [ID!], $searchContext: SearchContextInput) {
1463
1463
  SearchKnowledge(query: $query, maxResults: $maxResults, filters: $filters, minScore: $minScore, scopeIDs: $scopeIDs, searchContext: $searchContext) {
1464
1464
  Success
@@ -1597,7 +1597,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
1597
1597
  ElapsedMs
1598
1598
  ErrorMessage
1599
1599
  }
1600
- }`;n=this._dataProvider.subscribe(o,{streamID:i.StreamID}).subscribe({next:y(u=>{const l=u?.SearchStreamEvents;l&&(t.next(l),l.Phase==="final"?(t.complete(),n?.unsubscribe()):l.Phase==="error"&&(t.error(new Error(l.ErrorMessage??"Stream error")),n?.unsubscribe()))},"next"),error:y(u=>t.error(u),"error")})}catch(a){t.error(a)}})(),()=>{n?.unsubscribe()}})}prepareFilters(e){const t={};return e.EntityNames!==void 0&&e.EntityNames.length>0&&(t.EntityNames=e.EntityNames),e.SourceTypes!==void 0&&e.SourceTypes.length>0&&(t.SourceTypes=e.SourceTypes),e.Tags!==void 0&&e.Tags.length>0&&(t.Tags=e.Tags),t}preparePreviewVariables(e,t){const r={query:e};return t!==void 0&&(r.maxResults=t),r}processSearchKnowledgeResult(e){if(!e?.SearchKnowledge)throw new Error("Invalid response from server");const t=e.SearchKnowledge;return this.mapSearchResponse(t)}processPreviewSearchResult(e){if(!e?.PreviewSearch)throw new Error("Invalid response from server");const t=e.PreviewSearch;return this.mapSearchResponse(t)}mapSearchResponse(e){return{Success:e.Success,Results:(e.Results||[]).map(t=>this.mapResultItem(t)),TotalCount:e.TotalCount,ElapsedMs:e.ElapsedMs,SourceCounts:this.mapSourceCounts(e.SourceCounts),Providers:(e.Providers||[]).map(t=>({ID:t.ID,Name:t.Name,DisplayName:t.DisplayName,Icon:t.Icon,SourceType:t.SourceType,Priority:t.Priority})),ErrorMessage:e.ErrorMessage}}mapResultItem(e){return{ID:e.ID,EntityName:e.EntityName,RecordID:e.RecordID,SourceType:e.SourceType,ResultType:e.ResultType,Title:e.Title,Snippet:e.Snippet,Score:e.Score,ScoreBreakdown:this.mapScoreBreakdown(e.ScoreBreakdown),Tags:e.Tags||[],EntityIcon:e.EntityIcon,RecordName:e.RecordName,MatchedAt:e.MatchedAt,RawMetadata:e.RawMetadata,ProviderId:e.ProviderId,ProviderLabel:e.ProviderLabel,ProviderIcon:e.ProviderIcon}}mapScoreBreakdown(e){if(!e)return{};const t={};return e.Vector!==void 0&&(t.Vector=e.Vector),e.FullText!==void 0&&(t.FullText=e.FullText),e.Entity!==void 0&&(t.Entity=e.Entity),e.Storage!==void 0&&(t.Storage=e.Storage),t}mapSourceCounts(e){return e?{Vector:e.Vector??0,FullText:e.FullText??0,Entity:e.Entity??0,Storage:e.Storage??0}:{Vector:0,FullText:0,Entity:0,Storage:0}}handleSearchError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error executing search: ${t}`),{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,SourceCounts:{Vector:0,FullText:0,Entity:0,Storage:0},Providers:[],ErrorMessage:`Error: ${t.message}`}}}class ke{static{y(this,"GraphQLIntegrationClient")}constructor(e){this._dataProvider=e}async DiscoverObjects(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
1600
+ }`;n=this._dataProvider.subscribe(o,{streamID:i.StreamID}).subscribe({next:y(l=>{const u=l?.SearchStreamEvents;u&&(t.next(u),u.Phase==="final"?(t.complete(),n?.unsubscribe()):u.Phase==="error"&&(t.error(new Error(u.ErrorMessage??"Stream error")),n?.unsubscribe()))},"next"),error:y(l=>t.error(l),"error")})}catch(a){t.error(a)}})(),()=>{n?.unsubscribe()}})}prepareFilters(e){const t={};return e.EntityNames!==void 0&&e.EntityNames.length>0&&(t.EntityNames=e.EntityNames),e.SourceTypes!==void 0&&e.SourceTypes.length>0&&(t.SourceTypes=e.SourceTypes),e.Tags!==void 0&&e.Tags.length>0&&(t.Tags=e.Tags),t}preparePreviewVariables(e,t){const r={query:e};return t!==void 0&&(r.maxResults=t),r}processSearchKnowledgeResult(e){if(!e?.SearchKnowledge)throw new Error("Invalid response from server");const t=e.SearchKnowledge;return this.mapSearchResponse(t)}processPreviewSearchResult(e){if(!e?.PreviewSearch)throw new Error("Invalid response from server");const t=e.PreviewSearch;return this.mapSearchResponse(t)}mapSearchResponse(e){return{Success:e.Success,Results:(e.Results||[]).map(t=>this.mapResultItem(t)),TotalCount:e.TotalCount,ElapsedMs:e.ElapsedMs,SourceCounts:this.mapSourceCounts(e.SourceCounts),Providers:(e.Providers||[]).map(t=>({ID:t.ID,Name:t.Name,DisplayName:t.DisplayName,Icon:t.Icon,SourceType:t.SourceType,Priority:t.Priority})),ErrorMessage:e.ErrorMessage}}mapResultItem(e){return{ID:e.ID,EntityName:e.EntityName,RecordID:e.RecordID,SourceType:e.SourceType,ResultType:e.ResultType,Title:e.Title,Snippet:e.Snippet,Score:e.Score,ScoreBreakdown:this.mapScoreBreakdown(e.ScoreBreakdown),Tags:e.Tags||[],EntityIcon:e.EntityIcon,RecordName:e.RecordName,MatchedAt:e.MatchedAt,RawMetadata:e.RawMetadata,ProviderId:e.ProviderId,ProviderLabel:e.ProviderLabel,ProviderIcon:e.ProviderIcon}}mapScoreBreakdown(e){if(!e)return{};const t={};return e.Vector!==void 0&&(t.Vector=e.Vector),e.FullText!==void 0&&(t.FullText=e.FullText),e.Entity!==void 0&&(t.Entity=e.Entity),e.Storage!==void 0&&(t.Storage=e.Storage),t}mapSourceCounts(e){return e?{Vector:e.Vector??0,FullText:e.FullText??0,Entity:e.Entity??0,Storage:e.Storage??0}:{Vector:0,FullText:0,Entity:0,Storage:0}}handleSearchError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error executing search: ${t}`),{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,SourceCounts:{Vector:0,FullText:0,Entity:0,Storage:0},Providers:[],ErrorMessage:`Error: ${t.message}`}}}class ke{static{y(this,"GraphQLIntegrationClient")}constructor(e){this._dataProvider=e}async DiscoverObjects(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
1601
1601
  query IntegrationDiscoverObjects($companyIntegrationID: String!) {
1602
1602
  IntegrationDiscoverObjects(companyIntegrationID: $companyIntegrationID) {
1603
1603
  Success
@@ -1748,7 +1748,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
1748
1748
  PipelineSteps { Name Status DurationMs Message }
1749
1749
  GitCommitSuccess APIRestarted
1750
1750
  }
1751
- }`,u={Connectors:e.map(f=>({CompanyIntegrationID:f.CompanyIntegrationID,SourceObjects:f.SourceObjects.map(R=>({SourceObjectID:R.SourceObjectID??null,SourceObjectName:R.SourceObjectName??null,Fields:R.Fields??null}))})),StartSync:t,FullSync:r,SyncScope:s},l=(await this._dataProvider.ExecuteGQL(o,{input:u,platform:n,skipGitCommit:a,skipRestart:i}))?.IntegrationApplyAllBatch;return l?{Success:l.Success,Message:l.Message,Steps:l.PipelineSteps,GitCommitSuccess:l.GitCommitSuccess,APIRestarted:l.APIRestarted,EntityMapsCreated:l.ConnectorResults?.[0]?.EntityMapsCreated,SyncRunID:l.ConnectorResults?.[0]?.SyncRunID,Warnings:l.ConnectorResults?.flatMap(f=>f.Warnings??[])}:{Success:!1,Message:"No response"}}catch(o){return{Success:!1,Message:o.message}}}async ApplyAll(e,t,r="sqlserver",s=!1,n=!1){try{const a=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation IntegrationApplyAll(
1751
+ }`,l={Connectors:e.map(f=>({CompanyIntegrationID:f.CompanyIntegrationID,SourceObjects:f.SourceObjects.map(R=>({SourceObjectID:R.SourceObjectID??null,SourceObjectName:R.SourceObjectName??null,Fields:R.Fields??null}))})),StartSync:t,FullSync:r,SyncScope:s},u=(await this._dataProvider.ExecuteGQL(o,{input:l,platform:n,skipGitCommit:a,skipRestart:i}))?.IntegrationApplyAllBatch;return u?{Success:u.Success,Message:u.Message,Steps:u.PipelineSteps,GitCommitSuccess:u.GitCommitSuccess,APIRestarted:u.APIRestarted,EntityMapsCreated:u.ConnectorResults?.[0]?.EntityMapsCreated,SyncRunID:u.ConnectorResults?.[0]?.SyncRunID,Warnings:u.ConnectorResults?.flatMap(f=>f.Warnings??[])}:{Success:!1,Message:"No response"}}catch(o){return{Success:!1,Message:o.message}}}async ApplyAll(e,t,r="sqlserver",s=!1,n=!1){try{const a=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation IntegrationApplyAll(
1752
1752
  $input: ApplyAllInput!, $platform: String!, $skipGitCommit: Boolean!, $skipRestart: Boolean!
1753
1753
  ) {
1754
1754
  IntegrationApplyAll(input: $input, platform: $platform, skipGitCommit: $skipGitCommit, skipRestart: $skipRestart) {