@memberjunction/graphql-dataprovider 2.14.0 → 2.15.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/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var M=Object.defineProperty;var E=(I,e)=>M(I,"name",{value:e,configurable:!0});var w=require("graphql-request"),d=require("@memberjunction/core"),x=require("@memberjunction/core-entities"),q=require("@tempfix/idb"),Q=require("rxjs"),k=require("graphql-ws"),B=require("uuid"),U=require("@memberjunction/global");const $=class ${constructor(){this._fieldMap={__mj_CreatedAt:"_mj__CreatedAt",__mj_UpdatedAt:"_mj__UpdatedAt",__mj_DeletedAt:"_mj__DeletedAt"}}MapFields(e){if(e)for(const a in e)a in this._fieldMap&&(e[this._fieldMap[a]]=e[a],delete e[a]);return e}MapFieldName(e){return this._fieldMap[e]??e}ReverseMapFieldName(e){return Object.entries(this._fieldMap).find(([a,s])=>s===e)?.[0]??e}ReverseMapFields(e){const a=Object.fromEntries(Object.entries(this._fieldMap).map(([s,t])=>[t,s]));for(const s in e)s in a&&(e[a[s]]=e[s],delete e[s]);return e}};E($,"FieldMapper");let N=$;const G=class G extends d.ProviderConfigDataBase{get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}constructor(e,a,s,t,r,c,n){super({Token:e,URL:a,WSURL:s,RefreshTokenFunction:t},r,c,n)}};E(G,"GraphQLProviderConfigData");let V=G;const h=class h extends d.ProviderBase{constructor(){super(),this._innerCurrentUserQueryString=`CurrentUser {
1
+ "use strict";var q=Object.defineProperty;var E=(I,e)=>q(I,"name",{value:e,configurable:!0});var w=require("graphql-request"),y=require("@memberjunction/core"),x=require("@memberjunction/core-entities"),M=require("@tempfix/idb"),Q=require("rxjs"),k=require("graphql-ws"),B=require("uuid"),U=require("@memberjunction/global");const $=class ${constructor(){this._fieldMap={__mj_CreatedAt:"_mj__CreatedAt",__mj_UpdatedAt:"_mj__UpdatedAt",__mj_DeletedAt:"_mj__DeletedAt"}}MapFields(e){if(e)for(const a in e)a in this._fieldMap&&(e[this._fieldMap[a]]=e[a],delete e[a]);return e}MapFieldName(e){return this._fieldMap[e]??e}ReverseMapFieldName(e){return Object.entries(this._fieldMap).find(([a,s])=>s===e)?.[0]??e}ReverseMapFields(e){const a=Object.fromEntries(Object.entries(this._fieldMap).map(([s,t])=>[t,s]));for(const s in e)s in a&&(e[a[s]]=e[s],delete e[s]);return e}};E($,"FieldMapper");let N=$;const G=class G extends y.ProviderConfigDataBase{get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}constructor(e,a,s,t,r,c,n){super({Token:e,URL:a,WSURL:s,RefreshTokenFunction:t},r,c,n)}};E(G,"GraphQLProviderConfigData");let V=G;const R=class R extends y.ProviderBase{constructor(){super(),this._innerCurrentUserQueryString=`CurrentUser {
2
2
  ${this.userInfoString()}
3
3
  UserRoles_UserIDArray {
4
4
  ${this.userRoleInfoString()}
@@ -6,7 +6,7 @@
6
6
  }
7
7
  `,this._currentUserQuery=w.gql`query CurrentUserAndRoles {
8
8
  ${this._innerCurrentUserQueryString}
9
- }`,this._wsClient=null,this._pushStatusRequests=[],h._instance||(h._instance=this)}static get Instance(){return h._instance}get ConfigData(){return this._configData}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}GenerateUUID(){return B.v4()}get LocalStoragePrefix(){return this._configData.URL.replace(/[^a-zA-Z0-9]/g,"_")+"."}async Config(e,a){try{const s=this.GenerateUUID();return a?(this._sessionId=s,this._configData=e,this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId)):(h.Instance._sessionId===void 0&&(h.Instance._sessionId=s),h.Instance._configData=e,h.Instance._client||(h.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,h.Instance._sessionId))),super.Config(e)}catch(s){throw d.LogError(s),s}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const a=this.ConvertBackToMJFields(e.CurrentUser),s=a.UserRoles_UserIDArray.map(t=>this.ConvertBackToMJFields(t));return a.UserRoles_UserIDArray=s,new d.UserInfo(this,{...a,UserRoles:s})}}async RunReport(e,a){const s=w.gql`
9
+ }`,this._wsClient=null,this._pushStatusRequests=[],R._instance||(R._instance=this)}static get Instance(){return R._instance}get ConfigData(){return this._configData}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}GenerateUUID(){return B.v4()}get LocalStoragePrefix(){return this._configData.URL.replace(/[^a-zA-Z0-9]/g,"_")+"."}async Config(e,a){try{const s=this.GenerateUUID();return a?(this._sessionId=s,this._configData=e,this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId)):(R.Instance._sessionId===void 0&&(R.Instance._sessionId=s),R.Instance._configData=e,R.Instance._client||(R.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,R.Instance._sessionId))),super.Config(e)}catch(s){throw y.LogError(s),s}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const a=this.ConvertBackToMJFields(e.CurrentUser),s=a.UserRoles_UserIDArray.map(t=>this.ConvertBackToMJFields(t));return a.UserRoles_UserIDArray=s,new y.UserInfo(this,{...a,UserRoles:s})}}async RunReport(e,a){const s=w.gql`
10
10
  query GetReportDataQuery ($ReportID: String!) {
11
11
  GetReportData(ReportID: $ReportID) {
12
12
  Success
@@ -24,7 +24,7 @@
24
24
  ExecutionTime
25
25
  ErrorMessage
26
26
  }
27
- }`,t=await this.ExecuteGQL(s,{QueryID:e.QueryID});if(t&&t.GetQueryData)return{QueryID:e.QueryID,Success:t.GetQueryData.Success,Results:JSON.parse(t.GetQueryData.Results),RowCount:t.GetQueryData.RowCount,ExecutionTime:t.GetQueryData.ExecutionTime,ErrorMessage:t.GetQueryData.ErrorMessage}}async RunView(e,a){try{let s="",t="";if(e){const r={};let c,n;if(e.ViewEntity)n=e.ViewEntity,c=n.Entity;else{const{entityName:o,v:l}=await this.getEntityNameAndUserView(e,a);n=l,c=o}const i=this.Entities.find(o=>o.Name===c);if(!i)throw new Error(`Entity ${c} not found in metadata`);let p=!1;e.ViewID?(s=`Run${i.ClassName}ViewByID`,t="RunViewByIDInput",r.ViewID=e.ViewID):e.ViewName?(s=`Run${i.ClassName}ViewByName`,t="RunViewByNameInput",r.ViewName=e.ViewName):(p=!0,s=`Run${i.ClassName}DynamicView`,t="RunDynamicViewInput",r.EntityName=e.EntityName),r.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",r.OrderBy=e.OrderBy?e.OrderBy:"",r.UserSearchString=e.UserSearchString?e.UserSearchString:"",r.Fields=e.Fields,r.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,r.MaxRows=e.MaxRows?e.MaxRows:0,r.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,r.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(r.AuditLogDescription=e.AuditLogDescription),p||(r.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",r.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,r.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",r.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1);const f=this.getViewRunTimeFieldList(i,n,e,p),y=w.gql`
27
+ }`,t=await this.ExecuteGQL(s,{QueryID:e.QueryID});if(t&&t.GetQueryData)return{QueryID:e.QueryID,Success:t.GetQueryData.Success,Results:JSON.parse(t.GetQueryData.Results),RowCount:t.GetQueryData.RowCount,ExecutionTime:t.GetQueryData.ExecutionTime,ErrorMessage:t.GetQueryData.ErrorMessage}}async RunView(e,a){try{let s="",t="";if(e){const r={};let c,n;if(e.ViewEntity)n=e.ViewEntity,c=n.Entity;else{const{entityName:o,v:l}=await this.getEntityNameAndUserView(e,a);n=l,c=o}const i=this.Entities.find(o=>o.Name===c);if(!i)throw new Error(`Entity ${c} not found in metadata`);let p=!1;e.ViewID?(s=`Run${i.ClassName}ViewByID`,t="RunViewByIDInput",r.ViewID=e.ViewID):e.ViewName?(s=`Run${i.ClassName}ViewByName`,t="RunViewByNameInput",r.ViewName=e.ViewName):(p=!0,s=`Run${i.ClassName}DynamicView`,t="RunDynamicViewInput",r.EntityName=e.EntityName),r.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",r.OrderBy=e.OrderBy?e.OrderBy:"",r.UserSearchString=e.UserSearchString?e.UserSearchString:"",r.Fields=e.Fields,r.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,r.MaxRows=e.MaxRows?e.MaxRows:0,r.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,r.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(r.AuditLogDescription=e.AuditLogDescription),p||(r.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",r.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,r.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",r.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1);const f=this.getViewRunTimeFieldList(i,n,e,p),d=w.gql`
28
28
  query RunViewQuery ($input: ${t}!) {
29
29
  ${s}(input: $input) {
30
30
  Results {
@@ -38,7 +38,7 @@
38
38
  Success
39
39
  ErrorMessage
40
40
  }
41
- }`,u=await this.ExecuteGQL(y,{input:r});if(u&&u[s]){const o=u[s].Results;if(o&&o.length>0){const l=i.Fields.filter(m=>m.CodeName!==m.Name&&m.CodeName!==void 0);o.forEach(m=>{this.ConvertBackToMJFields(m),l.forEach(R=>{m[R.Name]=m[R.CodeName]})})}return u[s]}}else throw"No parameters passed to RunView";return null}catch(s){throw d.LogError(s),s}}async RunViews(e,a){try{let s=[],t=[],r=[];for(const i of e){let p="",f="";const y={};let u=null,o=null;if(i.ViewEntity)o=i.ViewEntity,u=o.Get("Entity");else{const{entityName:R,v:D}=await this.getEntityNameAndUserView(i,a);o=D,u=R}const l=this.Entities.find(R=>R.Name===u);if(!l)throw new Error(`Entity ${u} not found in metadata`);t.push(l);let m=!1;i.ViewID?(p=`Run${l.ClassName}ViewByID`,f="RunViewByIDInput",y.ViewID=i.ViewID):i.ViewName?(p=`Run${l.ClassName}ViewByName`,f="RunViewByNameInput",y.ViewName=i.ViewName):(m=!0,p=`Run${l.ClassName}DynamicView`,f="RunDynamicViewInput",y.EntityName=i.EntityName),y.ExtraFilter=i.ExtraFilter||"",y.OrderBy=i.OrderBy||"",y.UserSearchString=i.UserSearchString||"",y.Fields=i.Fields,y.IgnoreMaxRows=i.IgnoreMaxRows||!1,y.MaxRows=i.MaxRows||0,y.ForceAuditLog=i.ForceAuditLog||!1,y.ResultType=i.ResultType||"simple",i.AuditLogDescription&&i.AuditLogDescription.length>0&&(y.AuditLogDescription=i.AuditLogDescription),m||(y.ExcludeUserViewRunID=i.ExcludeUserViewRunID||"",y.ExcludeDataFromAllPriorViewRuns=i.ExcludeDataFromAllPriorViewRuns||!1,y.OverrideExcludeFilter=i.OverrideExcludeFilter||"",y.SaveViewResults=i.SaveViewResults||!1),s.push(y),r.push(...this.getViewRunTimeFieldList(l,o,i,m))}const c=w.gql`
41
+ }`,u=await this.ExecuteGQL(d,{input:r});if(u&&u[s]){const o=u[s].Results;if(o&&o.length>0){const l=i.Fields.filter(m=>m.CodeName!==m.Name&&m.CodeName!==void 0);o.forEach(m=>{this.ConvertBackToMJFields(m),l.forEach(h=>{m[h.Name]=m[h.CodeName]})})}return u[s]}}else throw"No parameters passed to RunView";return null}catch(s){throw y.LogError(s),s}}async RunViews(e,a){try{let s=[],t=[],r=[];for(const i of e){let p="",f="";const d={};let u=null,o=null;if(i.ViewEntity)o=i.ViewEntity,u=o.Get("Entity");else{const{entityName:h,v:D}=await this.getEntityNameAndUserView(i,a);o=D,u=h}const l=this.Entities.find(h=>h.Name===u);if(!l)throw new Error(`Entity ${u} not found in metadata`);t.push(l);let m=!1;i.ViewID?(p=`Run${l.ClassName}ViewByID`,f="RunViewByIDInput",d.ViewID=i.ViewID):i.ViewName?(p=`Run${l.ClassName}ViewByName`,f="RunViewByNameInput",d.ViewName=i.ViewName):(m=!0,p=`Run${l.ClassName}DynamicView`,f="RunDynamicViewInput",d.EntityName=i.EntityName),d.ExtraFilter=i.ExtraFilter||"",d.OrderBy=i.OrderBy||"",d.UserSearchString=i.UserSearchString||"",d.Fields=i.Fields,d.IgnoreMaxRows=i.IgnoreMaxRows||!1,d.MaxRows=i.MaxRows||0,d.ForceAuditLog=i.ForceAuditLog||!1,d.ResultType=i.ResultType||"simple",i.AuditLogDescription&&i.AuditLogDescription.length>0&&(d.AuditLogDescription=i.AuditLogDescription),m||(d.ExcludeUserViewRunID=i.ExcludeUserViewRunID||"",d.ExcludeDataFromAllPriorViewRuns=i.ExcludeDataFromAllPriorViewRuns||!1,d.OverrideExcludeFilter=i.OverrideExcludeFilter||"",d.SaveViewResults=i.SaveViewResults||!1),s.push(d),r.push(...this.getViewRunTimeFieldList(l,o,i,m))}const c=w.gql`
42
42
  query RunViewsQuery ($input: [RunViewGenericInput!]!) {
43
43
  RunViews(input: $input) {
44
44
  Results {
@@ -53,7 +53,7 @@
53
53
  Success
54
54
  ErrorMessage
55
55
  }
56
- }`,n=await this.ExecuteGQL(c,{input:s});if(n&&n.RunViews){const i=n.RunViews;for(const[p,f]of i.entries())f.Results=f.Results.map(y=>{let u=JSON.parse(y.Data);return this.ConvertBackToMJFields(u),u});return i}return null}catch(s){throw d.LogError(s),s}}async getEntityNameAndUserView(e,a){let s,t;if(e.EntityName)s=e.EntityName;else if(e.ViewID)t=await x.ViewInfo.GetViewEntity(e.ViewID,a),s=t.Entity;else if(e.ViewName)t=await x.ViewInfo.GetViewEntityByName(e.ViewName,a),s=t.Entity;else throw new Error("No EntityName, ViewID or ViewName passed to RunView");return{entityName:s,v:t}}getViewRunTimeFieldList(e,a,s,t){const r=[],c=new N;if(s.Fields){for(const n of e.PrimaryKeys)s.Fields.find(i=>i.trim().toLowerCase()===n.Name.toLowerCase())===void 0&&r.push(n.Name);s.Fields.forEach(n=>{r.push(c.MapFieldName(n))})}else if(t)e.Fields.forEach(n=>{n.IsBinaryFieldType||r.push(c.MapFieldName(n.CodeName))});else{for(const n of e.PrimaryKeys)r.find(i=>i.trim().toLowerCase()===n.Name.toLowerCase())===void 0&&r.push(n.Name);a.Columns.forEach(n=>{n.hidden===!1&&!r.find(i=>i.trim().toLowerCase()===n.EntityField?.Name.trim().toLowerCase())&&n.EntityField&&r.push(c.MapFieldName(n.EntityField.CodeName))})}return r}get ProviderType(){return d.ProviderType.Network}async GetRecordChanges(e,a){try{const s={EntityName:"Record Changes",ExtraFilter:`RecordID = '${a.Values()}' AND Entity = '${e}'`},t=await this.RunView(s);return t?t.Results.sort((r,c)=>r.ChangedAt>c.ChangedAt?-1:1):null}catch(s){throw d.LogError(s),s}}async GetRecordDependencies(e,a){try{const s=w.gql`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
56
+ }`,n=await this.ExecuteGQL(c,{input:s});if(n&&n.RunViews){const i=n.RunViews;for(const[p,f]of i.entries())f.Results=f.Results.map(d=>{let u=JSON.parse(d.Data);return this.ConvertBackToMJFields(u),u});return i}return null}catch(s){throw y.LogError(s),s}}async getEntityNameAndUserView(e,a){let s,t;if(e.EntityName)s=e.EntityName;else if(e.ViewID)t=await x.ViewInfo.GetViewEntity(e.ViewID,a),s=t.Entity;else if(e.ViewName)t=await x.ViewInfo.GetViewEntityByName(e.ViewName,a),s=t.Entity;else throw new Error("No EntityName, ViewID or ViewName passed to RunView");return{entityName:s,v:t}}getViewRunTimeFieldList(e,a,s,t){const r=[],c=new N;if(s.Fields){for(const n of e.PrimaryKeys)s.Fields.find(i=>i.trim().toLowerCase()===n.Name.toLowerCase())===void 0&&r.push(n.Name);s.Fields.forEach(n=>{r.push(c.MapFieldName(n))})}else if(t)e.Fields.forEach(n=>{n.IsBinaryFieldType||r.push(c.MapFieldName(n.CodeName))});else{for(const n of e.PrimaryKeys)r.find(i=>i.trim().toLowerCase()===n.Name.toLowerCase())===void 0&&r.push(n.Name);a.Columns.forEach(n=>{n.hidden===!1&&!r.find(i=>i.trim().toLowerCase()===n.EntityField?.Name.trim().toLowerCase())&&n.EntityField&&r.push(c.MapFieldName(n.EntityField.CodeName))})}return r}get ProviderType(){return y.ProviderType.Network}async GetRecordChanges(e,a){try{const s={EntityName:"Record Changes",ExtraFilter:`RecordID = '${a.Values()}' AND Entity = '${e}'`},t=await this.RunView(s);return t?t.Results.sort((r,c)=>r.ChangedAt>c.ChangedAt?-1:1):null}catch(s){throw y.LogError(s),s}}async GetRecordDependencies(e,a){try{const s=w.gql`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
57
57
  GetRecordDependencies(entityName: $entityName, CompositeKey: $CompositeKey) {
58
58
  EntityName
59
59
  RelatedEntityName
@@ -65,7 +65,7 @@
65
65
  }
66
66
  }
