@memberjunction/react-runtime 5.13.0 → 5.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +12 -0
- package/dist/324.runtime.umd.js +7 -7
- package/dist/runtime.umd.js +1 -1
- package/package.json +6 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
|
|
2
|
-
> @memberjunction/react-runtime@5.
|
|
2
|
+
> @memberjunction/react-runtime@5.14.0 build
|
|
3
3
|
> npm run build:node && npm run build:umd
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @memberjunction/react-runtime@5.
|
|
6
|
+
> @memberjunction/react-runtime@5.14.0 build:node
|
|
7
7
|
> tsc
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @memberjunction/react-runtime@5.
|
|
10
|
+
> @memberjunction/react-runtime@5.14.0 build:umd
|
|
11
11
|
> webpack --config webpack.umd.config.cjs
|
|
12
12
|
|
|
13
13
|
[BABEL] Note: The code generator has deoptimised the styling of /home/runner/work/MJ/MJ/packages/MJCoreEntities/dist/generated/entity_subclasses.js as it exceeds the max of 500KB.
|
|
14
|
-
asset [1m[33mruntime.umd.js[39m[22m [1m[33m2.
|
|
15
|
-
asset [1m[32m324.runtime.umd.js[39m[22m
|
|
14
|
+
asset [1m[33mruntime.umd.js[39m[22m [1m[33m2.4 MiB[39m[22m [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m [1m[33m[big][39m[22m (name: main) 1 related asset
|
|
15
|
+
asset [1m[32m324.runtime.umd.js[39m[22m 128 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m
|
|
16
16
|
asset [1m[32m490.runtime.umd.js[39m[22m 61.7 KiB [1m[32m[emitted][39m[22m [1m[32m[minimized][39m[22m (id hint: vendors)
|
|
17
|
-
orphan modules 5.
|
|
17
|
+
orphan modules 5.91 MiB [1m[33m[orphan][39m[22m 493 modules
|
|
18
18
|
runtime modules 6.94 KiB 10 modules
|
|
19
|
-
cacheable modules 6.
|
|
19
|
+
cacheable modules 6.02 MiB
|
|
20
20
|
modules by path [1m../../../node_modules/[39m[22m 780 KiB
|
|
21
21
|
modules by path [1m../../../node_modules/rxjs/dist/esm5/internal/[39m[22m 29.1 KiB 14 modules
|
|
22
22
|
modules by path [1m../../../node_modules/debug/src/*.js[39m[22m 12.7 KiB 2 modules
|
|
@@ -25,7 +25,7 @@ cacheable modules 6.04 MiB
|
|
|
25
25
|
[1m../../MJCoreEntities/dist/index.js + 23 modules[39m[22m 3.29 MiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
26
26
|
[1m../../MJCoreEntities/dist/engines/UserViewEngine.js[39m[22m 19.6 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
27
27
|
[1m./dist/index.js + 27 modules[39m[22m 424 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
28
|
-
[1m../../MJCore/dist/index.js +
|
|
28
|
+
[1m../../MJCore/dist/index.js + 75 modules[39m[22m 1.21 MiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
29
29
|
[1m../../MJGlobal/dist/index.js + 16 modules[39m[22m 204 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
30
|
-
[1m../../GraphQLDataProvider/dist/index.mjs[39m[22m
|
|
31
|
-
webpack 5.105.0 compiled [1m[32msuccessfully[39m[22m in
|
|
30
|
+
[1m../../GraphQLDataProvider/dist/index.mjs[39m[22m 128 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
31
|
+
webpack 5.105.0 compiled [1m[32msuccessfully[39m[22m in 151497 ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @memberjunction/react-runtime
|
|
2
2
|
|
|
3
|
+
## 5.14.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [69b5af4]
|
|
8
|
+
- Updated dependencies [140fc6d]
|
|
9
|
+
- @memberjunction/core@5.14.0
|
|
10
|
+
- @memberjunction/graphql-dataprovider@5.14.0
|
|
11
|
+
- @memberjunction/interactive-component-types@5.14.0
|
|
12
|
+
- @memberjunction/core-entities@5.14.0
|
|
13
|
+
- @memberjunction/global@5.14.0
|
|
14
|
+
|
|
3
15
|
## 5.13.0
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/324.runtime.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkMJReactRuntime=this.webpackChunkMJReactRuntime||[]).push([[324],{324(e,t,r){r.r(t),r.d(t,{ActionItemInput:()=>
|
|
1
|
+
"use strict";(this.webpackChunkMJReactRuntime=this.webpackChunkMJReactRuntime||[]).push([[324],{324(e,t,r){r.r(t),r.d(t,{ActionItemInput:()=>M,ActionItemOutput:()=>F,BrowserIndexedDBStorageProvider:()=>v,BrowserStorageProviderBase:()=>D,FieldMapper:()=>g,FireAndForgetHelper:()=>I,GetDataOutput:()=>G,GraphQLAIClient:()=>S,GraphQLActionClient:()=>O,GraphQLComponentRegistryClient:()=>k,GraphQLDataProvider:()=>C,GraphQLEncryptionClient:()=>j,GraphQLFileStorageClient:()=>B,GraphQLIntegrationClient:()=>q,GraphQLProviderConfigData:()=>f,GraphQLSystemUserClient:()=>L,GraphQLTestingClient:()=>K,GraphQLTransactionGroup:()=>h,GraphQLVersionHistoryClient:()=>J,RoleInput:()=>A,RolesAndUsersInput:()=>b,SimpleRemoteEntity:()=>_,SimpleRemoteEntityField:()=>U,SimpleRemoteEntityOutput:()=>V,SyncDataAction:()=>Q,SyncDataResult:()=>T,SyncRolesAndUsersResult:()=>$,UserInput:()=>N,gql:()=>s.J1,setupGraphQLClient:()=>P});var s=r(215),a=r(433),n=r(300),o=r(429),i=r(600),u=r(49),c=r(226),l=r(497),d=r(718),m=r(196),y=Object.defineProperty,p=(e,t)=>y(e,"name",{value:t,configurable:!0});class g{static{p(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(g.DB_PREFIX)?g.GQL_PREFIX+e.substring(g.DB_PREFIX.length):e}ReverseMapFieldName(e){return e.startsWith(g.GQL_PREFIX)?g.DB_PREFIX+e.substring(g.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 h extends a.VH{static{p(this,"GraphQLTransactionGroup")}constructor(e){super(),this._provider=e}async HandleSubmit(){const e=s.J1`
|
|
2
2
|
mutation ExecuteTransactionGroup($group: TransactionInputType!) {
|
|
3
3
|
ExecuteTransactionGroup(group: $group) {
|
|
4
4
|
Success
|
|
@@ -183,10 +183,10 @@
|
|
|
183
183
|
error
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
`,r={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},a=await this._dataProvider.ExecuteGQL(t,r);if(!a?.EmbedText)throw new Error("Invalid response from server");const n=a.EmbedText;return{embeddings:Array.isArray(e.textToEmbed)?n.embeddings:n.embeddings[0],modelName:n.modelName,vectorDimensions:n.vectorDimensions,error:n.error}}catch(t){const r=t;return(0,a.ZI)(`Error generating embeddings: ${r}`),{embeddings:(Array.isArray(e.textToEmbed),[]),modelName:"Unknown",vectorDimensions:0,error:r.message||"Unknown error occurred"}}}}const R="default";class D{static{p(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}getCategoryMap(e){const t=e||R;let r=this._storage.get(t);return r||(r=new Map,this._storage.set(t,r)),r}async GetItem(e,t){return this.getCategoryMap(t||R).get(e)??null}async SetItem(e,t,r){this.getCategoryMap(r||R).set(e,t)}async Remove(e,t){this.getCategoryMap(t||R).delete(e)}async ClearCategory(e){const t=e||R;this._storage.delete(t)}async GetCategoryKeys(e){const t=this._storage.get(e||R);return t?Array.from(t.keys()):[]}}const E=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"],w="Metadata_KVPairs";class v extends D{static{p(this,"BrowserIndexedDBStorageProvider")}constructor(){super(),this._dbReady=!1,this.dbPromise=(0,m.P2)("MJ_Metadata",3,{upgrade(e){try{e.objectStoreNames.contains(w)&&e.deleteObjectStore(w);for(const t of E)e.objectStoreNames.contains(t)||e.createObjectStore(t)}catch(e){(0,a.Q1)({error:e,message:e?.message})}}}),this.dbPromise.then(()=>{this._dbReady=!0}).catch(e=>{(0,a.Q1)({error:e,message:"IndexedDB initialization failed: "+e?.message})})}isKnownCategory(e){const t=`mj:${e}`;return E.includes(t)}getStoreName(e){const t=e||R;return this.isKnownCategory(t)?`mj:${t}`:"mj:default"}getStoreKey(e,t){const r=t||R;return this.isKnownCategory(r)?e:`[${r}]:${e}`}async SetItem(e,t,r){try{const s=await this.dbPromise,a=this.getStoreName(r),n=this.getStoreKey(e,r),o=s.transaction(a,"readwrite");await o.objectStore(a).put(t,n),await o.done}catch(s){(0,a.Q1)({error:s,message:s?.message}),await super.SetItem(e,t,r)}}async GetItem(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),a=this.getStoreKey(e,t);return await r.transaction(s).objectStore(s).get(a)??null}catch(r){return(0,a.Q1)({error:r,message:r?.message}),await super.GetItem(e,t)}}async Remove(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),a=this.getStoreKey(e,t),n=r.transaction(s,"readwrite");await n.objectStore(s).delete(a),await n.done}catch(r){(0,a.Q1)({error:r,message:r?.message}),await super.Remove(e,t)}}async ClearCategory(e){try{const t=await this.dbPromise,r=e||R,s=this.getStoreName(e);if(this.isKnownCategory(r)){const e=t.transaction(s,"readwrite");await e.objectStore(s).clear(),await e.done}else{const e=`[${r}]:`,s=t.transaction("mj:default","readwrite"),a=s.objectStore("mj:default"),n=await a.getAllKeys();for(const t of n)"string"==typeof t&&t.startsWith(e)&&await a.delete(t);await s.done}}catch(t){(0,a.Q1)({error:t,message:t?.message}),await super.ClearCategory(e)}}async GetCategoryKeys(e){try{const t=await this.dbPromise,r=e||R,s=this.getStoreName(e),a=await t.transaction(s,"readonly").objectStore(s).getAllKeys();if(this.isKnownCategory(r))return a.map(e=>String(e));const n=`[${r}]:`;return a.map(e=>String(e)).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length))}catch(t){return(0,a.Q1)({error:t,message:t?.message}),await super.GetCategoryKeys(e)}}}class f extends a.dZ{static{p(this,"GraphQLProviderConfigData")}get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get MJAPIKey(){return this.Data.MJAPIKey}set MJAPIKey(e){this.Data.MJAPIKey=e}get UserAPIKey(){return this.Data.UserAPIKey}set UserAPIKey(e){this.Data.UserAPIKey=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}constructor(e,t,r,s,a,n,o,i,u){super({Token:e,URL:t,WSURL:r,MJAPIKey:i,UserAPIKey:u,RefreshTokenFunction:s},a,n,o)}}class
|
|
186
|
+
`,r={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},a=await this._dataProvider.ExecuteGQL(t,r);if(!a?.EmbedText)throw new Error("Invalid response from server");const n=a.EmbedText;return{embeddings:Array.isArray(e.textToEmbed)?n.embeddings:n.embeddings[0],modelName:n.modelName,vectorDimensions:n.vectorDimensions,error:n.error}}catch(t){const r=t;return(0,a.ZI)(`Error generating embeddings: ${r}`),{embeddings:(Array.isArray(e.textToEmbed),[]),modelName:"Unknown",vectorDimensions:0,error:r.message||"Unknown error occurred"}}}}const R="default";class D{static{p(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}getCategoryMap(e){const t=e||R;let r=this._storage.get(t);return r||(r=new Map,this._storage.set(t,r)),r}async GetItem(e,t){return this.getCategoryMap(t||R).get(e)??null}async SetItem(e,t,r){this.getCategoryMap(r||R).set(e,t)}async Remove(e,t){this.getCategoryMap(t||R).delete(e)}async ClearCategory(e){const t=e||R;this._storage.delete(t)}async GetCategoryKeys(e){const t=this._storage.get(e||R);return t?Array.from(t.keys()):[]}}const E=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"],w="Metadata_KVPairs";class v extends D{static{p(this,"BrowserIndexedDBStorageProvider")}constructor(){super(),this._dbReady=!1,this.dbPromise=(0,m.P2)("MJ_Metadata",3,{upgrade(e){try{e.objectStoreNames.contains(w)&&e.deleteObjectStore(w);for(const t of E)e.objectStoreNames.contains(t)||e.createObjectStore(t)}catch(e){(0,a.Q1)({error:e,message:e?.message})}}}),this.dbPromise.then(()=>{this._dbReady=!0}).catch(e=>{(0,a.Q1)({error:e,message:"IndexedDB initialization failed: "+e?.message})})}isKnownCategory(e){const t=`mj:${e}`;return E.includes(t)}getStoreName(e){const t=e||R;return this.isKnownCategory(t)?`mj:${t}`:"mj:default"}getStoreKey(e,t){const r=t||R;return this.isKnownCategory(r)?e:`[${r}]:${e}`}async SetItem(e,t,r){try{const s=await this.dbPromise,a=this.getStoreName(r),n=this.getStoreKey(e,r),o=s.transaction(a,"readwrite");await o.objectStore(a).put(t,n),await o.done}catch(s){(0,a.Q1)({error:s,message:s?.message}),await super.SetItem(e,t,r)}}async GetItem(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),a=this.getStoreKey(e,t);return await r.transaction(s).objectStore(s).get(a)??null}catch(r){return(0,a.Q1)({error:r,message:r?.message}),await super.GetItem(e,t)}}async Remove(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),a=this.getStoreKey(e,t),n=r.transaction(s,"readwrite");await n.objectStore(s).delete(a),await n.done}catch(r){(0,a.Q1)({error:r,message:r?.message}),await super.Remove(e,t)}}async ClearCategory(e){try{const t=await this.dbPromise,r=e||R,s=this.getStoreName(e);if(this.isKnownCategory(r)){const e=t.transaction(s,"readwrite");await e.objectStore(s).clear(),await e.done}else{const e=`[${r}]:`,s=t.transaction("mj:default","readwrite"),a=s.objectStore("mj:default"),n=await a.getAllKeys();for(const t of n)"string"==typeof t&&t.startsWith(e)&&await a.delete(t);await s.done}}catch(t){(0,a.Q1)({error:t,message:t?.message}),await super.ClearCategory(e)}}async GetCategoryKeys(e){try{const t=await this.dbPromise,r=e||R,s=this.getStoreName(e),a=await t.transaction(s,"readonly").objectStore(s).getAllKeys();if(this.isKnownCategory(r))return a.map(e=>String(e));const n=`[${r}]:`;return a.map(e=>String(e)).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length))}catch(t){return(0,a.Q1)({error:t,message:t?.message}),await super.GetCategoryKeys(e)}}}class f extends a.dZ{static{p(this,"GraphQLProviderConfigData")}get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get MJAPIKey(){return this.Data.MJAPIKey}set MJAPIKey(e){this.Data.MJAPIKey=e}get UserAPIKey(){return this.Data.UserAPIKey}set UserAPIKey(e){this.Data.UserAPIKey=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}constructor(e,t,r,s,a,n,o,i,u){super({Token:e,URL:t,WSURL:r,MJAPIKey:i,UserAPIKey:u,RefreshTokenFunction:s},a,n,o)}}class C extends a.Dn{static{p(this,"GraphQLDataProvider")}constructor(){super(),this._refreshPromise=null,this._dynamicHeaders=new Map,this._innerCurrentUserQueryString=`CurrentUser {\n ${this.userInfoString()}\n MJUserRoles_UserIDArray {\n ${this.userRoleInfoString()}\n }\n }\n `,this._currentUserQuery=s.J1`query CurrentUserAndRoles {
|
|
187
187
|
${this._innerCurrentUserQueryString}
|
|
188
188
|
CurrentUserTenantContext
|
|
189
|
-
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=18e5,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=3e5,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=6e5,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,this._cacheInvalidationSubscription=null,
|
|
189
|
+
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=18e5,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=3e5,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=6e5,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,this._cacheInvalidationSubscription=null,C._instance||(C._instance=this)}static get Instance(){return C._instance}get ConfigData(){return this._configData}get AI(){return this._aiClient||(this._aiClient=new S(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,d.A)()}get LocalStoragePrefix(){if(void 0===this._configData||void 0===this._configData.URL)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)):(C.Instance._configData=e,void 0===C.Instance._sessionId&&(C.Instance._sessionId=await this.GetPreferredUUID(s)),C.Instance._client||(C.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,C.Instance._sessionId,e.MJAPIKey,e.UserAPIKey)),await C.Instance.SaveStoredSessionID(C.Instance._sessionId),this._sessionId=C.Instance._sessionId,this._client=C.Instance._client),super.Config(e)}catch(e){throw(0,a.ZI)(e),e}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}SetDynamicHeader(e,t){this._dynamicHeaders.set(e,t),this._client&&this._client.setHeader(e,t),C.Instance&&C.Instance!==this&&C.Instance._configData===this._configData&&(C.Instance._dynamicHeaders.set(e,t),C.Instance._client&&C.Instance._client.setHeader(e,t))}RemoveDynamicHeader(e){this._dynamicHeaders.delete(e),this._client&&this._client.setHeader(e,""),C.Instance&&C.Instance!==this&&C.Instance._configData===this._configData&&(C.Instance._dynamicHeaders.delete(e),C.Instance._client&&C.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),r=t.MJUserRoles_UserIDArray.map(e=>this.ConvertBackToMJFields(e));t.MJUserRoles_UserIDArray=r;const s=new a.oq(this,{...t,UserRoles:r});return e.CurrentUserTenantContext&&"object"==typeof e.CurrentUserTenantContext&&(s.TenantContext=e.CurrentUserTenantContext),s}}async RunReport(e,t){const r=s.J1`
|
|
190
190
|
query GetReportDataQuery ($ReportID: String!) {
|
|
191
191
|
GetReportData(ReportID: $ReportID) {
|
|
192
192
|
Success
|
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
ErrorMessage
|
|
424
424
|
Result
|
|
425
425
|
}
|
|
426
|
-
}`,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)}throw new Error("GraphQL query failed")}catch(e){throw(0,a.ZI)(e),e}}static async ExecuteGQL(e,t,r=!0){return
|
|
426
|
+
}`,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)}throw new Error("GraphQL query failed")}catch(e){throw(0,a.ZI)(e),e}}static async ExecuteGQL(e,t,r=!0){return C.Instance.ExecuteGQL(e,t,r)}async ExecuteGQL(e,t,r=!0){try{return await this._client.request(e,t)}catch(s){if(console.error("[GraphQL] ExecuteGQL error caught:",{hasResponse:!!s?.response,hasErrors:!!s?.response?.errors,errorCount:s?.response?.errors?.length,firstError:s?.response?.errors?.[0],errorCode:s?.response?.errors?.[0]?.extensions?.code,errorMessage:s?.response?.errors?.[0]?.message,fullError:s}),s&&s.response&&s.response.errors?.length>0){if("JWT_EXPIRED"===s.response.errors[0]?.extensions?.code?.toUpperCase().trim()){if(r)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw(0,a.ZI)("JWT_EXPIRED and refreshTokenIfNeeded is false"),s}throw s}throw(0,a.ZI)(s),s}}async RefreshToken(){const e=C.Instance&&C.Instance._configData===this._configData;if(e&&C.Instance._refreshPromise)return C.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(C.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&C.Instance&&(C.Instance._refreshPromise=null)}}async performTokenRefresh(){if(!this._configData.Data.RefreshTokenFunction)throw new Error("No refresh token function provided");{const e=await this._configData.Data.RefreshTokenFunction();if(!e)throw new Error("Refresh token function returned null or undefined token");{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,C.Instance&&C.Instance._configData===this._configData&&(C.Instance._client=t)}}}static async RefreshToken(){return C.Instance.RefreshToken()}CreateNewGraphQLClient(e,t,r,a,n){const o={"x-session-id":r};t&&(o.authorization="Bearer "+t),a&&(o["x-mj-api-key"]=a),n&&(o["x-api-key"]=n);const i=new s.l4(e,{headers:o});for(const[e,t]of this._dynamicHeaders)i.setHeader(e,t);return i}userInfoString(){return this.infoString(new a.oq(null,null))}userRoleInfoString(){return this.infoString(new a.St(null))}infoString(e){let t="";const r=Object.keys(e);for(const e of r)e.startsWith("__mj_")?t+=e.replace("__mj_","_mj__")+"\n ":e.startsWith("_")||(t+=e+"\n ");return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new v:this._localStorageProvider=new a.KW),this._localStorageProvider}get Metadata(){return this}getOrCreateWSClient(){const e=Date.now();return this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&0===this._activeSubscriptionCount&&this.disposeWSClient(),this._wsClient||(this._wsClient=(0,l.UU)({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token},keepAlive:3e4,retryAttempts:3,shouldRetry:p(()=>!0,"shouldRetry")}),this._wsClientCreatedAt=e,this._subscriptionCleanupTimer||(this._subscriptionCleanupTimer=setInterval(()=>{this.cleanupStaleSubscriptions()},this.SUBSCRIPTION_CLEANUP_INTERVAL_MS))),this._wsClient}disposeWSClient(){if(this._wsClient){try{this._wsClient.dispose()}catch(e){console.error("[GraphQLDataProvider] Error disposing WebSocket client:",e)}this._wsClient=null,this._wsClientCreatedAt=null}}completeAllSubjects(){this._pushStatusSubjects.forEach((e,t)=>{try{e.subject.complete(),e.subscription.unsubscribe()}catch(e){console.error(`[GraphQLDataProvider] Error cleaning up subject for ${t}:`,e)}}),this._pushStatusSubjects.clear()}cleanupStaleSubscriptions(){if(!this._isCleaningUp){this._isCleaningUp=!0;try{const e=Date.now(),t=(this._pushStatusSubjects.size,Array.from(this._pushStatusSubjects.entries())),r=[];t.forEach(([t,s])=>{const a=e-s.lastRequestedAt,n=e-s.lastEmissionAt;0===s.activeSubscribers&&a>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&n>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&(console.log(`[GraphQLDataProvider] Marking session ${t} for cleanup: activeSubscribers=${s.activeSubscribers}, timeSinceRequested=${Math.round(a/1e3)}s, timeSinceEmission=${Math.round(n/1e3)}s`),r.push(t))}),r.forEach(e=>{const t=this._pushStatusSubjects.get(e);if(t)try{t.subject.complete(),t.subscription.unsubscribe(),this._pushStatusSubjects.delete(e),console.log(`[GraphQLDataProvider] Cleaned up stale subscription for session: ${e}`)}catch(t){console.error(`[GraphQLDataProvider] Error cleaning up subscription for ${e}:`,t)}}),r.length>0&&console.log(`[GraphQLDataProvider] Cleaned up ${r.length} stale subscription(s)`),0===this._pushStatusSubjects.size&&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 i.c(r=>{const s=this.getOrCreateWSClient();this._activeSubscriptionCount++;const a=s.subscribe({query:e,variables:t},{next:p(e=>{r.next(e.data)},"next"),error:p(async e=>{const t=e;if("JWT_EXPIRED"===t?.extensions?.code||t?.message?.includes("token has expired")||t?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] WebSocket JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),r.complete()}catch(e){console.error("[GraphQLDataProvider] Failed to refresh token for WebSocket:",e),r.error(e)}}else r.error(e)},"error"),complete:p(()=>{r.complete()},"complete")});return()=>{this._activeSubscriptionCount--,a()}})}PushStatusUpdates(e=null){e||(e=this.sessionId);const t=Date.now(),r=this._pushStatusSubjects.get(e);if(r)return r.lastRequestedAt=t,new i.c(t=>{r.activeSubscribers++;const s=r.subject.subscribe(t);return()=>{const t=this._pushStatusSubjects.get(e);t&&t.activeSubscribers>0&&t.activeSubscribers--,s.unsubscribe()}});const a=s.J1`subscription StatusUpdates($sessionId: String!) {
|
|
427
427
|
statusUpdates(sessionId: $sessionId) {
|
|
428
428
|
date
|
|
429
429
|
message
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
OriginSessionID
|
|
441
441
|
RecordData
|
|
442
442
|
}
|
|
443
|
-
}`,t=this.subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:p(e=>{const t=e?.cacheInvalidation;if(!t)return;if(t.OriginSessionID&&t.OriginSessionID===this.sessionId)return void console.debug(`[GraphQLDataProvider] Skipping self-originated cache invalidation for "${t.EntityName}" (action: ${t.Action})`);console.debug(`[GraphQLDataProvider] Cache invalidation received: ${t.Action} for "${t.EntityName}" from server ${t.SourceServerID?.substring(0,8)||"unknown"}`);const r={type:"remote-invalidate",entityName:t.EntityName,baseEntity:null,payload:{primaryKeyValues:t.PrimaryKeyValues,action:t.Action,sourceServerId:t.SourceServerID,timestamp:t.Timestamp,recordData:t.RecordData}};n.rt.Instance.RaiseEvent({event:n.UK.ComponentEvent,eventCode:a.HC.BaseEventCode,args:r,component:this})},"next"),error:p(e=>{console.error("[GraphQLDataProvider] Cache invalidation subscription error:",e),this._cacheInvalidationSubscription=null},"error"),complete:p(()=>{console.log("[GraphQLDataProvider] Cache invalidation subscription completed, will re-establish on next WebSocket creation"),this._cacheInvalidationSubscription=null},"complete")})}UnsubscribeFromCacheInvalidation(){this._cacheInvalidationSubscription&&(this._cacheInvalidationSubscription.unsubscribe(),this._cacheInvalidationSubscription=null)}async FindISAChildEntity(e,t,r){if(!e.IsParentType)return null;try{const r=await this.ExecuteGQL("query FindISAChildEntity($EntityName: String!, $RecordID: String!) {\n FindISAChildEntity(EntityName: $EntityName, RecordID: $RecordID) {\n Success\n ChildEntityName\n ErrorMessage\n }\n }",{EntityName:e.Name,RecordID:t});return r?.FindISAChildEntity?.Success&&r.FindISAChildEntity.ChildEntityName?{ChildEntityName:r.FindISAChildEntity.ChildEntityName}:null}catch(t){return(0,a.ZI)(`FindISAChildEntity failed for ${e.Name}: ${t}`),null}}async FindISAChildEntities(e,t,r){if(!e.IsParentType)return[];try{const r=await this.ExecuteGQL("query FindISAChildEntities($EntityName: String!, $RecordID: String!) {\n FindISAChildEntities(EntityName: $EntityName, RecordID: $RecordID) {\n Success\n ChildEntityNames\n ErrorMessage\n }\n }",{EntityName:e.Name,RecordID:t});return r?.FindISAChildEntities?.Success&&r.FindISAChildEntities.ChildEntityNames?r.FindISAChildEntities.ChildEntityNames.map(e=>({ChildEntityName:e})):[]}catch(t){return(0,a.ZI)(`FindISAChildEntities failed for ${e.Name}: ${t}`),[]}}}async function C(e){const t=new P;return(0,a.YE)(t),await t.Config(e),await a.jF.Instance.Startup(),n.rt.Instance.RaiseEvent({event:n.UK.LoggedIn,eventCode:null,component:this,args:null}),t}p(C,"setupGraphQLClient");class ${static{p(this,"SyncRolesAndUsersResult")}}class A{static{p(this,"RoleInput")}}class N{static{p(this,"UserInput")}}class b{static{p(this,"RolesAndUsersInput")}}var x,M=((x=M||{}).Create="Create",x.Update="Update",x.CreateOrUpdate="CreateOrUpdate",x.Delete="Delete",x.DeleteWithFilter="DeleteWithFilter",x);class F{static{p(this,"ActionItemInput")}}class T{static{p(this,"SyncDataResult")}constructor(){this.Results=[]}}class Q{static{p(this,"ActionItemOutput")}}class L{static{p(this,"GraphQLSystemUserClient")}get Client(){return this._client}constructor(e,t,r,a){const n={"x-session-id":r};this._sessionId=r,t&&(n.authorization="Bearer "+t),a&&(n["x-mj-api-key"]=a),this._client=new s.l4(e,{headers:n})}resolvePlatformSQL(e){if(null!=e)return(0,a.WV)(e)?e.default:e}async GetData(e,t){try{const r=await this.Client.request("query GetData($input: GetDataInputType!) {\n GetData(input: $input) {\n Success\n ErrorMessages\n Queries\n Results\n }\n }",{input:{Queries:e,Token:t}});return r&&r.GetData?{Success:r.GetData.Success,Results:r.GetData.Results.map(e=>e?(0,n.NG)(e):null),ErrorMessages:r.GetData.ErrorMessages,Queries:r.GetData.Queries}:{Success:!1,Results:[],ErrorMessages:r.GetData?.ErrorMessages??["Unknown error"],Queries:r.GetData?.Queries??e}}catch(t){let r=t instanceof Error?t.message:String(t);const s=r.match(/Error: ([^:]+)\./);if(s&&(r=s[1]+"."),(0,a.l9)()){const e=`GraphQLSystemUserClient::GetData - Error getting data - ${t}`;(0,a.ZI)(e)}return{Success:!1,Results:[],ErrorMessages:[r],Queries:e}}}async GetAllRemoteEntities(){try{const e=await this.Client.request("query GetAllEntities {\n GetAllEntities {\n Success\n ErrorMessage\n Results {\n ID\n Name\n Description\n SchemaName\n BaseView\n BaseTable\n CodeName\n ClassName\n Fields {\n ID\n Name\n Description\n Type\n AllowsNull\n MaxLength\n }\n }\n }\n }");return e&&e.GetAllEntities?e.GetAllEntities:{Success:!1,Results:[],ErrorMessage:e.GetAllEntities?.ErrorMessage??"Unknown error"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::GetAllRemoteEntities - Error getting remote entities - ${e}`),{Success:!1,Results:[],ErrorMessage:e}}}async SyncData(e){try{const t=await this.Client.request("mutation SyncData($items: [ActionItemInputType!]!) {\n SyncData(items: $items) {\n Success\n Results {\n Success\n ErrorMessage\n EntityName\n Type\n PrimaryKey {\n KeyValuePairs {\n FieldName\n Value \n }\n }\n AlternateKey {\n KeyValuePairs {\n FieldName\n Value \n }\n }\n DeleteFilter\n RecordJSON\n }\n }\n }",{items:e});return t&&t.SyncData?t.SyncData:{Success:!1,Results:[]}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::SyncData - Error syncing data - ${e}`),{Success:!1,Results:[]}}}async SyncRolesAndUsers(e){try{const t=await this.Client.request("mutation SyncRolesAndUsers($data: RolesAndUsersInputType!) {\n SyncRolesAndUsers(data: $data) {\n Success\n }\n }",{data:e});return t&&t.SyncRolesAndUsers?t.SyncRolesAndUsers:{Success:!1}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::SyncRolesAndUsers - Error syncing roles and users - ${e}`),{Success:!1}}}async RunViewByName(e){try{const t="query RunViewByNameSystemUser($input: RunViewByNameInput!) {\n RunViewByNameSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByNameSystemUser?s.RunViewByNameSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by name"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunViewByNameSystemUser - Error running view by name - ${e}`),{Results:[],Success:!1,ErrorMessage:e.toString()}}}async RunViewByID(e){try{const t="query RunViewByIDSystemUser($input: RunViewByIDInput!) {\n RunViewByIDSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByIDSystemUser?s.RunViewByIDSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by ID"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunViewByIDSystemUser - Error running view by ID - ${e}`),{Results:[],Success:!1,ErrorMessage:e.toString()}}}async RunDynamicView(e){try{const t="query RunDynamicViewSystemUser($input: RunDynamicViewInput!) {\n RunDynamicViewSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunDynamicViewSystemUser?s.RunDynamicViewSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute dynamic view"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunDynamicViewSystemUser - Error running dynamic view - ${e}`),{Results:[],Success:!1,ErrorMessage:e.toString()}}}async RunViews(e){try{const t="query RunViewsSystemUser($input: [RunViewGenericInput!]!) {\n RunViewsSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r=e.map(e=>({...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)})),s=await this.Client.request(t,{input:r});return s&&s.RunViewsSystemUser?s.RunViewsSystemUser:[]}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunViewsSystemUser - Error running views - ${e}`),[]}}async GetQueryData(e){try{if(void 0!==e.Parameters&&Array.isArray(e.Parameters))throw new Error("Parameters must be a JSON object, not an array. Use {} for empty parameters instead of [].");const t="query GetQueryDataSystemUser($QueryID: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {\n GetQueryDataSystemUser(QueryID: $QueryID, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {\n QueryID\n QueryName\n Success\n Results\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n AppliedParameters\n }\n }",r={QueryID:e.QueryID};void 0!==e.CategoryID&&(r.CategoryID=e.CategoryID),void 0!==e.CategoryPath&&(r.CategoryPath=e.CategoryPath),void 0!==e.Parameters&&(r.Parameters=e.Parameters),void 0!==e.MaxRows&&(r.MaxRows=e.MaxRows),void 0!==e.StartRow&&(r.StartRow=e.StartRow);const s=await this.Client.request(t,r);return s&&s.GetQueryDataSystemUser?{...s.GetQueryDataSystemUser,Results:s.GetQueryDataSystemUser.Results?(0,n.NG)(s.GetQueryDataSystemUser.Results):null}:{QueryID:e.QueryID,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return(0,a.ZI)(`GraphQLSystemUserClient::GetQueryDataSystemUser - Error executing query - ${t}`),{QueryID:e.QueryID,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:t.toString()}}}async GetQueryDataByName(e){try{if(void 0!==e.Parameters&&Array.isArray(e.Parameters))throw new Error("Parameters must be a JSON object, not an array. Use {} for empty parameters instead of [].");const t="query GetQueryDataByNameSystemUser($QueryName: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {\n GetQueryDataByNameSystemUser(QueryName: $QueryName, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {\n QueryID\n QueryName\n Success\n Results\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n AppliedParameters\n }\n }",r={QueryName:e.QueryName};void 0!==e.CategoryID&&(r.CategoryID=e.CategoryID),void 0!==e.CategoryPath&&(r.CategoryPath=e.CategoryPath),void 0!==e.Parameters&&(r.Parameters=e.Parameters),void 0!==e.MaxRows&&(r.MaxRows=e.MaxRows),void 0!==e.StartRow&&(r.StartRow=e.StartRow);const s=await this.Client.request(t,r);return s&&s.GetQueryDataByNameSystemUser?{...s.GetQueryDataByNameSystemUser,Results:s.GetQueryDataByNameSystemUser.Results?(0,n.NG)(s.GetQueryDataByNameSystemUser.Results):null}:{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return(0,a.ZI)(`GraphQLSystemUserClient::GetQueryDataByNameSystemUser - Error executing query - ${t}`),{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:t.toString()}}}async CreateQuery(e){try{const t=await this.Client.request("mutation CreateQuerySystemUser($input: CreateQuerySystemUserInput!) {\n CreateQuerySystemUser(input: $input) {\n Success\n ErrorMessage\n ID\n Name\n Description\n CategoryID\n Category\n SQL\n Status\n QualityRank\n EmbeddingVector\n EmbeddingModelID\n EmbeddingModelName\n TechnicalDescription\n Fields {\n ID\n QueryID\n Name\n Description\n Sequence\n SQLBaseType\n SQLFullType\n SourceEntityID\n SourceEntity\n SourceFieldName\n IsComputed\n ComputationDescription\n IsSummary\n SummaryDescription\n }\n Parameters {\n ID\n QueryID\n Name\n Description\n Type\n IsRequired\n DefaultValue\n SampleValue\n ValidationFilters\n }\n Entities {\n ID\n QueryID\n EntityID\n Entity\n }\n Permissions {\n ID\n QueryID\n RoleID\n Role\n }\n }\n }",{input:e});return t&&t.CreateQuerySystemUser?t.CreateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to create query"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::CreateQuery - Error creating query - ${e}`),{Success:!1,ErrorMessage:e.toString()}}}async UpdateQuery(e){try{const t=await this.Client.request("mutation UpdateQuerySystemUser($input: UpdateQuerySystemUserInput!) {\n UpdateQuerySystemUser(input: $input) {\n Success\n ErrorMessage\n ID\n Name\n Description\n CategoryID\n Category\n SQL\n Status\n QualityRank\n EmbeddingVector\n EmbeddingModelID\n EmbeddingModelName\n TechnicalDescription\n Fields {\n ID\n QueryID\n Name\n Description\n Sequence\n SQLBaseType\n SQLFullType\n SourceEntityID\n SourceEntity\n SourceFieldName\n IsComputed\n ComputationDescription\n IsSummary\n SummaryDescription\n }\n Parameters {\n ID\n QueryID\n Name\n Description\n Type\n IsRequired\n DefaultValue\n SampleValue\n ValidationFilters\n }\n Entities {\n ID\n QueryID\n EntityID\n Entity\n }\n Permissions {\n ID\n QueryID\n RoleID\n Role\n }\n }\n }",{input:e});return t&&t.UpdateQuerySystemUser?t.UpdateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to update query"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::UpdateQuery - Error updating query - ${e}`),{Success:!1,ErrorMessage:e.toString()}}}async DeleteQuery(e,t){try{if(!e||""===e.trim())return(0,a.ZI)("GraphQLSystemUserClient::DeleteQuery - Invalid query ID: ID cannot be null or empty"),{Success:!1,ErrorMessage:"Invalid query ID: ID cannot be null or empty"};const r="mutation DeleteQuerySystemResolver($ID: String!, $options: DeleteOptionsInput) {\n DeleteQuerySystemResolver(ID: $ID, options: $options) {\n Success\n ErrorMessage\n ID\n Name\n }\n }",s={ID:e};void 0!==t&&(s.options={SkipEntityAIActions:t.SkipEntityAIActions??!1,SkipEntityActions:t.SkipEntityActions??!1,ReplayOnly:t.ReplayOnly??!1,IsParentEntityDelete:t.IsParentEntityDelete??!1});const n=await this.Client.request(r,s);return n&&n.DeleteQuerySystemResolver?n.DeleteQuerySystemResolver:{Success:!1,ErrorMessage:"Failed to delete query"}}catch(e){let t="";if(e instanceof Error){if(t=e.message,"cause"in e&&e.cause){const r=e.cause;t+=` | Cause: ${r.message||r}`,"code"in r&&(t+=` | Code: ${r.code}`)}if("response"in e){const r=e.response;r?.status&&(t+=` | HTTP Status: ${r.status}`),r?.errors&&(t+=` | GraphQL Errors: ${JSON.stringify(r.errors)}`)}e.stack&&console.error("DeleteQuery stack trace:",e.stack)}else t=String(e);return(0,a.ZI)(`GraphQLSystemUserClient::DeleteQuery - Error deleting query - ${t}`),{Success:!1,ErrorMessage:t}}}async RunAIPrompt(e){try{const t=s.J1`
|
|
443
|
+
}`,t=this.subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:p(e=>{const t=e?.cacheInvalidation;if(!t)return;if(t.OriginSessionID&&t.OriginSessionID===this.sessionId)return void console.debug(`[GraphQLDataProvider] Skipping self-originated cache invalidation for "${t.EntityName}" (action: ${t.Action})`);console.debug(`[GraphQLDataProvider] Cache invalidation received: ${t.Action} for "${t.EntityName}" from server ${t.SourceServerID?.substring(0,8)||"unknown"}`);const r={type:"remote-invalidate",entityName:t.EntityName,baseEntity:null,payload:{primaryKeyValues:t.PrimaryKeyValues,action:t.Action,sourceServerId:t.SourceServerID,timestamp:t.Timestamp,recordData:t.RecordData}};n.rt.Instance.RaiseEvent({event:n.UK.ComponentEvent,eventCode:a.HC.BaseEventCode,args:r,component:this})},"next"),error:p(e=>{console.error("[GraphQLDataProvider] Cache invalidation subscription error:",e),this._cacheInvalidationSubscription=null},"error"),complete:p(()=>{console.log("[GraphQLDataProvider] Cache invalidation subscription completed, will re-establish on next WebSocket creation"),this._cacheInvalidationSubscription=null},"complete")})}UnsubscribeFromCacheInvalidation(){this._cacheInvalidationSubscription&&(this._cacheInvalidationSubscription.unsubscribe(),this._cacheInvalidationSubscription=null)}async FindISAChildEntity(e,t,r){if(!e.IsParentType)return null;try{const r=await this.ExecuteGQL("query FindISAChildEntity($EntityName: String!, $RecordID: String!) {\n FindISAChildEntity(EntityName: $EntityName, RecordID: $RecordID) {\n Success\n ChildEntityName\n ErrorMessage\n }\n }",{EntityName:e.Name,RecordID:t});return r?.FindISAChildEntity?.Success&&r.FindISAChildEntity.ChildEntityName?{ChildEntityName:r.FindISAChildEntity.ChildEntityName}:null}catch(t){return(0,a.ZI)(`FindISAChildEntity failed for ${e.Name}: ${t}`),null}}async FindISAChildEntities(e,t,r){if(!e.IsParentType)return[];try{const r=await this.ExecuteGQL("query FindISAChildEntities($EntityName: String!, $RecordID: String!) {\n FindISAChildEntities(EntityName: $EntityName, RecordID: $RecordID) {\n Success\n ChildEntityNames\n ErrorMessage\n }\n }",{EntityName:e.Name,RecordID:t});return r?.FindISAChildEntities?.Success&&r.FindISAChildEntities.ChildEntityNames?r.FindISAChildEntities.ChildEntityNames.map(e=>({ChildEntityName:e})):[]}catch(t){return(0,a.ZI)(`FindISAChildEntities failed for ${e.Name}: ${t}`),[]}}}async function P(e){const t=new C;return(0,a.YE)(t),await t.Config(e),await a.jF.Instance.Startup(),n.rt.Instance.RaiseEvent({event:n.UK.LoggedIn,eventCode:null,component:this,args:null}),t}p(P,"setupGraphQLClient");class ${static{p(this,"SyncRolesAndUsersResult")}}class A{static{p(this,"RoleInput")}}class N{static{p(this,"UserInput")}}class b{static{p(this,"RolesAndUsersInput")}}var x,Q=((x=Q||{}).Create="Create",x.Update="Update",x.CreateOrUpdate="CreateOrUpdate",x.Delete="Delete",x.DeleteWithFilter="DeleteWithFilter",x);class M{static{p(this,"ActionItemInput")}}class T{static{p(this,"SyncDataResult")}constructor(){this.Results=[]}}class F{static{p(this,"ActionItemOutput")}}class L{static{p(this,"GraphQLSystemUserClient")}get Client(){return this._client}constructor(e,t,r,a){const n={"x-session-id":r};this._sessionId=r,t&&(n.authorization="Bearer "+t),a&&(n["x-mj-api-key"]=a),this._client=new s.l4(e,{headers:n})}resolvePlatformSQL(e){if(null!=e)return(0,a.WV)(e)?e.default:e}async GetData(e,t){try{const r=await this.Client.request("query GetData($input: GetDataInputType!) {\n GetData(input: $input) {\n Success\n ErrorMessages\n Queries\n Results\n }\n }",{input:{Queries:e,Token:t}});return r&&r.GetData?{Success:r.GetData.Success,Results:r.GetData.Results.map(e=>e?(0,n.NG)(e):null),ErrorMessages:r.GetData.ErrorMessages,Queries:r.GetData.Queries}:{Success:!1,Results:[],ErrorMessages:r.GetData?.ErrorMessages??["Unknown error"],Queries:r.GetData?.Queries??e}}catch(t){let r=t instanceof Error?t.message:String(t);const s=r.match(/Error: ([^:]+)\./);if(s&&(r=s[1]+"."),(0,a.l9)()){const e=`GraphQLSystemUserClient::GetData - Error getting data - ${t}`;(0,a.ZI)(e)}return{Success:!1,Results:[],ErrorMessages:[r],Queries:e}}}async GetAllRemoteEntities(){try{const e=await this.Client.request("query GetAllEntities {\n GetAllEntities {\n Success\n ErrorMessage\n Results {\n ID\n Name\n Description\n SchemaName\n BaseView\n BaseTable\n CodeName\n ClassName\n Fields {\n ID\n Name\n Description\n Type\n AllowsNull\n MaxLength\n }\n }\n }\n }");return e&&e.GetAllEntities?e.GetAllEntities:{Success:!1,Results:[],ErrorMessage:e.GetAllEntities?.ErrorMessage??"Unknown error"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::GetAllRemoteEntities - Error getting remote entities - ${e}`),{Success:!1,Results:[],ErrorMessage:e}}}async SyncData(e){try{const t=await this.Client.request("mutation SyncData($items: [ActionItemInputType!]!) {\n SyncData(items: $items) {\n Success\n Results {\n Success\n ErrorMessage\n EntityName\n Type\n PrimaryKey {\n KeyValuePairs {\n FieldName\n Value \n }\n }\n AlternateKey {\n KeyValuePairs {\n FieldName\n Value \n }\n }\n DeleteFilter\n RecordJSON\n }\n }\n }",{items:e});return t&&t.SyncData?t.SyncData:{Success:!1,Results:[]}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::SyncData - Error syncing data - ${e}`),{Success:!1,Results:[]}}}async SyncRolesAndUsers(e){try{const t=await this.Client.request("mutation SyncRolesAndUsers($data: RolesAndUsersInputType!) {\n SyncRolesAndUsers(data: $data) {\n Success\n }\n }",{data:e});return t&&t.SyncRolesAndUsers?t.SyncRolesAndUsers:{Success:!1}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::SyncRolesAndUsers - Error syncing roles and users - ${e}`),{Success:!1}}}async RunViewByName(e){try{const t="query RunViewByNameSystemUser($input: RunViewByNameInput!) {\n RunViewByNameSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByNameSystemUser?s.RunViewByNameSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by name"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunViewByNameSystemUser - Error running view by name - ${e}`),{Results:[],Success:!1,ErrorMessage:e.toString()}}}async RunViewByID(e){try{const t="query RunViewByIDSystemUser($input: RunViewByIDInput!) {\n RunViewByIDSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByIDSystemUser?s.RunViewByIDSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by ID"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunViewByIDSystemUser - Error running view by ID - ${e}`),{Results:[],Success:!1,ErrorMessage:e.toString()}}}async RunDynamicView(e){try{const t="query RunDynamicViewSystemUser($input: RunDynamicViewInput!) {\n RunDynamicViewSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunDynamicViewSystemUser?s.RunDynamicViewSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute dynamic view"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunDynamicViewSystemUser - Error running dynamic view - ${e}`),{Results:[],Success:!1,ErrorMessage:e.toString()}}}async RunViews(e){try{const t="query RunViewsSystemUser($input: [RunViewGenericInput!]!) {\n RunViewsSystemUser(input: $input) {\n Results {\n PrimaryKey {\n FieldName\n Value\n }\n EntityID\n Data\n }\n UserViewRunID\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n Success\n }\n }",r=e.map(e=>({...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)})),s=await this.Client.request(t,{input:r});return s&&s.RunViewsSystemUser?s.RunViewsSystemUser:[]}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunViewsSystemUser - Error running views - ${e}`),[]}}async GetQueryData(e){try{if(void 0!==e.Parameters&&Array.isArray(e.Parameters))throw new Error("Parameters must be a JSON object, not an array. Use {} for empty parameters instead of [].");const t="query GetQueryDataSystemUser($QueryID: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {\n GetQueryDataSystemUser(QueryID: $QueryID, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {\n QueryID\n QueryName\n Success\n Results\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n AppliedParameters\n }\n }",r={QueryID:e.QueryID};void 0!==e.CategoryID&&(r.CategoryID=e.CategoryID),void 0!==e.CategoryPath&&(r.CategoryPath=e.CategoryPath),void 0!==e.Parameters&&(r.Parameters=e.Parameters),void 0!==e.MaxRows&&(r.MaxRows=e.MaxRows),void 0!==e.StartRow&&(r.StartRow=e.StartRow);const s=await this.Client.request(t,r);return s&&s.GetQueryDataSystemUser?{...s.GetQueryDataSystemUser,Results:s.GetQueryDataSystemUser.Results?(0,n.NG)(s.GetQueryDataSystemUser.Results):null}:{QueryID:e.QueryID,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return(0,a.ZI)(`GraphQLSystemUserClient::GetQueryDataSystemUser - Error executing query - ${t}`),{QueryID:e.QueryID,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:t.toString()}}}async GetQueryDataByName(e){try{if(void 0!==e.Parameters&&Array.isArray(e.Parameters))throw new Error("Parameters must be a JSON object, not an array. Use {} for empty parameters instead of [].");const t="query GetQueryDataByNameSystemUser($QueryName: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {\n GetQueryDataByNameSystemUser(QueryName: $QueryName, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {\n QueryID\n QueryName\n Success\n Results\n RowCount\n TotalRowCount\n ExecutionTime\n ErrorMessage\n AppliedParameters\n }\n }",r={QueryName:e.QueryName};void 0!==e.CategoryID&&(r.CategoryID=e.CategoryID),void 0!==e.CategoryPath&&(r.CategoryPath=e.CategoryPath),void 0!==e.Parameters&&(r.Parameters=e.Parameters),void 0!==e.MaxRows&&(r.MaxRows=e.MaxRows),void 0!==e.StartRow&&(r.StartRow=e.StartRow);const s=await this.Client.request(t,r);return s&&s.GetQueryDataByNameSystemUser?{...s.GetQueryDataByNameSystemUser,Results:s.GetQueryDataByNameSystemUser.Results?(0,n.NG)(s.GetQueryDataByNameSystemUser.Results):null}:{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return(0,a.ZI)(`GraphQLSystemUserClient::GetQueryDataByNameSystemUser - Error executing query - ${t}`),{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:t.toString()}}}async CreateQuery(e){try{const t=await this.Client.request("mutation CreateQuerySystemUser($input: CreateQuerySystemUserInput!) {\n CreateQuerySystemUser(input: $input) {\n Success\n ErrorMessage\n Query {\n ID\n Name\n Description\n CategoryID\n Category\n SQL\n Status\n QualityRank\n EmbeddingVector\n EmbeddingModelID\n EmbeddingModel\n TechnicalDescription\n Reusable\n MJQueryFields_QueryIDArray {\n ID\n QueryID\n Name\n Description\n Sequence\n SQLBaseType\n SQLFullType\n SourceEntityID\n SourceEntity\n SourceFieldName\n IsComputed\n ComputationDescription\n IsSummary\n SummaryDescription\n }\n MJQueryParameters_QueryIDArray {\n ID\n QueryID\n Name\n Description\n Type\n IsRequired\n DefaultValue\n SampleValue\n ValidationFilters\n }\n MJQueryEntities_QueryIDArray {\n ID\n QueryID\n EntityID\n Entity\n }\n MJQueryPermissions_QueryIDArray {\n ID\n QueryID\n RoleID\n Role\n }\n }\n }\n }",{input:e});return t&&t.CreateQuerySystemUser?t.CreateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to create query"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::CreateQuery - Error creating query - ${e}`),{Success:!1,ErrorMessage:e.toString()}}}async UpdateQuery(e){try{const t=await this.Client.request("mutation UpdateQuerySystemUser($input: UpdateQuerySystemUserInput!) {\n UpdateQuerySystemUser(input: $input) {\n Success\n ErrorMessage\n Query {\n ID\n Name\n Description\n CategoryID\n Category\n SQL\n Status\n QualityRank\n EmbeddingVector\n EmbeddingModelID\n EmbeddingModel\n TechnicalDescription\n Reusable\n MJQueryFields_QueryIDArray {\n ID\n QueryID\n Name\n Description\n Sequence\n SQLBaseType\n SQLFullType\n SourceEntityID\n SourceEntity\n SourceFieldName\n IsComputed\n ComputationDescription\n IsSummary\n SummaryDescription\n }\n MJQueryParameters_QueryIDArray {\n ID\n QueryID\n Name\n Description\n Type\n IsRequired\n DefaultValue\n SampleValue\n ValidationFilters\n }\n MJQueryEntities_QueryIDArray {\n ID\n QueryID\n EntityID\n Entity\n }\n MJQueryPermissions_QueryIDArray {\n ID\n QueryID\n RoleID\n Role\n }\n }\n }\n }",{input:e});return t&&t.UpdateQuerySystemUser?t.UpdateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to update query"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::UpdateQuery - Error updating query - ${e}`),{Success:!1,ErrorMessage:e.toString()}}}async DeleteQuery(e,t){try{if(!e||""===e.trim())return(0,a.ZI)("GraphQLSystemUserClient::DeleteQuery - Invalid query ID: ID cannot be null or empty"),{Success:!1,ErrorMessage:"Invalid query ID: ID cannot be null or empty"};const r="mutation DeleteQuerySystemResolver($ID: String!, $options: DeleteOptionsInput) {\n DeleteQuerySystemResolver(ID: $ID, options: $options) {\n Success\n ErrorMessage\n ID\n Name\n }\n }",s={ID:e};void 0!==t&&(s.options={SkipEntityAIActions:t.SkipEntityAIActions??!1,SkipEntityActions:t.SkipEntityActions??!1,ReplayOnly:t.ReplayOnly??!1,IsParentEntityDelete:t.IsParentEntityDelete??!1});const n=await this.Client.request(r,s);return n&&n.DeleteQuerySystemResolver?n.DeleteQuerySystemResolver:{Success:!1,ErrorMessage:"Failed to delete query"}}catch(e){let t="";if(e instanceof Error){if(t=e.message,"cause"in e&&e.cause){const r=e.cause;t+=` | Cause: ${r.message||r}`,"code"in r&&(t+=` | Code: ${r.code}`)}if("response"in e){const r=e.response;r?.status&&(t+=` | HTTP Status: ${r.status}`),r?.errors&&(t+=` | GraphQL Errors: ${JSON.stringify(r.errors)}`)}e.stack&&console.error("DeleteQuery stack trace:",e.stack)}else t=String(e);return(0,a.ZI)(`GraphQLSystemUserClient::DeleteQuery - Error deleting query - ${t}`),{Success:!1,ErrorMessage:t}}}async RunAIPrompt(e){try{const t=s.J1`
|
|
444
444
|
query RunAIPromptSystemUser(
|
|
445
445
|
$promptId: String!,
|
|
446
446
|
$data: String,
|
|
@@ -526,7 +526,7 @@
|
|
|
526
526
|
result
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
`,r=this.prepareAgentVariables(e),a=await this.Client.request(t,r);return a&&a.RunAIAgentSystemUser?this.processAgentResult(a.RunAIAgentSystemUser.result):{success:!1,agentRun:void 0}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunAIAgent - Error running AI agent - ${e}`),{success:!1,agentRun:void 0}}}preparePromptVariables(e){const t={promptId:e.promptId};return void 0!==e.data&&(t.data="object"==typeof e.data?JSON.stringify(e.data):e.data),void 0!==e.templateData&&(t.templateData="object"==typeof e.templateData?JSON.stringify(e.templateData):e.templateData),void 0!==e.messages&&(t.messages=JSON.stringify(e.messages)),void 0!==e.overrideModelId&&(t.overrideModelId=e.overrideModelId),void 0!==e.overrideVendorId&&(t.overrideVendorId=e.overrideVendorId),void 0!==e.configurationId&&(t.configurationId=e.configurationId),void 0!==e.skipValidation&&(t.skipValidation=e.skipValidation),void 0!==e.responseFormat&&(t.responseFormat=e.responseFormat),void 0!==e.temperature&&(t.temperature=e.temperature),void 0!==e.topP&&(t.topP=e.topP),void 0!==e.topK&&(t.topK=e.topK),void 0!==e.minP&&(t.minP=e.minP),void 0!==e.frequencyPenalty&&(t.frequencyPenalty=e.frequencyPenalty),void 0!==e.presencePenalty&&(t.presencePenalty=e.presencePenalty),void 0!==e.seed&&(t.seed=e.seed),void 0!==e.stopSequences&&(t.stopSequences=e.stopSequences),void 0!==e.includeLogProbs&&(t.includeLogProbs=e.includeLogProbs),void 0!==e.topLogProbs&&(t.topLogProbs=e.topLogProbs),void 0!==e.rerunFromPromptRunID&&(t.rerunFromPromptRunID=e.rerunFromPromptRunID),void 0!==e.systemPromptOverride&&(t.systemPromptOverride=e.systemPromptOverride),t}prepareAgentVariables(e){const t={agentId:e.agent.ID,messages:JSON.stringify(e.conversationMessages),sessionId:this._sessionId};return void 0!==e.data&&(t.data="object"==typeof e.data?JSON.stringify(e.data):e.data),void 0!==e.lastRunId&&(t.lastRunId=e.lastRunId),void 0!==e.autoPopulateLastRunPayload&&(t.autoPopulateLastRunPayload=e.autoPopulateLastRunPayload),void 0!==e.configurationId&&(t.configurationId=e.configurationId),t}processPromptResult(e){let t,r,s;try{e.parsedResult&&(t=JSON.parse(e.parsedResult))}catch{t=e.parsedResult}try{e.validationResult&&(r=JSON.parse(e.validationResult))}catch{r=e.validationResult}try{e.chatResult&&(s=JSON.parse(e.chatResult))}catch{s=e.chatResult}return{success:e.success,output:e.output,parsedResult:t,error:e.error,executionTimeMs:e.executionTimeMs,tokensUsed:e.tokensUsed,promptRunId:e.promptRunId,rawResult:e.rawResult,validationResult:r,chatResult:s}}processAgentResult(e){return(0,n.NG)(e)}async ExecuteSimplePrompt(e){try{const t=s.J1`
|
|
529
|
+
`,r=this.prepareAgentVariables(e),a=await this.Client.request(t,r);return a&&a.RunAIAgentSystemUser?this.processAgentResult(a.RunAIAgentSystemUser.result):{success:!1,agentRun:void 0}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::RunAIAgent - Error running AI agent - ${e}`),{success:!1,agentRun:void 0}}}preparePromptVariables(e){const t={promptId:e.promptId};return void 0!==e.data&&(t.data="object"==typeof e.data?JSON.stringify(e.data):e.data),void 0!==e.templateData&&(t.templateData="object"==typeof e.templateData?JSON.stringify(e.templateData):e.templateData),void 0!==e.messages&&(t.messages=JSON.stringify(e.messages)),void 0!==e.overrideModelId&&(t.overrideModelId=e.overrideModelId),void 0!==e.overrideVendorId&&(t.overrideVendorId=e.overrideVendorId),void 0!==e.configurationId&&(t.configurationId=e.configurationId),void 0!==e.skipValidation&&(t.skipValidation=e.skipValidation),void 0!==e.responseFormat&&(t.responseFormat=e.responseFormat),void 0!==e.temperature&&(t.temperature=e.temperature),void 0!==e.topP&&(t.topP=e.topP),void 0!==e.topK&&(t.topK=e.topK),void 0!==e.minP&&(t.minP=e.minP),void 0!==e.frequencyPenalty&&(t.frequencyPenalty=e.frequencyPenalty),void 0!==e.presencePenalty&&(t.presencePenalty=e.presencePenalty),void 0!==e.seed&&(t.seed=e.seed),void 0!==e.stopSequences&&(t.stopSequences=e.stopSequences),void 0!==e.includeLogProbs&&(t.includeLogProbs=e.includeLogProbs),void 0!==e.topLogProbs&&(t.topLogProbs=e.topLogProbs),void 0!==e.rerunFromPromptRunID&&(t.rerunFromPromptRunID=e.rerunFromPromptRunID),void 0!==e.systemPromptOverride&&(t.systemPromptOverride=e.systemPromptOverride),t}prepareAgentVariables(e){const t={agentId:e.agent.ID,messages:JSON.stringify(e.conversationMessages),sessionId:this._sessionId};return void 0!==e.data&&(t.data="object"==typeof e.data?JSON.stringify(e.data):e.data),void 0!==e.lastRunId&&(t.lastRunId=e.lastRunId),void 0!==e.autoPopulateLastRunPayload&&(t.autoPopulateLastRunPayload=e.autoPopulateLastRunPayload),void 0!==e.configurationId&&(t.configurationId=e.configurationId),t}processPromptResult(e){let t,r,s;try{e.parsedResult&&(t=JSON.parse(e.parsedResult))}catch{t=e.parsedResult}try{e.validationResult&&(r=JSON.parse(e.validationResult))}catch{r=e.validationResult}try{e.chatResult&&(s=JSON.parse(e.chatResult))}catch{s=e.chatResult}return{success:e.success,output:e.output,parsedResult:t,error:e.error,executionTimeMs:e.executionTimeMs,tokensUsed:e.tokensUsed,promptRunId:e.promptRunId,rawResult:e.rawResult,validationResult:r,chatResult:s}}processAgentResult(e){return(0,n.NG)(e)}async TestQuerySQL(e){try{const t=await this.Client.request("query TestQuerySQL($input: TestQuerySQLInput!) {\n TestQuerySQL(input: $input) {\n Success\n Results\n RowCount\n ExecutionTime\n ErrorMessage\n AppliedParameters\n }\n }",{input:e});return t&&t.TestQuerySQL?{Success:t.TestQuerySQL.Success,Results:t.TestQuerySQL.Results?(0,n.NG)(t.TestQuerySQL.Results):null,RowCount:t.TestQuerySQL.RowCount,ExecutionTime:t.TestQuerySQL.ExecutionTime,ErrorMessage:t.TestQuerySQL.ErrorMessage,AppliedParameters:t.TestQuerySQL.AppliedParameters?(0,n.NG)(t.TestQuerySQL.AppliedParameters):void 0}:{Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:"TestQuerySQL execution failed"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::TestQuerySQL - Error testing query SQL - ${e}`),{Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:e instanceof Error?e.message:String(e)}}}async ExecuteSimplePrompt(e){try{const t=s.J1`
|
|
530
530
|
query ExecuteSimplePromptSystemUser(
|
|
531
531
|
$systemPrompt: String!,
|
|
532
532
|
$messages: String,
|
|
@@ -564,7 +564,7 @@
|
|
|
564
564
|
error
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
|
-
`,r={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},a=await this.Client.request(t,r);if(!a?.EmbedTextSystemUser)return{embeddings:(Array.isArray(e.textToEmbed),[]),modelName:"Unknown",vectorDimensions:0,error:"Failed to generate embeddings as system user"};const n=a.EmbedTextSystemUser;return{embeddings:Array.isArray(e.textToEmbed)?n.embeddings:n.embeddings[0],modelName:n.modelName,vectorDimensions:n.vectorDimensions,error:n.error}}catch(t){return(0,a.ZI)(`GraphQLSystemUserClient::EmbedText - Error generating embeddings - ${t}`),{embeddings:(Array.isArray(e.textToEmbed),[]),modelName:"Unknown",vectorDimensions:0,error:t.toString()}}}}class G{static{p(this,"GetDataOutput")}}class V{static{p(this,"SimpleRemoteEntityOutput")}}class
|
|
567
|
+
`,r={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},a=await this.Client.request(t,r);if(!a?.EmbedTextSystemUser)return{embeddings:(Array.isArray(e.textToEmbed),[]),modelName:"Unknown",vectorDimensions:0,error:"Failed to generate embeddings as system user"};const n=a.EmbedTextSystemUser;return{embeddings:Array.isArray(e.textToEmbed)?n.embeddings:n.embeddings[0],modelName:n.modelName,vectorDimensions:n.vectorDimensions,error:n.error}}catch(t){return(0,a.ZI)(`GraphQLSystemUserClient::EmbedText - Error generating embeddings - ${t}`),{embeddings:(Array.isArray(e.textToEmbed),[]),modelName:"Unknown",vectorDimensions:0,error:t.toString()}}}}class G{static{p(this,"GetDataOutput")}}class V{static{p(this,"SimpleRemoteEntityOutput")}}class _{static{p(this,"SimpleRemoteEntity")}}class U{static{p(this,"SimpleRemoteEntityField")}}class O{static{p(this,"GraphQLActionClient")}constructor(e){this._dataProvider=e}async RunAction(e,t,r=!1){try{const s=this.serializeActionParameters(t),a=this.createActionVariables(e,s,r),n=await this.executeActionMutation(a);return this.processActionResult(n,t)}catch(e){return this.handleActionError(e,t)}}serializeActionParameters(e){if(e)return e.map(e=>{let t=e.Value;return null!=t&&"object"==typeof t&&(t=JSON.stringify(t)),{...e,Value:t}})}createActionVariables(e,t,r=!1){return{input:{ActionID:e,Params:t,SkipActionLog:r}}}async executeActionMutation(e){const t=s.J1`
|
|
568
568
|
mutation RunAction($input: RunActionInput!) {
|
|
569
569
|
RunAction(input: $input) {
|
|
570
570
|
Success
|