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