@memberjunction/react-runtime 6.1.5 → 6.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +21 -0
- package/dist/324.runtime.umd.js +79 -77
- package/dist/runtime.umd.js +2590 -1652
- package/package.json +6 -6
package/dist/324.runtime.umd.js
CHANGED
|
@@ -6,49 +6,49 @@
|
|
|
6
6
|
|
|
7
7
|
__webpack_require__.r(__webpack_exports__);
|
|
8
8
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
/* harmony export */ ActionItemInput: () => (/* binding */
|
|
10
|
-
/* harmony export */ ActionItemOutput: () => (/* binding */
|
|
9
|
+
/* harmony export */ ActionItemInput: () => (/* binding */ Xe),
|
|
10
|
+
/* harmony export */ ActionItemOutput: () => (/* binding */ Ze),
|
|
11
11
|
/* harmony export */ BrowserIndexedDBStorageProvider: () => (/* binding */ oe),
|
|
12
12
|
/* harmony export */ BrowserStorageProviderBase: () => (/* binding */ ne),
|
|
13
|
-
/* harmony export */ FieldMapper: () => (/* binding */
|
|
13
|
+
/* harmony export */ FieldMapper: () => (/* binding */ M),
|
|
14
14
|
/* harmony export */ FireAndForgetHelper: () => (/* binding */ w),
|
|
15
|
-
/* harmony export */ GetDataOutput: () => (/* binding */
|
|
15
|
+
/* harmony export */ GetDataOutput: () => (/* binding */ tt),
|
|
16
16
|
/* harmony export */ GraphQLAIClient: () => (/* binding */ se),
|
|
17
|
-
/* harmony export */ GraphQLActionClient: () => (/* binding */
|
|
18
|
-
/* harmony export */ GraphQLClassifyClient: () => (/* binding */
|
|
19
|
-
/* harmony export */ GraphQLClusterClient: () => (/* binding */
|
|
20
|
-
/* harmony export */ GraphQLComponentRegistryClient: () => (/* binding */
|
|
21
|
-
/* harmony export */ GraphQLDataProvider: () => (/* binding */
|
|
22
|
-
/* harmony export */ GraphQLEncryptionClient: () => (/* binding */
|
|
23
|
-
/* harmony export */ GraphQLFileStorageClient: () => (/* binding */
|
|
24
|
-
/* harmony export */ GraphQLIntegrationClient: () => (/* binding */
|
|
25
|
-
/* harmony export */ GraphQLListsClient: () => (/* binding */
|
|
26
|
-
/* harmony export */ GraphQLLiveKitClient: () => (/* binding */
|
|
27
|
-
/* harmony export */ GraphQLProviderConfigData: () => (/* binding */
|
|
28
|
-
/* harmony export */ GraphQLSearchClient: () => (/* binding */
|
|
29
|
-
/* harmony export */ GraphQLSystemUserClient: () => (/* binding */
|
|
30
|
-
/* harmony export */ GraphQLTestingClient: () => (/* binding */
|
|
17
|
+
/* harmony export */ GraphQLActionClient: () => (/* binding */ at),
|
|
18
|
+
/* harmony export */ GraphQLClassifyClient: () => (/* binding */ mt),
|
|
19
|
+
/* harmony export */ GraphQLClusterClient: () => (/* binding */ dt),
|
|
20
|
+
/* harmony export */ GraphQLComponentRegistryClient: () => (/* binding */ St),
|
|
21
|
+
/* harmony export */ GraphQLDataProvider: () => (/* binding */ I),
|
|
22
|
+
/* harmony export */ GraphQLEncryptionClient: () => (/* binding */ lt),
|
|
23
|
+
/* harmony export */ GraphQLFileStorageClient: () => (/* binding */ ht),
|
|
24
|
+
/* harmony export */ GraphQLIntegrationClient: () => (/* binding */ ft),
|
|
25
|
+
/* harmony export */ GraphQLListsClient: () => (/* binding */ ot),
|
|
26
|
+
/* harmony export */ GraphQLLiveKitClient: () => (/* binding */ yt),
|
|
27
|
+
/* harmony export */ GraphQLProviderConfigData: () => (/* binding */ Be),
|
|
28
|
+
/* harmony export */ GraphQLSearchClient: () => (/* binding */ It),
|
|
29
|
+
/* harmony export */ GraphQLSystemUserClient: () => (/* binding */ et),
|
|
30
|
+
/* harmony export */ GraphQLTestingClient: () => (/* binding */ gt),
|
|
31
31
|
/* harmony export */ GraphQLTransactionGroup: () => (/* binding */ re),
|
|
32
|
-
/* harmony export */ GraphQLVersionHistoryClient: () => (/* binding */
|
|
32
|
+
/* harmony export */ GraphQLVersionHistoryClient: () => (/* binding */ pt),
|
|
33
33
|
/* harmony export */ PACKAGE_VERSION: () => (/* binding */ F),
|
|
34
|
-
/* harmony export */ RoleInput: () => (/* binding */
|
|
35
|
-
/* harmony export */ RolesAndUsersInput: () => (/* binding */
|
|
34
|
+
/* harmony export */ RoleInput: () => (/* binding */ We),
|
|
35
|
+
/* harmony export */ RolesAndUsersInput: () => (/* binding */ ze),
|
|
36
36
|
/* harmony export */ SafeGraphQLError: () => (/* binding */ V),
|
|
37
37
|
/* harmony export */ SanitizeGraphQLError: () => (/* binding */ O),
|
|
38
|
-
/* harmony export */ SimpleRemoteEntity: () => (/* binding */
|
|
39
|
-
/* harmony export */ SimpleRemoteEntityField: () => (/* binding */
|
|
40
|
-
/* harmony export */ SimpleRemoteEntityOutput: () => (/* binding */
|
|
38
|
+
/* harmony export */ SimpleRemoteEntity: () => (/* binding */ st),
|
|
39
|
+
/* harmony export */ SimpleRemoteEntityField: () => (/* binding */ nt),
|
|
40
|
+
/* harmony export */ SimpleRemoteEntityOutput: () => (/* binding */ rt),
|
|
41
41
|
/* harmony export */ SyncDataAction: () => (/* binding */ ce),
|
|
42
|
-
/* harmony export */ SyncDataResult: () => (/* binding */
|
|
43
|
-
/* harmony export */ SyncRolesAndUsersResult: () => (/* binding */
|
|
42
|
+
/* harmony export */ SyncDataResult: () => (/* binding */ Ye),
|
|
43
|
+
/* harmony export */ SyncRolesAndUsersResult: () => (/* binding */ Je),
|
|
44
44
|
/* harmony export */ ToSafeGraphQLError: () => (/* binding */ ie),
|
|
45
|
-
/* harmony export */ UserInput: () => (/* binding */
|
|
45
|
+
/* harmony export */ UserInput: () => (/* binding */ He),
|
|
46
46
|
/* harmony export */ gql: () => (/* reexport safe */ graphql_request__WEBPACK_IMPORTED_MODULE_0__.J1),
|
|
47
|
-
/* harmony export */ setupGraphQLClient: () => (/* binding */
|
|
47
|
+
/* harmony export */ setupGraphQLClient: () => (/* binding */ je)
|
|
48
48
|
/* harmony export */ });
|
|
49
49
|
/* harmony import */ var graphql_request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(927);
|
|
50
|
-
/* harmony import */ var _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
51
|
-
/* harmony import */ var _memberjunction_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
50
|
+
/* harmony import */ var _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(978);
|
|
51
|
+
/* harmony import */ var _memberjunction_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(240);
|
|
52
52
|
/* harmony import */ var _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(278);
|
|
53
53
|
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(942);
|
|
54
54
|
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(291);
|
|
@@ -57,7 +57,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
57
57
|
/* harmony import */ var graphql_ws__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(283);
|
|
58
58
|
/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(289);
|
|
59
59
|
/* harmony import */ var _tempfix_idb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(74);
|
|
60
|
-
var ye=Object.defineProperty;var l=(d,e)=>ye(d,"name",{value:e,configurable:!0});class
|
|
60
|
+
var ye=Object.defineProperty;var l=(d,e)=>ye(d,"name",{value:e,configurable:!0});class M{static{l(this,"FieldMapper")}static{this.DB_PREFIX="__mj_"}static{this.GQL_PREFIX="_mj__"}constructor(){}MapFields(e){if(e)for(const t in e){const r=this.MapFieldName(t);r!==t&&(e[r]=e[t],delete e[t])}return e}MapFieldName(e){return e.startsWith(M.DB_PREFIX)?M.GQL_PREFIX+e.substring(M.DB_PREFIX.length):e}ReverseMapFieldName(e){return e.startsWith(M.GQL_PREFIX)?M.DB_PREFIX+e.substring(M.GQL_PREFIX.length):e}ReverseMapFields(e){for(const t in e){const r=this.ReverseMapFieldName(t);r!==t&&(e[r]=e[t],delete e[t])}return e}}class re extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionGroupBase */ .VHz{static{l(this,"GraphQLTransactionGroup")}constructor(e){super(),this._provider=e}async HandleSubmit(){const e=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
61
61
|
mutation ExecuteTransactionGroup($group: TransactionInputType!) {
|
|
62
62
|
ExecuteTransactionGroup(group: $group) {
|
|
63
63
|
Success
|
|
@@ -65,7 +65,7 @@ var ye=Object.defineProperty;var l=(d,e)=>ye(d,"name",{value:e,configurable:!0})
|
|
|
65
65
|
ResultsJSON
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
`,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=n.Success===!0,i=[];for(let o=0;o<this.PendingTransactions.length;o++){const m=n.ResultsJSON[o],u=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(m),g=this.PendingTransactions[o];i.push(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionResult */ .qTq(g,u,a&&u!==null))}return i}else throw new Error("Failed to execute transaction group")}}const
|
|
68
|
+
`,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=n.Success===!0,i=[];for(let o=0;o<this.PendingTransactions.length;o++){const m=n.ResultsJSON[o],u=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(m),g=this.PendingTransactions[o];i.push(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionResult */ .qTq(g,u,a&&u!==null))}return i}else throw new Error("Failed to execute transaction group")}}const xe=720*1e3,Te=6;class w{static{l(this,"FireAndForgetHelper")}static async Execute(e){const t=e.operationLabel??e.mutationFieldName;if(!(typeof e.dataProvider.PushStatusUpdates=="function"))return w.executeSynchronously(e);const s=e.timeoutMs??xe,n=e.maxStallReconciles??Te;let a,i=!1,o=0;const{promise:m,resolve:u,reject:g}=w.createCompletionPromise(),f=l(p=>{i||(i=!0,h.clear(),p())},"finish"),S=l(p=>f(()=>u(p)),"settleResolve"),E=l(p=>f(()=>g(p)),"settleReject"),D=l(async()=>{if(i)return;if(!e.onStall){E(new Error(w.timeoutMessage(e.timeoutErrorMessage,s)));return}let p;try{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Idle window elapsed, reconciling against server run record`),p=await e.onStall()}catch(R){E(R);return}i||(p==="continue"?++o>n?E(new Error(`The operation is still reported as running but no signal has arrived after ${o} checks. Please refresh the page to check the latest status.`)):h.reset():"resolve"in p?((0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Reconciliation recovered a completed run`),S(p.resolve)):E(p.reject))},"onStall"),h=w.createIdleTimer(s,()=>{D()});try{h.reset(),a=w.subscribeToPubSub(e,{onActivity:l(()=>{o=0,h.reset()},"onActivity"),onCompletion:l(R=>S(R),"onCompletion"),onStreamEnd:l(()=>{D()},"onStreamEnd")});const p=await w.executeMutation(e);if(!e.validateAck(p)){h.clear();const R=p?.errorMessage??"Server rejected the request";return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Server rejected: ${R}`),e.createErrorResult(R)}return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Server accepted, waiting for completion via WebSocket`),await m}catch(p){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Error: ${p.message}`),p}finally{h.clear(),a&&a.unsubscribe()}}static createCompletionPromise(){let e,t;return{promise:new Promise((s,n)=>{e=s,t=n}),resolve:e,reject:t}}static createIdleTimer(e,t){let r;return{reset:l(()=>{r&&clearTimeout(r),r=setTimeout(t,e)},"reset"),clear:l(()=>{r&&clearTimeout(r),r=void 0},"clear")}}static timeoutMessage(e,t){const r=Math.round(t/6e4);return e??`The operation may still be running on the server but the client received no updates for ${r} minutes. Please refresh the page to check the latest status.`}static subscribeToPubSub(e,t){const r=e.dataProvider.sessionId,s=e.operationLabel??e.mutationFieldName;return e.dataProvider.PushStatusUpdates(r).subscribe({next:l(n=>{t.onActivity();try{const a=JSON.parse(n);e.onMessage&&e.onMessage(a),e.isCompletionEvent(a)&&((0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${s}] Completion event received`),t.onCompletion(e.extractResult(a)))}catch(a){console.error(`[FireAndForget:${s}] Failed to parse PubSub message:`,a)}},"next"),error:l(()=>t.onStreamEnd(),"error"),complete:l(()=>t.onStreamEnd(),"complete")})}static async executeMutation(e){return(await e.dataProvider.ExecuteGQL(e.mutation,e.variables))[e.mutationFieldName]}static async executeSynchronously(e){const t=e.operationLabel??e.mutationFieldName;(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Provider has no PushStatusUpdates channel \u2014 running synchronously (fireAndForget disabled)`);const r={...e.variables,fireAndForget:!1},n=(await e.dataProvider.ExecuteGQL(e.mutation,r))?.[e.mutationFieldName];return n?e.extractSyncResult?((0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Synchronous execution completed`),e.extractSyncResult(n)):e.createErrorResult(`${t} cannot run on this data provider: it has no PushStatusUpdates channel and no synchronous result extractor is configured for this operation.`):((0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Synchronous execution returned no '${e.mutationFieldName}' payload`),e.createErrorResult(`Server returned no '${e.mutationFieldName}' result for ${t}`))}}class se{static{l(this,"GraphQLAIClient")}constructor(e){this._dataProvider=e}async RunAIPrompt(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
69
69
|
mutation RunAIPrompt(
|
|
70
70
|
$promptId: String!,
|
|
71
71
|
$data: String,
|
|
@@ -366,14 +366,14 @@ var ye=Object.defineProperty;var l=(d,e)=>ye(d,"name",{value:e,configurable:!0})
|
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
`,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="6.1.
|
|
370
|
-
${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))}l(ie,"ToSafeGraphQLError");const
|
|
371
|
-
at `);return e===-1?"":d.slice(e+1)}l(
|
|
369
|
+
`,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="6.1.6",$="default";class ne{static{l(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}get SharesReferences(){return!0}get SupportsCrossProcessPersistence(){return!1}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 Le="MJ_Metadata",Fe=0;function Ge(){try{const d=F.split("."),e=parseInt(d[0],10),t=parseInt(d[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(d){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:d,message:"Failed to derive IDB version from PACKAGE_VERSION; using fallback 99999"}),99999}}l(Ge,"computeIdbVersion");const Ue=Ge(),ae=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"];class oe extends ne{static{l(this,"BrowserIndexedDBStorageProvider")}constructor(){super(),this._dbReady=!1,this.dbPromise=(0,_tempfix_idb__WEBPACK_IMPORTED_MODULE_10__/* .openDB */ .P2)(Le,Ue,{upgrade:l((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 ae)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:l((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 SharesReferences(){return!1}get SupportsCrossProcessPersistence(){return!0}get IsReady(){return this._dbReady}isKnownCategory(e){const t=`mj:${e}`;return ae.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(f=>this.getStoreKey(f,t)),o=s.transaction(n,"readonly"),m=o.objectStore(n),u=i.map(f=>m.get(f)),g=await Promise.all(u);await o.done;for(let f=0;f<a.length;f++){const S=g[f];r.set(a[f],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 m of o)typeof m=="string"&&m.startsWith(n)&&await i.delete(m);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(m=>String(m));const o=`[${r}]:`;return i.map(m=>String(m)).filter(m=>m.startsWith(o)).map(m=>m.slice(o.length))}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:t,message:t?.message}),[]}}}class V extends Error{static{l(this,"SafeGraphQLError")}constructor(e){super(e.message),this.name=e.name,this.response={status:e.status,errors:e.errors},this.request={query:e.query},this.Code=e.code,this.VariableShape=e.variableShape,this.stack=e.stackFrames?`${e.name}: ${e.message}
|
|
370
|
+
${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))}l(ie,"ToSafeGraphQLError");const Qe=3,_e=25;function k(d,e=0){if(d===null)return"null";if(d===void 0)return"undefined";if(Array.isArray(d))return d.length===0?"array(empty)":`array(${d.length} \xD7 ${Ve(k(d[0],e+1))})`;if(typeof d=="object"){if(e>=Qe)return"object(\u2026)";const t=Object.keys(d);if(t.length>_e)return`object(${t.length} keys)`;const r={};for(const s of t)r[s]=k(d[s],e+1);return r}return typeof d=="string"?d.length===0?"string(empty)":"string":typeof d}l(k,"describeShape");function Ve(d){return typeof d=="string"?d:"object"}l(Ve,"typeOf");function ke(d){const e=d.indexOf(`
|
|
371
|
+
at `);return e===-1?"":d.slice(e+1)}l(ke,"stripStackHeader");function Oe(d,e){const t=d?.[0]?.message;return typeof t=="string"&&t.length>0?t:`GraphQL Error (Code: ${String(e??"unknown")})`}l(Oe,"deriveMessage");function qe(d){if(Array.isArray(d))return d.map(e=>{const t=e??{};return{message:typeof t.message=="string"?t.message:void 0,path:Array.isArray(t.path)?t.path:void 0,extensions:t.extensions&&typeof t.extensions=="object"?t.extensions:void 0}})}l(qe,"extractErrors");function O(d,e=!1){if(!d||typeof d!="object")return{name:typeof d,message:"Non-object value thrown; contents withheld",variables:"[REDACTED]"};const t=d,r=typeof t.response?.status=="number"?t.response.status:void 0,s=qe(t.response?.errors),n=s?.[0]?.extensions?.code;return{name:typeof t.name=="string"?t.name:"Error",message:Oe(s,r),status:r,errors:s,code:typeof n=="string"?n:void 0,query:typeof t.request?.query=="string"?t.request.query:void 0,stackFrames:typeof t.stack=="string"?ke(t.stack):void 0,variables:e?t.request?.variables:"[REDACTED]",variableShape:t.request?.variables===void 0?void 0:k(t.request.variables)}}l(O,"SanitizeGraphQLError");const N=new M,Ke=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`subscription RemoteOperationProgress($channelId: ID!) {
|
|
372
372
|
RemoteOperationProgress(channelId: $channelId) {
|
|
373
373
|
ChannelId
|
|
374
374
|
ProgressJSON
|
|
375
375
|
}
|
|
376
|
-
}`;class
|
|
376
|
+
}`;class Be extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderConfigDataBase */ .dZq{static{l(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 LogVariableValues(){return this.Data.LogVariableValues===!0}set LogVariableValues(e){this.Data.LogVariableValues=e}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,m,u){super({Token:e,URL:t,WSURL:r,MJAPIKey:o,UserAPIKey:m,RefreshTokenFunction:s,OnAuthenticationError:u},n,a,i)}}class I extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderBase */ .Dny{static{l(this,"GraphQLDataProvider")}constructor(){super(),this._refreshPromise=null,this._dynamicHeaders=new Map,this._recordNames=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityRecordNameCache */ .U_4,this._innerCurrentUserQueryString=`CurrentUser {
|
|
377
377
|
${this.userInfoString()}
|
|
378
378
|
Roles {
|
|
379
379
|
${this.userRoleInfoString()}
|
|
@@ -382,7 +382,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
382
382
|
`,this._currentUserQuery=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query CurrentUserAndRoles {
|
|
383
383
|
${this._innerCurrentUserQueryString}
|
|
384
384
|
CurrentUserTenantContext
|
|
385
|
-
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject=new rxjs__WEBPACK_IMPORTED_MODULE_6__/* .BehaviorSubject */ .t("unknown"),this._isDisposingSocketIntentionally=!1,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=1800*1e3,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=300*1e3,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=600*1e3,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,this._taskGraphFrameStreams=new Map,this._cacheInvalidationSubscription=null;const e=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .GetGlobalObjectStore */ .Ip)();if(e&&e[
|
|
385
|
+
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject=new rxjs__WEBPACK_IMPORTED_MODULE_6__/* .BehaviorSubject */ .t("unknown"),this._isDisposingSocketIntentionally=!1,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=1800*1e3,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=300*1e3,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=600*1e3,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,this._taskGraphFrameStreams=new Map,this._cacheInvalidationSubscription=null;const e=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .GetGlobalObjectStore */ .Ip)();if(e&&e[I._globalStoreKey])return e[I._globalStoreKey];e&&(e[I._globalStoreKey]=this)}static{this.VerboseCacheInvalidationLogging=!1}static{this._globalStoreKey="___SINGLETON__GraphQLDataProvider"}static get Instance(){const e=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .GetGlobalObjectStore */ .Ip)();return e?e[I._globalStoreKey]:void 0}get ConfigData(){return this._configData}get AI(){return this._aiClient||(this._aiClient=new se(this)),this._aiClient}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}async InternalExecuteQueryFromSpec(e,t){throw new Error("ExecuteQueryFromSpec is not supported by this provider.")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return (0,uuid__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)()}get LocalStoragePrefix(){if(this._configData===void 0||this._configData.URL===void 0)throw new Error("GraphQLDataProvider: ConfigData is not set. Please call Config() first.");return this._configData.URL.replace(/[^a-zA-Z0-9]/g,"_")+"."}async GetStoredSessionID(){try{const e=this.LocalStorageProvider;if(e){const t=this.LocalStoragePrefix+"sessionId";return await e.GetItem(t)}return null}catch(e){return console.error("Error retrieving session ID from local storage:",e),null}}async SaveStoredSessionID(e){try{const t=this.LocalStorageProvider;if(t){const r=this.LocalStoragePrefix+"sessionId";await t.SetItem(r,e)}}catch{}}async GetPreferredUUID(e){const t=await this.GetStoredSessionID();return e||!t?this.GenerateUUID():t}async Config(e,t,r,s){try{return this._configData=e,r?(this._sessionId=await this.GetPreferredUUID(s),this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId,e.MJAPIKey,e.UserAPIKey),await this.SaveStoredSessionID(this._sessionId)):(I.Instance._configData=e,I.Instance._sessionId===void 0&&(I.Instance._sessionId=await this.GetPreferredUUID(s)),I.Instance._client||(I.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,I.Instance._sessionId,e.MJAPIKey,e.UserAPIKey)),await I.Instance.SaveStoredSessionID(I.Instance._sessionId),this._sessionId=I.Instance._sessionId,this._client=I.Instance._client),super.Config(e)}catch(n){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),n}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}SetDynamicHeader(e,t){this._dynamicHeaders.set(e,t),this._client&&this._client.setHeader(e,t),I.Instance&&I.Instance!==this&&I.Instance._configData===this._configData&&(I.Instance._dynamicHeaders.set(e,t),I.Instance._client&&I.Instance._client.setHeader(e,t))}RemoveDynamicHeader(e){this._dynamicHeaders.delete(e),this._client&&this._client.setHeader(e,""),I.Instance&&I.Instance!==this&&I.Instance._configData===this._configData&&(I.Instance._dynamicHeaders.delete(e),I.Instance._client&&I.Instance._client.setHeader(e,""))}GetDynamicHeaders(){return this._dynamicHeaders}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const t=this.ConvertBackToMJFields(e.CurrentUser),{Roles:r,...s}=t,n=(r??[]).map(i=>this.ConvertBackToMJFields(i)),a=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserInfo */ .oqB(this,{...s,UserRoles:n});return e.CurrentUserTenantContext&&typeof e.CurrentUserTenantContext=="object"&&(a.TenantContext=e.CurrentUserTenantContext),a}}async InternalRunQuery(e,t){if(e.SQL)return this.RunAdhocQuery(e.SQL,e.MaxRows,e.TimeoutSeconds,e.StartRow);if(e.QueryID)return this.RunQueryByID(e.QueryID,e.CategoryID,e.CategoryPath,t,e.Parameters,e.MaxRows,e.StartRow,e.Enrichment,e.DataSource);if(e.QueryName)return this.RunQueryByName(e.QueryName,e.CategoryID,e.CategoryPath,t,e.Parameters,e.MaxRows,e.StartRow,e.Enrichment,e.DataSource);throw new Error("No SQL, QueryID, or QueryName provided to RunQuery")}async RunAdhocQuery(e,t,r,s){const n=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
386
386
|
query ExecuteAdhocQuery($input: AdhocQueryInput!) {
|
|
387
387
|
ExecuteAdhocQuery(input: $input) {
|
|
388
388
|
${this.QueryReturnFieldList}
|
|
@@ -400,13 +400,13 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
400
400
|
${this.QueryReturnFieldList}
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
`,g={QueryID:e};t!==void 0&&(g.CategoryID=t),r!==void 0&&(g.CategoryPath=r),n!==void 0&&(g.Parameters=n),a!==void 0&&(g.MaxRows=a),i!==void 0&&(g.StartRow=i),o!==void 0&&(g.Enrichment=o),m!==void 0&&(g.DataSource=m);const
|
|
403
|
+
`,g={QueryID:e};t!==void 0&&(g.CategoryID=t),r!==void 0&&(g.CategoryPath=r),n!==void 0&&(g.Parameters=n),a!==void 0&&(g.MaxRows=a),i!==void 0&&(g.StartRow=i),o!==void 0&&(g.Enrichment=o),m!==void 0&&(g.DataSource=m);const f=await this.ExecuteGQL(u,g);if(f&&f.GetQueryData)return this.TransformQueryPayload(f.GetQueryData)}async RunQueryByName(e,t,r,s,n,a,i,o,m){const u=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
404
404
|
query GetQueryDataByNameQuery($QueryName: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int, $Enrichment: JSONObject, $DataSource: String) {
|
|
405
405
|
GetQueryDataByName(QueryName: $QueryName, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow, Enrichment: $Enrichment, DataSource: $DataSource) {
|
|
406
406
|
${this.QueryReturnFieldList}
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
`,g={QueryName:e};t!==void 0&&(g.CategoryID=t),r!==void 0&&(g.CategoryPath=r),n!==void 0&&(g.Parameters=n),a!==void 0&&(g.MaxRows=a),i!==void 0&&(g.StartRow=i),o!==void 0&&(g.Enrichment=o),m!==void 0&&(g.DataSource=m);const
|
|
409
|
+
`,g={QueryName:e};t!==void 0&&(g.CategoryID=t),r!==void 0&&(g.CategoryPath=r),n!==void 0&&(g.Parameters=n),a!==void 0&&(g.MaxRows=a),i!==void 0&&(g.StartRow=i),o!==void 0&&(g.Enrichment=o),m!==void 0&&(g.DataSource=m);const f=await this.ExecuteGQL(u,g);if(f&&f.GetQueryDataByName)return this.TransformQueryPayload(f.GetQueryDataByName)}get QueryReturnFieldList(){return`
|
|
410
410
|
Success
|
|
411
411
|
QueryID
|
|
412
412
|
QueryName
|
|
@@ -431,7 +431,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
`,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 m=JSON.parse(o.Results);return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,results:m,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:
|
|
434
|
+
`,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 m=JSON.parse(o.Results);return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,results:m,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:D,v:h}=await this.getEntityNameAndUserView(e,t);i=h,a=D}const o=this.EntityByName(a);if(!o)throw new Error(`Entity ${a} not found in metadata`);let m=!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):(m=!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),e.DataSource!==void 0&&(n.DataSource=e.DataSource),m||(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(D=>({expression:D.expression,alias:D.alias})));const g=this.getViewRunTimeFieldList(o,i,e,m),f=e.Aggregates&&e.Aggregates.length>0?`
|
|
435
435
|
AggregateResults {
|
|
436
436
|
alias
|
|
437
437
|
expression
|
|
@@ -450,9 +450,9 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
450
450
|
TotalRowCount
|
|
451
451
|
ExecutionTime
|
|
452
452
|
Success
|
|
453
|
-
ErrorMessage${
|
|
453
|
+
ErrorMessage${f}
|
|
454
454
|
}
|
|
455
|
-
}`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const E=await this.ExecuteGQL(S,{input:n});if(E&&E[r]){const
|
|
455
|
+
}`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const E=await this.ExecuteGQL(S,{input:n});if(E&&E[r]){const D=E[r].AggregateResults;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Received aggregate results:",{entityName:a,aggregateResultCount:D?.length||0,aggregateResults:D,aggregateExecutionTime:E[r].AggregateExecutionTime});const h=E[r].Results;if(h&&h.length>0){const R=o.Fields.filter(C=>C.CodeName!==C.Name&&C.CodeName!==void 0);h.forEach(C=>{this.ConvertBackToMJFields(C),R.forEach(L=>{C[L.Name]=C[L.CodeName]})})}return E[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 g="",f="";const S={};let E=null,D=null;if(u.ViewEntity)D=u.ViewEntity,E=D.Get("Entity");else{const{entityName:C,v:L}=await this.getEntityNameAndUserView(u,t);D=L,E=C}const h=this.EntityByName(E);if(!h)throw new Error(`Entity ${E} not found in metadata`);s.push(h);let p=!1;const R=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(h);u.ViewID?(g=`Run${R}ViewByID`,f="RunViewByIDInput",S.ViewID=u.ViewID):u.ViewName?(g=`Run${R}ViewByName`,f="RunViewByNameInput",S.ViewName=u.ViewName):(p=!0,g=`Run${R}DynamicView`,f="RunDynamicViewInput",S.EntityName=u.EntityName),S.ExtraFilter=u.ExtraFilter||"",S.OrderBy=u.OrderBy||"",S.UserSearchString=u.UserSearchString||"",S.Fields=u.Fields,S.IgnoreMaxRows=u.IgnoreMaxRows||!1,u.MaxRows!==void 0&&(S.MaxRows=u.MaxRows),u.StartRow!==void 0&&(S.StartRow=u.StartRow),u.AfterKey&&(S.AfterKey={KeyValuePairs:u.AfterKey.KeyValuePairs}),S.ForceAuditLog=u.ForceAuditLog||!1,S.ResultType=u.ResultType||"simple",u.AuditLogDescription&&u.AuditLogDescription.length>0&&(S.AuditLogDescription=u.AuditLogDescription),u.BypassCache!==void 0&&(S.BypassCache=u.BypassCache),u.DataSource!==void 0&&(S.DataSource=u.DataSource),p||(S.ExcludeUserViewRunID=u.ExcludeUserViewRunID||"",S.ExcludeDataFromAllPriorViewRuns=u.ExcludeDataFromAllPriorViewRuns||!1,S.OverrideExcludeFilter=u.OverrideExcludeFilter||"",S.SaveViewResults=u.SaveViewResults||!1),u.Aggregates&&u.Aggregates.length>0&&(S.Aggregates=u.Aggregates.map(C=>({expression:C.expression,alias:C.alias}))),r.push(S),n.push(...this.getViewRunTimeFieldList(h,D,u,p))}const i=e.some(u=>u.Aggregates&&u.Aggregates.length>0)?`
|
|
456
456
|
AggregateResults {
|
|
457
457
|
alias
|
|
458
458
|
expression
|
|
@@ -477,7 +477,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
477
477
|
Success
|
|
478
478
|
ErrorMessage${i}
|
|
479
479
|
}
|
|
480
|
-
}`,m=await this.ExecuteGQL(o,{input:r});if(m&&m.RunViews){const u=m.RunViews;for(const[g,
|
|
480
|
+
}`,m=await this.ExecuteGQL(o,{input:r});if(m&&m.RunViews){const u=m.RunViews;for(const[g,f]of u.entries())f.Results=f.Results.map(S=>{let E=JSON.parse(S.Data);return this.ConvertBackToMJFields(E),E});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",Aggregates:o.params.Aggregates??null,DataSource:o.params.DataSource},cacheStatus:o.cacheStatus?{maxUpdatedAt:o.cacheStatus.maxUpdatedAt,rowCount:o.cacheStatus.rowCount}:null})),s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
481
481
|
query RunViewsWithCacheCheckQuery($input: [RunViewWithCacheCheckInput!]!) {
|
|
482
482
|
RunViewsWithCacheCheck(input: $input) {
|
|
483
483
|
success
|
|
@@ -516,7 +516,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
`,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,m)=>{const u=e[m];if(o.status==="differential"&&o.differentialData){const g=o.differentialData.updatedRows.map(
|
|
519
|
+
`,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,m)=>{const u=e[m];if(o.status==="differential"&&o.differentialData){const g=o.differentialData.updatedRows.map(f=>{const S=JSON.parse(f.Data);return this.ConvertBackToMJFields(S),S});return{viewIndex:o.viewIndex,status:o.status,results:void 0,differentialData:{updatedRows:g,deletedRecordIDs:o.differentialData.deletedRecordIDs},maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}if(o.status==="stale"&&o.Results){const g=o.Results.map(S=>{const E=JSON.parse(S.Data);return this.ConvertBackToMJFields(E),E}),f=o.aggregateResults?.map(S=>({expression:S.expression,alias:S.alias,value:S.value!==void 0&&S.value!==null?JSON.parse(S.value):null,error:S.error}));return{viewIndex:o.viewIndex,status:o.status,results:g,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage,aggregateResults:f}}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=[];if(r.Fields){for(const a of e.PrimaryKeys)r.Fields.find(i=>i.trim().toLowerCase()===a.Name.toLowerCase())===void 0&&n.push(N.MapFieldName(a.Name));r.Fields.forEach(a=>{n.push(N.MapFieldName(a))})}else if(s)e.Fields.forEach(a=>{a.IsBinaryFieldType||n.push(N.MapFieldName(a.CodeName))});else{for(const a of e.PrimaryKeys)n.find(i=>i.trim().toLowerCase()===a.Name.toLowerCase())===void 0&&n.push(N.MapFieldName(a.Name));t.Columns.forEach(a=>{a.hidden===!1&&!n.find(i=>i.trim().toLowerCase()===a.EntityField?.Name.trim().toLowerCase())&&a.EntityField&&n.push(N.MapFieldName(a.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!) {
|
|
520
520
|
GetRecordDependencies(entityName: $entityName, CompositeKey: $CompositeKey) {
|
|
521
521
|
EntityName
|
|
522
522
|
RelatedEntityName
|
|
@@ -574,7 +574,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
574
574
|
handle
|
|
575
575
|
errorMessage
|
|
576
576
|
}
|
|
577
|
-
}`;let n,a;r.onProgress&&(n=this.GenerateUUID(),a=this.subscribe(
|
|
577
|
+
}`;let n,a;r.onProgress&&(n=this.GenerateUUID(),a=this.subscribe(Ke,{channelId:n}).subscribe({next:l(i=>{const o=i?.RemoteOperationProgress?.ProgressJSON;if(o)try{r.onProgress(JSON.parse(o))}catch{}},"next"),error:l(()=>{},"error")}),await new Promise(i=>setTimeout(i,400)));try{const o=(await this.ExecuteGQL(s,{operationKey:e,inputJSON:JSON.stringify(t??null),invokeMode:r.mode??"attached",progressChannelId:n??null}))?.ExecuteRemoteOperation;return o?{Success:!!o.success,ResultCode:o.resultCode??void 0,Output:o.outputJSON!=null?JSON.parse(o.outputJSON):void 0,Handle:o.handle??void 0,ErrorMessage:o.errorMessage??void 0}:{Success:!1,ResultCode:"NO_RESPONSE",ErrorMessage:"No response from ExecuteRemoteOperation"}}catch(i){return{Success:!1,ResultCode:"TRANSPORT_ERROR",ErrorMessage:i instanceof Error?i.message:String(i)}}finally{a?.unsubscribe()}}async MergeRecords(e,t,r){const s=this.Entities.find(n=>n.Name.trim().toLowerCase()===e.EntityName.trim().toLowerCase());if(!s||!s.AllowRecordMerge)throw new Error(`Entity ${e.EntityName} does not allow record merging, check the AllowRecordMerge property in the entity metadata`);try{const n=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation MergeRecordsMutation ($request: RecordMergeRequest!) {
|
|
578
578
|
MergeRecords(request: $request) {
|
|
579
579
|
Success
|
|
580
580
|
OverallStatus
|
|
@@ -591,14 +591,14 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
591
591
|
Message
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
}`,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}}}GetDeniedReadFieldNamesForCurrentUser(e){return!e?.EnableFieldLevelSecurity||!this.CurrentUser?new Set:e.GetDeniedReadFields(this.CurrentUser)}FieldSecurityTransportSelection(e){return e?.EnableFieldLevelSecurity?_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ReadableFieldsTransportKey */ .ecJ:""}ApplyServerFieldAccess(e,t){if(!t||typeof t!="object")return t;const r=t,s=r[_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ReadableFieldsTransportKey */ .ecJ];if(delete r[_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ReadableFieldsTransportKey */ .ecJ],Array.isArray(s)){const a=new Set(s.map(i=>String(i).trim().toLowerCase()));for(const i of e.Fields)a.has(i.Name.trim().toLowerCase())||(delete r[i.Name],delete r[i.CodeName]);return t}const n=this.GetDeniedReadFieldNamesForCurrentUser(e);if(n.size===0)return t;for(const a of e.Fields)n.has(a.Name.trim().toLowerCase())&&(r[a.Name]===null&&delete r[a.Name],r[a.CodeName]===null&&delete r[a.CodeName]);return t}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(
|
|
595
|
-
${e.Fields.filter(
|
|
594
|
+
}`,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}}}GetDeniedReadFieldNamesForCurrentUser(e){return!e?.EnableFieldLevelSecurity||!this.CurrentUser?new Set:e.GetDeniedReadFields(this.CurrentUser)}FieldSecurityTransportSelection(e){return e?.EnableFieldLevelSecurity?_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ReadableFieldsTransportKey */ .ecJ:""}ApplyServerFieldAccess(e,t){if(!t||typeof t!="object")return t;const r=t,s=r[_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ReadableFieldsTransportKey */ .ecJ];if(delete r[_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ReadableFieldsTransportKey */ .ecJ],Array.isArray(s)){const a=new Set(s.map(i=>String(i).trim().toLowerCase()));for(const i of e.Fields)a.has(i.Name.trim().toLowerCase())||(delete r[i.Name],delete r[i.CodeName]);return t}const n=this.GetDeniedReadFieldNamesForCurrentUser(e);if(n.size===0)return t;for(const a of e.Fields)n.has(a.Name.trim().toLowerCase())&&(r[a.Name]===null&&delete r[a.Name],r[a.CodeName]===null&&delete r[a.CodeName]);return t}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(h=>({FieldName:h.CodeName,Value:h.Value})),e.RegisterResultHistoryEntry(s);const i=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),o=`${a}${i}`,m=!e.IsSaved&&e.EntityInfo.IsChildType&&e.ISAParent?.IsSaved===!0,u=this.GetDeniedReadFieldNamesForCurrentUser(e.EntityInfo),g=l(h=>u.has(h.trim().toLowerCase()),"isDeniedRead"),f=e.Fields.filter(h=>(!h.ReadOnly||h.IsPrimaryKey&&(e.IsSaved||m))&&(h.IsPrimaryKey||!h.NotLoaded&&!g(h.Name))),S=` ${o}(input: $input) {
|
|
595
|
+
${e.Fields.filter(h=>!g(h.Name)).map(h=>N.MapFieldName(h.CodeName)).join(`
|
|
596
596
|
`)}
|
|
597
597
|
${this.FieldSecurityTransportSelection(e.EntityInfo)}
|
|
598
|
-
}`,
|
|
599
|
-
${
|
|
598
|
+
}`,E=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation ${a}${i} ($input: ${o}Input!) {
|
|
599
|
+
${S}
|
|
600
600
|
}
|
|
601
|
-
`;for(let
|
|
601
|
+
`;for(let h=0;h<f.length;h++){const p=f[h];let R=e.Get(p.Name);if(R)switch(p.EntityFieldInfo.TSType){case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date:R=R.getTime();break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean:typeof R!="boolean"&&(R=parseInt(R)!==0);break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number:if(typeof R!="number"){const C=Number(R);isNaN(C)||(R=C)}break}R===null&&p.EntityFieldInfo.AllowsNull===!1&&(p.EntityFieldInfo.DefaultValue!==null?R=p.EntityFieldInfo.DefaultValue:p.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number||p.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?R=0:R=""),n.input[N.MapFieldName(p.CodeName)]=R}const D=e.RestoreContext;if(D&&(n.input.RestoreContext___={SourceChangeID:D.SourceChangeID,Reason:D.Reason}),a.trim().toLowerCase()==="update"&&r.SkipOldValuesCheck===!1){const h=[];e.Fields.forEach(p=>{if(p.NotLoaded&&!p.IsPrimaryKey)return;let R=null;p.OldValue!==null&&p.OldValue!==void 0&&(p.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date?R=p.OldValue.getTime().toString():p.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?R=p.OldValue===!0?"1":"0":typeof p.OldValue!="string"?R=p.OldValue.toString():R=p.OldValue),h.push({Key:N.MapFieldName(p.CodeName),Value:R})}),n.input.OldValues___=h}if(e.TransactionGroup){const h=[{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",S,n,{mutationName:o,mutationInputTypes:h},(p,R)=>{s.EndedAt=new Date,R&&p?(s.Success=!0,s.NewValues=this.ApplyServerFieldAccess(e.EntityInfo,this.ConvertBackToMJFields(p))):(s.Success=!1,s.Message="Transaction failed")})),!0}else{const h=await this.ExecuteGQL(E,n);if(h&&h[o])return s.Success=!0,s.EndedAt=new Date,s.NewValues=this.ApplyServerFieldAccess(e.EntityInfo,this.ConvertBackToMJFields(h[o])),s.NewValues;throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(n){s.Success=!1,s.EndedAt=new Date,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message;const a=n.response?.errors?.[0]?.extensions;return s.Errors=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .DeserializeValidationErrors */ .E$)(a?.validationErrors),s.MessageIncludesErrors=s.Errors.length>0&&a?.messageIncludesValidationErrors===!0,(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 E=e.Fields.find(R=>R.Name.trim().toLowerCase()===t.KeyValuePairs[S].FieldName.trim().toLowerCase()).EntityFieldInfo,D=t.GetValueByIndex(S),h=E.GraphQLType;i.length>0&&(i+=", "),i+=`$${E.CodeName}: ${h}!`,a.length>0&&(a+=", ");const p=E.CodeName.startsWith("__mj_")?E.CodeName.replace("__mj_","_mj__"):E.CodeName;if(a+=`${p}: $${E.CodeName}`,E.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number){if(isNaN(t.GetValueByIndex(S)))throw new Error(`Primary Key value ${D} (${E.Name}) is not a valid number`);n[E.CodeName]=parseInt(D)}else n[E.CodeName]=D}const o=r&&r.length>0?this.getRelatedEntityString(e.EntityInfo,r):"",m=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),u=this.GetDeniedReadFieldNamesForCurrentUser(e.EntityInfo),g=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query Single${m}${o.length>0?"Full":""} (${i}) {
|
|
602
602
|
${m}(${a}) {
|
|
603
603
|
${e.Fields.filter(S=>!S.EntityFieldInfo.IsBinaryFieldType&&!u.has(S.Name.trim().toLowerCase())).map(S=>S.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?S.CodeName.replace("__mj_","_mj__"):S.CodeName).join(`
|
|
604
604
|
`)}
|
|
@@ -606,19 +606,19 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
606
606
|
${o}
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
`,
|
|
609
|
+
`,f=await this.ExecuteGQL(g,n);return f&&f[m]?this.ApplyServerFieldAccess(e.EntityInfo,this.ConvertBackToMJFields(f[m])):null}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),null}}ConvertBackToMJFields(e){return N.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.EntityByID(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+=`
|
|
610
610
|
${i} {
|
|
611
611
|
${a.Fields.map(o=>o.CodeName).join(`
|
|
612
612
|
`)}
|
|
613
613
|
}
|
|
614
|
-
`}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(E=>({FieldName:E.CodeName,Value:E.Value})),e.RegisterResultHistoryEntry(s);const n={},a=[];let i="",o="",m="";for(let E of e.PrimaryKey.KeyValuePairs){const
|
|
615
|
-
`),m+=`${
|
|
614
|
+
`}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(E=>({FieldName:E.CodeName,Value:E.Value})),e.RegisterResultHistoryEntry(s);const n={},a=[];let i="",o="",m="";for(let E of e.PrimaryKey.KeyValuePairs){const D=e.Fields.find(p=>p.Name.trim().toLowerCase()===E.FieldName.trim().toLowerCase());n[D.CodeName]=D.Value,a.push({varName:D.CodeName,inputType:D.EntityFieldInfo.GraphQLType+"!"});const h=D.CodeName.startsWith("__mj_")?D.CodeName.replace("__mj_","_mj__"):D.CodeName;i.length>0&&(i+=", "),i+=`${h}: $${D.CodeName}`,o.length>0&&(o+=", "),o+=`$${D.CodeName}: ${D.EntityFieldInfo.GraphQLType}!`,m.length>0&&(m+=`
|
|
615
|
+
`),m+=`${h}`}a.push({varName:"options___",inputType:"DeleteOptionsInput!"}),n.options___={SkipEntityAIActions:t?.SkipEntityAIActions??!1,SkipEntityActions:t?.SkipEntityActions??!1,ReplayOnly:t?.ReplayOnly??!1,IsParentEntityDelete:t?.IsParentEntityDelete??!1,SkipRecordChanges:t?.SkipRecordChanges??!1};const g="Delete"+(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),f=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`${g}(${i}, options___: $options___) {
|
|
616
616
|
${m}
|
|
617
617
|
}
|
|
618
618
|
`,S=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation ${g} (${o}, $options___: DeleteOptionsInput!) {
|
|
619
|
-
${
|
|
619
|
+
${f}
|
|
620
620
|
}
|
|
621
|
-
`;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,"Delete",
|
|
621
|
+
`;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,"Delete",f,n,{mutationName:g,mutationInputTypes:a},(E,D)=>{if(s.EndedAt=new Date,D&&E){let h=!0;for(const p of e.PrimaryKey.KeyValuePairs)p.Value!==E[p.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 E=await this.ExecuteGQL(S,n);if(E&&E[g]){const D=E[g];for(let h of e.PrimaryKey.KeyValuePairs){let p=D[h.FieldName],R=h.Value;if(typeof R=="number"&&(R=R.toString()),typeof p=="number"&&(p=p.toString()),R!==p)throw new Error(`Primary key value mismatch in server Delete response. Field: ${h.FieldName}, Original: ${R}, Returned: ${p}`)}return s.Success=!0,s.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(n){s.EndedAt=new Date,s.Success=!1,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message;const a=n.response?.errors?.[0]?.extensions;return s.Errors=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .DeserializeValidationErrors */ .E$)(a?.validationErrors),s.MessageIncludesErrors=s.Errors.length>0&&a?.messageIncludesValidationErrors===!0,(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!]) {
|
|
622
622
|
GetDatasetByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
|
|
623
623
|
DatasetID
|
|
624
624
|
DatasetName
|
|
@@ -627,7 +627,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
627
627
|
LatestUpdateDate
|
|
628
628
|
Results
|
|
629
629
|
}
|
|
630
|
-
}`,s=await this.ExecuteGQL(r,{DatasetName:e,ItemFilters:t});return s&&s.GetDatasetByName&&s.GetDatasetByName.Success?{DatasetID:s.GetDatasetByName.DatasetID,DatasetName:s.GetDatasetByName.DatasetName,Success:s.GetDatasetByName.Success,Status:s.GetDatasetByName.Status,LatestUpdateDate:new Date(s.GetDatasetByName.LatestUpdateDate),Results:JSON.parse(s.GetDatasetByName.Results)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,Results:null}}static{this._datasetStatusQueue=[]}static{this._datasetStatusTimer=null}static{this._datasetStatusCoalesceMs=10}async GetDatasetStatusByName(e,t){return
|
|
630
|
+
}`,s=await this.ExecuteGQL(r,{DatasetName:e,ItemFilters:t});return s&&s.GetDatasetByName&&s.GetDatasetByName.Success?{DatasetID:s.GetDatasetByName.DatasetID,DatasetName:s.GetDatasetByName.DatasetName,Success:s.GetDatasetByName.Success,Status:s.GetDatasetByName.Status,LatestUpdateDate:new Date(s.GetDatasetByName.LatestUpdateDate),Results:JSON.parse(s.GetDatasetByName.Results)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,Results:null}}static{this._datasetStatusQueue=[]}static{this._datasetStatusTimer=null}static{this._datasetStatusCoalesceMs=10}async GetDatasetStatusByName(e,t){return I._datasetStatusCoalesceMs>0&&!t?this.enqueueDatasetStatusCheck(e):this.executeDatasetStatusByName(e,t)}enqueueDatasetStatusCheck(e){return new Promise((t,r)=>{I._datasetStatusQueue.push({datasetName:e,resolve:t,reject:r}),I._datasetStatusTimer||(I._datasetStatusTimer=setTimeout(()=>this.flushDatasetStatusQueue(),I._datasetStatusCoalesceMs))})}async flushDatasetStatusQueue(){I._datasetStatusTimer=null;const e=I._datasetStatusQueue.splice(0);if(e.length===0)return;if(e.length===1){try{const r=await this.executeDatasetStatusByName(e[0].datasetName,e[0].itemFilters);e[0].resolve(r)}catch(r){e[0].reject(r)}return}const t=e.map(r=>r.datasetName);(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`\u26A1 [Coalesce] Batching ${t.length} dataset status checks into 1 request: [${t.join(", ")}]`);try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetMultipleDatasetStatusByName($DatasetNames: [String!]!) {
|
|
631
631
|
GetMultipleDatasetStatusByName(DatasetNames: $DatasetNames) {
|
|
632
632
|
DatasetID
|
|
633
633
|
DatasetName
|
|
@@ -654,7 +654,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
654
654
|
SetRecordFavoriteStatus(params: $params){
|
|
655
655
|
Success
|
|
656
656
|
}
|
|
657
|
-
}`,o=await this.ExecuteGQL(i,{params:{UserID:e,EntityID:a.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)},IsFavorite:s}});if(o&&o.SetRecordFavoriteStatus!==null)return o.SetRecordFavoriteStatus.Success}async InternalGetEntityRecordName(e,t){if(!e||!t||t.KeyValuePairs?.length===0)return null;const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetEntityRecordNameQuery ($EntityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
657
|
+
}`,o=await this.ExecuteGQL(i,{params:{UserID:e,EntityID:a.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)},IsFavorite:s}});if(o&&o.SetRecordFavoriteStatus!==null)return o.SetRecordFavoriteStatus.Success}async GetCachedRecordName(e,t,r){const s=this._recordNames.Get(e,t);return!s&&r?this.GetEntityRecordName(e,t):s}SetCachedRecordName(e,t,r){this._recordNames.Set(e,t,r)}async GetEntityRecordName(e,t,r,s=!1){return this._recordNames.GetOrFetch(e,t,s,()=>this.InternalGetEntityRecordName(e,t))}async GetEntityRecordNames(e,t,r=!1){return this._recordNames.GetOrFetchMany(e,r,s=>this.InternalGetEntityRecordNames(s))}async InternalGetEntityRecordName(e,t){if(!e||!t||t.KeyValuePairs?.length===0)return null;const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetEntityRecordNameQuery ($EntityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
658
658
|
GetEntityRecordName(EntityName: $EntityName, CompositeKey: $CompositeKey) {
|
|
659
659
|
Success
|
|
660
660
|
Status
|
|
@@ -685,7 +685,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
685
685
|
ErrorMessage
|
|
686
686
|
Result
|
|
687
687
|
}
|
|
688
|
-
}`,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
|
|
688
|
+
}`,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 I.Instance.ExecuteGQL(e,t,r)}static async ExecuteGQLWithProgress(e,t,r,s=!0){return I.Instance.ExecuteGQLWithProgress(e,t,r,s)}async ExecuteGQLWithProgress(e,t,r,s=!0){if(!this._configData?.URL)throw new Error("GraphQLDataProvider is not configured with a URL.");const n=this._configData.URL,a=JSON.stringify({query:e,variables:t});return new Promise((i,o)=>{const m=new XMLHttpRequest;m.open("POST",n),m.setRequestHeader("Content-Type","application/json"),this._sessionId&&m.setRequestHeader("x-session-id",this._sessionId),this._configData?.Token&&m.setRequestHeader("authorization","Bearer "+this._configData.Token),this._configData?.MJAPIKey&&m.setRequestHeader("x-mj-api-key",this._configData.MJAPIKey),this._configData?.UserAPIKey&&m.setRequestHeader("x-api-key",this._configData.UserAPIKey);for(const[u,g]of this._dynamicHeaders)m.setRequestHeader(u,g);m.upload&&r&&(m.upload.onprogress=u=>{if(u.lengthComputable&&u.total>0){const g=Math.min(100,Math.round(u.loaded/u.total*100));r({loaded:u.loaded,total:u.total,percent:g})}}),m.onload=async()=>{if(m.status>=200&&m.status<300)try{const u=JSON.parse(m.responseText);if(u.errors&&u.errors.length>0){const g=u.errors[0];if(g?.extensions?.code?.toUpperCase()?.trim()==="JWT_EXPIRED"&&s){await this.RefreshToken(),i(await this.ExecuteGQLWithProgress(e,t,r,!1));return}o(new Error(g.message||"GraphQL Error"))}else i(u.data)}catch(u){o(u)}else o(new Error(`HTTP error ${m.status}: ${m.statusText}`))},m.onerror=()=>o(new Error("Network error during request")),m.onabort=()=>o(new Error("Request aborted")),m.send(a)})}async ExecuteGQL(e,t,r=!0){try{return await this._client.request(e,t)}catch(s){const n=O(s,this._configData?.LogVariableValues===!0);console.error("[GraphQL] ExecuteGQL error caught:",n);const a=ie(s);if(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"),a}else throw a;else throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(JSON.stringify(n)),a}}async RefreshToken(){const e=I.Instance&&I.Instance._configData===this._configData;if(e&&I.Instance._refreshPromise)return I.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(I.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&I.Instance&&(I.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,I.Instance&&I.Instance._configData===this._configData&&(I.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 I.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,m]of this._dynamicHeaders)i.setHeader(o,m);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__")+`
|
|
689
689
|
`:s.startsWith("_")||(t+=s+`
|
|
690
690
|
`);return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new oe: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:l(()=>({Authorization:"Bearer "+this.ConfigData.Token,...this.ConfigData.MJAPIKey?{"x-mj-api-key":this.ConfigData.MJAPIKey}:{},...this.ConfigData.UserAPIKey?{"x-mj-user-api-key":this.ConfigData.UserAPIKey}:{}}),"connectionParams"),keepAlive:3e4,retryAttempts:3,shouldRetry:l(()=>!0,"shouldRetry")}),this._wsClientCreatedAt=e,this._wsClient.on("connected",()=>{this._socketStateSubject.next("connected")}),this._wsClient.on("closed",t=>{if(this._isDisposingSocketIntentionally)return;this._socketStateSubject.next("disconnected"),t?.code===4403&&this._configData.Data.RefreshTokenFunction&&this.RefreshToken().catch(()=>{})}),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(),this._taskGraphFrameStreams.forEach((e,t)=>{try{e.subject.complete(),e.subscription.unsubscribe()}catch(r){console.error(`[GraphQLDataProvider] Error cleaning up frame stream for ${t}:`,r)}}),this._taskGraphFrameStreams.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:l(a=>{r.next(a.data)},"next"),error:l(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(m){console.error("[GraphQLDataProvider] Failed to refresh token for WebSocket:",m),r.error(m)}}else r.error(a)},"error"),complete:l(()=>{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 m=r.subject.subscribe(o);return()=>{const u=this._pushStatusSubjects.get(e);u&&u.activeSubscribers>0&&u.activeSubscribers--,m.unsubscribe()}});const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`subscription StatusUpdates($sessionId: String!) {
|
|
691
691
|
statusUpdates(sessionId: $sessionId) {
|
|
@@ -744,7 +744,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
744
744
|
OriginSessionID
|
|
745
745
|
RecordData
|
|
746
746
|
}
|
|
747
|
-
}`,t=this.subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:l(r=>{const s=r?.cacheInvalidation;if(!s)return;if(s.OriginSessionID&&s.OriginSessionID===this.sessionId){
|
|
747
|
+
}`,t=this.subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:l(r=>{const s=r?.cacheInvalidation;if(!s)return;if(s.OriginSessionID&&s.OriginSessionID===this.sessionId){I.VerboseCacheInvalidationLogging&&console.debug(`[GraphQLDataProvider] Skipping self-originated cache invalidation for "${s.EntityName}" (action: ${s.Action})`);return}I.VerboseCacheInvalidationLogging&&console.debug(`[GraphQLDataProvider] Cache invalidation received: ${s.Action} for "${s.EntityName}" from server ${s.SourceServerID?.substring(0,8)||"unknown"}`);const n={type:"remote-invalidate",entityName:s.EntityName,baseEntity:null,provider:this,payload:{primaryKeyValues:s.PrimaryKeyValues,action:s.Action,sourceServerId:s.SourceServerID,timestamp:s.Timestamp,recordData:s.RecordData}};_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJGlobal */ .rt.Instance.RaiseEvent({event:_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJEventType */ .UK.ComponentEvent,eventCode:_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntity */ .HCJ.BaseEventCode,args:n,component:this})},"next"),error:l(r=>{console.error("[GraphQLDataProvider] Cache invalidation subscription error:",r),this._cacheInvalidationSubscription=null},"error"),complete:l(()=>{console.log("[GraphQLDataProvider] Cache invalidation subscription completed, will re-establish on next WebSocket creation"),this._cacheInvalidationSubscription=null},"complete")})}static{this.ClientMemberRefreshWindowMinMs=15e3}static{this.ClientMemberRefreshWindowJitterMs=3e4}get MetadataMemberRefreshDelayMs(){return I.ClientMemberRefreshWindowMinMs+Math.random()*I.ClientMemberRefreshWindowJitterMs}get MetadataMemberRefreshRearmsOnNewEvents(){return!1}async RefreshAfterMetadataMemberChange(){return this.RefreshIfNeeded(void 0,!0)}UnsubscribeFromCacheInvalidation(){this.CancelPendingMetadataMemberRefresh(),this._cacheInvalidationSubscription&&(this._cacheInvalidationSubscription.unsubscribe(),this._cacheInvalidationSubscription=null)}async FindISAChildEntity(e,t,r){if(!e.IsParentType)return null;const s=`query FindISAChildEntity($EntityName: String!, $RecordID: String!) {
|
|
748
748
|
FindISAChildEntity(EntityName: $EntityName, RecordID: $RecordID) {
|
|
749
749
|
Success
|
|
750
750
|
ChildEntityName
|
|
@@ -756,7 +756,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
756
756
|
ChildEntityNames
|
|
757
757
|
ErrorMessage
|
|
758
758
|
}
|
|
759
|
-
}`;try{const n=await this.ExecuteGQL(s,{EntityName:e.Name,RecordID:t});return n?.FindISAChildEntities?.Success&&n.FindISAChildEntities.ChildEntityNames?n.FindISAChildEntities.ChildEntityNames.map(a=>({ChildEntityName:a})):[]}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`FindISAChildEntities failed for ${e.Name}: ${n}`),[]}}}async function
|
|
759
|
+
}`;try{const n=await this.ExecuteGQL(s,{EntityName:e.Name,RecordID:t});return n?.FindISAChildEntities?.Success&&n.FindISAChildEntities.ChildEntityNames?n.FindISAChildEntities.ChildEntityNames.map(a=>({ChildEntityName:a})):[]}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`FindISAChildEntities failed for ${e.Name}: ${n}`),[]}}}async function je(d){const e=new I;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .SetProvider */ .YEN)(e),await e.Config(d),await e.preValidateAndRefresh(),_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJGlobal */ .rt.Instance.RaiseEvent({event:_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJEventType */ .UK.LoggedIn,eventCode:null,component:this,args:null}),await _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .StartupManager */ .jFS.Instance.Startup(),e}l(je,"setupGraphQLClient");class Je{static{l(this,"SyncRolesAndUsersResult")}}class We{static{l(this,"RoleInput")}}class He{static{l(this,"UserInput")}}class ze{static{l(this,"RolesAndUsersInput")}}var ce=(d=>(d.Create="Create",d.Update="Update",d.CreateOrUpdate="CreateOrUpdate",d.Delete="Delete",d.DeleteWithFilter="DeleteWithFilter",d))(ce||{});class Xe{static{l(this,"ActionItemInput")}}class Ye{static{l(this,"SyncDataResult")}constructor(){this.Results=[]}}class Ze{static{l(this,"ActionItemOutput")}}const ue=`Success
|
|
760
760
|
ErrorMessage
|
|
761
761
|
Query {
|
|
762
762
|
ID
|
|
@@ -811,7 +811,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
811
811
|
QueryID
|
|
812
812
|
RoleID
|
|
813
813
|
Role
|
|
814
|
-
}`;class
|
|
814
|
+
}`;class et{static{l(this,"GraphQLSystemUserClient")}get Client(){return this._client}constructor(e,t,r,s){const n={"x-session-id":r};this._sessionId=r,t&&(n.authorization="Bearer "+t),s&&(n["x-mj-api-key"]=s),this._client=new graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .GraphQLClient */ .l4(e,{headers:n})}resolvePlatformSQL(e){if(e!=null)return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .IsPlatformSQL */ .WVk)(e)?e.default:e}async GetData(e,t){try{const s=await this.Client.request(`query GetData($input: GetDataInputType!) {
|
|
815
815
|
GetData(input: $input) {
|
|
816
816
|
Success
|
|
817
817
|
ErrorMessages
|
|
@@ -1214,7 +1214,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1214
1214
|
ErrorMessage
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
|
-
`,s={EntityNames:e,UserEmail:t},n=await this.Client.request(r,s);if(n?.CheckEntityPermissionsSystemUser){const a=n.CheckEntityPermissionsSystemUser;return{Success:a.Success,Results:(a.Results||[]).map(i=>({EntityName:i.EntityName,CanRead:i.CanRead})),ErrorMessage:a.ErrorMessage}}return{Success:!1,Results:[],ErrorMessage:"Invalid response from server"}}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::CheckEntityPermissionsSystemUser - Error checking entity permissions - ${r}`),{Success:!1,Results:[],ErrorMessage:r instanceof Error?r.message:String(r)}}}}class
|
|
1217
|
+
`,s={EntityNames:e,UserEmail:t},n=await this.Client.request(r,s);if(n?.CheckEntityPermissionsSystemUser){const a=n.CheckEntityPermissionsSystemUser;return{Success:a.Success,Results:(a.Results||[]).map(i=>({EntityName:i.EntityName,CanRead:i.CanRead})),ErrorMessage:a.ErrorMessage}}return{Success:!1,Results:[],ErrorMessage:"Invalid response from server"}}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::CheckEntityPermissionsSystemUser - Error checking entity permissions - ${r}`),{Success:!1,Results:[],ErrorMessage:r instanceof Error?r.message:String(r)}}}}class tt{static{l(this,"GetDataOutput")}}class rt{static{l(this,"SimpleRemoteEntityOutput")}}class st{static{l(this,"SimpleRemoteEntity")}}class nt{static{l(this,"SimpleRemoteEntityField")}}class at{static{l(this,"GraphQLActionClient")}constructor(e){this._dataProvider=e}async RunAction(e,t,r=!1){try{const s=this.serializeActionParameters(t),n=this.createActionVariables(e,s,r),a=await this.executeActionMutation(n);return this.processActionResult(a,t)}catch(s){return this.handleActionError(s,t)}}serializeActionParameters(e){if(e)return e.map(t=>{let r=t.Value;return r!=null&&typeof r=="object"&&(r=JSON.stringify(r)),{...t,Value:r}})}createActionVariables(e,t,r=!1){return{input:{ActionID:e,Params:t,SkipActionLog:r}}}async executeActionMutation(e){const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1218
1218
|
mutation RunAction($input: RunActionInput!) {
|
|
1219
1219
|
RunAction(input: $input) {
|
|
1220
1220
|
Success
|
|
@@ -1231,7 +1231,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1231
1231
|
ResultData
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
|
-
`;return await this._dataProvider.ExecuteGQL(t,{input:e})}processEntityActionResult(e){if(!e?.RunEntityAction)throw new Error("Invalid response from server");let t={};try{e.RunEntityAction.ResultData&&(t=JSON.parse(e.RunEntityAction.ResultData))}catch(r){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Failed to parse entity action result data: ${r}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}}class
|
|
1234
|
+
`;return await this._dataProvider.ExecuteGQL(t,{input:e})}processEntityActionResult(e){if(!e?.RunEntityAction)throw new Error("Invalid response from server");let t={};try{e.RunEntityAction.ResultData&&(t=JSON.parse(e.RunEntityAction.ResultData))}catch(r){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Failed to parse entity action result data: ${r}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}}class ot{static{l(this,"GraphQLListsClient")}constructor(e){this.dataProvider=e}async PreviewListDelta(e){const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1235
1235
|
query PreviewListDelta($input: ComputeDeltaInput!) {
|
|
1236
1236
|
PreviewListDelta(input: $input) {
|
|
1237
1237
|
...ListDeltaFields
|
|
@@ -1280,7 +1280,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
1282
|
${q}
|
|
1283
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{input:{ListID:e.ListID,Target:
|
|
1283
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{input:{ListID:e.ListID,Target:it(e.Target),PermissionLevel:e.PermissionLevel}});return K(r?.ShareList)}async Unshare(e){const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1284
1284
|
mutation UnshareList($permissionId: String!) {
|
|
1285
1285
|
UnshareList(permissionId: $permissionId) {
|
|
1286
1286
|
...ShareResultFields
|
|
@@ -1331,7 +1331,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1331
1331
|
CreatedAt
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
|
-
`;return((await this.dataProvider.ExecuteGQL(t,{listId:e}))?.ListSharesForList??[]).map(
|
|
1334
|
+
`;return((await this.dataProvider.ExecuteGQL(t,{listId:e}))?.ListSharesForList??[]).map(ct)}async ListsSharedWithMe(){const e=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1335
1335
|
query ListsSharedWithMe {
|
|
1336
1336
|
ListsSharedWithMe {
|
|
1337
1337
|
ListID
|
|
@@ -1381,7 +1381,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1381
1381
|
Message
|
|
1382
1382
|
PermissionID
|
|
1383
1383
|
}
|
|
1384
|
-
`;function
|
|
1384
|
+
`;function it(d){return d.kind==="user"?{Kind:"user",UserID:d.userId}:{Kind:"role",RoleID:d.roleId}}l(it,"serializeShareTarget");function K(d){if(!d||typeof d!="object")throw new Error("GraphQLListsClient: empty/invalid ShareResult response");const e=d;return{Success:e.Success,ResultCode:e.ResultCode,Message:e.Message,PermissionID:e.PermissionID??void 0}}l(K,"parseShareResult");function ct(d){const e=d,t=e.Target.Kind==="user"?{kind:"user",userId:e.Target.UserID}:{kind:"role",roleId:e.Target.RoleID};return{PermissionID:e.PermissionID,ListID:e.ListID,Target:t,PermissionLevel:e.PermissionLevel,Status:e.Status,SharedByUserID:e.SharedByUserID??null,CreatedAt:new Date(e.CreatedAt)}}l(ct,"parseShareSummary");function B(d){switch(d.kind){case"list":return{Kind:"list",ListID:d.listId};case"view":return{Kind:"view",ViewID:d.viewId};case"adhoc":return{Kind:"adhoc",EntityName:d.entityName,ExtraFilter:d.extraFilter}}}l(B,"serializeListSource");function de(d){if(!d||typeof d!="object")throw new Error("GraphQLListsClient: empty/invalid ListDelta response from server");const e=d;return{TargetListId:e.TargetListId,EntityName:e.EntityName,ToAdd:e.ToAdd,ToRemove:e.ToRemove,Unchanged:e.Unchanged,Counts:e.Counts,Warnings:e.Warnings.map(ut),DeltaToken:e.DeltaToken}}l(de,"parseListDelta");function ut(d){let e;if(d.DetailsJSON)try{e=JSON.parse(d.DetailsJSON)}catch(t){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLListsClient: failed to parse warning details JSON: ${t}`)}return{Code:d.Code,Message:d.Message,Details:e}}l(ut,"parseWarning");function U(d){if(!d||typeof d!="object")throw new Error("GraphQLListsClient: empty/invalid ApplyResult response from server");const e=d;return{Success:e.Success,ResultCode:e.ResultCode,Message:e.Message,CreatedListId:e.CreatedListId??void 0,TargetListId:e.TargetListId??void 0,Counts:e.AddedCount!=null||e.RemovedCount!=null||e.FailedCount!=null?{Added:e.AddedCount??0,Removed:e.RemovedCount??0,Failed:e.FailedCount??0}:void 0,Errors:e.Errors??void 0}}l(U,"parseApplyResult");class lt{static{l(this,"GraphQLEncryptionClient")}constructor(e){this._dataProvider=e}async CreateAPIKey(e){try{const t=this.createAPIKeyVariables(e),r=await this.executeCreateAPIKeyMutation(t);return this.processCreateAPIKeyResult(r)}catch(t){return this.handleCreateAPIKeyError(t)}}createAPIKeyVariables(e){return{input:{Label:e.Label,Description:e.Description,ExpiresAt:e.ExpiresAt?.toISOString(),ScopeIDs:e.ScopeIDs}}}async executeCreateAPIKeyMutation(e){const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1385
1385
|
mutation CreateAPIKey($input: CreateAPIKeyInput!) {
|
|
1386
1386
|
CreateAPIKey(input: $input) {
|
|
1387
1387
|
Success
|
|
@@ -1397,7 +1397,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1397
1397
|
Error
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
`,s=await this._dataProvider.ExecuteGQL(t,{apiKeyId:e});return s?.RevokeAPIKey?{Success:s.RevokeAPIKey.Success,Error:s.RevokeAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error revoking API key: ${r.message}`),{Success:!1,Error:`Error: ${r.message}`}}}}class
|
|
1400
|
+
`,s=await this._dataProvider.ExecuteGQL(t,{apiKeyId:e});return s?.RevokeAPIKey?{Success:s.RevokeAPIKey.Success,Error:s.RevokeAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error revoking API key: ${r.message}`),{Success:!1,Error:`Error: ${r.message}`}}}}class dt{static{l(this,"GraphQLClusterClient")}constructor(e){this._dataProvider=e}async RunClusterAnalysis(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1401
1401
|
mutation RunClusterAnalysis($input: RunClusterAnalysisInput!) {
|
|
1402
1402
|
RunClusterAnalysis(input: $input) {
|
|
1403
1403
|
Success
|
|
@@ -1413,7 +1413,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1413
1413
|
AnalysisID
|
|
1414
1414
|
}
|
|
1415
1415
|
}
|
|
1416
|
-
`,s=(await this._dataProvider.ExecuteGQL(t,{input:e}))?.RunClusterAnalysis;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLClusterClient.RunClusterAnalysis failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=this.parseMetrics(e),r=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.ClustersJSON)??[],s=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.PointsJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Metrics:t,Clusters:r,Points:s,AnalysisID:e.AnalysisID}}parseMetrics(e){const t=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.MetricsJSON);return t||{SilhouetteScore:e.SilhouetteScore,ClusterCount:e.ClusterCount,ComputationTimeMs:e.ComputationTimeMs,RecordCount:e.RecordCount,OutlierCount:e.OutlierCount}}errorResult(e){return{Success:!1,ErrorMessage:e,Metrics:{SilhouetteScore:0,ClusterCount:0,ComputationTimeMs:0,RecordCount:0,OutlierCount:0},Clusters:[],Points:[]}}}class
|
|
1416
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{input:e}))?.RunClusterAnalysis;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLClusterClient.RunClusterAnalysis failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=this.parseMetrics(e),r=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.ClustersJSON)??[],s=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.PointsJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Metrics:t,Clusters:r,Points:s,AnalysisID:e.AnalysisID}}parseMetrics(e){const t=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.MetricsJSON);return t||{SilhouetteScore:e.SilhouetteScore,ClusterCount:e.ClusterCount,ComputationTimeMs:e.ComputationTimeMs,RecordCount:e.RecordCount,OutlierCount:e.OutlierCount}}errorResult(e){return{Success:!1,ErrorMessage:e,Metrics:{SilhouetteScore:0,ClusterCount:0,ComputationTimeMs:0,RecordCount:0,OutlierCount:0},Clusters:[],Points:[]}}}class yt{static{l(this,"GraphQLLiveKitClient")}constructor(e){this._dataProvider=e}async MintClientToken(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1417
1417
|
mutation MintLiveKitClientToken($input: MintLiveKitClientTokenInput!) {
|
|
1418
1418
|
MintLiveKitClientToken(input: $input) {
|
|
1419
1419
|
Success
|
|
@@ -1478,7 +1478,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1478
1478
|
RecordingFileID
|
|
1479
1479
|
}
|
|
1480
1480
|
}
|
|
1481
|
-
`,{egressID:e},"StopLiveKitRecording",e)}async runRecordingMutation(e,t,r,s){try{const a=(await this._dataProvider.ExecuteGQL(e,t))?.[r];if(!a)throw new Error("Invalid response from server");return a}catch(n){const a=n;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLLiveKitClient.${r} failed`,void 0,a),{Success:!1,ErrorMessage:a.message||"Unknown error",EgressID:s,Status:""}}}}class
|
|
1481
|
+
`,{egressID:e},"StopLiveKitRecording",e)}async runRecordingMutation(e,t,r,s){try{const a=(await this._dataProvider.ExecuteGQL(e,t))?.[r];if(!a)throw new Error("Invalid response from server");return a}catch(n){const a=n;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLLiveKitClient.${r} failed`,void 0,a),{Success:!1,ErrorMessage:a.message||"Unknown error",EgressID:s,Status:""}}}}class mt{static{l(this,"GraphQLClassifyClient")}constructor(e){this._dataProvider=e}async GenerateSeedTaxonomy(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1482
1482
|
mutation GenerateSeedTaxonomy($sourceID: String!, $sampleSize: Int!) {
|
|
1483
1483
|
GenerateSeedTaxonomy(sourceID: $sourceID, sampleSize: $sampleSize) {
|
|
1484
1484
|
Success
|
|
@@ -1488,7 +1488,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1488
1488
|
NodesJSON
|
|
1489
1489
|
}
|
|
1490
1490
|
}
|
|
1491
|
-
`,s=(await this._dataProvider.ExecuteGQL(t,{sourceID:e.SourceID,sampleSize:e.SampleSize}))?.GenerateSeedTaxonomy;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLClassifyClient.GenerateSeedTaxonomy failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.NodesJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Method:e.Method,SampleSize:e.SampleSize,Nodes:t}}errorResult(e){return{Success:!1,ErrorMessage:e,SampleSize:0,Nodes:[]}}}class
|
|
1491
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{sourceID:e.SourceID,sampleSize:e.SampleSize}))?.GenerateSeedTaxonomy;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLClassifyClient.GenerateSeedTaxonomy failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e.NodesJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Method:e.Method,SampleSize:e.SampleSize,Nodes:t}}errorResult(e){return{Success:!1,ErrorMessage:e,SampleSize:0,Nodes:[]}}}class gt{static{l(this,"GraphQLTestingClient")}constructor(e){this._dataProvider=e}async RunTest(e){try{const t=this.buildRunTestMutation(),r=this.buildRunTestVariables(e),s={};return await w.Execute({dataProvider:this._dataProvider,mutation:t,variables:r,mutationFieldName:"RunTest",operationLabel:"RunTest",validateAck:l(n=>n?.success===!0,"validateAck"),isCompletionEvent:l(n=>this.isTestCompletionEvent(n,e.testId),"isCompletionEvent"),extractResult:l(n=>this.extractTestResult(n),"extractResult"),onMessage:l(n=>{this.captureTestRunId(n,s),e.onProgress&&this.forwardTestProgress(n,e.onProgress)},"onMessage"),onStall:l(()=>this.reconcileTestRun(s),"onStall"),createErrorResult:l(n=>({success:!1,errorMessage:n,result:null}),"createErrorResult")})}catch(t){return this.handleError(t,"RunTest")}}async RunTestSuite(e){try{const t=this.buildRunTestSuiteMutation(),r=this.buildRunTestSuiteVariables(e);return await w.Execute({dataProvider:this._dataProvider,mutation:t,variables:r,mutationFieldName:"RunTestSuite",operationLabel:"RunTestSuite",validateAck:l(s=>s?.success===!0,"validateAck"),isCompletionEvent:l(s=>this.isSuiteCompletionEvent(s,e.suiteId),"isCompletionEvent"),extractResult:l(s=>this.extractSuiteResult(s),"extractResult"),onMessage:e.onProgress?s=>this.forwardTestProgress(s,e.onProgress):void 0,createErrorResult:l(s=>({success:!1,errorMessage:s,result:null}),"createErrorResult")})}catch(t){return this.handleError(t,"RunTestSuite")}}async IsTestRunning(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1492
1492
|
query IsTestRunning($testId: String!) {
|
|
1493
1493
|
IsTestRunning(testId: $testId)
|
|
1494
1494
|
}
|
|
@@ -1546,7 +1546,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1546
1546
|
result
|
|
1547
1547
|
}
|
|
1548
1548
|
}
|
|
1549
|
-
`}buildRunTestVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0;return{testId:e.testId,verbose:e.verbose,environment:e.environment,tags:t,variables:r,fireAndForget:!0}}buildRunTestSuiteVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0,s=e.selectedTestIds&&e.selectedTestIds.length>0?JSON.stringify(e.selectedTestIds):void 0;return{suiteId:e.suiteId,verbose:e.verbose,environment:e.environment,parallel:e.parallel,tags:t,variables:r,selectedTestIds:s,sequenceStart:e.sequenceStart,sequenceEnd:e.sequenceEnd,fireAndForget:!0}}isTestCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetComplete"&&r?.type==="complete"&&r?.testId===t}isSuiteCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetSuiteComplete"&&r?.type==="complete"&&r?.suiteId===t}captureTestRunId(e,t){if(e.resolver!=="RunTestResolver")return;const s=e.data?.testRunId;s&&(t.id=s)}async reconcileTestRun(e){if(!e.id)return"continue";const t=await this._dataProvider.RunView({EntityName:"MJ: Test Runs",ExtraFilter:`ID='${e.id}'`,ResultType:"entity_object",BypassCache:!0}),r=t.Success?t.Results?.[0]:void 0;if(!r||r.Status==="Pending"||r.Status==="Running")return"continue";const s=r.Status==="Passed";return{resolve:{success:s,errorMessage:s?void 0:`Test run ${r.Status}`,result:null}}}extractTestResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(t.result):null}}extractSuiteResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(t.result):null}}forwardTestProgress(e,t){if(e.resolver==="RunTestResolver"&&e.type==="TestExecutionProgress"&&e.status==="ok"){const s=e.data?.progress;s&&t(s)}}handleError(e,t){const r=e.message;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`${t} failed: ${r}`),{success:!1,errorMessage:r.includes("Failed to fetch")||r.includes("NetworkError")?"Lost connection to the server. The test may still be running. Please refresh to check the latest status.":r,result:null}}}class
|
|
1549
|
+
`}buildRunTestVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0;return{testId:e.testId,verbose:e.verbose,environment:e.environment,tags:t,variables:r,fireAndForget:!0}}buildRunTestSuiteVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0,s=e.selectedTestIds&&e.selectedTestIds.length>0?JSON.stringify(e.selectedTestIds):void 0;return{suiteId:e.suiteId,verbose:e.verbose,environment:e.environment,parallel:e.parallel,tags:t,variables:r,selectedTestIds:s,sequenceStart:e.sequenceStart,sequenceEnd:e.sequenceEnd,fireAndForget:!0}}isTestCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetComplete"&&r?.type==="complete"&&r?.testId===t}isSuiteCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetSuiteComplete"&&r?.type==="complete"&&r?.suiteId===t}captureTestRunId(e,t){if(e.resolver!=="RunTestResolver")return;const s=e.data?.testRunId;s&&(t.id=s)}async reconcileTestRun(e){if(!e.id)return"continue";const t=await this._dataProvider.RunView({EntityName:"MJ: Test Runs",ExtraFilter:`ID='${e.id}'`,ResultType:"entity_object",BypassCache:!0}),r=t.Success?t.Results?.[0]:void 0;if(!r||r.Status==="Pending"||r.Status==="Running")return"continue";const s=r.Status==="Passed";return{resolve:{success:s,errorMessage:s?void 0:`Test run ${r.Status}`,result:null}}}extractTestResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(t.result):null}}extractSuiteResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(t.result):null}}forwardTestProgress(e,t){if(e.resolver==="RunTestResolver"&&e.type==="TestExecutionProgress"&&e.status==="ok"){const s=e.data?.progress;s&&t(s)}}handleError(e,t){const r=e.message;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`${t} failed: ${r}`),{success:!1,errorMessage:r.includes("Failed to fetch")||r.includes("NetworkError")?"Lost connection to the server. The test may still be running. Please refresh to check the latest status.":r,result:null}}}class St{static{l(this,"GraphQLComponentRegistryClient")}constructor(e){this._dataProvider=e}async GetRegistryComponent(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1550
1550
|
query GetRegistryComponent(
|
|
1551
1551
|
$registryName: String!,
|
|
1552
1552
|
$namespace: String!,
|
|
@@ -1630,7 +1630,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1630
1630
|
error
|
|
1631
1631
|
}
|
|
1632
1632
|
}
|
|
1633
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}}class
|
|
1633
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}}class pt{static{l(this,"GraphQLVersionHistoryClient")}constructor(e){this._dataProvider=e}async CreateLabel(e){let t;try{e.OnProgress&&(t=this._dataProvider.PushStatusUpdates(this._dataProvider.sessionId).subscribe(a=>{try{const i=JSON.parse(a);i.resolver==="VersionHistoryResolver"&&i.type==="CreateLabelProgress"&&i.status==="ok"&&i.data&&e.OnProgress(i.data)}catch{}}));const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1634
1634
|
mutation CreateVersionLabel($input: CreateVersionLabelInput!, $sessionId: String) {
|
|
1635
1635
|
CreateVersionLabel(input: $input, sessionId: $sessionId) {
|
|
1636
1636
|
Success
|
|
@@ -1646,7 +1646,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1646
1646
|
}
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
|
-
`,s={input:this.buildInput(e),sessionId:this._dataProvider.sessionId},n=await this._dataProvider.ExecuteGQL(r,s);return this.processResult(n)}catch(r){const s=r instanceof Error?r.message:String(r);return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLVersionHistoryClient.CreateLabel error: ${s}`),{Success:!1,Error:s}}finally{t&&t.unsubscribe()}}buildInput(e){const t={Name:e.Name};return e.Description!=null&&(t.Description=e.Description),e.Scope!=null&&(t.Scope=e.Scope),e.EntityName!=null&&(t.EntityName=e.EntityName),e.ParentID!=null&&(t.ParentID=e.ParentID),e.ExternalSystemID!=null&&(t.ExternalSystemID=e.ExternalSystemID),e.IncludeDependencies!=null&&(t.IncludeDependencies=e.IncludeDependencies),e.MaxDepth!=null&&(t.MaxDepth=e.MaxDepth),e.ExcludeEntities!=null&&(t.ExcludeEntities=e.ExcludeEntities),e.RecordKeys&&e.RecordKeys.length>0&&(t.RecordKeys=e.RecordKeys.map(r=>({Key:r.Key,Value:r.Value}))),t}processResult(e){const t=e?.CreateVersionLabel;if(!t)return{Success:!1,Error:"Invalid response from server."};const r=Array.isArray(t.CaptureErrors)?t.CaptureErrors.map(s=>({EntityName:s.EntityName??"",RecordID:s.RecordID??"",ErrorMessage:s.ErrorMessage??""})):void 0;return{Success:t.Success,LabelID:t.LabelID,LabelName:t.LabelName,ItemsCaptured:t.ItemsCaptured,SyntheticSnapshotsCreated:t.SyntheticSnapshotsCreated,Error:t.Error,CaptureErrors:r}}}class
|
|
1649
|
+
`,s={input:this.buildInput(e),sessionId:this._dataProvider.sessionId},n=await this._dataProvider.ExecuteGQL(r,s);return this.processResult(n)}catch(r){const s=r instanceof Error?r.message:String(r);return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLVersionHistoryClient.CreateLabel error: ${s}`),{Success:!1,Error:s}}finally{t&&t.unsubscribe()}}buildInput(e){const t={Name:e.Name};return e.Description!=null&&(t.Description=e.Description),e.Scope!=null&&(t.Scope=e.Scope),e.EntityName!=null&&(t.EntityName=e.EntityName),e.ParentID!=null&&(t.ParentID=e.ParentID),e.ExternalSystemID!=null&&(t.ExternalSystemID=e.ExternalSystemID),e.IncludeDependencies!=null&&(t.IncludeDependencies=e.IncludeDependencies),e.MaxDepth!=null&&(t.MaxDepth=e.MaxDepth),e.ExcludeEntities!=null&&(t.ExcludeEntities=e.ExcludeEntities),e.RecordKeys&&e.RecordKeys.length>0&&(t.RecordKeys=e.RecordKeys.map(r=>({Key:r.Key,Value:r.Value}))),t}processResult(e){const t=e?.CreateVersionLabel;if(!t)return{Success:!1,Error:"Invalid response from server."};const r=Array.isArray(t.CaptureErrors)?t.CaptureErrors.map(s=>({EntityName:s.EntityName??"",RecordID:s.RecordID??"",ErrorMessage:s.ErrorMessage??""})):void 0;return{Success:t.Success,LabelID:t.LabelID,LabelName:t.LabelName,ItemsCaptured:t.ItemsCaptured,SyntheticSnapshotsCreated:t.SyntheticSnapshotsCreated,Error:t.Error,CaptureErrors:r}}}class ht{static{l(this,"GraphQLFileStorageClient")}constructor(e){this._dataProvider=e}async ListObjects(e,t="",r){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1650
1650
|
query ListStorageObjects($input: ListStorageObjectsInput!) {
|
|
1651
1651
|
ListStorageObjects(input: $input) {
|
|
1652
1652
|
objects {
|
|
@@ -1747,13 +1747,14 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1747
1747
|
failedAccounts
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
1750
|
-
`,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(m=>({path:m.path,name:m.name,size:m.size,contentType:m.contentType,lastModified:new Date(m.lastModified),relevance:m.relevance,excerpt:m.excerpt,matchInFilename:m.matchInFilename,objectId:m.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
|
|
1750
|
+
`,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(m=>({path:m.path,name:m.name,size:m.size,contentType:m.contentType,lastModified:new Date(m.lastModified),relevance:m.relevance,excerpt:m.excerpt,matchInFilename:m.matchInFilename,objectId:m.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 It{static{l(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)`
|
|
1751
1751
|
mutation SearchKnowledge($query: String!, $maxResults: Float, $filters: SearchFiltersInput, $minScore: Float, $scopeIDs: [ID!], $searchContext: SearchContextInput) {
|
|
1752
1752
|
SearchKnowledge(query: $query, maxResults: $maxResults, filters: $filters, minScore: $minScore, scopeIDs: $scopeIDs, searchContext: $searchContext) {
|
|
1753
1753
|
Success
|
|
1754
1754
|
Results {
|
|
1755
1755
|
ID
|
|
1756
1756
|
EntityName
|
|
1757
|
+
EntityDisplayName
|
|
1757
1758
|
RecordID
|
|
1758
1759
|
SourceType
|
|
1759
1760
|
ResultType
|
|
@@ -1801,6 +1802,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1801
1802
|
Results {
|
|
1802
1803
|
ID
|
|
1803
1804
|
EntityName
|
|
1805
|
+
EntityDisplayName
|
|
1804
1806
|
RecordID
|
|
1805
1807
|
SourceType
|
|
1806
1808
|
ResultType
|
|
@@ -1881,12 +1883,12 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
1881
1883
|
Phase
|
|
1882
1884
|
ProviderName
|
|
1883
1885
|
DurationMs
|
|
1884
|
-
Results { ID EntityName RecordID SourceType Title Snippet Score Tags MatchedAt ProviderId ProviderLabel ProviderIcon }
|
|
1886
|
+
Results { ID EntityName EntityDisplayName RecordID SourceType Title Snippet Score Tags MatchedAt ProviderId ProviderLabel ProviderIcon }
|
|
1885
1887
|
SourceCounts { Vector FullText Entity Storage }
|
|
1886
1888
|
ElapsedMs
|
|
1887
1889
|
ErrorMessage
|
|
1888
1890
|
}
|
|
1889
|
-
}`;n=this._dataProvider.subscribe(o,{streamID:i.StreamID}).subscribe({next:l(m=>{const u=m?.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:l(m=>t.error(m),"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
|
|
1891
|
+
}`;n=this._dataProvider.subscribe(o,{streamID:i.StreamID}).subscribe({next:l(m=>{const u=m?.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:l(m=>t.error(m),"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,EntityDisplayName:e.EntityDisplayName,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 ft{static{l(this,"GraphQLIntegrationClient")}constructor(e){this._dataProvider=e}async DiscoverObjects(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1890
1892
|
query IntegrationDiscoverObjects($companyIntegrationID: String!) {
|
|
1891
1893
|
IntegrationDiscoverObjects(companyIntegrationID: $companyIntegrationID) {
|
|
1892
1894
|
Success
|
|
@@ -2037,7 +2039,7 @@ ${e.stackFrames}`:this.stack}}function ie(d){return d instanceof V?d:new V(O(d))
|
|
|
2037
2039
|
PipelineSteps { Name Status DurationMs Message }
|
|
2038
2040
|
GitCommitSuccess APIRestarted
|
|
2039
2041
|
}
|
|
2040
|
-
}`,m={Connectors:e.map(g=>({CompanyIntegrationID:g.CompanyIntegrationID,SourceObjects:g.SourceObjects.map(
|
|
2042
|
+
}`,m={Connectors:e.map(g=>({CompanyIntegrationID:g.CompanyIntegrationID,SourceObjects:g.SourceObjects.map(f=>({SourceObjectID:f.SourceObjectID??null,SourceObjectName:f.SourceObjectName??null,Fields:f.Fields??null}))})),StartSync:t,FullSync:r,SyncScope:s},u=(await this._dataProvider.ExecuteGQL(o,{input:m,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(g=>g.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(
|
|
2041
2043
|
$input: ApplyAllInput!, $platform: String!, $skipGitCommit: Boolean!, $skipRestart: Boolean!
|
|
2042
2044
|
) {
|
|
2043
2045
|
IntegrationApplyAll(input: $input, platform: $platform, skipGitCommit: $skipGitCommit, skipRestart: $skipRestart) {
|