67
67
  }
68
- }`,t={entityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(a.KeyValuePairs)}};return(await this.ExecuteGQL(s,t))?.GetRecordDependencies}catch(s){throw d.LogError(s),s}}ensureKeyValuePairValueIsString(e){return e.map(a=>({FieldName:a.FieldName,Value:a.Value.toString()}))}async GetRecordDuplicates(e,a){if(!e)return null;const s=w.gql`query GetRecordDuplicatesQuery ($params: PotentialDuplicateRequestType!) {
68
+ }`,t={entityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(a.KeyValuePairs)}};return(await this.ExecuteGQL(s,t))?.GetRecordDependencies}catch(s){throw y.LogError(s),s}}ensureKeyValuePairValueIsString(e){return e.map(a=>({FieldName:a.FieldName,Value:a.Value.toString()}))}async GetRecordDuplicates(e,a){if(!e)return null;const s=w.gql`query GetRecordDuplicatesQuery ($params: PotentialDuplicateRequestType!) {
69
69
  GetRecordDuplicates(params: $params) {
70
70
  Status
71
71
  ErrorMessage
@@ -104,32 +104,32 @@
104
104
  Message
105
105
  }
106
106
  }
107
- }`,t={EntityName:e.EntityName,SurvivingRecordCompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(e.SurvivingRecordCompositeKey.KeyValuePairs)},FieldMap:e.FieldMap?.map(c=>({FieldName:c.FieldName,Value:c.Value.toString()})),RecordsToMerge:e.RecordsToMerge.map(c=>c.Copy())};return(await this.ExecuteGQL(s,{request:t}))?.MergeRecords}catch(s){return d.LogError(s),{Success:!1,OverallStatus:s&&s.message?s.message:s,RecordStatus:[],RecordMergeLogID:"",Request:e}}}async Save(e,a,s){const t=new d.BaseEntityResult;try{e.RegisterTransactionPreprocessing();const r={input:{}},c=e.IsSaved?"Update":"Create";t.StartedAt=new Date,t.Type=e.IsSaved?"update":"create",t.OriginalValues=e.Fields.map(u=>({FieldName:u.CodeName,Value:u.Value})),e.ResultHistory.push(t);const n=`${c}${e.EntityInfo.ClassName}`,i=e.Fields.filter(u=>!u.ReadOnly||u.IsPrimaryKey&&e.IsSaved),p=new N,f=` ${n}(input: $input) {
107
+ }`,t={EntityName:e.EntityName,SurvivingRecordCompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(e.SurvivingRecordCompositeKey.KeyValuePairs)},FieldMap:e.FieldMap?.map(c=>({FieldName:c.FieldName,Value:c.Value.toString()})),RecordsToMerge:e.RecordsToMerge.map(c=>c.Copy())};return(await this.ExecuteGQL(s,{request:t}))?.MergeRecords}catch(s){return y.LogError(s),{Success:!1,OverallStatus:s&&s.message?s.message:s,RecordStatus:[],RecordMergeLogID:"",Request:e}}}async Save(e,a,s){const t=new y.BaseEntityResult;try{e.RegisterTransactionPreprocessing();const r={input:{}},c=e.IsSaved?"Update":"Create";t.StartedAt=new Date,t.Type=e.IsSaved?"update":"create",t.OriginalValues=e.Fields.map(u=>({FieldName:u.CodeName,Value:u.Value})),e.ResultHistory.push(t);const n=`${c}${e.EntityInfo.ClassName}`,i=e.Fields.filter(u=>!u.ReadOnly||u.IsPrimaryKey&&e.IsSaved),p=new N,f=` ${n}(input: $input) {
108
108
  ${e.Fields.map(u=>p.MapFieldName(u.CodeName)).join(`
109
109
  `)}
110
- }`,y=w.gql`mutation ${c}${e.EntityInfo.ClassName} ($input: ${n}Input!) {
110
+ }`,d=w.gql`mutation ${c}${e.EntityInfo.ClassName} ($input: ${n}Input!) {
111
111
  ${f}
112
112
  }
