@memberjunction/graphql-dataprovider 2.73.0 → 2.75.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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0});import{gql as D,GraphQLClient as ue}from"graphql-request";import{gql as qe}from"graphql-request";import{TransactionGroupBase as we,TransactionResult as he,ProviderConfigDataBase as Se,ProviderBase as ge,LogError as m,UserInfo as le,ProviderType as Ee,BaseEntityResult as ce,EntityFieldTSType as E,TransactionItem as ye,UserRoleInfo as pe,SetProvider as Ne}from"@memberjunction/core";import{ViewInfo as me}from"@memberjunction/core-entities";import{openDB as Ie}from"@tempfix/idb";import{Observable as de}from"rxjs";import{createClient as De}from"graphql-ws";import{v4 as Ce}from"uuid";import{SafeJSONParse as C,MJGlobal as Ve,MJEventType as Ge}from"@memberjunction/global";const O=class O{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,s])=>s===e)?.[0]??e}ReverseMapFields(e){const t=Object.fromEntries(Object.entries(this._fieldMap).map(([s,r])=>[r,s]));for(const s in e)s in t&&(e[t[s]]=e[s],delete e[s]);return e}};w(O,"FieldMapper");let I=O;const k=class k extends we{constructor(e){super(),this._provider=e}async HandleSubmit(){const e=D`
1
+ var we=Object.defineProperty;var f=(p,e)=>we(p,"name",{value:e,configurable:!0});import{gql as w,GraphQLClient as ue}from"graphql-request";import{gql as qe}from"graphql-request";import{TransactionGroupBase as fe,TransactionResult as Se,ProviderConfigDataBase as he,ProviderBase as pe,LogError as D,UserInfo as le,ProviderType as Ee,BaseEntityResult as ce,EntityFieldTSType as E,TransactionItem as ye,UserRoleInfo as ge,SetProvider as Ie}from"@memberjunction/core";import{ViewInfo as me}from"@memberjunction/core-entities";import{openDB as Ne}from"@tempfix/idb";import{Observable as de}from"rxjs";import{createClient as De}from"graphql-ws";import{v4 as Ce}from"uuid";import{SafeJSONParse as C,MJGlobal as Ve,MJEventType as $e}from"@memberjunction/global";const b=class b{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,s])=>s===e)?.[0]??e}ReverseMapFields(e){const t=Object.fromEntries(Object.entries(this._fieldMap).map(([s,r])=>[r,s]));for(const s in e)s in t&&(e[t[s]]=e[s],delete e[s]);return e}};f(b,"FieldMapper");let N=b;const k=class k extends fe{constructor(e){super(),this._provider=e}async HandleSubmit(){const e=w`
2
2
  mutation ExecuteTransactionGroup($group: TransactionInputType!) {
3
3
  ExecuteTransactionGroup(group: $group) {
4
4
  Success
@@ -6,15 +6,15 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
6
6
  ResultsJSON
7
7
  }
8
8
  }
9
- `,t=[];for(const a of this.PendingTransactions)t.push({EntityName:a.BaseEntity.EntityInfo.Name,EntityObjectJSON:await a.BaseEntity.GetDataObjectJSON(),OperationType:a.OperationType});const s={group:{Items:t,Variables:this.Variables.map(a=>({Name:a.Name,ItemIndex:this.MapVariableEntityObjectToPosition(a),FieldName:a.FieldName,Type:a.Type}))}},r=await this._provider.ExecuteGQL(e,s);if(r&&r.ExecuteTransactionGroup){const a=r.ExecuteTransactionGroup,o=[];for(let n=0;n<this.PendingTransactions.length;n++){const i=a.ResultsJSON[n],R=C(i),f=this.PendingTransactions[n];o.push(new he(f,R,R!==null))}return o}else throw new Error("Failed to execute transaction group")}};w(k,"GraphQLTransactionGroup");let V=k;const J=class J extends Se{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 URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}constructor(e,t,s,r,a,o,n,i){super({Token:e,URL:t,WSURL:s,MJAPIKey:i,RefreshTokenFunction:r},a,o,n)}};w(J,"GraphQLProviderConfigData");let $=J;const S=class S extends ge{constructor(){super(),this._innerCurrentUserQueryString=`CurrentUser {
9
+ `,t=[];for(const a of this.PendingTransactions)t.push({EntityName:a.BaseEntity.EntityInfo.Name,EntityObjectJSON:await a.BaseEntity.GetDataObjectJSON(),OperationType:a.OperationType});const s={group:{Items:t,Variables:this.Variables.map(a=>({Name:a.Name,ItemIndex:this.MapVariableEntityObjectToPosition(a),FieldName:a.FieldName,Type:a.Type}))}},r=await this._provider.ExecuteGQL(e,s);if(r&&r.ExecuteTransactionGroup){const a=r.ExecuteTransactionGroup,o=[];for(let i=0;i<this.PendingTransactions.length;i++){const n=a.ResultsJSON[i],c=C(n),d=this.PendingTransactions[i];o.push(new Se(d,c,c!==null))}return o}else throw new Error("Failed to execute transaction group")}};f(k,"GraphQLTransactionGroup");let V=k;const J=class J extends he{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 URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}constructor(e,t,s,r,a,o,i,n){super({Token:e,URL:t,WSURL:s,MJAPIKey:n,RefreshTokenFunction:r},a,o,i)}};f(J,"GraphQLProviderConfigData");let G=J;const h=class h extends pe{constructor(){super(),this._innerCurrentUserQueryString=`CurrentUser {
10
10
  ${this.userInfoString()}
11
11
  UserRoles_UserIDArray {
12
12
  ${this.userRoleInfoString()}
13
13
  }
14
14
  }
15
- `,this._currentUserQuery=D`query CurrentUserAndRoles {
15
+ `,this._currentUserQuery=w`query CurrentUserAndRoles {
16
16
  ${this._innerCurrentUserQueryString}
17
- }`,this._wsClient=null,this._pushStatusRequests=[],S._instance||(S._instance=this)}static get Instance(){return S._instance}get ConfigData(){return this._configData}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return Ce()}get LocalStoragePrefix(){if(this._configData===void 0||this._configData.URL===void 0)throw new Error("GraphQLDataProvider: ConfigData is not set. Please call Config() first.");return this._configData.URL.replace(/[^a-zA-Z0-9]/g,"_")+"."}async GetStoredSessionID(){try{const e=this.LocalStorageProvider;if(e){const t=this.LocalStoragePrefix+"sessionId";return await e.GetItem(t)}return null}catch(e){return console.error("Error retrieving session ID from local storage:",e),null}}async SaveStoredSessionID(e){try{const t=this.LocalStorageProvider;if(t){const s=this.LocalStoragePrefix+"sessionId";await t.SetItem(s,e)}}catch{}}async GetPreferredUUID(e){const t=await this.GetStoredSessionID();return e||!t?this.GenerateUUID():t}async Config(e,t,s){try{return t?(this._configData=e,this._sessionId=await this.GetPreferredUUID(s),this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId,e.MJAPIKey),await this.SaveStoredSessionID(this._sessionId)):(S.Instance._configData=e,S.Instance._sessionId===void 0&&(S.Instance._sessionId=await this.GetPreferredUUID(s)),S.Instance._client||(S.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,S.Instance._sessionId,e.MJAPIKey)),await S.Instance.SaveStoredSessionID(S.Instance._sessionId)),super.Config(e)}catch(r){throw m(r),r}}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),s=t.UserRoles_UserIDArray.map(r=>this.ConvertBackToMJFields(r));return t.UserRoles_UserIDArray=s,new le(this,{...t,UserRoles:s})}}async RunReport(e,t){const s=D`
17
+ }`,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")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return Ce()}get LocalStoragePrefix(){if(this._configData===void 0||this._configData.URL===void 0)throw new Error("GraphQLDataProvider: ConfigData is not set. Please call Config() first.");return this._configData.URL.replace(/[^a-zA-Z0-9]/g,"_")+"."}async GetStoredSessionID(){try{const e=this.LocalStorageProvider;if(e){const t=this.LocalStoragePrefix+"sessionId";return await e.GetItem(t)}return null}catch(e){return console.error("Error retrieving session ID from local storage:",e),null}}async SaveStoredSessionID(e){try{const t=this.LocalStorageProvider;if(t){const s=this.LocalStoragePrefix+"sessionId";await t.SetItem(s,e)}}catch{}}async GetPreferredUUID(e){const t=await this.GetStoredSessionID();return e||!t?this.GenerateUUID():t}async Config(e,t,s){try{return t?(this._configData=e,this._sessionId=await this.GetPreferredUUID(s),this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId,e.MJAPIKey),await this.SaveStoredSessionID(this._sessionId)):(h.Instance._configData=e,h.Instance._sessionId===void 0&&(h.Instance._sessionId=await this.GetPreferredUUID(s)),h.Instance._client||(h.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,h.Instance._sessionId,e.MJAPIKey)),await h.Instance.SaveStoredSessionID(h.Instance._sessionId)),super.Config(e)}catch(r){throw D(r),r}}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),s=t.UserRoles_UserIDArray.map(r=>this.ConvertBackToMJFields(r));return t.UserRoles_UserIDArray=s,new le(this,{...t,UserRoles:s})}}async RunReport(e,t){const s=w`
18
18
  query GetReportDataQuery ($ReportID: String!) {
19
19
  GetReportData(ReportID: $ReportID) {
20
20
  Success
@@ -23,30 +23,32 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
23
23
  ExecutionTime
24
24
  ErrorMessage
25
25
  }
26
- }`,r=await this.ExecuteGQL(s,{ReportID:e.ReportID});if(r&&r.GetReportData)return{ReportID:e.ReportID,Success:r.GetReportData.Success,Results:JSON.parse(r.GetReportData.Results),RowCount:r.GetReportData.RowCount,ExecutionTime:r.GetReportData.ExecutionTime,ErrorMessage:r.GetReportData.ErrorMessage}}async RunQuery(e,t){if(e.QueryID)return this.RunQueryByID(e.QueryID,e.CategoryID,e.CategoryName,t);if(e.QueryName)return this.RunQueryByName(e.QueryName,e.CategoryID,e.CategoryName,t);throw new Error("No QueryID or QueryName provided to RunQuery")}async RunQueryByID(e,t,s,r){const a=D`
27
- query GetQueryDataQuery($QueryID: String!, $CategoryID: String, $CategoryName: String) {
28
- GetQueryData(QueryID: $QueryID, CategoryID: $CategoryID, CategoryName: $CategoryName) {
26
+ }`,r=await this.ExecuteGQL(s,{ReportID:e.ReportID});if(r&&r.GetReportData)return{ReportID:e.ReportID,Success:r.GetReportData.Success,Results:JSON.parse(r.GetReportData.Results),RowCount:r.GetReportData.RowCount,ExecutionTime:r.GetReportData.ExecutionTime,ErrorMessage:r.GetReportData.ErrorMessage}}async RunQuery(e,t){if(e.QueryID)return this.RunQueryByID(e.QueryID,e.CategoryID,e.CategoryName,t,e.Parameters,e.MaxRows,e.StartRow);if(e.QueryName)return this.RunQueryByName(e.QueryName,e.CategoryID,e.CategoryName,t,e.Parameters,e.MaxRows,e.StartRow);throw new Error("No QueryID or QueryName provided to RunQuery")}async RunQueryByID(e,t,s,r,a,o,i){const n=w`
27
+ query GetQueryDataQuery($QueryID: String!, $CategoryID: String, $CategoryName: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
28
+ GetQueryData(QueryID: $QueryID, CategoryID: $CategoryID, CategoryName: $CategoryName, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
29
29
  ${this.QueryReturnFieldList}
30
30
  }
31
31
  }
32
- `,o={QueryID:e};t!==void 0&&(o.CategoryID=t),s!==void 0&&(o.CategoryName=s);const n=await this.ExecuteGQL(a,o);if(n&&n.GetQueryData)return this.TransformQueryPayload(n.GetQueryData)}async RunQueryByName(e,t,s,r){const a=D`
33
- query GetQueryDataByNameQuery($QueryName: String!, $CategoryID: String, $CategoryName: String) {
34
- GetQueryDataByName(QueryName: $QueryName, CategoryID: $CategoryID, CategoryName: $CategoryName) {
32
+ `,c={QueryID:e};t!==void 0&&(c.CategoryID=t),s!==void 0&&(c.CategoryName=s),a!==void 0&&(c.Parameters=a),o!==void 0&&(c.MaxRows=o),i!==void 0&&(c.StartRow=i);const d=await this.ExecuteGQL(n,c);if(d&&d.GetQueryData)return this.TransformQueryPayload(d.GetQueryData)}async RunQueryByName(e,t,s,r,a,o,i){const n=w`
33
+ query GetQueryDataByNameQuery($QueryName: String!, $CategoryID: String, $CategoryName: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
34
+ GetQueryDataByName(QueryName: $QueryName, CategoryID: $CategoryID, CategoryName: $CategoryName, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
35
35
  ${this.QueryReturnFieldList}
36
36
  }
37
37
  }
38
- `,o={QueryName:e,CategoryID:t,CategoryName:s},n=await this.ExecuteGQL(a,o);if(n&&n.GetQueryDataByName)return this.TransformQueryPayload(n.GetQueryDataByName)}get QueryReturnFieldList(){return`
38
+ `,c={QueryName:e};t!==void 0&&(c.CategoryID=t),s!==void 0&&(c.CategoryName=s),a!==void 0&&(c.Parameters=a),o!==void 0&&(c.MaxRows=o),i!==void 0&&(c.StartRow=i);const d=await this.ExecuteGQL(n,c);if(d&&d.GetQueryDataByName)return this.TransformQueryPayload(d.GetQueryDataByName)}get QueryReturnFieldList(){return`
39
39
  Success
40
40
  QueryID
41
41
  QueryName
42
42
  Results
43
43
  RowCount
44
+ TotalRowCount
44
45
  ExecutionTime
45
- ErrorMessage`}TransformQueryPayload(e){try{return{QueryID:e.QueryID,QueryName:e.QueryName,Success:e.Success,Results:JSON.parse(e.Results),RowCount:e.RowCount,ExecutionTime:e.ExecutionTime,ErrorMessage:e.ErrorMessage}}catch(t){return m(`Error transforming query payload: ${t}`),null}}async RunView(e,t){try{let s="",r="";if(e){const a={};let o,n;if(e.ViewEntity)n=e.ViewEntity,o=n.Entity;else{const{entityName:u,v:l}=await this.getEntityNameAndUserView(e,t);n=l,o=u}const i=this.Entities.find(u=>u.Name===o);if(!i)throw new Error(`Entity ${o} not found in metadata`);let R=!1;e.ViewID?(s=`Run${i.ClassName}ViewByID`,r="RunViewByIDInput",a.ViewID=e.ViewID):e.ViewName?(s=`Run${i.ClassName}ViewByName`,r="RunViewByNameInput",a.ViewName=e.ViewName):(R=!0,s=`Run${i.ClassName}DynamicView`,r="RunDynamicViewInput",a.EntityName=e.EntityName),a.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",a.OrderBy=e.OrderBy?e.OrderBy:"",a.UserSearchString=e.UserSearchString?e.UserSearchString:"",a.Fields=e.Fields,a.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,a.MaxRows=e.MaxRows?e.MaxRows:0,a.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,a.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(a.AuditLogDescription=e.AuditLogDescription),R||(a.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",a.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,a.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",a.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1);const f=this.getViewRunTimeFieldList(i,n,e,R),y=D`
46
+ ErrorMessage
47
+ AppliedParameters`}TransformQueryPayload(e){try{return{QueryID:e.QueryID,QueryName:e.QueryName,Success:e.Success,Results:JSON.parse(e.Results),RowCount:e.RowCount,TotalRowCount:e.TotalRowCount,ExecutionTime:e.ExecutionTime,ErrorMessage:e.ErrorMessage,AppliedParameters:e.AppliedParameters?JSON.parse(e.AppliedParameters):void 0}}catch(t){return D(`Error transforming query payload: ${t}`),null}}async RunView(e,t){try{let s="",r="";if(e){const a={};let o,i;if(e.ViewEntity)i=e.ViewEntity,o=i.Entity;else{const{entityName:u,v:l}=await this.getEntityNameAndUserView(e,t);i=l,o=u}const n=this.Entities.find(u=>u.Name===o);if(!n)throw new Error(`Entity ${o} not found in metadata`);let c=!1;e.ViewID?(s=`Run${n.ClassName}ViewByID`,r="RunViewByIDInput",a.ViewID=e.ViewID):e.ViewName?(s=`Run${n.ClassName}ViewByName`,r="RunViewByNameInput",a.ViewName=e.ViewName):(c=!0,s=`Run${n.ClassName}DynamicView`,r="RunDynamicViewInput",a.EntityName=e.EntityName),a.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",a.OrderBy=e.OrderBy?e.OrderBy:"",a.UserSearchString=e.UserSearchString?e.UserSearchString:"",a.Fields=e.Fields,a.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,a.MaxRows=e.MaxRows?e.MaxRows:0,a.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,a.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(a.AuditLogDescription=e.AuditLogDescription),c||(a.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",a.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,a.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",a.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1);const d=this.getViewRunTimeFieldList(n,i,e,c),m=w`
46
48
  query RunViewQuery ($input: ${r}!) {
47
49
  ${s}(input: $input) {
48
50
  Results {
49
- ${f.join(`
51
+ ${d.join(`
50
52
  `)}
51
53
  }
52
54
  UserViewRunID
@@ -56,7 +58,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
56
58
  Success
57
59
  ErrorMessage
58
60
  }
59
- }`,c=await this.ExecuteGQL(y,{input:a});if(c&&c[s]){const u=c[s].Results;if(u&&u.length>0){const l=i.Fields.filter(d=>d.CodeName!==d.Name&&d.CodeName!==void 0);u.forEach(d=>{this.ConvertBackToMJFields(d),l.forEach(h=>{d[h.Name]=d[h.CodeName]})})}return c[s]}}else throw"No parameters passed to RunView";return null}catch(s){throw m(s),s}}async RunViews(e,t){try{let s=[],r=[],a=[];for(const i of e){let R="",f="";const y={};let c=null,u=null;if(i.ViewEntity)u=i.ViewEntity,c=u.Get("Entity");else{const{entityName:h,v:N}=await this.getEntityNameAndUserView(i,t);u=N,c=h}const l=this.Entities.find(h=>h.Name===c);if(!l)throw new Error(`Entity ${c} not found in metadata`);r.push(l);let d=!1;i.ViewID?(R=`Run${l.ClassName}ViewByID`,f="RunViewByIDInput",y.ViewID=i.ViewID):i.ViewName?(R=`Run${l.ClassName}ViewByName`,f="RunViewByNameInput",y.ViewName=i.ViewName):(d=!0,R=`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),d||(y.ExcludeUserViewRunID=i.ExcludeUserViewRunID||"",y.ExcludeDataFromAllPriorViewRuns=i.ExcludeDataFromAllPriorViewRuns||!1,y.OverrideExcludeFilter=i.OverrideExcludeFilter||"",y.SaveViewResults=i.SaveViewResults||!1),s.push(y),a.push(...this.getViewRunTimeFieldList(l,u,i,d))}const o=D`
61
+ }`,y=await this.ExecuteGQL(m,{input:a});if(y&&y[s]){const u=y[s].Results;if(u&&u.length>0){const l=n.Fields.filter(R=>R.CodeName!==R.Name&&R.CodeName!==void 0);u.forEach(R=>{this.ConvertBackToMJFields(R),l.forEach(S=>{R[S.Name]=R[S.CodeName]})})}return y[s]}}else throw"No parameters passed to RunView";return null}catch(s){throw D(s),s}}async RunViews(e,t){try{let s=[],r=[],a=[];for(const n of e){let c="",d="";const m={};let y=null,u=null;if(n.ViewEntity)u=n.ViewEntity,y=u.Get("Entity");else{const{entityName:S,v:I}=await this.getEntityNameAndUserView(n,t);u=I,y=S}const l=this.Entities.find(S=>S.Name===y);if(!l)throw new Error(`Entity ${y} not found in metadata`);r.push(l);let R=!1;n.ViewID?(c=`Run${l.ClassName}ViewByID`,d="RunViewByIDInput",m.ViewID=n.ViewID):n.ViewName?(c=`Run${l.ClassName}ViewByName`,d="RunViewByNameInput",m.ViewName=n.ViewName):(R=!0,c=`Run${l.ClassName}DynamicView`,d="RunDynamicViewInput",m.EntityName=n.EntityName),m.ExtraFilter=n.ExtraFilter||"",m.OrderBy=n.OrderBy||"",m.UserSearchString=n.UserSearchString||"",m.Fields=n.Fields,m.IgnoreMaxRows=n.IgnoreMaxRows||!1,m.MaxRows=n.MaxRows||0,m.ForceAuditLog=n.ForceAuditLog||!1,m.ResultType=n.ResultType||"simple",n.AuditLogDescription&&n.AuditLogDescription.length>0&&(m.AuditLogDescription=n.AuditLogDescription),R||(m.ExcludeUserViewRunID=n.ExcludeUserViewRunID||"",m.ExcludeDataFromAllPriorViewRuns=n.ExcludeDataFromAllPriorViewRuns||!1,m.OverrideExcludeFilter=n.OverrideExcludeFilter||"",m.SaveViewResults=n.SaveViewResults||!1),s.push(m),a.push(...this.getViewRunTimeFieldList(l,u,n,R))}const o=w`
60
62
  query RunViewsQuery ($input: [RunViewGenericInput!]!) {
61
63
  RunViews(input: $input) {
62
64
  Results {
@@ -71,7 +73,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
71
73
  Success
72
74
  ErrorMessage
73
75
  }
74
- }`,n=await this.ExecuteGQL(o,{input:s});if(n&&n.RunViews){const i=n.RunViews;for(const[R,f]of i.entries())f.Results=f.Results.map(y=>{let c=JSON.parse(y.Data);return this.ConvertBackToMJFields(c),c});return i}return null}catch(s){throw m(s),s}}async getEntityNameAndUserView(e,t){let s,r;if(e.EntityName)s=e.EntityName;else if(e.ViewID)r=await me.GetViewEntity(e.ViewID,t),s=r.Entity;else if(e.ViewName)r=await me.GetViewEntityByName(e.ViewName,t),s=r.Entity;else throw new Error("No EntityName, ViewID or ViewName passed to RunView");return{entityName:s,v:r}}getViewRunTimeFieldList(e,t,s,r){const a=[],o=new I;if(s.Fields){for(const n of e.PrimaryKeys)s.Fields.find(i=>i.trim().toLowerCase()===n.Name.toLowerCase())===void 0&&a.push(n.Name);s.Fields.forEach(n=>{a.push(o.MapFieldName(n))})}else if(r)e.Fields.forEach(n=>{n.IsBinaryFieldType||a.push(o.MapFieldName(n.CodeName))});else{for(const n of e.PrimaryKeys)a.find(i=>i.trim().toLowerCase()===n.Name.toLowerCase())===void 0&&a.push(n.Name);t.Columns.forEach(n=>{n.hidden===!1&&!a.find(i=>i.trim().toLowerCase()===n.EntityField?.Name.trim().toLowerCase())&&n.EntityField&&a.push(o.MapFieldName(n.EntityField.CodeName))})}return a}get ProviderType(){return Ee.Network}async GetRecordChanges(e,t){try{const s={EntityName:"Record Changes",ExtraFilter:`RecordID = '${t.Values()}' AND Entity = '${e}'`},r=await this.RunView(s);return r?r.Results.sort((a,o)=>a.ChangedAt>o.ChangedAt?-1:1):null}catch(s){throw m(s),s}}async GetRecordDependencies(e,t){try{const s=D`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
76
+ }`,i=await this.ExecuteGQL(o,{input:s});if(i&&i.RunViews){const n=i.RunViews;for(const[c,d]of n.entries())d.Results=d.Results.map(m=>{let y=JSON.parse(m.Data);return this.ConvertBackToMJFields(y),y});return n}return null}catch(s){throw D(s),s}}async getEntityNameAndUserView(e,t){let s,r;if(e.EntityName)s=e.EntityName;else if(e.ViewID)r=await me.GetViewEntity(e.ViewID,t),s=r.Entity;else if(e.ViewName)r=await me.GetViewEntityByName(e.ViewName,t),s=r.Entity;else throw new Error("No EntityName, ViewID or ViewName passed to RunView");return{entityName:s,v:r}}getViewRunTimeFieldList(e,t,s,r){const a=[],o=new N;if(s.Fields){for(const i of e.PrimaryKeys)s.Fields.find(n=>n.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&a.push(i.Name);s.Fields.forEach(i=>{a.push(o.MapFieldName(i))})}else if(r)e.Fields.forEach(i=>{i.IsBinaryFieldType||a.push(o.MapFieldName(i.CodeName))});else{for(const i of e.PrimaryKeys)a.find(n=>n.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&a.push(i.Name);t.Columns.forEach(i=>{i.hidden===!1&&!a.find(n=>n.trim().toLowerCase()===i.EntityField?.Name.trim().toLowerCase())&&i.EntityField&&a.push(o.MapFieldName(i.EntityField.CodeName))})}return a}get ProviderType(){return Ee.Network}async GetRecordChanges(e,t){try{const s={EntityName:"Record Changes",ExtraFilter:`RecordID = '${t.Values()}' AND Entity = '${e}'`},r=await this.RunView(s);return r?r.Results.sort((a,o)=>a.ChangedAt>o.ChangedAt?-1:1):null}catch(s){throw D(s),s}}async GetRecordDependencies(e,t){try{const s=w`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
75
77
  GetRecordDependencies(entityName: $entityName, CompositeKey: $CompositeKey) {
76
78
  EntityName
77
79
  RelatedEntityName
@@ -83,7 +85,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
83
85
  }
84
86
  }
85
87
  }
86
- }`,r={entityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.KeyValuePairs)}};return(await this.ExecuteGQL(s,r))?.GetRecordDependencies}catch(s){throw m(s),s}}ensureKeyValuePairValueIsString(e){return e.map(t=>({FieldName:t.FieldName,Value:t.Value.toString()}))}async GetRecordDuplicates(e,t){if(!e)return null;const s=D`query GetRecordDuplicatesQuery ($params: PotentialDuplicateRequestType!) {
88
+ }`,r={entityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.KeyValuePairs)}};return(await this.ExecuteGQL(s,r))?.GetRecordDependencies}catch(s){throw D(s),s}}ensureKeyValuePairValueIsString(e){return e.map(t=>({FieldName:t.FieldName,Value:t.Value.toString()}))}async GetRecordDuplicates(e,t){if(!e)return null;const s=w`query GetRecordDuplicatesQuery ($params: PotentialDuplicateRequestType!) {
87
89
  GetRecordDuplicates(params: $params) {
88
90
  Status
89
91
  ErrorMessage
@@ -105,7 +107,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
105
107
  }
106
108
  }
107
109
  }
108
- }`;let r={EntityID:e.EntityID,EntityDocumentID:e.EntityDocumentID,ListID:e.ListID,ProbabilityScore:e.ProbabilityScore,Options:e.Options,RecordIDs:e.RecordIDs.map(o=>o.Copy())};const a=await this.ExecuteGQL(s,{params:r});if(a&&a.GetRecordDuplicates)return a.GetRecordDuplicates}async MergeRecords(e){const t=this.Entities.find(s=>s.Name.trim().toLowerCase()===e.EntityName.trim().toLowerCase());if(!t||!t.AllowRecordMerge)throw new Error(`Entity ${e.EntityName} does not allow record merging, check the AllowRecordMerge property in the entity metadata`);try{const s=D`mutation MergeRecordsMutation ($request: RecordMergeRequest!) {
110
+ }`;let r={EntityID:e.EntityID,EntityDocumentID:e.EntityDocumentID,ListID:e.ListID,ProbabilityScore:e.ProbabilityScore,Options:e.Options,RecordIDs:e.RecordIDs.map(o=>o.Copy())};const a=await this.ExecuteGQL(s,{params:r});if(a&&a.GetRecordDuplicates)return a.GetRecordDuplicates}async MergeRecords(e){const t=this.Entities.find(s=>s.Name.trim().toLowerCase()===e.EntityName.trim().toLowerCase());if(!t||!t.AllowRecordMerge)throw new Error(`Entity ${e.EntityName} does not allow record merging, check the AllowRecordMerge property in the entity metadata`);try{const s=w`mutation MergeRecordsMutation ($request: RecordMergeRequest!) {
109
111
  MergeRecords(request: $request) {
110
112
  Success
111
113
  OverallStatus
@@ -122,32 +124,32 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
122
124
  Message
123
125
  }
124
126
  }
125
- }`,r={EntityName:e.EntityName,SurvivingRecordCompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(e.SurvivingRecordCompositeKey.KeyValuePairs)},FieldMap:e.FieldMap?.map(o=>({FieldName:o.FieldName,Value:o.Value.toString()})),RecordsToMerge:e.RecordsToMerge.map(o=>o.Copy())};return(await this.ExecuteGQL(s,{request:r}))?.MergeRecords}catch(s){return m(s),{Success:!1,OverallStatus:s&&s.message?s.message:s,RecordStatus:[],RecordMergeLogID:"",Request:e}}}async Save(e,t,s){const r=new ce;try{e.RegisterTransactionPreprocessing();const a={input:{}},o=e.IsSaved?"Update":"Create";r.StartedAt=new Date,r.Type=e.IsSaved?"update":"create",r.OriginalValues=e.Fields.map(c=>({FieldName:c.CodeName,Value:c.Value})),e.ResultHistory.push(r);const n=`${o}${e.EntityInfo.ClassName}`,i=e.Fields.filter(c=>!c.ReadOnly||c.IsPrimaryKey&&e.IsSaved),R=new I,f=` ${n}(input: $input) {
126
- ${e.Fields.map(c=>R.MapFieldName(c.CodeName)).join(`
127
+ }`,r={EntityName:e.EntityName,SurvivingRecordCompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(e.SurvivingRecordCompositeKey.KeyValuePairs)},FieldMap:e.FieldMap?.map(o=>({FieldName:o.FieldName,Value:o.Value.toString()})),RecordsToMerge:e.RecordsToMerge.map(o=>o.Copy())};return(await this.ExecuteGQL(s,{request:r}))?.MergeRecords}catch(s){return D(s),{Success:!1,OverallStatus:s&&s.message?s.message:s,RecordStatus:[],RecordMergeLogID:"",Request:e}}}async Save(e,t,s){const r=new ce;try{e.RegisterTransactionPreprocessing();const a={input:{}},o=e.IsSaved?"Update":"Create";r.StartedAt=new Date,r.Type=e.IsSaved?"update":"create",r.OriginalValues=e.Fields.map(y=>({FieldName:y.CodeName,Value:y.Value})),e.ResultHistory.push(r);const i=`${o}${e.EntityInfo.ClassName}`,n=e.Fields.filter(y=>!y.ReadOnly||y.IsPrimaryKey&&e.IsSaved),c=new N,d=` ${i}(input: $input) {
128
+ ${e.Fields.map(y=>c.MapFieldName(y.CodeName)).join(`
127
129
  `)}
128
- }`,y=D`mutation ${o}${e.EntityInfo.ClassName} ($input: ${n}Input!) {
129
- ${f}
130
+ }`,m=w`mutation ${o}${e.EntityInfo.ClassName} ($input: ${i}Input!) {
131
+ ${d}
130
132
  }
131
- `;for(let c=0;c<i.length;c++){const u=i[c];let l=u.Value;if(l)switch(u.EntityFieldInfo.TSType){case E.Date:l=l.getTime();break;case E.Boolean:typeof l!="boolean"&&(l=parseInt(l)!==0);break;case E.Number:if(typeof l!="number"){const d=Number(l);isNaN(d)||(l=d)}break}l===null&&u.EntityFieldInfo.AllowsNull===!1&&(u.EntityFieldInfo.DefaultValue!==null?l=u.EntityFieldInfo.DefaultValue:u.FieldType===E.Number||u.FieldType===E.Boolean?l=0:l=""),a.input[u.CodeName]=l}if(o.trim().toLowerCase()==="update"&&s.SkipOldValuesCheck===!1){const c=[];e.Fields.forEach(u=>{let l=null;u.OldValue!==null&&u.OldValue!==void 0&&(u.EntityFieldInfo.TSType===E.Date?l=u.OldValue.getTime().toString():u.EntityFieldInfo.TSType===E.Boolean?l=u.OldValue===!0?"1":"0":typeof u.OldValue!="string"?l=u.OldValue.toString():l=u.OldValue),c.push({Key:u.CodeName,Value:l})}),a.input.OldValues___=c}if(e.TransactionGroup){const c=[{varName:"input",inputType:n+"Input!"}];return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new ye(e,r.Type==="create"?"Create":"Update",f,a,{mutationName:n,mutationInputTypes:c},(u,l)=>{r.EndedAt=new Date,l&&u?(r.Success=!0,r.NewValues=this.ConvertBackToMJFields(u)):(r.Success=!1,r.Message="Transaction failed")})),!0}else{const c=await this.ExecuteGQL(y,a);if(c&&c[o+e.EntityInfo.ClassName])return r.Success=!0,r.EndedAt=new Date,r.NewValues=this.ConvertBackToMJFields(c[o+e.EntityInfo.ClassName]),r.NewValues;throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(a){return r.Success=!1,r.EndedAt=new Date,r.Message=a.response?.errors?.length>0?a.response.errors[0].message:a.message,m(a),null}}async Load(e,t,s=null,r){try{const a={};let o="",n="";for(let c=0;c<t.KeyValuePairs.length;c++){const u=e.Fields.find(h=>h.Name.trim().toLowerCase()===t.KeyValuePairs[c].FieldName.trim().toLowerCase()).EntityFieldInfo,l=t.GetValueByIndex(c),d=u.GraphQLType;if(n.length>0&&(n+=", "),n+=`$${u.CodeName}: ${d}!`,o.length>0&&(o+=", "),o+=`${u.CodeName}: $${u.CodeName}`,u.TSType===E.Number){if(isNaN(t.GetValueByIndex(c)))throw new Error(`Primary Key value ${l} (${u.Name}) is not a valid number`);a[u.CodeName]=parseInt(l)}else a[u.CodeName]=l}const i=s&&s.length>0?this.getRelatedEntityString(e.EntityInfo,s):"",R=new I,f=D`query Single${e.EntityInfo.ClassName}${i.length>0?"Full":""} (${n}) {
133
+ `;for(let y=0;y<n.length;y++){const u=n[y];let l=u.Value;if(l)switch(u.EntityFieldInfo.TSType){case E.Date:l=l.getTime();break;case E.Boolean:typeof l!="boolean"&&(l=parseInt(l)!==0);break;case E.Number:if(typeof l!="number"){const R=Number(l);isNaN(R)||(l=R)}break}l===null&&u.EntityFieldInfo.AllowsNull===!1&&(u.EntityFieldInfo.DefaultValue!==null?l=u.EntityFieldInfo.DefaultValue:u.FieldType===E.Number||u.FieldType===E.Boolean?l=0:l=""),a.input[u.CodeName]=l}if(o.trim().toLowerCase()==="update"&&s.SkipOldValuesCheck===!1){const y=[];e.Fields.forEach(u=>{let l=null;u.OldValue!==null&&u.OldValue!==void 0&&(u.EntityFieldInfo.TSType===E.Date?l=u.OldValue.getTime().toString():u.EntityFieldInfo.TSType===E.Boolean?l=u.OldValue===!0?"1":"0":typeof u.OldValue!="string"?l=u.OldValue.toString():l=u.OldValue),y.push({Key:u.CodeName,Value:l})}),a.input.OldValues___=y}if(e.TransactionGroup){const y=[{varName:"input",inputType:i+"Input!"}];return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new ye(e,r.Type==="create"?"Create":"Update",d,a,{mutationName:i,mutationInputTypes:y},(u,l)=>{r.EndedAt=new Date,l&&u?(r.Success=!0,r.NewValues=this.ConvertBackToMJFields(u)):(r.Success=!1,r.Message="Transaction failed")})),!0}else{const y=await this.ExecuteGQL(m,a);if(y&&y[o+e.EntityInfo.ClassName])return r.Success=!0,r.EndedAt=new Date,r.NewValues=this.ConvertBackToMJFields(y[o+e.EntityInfo.ClassName]),r.NewValues;throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(a){return r.Success=!1,r.EndedAt=new Date,r.Message=a.response?.errors?.length>0?a.response.errors[0].message:a.message,D(a),null}}async Load(e,t,s=null,r){try{const a={};let o="",i="";for(let y=0;y<t.KeyValuePairs.length;y++){const u=e.Fields.find(S=>S.Name.trim().toLowerCase()===t.KeyValuePairs[y].FieldName.trim().toLowerCase()).EntityFieldInfo,l=t.GetValueByIndex(y),R=u.GraphQLType;if(i.length>0&&(i+=", "),i+=`$${u.CodeName}: ${R}!`,o.length>0&&(o+=", "),o+=`${u.CodeName}: $${u.CodeName}`,u.TSType===E.Number){if(isNaN(t.GetValueByIndex(y)))throw new Error(`Primary Key value ${l} (${u.Name}) is not a valid number`);a[u.CodeName]=parseInt(l)}else a[u.CodeName]=l}const n=s&&s.length>0?this.getRelatedEntityString(e.EntityInfo,s):"",c=new N,d=w`query Single${e.EntityInfo.ClassName}${n.length>0?"Full":""} (${i}) {
132
134
  ${e.EntityInfo.ClassName}(${o}) {
133
- ${e.Fields.filter(c=>!c.EntityFieldInfo.IsBinaryFieldType).map(c=>c.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?c.CodeName.replace("__mj_","_mj__"):c.CodeName).join(`
135
+ ${e.Fields.filter(y=>!y.EntityFieldInfo.IsBinaryFieldType).map(y=>y.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?y.CodeName.replace("__mj_","_mj__"):y.CodeName).join(`
134
136
  `)}
135
- ${i}
137
+ ${n}
136
138
  }
137
139
  }
138
- `,y=await this.ExecuteGQL(f,a);return y&&y[e.EntityInfo.ClassName]?this.ConvertBackToMJFields(y[e.EntityInfo.ClassName]):null}catch(a){return m(a),null}}ConvertBackToMJFields(e){return new I().ReverseMapFields(e),e}getRelatedEntityString(e,t){let s="";for(let r=0;r<e.RelatedEntities.length;r++)if(t.indexOf(e.RelatedEntities[r].RelatedEntity)>=0){const a=e.RelatedEntities[r],o=this.Entities.find(i=>i.ID===a.RelatedEntityID);let n="";a.Type.toLowerCase().trim()==="many to many"?n=`${a.RelatedEntityCodeName}_${a.JoinEntityJoinField.replace(/\s/g,"")}`:n=`${a.RelatedEntityCodeName}_${a.RelatedEntityJoinField.replace(/\s/g,"")}`,s+=`
139
- ${n} {
140
- ${o.Fields.map(i=>i.CodeName).join(`
140
+ `,m=await this.ExecuteGQL(d,a);return m&&m[e.EntityInfo.ClassName]?this.ConvertBackToMJFields(m[e.EntityInfo.ClassName]):null}catch(a){return D(a),null}}ConvertBackToMJFields(e){return new N().ReverseMapFields(e),e}getRelatedEntityString(e,t){let s="";for(let r=0;r<e.RelatedEntities.length;r++)if(t.indexOf(e.RelatedEntities[r].RelatedEntity)>=0){const a=e.RelatedEntities[r],o=this.Entities.find(n=>n.ID===a.RelatedEntityID);let i="";a.Type.toLowerCase().trim()==="many to many"?i=`${a.RelatedEntityCodeName}_${a.JoinEntityJoinField.replace(/\s/g,"")}`:i=`${a.RelatedEntityCodeName}_${a.RelatedEntityJoinField.replace(/\s/g,"")}`,s+=`
141
+ ${i} {
142
+ ${o.Fields.map(n=>n.CodeName).join(`
141
143
  `)}
142
144
  }
143
- `}return s}async Delete(e,t,s){const r=new ce;try{e.RegisterTransactionPreprocessing(),r.StartedAt=new Date,r.Type="delete",r.OriginalValues=e.Fields.map(u=>({FieldName:u.CodeName,Value:u.Value})),e.ResultHistory.push(r);const a={},o=[];let n="",i="",R="";for(let u of e.PrimaryKey.KeyValuePairs){const l=e.Fields.find(d=>d.Name.trim().toLowerCase()===u.FieldName.trim().toLowerCase());a[l.CodeName]=l.Value,o.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}!`,R.length>0&&(R+=`
144
- `),R+=`${l.CodeName}`}o.push({varName:"options___",inputType:"DeleteOptionsInput!"}),a.options___=t||{SkipEntityAIActions:!1,SkipEntityActions:!1};const f="Delete"+e.EntityInfo.ClassName,y=D`${f}(${n}, options___: $options___) {
145
- ${R}
145
+ `}return s}async Delete(e,t,s){const r=new ce;try{e.RegisterTransactionPreprocessing(),r.StartedAt=new Date,r.Type="delete",r.OriginalValues=e.Fields.map(u=>({FieldName:u.CodeName,Value:u.Value})),e.ResultHistory.push(r);const a={},o=[];let i="",n="",c="";for(let u of e.PrimaryKey.KeyValuePairs){const l=e.Fields.find(R=>R.Name.trim().toLowerCase()===u.FieldName.trim().toLowerCase());a[l.CodeName]=l.Value,o.push({varName:l.CodeName,inputType:l.EntityFieldInfo.GraphQLType+"!"}),i.length>0&&(i+=", "),i+=`${l.CodeName}: $${l.CodeName}`,n.length>0&&(n+=", "),n+=`$${l.CodeName}: ${l.EntityFieldInfo.GraphQLType}!`,c.length>0&&(c+=`
146
+ `),c+=`${l.CodeName}`}o.push({varName:"options___",inputType:"DeleteOptionsInput!"}),a.options___=t||{SkipEntityAIActions:!1,SkipEntityActions:!1};const d="Delete"+e.EntityInfo.ClassName,m=w`${d}(${i}, options___: $options___) {
147
+ ${c}
146
148
  }
147
- `,c=D`mutation ${f} (${i}, $options___: DeleteOptionsInput!) {
148
- ${y}
149
+ `,y=w`mutation ${d} (${n}, $options___: DeleteOptionsInput!) {
150
+ ${m}
149
151
  }
150
- `;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new ye(e,"Delete",y,a,{mutationName:f,mutationInputTypes:o},(u,l)=>{if(r.EndedAt=new Date,l&&u){let d=!0;for(const h of e.PrimaryKey.KeyValuePairs)h.Value!==u[h.FieldName]&&(d=!1);d?r.Success=!0:(r.Success=!1,r.Message="Transaction failed to commit")}else r.Success=!1,r.Message="Transaction failed to commit"})),!0;{const u=await this.ExecuteGQL(c,a);if(u&&u[f]){const l=u[f];for(let d of e.PrimaryKey.KeyValuePairs){let h=l[d.FieldName],N=d.Value;if(typeof N=="number"&&(N=N.toString()),typeof h=="number"&&(h=h.toString()),N!==h)throw new Error(`Primary key value mismatch in server Delete response. Field: ${d.FieldName}, Original: ${N}, Returned: ${h}`)}return r.Success=!0,r.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(a){return r.EndedAt=new Date,r.Success=!1,r.Message=a.response?.errors?.length>0?a.response.errors[0].message:a.message,m(a),!1}}async GetDatasetByName(e,t){const s=D`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
152
+ `;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new ye(e,"Delete",m,a,{mutationName:d,mutationInputTypes:o},(u,l)=>{if(r.EndedAt=new Date,l&&u){let R=!0;for(const S of e.PrimaryKey.KeyValuePairs)S.Value!==u[S.FieldName]&&(R=!1);R?r.Success=!0:(r.Success=!1,r.Message="Transaction failed to commit")}else r.Success=!1,r.Message="Transaction failed to commit"})),!0;{const u=await this.ExecuteGQL(y,a);if(u&&u[d]){const l=u[d];for(let R of e.PrimaryKey.KeyValuePairs){let S=l[R.FieldName],I=R.Value;if(typeof I=="number"&&(I=I.toString()),typeof S=="number"&&(S=S.toString()),I!==S)throw new Error(`Primary key value mismatch in server Delete response. Field: ${R.FieldName}, Original: ${I}, Returned: ${S}`)}return r.Success=!0,r.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(a){return r.EndedAt=new Date,r.Success=!1,r.Message=a.response?.errors?.length>0?a.response.errors[0].message:a.message,D(a),!1}}async GetDatasetByName(e,t){const s=w`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
151
153
  GetDatasetByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
152
154
  DatasetID
153
155
  DatasetName
@@ -156,7 +158,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
156
158
  LatestUpdateDate
157
159
  Results
158
160
  }
159
- }`,r=await this.ExecuteGQL(s,{DatasetName:e,ItemFilters:t});return r&&r.GetDatasetByName&&r.GetDatasetByName.Success?{DatasetID:r.GetDatasetByName.DatasetID,DatasetName:r.GetDatasetByName.DatasetName,Success:r.GetDatasetByName.Success,Status:r.GetDatasetByName.Status,LatestUpdateDate:new Date(r.GetDatasetByName.LatestUpdateDate),Results:JSON.parse(r.GetDatasetByName.Results)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,Results:null}}async GetDatasetStatusByName(e,t){const s=D`query GetDatasetStatusByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
161
+ }`,r=await this.ExecuteGQL(s,{DatasetName:e,ItemFilters:t});return r&&r.GetDatasetByName&&r.GetDatasetByName.Success?{DatasetID:r.GetDatasetByName.DatasetID,DatasetName:r.GetDatasetByName.DatasetName,Success:r.GetDatasetByName.Success,Status:r.GetDatasetByName.Status,LatestUpdateDate:new Date(r.GetDatasetByName.LatestUpdateDate),Results:JSON.parse(r.GetDatasetByName.Results)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,Results:null}}async GetDatasetStatusByName(e,t){const s=w`query GetDatasetStatusByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
160
162
  GetDatasetStatusByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
161
163
  DatasetID
162
164
  DatasetName
@@ -165,22 +167,22 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
165
167
  LatestUpdateDate
166
168
  EntityUpdateDates
167
169
  }
168
- }`,r=await this.ExecuteGQL(s,{DatasetName:e,ItemFilters:t});return r&&r.GetDatasetStatusByName&&r.GetDatasetStatusByName.Success?{DatasetID:r.GetDatasetStatusByName.DatasetID,DatasetName:r.GetDatasetStatusByName.DatasetName,Success:r.GetDatasetStatusByName.Success,Status:r.GetDatasetStatusByName.Status,LatestUpdateDate:new Date(r.GetDatasetStatusByName.LatestUpdateDate),EntityUpdateDates:JSON.parse(r.GetDatasetStatusByName.EntityUpdateDates)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,EntityUpdateDates:null}}async CreateTransactionGroup(){return new V(this)}async GetRecordFavoriteStatus(e,t,s){if(!s.Validate().IsValid)return!1;const a=this.Entities.find(i=>i.Name===t);if(!a)throw new Error(`Entity ${t} not found in metadata`);const o=D`query GetRecordFavoriteStatus($params: UserFavoriteSearchParams!) {
170
+ }`,r=await this.ExecuteGQL(s,{DatasetName:e,ItemFilters:t});return r&&r.GetDatasetStatusByName&&r.GetDatasetStatusByName.Success?{DatasetID:r.GetDatasetStatusByName.DatasetID,DatasetName:r.GetDatasetStatusByName.DatasetName,Success:r.GetDatasetStatusByName.Success,Status:r.GetDatasetStatusByName.Status,LatestUpdateDate:new Date(r.GetDatasetStatusByName.LatestUpdateDate),EntityUpdateDates:JSON.parse(r.GetDatasetStatusByName.EntityUpdateDates)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,EntityUpdateDates:null}}async CreateTransactionGroup(){return new V(this)}async GetRecordFavoriteStatus(e,t,s){if(!s.Validate().IsValid)return!1;const a=this.Entities.find(n=>n.Name===t);if(!a)throw new Error(`Entity ${t} not found in metadata`);const o=w`query GetRecordFavoriteStatus($params: UserFavoriteSearchParams!) {
169
171
  GetRecordFavoriteStatus(params: $params) {
170
172
  Success
171
173
  IsFavorite
172
174
  }
173
- }`,n=await this.ExecuteGQL(o,{params:{UserID:e,EntityID:a.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(s.KeyValuePairs)}}});if(n&&n.GetRecordFavoriteStatus&&n.GetRecordFavoriteStatus.Success)return n.GetRecordFavoriteStatus.IsFavorite}async SetRecordFavoriteStatus(e,t,s,r,a){const o=this.Entities.find(R=>R.Name===t);if(!o)throw new Error(`Entity ${t} not found in metadata`);const n=D`mutation SetRecordFavoriteStatus($params: UserFavoriteSetParams!) {
175
+ }`,i=await this.ExecuteGQL(o,{params:{UserID:e,EntityID:a.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(s.KeyValuePairs)}}});if(i&&i.GetRecordFavoriteStatus&&i.GetRecordFavoriteStatus.Success)return i.GetRecordFavoriteStatus.IsFavorite}async SetRecordFavoriteStatus(e,t,s,r,a){const o=this.Entities.find(c=>c.Name===t);if(!o)throw new Error(`Entity ${t} not found in metadata`);const i=w`mutation SetRecordFavoriteStatus($params: UserFavoriteSetParams!) {
174
176
  SetRecordFavoriteStatus(params: $params){
175
177
  Success
176
178
  }
177
- }`,i=await this.ExecuteGQL(n,{params:{UserID:e,EntityID:o.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(s.KeyValuePairs)},IsFavorite:r}});if(i&&i.SetRecordFavoriteStatus!==null)return i.SetRecordFavoriteStatus.Success}async GetEntityRecordName(e,t){if(!e||!t||t.KeyValuePairs?.length===0)return null;const s=D`query GetEntityRecordNameQuery ($EntityName: String!, $CompositeKey: CompositeKeyInputType!) {
179
+ }`,n=await this.ExecuteGQL(i,{params:{UserID:e,EntityID:o.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(s.KeyValuePairs)},IsFavorite:r}});if(n&&n.SetRecordFavoriteStatus!==null)return n.SetRecordFavoriteStatus.Success}async GetEntityRecordName(e,t){if(!e||!t||t.KeyValuePairs?.length===0)return null;const s=w`query GetEntityRecordNameQuery ($EntityName: String!, $CompositeKey: CompositeKeyInputType!) {
178
180
  GetEntityRecordName(EntityName: $EntityName, CompositeKey: $CompositeKey) {
179
181
  Success
180
182
  Status
181
183
  RecordName
182
184
  }
183
- }`,r=await this.ExecuteGQL(s,{EntityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.KeyValuePairs)}});if(r&&r.GetEntityRecordName&&r.GetEntityRecordName.Success)return r.GetEntityRecordName.RecordName}async GetEntityRecordNames(e){if(!e)return null;const t=D`query GetEntityRecordNamesQuery ($info: [EntityRecordNameInput!]!) {
185
+ }`,r=await this.ExecuteGQL(s,{EntityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.KeyValuePairs)}});if(r&&r.GetEntityRecordName&&r.GetEntityRecordName.Success)return r.GetEntityRecordName.RecordName}async GetEntityRecordNames(e){if(!e)return null;const t=w`query GetEntityRecordNamesQuery ($info: [EntityRecordNameInput!]!) {
184
186
  GetEntityRecordNames(info: $info) {
185
187
  Success
186
188
  Status
@@ -193,35 +195,35 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
193
195
  EntityName
194
196
  RecordName
195
197
  }
196
- }`,s=await this.ExecuteGQL(t,{info:e.map(r=>({EntityName:r.EntityName,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.CompositeKey.KeyValuePairs)}}))});if(s&&s.GetEntityRecordNames)return s.GetEntityRecordNames}async GetDataContextData(e){try{const t=D`query GetDataContextData ($DataContextID: String!) {
198
+ }`,s=await this.ExecuteGQL(t,{info:e.map(r=>({EntityName:r.EntityName,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.CompositeKey.KeyValuePairs)}}))});if(s&&s.GetEntityRecordNames)return s.GetEntityRecordNames}async GetDataContextData(e){try{const t=w`query GetDataContextData ($DataContextID: String!) {
197
199
  GetDataContextData(DataContextID: $DataContextID) {
198
200
  Success
199
201
  ErrorMessages
200
202
  Results
201
203
  }
202
- }`,s=await this.ExecuteGQL(t,{DataContextID:e});if(s&&s.GetDataContextData){if(s.GetDataContextData.Success)return s.GetDataContextData.Results.map(r=>JSON.parse(r));throw new Error(s.GetDataContextData.ErrorMessages.join(", "))}else throw new Error("GraphQL query failed")}catch(t){throw m(t),t}}async GetDataContextItemData(e){try{const t=D`query GetDataContextItemData ($DataContextItemID: String!) {
204
+ }`,s=await this.ExecuteGQL(t,{DataContextID:e});if(s&&s.GetDataContextData){if(s.GetDataContextData.Success)return s.GetDataContextData.Results.map(r=>JSON.parse(r));throw new Error(s.GetDataContextData.ErrorMessages.join(", "))}else throw new Error("GraphQL query failed")}catch(t){throw D(t),t}}async GetDataContextItemData(e){try{const t=w`query GetDataContextItemData ($DataContextItemID: String!) {
203
205
  GetDataContextItemData(DataContextItemID: $DataContextItemID) {
204
206
  Success
205
207
  ErrorMessage
206
208
  Result
207
209
  }
208
- }`,s=await this.ExecuteGQL(t,{DataContextItemID:e});if(s&&s.GetDataContextItemData){if(s.GetDataContextItemData.Success)return JSON.parse(s.GetDataContextItemData.Result);throw new Error(s.GetDataContextItemData.ErrorMessage)}else throw new Error("GraphQL query failed")}catch(t){throw m(t),t}}static async ExecuteGQL(e,t,s=!0){return S.Instance.ExecuteGQL(e,t,s)}async ExecuteGQL(e,t,s=!0){try{return await this._client.request(e,t)}catch(r){if(r&&r.response&&r.response.errors?.length>0)if(r.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(s)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw m("JWT_EXPIRED and refreshTokenIfNeeded is false"),r}else throw r;else throw m(r),r}}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,this._configData.MJAPIKey);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 S.Instance.RefreshToken()}CreateNewGraphQLClient(e,t,s,r){const a={"x-session-id":s};return t&&(a.authorization="Bearer "+t),r&&(a["x-mj-api-key"]=r),new ue(e,{headers:a})}userInfoString(){return this.infoString(new le(null,null))}userRoleInfoString(){return this.infoString(new pe(null))}infoString(e){let t="";const s=Object.keys(e);for(const r of s)r.startsWith("__mj_")?t+=r.replace("__mj_","_mj__")+`
210
+ }`,s=await this.ExecuteGQL(t,{DataContextItemID:e});if(s&&s.GetDataContextItemData){if(s.GetDataContextItemData.Success)return JSON.parse(s.GetDataContextItemData.Result);throw new Error(s.GetDataContextItemData.ErrorMessage)}else throw new Error("GraphQL query failed")}catch(t){throw D(t),t}}static async ExecuteGQL(e,t,s=!0){return h.Instance.ExecuteGQL(e,t,s)}async ExecuteGQL(e,t,s=!0){try{return await this._client.request(e,t)}catch(r){if(r&&r.response&&r.response.errors?.length>0)if(r.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(s)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw D("JWT_EXPIRED and refreshTokenIfNeeded is false"),r}else throw r;else throw D(r),r}}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,this._configData.MJAPIKey);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,t,s,r){const a={"x-session-id":s};return t&&(a.authorization="Bearer "+t),r&&(a["x-mj-api-key"]=r),new ue(e,{headers:a})}userInfoString(){return this.infoString(new le(null,null))}userRoleInfoString(){return this.infoString(new ge(null))}infoString(e){let t="";const s=Object.keys(e);for(const r of s)r.startsWith("__mj_")?t+=r.replace("__mj_","_mj__")+`
209
211
  `:r.startsWith("_")||(t+=r+`
210
- `);return t}get LocalStorageProvider(){return this._localStorageProvider||(this._localStorageProvider=new F),this._localStorageProvider}get Metadata(){return this}subscribe(e,t){return this._wsClient||(this._wsClient=De({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token}})),new de(s=>{const r=this._wsClient.subscribe({query:e,variables:t},{next:a=>{s.next(a.data)},error:a=>{s.error(a)},complete:()=>{s.complete()}});return()=>{r()}})}PushStatusUpdates(e=null){e||(e=this.sessionId),this._wsClient||(this._wsClient=De({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token}}));const t=this._pushStatusRequests.find(a=>a.sessionId===e);if(t)return t.observable;const s=D`subscription StatusUpdates($sessionId: String!) {
212
+ `);return t}get LocalStorageProvider(){return this._localStorageProvider||(this._localStorageProvider=new x),this._localStorageProvider}get Metadata(){return this}subscribe(e,t){return this._wsClient||(this._wsClient=De({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token}})),new de(s=>{const r=this._wsClient.subscribe({query:e,variables:t},{next:a=>{s.next(a.data)},error:a=>{s.error(a)},complete:()=>{s.complete()}});return()=>{r()}})}PushStatusUpdates(e=null){e||(e=this.sessionId),this._wsClient||(this._wsClient=De({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token}}));const t=this._pushStatusRequests.find(a=>a.sessionId===e);if(t)return t.observable;const s=w`subscription StatusUpdates($sessionId: String!) {
211
213
  statusUpdates(sessionId: $sessionId) {
212
214
  date
213
215
  message
214
216
  sessionId
215
217
  }
216
218
  }
217
- `,r=new de(a=>(this._wsClient.subscribe({query:s,variables:{sessionId:e}},{next:o=>a.next(o.data.statusUpdates),error:o=>a.error(o),complete:()=>a.complete()}),()=>{console.log("would unsub here")}));return this._pushStatusRequests.push({sessionId:e,observable:r}),r}};w(S,"GraphQLDataProvider");let G=S;const j=class j{constructor(){this._localStorage={}}async GetItem(e){return new Promise(t=>{this._localStorage.hasOwnProperty(e)?t(this._localStorage[e]):t(null)})}async SetItem(e,t){return new Promise(s=>{this._localStorage[e]=t,s()})}async Remove(e){return new Promise(t=>{this._localStorage.hasOwnProperty(e)&&delete this._localStorage[e],t()})}};w(j,"BrowserStorageProviderBase");let U=j;const $e="MJ_Metadata",p="Metadata_KVPairs",W=class W extends U{constructor(){super(),this.dbPromise=Ie($e,1,{upgrade(e){e.objectStoreNames.contains(p)||e.createObjectStore(p)}})}async setItem(e,t){const r=(await this.dbPromise).transaction(p,"readwrite");await r.objectStore(p).put(t,e),await r.done}async getItem(e){return await(await this.dbPromise).transaction(p).objectStore(p).get(e)}async remove(e){const s=(await this.dbPromise).transaction(p,"readwrite");await s.objectStore(p).delete(e),await s.done}};w(W,"BrowserIndexedDBStorageProvider");let F=W;async function Ue(g){const e=new G;return Ne(e),await e.Config(g),Ve.Instance.RaiseEvent({event:Ge.LoggedIn,eventCode:null,component:this,args:null}),e}w(Ue,"setupGraphQLClient");const z=class z{};w(z,"SyncRolesAndUsersResult");let T=z;const H=class H{};w(H,"RoleInput");let x=H;const X=class X{};w(X,"UserInput");let Q=X;const Z=class Z{};w(Z,"RolesAndUsersInput");let v=Z;var Re=(g=>(g.Create="Create",g.Update="Update",g.CreateOrUpdate="CreateOrUpdate",g.Delete="Delete",g.DeleteWithFilter="DeleteWithFilter",g))(Re||{});const Y=class Y{};w(Y,"ActionItemInput");let P=Y;const ee=class ee{constructor(){this.Results=[]}};w(ee,"SyncDataResult");let M=ee;const te=class te{};w(te,"ActionItemOutput");let L=te;const se=class se{get Client(){return this._client}constructor(e,t,s,r){const a={"x-session-id":s};t&&(a.authorization="Bearer "+t),r&&(a["x-mj-api-key"]=r),this._client=new ue(e,{headers:a})}async GetData(e,t){try{const r=await this.Client.request(`query GetData($input: GetDataInputType!) {
219
+ `,r=new de(a=>(this._wsClient.subscribe({query:s,variables:{sessionId:e}},{next:o=>a.next(o.data.statusUpdates),error:o=>a.error(o),complete:()=>a.complete()}),()=>{console.log("would unsub here")}));return this._pushStatusRequests.push({sessionId:e,observable:r}),r}};f(h,"GraphQLDataProvider");let $=h;const j=class j{constructor(){this._localStorage={}}async GetItem(e){return new Promise(t=>{this._localStorage.hasOwnProperty(e)?t(this._localStorage[e]):t(null)})}async SetItem(e,t){return new Promise(s=>{this._localStorage[e]=t,s()})}async Remove(e){return new Promise(t=>{this._localStorage.hasOwnProperty(e)&&delete this._localStorage[e],t()})}};f(j,"BrowserStorageProviderBase");let T=j;const Ge="MJ_Metadata",g="Metadata_KVPairs",W=class W extends T{constructor(){super(),this.dbPromise=Ne(Ge,1,{upgrade(e){e.objectStoreNames.contains(g)||e.createObjectStore(g)}})}async setItem(e,t){const r=(await this.dbPromise).transaction(g,"readwrite");await r.objectStore(g).put(t,e),await r.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}};f(W,"BrowserIndexedDBStorageProvider");let x=W;async function Te(p){const e=new $;return Ie(e),await e.Config(p),Ve.Instance.RaiseEvent({event:$e.LoggedIn,eventCode:null,component:this,args:null}),e}f(Te,"setupGraphQLClient");const z=class z{};f(z,"SyncRolesAndUsersResult");let Q=z;const H=class H{};f(H,"RoleInput");let P=H;const X=class X{};f(X,"UserInput");let U=X;const Z=class Z{};f(Z,"RolesAndUsersInput");let v=Z;var Re=(p=>(p.Create="Create",p.Update="Update",p.CreateOrUpdate="CreateOrUpdate",p.Delete="Delete",p.DeleteWithFilter="DeleteWithFilter",p))(Re||{});const Y=class Y{};f(Y,"ActionItemInput");let F=Y;const ee=class ee{constructor(){this.Results=[]}};f(ee,"SyncDataResult");let M=ee;const te=class te{};f(te,"ActionItemOutput");let L=te;const se=class se{get Client(){return this._client}constructor(e,t,s,r){const a={"x-session-id":s};t&&(a.authorization="Bearer "+t),r&&(a["x-mj-api-key"]=r),this._client=new ue(e,{headers:a})}async GetData(e,t){try{const r=await this.Client.request(`query GetData($input: GetDataInputType!) {
218
220
  GetData(input: $input) {
219
221
  Success
220
222
  ErrorMessages
221
223
  Queries
222
224
  Results
223
225
  }
224
- }`,{input:{Queries:e,Token:"nope"}});return r&&r.GetData?{Success:r.GetData.Success,Results:r.GetData.Results.map(a=>a?C(a):null),ErrorMessages:r.GetData.ErrorMessages,Queries:r.GetData.Queries}:{Success:!1,Results:[],ErrorMessages:r.GetData?.ErrorMessages??["Unknown error"],Queries:r.GetData?.Queries??e}}catch(s){const r=`GraphQLSystemUserClient::GetData - Error getting geta - ${s}`;return m(r),{Success:!1,Results:[],ErrorMessages:[r],Queries:e}}}async GetAllRemoteEntities(){try{const t=await this.Client.request(`query GetAllEntities {
226
+ }`,{input:{Queries:e,Token:"nope"}});return r&&r.GetData?{Success:r.GetData.Success,Results:r.GetData.Results.map(a=>a?C(a):null),ErrorMessages:r.GetData.ErrorMessages,Queries:r.GetData.Queries}:{Success:!1,Results:[],ErrorMessages:r.GetData?.ErrorMessages??["Unknown error"],Queries:r.GetData?.Queries??e}}catch(s){const r=`GraphQLSystemUserClient::GetData - Error getting geta - ${s}`;return D(r),{Success:!1,Results:[],ErrorMessages:[r],Queries:e}}}async GetAllRemoteEntities(){try{const t=await this.Client.request(`query GetAllEntities {
225
227
  GetAllEntities {
226
228
  Success
227
229
  ErrorMessage
@@ -244,7 +246,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
244
246
  }
245
247
  }
246
248
  }
247
- }`);return t&&t.GetAllEntities?t.GetAllEntities:{Success:!1,Results:[],ErrorMessage:t.GetAllEntities?.ErrorMessage??"Unknown error"}}catch(e){return m(`GraphQLSystemUserClient::GetAllRemoteEntities - Error getting remote entities - ${e}`),{Success:!1,Results:[],ErrorMessage:e}}}async SyncData(e){try{const s=await this.Client.request(`mutation SyncData($items: [ActionItemInputType!]!) {
249
+ }`);return t&&t.GetAllEntities?t.GetAllEntities:{Success:!1,Results:[],ErrorMessage:t.GetAllEntities?.ErrorMessage??"Unknown error"}}catch(e){return D(`GraphQLSystemUserClient::GetAllRemoteEntities - Error getting remote entities - ${e}`),{Success:!1,Results:[],ErrorMessage:e}}}async SyncData(e){try{const s=await this.Client.request(`mutation SyncData($items: [ActionItemInputType!]!) {
248
250
  SyncData(items: $items) {
249
251
  Success
250
252
  Results {
@@ -268,11 +270,11 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
268
270
  RecordJSON
269
271
  }
270
272
  }
271
- }`,{items:e});return s&&s.SyncData?s.SyncData:{Success:!1,Results:[]}}catch(t){return m(`GraphQLSystemUserClient::SyncData - Error syncing data - ${t}`),{Success:!1,Results:[]}}}async SyncRolesAndUsers(e){try{const s=await this.Client.request(`mutation SyncRolesAndUsers($data: RolesAndUsersInputType!) {
273
+ }`,{items:e});return s&&s.SyncData?s.SyncData:{Success:!1,Results:[]}}catch(t){return D(`GraphQLSystemUserClient::SyncData - Error syncing data - ${t}`),{Success:!1,Results:[]}}}async SyncRolesAndUsers(e){try{const s=await this.Client.request(`mutation SyncRolesAndUsers($data: RolesAndUsersInputType!) {
272
274
  SyncRolesAndUsers(data: $data) {
273
275
  Success
274
276
  }
275
- }`,{data:e});return s&&s.SyncRolesAndUsers?s.SyncRolesAndUsers:{Success:!1}}catch(t){return m(`GraphQLSystemUserClient::SyncRolesAndUsers - Error syncing roles and users - ${t}`),{Success:!1}}}async RunViewByNameSystemUser(e){try{const s=await this.Client.request(`query RunViewByNameSystemUser($input: RunViewByNameInput!) {
277
+ }`,{data:e});return s&&s.SyncRolesAndUsers?s.SyncRolesAndUsers:{Success:!1}}catch(t){return D(`GraphQLSystemUserClient::SyncRolesAndUsers - Error syncing roles and users - ${t}`),{Success:!1}}}async RunViewByNameSystemUser(e){try{const s=await this.Client.request(`query RunViewByNameSystemUser($input: RunViewByNameInput!) {
276
278
  RunViewByNameSystemUser(input: $input) {
277
279
  Results {
278
280
  ID
@@ -286,7 +288,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
286
288
  ErrorMessage
287
289
  Success
288
290
  }
289
- }`,{input:e});return s&&s.RunViewByNameSystemUser?s.RunViewByNameSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by name"}}catch(t){return m(`GraphQLSystemUserClient::RunViewByNameSystemUser - Error running view by name - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunViewByIDSystemUser(e){try{const s=await this.Client.request(`query RunViewByIDSystemUser($input: RunViewByIDInput!) {
291
+ }`,{input:e});return s&&s.RunViewByNameSystemUser?s.RunViewByNameSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by name"}}catch(t){return D(`GraphQLSystemUserClient::RunViewByNameSystemUser - Error running view by name - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunViewByIDSystemUser(e){try{const s=await this.Client.request(`query RunViewByIDSystemUser($input: RunViewByIDInput!) {
290
292
  RunViewByIDSystemUser(input: $input) {
291
293
  Results {
292
294
  ID
@@ -300,7 +302,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
300
302
  ErrorMessage
301
303
  Success
302
304
  }
303
- }`,{input:e});return s&&s.RunViewByIDSystemUser?s.RunViewByIDSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by ID"}}catch(t){return m(`GraphQLSystemUserClient::RunViewByIDSystemUser - Error running view by ID - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunDynamicViewSystemUser(e){try{const s=await this.Client.request(`query RunDynamicViewSystemUser($input: RunDynamicViewInput!) {
305
+ }`,{input:e});return s&&s.RunViewByIDSystemUser?s.RunViewByIDSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by ID"}}catch(t){return D(`GraphQLSystemUserClient::RunViewByIDSystemUser - Error running view by ID - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunDynamicViewSystemUser(e){try{const s=await this.Client.request(`query RunDynamicViewSystemUser($input: RunDynamicViewInput!) {
304
306
  RunDynamicViewSystemUser(input: $input) {
305
307
  Results {
306
308
  ID
@@ -314,7 +316,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
314
316
  ErrorMessage
315
317
  Success
316
318
  }
317
- }`,{input:e});return s&&s.RunDynamicViewSystemUser?s.RunDynamicViewSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute dynamic view"}}catch(t){return m(`GraphQLSystemUserClient::RunDynamicViewSystemUser - Error running dynamic view - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunViewsSystemUser(e){try{const s=await this.Client.request(`query RunViewsSystemUser($input: [RunViewGenericInput!]!) {
319
+ }`,{input:e});return s&&s.RunDynamicViewSystemUser?s.RunDynamicViewSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute dynamic view"}}catch(t){return D(`GraphQLSystemUserClient::RunDynamicViewSystemUser - Error running dynamic view - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunViewsSystemUser(e){try{const s=await this.Client.request(`query RunViewsSystemUser($input: [RunViewGenericInput!]!) {
318
320
  RunViewsSystemUser(input: $input) {
319
321
  Results {
320
322
  ID
@@ -328,27 +330,37 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
328
330
  ErrorMessage
329
331
  Success
330
332
  }
331
- }`,{input:e});return s&&s.RunViewsSystemUser?s.RunViewsSystemUser:[]}catch(t){return m(`GraphQLSystemUserClient::RunViewsSystemUser - Error running views - ${t}`),[]}}async GetQueryDataSystemUser(e,t,s){try{const a=await this.Client.request(`query GetQueryDataSystemUser($QueryID: String!, $CategoryID: String, $CategoryName: String) {
332
- GetQueryDataSystemUser(QueryID: $QueryID, CategoryID: $CategoryID, CategoryName: $CategoryName) {
333
+ }`,{input:e});return s&&s.RunViewsSystemUser?s.RunViewsSystemUser:[]}catch(t){return D(`GraphQLSystemUserClient::RunViewsSystemUser - Error running views - ${t}`),[]}}async GetQueryDataSystemUser(e,t,s,r,a,o){try{const i=`query GetQueryDataSystemUser($QueryID: String!, $CategoryID: String, $CategoryName: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
334
+ GetQueryDataSystemUser(QueryID: $QueryID, CategoryID: $CategoryID, CategoryName: $CategoryName, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
333
335
  QueryID
334
336
  QueryName
335
337
  Success
336
338
  Results
337
339
  RowCount
340
+ TotalRowCount
338
341
  ExecutionTime
339
342
  ErrorMessage
343
+ AppliedParameters
340
344
  }
341
- }`,{QueryID:e,CategoryID:t,CategoryName:s});return a&&a.GetQueryDataSystemUser?{...a.GetQueryDataSystemUser,Results:a.GetQueryDataSystemUser.Results?C(a.GetQueryDataSystemUser.Results):null}:{QueryID:e,QueryName:"",Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(r){return m(`GraphQLSystemUserClient::GetQueryDataSystemUser - Error executing query - ${r}`),{QueryID:e,QueryName:"",Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:r.toString()}}}async GetQueryDataByNameSystemUser(e,t,s){try{const a=await this.Client.request(`query GetQueryDataByNameSystemUser($QueryName: String!, $CategoryID: String, $CategoryName: String) {
342
- GetQueryDataByNameSystemUser(QueryName: $QueryName, CategoryID: $CategoryID, CategoryName: $CategoryName) {
345
+ }`,n={QueryID:e};t!==void 0&&(n.CategoryID=t),s!==void 0&&(n.CategoryName=s),r!==void 0&&(n.Parameters=r),a!==void 0&&(n.MaxRows=a),o!==void 0&&(n.StartRow=o);const c=await this.Client.request(i,n);return c&&c.GetQueryDataSystemUser?{...c.GetQueryDataSystemUser,Results:c.GetQueryDataSystemUser.Results?C(c.GetQueryDataSystemUser.Results):null}:{QueryID:e,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(i){return D(`GraphQLSystemUserClient::GetQueryDataSystemUser - Error executing query - ${i}`),{QueryID:e,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:i.toString()}}}async GetQueryDataByNameSystemUser(e,t,s,r,a,o){try{const i=`query GetQueryDataByNameSystemUser($QueryName: String!, $CategoryID: String, $CategoryName: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
346
+ GetQueryDataByNameSystemUser(QueryName: $QueryName, CategoryID: $CategoryID, CategoryName: $CategoryName, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
343
347
  QueryID
344
348
  QueryName
345
349
  Success
346
350
  Results
347
351
  RowCount
352
+ TotalRowCount
348
353
  ExecutionTime
349
354
  ErrorMessage
355
+ AppliedParameters
356
+ }
357
+ }`,n={QueryName:e};t!==void 0&&(n.CategoryID=t),s!==void 0&&(n.CategoryName=s),r!==void 0&&(n.Parameters=r),a!==void 0&&(n.MaxRows=a),o!==void 0&&(n.StartRow=o);const c=await this.Client.request(i,n);return c&&c.GetQueryDataByNameSystemUser?{...c.GetQueryDataByNameSystemUser,Results:c.GetQueryDataByNameSystemUser.Results?C(c.GetQueryDataByNameSystemUser.Results):null}:{QueryID:"",QueryName:e,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(i){return D(`GraphQLSystemUserClient::GetQueryDataByNameSystemUser - Error executing query - ${i}`),{QueryID:"",QueryName:e,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:i.toString()}}}async CreateQuery(e){try{const s=await this.Client.request(`mutation CreateQuery($input: CreateQueryInputType!) {
358
+ CreateQuery(input: $input) {
359
+ Success
360
+ ErrorMessage
361
+ QueryData
350
362
  }
351
- }`,{QueryName:e,CategoryID:t,CategoryName:s});return a&&a.GetQueryDataByNameSystemUser?{...a.GetQueryDataByNameSystemUser,Results:a.GetQueryDataByNameSystemUser.Results?C(a.GetQueryDataByNameSystemUser.Results):null}:{QueryID:"",QueryName:e,Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(r){return m(`GraphQLSystemUserClient::GetQueryDataByNameSystemUser - Error executing query - ${r}`),{QueryID:"",QueryName:e,Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:r.toString()}}}};w(se,"GraphQLSystemUserClient");let A=se;const re=class re{};w(re,"GetDataOutput");let _=re;const ae=class ae{};w(ae,"SimpleRemoteEntityOutput");let B=ae;const ne=class ne{};w(ne,"SimpleRemoteEntity");let q=ne;const ie=class ie{};w(ie,"SimpleRemoteEntityField");let K=ie;const oe=class oe{constructor(e){this._dataProvider=e}async RunAction(e,t,s=!1){try{const r=this.serializeActionParameters(t),a=this.createActionVariables(e,r,s),o=await this.executeActionMutation(a);return this.processActionResult(o,t)}catch(r){return this.handleActionError(r,t)}}serializeActionParameters(e){if(e)return e.map(t=>{let s=t.Value;return s!=null&&typeof s=="object"&&(s=JSON.stringify(s)),{...t,Value:s}})}createActionVariables(e,t,s=!1){return{input:{ActionID:e,Params:t,SkipActionLog:s}}}async executeActionMutation(e){const t=D`
363
+ }`,{input:e});return s&&s.CreateQuery?s.CreateQuery.Success&&s.CreateQuery.QueryData?{...s.CreateQuery,QueryData:s.CreateQuery.QueryData}:s.CreateQuery:{Success:!1,ErrorMessage:"Failed to create query"}}catch(t){return D(`GraphQLSystemUserClient::CreateQuery - Error creating query - ${t}`),{Success:!1,ErrorMessage:t.toString()}}}};f(se,"GraphQLSystemUserClient");let A=se;const re=class re{};f(re,"GetDataOutput");let _=re;const ae=class ae{};f(ae,"SimpleRemoteEntityOutput");let B=ae;const ne=class ne{};f(ne,"SimpleRemoteEntity");let q=ne;const ie=class ie{};f(ie,"SimpleRemoteEntityField");let O=ie;const oe=class oe{constructor(e){this._dataProvider=e}async RunAction(e,t,s=!1){try{const r=this.serializeActionParameters(t),a=this.createActionVariables(e,r,s),o=await this.executeActionMutation(a);return this.processActionResult(o,t)}catch(r){return this.handleActionError(r,t)}}serializeActionParameters(e){if(e)return e.map(t=>{let s=t.Value;return s!=null&&typeof s=="object"&&(s=JSON.stringify(s)),{...t,Value:s}})}createActionVariables(e,t,s=!1){return{input:{ActionID:e,Params:t,SkipActionLog:s}}}async executeActionMutation(e){const t=w`
352
364
  mutation RunAction($input: RunActionInput!) {
353
365
  RunAction(input: $input) {
354
366
  Success
@@ -357,7 +369,7 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
357
369
  ResultData
358
370
  }
359
371
  }
360
- `;return await this._dataProvider.ExecuteGQL(t,e)}processActionResult(e,t){if(!e?.RunAction)throw new Error("Invalid response from server");let s;try{e.RunAction.ResultData&&(s=JSON.parse(e.RunAction.ResultData))}catch(r){m(`Failed to parse action result data: ${r}`)}return{Success:e.RunAction.Success,Message:e.RunAction.Message,Result:s,LogEntry:null,Params:t||[],RunParams:null}}handleActionError(e,t){const s=e;return m(`Error running action: ${s}`),{Success:!1,Message:`Error: ${s.message}`,Result:null,LogEntry:null,Params:t||[],RunParams:null}}async RunEntityAction(e){try{const t=this.createEntityActionInput(e),s=await this.executeEntityActionMutation(t);return this.processEntityActionResult(s)}catch(t){return this.handleEntityActionError(t)}}createEntityActionInput(e){const t={EntityActionID:e.EntityAction.ID,InvocationType:e.InvocationType.Name,ListID:e.ListID,ViewID:e.ViewID};return e.Params&&(t.Params=this.convertActionParams(e.Params)),e.EntityObject&&this.addEntityInformation(t,e.EntityObject),t}convertActionParams(e){return e.map(t=>{let s=t.Value;return s!=null&&typeof s=="object"&&(s=JSON.stringify(s)),{Name:t.Name,Value:s,Type:t.Type}})}addEntityInformation(e,t){e.EntityName=t.EntityInfo?.Name,t.PrimaryKey&&(e.PrimaryKey=this.convertPrimaryKey(t.PrimaryKey))}convertPrimaryKey(e){return{KeyValuePairs:e.KeyValuePairs.map(t=>this.convertKeyValuePair(t))}}convertKeyValuePair(e){return{FieldName:e.FieldName,Value:e.Value!==null&&e.Value!==void 0?typeof e.Value=="object"?JSON.stringify(e.Value):e.Value.toString():null}}async executeEntityActionMutation(e){const t=D`
372
+ `;return await this._dataProvider.ExecuteGQL(t,e)}processActionResult(e,t){if(!e?.RunAction)throw new Error("Invalid response from server");let s;try{e.RunAction.ResultData&&(s=JSON.parse(e.RunAction.ResultData))}catch(r){D(`Failed to parse action result data: ${r}`)}return{Success:e.RunAction.Success,Message:e.RunAction.Message,Result:s,LogEntry:null,Params:t||[],RunParams:null}}handleActionError(e,t){const s=e;return D(`Error running action: ${s}`),{Success:!1,Message:`Error: ${s.message}`,Result:null,LogEntry:null,Params:t||[],RunParams:null}}async RunEntityAction(e){try{const t=this.createEntityActionInput(e),s=await this.executeEntityActionMutation(t);return this.processEntityActionResult(s)}catch(t){return this.handleEntityActionError(t)}}createEntityActionInput(e){const t={EntityActionID:e.EntityAction.ID,InvocationType:e.InvocationType.Name,ListID:e.ListID,ViewID:e.ViewID};return e.Params&&(t.Params=this.convertActionParams(e.Params)),e.EntityObject&&this.addEntityInformation(t,e.EntityObject),t}convertActionParams(e){return e.map(t=>{let s=t.Value;return s!=null&&typeof s=="object"&&(s=JSON.stringify(s)),{Name:t.Name,Value:s,Type:t.Type}})}addEntityInformation(e,t){e.EntityName=t.EntityInfo?.Name,t.PrimaryKey&&(e.PrimaryKey=this.convertPrimaryKey(t.PrimaryKey))}convertPrimaryKey(e){return{KeyValuePairs:e.KeyValuePairs.map(t=>this.convertKeyValuePair(t))}}convertKeyValuePair(e){return{FieldName:e.FieldName,Value:e.Value!==null&&e.Value!==void 0?typeof e.Value=="object"?JSON.stringify(e.Value):e.Value.toString():null}}async executeEntityActionMutation(e){const t=w`
361
373
  mutation RunEntityAction($input: EntityActionInput!) {
362
374
  RunEntityAction(input: $input) {
363
375
  Success
@@ -365,5 +377,5 @@ var fe=Object.defineProperty;var w=(g,e)=>fe(g,"name",{value:e,configurable:!0})
365
377
  ResultData
366
378
  }
367
379
  }
368
- `;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(s){m(`Failed to parse entity action result data: ${s}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return m(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}};w(oe,"GraphQLActionClient");let b=oe;export{P as ActionItemInput,L as ActionItemOutput,I as FieldMapper,_ as GetDataOutput,b as GraphQLActionClient,G as GraphQLDataProvider,$ as GraphQLProviderConfigData,A as GraphQLSystemUserClient,V as GraphQLTransactionGroup,x as RoleInput,v as RolesAndUsersInput,q as SimpleRemoteEntity,K as SimpleRemoteEntityField,B as SimpleRemoteEntityOutput,Re as SyncDataAction,M as SyncDataResult,T as SyncRolesAndUsersResult,Q as UserInput,qe as gql,Ue as setupGraphQLClient};
380
+ `;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(s){D(`Failed to parse entity action result data: ${s}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return D(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}};f(oe,"GraphQLActionClient");let K=oe;export{F as ActionItemInput,L as ActionItemOutput,N as FieldMapper,_ as GetDataOutput,K as GraphQLActionClient,$ as GraphQLDataProvider,G as GraphQLProviderConfigData,A as GraphQLSystemUserClient,V as GraphQLTransactionGroup,P as RoleInput,v as RolesAndUsersInput,q as SimpleRemoteEntity,O as SimpleRemoteEntityField,B as SimpleRemoteEntityOutput,Re as SyncDataAction,M as SyncDataResult,Q as SyncRolesAndUsersResult,U as UserInput,qe as gql,Te as setupGraphQLClient};
369
381
  //# sourceMappingURL=index.mjs.map