@memberjunction/react-runtime 4.4.0 → 5.1.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 +28 -17
- package/CHANGELOG.md +28 -0
- package/dist/324.runtime.umd.js +17 -17
- package/dist/compiler/component-compiler.js.map +1 -1
- package/dist/component-manager/component-manager.js.map +1 -1
- package/dist/component-manager/types.d.ts +2 -2
- package/dist/component-manager/types.d.ts.map +1 -1
- package/dist/component-manager/types.js.map +1 -1
- package/dist/registry/component-registry-service.js.map +1 -1
- package/dist/runtime/component-hierarchy.d.ts +3 -3
- package/dist/runtime/component-hierarchy.d.ts.map +1 -1
- package/dist/runtime/component-hierarchy.js.map +1 -1
- package/dist/runtime.umd.js +1 -1
- package/dist/types/dependency-types.d.ts +3 -3
- package/dist/types/dependency-types.d.ts.map +1 -1
- package/dist/types/dependency-types.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/library-dependency-resolver.d.ts +7 -7
- package/dist/utilities/library-dependency-resolver.d.ts.map +1 -1
- package/dist/utilities/library-dependency-resolver.js.map +1 -1
- package/dist/utilities/library-loader.d.ts +3 -3
- package/dist/utilities/library-loader.d.ts.map +1 -1
- package/dist/utilities/library-loader.js.map +1 -1
- package/dist/utilities/library-registry.d.ts +2 -2
- package/dist/utilities/library-registry.d.ts.map +1 -1
- package/dist/utilities/library-registry.js.map +1 -1
- package/package.json +6 -6
- package/src/compiler/component-compiler.ts +2 -2
- package/src/component-manager/component-manager.ts +1 -1
- package/src/component-manager/types.ts +2 -2
- package/src/registry/component-registry-service.ts +10 -10
- package/src/runtime/component-hierarchy.ts +3 -3
- package/src/types/dependency-types.ts +3 -3
- package/src/types/index.ts +2 -2
- package/src/utilities/library-dependency-resolver.ts +11 -11
- package/src/utilities/library-loader.ts +3 -3
- package/src/utilities/library-registry.ts +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
|
|
2
|
-
> @memberjunction/react-runtime@
|
|
2
|
+
> @memberjunction/react-runtime@5.1.0 build
|
|
3
3
|
> npm run build:node && npm run build:umd
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @memberjunction/react-runtime@
|
|
6
|
+
> @memberjunction/react-runtime@5.1.0 build:node
|
|
7
7
|
> tsc
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @memberjunction/react-runtime@
|
|
10
|
+
> @memberjunction/react-runtime@5.1.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.22 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 113 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.44 MiB [1m[33m[orphan][39m[22m 486 modules
|
|
18
18
|
runtime modules 6.94 KiB 10 modules
|
|
19
|
-
|
|
20
|
-
modules by path [1m../../../node_modules/[39m[22m 780 KiB
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
+ 7 modules
|
|
24
|
-
modules by path [1m../../MJCoreEntities/dist/[39m[22m 3.09 MiB
|
|
25
|
-
[1m../../MJCoreEntities/dist/index.js + 22 modules[39m[22m 3.07 MiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
19
|
+
built modules 5.55 MiB [1m[33m[built][39m[22m
|
|
20
|
+
modules by path [1m../../../node_modules/[39m[22m 780 KiB 23 modules
|
|
21
|
+
modules by path [1m../../MJCoreEntities/dist/[39m[22m 3.13 MiB
|
|
22
|
+
[1m../../MJCoreEntities/dist/index.js + 22 modules[39m[22m 3.11 MiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
26
23
|
[1m../../MJCoreEntities/dist/engines/UserViewEngine.js[39m[22m 18.7 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
24
|
+
modules by path [1m../../MJGlobal/dist/[39m[22m 188 KiB
|
|
25
|
+
[1m../../MJGlobal/dist/index.js + 16 modules[39m[22m 188 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
26
|
+
[1m../../MJGlobal/dist/ lazy strict namespace object[39m[22m 160 bytes [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
27
27
|
[1m./dist/index.js + 27 modules[39m[22m 420 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
28
|
-
[1m../../MJCore/dist/index.js + 71 modules[39m[22m
|
|
29
|
-
[1m../../GraphQLDataProvider/dist/index.mjs[39m[22m
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
[1m../../MJCore/dist/index.js + 71 modules[39m[22m 983 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
29
|
+
[1m../../GraphQLDataProvider/dist/index.mjs[39m[22m 113 KiB [1m[33m[built][39m[22m [1m[33m[code generated][39m[22m
|
|
30
|
+
|
|
31
|
+
[1m[33mWARNING[39m[22m in [1m../../MJGlobal/dist/DynamicPackageLoader.js[39m[22m [1m[32m80:21-44[39m[22m
|
|
32
|
+
[1mCritical dependency: the request of a dependency is an expression[39m[22m
|
|
33
|
+
@ ../../MJGlobal/dist/index.js 21:0-42 21:0-42
|
|
34
|
+
@ ../../GraphQLDataProvider/dist/index.mjs
|
|
35
|
+
@ ./dist/registry/component-registry-service.js 75:21-67
|
|
36
|
+
@ ./dist/registry/index.js 3:0-72 3:0-72
|
|
37
|
+
@ ./dist/index.js 8:0-47 63:21-38 9:0-47 64:21-38 14:0-47 14:0-47 15:0-88 15:0-88 15:0-88 15:0-88
|
|
38
|
+
|
|
39
|
+
1 warning has detailed information that is not shown.
|
|
40
|
+
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
|
|
41
|
+
|
|
42
|
+
webpack 5.105.0 compiled with [1m[33m1 warning[39m[22m in 124434 ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @memberjunction/react-runtime
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [61079e9]
|
|
8
|
+
- @memberjunction/global@5.1.0
|
|
9
|
+
- @memberjunction/graphql-dataprovider@5.1.0
|
|
10
|
+
- @memberjunction/core@5.1.0
|
|
11
|
+
- @memberjunction/core-entities@5.1.0
|
|
12
|
+
- @memberjunction/interactive-component-types@5.1.0
|
|
13
|
+
|
|
14
|
+
## 5.0.0
|
|
15
|
+
|
|
16
|
+
### Major Changes
|
|
17
|
+
|
|
18
|
+
- 4aa1b54: breaking changes due to class name updates/approach
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [737b56b]
|
|
23
|
+
- Updated dependencies [a3e7cb6]
|
|
24
|
+
- Updated dependencies [4aa1b54]
|
|
25
|
+
- @memberjunction/graphql-dataprovider@5.0.0
|
|
26
|
+
- @memberjunction/interactive-component-types@5.0.0
|
|
27
|
+
- @memberjunction/core@5.0.0
|
|
28
|
+
- @memberjunction/core-entities@5.0.0
|
|
29
|
+
- @memberjunction/global@5.0.0
|
|
30
|
+
|
|
3
31
|
## 4.4.0
|
|
4
32
|
|
|
5
33
|
### 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:()=>M,ActionItemOutput:()=>
|
|
1
|
+
"use strict";(this.webpackChunkMJReactRuntime=this.webpackChunkMJReactRuntime||[]).push([[324],{324(e,t,r){r.r(t),r.d(t,{ActionItemInput:()=>M,ActionItemOutput:()=>Q,BrowserIndexedDBStorageProvider:()=>E,BrowserStorageProviderBase:()=>R,FieldMapper:()=>g,GetDataOutput:()=>T,GraphQLAIClient:()=>I,GraphQLActionClient:()=>_,GraphQLComponentRegistryClient:()=>k,GraphQLDataProvider:()=>f,GraphQLEncryptionClient:()=>O,GraphQLFileStorageClient:()=>j,GraphQLProviderConfigData:()=>P,GraphQLSystemUserClient:()=>L,GraphQLTestingClient:()=>K,GraphQLTransactionGroup:()=>h,GraphQLVersionHistoryClient:()=>J,RoleInput:()=>v,RolesAndUsersInput:()=>N,SimpleRemoteEntity:()=>V,SimpleRemoteEntityField:()=>F,SimpleRemoteEntityOutput:()=>U,SyncDataAction:()=>x,SyncDataResult:()=>G,SyncRolesAndUsersResult:()=>$,UserInput:()=>A,gql:()=>s.J1,setupGraphQLClient:()=>C});var s=r(215),a=r(454),n=r(928),o=r(600),i=r(49),u=r(226),c=r(497),l=r(718),d=r(292),m=r(196),y=Object.defineProperty,p=(e,t)=>y(e,"name",{value:t,configurable:!0});class g{static{p(this,"FieldMapper")}constructor(){this._fieldMap={__mj_CreatedAt:"_mj__CreatedAt",__mj_UpdatedAt:"_mj__UpdatedAt",__mj_DeletedAt:"_mj__DeletedAt"}}MapFields(e){if(e)for(const t in e)t in this._fieldMap&&(e[this._fieldMap[t]]=e[t],delete e[t]);return e}MapFieldName(e){return this._fieldMap[e]??e}ReverseMapFieldName(e){return Object.entries(this._fieldMap).find(([t,r])=>r===e)?.[0]??e}ReverseMapFields(e){const t=Object.fromEntries(Object.entries(this._fieldMap).map(([e,t])=>[t,e]));for(const r in e)r in t&&(e[t[r]]=e[r],delete e[r]);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
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
ResultsJSON
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`,t=[];for(const e of this.PendingTransactions)t.push({EntityName:e.BaseEntity.EntityInfo.Name,EntityObjectJSON:await e.BaseEntity.GetDataObjectJSON(),OperationType:e.OperationType});const r={group:{Items:t,Variables:this.Variables.map(e=>({Name:e.Name,ItemIndex:this.MapVariableEntityObjectToPosition(e),FieldName:e.FieldName,Type:e.Type}))}},n=await this._provider.ExecuteGQL(e,r);if(n&&n.ExecuteTransactionGroup){const e=n.ExecuteTransactionGroup,t=[];for(let r=0;r<this.PendingTransactions.length;r++){const s=e.ResultsJSON[r],n=(0,d.NG)(s),o=this.PendingTransactions[r];t.push(new a.qT(o,n,null!==n))}return t}throw new Error("Failed to execute transaction group")}}class I{static{
|
|
9
|
+
`,t=[];for(const e of this.PendingTransactions)t.push({EntityName:e.BaseEntity.EntityInfo.Name,EntityObjectJSON:await e.BaseEntity.GetDataObjectJSON(),OperationType:e.OperationType});const r={group:{Items:t,Variables:this.Variables.map(e=>({Name:e.Name,ItemIndex:this.MapVariableEntityObjectToPosition(e),FieldName:e.FieldName,Type:e.Type}))}},n=await this._provider.ExecuteGQL(e,r);if(n&&n.ExecuteTransactionGroup){const e=n.ExecuteTransactionGroup,t=[];for(let r=0;r<this.PendingTransactions.length;r++){const s=e.ResultsJSON[r],n=(0,d.NG)(s),o=this.PendingTransactions[r];t.push(new a.qT(o,n,null!==n))}return t}throw new Error("Failed to execute transaction group")}}class I{static{p(this,"GraphQLAIClient")}constructor(e){this._dataProvider=e}async RunAIPrompt(e){try{const t=s.J1`
|
|
10
10
|
mutation RunAIPrompt(
|
|
11
11
|
$promptId: String!,
|
|
12
12
|
$data: String,
|
|
@@ -179,9 +179,9 @@
|
|
|
179
179
|
error
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
`,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 S="default";class R{static{
|
|
182
|
+
`,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 S="default";class R{static{p(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}getCategoryMap(e){const t=e||S;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||S).get(e)??null}async SetItem(e,t,r){this.getCategoryMap(r||S).set(e,t)}async Remove(e,t){this.getCategoryMap(t||S).delete(e)}async ClearCategory(e){const t=e||S;this._storage.delete(t)}async GetCategoryKeys(e){const t=this._storage.get(e||S);return t?Array.from(t.keys()):[]}}const D=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"],w="Metadata_KVPairs";class E extends R{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 D)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 D.includes(t)}getStoreName(e){const t=e||S;return this.isKnownCategory(t)?`mj:${t}`:"mj:default"}getStoreKey(e,t){const r=t||S;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||S,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||S,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 P 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 f extends a.Dn{static{p(this,"GraphQLDataProvider")}constructor(){super(),this._refreshPromise=null,this._innerCurrentUserQueryString=`CurrentUser {\n ${this.userInfoString()}\n MJUserRoles_UserIDArray {\n ${this.userRoleInfoString()}\n }\n }\n `,this._currentUserQuery=s.J1`query CurrentUserAndRoles {
|
|
183
183
|
${this._innerCurrentUserQueryString}
|
|
184
|
-
}`,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,f._instance||(f._instance=this)}static get Instance(){return f._instance}get ConfigData(){return this._configData}get AI(){return this._aiClient||(this._aiClient=new I(this)),this._aiClient}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return(0,l.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)):(f.Instance._configData=e,void 0===f.Instance._sessionId&&(f.Instance._sessionId=await this.GetPreferredUUID(s)),f.Instance._client||(f.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,f.Instance._sessionId,e.MJAPIKey,e.UserAPIKey)),await f.Instance.SaveStoredSessionID(f.Instance._sessionId),this._sessionId=f.Instance._sessionId,this._client=f.Instance._client),super.Config(e)}catch(e){throw(0,a.ZI)(e),e}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const t=this.ConvertBackToMJFields(e.CurrentUser),r=t.
|
|
184
|
+
}`,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,f._instance||(f._instance=this)}static get Instance(){return f._instance}get ConfigData(){return this._configData}get AI(){return this._aiClient||(this._aiClient=new I(this)),this._aiClient}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return(0,l.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)):(f.Instance._configData=e,void 0===f.Instance._sessionId&&(f.Instance._sessionId=await this.GetPreferredUUID(s)),f.Instance._client||(f.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,f.Instance._sessionId,e.MJAPIKey,e.UserAPIKey)),await f.Instance.SaveStoredSessionID(f.Instance._sessionId),this._sessionId=f.Instance._sessionId,this._client=f.Instance._client),super.Config(e)}catch(e){throw(0,a.ZI)(e),e}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}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));return t.MJUserRoles_UserIDArray=r,new a.oq(this,{...t,UserRoles:r})}}async RunReport(e,t){const r=s.J1`
|
|
185
185
|
query GetReportDataQuery ($ReportID: String!) {
|
|
186
186
|
GetReportData(ReportID: $ReportID) {
|
|
187
187
|
Success
|
|
@@ -224,7 +224,7 @@
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
`,a=(await this.ExecuteGQL(r,{input:t}))?.RunQueriesWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const n=a.results.map(e=>{if(("stale"===e.status||"no_validation"===e.status)&&e.Results){const t=JSON.parse(e.Results);return{queryIndex:e.queryIndex,queryId:e.queryId,status:e.status,results:t,maxUpdatedAt:e.maxUpdatedAt,rowCount:e.rowCount,errorMessage:e.errorMessage}}return{queryIndex:e.queryIndex,queryId:e.queryId,status:e.status,maxUpdatedAt:e.maxUpdatedAt,rowCount:e.rowCount,errorMessage:e.errorMessage}});return{success:a.success,results:n,errorMessage:a.errorMessage}}catch(e){return(0,a.ZI)(`Error in RunQueriesWithCacheCheck: ${e}`),{success:!1,results:[],errorMessage:e instanceof Error?e.message:String(e)}}}async InternalRunView(e,t){try{let r="",n="";if(!e)throw"No parameters passed to RunView";{const o={};let i,u;if(e.ViewEntity)u=e.ViewEntity,i=u.Entity;else{const{entityName:r,v:s}=await this.getEntityNameAndUserView(e,t);u=s,i=r}const c=this.Entities.find(e=>e.Name===i);if(!c)throw new Error(`Entity ${i} not found in metadata`);let l=!1;const d=(0,a.I)(c);e.ViewID?(r=`Run${d}ViewByID`,n="RunViewByIDInput",o.ViewID=e.ViewID):e.ViewName?(r=`Run${d}ViewByName`,n="RunViewByNameInput",o.ViewName=e.ViewName):(l=!0,r=`Run${d}DynamicView`,n="RunDynamicViewInput",o.EntityName=e.EntityName),o.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",o.OrderBy=e.OrderBy?e.OrderBy:"",o.UserSearchString=e.UserSearchString?e.UserSearchString:"",o.Fields=e.Fields,o.IgnoreMaxRows=!!e.IgnoreMaxRows&&e.IgnoreMaxRows,void 0!==e.MaxRows&&(o.MaxRows=e.MaxRows),void 0!==e.StartRow&&(o.StartRow=e.StartRow),o.ForceAuditLog=!!e.ForceAuditLog&&e.ForceAuditLog,o.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(o.AuditLogDescription=e.AuditLogDescription),l||(o.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",o.ExcludeDataFromAllPriorViewRuns=!!e.ExcludeDataFromAllPriorViewRuns&&e.ExcludeDataFromAllPriorViewRuns,o.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",o.SaveViewResults=!!e.SaveViewResults&&e.SaveViewResults),e.Aggregates&&e.Aggregates.length>0&&(o.Aggregates=e.Aggregates.map(e=>({expression:e.expression,alias:e.alias})));const m=this.getViewRunTimeFieldList(c,u,e,l),
|
|
227
|
+
`,a=(await this.ExecuteGQL(r,{input:t}))?.RunQueriesWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const n=a.results.map(e=>{if(("stale"===e.status||"no_validation"===e.status)&&e.Results){const t=JSON.parse(e.Results);return{queryIndex:e.queryIndex,queryId:e.queryId,status:e.status,results:t,maxUpdatedAt:e.maxUpdatedAt,rowCount:e.rowCount,errorMessage:e.errorMessage}}return{queryIndex:e.queryIndex,queryId:e.queryId,status:e.status,maxUpdatedAt:e.maxUpdatedAt,rowCount:e.rowCount,errorMessage:e.errorMessage}});return{success:a.success,results:n,errorMessage:a.errorMessage}}catch(e){return(0,a.ZI)(`Error in RunQueriesWithCacheCheck: ${e}`),{success:!1,results:[],errorMessage:e instanceof Error?e.message:String(e)}}}async InternalRunView(e,t){try{let r="",n="";if(!e)throw"No parameters passed to RunView";{const o={};let i,u;if(e.ViewEntity)u=e.ViewEntity,i=u.Entity;else{const{entityName:r,v:s}=await this.getEntityNameAndUserView(e,t);u=s,i=r}const c=this.Entities.find(e=>e.Name===i);if(!c)throw new Error(`Entity ${i} not found in metadata`);let l=!1;const d=(0,a.I)(c);e.ViewID?(r=`Run${d}ViewByID`,n="RunViewByIDInput",o.ViewID=e.ViewID):e.ViewName?(r=`Run${d}ViewByName`,n="RunViewByNameInput",o.ViewName=e.ViewName):(l=!0,r=`Run${d}DynamicView`,n="RunDynamicViewInput",o.EntityName=e.EntityName),o.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",o.OrderBy=e.OrderBy?e.OrderBy:"",o.UserSearchString=e.UserSearchString?e.UserSearchString:"",o.Fields=e.Fields,o.IgnoreMaxRows=!!e.IgnoreMaxRows&&e.IgnoreMaxRows,void 0!==e.MaxRows&&(o.MaxRows=e.MaxRows),void 0!==e.StartRow&&(o.StartRow=e.StartRow),o.ForceAuditLog=!!e.ForceAuditLog&&e.ForceAuditLog,o.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(o.AuditLogDescription=e.AuditLogDescription),l||(o.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",o.ExcludeDataFromAllPriorViewRuns=!!e.ExcludeDataFromAllPriorViewRuns&&e.ExcludeDataFromAllPriorViewRuns,o.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",o.SaveViewResults=!!e.SaveViewResults&&e.SaveViewResults),e.Aggregates&&e.Aggregates.length>0&&(o.Aggregates=e.Aggregates.map(e=>({expression:e.expression,alias:e.alias})));const m=this.getViewRunTimeFieldList(c,u,e,l),y=e.Aggregates&&e.Aggregates.length>0?"\n AggregateResults {\n alias\n expression\n value\n error\n }\n AggregateExecutionTime":"",p=s.J1`
|
|
228
228
|
query RunViewQuery ($input: ${n}!) {
|
|
229
229
|
${r}(input: $input) {
|
|
230
230
|
Results {
|
|
@@ -235,9 +235,9 @@
|
|
|
235
235
|
TotalRowCount
|
|
236
236
|
ExecutionTime
|
|
237
237
|
Success
|
|
238
|
-
ErrorMessage${
|
|
238
|
+
ErrorMessage${y}
|
|
239
239
|
}
|
|
240
|
-
}`;o.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:i,queryName:r,aggregateCount:o.Aggregates.length,aggregates:o.Aggregates});const g=await this.ExecuteGQL(
|
|
240
|
+
}`;o.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:i,queryName:r,aggregateCount:o.Aggregates.length,aggregates:o.Aggregates});const g=await this.ExecuteGQL(p,{input:o});if(g&&g[r]){const e=g[r].AggregateResults;o.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Received aggregate results:",{entityName:i,aggregateResultCount:e?.length||0,aggregateResults:e,aggregateExecutionTime:g[r].AggregateExecutionTime});const t=g[r].Results;if(t&&t.length>0){const e=c.Fields.filter(e=>e.CodeName!==e.Name&&void 0!==e.CodeName);t.forEach(t=>{this.ConvertBackToMJFields(t),e.forEach(e=>{t[e.Name]=t[e.CodeName]})})}return g[r]}}return null}catch(e){throw(0,a.ZI)(e),e}}async InternalRunViews(e,t){try{let r=[],n=[],o=[];for(const s of e){let e="",i="";const u={};let c=null,l=null;if(s.ViewEntity)l=s.ViewEntity,c=l.Get("Entity");else{const{entityName:e,v:r}=await this.getEntityNameAndUserView(s,t);l=r,c=e}const d=this.Entities.find(e=>e.Name===c);if(!d)throw new Error(`Entity ${c} not found in metadata`);n.push(d);let m=!1;const y=(0,a.I)(d);s.ViewID?(e=`Run${y}ViewByID`,i="RunViewByIDInput",u.ViewID=s.ViewID):s.ViewName?(e=`Run${y}ViewByName`,i="RunViewByNameInput",u.ViewName=s.ViewName):(m=!0,e=`Run${y}DynamicView`,i="RunDynamicViewInput",u.EntityName=s.EntityName),u.ExtraFilter=s.ExtraFilter||"",u.OrderBy=s.OrderBy||"",u.UserSearchString=s.UserSearchString||"",u.Fields=s.Fields,u.IgnoreMaxRows=s.IgnoreMaxRows||!1,void 0!==s.MaxRows&&(u.MaxRows=s.MaxRows),void 0!==s.StartRow&&(u.StartRow=s.StartRow),u.ForceAuditLog=s.ForceAuditLog||!1,u.ResultType=s.ResultType||"simple",s.AuditLogDescription&&s.AuditLogDescription.length>0&&(u.AuditLogDescription=s.AuditLogDescription),m||(u.ExcludeUserViewRunID=s.ExcludeUserViewRunID||"",u.ExcludeDataFromAllPriorViewRuns=s.ExcludeDataFromAllPriorViewRuns||!1,u.OverrideExcludeFilter=s.OverrideExcludeFilter||"",u.SaveViewResults=s.SaveViewResults||!1),s.Aggregates&&s.Aggregates.length>0&&(u.Aggregates=s.Aggregates.map(e=>({expression:e.expression,alias:e.alias}))),r.push(u),o.push(...this.getViewRunTimeFieldList(d,l,s,m))}const i=e.some(e=>e.Aggregates&&e.Aggregates.length>0)?"\n AggregateResults {\n alias\n expression\n value\n error\n }\n AggregateExecutionTime":"",u=s.J1`
|
|
241
241
|
query RunViewsQuery ($input: [RunViewGenericInput!]!) {
|
|
242
242
|
RunViews(input: $input) {
|
|
243
243
|
Results {
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
`,a=(await this.ExecuteGQL(r,{input:t}))?.RunViewsWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const n=a.results.map((t,r)=>{if(e[r],"differential"===t.status&&t.differentialData){const e=t.differentialData.updatedRows.map(e=>{const t=JSON.parse(e.Data);return this.ConvertBackToMJFields(t),t});return{viewIndex:t.viewIndex,status:t.status,results:void 0,differentialData:{updatedRows:e,deletedRecordIDs:t.differentialData.deletedRecordIDs},maxUpdatedAt:t.maxUpdatedAt,rowCount:t.rowCount,errorMessage:t.errorMessage}}if("stale"===t.status&&t.Results){const e=t.Results.map(e=>{const t=JSON.parse(e.Data);return this.ConvertBackToMJFields(t),t});return{viewIndex:t.viewIndex,status:t.status,results:e,maxUpdatedAt:t.maxUpdatedAt,rowCount:t.rowCount,errorMessage:t.errorMessage}}return{viewIndex:t.viewIndex,status:t.status,results:void 0,maxUpdatedAt:t.maxUpdatedAt,rowCount:t.rowCount,errorMessage:t.errorMessage}});return{success:a.success,results:n,errorMessage:a.errorMessage}}catch(e){return(0,a.ZI)(e),{success:!1,results:[],errorMessage:e instanceof Error?e.message:String(e)}}}async getEntityNameAndUserView(e,t){let r,s;if(e.EntityName)r=e.EntityName;else if(e.ViewID)s=await n.o1C.GetViewEntity(e.ViewID,t),r=s.Entity;else{if(!e.ViewName)throw new Error("No EntityName, ViewID or ViewName passed to RunView");s=await n.o1C.GetViewEntityByName(e.ViewName,t),r=s.Entity}return{entityName:r,v:s}}getViewRunTimeFieldList(e,t,r,s){const a=[],n=new g;if(r.Fields){for(const t of e.PrimaryKeys)void 0===r.Fields.find(e=>e.trim().toLowerCase()===t.Name.toLowerCase())&&a.push(t.Name);r.Fields.forEach(e=>{a.push(n.MapFieldName(e))})}else if(s)e.Fields.forEach(e=>{e.IsBinaryFieldType||a.push(n.MapFieldName(e.CodeName))});else{for(const t of e.PrimaryKeys)void 0===a.find(e=>e.trim().toLowerCase()===t.Name.toLowerCase())&&a.push(t.Name);t.Columns.forEach(e=>{!1===e.hidden&&!a.find(t=>t.trim().toLowerCase()===e.EntityField?.Name.trim().toLowerCase())&&e.EntityField&&a.push(n.MapFieldName(e.EntityField.CodeName))})}return a}get ProviderType(){return a.cp.Network}async GetRecordChanges(e,t){try{const r={EntityName:"Record Changes",ExtraFilter:`RecordID = '${t.Values()}' AND Entity = '${e}'`},s=await this.RunView(r);return s?s.Results.sort((e,t)=>e.ChangedAt>t.ChangedAt?-1:1):null}catch(e){throw(0,a.ZI)(e),e}}async GetRecordDependencies(e,t){try{const r=s.J1`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
291
|
+
`,a=(await this.ExecuteGQL(r,{input:t}))?.RunViewsWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const n=a.results.map((t,r)=>{if(e[r],"differential"===t.status&&t.differentialData){const e=t.differentialData.updatedRows.map(e=>{const t=JSON.parse(e.Data);return this.ConvertBackToMJFields(t),t});return{viewIndex:t.viewIndex,status:t.status,results:void 0,differentialData:{updatedRows:e,deletedRecordIDs:t.differentialData.deletedRecordIDs},maxUpdatedAt:t.maxUpdatedAt,rowCount:t.rowCount,errorMessage:t.errorMessage}}if("stale"===t.status&&t.Results){const e=t.Results.map(e=>{const t=JSON.parse(e.Data);return this.ConvertBackToMJFields(t),t});return{viewIndex:t.viewIndex,status:t.status,results:e,maxUpdatedAt:t.maxUpdatedAt,rowCount:t.rowCount,errorMessage:t.errorMessage}}return{viewIndex:t.viewIndex,status:t.status,results:void 0,maxUpdatedAt:t.maxUpdatedAt,rowCount:t.rowCount,errorMessage:t.errorMessage}});return{success:a.success,results:n,errorMessage:a.errorMessage}}catch(e){return(0,a.ZI)(e),{success:!1,results:[],errorMessage:e instanceof Error?e.message:String(e)}}}async getEntityNameAndUserView(e,t){let r,s;if(e.EntityName)r=e.EntityName;else if(e.ViewID)s=await n.o1C.GetViewEntity(e.ViewID,t),r=s.Entity;else{if(!e.ViewName)throw new Error("No EntityName, ViewID or ViewName passed to RunView");s=await n.o1C.GetViewEntityByName(e.ViewName,t),r=s.Entity}return{entityName:r,v:s}}getViewRunTimeFieldList(e,t,r,s){const a=[],n=new g;if(r.Fields){for(const t of e.PrimaryKeys)void 0===r.Fields.find(e=>e.trim().toLowerCase()===t.Name.toLowerCase())&&a.push(t.Name);r.Fields.forEach(e=>{a.push(n.MapFieldName(e))})}else if(s)e.Fields.forEach(e=>{e.IsBinaryFieldType||a.push(n.MapFieldName(e.CodeName))});else{for(const t of e.PrimaryKeys)void 0===a.find(e=>e.trim().toLowerCase()===t.Name.toLowerCase())&&a.push(t.Name);t.Columns.forEach(e=>{!1===e.hidden&&!a.find(t=>t.trim().toLowerCase()===e.EntityField?.Name.trim().toLowerCase())&&e.EntityField&&a.push(n.MapFieldName(e.EntityField.CodeName))})}return a}get ProviderType(){return a.cp.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((e,t)=>e.ChangedAt>t.ChangedAt?-1:1):null}catch(e){throw(0,a.ZI)(e),e}}async GetRecordDependencies(e,t){try{const r=s.J1`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
292
292
|
GetRecordDependencies(entityName: $entityName, CompositeKey: $CompositeKey) {
|
|
293
293
|
EntityName
|
|
294
294
|
RelatedEntityName
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
${u}
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
`),d=await this.ExecuteGQL(l,n);return d&&d[c]?this.ConvertBackToMJFields(d[c]):null}catch(e){return(0,a.ZI)(e),null}}ConvertBackToMJFields(e){return(new g).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 t=e.RelatedEntities[s],a=this.Entities.find(e=>e.ID===t.RelatedEntityID);let n="";n="many to many"===t.Type.toLowerCase().trim()?`${t.RelatedEntityCodeName}_${t.JoinEntityJoinField.replace(/\s/g,"")}`:`${t.RelatedEntityCodeName}_${t.RelatedEntityJoinField.replace(/\s/g,"")}`,r+=`\n ${n} {\n ${a.Fields.map(e=>e.CodeName).join("\n ")}\n }\n `}return r}async Delete(e,t,r){const n=new a.KV;try{e.RegisterTransactionPreprocessing(),n.StartedAt=new Date,n.Type="delete",n.OriginalValues=e.Fields.map(e=>({FieldName:e.CodeName,Value:e.Value})),e.ResultHistory.push(n);const r={},o=[];let i="",u="",c="";for(let t of e.PrimaryKey.KeyValuePairs){const s=e.Fields.find(e=>e.Name.trim().toLowerCase()===t.FieldName.trim().toLowerCase());r[s.CodeName]=s.Value,o.push({varName:s.CodeName,inputType:s.EntityFieldInfo.GraphQLType+"!"}),i.length>0&&(i+=", "),i+=`${s.CodeName}: $${s.CodeName}`,u.length>0&&(u+=", "),u+=`$${s.CodeName}: ${s.EntityFieldInfo.GraphQLType}!`,c.length>0&&(c+="\n "),c+=`${s.CodeName}`}o.push({varName:"options___",inputType:"DeleteOptionsInput!"}),r.options___=
|
|
351
|
+
`),d=await this.ExecuteGQL(l,n);return d&&d[c]?this.ConvertBackToMJFields(d[c]):null}catch(e){return(0,a.ZI)(e),null}}ConvertBackToMJFields(e){return(new g).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 t=e.RelatedEntities[s],a=this.Entities.find(e=>e.ID===t.RelatedEntityID);let n="";n="many to many"===t.Type.toLowerCase().trim()?`${t.RelatedEntityCodeName}_${t.JoinEntityJoinField.replace(/\s/g,"")}`:`${t.RelatedEntityCodeName}_${t.RelatedEntityJoinField.replace(/\s/g,"")}`,r+=`\n ${n} {\n ${a.Fields.map(e=>e.CodeName).join("\n ")}\n }\n `}return r}async Delete(e,t,r){const n=new a.KV;try{e.RegisterTransactionPreprocessing(),n.StartedAt=new Date,n.Type="delete",n.OriginalValues=e.Fields.map(e=>({FieldName:e.CodeName,Value:e.Value})),e.ResultHistory.push(n);const r={},o=[];let i="",u="",c="";for(let t of e.PrimaryKey.KeyValuePairs){const s=e.Fields.find(e=>e.Name.trim().toLowerCase()===t.FieldName.trim().toLowerCase());r[s.CodeName]=s.Value,o.push({varName:s.CodeName,inputType:s.EntityFieldInfo.GraphQLType+"!"}),i.length>0&&(i+=", "),i+=`${s.CodeName}: $${s.CodeName}`,u.length>0&&(u+=", "),u+=`$${s.CodeName}: ${s.EntityFieldInfo.GraphQLType}!`,c.length>0&&(c+="\n "),c+=`${s.CodeName}`}o.push({varName:"options___",inputType:"DeleteOptionsInput!"}),r.options___={SkipEntityAIActions:t?.SkipEntityAIActions??!1,SkipEntityActions:t?.SkipEntityActions??!1,ReplayOnly:t?.ReplayOnly??!1,IsParentEntityDelete:t?.IsParentEntityDelete??!1};const l="Delete"+(0,a.I)(e.EntityInfo),d=s.J1`${l}(${i}, options___: $options___) {
|
|
352
352
|
${c}
|
|
353
353
|
}
|
|
354
354
|
`,m=s.J1`mutation ${l} (${u}, $options___: DeleteOptionsInput!) {
|
|
@@ -412,14 +412,14 @@
|
|
|
412
412
|
ErrorMessage
|
|
413
413
|
Result
|
|
414
414
|
}
|
|
415
|
-
}`,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 f.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=f.Instance&&f.Instance._configData===this._configData;if(e&&f.Instance._refreshPromise)return f.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(f.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&f.Instance&&(f.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,f.Instance&&f.Instance._configData===this._configData&&(f.Instance._client=t)}}}static async RefreshToken(){return f.Instance.RefreshToken()}CreateNewGraphQLClient(e,t,r,a,n){const o={"x-session-id":r};return t&&(o.authorization="Bearer "+t),a&&(o["x-mj-api-key"]=a),n&&(o["x-api-key"]=n),new s.l4(e,{headers:o})}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 E: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,c.UU)({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token},keepAlive:3e4,retryAttempts:3,shouldRetry:
|
|
415
|
+
}`,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 f.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=f.Instance&&f.Instance._configData===this._configData;if(e&&f.Instance._refreshPromise)return f.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(f.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&f.Instance&&(f.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,f.Instance&&f.Instance._configData===this._configData&&(f.Instance._client=t)}}}static async RefreshToken(){return f.Instance.RefreshToken()}CreateNewGraphQLClient(e,t,r,a,n){const o={"x-session-id":r};return t&&(o.authorization="Bearer "+t),a&&(o["x-mj-api-key"]=a),n&&(o["x-api-key"]=n),new s.l4(e,{headers:o})}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 E: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,c.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 o.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 o.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!) {
|
|
416
416
|
statusUpdates(sessionId: $sessionId) {
|
|
417
417
|
date
|
|
418
418
|
message
|
|
419
419
|
sessionId
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
`,n=new i.B,c=this.getOrCreateWSClient(),l=new u.yU;return l.add(new o.c(t=>{const r=c.subscribe({query:a,variables:{sessionId:e}},{next:y(r=>{const s=this._pushStatusSubjects.get(e);s&&(s.lastEmissionAt=Date.now()),t.next(r.data.statusUpdates.message)},"next"),error:y(async e=>{const r=e;if("JWT_EXPIRED"===r?.extensions?.code||r?.message?.includes("token has expired")||r?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] PushStatusUpdates JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),t.complete()}catch(e){console.error("[GraphQLDataProvider] Failed to refresh token for PushStatusUpdates:",e),t.error(e)}}else t.error(e)},"error"),complete:y(()=>{t.complete()},"complete")});return this._activeSubscriptionCount++,()=>{this._activeSubscriptionCount--,r()}}).subscribe({next:y(e=>n.next(e),"next"),error:y(t=>{n.error(t),this._pushStatusSubjects.delete(e)},"error"),complete:y(()=>{n.complete(),this._pushStatusSubjects.delete(e)},"complete")})),this._pushStatusSubjects.set(e,{subject:n,subscription:l,createdAt:t,lastRequestedAt:t,lastEmissionAt:t,activeSubscribers:0}),new o.c(t=>{const r=this._pushStatusSubjects.get(e);r&&r.activeSubscribers++;const s=n.subscribe(t);return()=>{const t=this._pushStatusSubjects.get(e);t&&t.activeSubscribers>0&&t.activeSubscribers--,s.unsubscribe()}})}disposeWebSocketResources(){this._subscriptionCleanupTimer&&(clearInterval(this._subscriptionCleanupTimer),this._subscriptionCleanupTimer=null),this.completeAllSubjects(),this._activeSubscriptionCount=0,this.disposeWSClient()}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 function C(e){const t=new f;return(0,a.YE)(t),await t.Config(e),await a.jF.Instance.Startup(),d.rt.Instance.RaiseEvent({event:d.UK.LoggedIn,eventCode:null,component:this,args:null}),t}y(C,"setupGraphQLClient");class ${static{y(this,"SyncRolesAndUsersResult")}}class v{static{y(this,"RoleInput")}}class A{static{y(this,"UserInput")}}class N{static{y(this,"RolesAndUsersInput")}}var b,x=((b=x||{}).Create="Create",b.Update="Update",b.CreateOrUpdate="CreateOrUpdate",b.Delete="Delete",b.DeleteWithFilter="DeleteWithFilter",b);class M{static{y(this,"ActionItemInput")}}class G{static{y(this,"SyncDataResult")}constructor(){this.Results=[]}}class L{static{y(this,"ActionItemOutput")}}class Q{static{y(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})}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,d.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=await this.Client.request("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 }",{input:e});return t&&t.RunViewByNameSystemUser?t.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=await this.Client.request("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 }",{input:e});return t&&t.RunViewByIDSystemUser?t.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=await this.Client.request("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 }",{input:e});return t&&t.RunDynamicViewSystemUser?t.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=await this.Client.request("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 }",{input:e});return t&&t.RunViewsSystemUser?t.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,d.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,d.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 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 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=t);const n=await this.Client.request(r,s);return n&&n.DeleteQuerySystemResolver?n.DeleteQuerySystemResolver:{Success:!1,ErrorMessage:"Failed to delete query"}}catch(e){return(0,a.ZI)(`GraphQLSystemUserClient::DeleteQuery - Error deleting query - ${e}`),{Success:!1,ErrorMessage:e.toString()}}}async RunAIPrompt(e){try{const t=s.J1`
|
|
422
|
+
`,n=new i.B,c=this.getOrCreateWSClient(),l=new u.yU;return l.add(new o.c(t=>{const r=c.subscribe({query:a,variables:{sessionId:e}},{next:p(r=>{const s=this._pushStatusSubjects.get(e);s&&(s.lastEmissionAt=Date.now()),t.next(r.data.statusUpdates.message)},"next"),error:p(async e=>{const r=e;if("JWT_EXPIRED"===r?.extensions?.code||r?.message?.includes("token has expired")||r?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] PushStatusUpdates JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),t.complete()}catch(e){console.error("[GraphQLDataProvider] Failed to refresh token for PushStatusUpdates:",e),t.error(e)}}else t.error(e)},"error"),complete:p(()=>{t.complete()},"complete")});return this._activeSubscriptionCount++,()=>{this._activeSubscriptionCount--,r()}}).subscribe({next:p(e=>n.next(e),"next"),error:p(t=>{n.error(t),this._pushStatusSubjects.delete(e)},"error"),complete:p(()=>{n.complete(),this._pushStatusSubjects.delete(e)},"complete")})),this._pushStatusSubjects.set(e,{subject:n,subscription:l,createdAt:t,lastRequestedAt:t,lastEmissionAt:t,activeSubscribers:0}),new o.c(t=>{const r=this._pushStatusSubjects.get(e);r&&r.activeSubscribers++;const s=n.subscribe(t);return()=>{const t=this._pushStatusSubjects.get(e);t&&t.activeSubscribers>0&&t.activeSubscribers--,s.unsubscribe()}})}disposeWebSocketResources(){this._subscriptionCleanupTimer&&(clearInterval(this._subscriptionCleanupTimer),this._subscriptionCleanupTimer=null),this.completeAllSubjects(),this._activeSubscriptionCount=0,this.disposeWSClient()}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 f;return(0,a.YE)(t),await t.Config(e),await a.jF.Instance.Startup(),d.rt.Instance.RaiseEvent({event:d.UK.LoggedIn,eventCode:null,component:this,args:null}),t}p(C,"setupGraphQLClient");class ${static{p(this,"SyncRolesAndUsersResult")}}class v{static{p(this,"RoleInput")}}class A{static{p(this,"UserInput")}}class N{static{p(this,"RolesAndUsersInput")}}var b,x=((b=x||{}).Create="Create",b.Update="Update",b.CreateOrUpdate="CreateOrUpdate",b.Delete="Delete",b.DeleteWithFilter="DeleteWithFilter",b);class M{static{p(this,"ActionItemInput")}}class G{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})}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,d.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=await this.Client.request("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 }",{input:e});return t&&t.RunViewByNameSystemUser?t.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=await this.Client.request("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 }",{input:e});return t&&t.RunViewByIDSystemUser?t.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=await this.Client.request("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 }",{input:e});return t&&t.RunDynamicViewSystemUser?t.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=await this.Client.request("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 }",{input:e});return t&&t.RunViewsSystemUser?t.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,d.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,d.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 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 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`
|
|
423
423
|
query RunAIPromptSystemUser(
|
|
424
424
|
$promptId: String!,
|
|
425
425
|
$data: String,
|
|
@@ -543,7 +543,7 @@
|
|
|
543
543
|
error
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
|
-
`,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 T{static{
|
|
546
|
+
`,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 T{static{p(this,"GetDataOutput")}}class U{static{p(this,"SimpleRemoteEntityOutput")}}class V{static{p(this,"SimpleRemoteEntity")}}class F{static{p(this,"SimpleRemoteEntityField")}}class _{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`
|
|
547
547
|
mutation RunAction($input: RunActionInput!) {
|
|
548
548
|
RunAction(input: $input) {
|
|
549
549
|
Success
|
|
@@ -560,7 +560,7 @@
|
|
|
560
560
|
ResultData
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
`;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(e){(0,a.ZI)(`Failed to parse entity action result data: ${e}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return(0,a.ZI)(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}}class O{static{
|
|
563
|
+
`;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(e){(0,a.ZI)(`Failed to parse entity action result data: ${e}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return(0,a.ZI)(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}}class O{static{p(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(e){return this.handleCreateAPIKeyError(e)}}createAPIKeyVariables(e){return{input:{Label:e.Label,Description:e.Description,ExpiresAt:e.ExpiresAt?.toISOString(),ScopeIDs:e.ScopeIDs}}}async executeCreateAPIKeyMutation(e){const t=s.J1`
|
|
564
564
|
mutation CreateAPIKey($input: CreateAPIKeyInput!) {
|
|
565
565
|
CreateAPIKey(input: $input) {
|
|
566
566
|
Success
|
|
@@ -576,7 +576,7 @@
|
|
|
576
576
|
Error
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{apiKeyId:e});return r?.RevokeAPIKey?{Success:r.RevokeAPIKey.Success,Error:r.RevokeAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}catch(e){const t=e;return(0,a.ZI)(`Error revoking API key: ${t.message}`),{Success:!1,Error:`Error: ${t.message}`}}}}class K{static{
|
|
579
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{apiKeyId:e});return r?.RevokeAPIKey?{Success:r.RevokeAPIKey.Success,Error:r.RevokeAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}catch(e){const t=e;return(0,a.ZI)(`Error revoking API key: ${t.message}`),{Success:!1,Error:`Error: ${t.message}`}}}}class K{static{p(this,"GraphQLTestingClient")}constructor(e){this._dataProvider=e}async RunTest(e){let t;try{e.onProgress&&(t=this._dataProvider.PushStatusUpdates(this._dataProvider.sessionId).subscribe(t=>{try{const r=JSON.parse(t);"RunTestResolver"===r.resolver&&"TestExecutionProgress"===r.type&&"ok"===r.status&&r.data?.progress&&e.onProgress(r.data.progress)}catch(e){console.error("[GraphQLTestingClient] Failed to parse progress message:",e)}}));const r=s.J1`
|
|
580
580
|
mutation RunTest(
|
|
581
581
|
$testId: String!,
|
|
582
582
|
$verbose: Boolean,
|
|
@@ -630,7 +630,7 @@
|
|
|
630
630
|
query IsTestRunning($testId: String!) {
|
|
631
631
|
IsTestRunning(testId: $testId)
|
|
632
632
|
}
|
|
633
|
-
`;return(await this._dataProvider.ExecuteGQL(t,{testId:e})).IsTestRunning}catch(e){return(0,a.ZI)(`Error checking test running status: ${e.message}`),!1}}processTestResult(e){if(!e)throw new Error("Invalid response from server");let t;try{t=(0,d.NG)(e.result)}catch{t=e.result}return{success:e.success,errorMessage:e.errorMessage,executionTimeMs:e.executionTimeMs,result:t}}processSuiteResult(e){if(!e)throw new Error("Invalid response from server");let t;try{t=(0,d.NG)(e.result)}catch{t=e.result}return{success:e.success,errorMessage:e.errorMessage,executionTimeMs:e.executionTimeMs,result:t}}handleError(e,t){const r=e.message;return(0,a.ZI)(`${t} failed: ${r}`),{success:!1,errorMessage:r,result:null}}}class
|
|
633
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{testId:e})).IsTestRunning}catch(e){return(0,a.ZI)(`Error checking test running status: ${e.message}`),!1}}processTestResult(e){if(!e)throw new Error("Invalid response from server");let t;try{t=(0,d.NG)(e.result)}catch{t=e.result}return{success:e.success,errorMessage:e.errorMessage,executionTimeMs:e.executionTimeMs,result:t}}processSuiteResult(e){if(!e)throw new Error("Invalid response from server");let t;try{t=(0,d.NG)(e.result)}catch{t=e.result}return{success:e.success,errorMessage:e.errorMessage,executionTimeMs:e.executionTimeMs,result:t}}handleError(e,t){const r=e.message;return(0,a.ZI)(`${t} failed: ${r}`),{success:!1,errorMessage:r,result:null}}}class k{static{p(this,"GraphQLComponentRegistryClient")}constructor(e){this._dataProvider=e}async GetRegistryComponent(e){try{const t=s.J1`
|
|
634
634
|
query GetRegistryComponent(
|
|
635
635
|
$registryName: String!,
|
|
636
636
|
$namespace: String!,
|
|
@@ -714,7 +714,7 @@
|
|
|
714
714
|
error
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(e){return(0,a.ZI)(e),{success:!1,error:e instanceof Error?e.message:"Unknown error"}}}}class J{static{
|
|
717
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(e){return(0,a.ZI)(e),{success:!1,error:e instanceof Error?e.message:"Unknown error"}}}}class J{static{p(this,"GraphQLVersionHistoryClient")}constructor(e){this._dataProvider=e}async CreateLabel(e){let t;try{e.OnProgress&&(t=this._dataProvider.PushStatusUpdates(this._dataProvider.sessionId).subscribe(t=>{try{const r=JSON.parse(t);"VersionHistoryResolver"===r.resolver&&"CreateLabelProgress"===r.type&&"ok"===r.status&&r.data&&e.OnProgress(r.data)}catch{}}));const r=s.J1`
|
|
718
718
|
mutation CreateVersionLabel($input: CreateVersionLabelInput!, $sessionId: String) {
|
|
719
719
|
CreateVersionLabel(input: $input, sessionId: $sessionId) {
|
|
720
720
|
Success
|
|
@@ -730,7 +730,7 @@
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
}
|
|
733
|
-
`,a={input:this.buildInput(e),sessionId:this._dataProvider.sessionId},n=await this._dataProvider.ExecuteGQL(r,a);return this.processResult(n)}catch(e){const t=e instanceof Error?e.message:String(e);return(0,a.ZI)(`GraphQLVersionHistoryClient.CreateLabel error: ${t}`),{Success:!1,Error:t}}finally{t&&t.unsubscribe()}}buildInput(e){const t={Name:e.Name};return null!=e.Description&&(t.Description=e.Description),null!=e.Scope&&(t.Scope=e.Scope),null!=e.EntityName&&(t.EntityName=e.EntityName),null!=e.ParentID&&(t.ParentID=e.ParentID),null!=e.ExternalSystemID&&(t.ExternalSystemID=e.ExternalSystemID),null!=e.IncludeDependencies&&(t.IncludeDependencies=e.IncludeDependencies),null!=e.MaxDepth&&(t.MaxDepth=e.MaxDepth),null!=e.ExcludeEntities&&(t.ExcludeEntities=e.ExcludeEntities),e.RecordKeys&&e.RecordKeys.length>0&&(t.RecordKeys=e.RecordKeys.map(e=>({Key:e.Key,Value:e.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(e=>({EntityName:e.EntityName??"",RecordID:e.RecordID??"",ErrorMessage:e.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
|
|
733
|
+
`,a={input:this.buildInput(e),sessionId:this._dataProvider.sessionId},n=await this._dataProvider.ExecuteGQL(r,a);return this.processResult(n)}catch(e){const t=e instanceof Error?e.message:String(e);return(0,a.ZI)(`GraphQLVersionHistoryClient.CreateLabel error: ${t}`),{Success:!1,Error:t}}finally{t&&t.unsubscribe()}}buildInput(e){const t={Name:e.Name};return null!=e.Description&&(t.Description=e.Description),null!=e.Scope&&(t.Scope=e.Scope),null!=e.EntityName&&(t.EntityName=e.EntityName),null!=e.ParentID&&(t.ParentID=e.ParentID),null!=e.ExternalSystemID&&(t.ExternalSystemID=e.ExternalSystemID),null!=e.IncludeDependencies&&(t.IncludeDependencies=e.IncludeDependencies),null!=e.MaxDepth&&(t.MaxDepth=e.MaxDepth),null!=e.ExcludeEntities&&(t.ExcludeEntities=e.ExcludeEntities),e.RecordKeys&&e.RecordKeys.length>0&&(t.RecordKeys=e.RecordKeys.map(e=>({Key:e.Key,Value:e.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(e=>({EntityName:e.EntityName??"",RecordID:e.RecordID??"",ErrorMessage:e.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 j{static{p(this,"GraphQLFileStorageClient")}constructor(e){this._dataProvider=e}async ListObjects(e,t="",r){try{const a=s.J1`
|
|
734
734
|
query ListStorageObjects($input: ListStorageObjectsInput!) {
|
|
735
735
|
ListStorageObjects(input: $input) {
|
|
736
736
|
objects {
|