113
- `;for(let u=0;u<i.length;u++){const o=i[u];let l=o.Value;l&&o.EntityFieldInfo.TSType===d.EntityFieldTSType.Date&&(l=l.getTime()),l&&o.EntityFieldInfo.TSType===d.EntityFieldTSType.Boolean&&typeof l!="boolean"&&(l=parseInt(l)!==0),l===null&&o.EntityFieldInfo.AllowsNull===!1&&(o.EntityFieldInfo.DefaultValue!==null?l=o.EntityFieldInfo.DefaultValue:o.FieldType===d.EntityFieldTSType.Number||o.FieldType===d.EntityFieldTSType.Boolean?l=0:l=""),r.input[o.CodeName]=l}if(c.trim().toLowerCase()==="update"&&s.SkipOldValuesCheck===!1){const u=[];e.Fields.forEach(o=>{let l=null;o.OldValue!==null&&o.OldValue!==void 0&&(o.EntityFieldInfo.TSType===d.EntityFieldTSType.Date?l=o.OldValue.getTime().toString():o.EntityFieldInfo.TSType===d.EntityFieldTSType.Boolean?l=o.OldValue===!0?"1":"0":typeof o.OldValue!="string"?l=o.OldValue.toString():l=o.OldValue),u.push({Key:o.CodeName,Value:l})}),r.input.OldValues___=u}if(e.TransactionGroup)return new Promise((u,o)=>{const l=[{varName:"input",inputType:n+"Input!"}];e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new d.TransactionItem(e,f,r,{mutationName:n,mutationInputTypes:l},(m,R)=>{t.EndedAt=new Date,R&&m?(t.Success=!0,u(this.ConvertBackToMJFields(m))):(t.Success=!1,t.Message="Transaction failed",o())}))});{const u=await this.ExecuteGQL(y,r);if(u&&u[c+e.EntityInfo.ClassName])return t.Success=!0,t.EndedAt=new Date,this.ConvertBackToMJFields(u[c+e.EntityInfo.ClassName]);throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(r){return t.Success=!1,t.EndedAt=new Date,t.Message=r.response?.errors?.length>0?r.response.errors[0].message:r.message,d.LogError(r),null}}async Load(e,a,s=null,t){try{const r={};let c="",n="";for(let u=0;u<a.KeyValuePairs.length;u++){const o=e.Fields.find(R=>R.Name.trim().toLowerCase()===a.KeyValuePairs[u].FieldName.trim().toLowerCase()).EntityFieldInfo,l=a.GetValueByIndex(u),m=o.GraphQLType;if(n.length>0&&(n+=", "),n+=`$${o.CodeName}: ${m}!`,c.length>0&&(c+=", "),c+=`${o.CodeName}: $${o.CodeName}`,o.TSType===d.EntityFieldTSType.Number){if(isNaN(a.GetValueByIndex(u)))throw new Error(`Primary Key value ${l} (${o.Name}) is not a valid number`);r[o.CodeName]=parseInt(l)}else r[o.CodeName]=l}const i=s&&s.length>0?this.getRelatedEntityString(e.EntityInfo,s):"",p=new N,f=w.gql`query Single${e.EntityInfo.ClassName}${i.length>0?"Full":""} (${n}) {
113
+ `;for(let u=0;u<i.length;u++){const o=i[u];let l=o.Value;l&&o.EntityFieldInfo.TSType===y.EntityFieldTSType.Date&&(l=l.getTime()),l&&o.EntityFieldInfo.TSType===y.EntityFieldTSType.Boolean&&typeof l!="boolean"&&(l=parseInt(l)!==0),l===null&&o.EntityFieldInfo.AllowsNull===!1&&(o.EntityFieldInfo.DefaultValue!==null?l=o.EntityFieldInfo.DefaultValue:o.FieldType===y.EntityFieldTSType.Number||o.FieldType===y.EntityFieldTSType.Boolean?l=0:l=""),r.input[o.CodeName]=l}if(c.trim().toLowerCase()==="update"&&s.SkipOldValuesCheck===!1){const u=[];e.Fields.forEach(o=>{let l=null;o.OldValue!==null&&o.OldValue!==void 0&&(o.EntityFieldInfo.TSType===y.EntityFieldTSType.Date?l=o.OldValue.getTime().toString():o.EntityFieldInfo.TSType===y.EntityFieldTSType.Boolean?l=o.OldValue===!0?"1":"0":typeof o.OldValue!="string"?l=o.OldValue.toString():l=o.OldValue),u.push({Key:o.CodeName,Value:l})}),r.input.OldValues___=u}if(e.TransactionGroup)return new Promise((u,o)=>{const l=[{varName:"input",inputType:n+"Input!"}];e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new y.TransactionItem(e,f,r,{mutationName:n,mutationInputTypes:l},(m,h)=>{t.EndedAt=new Date,h&&m?(t.Success=!0,u(this.ConvertBackToMJFields(m))):(t.Success=!1,t.Message="Transaction failed",o())}))});{const u=await this.ExecuteGQL(d,r);if(u&&u[c+e.EntityInfo.ClassName])return t.Success=!0,t.EndedAt=new Date,this.ConvertBackToMJFields(u[c+e.EntityInfo.ClassName]);throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(r){return t.Success=!1,t.EndedAt=new Date,t.Message=r.response?.errors?.length>0?r.response.errors[0].message:r.message,y.LogError(r),null}}async Load(e,a,s=null,t){try{const r={};let c="",n="";for(let u=0;u<a.KeyValuePairs.length;u++){const o=e.Fields.find(h=>h.Name.trim().toLowerCase()===a.KeyValuePairs[u].FieldName.trim().toLowerCase()).EntityFieldInfo,l=a.GetValueByIndex(u),m=o.GraphQLType;if(n.length>0&&(n+=", "),n+=`$${o.CodeName}: ${m}!`,c.length>0&&(c+=", "),c+=`${o.CodeName}: $${o.CodeName}`,o.TSType===y.EntityFieldTSType.Number){if(isNaN(a.GetValueByIndex(u)))throw new Error(`Primary Key value ${l} (${o.Name}) is not a valid number`);r[o.CodeName]=parseInt(l)}else r[o.CodeName]=l}const i=s&&s.length>0?this.getRelatedEntityString(e.EntityInfo,s):"",p=new N,f=w.gql`query Single${e.EntityInfo.ClassName}${i.length>0?"Full":""} (${n}) {
114
114
  ${e.EntityInfo.ClassName}(${c}) {
115
115
  ${e.Fields.filter(u=>!u.EntityFieldInfo.IsBinaryFieldType).map(u=>u.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?u.CodeName.replace("__mj_","_mj__"):u.CodeName).join(`
116
116
  `)}
117
117
  ${i}
118
118
  }
119
119
  }
120
- `,y=await this.ExecuteGQL(f,r);return y&&y[e.EntityInfo.ClassName]?this.ConvertBackToMJFields(y[e.EntityInfo.ClassName]):null}catch(r){return d.LogError(r),null}}ConvertBackToMJFields(e){return new N().ReverseMapFields(e),e}getRelatedEntityString(e,a){let s="";for(let t=0;t<e.RelatedEntities.length;t++)if(a.indexOf(e.RelatedEntities[t].RelatedEntity)>=0){const r=e.RelatedEntities[t],c=this.Entities.find(i=>i.ID===r.RelatedEntityID);let n="";r.Type.toLowerCase().trim()==="many to many"?n=`${r.RelatedEntityCodeName}_${r.JoinEntityJoinField.replace(/\s/g,"")}`:n=`${r.RelatedEntityCodeName}_${r.RelatedEntityJoinField.replace(/\s/g,"")}`,s+=`
120
+ `,d=await this.ExecuteGQL(f,r);return d&&d[e.EntityInfo.ClassName]?this.ConvertBackToMJFields(d[e.EntityInfo.ClassName]):null}catch(r){return y.LogError(r),null}}ConvertBackToMJFields(e){return new N().ReverseMapFields(e),e}getRelatedEntityString(e,a){let s="";for(let t=0;t<e.RelatedEntities.length;t++)if(a.indexOf(e.RelatedEntities[t].RelatedEntity)>=0){const r=e.RelatedEntities[t],c=this.Entities.find(i=>i.ID===r.RelatedEntityID);let n="";r.Type.toLowerCase().trim()==="many to many"?n=`${r.RelatedEntityCodeName}_${r.JoinEntityJoinField.replace(/\s/g,"")}`:n=`${r.RelatedEntityCodeName}_${r.RelatedEntityJoinField.replace(/\s/g,"")}`,s+=`
121
121
  ${n} {
122
122
  ${c.Fields.map(i=>i.CodeName).join(`
123
123
  `)}
124
124
  }
125
- `}return s}async Delete(e,a,s){const t=new d.BaseEntityResult;try{e.RegisterTransactionPreprocessing(),t.StartedAt=new Date,t.Type="delete",t.OriginalValues=e.Fields.map(o=>({FieldName:o.CodeName,Value:o.Value})),e.ResultHistory.push(t);const r={},c=[];let n="",i="",p="";for(let o of e.PrimaryKey.KeyValuePairs){const l=e.Fields.find(m=>m.Name.trim().toLowerCase()===o.FieldName.trim().toLowerCase());r[l.CodeName]=l.Value,c.push({varName:l.CodeName,inputType:l.EntityFieldInfo.GraphQLType+"!"}),n.length>0&&(n+=", "),n+=`${l.CodeName}: $${l.CodeName}`,i.length>0&&(i+=", "),i+=`$${l.CodeName}: ${l.EntityFieldInfo.GraphQLType}!`,p.length>0&&(p+=`
126
- `),p+=`${l.CodeName}`}c.push({varName:"options___",inputType:"DeleteOptionsInput!"}),r.options___=a||{SkipEntityAIActions:!1,SkipEntityActions:!1};const f="Delete"+e.EntityInfo.ClassName,y=w.gql`${f}(${n}, options___: $options___) {
125
+ `}return s}async Delete(e,a,s){const t=new y.BaseEntityResult;try{e.RegisterTransactionPreprocessing(),t.StartedAt=new Date,t.Type="delete",t.OriginalValues=e.Fields.map(o=>({FieldName:o.CodeName,Value:o.Value})),e.ResultHistory.push(t);const r={},c=[];let n="",i="",p="";for(let o of e.PrimaryKey.KeyValuePairs){const l=e.Fields.find(m=>m.Name.trim().toLowerCase()===o.FieldName.trim().toLowerCase());r[l.CodeName]=l.Value,c.push({varName:l.CodeName,inputType:l.EntityFieldInfo.GraphQLType+"!"}),n.length>0&&(n+=", "),n+=`${l.CodeName}: $${l.CodeName}`,i.length>0&&(i+=", "),i+=`$${l.CodeName}: ${l.EntityFieldInfo.GraphQLType}!`,p.length>0&&(p+=`
126
+ `),p+=`${l.CodeName}`}c.push({varName:"options___",inputType:"DeleteOptionsInput!"}),r.options___=a||{SkipEntityAIActions:!1,SkipEntityActions:!1};const f="Delete"+e.EntityInfo.ClassName,d=w.gql`${f}(${n}, options___: $options___) {
127
127
  ${p}
128
128
  }
129
129
  `,u=w.gql`mutation ${f} (${i}, $options___: DeleteOptionsInput!) {
130
- ${y}
130
+ ${d}
131
131
  }
132
- `;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),new Promise((o,l)=>{e.TransactionGroup.AddTransaction(new d.TransactionItem(e,y,r,{mutationName:f,mutationInputTypes:c},(m,R)=>{if(t.EndedAt=new Date,R&&m){let D=!0;for(const P of e.PrimaryKey.KeyValuePairs)P.Value!==m[P.FieldName]&&(D=!1);D?(t.Success=!0,o(!0)):(t.Success=!1,t.Message="Transaction failed to commit",l())}else t.Success=!1,t.Message="Transaction failed to commit",l()}))});{const o=await this.ExecuteGQL(u,r);if(o&&o[f]){const l=o[f];for(let m of e.PrimaryKey.KeyValuePairs){let R=l[m.FieldName],D=m.Value;if(typeof D=="number"&&(D=D.toString()),typeof R=="number"&&(R=R.toString()),D!==R)throw new Error(`Primary key value mismatch in server Delete response. Field: ${m.FieldName}, Original: ${D}, Returned: ${R}`)}return t.Success=!0,t.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(r){return t.EndedAt=new Date,t.Success=!1,t.Message=r.response?.errors?.length>0?r.response.errors[0].message:r.message,d.LogError(r),!1}}async GetDatasetByName(e,a){const s=w.gql`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
132
+ `;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),new Promise((o,l)=>{e.TransactionGroup.AddTransaction(new y.TransactionItem(e,d,r,{mutationName:f,mutationInputTypes:c},(m,h)=>{if(t.EndedAt=new Date,h&&m){let D=!0;for(const P of e.PrimaryKey.KeyValuePairs)P.Value!==m[P.FieldName]&&(D=!1);D?(t.Success=!0,o(!0)):(t.Success=!1,t.Message="Transaction failed to commit",l())}else t.Success=!1,t.Message="Transaction failed to commit",l()}))});{const o=await this.ExecuteGQL(u,r);if(o&&o[f]){const l=o[f];for(let m of e.PrimaryKey.KeyValuePairs){let h=l[m.FieldName],D=m.Value;if(typeof D=="number"&&(D=D.toString()),typeof h=="number"&&(h=h.toString()),D!==h)throw new Error(`Primary key value mismatch in server Delete response. Field: ${m.FieldName}, Original: ${D}, Returned: ${h}`)}return t.Success=!0,t.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(r){return t.EndedAt=new Date,t.Success=!1,t.Message=r.response?.errors?.length>0?r.response.errors[0].message:r.message,y.LogError(r),!1}}async GetDatasetByName(e,a){const s=w.gql`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
133
133
  GetDatasetByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
134
134
  DatasetID
135
135
  DatasetName
@@ -175,7 +175,7 @@
175
175
  EntityName
176
176
  RecordName
177
177
  }
178
- }`,s=await this.ExecuteGQL(a,{info:e.map(t=>({EntityName:t.EntityName,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.CompositeKey.KeyValuePairs)}}))});if(s&&s.GetEntityRecordNames)return s.GetEntityRecordNames}static async ExecuteGQL(e,a,s=!0){return h.Instance.ExecuteGQL(e,a,s)}async ExecuteGQL(e,a,s=!0){try{return await this._client.request(e,a)}catch(t){if(t&&t.response&&t.response.errors?.length>0)if(t.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(s)return await this.RefreshToken(),await this.ExecuteGQL(e,a,!1);throw d.LogError("JWT_EXPIRED and refreshTokenIfNeeded is false"),t}else throw t;else throw d.LogError(t),t}}async RefreshToken(){if(this._configData.Data.RefreshTokenFunction){const e=await this._configData.Data.RefreshTokenFunction();if(e)this._configData.Token=e,this._client=this.CreateNewGraphQLClient(this._configData.URL,this._configData.Token,this._sessionId);else throw new Error("Refresh token function returned null or undefined token")}else throw new Error("No refresh token function provided")}static async RefreshToken(){return h.Instance.RefreshToken()}CreateNewGraphQLClient(e,a,s){return new w.GraphQLClient(e,{headers:{authorization:"Bearer "+a,"x-session-id":s}})}userInfoString(){return this.infoString(new d.UserInfo(null,null))}userRoleInfoString(){return this.infoString(new d.UserRoleInfo(null))}infoString(e){let a="";const s=Object.keys(e);for(const t of s)t.startsWith("__mj_")?a+=t.replace("__mj_","_mj__")+`
178
+ }`,s=await this.ExecuteGQL(a,{info:e.map(t=>({EntityName:t.EntityName,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.CompositeKey.KeyValuePairs)}}))});if(s&&s.GetEntityRecordNames)return s.GetEntityRecordNames}static async ExecuteGQL(e,a,s=!0){return R.Instance.ExecuteGQL(e,a,s)}async ExecuteGQL(e,a,s=!0){try{return await this._client.request(e,a)}catch(t){if(t&&t.response&&t.response.errors?.length>0)if(t.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(s)return await this.RefreshToken(),await this.ExecuteGQL(e,a,!1);throw y.LogError("JWT_EXPIRED and refreshTokenIfNeeded is false"),t}else throw t;else throw y.LogError(t),t}}async RefreshToken(){if(this._configData.Data.RefreshTokenFunction){const e=await this._configData.Data.RefreshTokenFunction();if(e)this._configData.Token=e,this._client=this.CreateNewGraphQLClient(this._configData.URL,this._configData.Token,this._sessionId);else throw new Error("Refresh token function returned null or undefined token")}else throw new Error("No refresh token function provided")}static async RefreshToken(){return R.Instance.RefreshToken()}CreateNewGraphQLClient(e,a,s){return new w.GraphQLClient(e,{headers:{authorization:"Bearer "+a,"x-session-id":s}})}userInfoString(){return this.infoString(new y.UserInfo(null,null))}userRoleInfoString(){return this.infoString(new y.UserRoleInfo(null))}infoString(e){let a="";const s=Object.keys(e);for(const t of s)t.startsWith("__mj_")?a+=t.replace("__mj_","_mj__")+`
179
179
  `:t.startsWith("_")||(a+=t+`
180
180
  `);return a}get LocalStorageProvider(){return this._localStorageProvider||(this._localStorageProvider=new C),this._localStorageProvider}get Metadata(){return this}PushStatusUpdates(e=null){e||(e=this.sessionId),this._wsClient||(this._wsClient=k.createClient({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token}}));const a=this._pushStatusRequests.find(r=>r.sessionId===e);if(a)return a.observable;const s=w.gql`subscription StatusUpdates($sessionId: String!) {
181
181
  statusUpdates(sessionId: $sessionId) {
@@ -184,9 +184,9 @@
184
184
  sessionId
185
185
  }
186
186
  }
187
- `,t=new Q.Observable(r=>(this._wsClient.subscribe({query:s,variables:{sessionId:e}},{next:c=>r.next(c.data.statusUpdates),error:c=>r.error(c),complete:()=>r.complete()}),()=>{console.log("would unsub here")}));return this._pushStatusRequests.push({sessionId:e,observable:t}),t}};E(h,"GraphQLDataProvider");let S=h;const v=class v{constructor(){this._localStorage={}}async getItem(e){return new Promise(a=>{this._localStorage.hasOwnProperty(e)?a(this._localStorage[e]):a(null)})}async setItem(e,a){return new Promise(s=>{this._localStorage[e]=a,s()})}async remove(e){return new Promise(a=>{this._localStorage.hasOwnProperty(e)&&delete this._localStorage[e],a()})}};E(v,"BrowserStorageProviderBase");let F=v;const A="MJ_Metadata",g="Metadata_KVPairs",_=class _ extends F{constructor(){super(),this.dbPromise=q.openDB(A,1,{upgrade(e){e.objectStoreNames.contains(g)||e.createObjectStore(g)}})}async setItem(e,a){const t=(await this.dbPromise).transaction(g,"readwrite");await t.objectStore(g).put(a,e),await t.done}async getItem(e){return await(await this.dbPromise).transaction(g).objectStore(g).get(e)}async remove(e){const s=(await this.dbPromise).transaction(g,"readwrite");await s.objectStore(g).delete(e),await s.done}};E(_,"BrowserIndexedDBStorageProvider");let C=_;const L=class L extends d.TransactionGroupBase{constructor(e){super()}async HandleSubmit(e){let a="",s="";const t={};for(let n=0;n<e.length;n++){const i=e[n];let p=i.Instruction;if(i.Vars){const f=Object.keys(i.Vars);for(let y=0;y<f.length;y++){const u=f[y],o=`${u}_${n}`;t[o]=i.Vars[u];const l=new RegExp("\\$"+u,"g");p=p.replace(l,"$"+o);const m=i.ExtraData.mutationInputTypes.find(R=>R.varName===u)?.inputType;s+=`$${o}: ${m}
187
+ `,t=new Q.Observable(r=>(this._wsClient.subscribe({query:s,variables:{sessionId:e}},{next:c=>r.next(c.data.statusUpdates),error:c=>r.error(c),complete:()=>r.complete()}),()=>{console.log("would unsub here")}));return this._pushStatusRequests.push({sessionId:e,observable:t}),t}};E(R,"GraphQLDataProvider");let S=R;const _=class _{constructor(){this._localStorage={}}async getItem(e){return new Promise(a=>{this._localStorage.hasOwnProperty(e)?a(this._localStorage[e]):a(null)})}async setItem(e,a){return new Promise(s=>{this._localStorage[e]=a,s()})}async remove(e){return new Promise(a=>{this._localStorage.hasOwnProperty(e)&&delete this._localStorage[e],a()})}};E(_,"BrowserStorageProviderBase");let F=_;const A="MJ_Metadata",g="Metadata_KVPairs",v=class v extends F{constructor(){super(),this.dbPromise=M.openDB(A,1,{upgrade(e){e.objectStoreNames.contains(g)||e.createObjectStore(g)}})}async setItem(e,a){const t=(await this.dbPromise).transaction(g,"readwrite");await t.objectStore(g).put(a,e),await t.done}async getItem(e){return await(await this.dbPromise).transaction(g).objectStore(g).get(e)}async remove(e){const s=(await this.dbPromise).transaction(g,"readwrite");await s.objectStore(g).delete(e),await s.done}};E(v,"BrowserIndexedDBStorageProvider");let C=v;const L=class L extends y.TransactionGroupBase{constructor(e){super()}async HandleSubmit(e){let a="",s="";const t={};for(let n=0;n<e.length;n++){const i=e[n];let p=i.Instruction;if(i.Vars){const f=Object.keys(i.Vars);for(let d=0;d<f.length;d++){const u=f[d],o=`${u}_${n}`;t[o]=i.Vars[u];const l=new RegExp("\\$"+u,"g");p=p.replace(l,"$"+o);const m=i.ExtraData.mutationInputTypes.find(h=>h.varName===u)?.inputType;s+=`$${o}: ${m}
188
188
  `}}a+=`mutation_${n}: `+p+`
189
189
  `}a=`mutation TransactionGroup(${s}){
190
190
  `+a+`
191
- }`;const r=await this._provider.ExecuteGQL(a,t),c=[];for(let n=0;n<e.length;n++){const i=r[`mutation_${n}`],p=e[n];c.push(new d.TransactionResult(p,i,i!==null))}return c}};E(L,"GraphQLTransactionGroup");let T=L;async function K(I){const e=new S;return d.BaseEntity.Provider=e,d.Metadata.Provider=e,d.RunView.Provider=e,d.RunReport.Provider=e,d.RunQuery.Provider=e,await e.Config(I),U.MJGlobal.Instance.RaiseEvent({event:U.MJEventType.LoggedIn,eventCode:null,component:this,args:null}),e}E(K,"setupGraphQLClient"),Object.defineProperty(exports,"gql",{enumerable:!0,get:function(){return w.gql}}),exports.FieldMapper=N,exports.GraphQLDataProvider=S,exports.GraphQLProviderConfigData=V,exports.setupGraphQLClient=K;
191
+ }`;const r=await this._provider.ExecuteGQL(a,t),c=[];for(let n=0;n<e.length;n++){const i=r[`mutation_${n}`],p=e[n];c.push(new y.TransactionResult(p,i,i!==null))}return c}};E(L,"GraphQLTransactionGroup");let T=L;async function K(I){const e=new S;return y.SetProvider(e),await e.Config(I),U.MJGlobal.Instance.RaiseEvent({event:U.MJEventType.LoggedIn,eventCode:null,component:this,args:null}),e}E(K,"setupGraphQLClient"),Object.defineProperty(exports,"gql",{enumerable:!0,get:function(){return w.gql}}),exports.FieldMapper=N,exports.GraphQLDataProvider=S,exports.GraphQLProviderConfigData=V,exports.setupGraphQLClient=K;
192
192
  //# sourceMappingURL=index.cjs.map