@memberjunction/graphql-dataprovider 6.2.0-edge.2 → 6.2.0-edge.3
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 +260 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +316 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +316 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +328 -139
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var re=Object.defineProperty;var l=(d,e)=>re(d,"name",{value:e,configurable:!0});var u=require("graphql-request"),c=require("@memberjunction/core"),v=require("@memberjunction/global"),V=require("@memberjunction/core-entities"),w=require("rxjs"),se=require("graphql-ws"),ne=require("uuid"),ae=require("@tempfix/idb");class N{static{l(this,"FieldMapper")}static{this.DB_PREFIX="__mj_"}static{this.GQL_PREFIX="_mj__"}constructor(){}MapFields(e){if(e)for(const t in e){const r=this.MapFieldName(t);r!==t&&(e[r]=e[t],delete e[t])}return e}MapFieldName(e){return e.startsWith(N.DB_PREFIX)?N.GQL_PREFIX+e.substring(N.DB_PREFIX.length):e}ReverseMapFieldName(e){return e.startsWith(N.GQL_PREFIX)?N.DB_PREFIX+e.substring(N.GQL_PREFIX.length):e}ReverseMapFields(e){for(const t in e){const r=this.ReverseMapFieldName(t);r!==t&&(e[r]=e[t],delete e[t])}return e}}class k extends c.TransactionGroupBase{static{l(this,"GraphQLTransactionGroup")}constructor(e){super(),this._provider=e}async HandleSubmit(){const e=u.gql`
|
|
2
2
|
mutation ExecuteTransactionGroup($group: TransactionInputType!) {
|
|
3
3
|
ExecuteTransactionGroup(group: $group) {
|
|
4
4
|
Success
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
ResultsJSON
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`,t=[];for(const n of this.PendingTransactions)t.push({EntityName:n.BaseEntity.EntityInfo.Name,EntityObjectJSON:await n.BaseEntity.GetDataObjectJSON(),OperationType:n.OperationType});const r={group:{Items:t,Variables:this.Variables.map(n=>({Name:n.Name,ItemIndex:this.MapVariableEntityObjectToPosition(n),FieldName:n.FieldName,Type:n.Type}))}},s=await this._provider.ExecuteGQL(e,r);if(s&&s.ExecuteTransactionGroup){const n=s.ExecuteTransactionGroup,a=n.Success===!0,i=[];for(let o=0;o<this.PendingTransactions.length;o++){const y=n.ResultsJSON[o],g=v.SafeJSONParse(y),m=this.PendingTransactions[o];a||this.recordServerFailure(m.BaseEntity,n.ErrorMessages?.[o]),i.push(new c.TransactionResult(m,g,a&&g!==null))}return i}else throw new Error("Failed to execute transaction group")}recordServerFailure(e,t){const r=v.SafeJSONParse(t??"");if(!r||r.Success!==!1)return;const s=r.Message?.trim();if(!s&&(r.Errors?.length??0)===0)return;const n=new c.BaseEntityResult;n.Success=!1,n.Type=r.Type??(e.IsSaved?"update":"create"),n.Message=s??null,n.Errors=r.Errors??[],n.StartedAt=new Date,n.EndedAt=new Date,e.RegisterResultHistoryEntry(n)}}const
|
|
9
|
+
`,t=[];for(const n of this.PendingTransactions)t.push({EntityName:n.BaseEntity.EntityInfo.Name,EntityObjectJSON:await n.BaseEntity.GetDataObjectJSON(),OperationType:n.OperationType});const r={group:{Items:t,Variables:this.Variables.map(n=>({Name:n.Name,ItemIndex:this.MapVariableEntityObjectToPosition(n),FieldName:n.FieldName,Type:n.Type}))}},s=await this._provider.ExecuteGQL(e,r);if(s&&s.ExecuteTransactionGroup){const n=s.ExecuteTransactionGroup,a=n.Success===!0,i=[];for(let o=0;o<this.PendingTransactions.length;o++){const y=n.ResultsJSON[o],g=v.SafeJSONParse(y),m=this.PendingTransactions[o];a||this.recordServerFailure(m.BaseEntity,n.ErrorMessages?.[o]),i.push(new c.TransactionResult(m,g,a&&g!==null))}return i}else throw new Error("Failed to execute transaction group")}recordServerFailure(e,t){const r=v.SafeJSONParse(t??"");if(!r||r.Success!==!1)return;const s=r.Message?.trim();if(!s&&(r.Errors?.length??0)===0)return;const n=new c.BaseEntityResult;n.Success=!1,n.Type=r.Type??(e.IsSaved?"update":"create"),n.Message=s??null,n.Errors=r.Errors??[],n.StartedAt=new Date,n.EndedAt=new Date,e.RegisterResultHistoryEntry(n)}}const oe=180*1e3,ie=6;class ${static{l(this,"FireAndForgetHelper")}static async Execute(e){const t=e.operationLabel??e.mutationFieldName;if(!(typeof e.dataProvider.PushStatusUpdates=="function"))return $.executeSynchronously(e);const s=e.timeoutMs??oe,n=e.maxStallReconciles??ie;let a,i=!1,o=0;const{promise:y,resolve:g,reject:m}=$.createCompletionPromise(),I=l(p=>{i||(i=!0,h.clear(),p())},"finish"),S=l(p=>I(()=>g(p)),"settleResolve"),E=l(p=>I(()=>m(p)),"settleReject"),D=l(async()=>{if(i)return;if(!e.onStall){E(new Error($.timeoutMessage(e.timeoutErrorMessage,s)));return}let p;try{c.LogStatus(`[FireAndForget:${t}] Idle window elapsed, reconciling against server run record`),p=await e.onStall()}catch(R){E(R);return}i||(p==="continue"?++o>n?E(new Error(`The operation is still reported as running but no signal has arrived after ${o} checks. Please refresh the page to check the latest status.`)):h.reset():"resolve"in p?(c.LogStatus(`[FireAndForget:${t}] Reconciliation recovered a completed run`),S(p.resolve)):E(p.reject))},"onStall"),h=$.createIdleTimer(s,()=>{D()});try{h.reset(),a=$.subscribeToPubSub(e,{onActivity:l(()=>{o=0,h.reset()},"onActivity"),onCompletion:l(R=>S(R),"onCompletion"),onStreamEnd:l(()=>{D()},"onStreamEnd")});const p=await $.executeMutation(e);if(!e.validateAck(p)){h.clear();const R=p?.errorMessage??"Server rejected the request";return c.LogError(`[FireAndForget:${t}] Server rejected: ${R}`),e.createErrorResult(R)}return c.LogStatus(`[FireAndForget:${t}] Server accepted, waiting for completion via WebSocket`),await y}catch(p){const R=p;throw c.LogError(`[FireAndForget:${t}] Error: ${R.message}`),p}finally{h.clear(),a&&a.unsubscribe()}}static createCompletionPromise(){let e,t;return{promise:new Promise((s,n)=>{e=s,t=n}),resolve:e,reject:t}}static createIdleTimer(e,t){let r;return{reset:l(()=>{r&&clearTimeout(r),r=setTimeout(t,e)},"reset"),clear:l(()=>{r&&clearTimeout(r),r=void 0},"clear")}}static timeoutMessage(e,t){const r=Math.round(t/6e4);return e??`The operation may still be running on the server but the client received no updates for ${r} minutes. Please refresh the page to check the latest status.`}static subscribeToPubSub(e,t){const r=e.dataProvider.sessionId,s=e.operationLabel??e.mutationFieldName;return e.dataProvider.PushStatusUpdates(r).subscribe({next:l(n=>{let a;try{a=JSON.parse(n)}catch(i){console.error(`[FireAndForget:${s}] Failed to parse PubSub message:`,i),t.onActivity();return}(!e.isRelevantMessage||e.isRelevantMessage(a))&&t.onActivity();try{e.onMessage&&e.onMessage(a),e.isCompletionEvent(a)&&(c.LogStatus(`[FireAndForget:${s}] Completion event received`),t.onCompletion(e.extractResult(a)))}catch(i){console.error(`[FireAndForget:${s}] Failed to route PubSub message:`,i)}},"next"),error:l(()=>t.onStreamEnd(),"error"),complete:l(()=>t.onStreamEnd(),"complete")})}static async executeMutation(e){return(await e.dataProvider.ExecuteGQL(e.mutation,e.variables))[e.mutationFieldName]}static async executeSynchronously(e){const t=e.operationLabel??e.mutationFieldName;c.LogStatus(`[FireAndForget:${t}] Provider has no PushStatusUpdates channel \u2014 running synchronously (fireAndForget disabled)`);const r={...e.variables,fireAndForget:!1},n=(await e.dataProvider.ExecuteGQL(e.mutation,r))?.[e.mutationFieldName];return n?e.extractSyncResult?(c.LogStatus(`[FireAndForget:${t}] Synchronous execution completed`),e.extractSyncResult(n)):e.createErrorResult(`${t} cannot run on this data provider: it has no PushStatusUpdates channel and no synchronous result extractor is configured for this operation.`):(c.LogError(`[FireAndForget:${t}] Synchronous execution returned no '${e.mutationFieldName}' payload`),e.createErrorResult(`Server returned no '${e.mutationFieldName}' result for ${t}`))}}class K{static{l(this,"GraphQLAIClient")}constructor(e){this._dataProvider=e}async RunAIPrompt(e){try{const t=u.gql`
|
|
10
10
|
mutation RunAIPrompt(
|
|
11
11
|
$promptId: String!,
|
|
12
12
|
$data: String,
|
|
@@ -353,14 +353,14 @@
|
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
`,r={entityName:e.EntityName,valuesJSON:JSON.stringify(e.Values)},s=await this._dataProvider.ExecuteGQL(t,r);return this.processDuplicateEntryCheckResult(s)}catch(t){return this.handleDuplicateEntryCheckError(t)}}processDuplicateEntryCheckResult(e){const t=e?.CheckDuplicateEntry;if(!t)throw new Error("Invalid response from server");const r=t.ElapsedMs??void 0;if(!this.isDuplicateEntryCheckStatus(t.Status))return{Status:"Failed",ErrorMessage:`The server returned an unknown status '${t.Status}'`,Candidates:[],ElapsedMs:r};const s={Status:t.Status,Candidates:(t.Candidates??[]).map(n=>({RecordID:n.RecordID,DisplayName:n.DisplayName,VectorScore:n.VectorScore,Probability:n.Probability??null})),ElapsedMs:r};return t.ErrorMessage&&(s.ErrorMessage=t.ErrorMessage),s}isDuplicateEntryCheckStatus(e){return e==="Checked"||e==="NotConfigured"||e==="NotAuthorized"||e==="Failed"}handleDuplicateEntryCheckError(e){const t=e instanceof Error?e.message:String(e);return c.LogError(`Error checking for a duplicate entry: ${t}`),{Status:"Failed",ErrorMessage:t||"Unknown error occurred",Candidates:[]}}}const
|
|
357
|
-
${e.stackFrames}`:this.stack}}function
|
|
358
|
-
at `);return e===-1?"":d.slice(e+1)}l(
|
|
356
|
+
`,r={entityName:e.EntityName,valuesJSON:JSON.stringify(e.Values)},s=await this._dataProvider.ExecuteGQL(t,r);return this.processDuplicateEntryCheckResult(s)}catch(t){return this.handleDuplicateEntryCheckError(t)}}processDuplicateEntryCheckResult(e){const t=e?.CheckDuplicateEntry;if(!t)throw new Error("Invalid response from server");const r=t.ElapsedMs??void 0;if(!this.isDuplicateEntryCheckStatus(t.Status))return{Status:"Failed",ErrorMessage:`The server returned an unknown status '${t.Status}'`,Candidates:[],ElapsedMs:r};const s={Status:t.Status,Candidates:(t.Candidates??[]).map(n=>({RecordID:n.RecordID,DisplayName:n.DisplayName,VectorScore:n.VectorScore,Probability:n.Probability??null})),ElapsedMs:r};return t.ErrorMessage&&(s.ErrorMessage=t.ErrorMessage),s}isDuplicateEntryCheckStatus(e){return e==="Checked"||e==="NotConfigured"||e==="NotAuthorized"||e==="Failed"}handleDuplicateEntryCheckError(e){const t=e instanceof Error?e.message:String(e);return c.LogError(`Error checking for a duplicate entry: ${t}`),{Status:"Failed",ErrorMessage:t||"Unknown error occurred",Candidates:[]}}}const A="6.2.0-edge.3",P="default";class B{static{l(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}get SharesReferences(){return!0}get SupportsCrossProcessPersistence(){return!1}getCategoryMap(e){const t=e||P;let r=this._storage.get(t);return r||(r=new Map,this._storage.set(t,r)),r}async GetItem(e,t){const s=this.getCategoryMap(t||P).get(e);return s===void 0?null:s}async GetItems(e,t){const r=new Map;if(e.length===0)return r;const s=this.getCategoryMap(t||P);for(const n of new Set(e)){const a=s.get(n);r.set(n,a===void 0?null:a)}return r}async SetItem(e,t,r){this.getCategoryMap(r||P).set(e,t)}async Remove(e,t){this.getCategoryMap(t||P).delete(e)}async ClearCategory(e){const t=e||P;this._storage.delete(t)}async GetCategoryKeys(e){const t=this._storage.get(e||P);return t?Array.from(t.keys()):[]}}const ce="MJ_Metadata",ue=0;function le(){try{const d=A.split("."),e=parseInt(d[0],10),t=parseInt(d[1],10);if(!Number.isFinite(e)||!Number.isFinite(t))throw new Error(`Could not parse major.minor from version "${A}"`);return e*1e3+t+ue}catch(d){return c.LogErrorEx({error:d,message:"Failed to derive IDB version from PACKAGE_VERSION; using fallback 99999"}),99999}}l(le,"computeIdbVersion");const de=le(),j=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"];class J extends B{static{l(this,"BrowserIndexedDBStorageProvider")}constructor(){super(),this._dbReady=!1,this.dbPromise=ae.openDB(ce,de,{upgrade:l((e,t,r)=>{try{c.LogStatus(`[IDBCache] Upgrading IndexedDB schema v${t} \u2192 v${r} (package ${A}). Dropping all stores; caches will repopulate on first use.`);for(const s of Array.from(e.objectStoreNames))e.deleteObjectStore(s);for(const s of j)e.objectStoreNames.contains(s)||e.createObjectStore(s)}catch(s){c.LogErrorEx({error:s,message:s?.message})}},"upgrade"),blocked:l((e,t)=>{c.LogStatus(`[IDBCache] Upgrade from v${e} to v${t} blocked by another tab. Close other tabs to allow the upgrade to proceed.`)},"blocked")}),this.dbPromise.then(e=>{this._dbReady=!0,e.onversionchange=()=>{c.LogStatus("[IDBCache] DB schema upgraded in another tab \u2014 closing local connection."),e.close(),this._dbReady=!1}}).catch(e=>{c.LogErrorEx({error:e,message:"IndexedDB initialization failed: "+e?.message})})}get SharesReferences(){return!1}get SupportsCrossProcessPersistence(){return!0}get IsReady(){return this._dbReady}isKnownCategory(e){const t=`mj:${e}`;return j.includes(t)}getStoreName(e){const t=e||P;return this.isKnownCategory(t)?`mj:${t}`:"mj:default"}getStoreKey(e,t){const r=t||P;return this.isKnownCategory(r)?e:`[${r}]:${e}`}async SetItem(e,t,r){try{const s=await this.dbPromise,n=this.getStoreName(r),a=this.getStoreKey(e,r),i=s.transaction(n,"readwrite");await i.objectStore(n).put(t,a),await i.done}catch(s){c.LogErrorEx({error:s,message:s?.message})}}async GetItem(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),n=this.getStoreKey(e,t),a=await r.transaction(s).objectStore(s).get(n);return a===void 0?null:a}catch(r){return c.LogErrorEx({error:r,message:r?.message}),null}}async GetItems(e,t){const r=new Map;if(e.length===0)return r;try{const s=await this.dbPromise,n=this.getStoreName(t),a=Array.from(new Set(e)),i=a.map(I=>this.getStoreKey(I,t)),o=s.transaction(n,"readonly"),y=o.objectStore(n),g=i.map(I=>y.get(I)),m=await Promise.all(g);await o.done;for(let I=0;I<a.length;I++){const S=m[I];r.set(a[I],S===void 0?null:S)}return r}catch(s){c.LogErrorEx({error:s,message:s?.message});for(const n of new Set(e))r.set(n,null);return r}}async Remove(e,t){try{const r=await this.dbPromise,s=this.getStoreName(t),n=this.getStoreKey(e,t),a=r.transaction(s,"readwrite");await a.objectStore(s).delete(n),await a.done}catch(r){c.LogErrorEx({error:r,message:r?.message})}}async ClearCategory(e){try{const t=await this.dbPromise,r=e||P,s=this.getStoreName(e);if(this.isKnownCategory(r)){const n=t.transaction(s,"readwrite");await n.objectStore(s).clear(),await n.done}else{const n=`[${r}]:`,a=t.transaction("mj:default","readwrite"),i=a.objectStore("mj:default"),o=await i.getAllKeys();for(const y of o)typeof y=="string"&&y.startsWith(n)&&await i.delete(y);await a.done}}catch(t){c.LogErrorEx({error:t,message:t?.message})}}async GetCategoryKeys(e){try{const t=await this.dbPromise,r=e||P,s=this.getStoreName(e),i=await t.transaction(s,"readonly").objectStore(s).getAllKeys();if(this.isKnownCategory(r))return i.map(y=>String(y));const o=`[${r}]:`;return i.map(y=>String(y)).filter(y=>y.startsWith(o)).map(y=>y.slice(o.length))}catch(t){return c.LogErrorEx({error:t,message:t?.message}),[]}}}class F extends Error{static{l(this,"SafeGraphQLError")}constructor(e){super(e.message),this.name=e.name,this.response={status:e.status,errors:e.errors},this.request={query:e.query},this.Code=e.code,this.VariableShape=e.variableShape,this.stack=e.stackFrames?`${e.name}: ${e.message}
|
|
357
|
+
${e.stackFrames}`:this.stack}}function W(d){return d instanceof F?d:new F(q(d))}l(W,"ToSafeGraphQLError");const ge=3,ye=25;function G(d,e=0){if(d===null)return"null";if(d===void 0)return"undefined";if(Array.isArray(d))return d.length===0?"array(empty)":`array(${d.length} \xD7 ${me(G(d[0],e+1))})`;if(typeof d=="object"){if(e>=ge)return"object(\u2026)";const t=Object.keys(d);if(t.length>ye)return`object(${t.length} keys)`;const r={};for(const s of t)r[s]=G(d[s],e+1);return r}return typeof d=="string"?d.length===0?"string(empty)":"string":typeof d}l(G,"describeShape");function me(d){return typeof d=="string"?d:"object"}l(me,"typeOf");function Se(d){const e=d.indexOf(`
|
|
358
|
+
at `);return e===-1?"":d.slice(e+1)}l(Se,"stripStackHeader");function pe(d,e){const t=d?.[0]?.message;return typeof t=="string"&&t.length>0?t:`GraphQL Error (Code: ${String(e??"unknown")})`}l(pe,"deriveMessage");function he(d){if(Array.isArray(d))return d.map(e=>{const t=e??{};return{message:typeof t.message=="string"?t.message:void 0,path:Array.isArray(t.path)?t.path:void 0,extensions:t.extensions&&typeof t.extensions=="object"?t.extensions:void 0}})}l(he,"extractErrors");function q(d,e=!1){if(!d||typeof d!="object")return{name:typeof d,message:"Non-object value thrown; contents withheld",variables:"[REDACTED]"};const t=d,r=typeof t.response?.status=="number"?t.response.status:void 0,s=he(t.response?.errors),n=s?.[0]?.extensions?.code;return{name:typeof t.name=="string"?t.name:"Error",message:pe(s,r),status:r,errors:s,code:typeof n=="string"?n:void 0,query:typeof t.request?.query=="string"?t.request.query:void 0,stackFrames:typeof t.stack=="string"?Se(t.stack):void 0,variables:e?t.request?.variables:"[REDACTED]",variableShape:t.request?.variables===void 0?void 0:G(t.request.variables)}}l(q,"SanitizeGraphQLError");const H=new WeakMap;function z(d,e,t,r){return JSON.stringify([d,e??null,t??null,r??null])}l(z,"credentialsKey");const M=new N,fe=u.gql`subscription RemoteOperationProgress($channelId: ID!) {
|
|
359
359
|
RemoteOperationProgress(channelId: $channelId) {
|
|
360
360
|
ChannelId
|
|
361
361
|
ProgressJSON
|
|
362
362
|
}
|
|
363
|
-
}`;class
|
|
363
|
+
}`;class Ie extends c.ProviderConfigDataBase{static{l(this,"GraphQLProviderConfigData")}get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get MJAPIKey(){return this.Data.MJAPIKey}set MJAPIKey(e){this.Data.MJAPIKey=e}get UserAPIKey(){return this.Data.UserAPIKey}set UserAPIKey(e){this.Data.UserAPIKey=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get LogVariableValues(){return this.Data.LogVariableValues===!0}set LogVariableValues(e){this.Data.LogVariableValues=e}get RefreshTokenFunction(){return this.Data.RefreshFunction}get OnAuthenticationError(){return this.Data.OnAuthenticationError}set OnAuthenticationError(e){this.Data.OnAuthenticationError=e}constructor(e,t,r,s,n,a,i,o,y,g){super({Token:e,URL:t,WSURL:r,MJAPIKey:o,UserAPIKey:y,RefreshTokenFunction:s,OnAuthenticationError:g},n,a,i)}}const Ee=1e4,Re=1e4,De=1e4;class f extends c.ProviderBase{static{l(this,"GraphQLDataProvider")}constructor(){super(),this._refreshPromise=null,this._dynamicHeaders=new Map,this._recordNames=new c.EntityRecordNameCache,this._innerCurrentUserQueryString=`CurrentUser {
|
|
364
364
|
${this.userInfoString()}
|
|
365
365
|
Roles {
|
|
366
366
|
${this.userRoleInfoString()}
|
|
@@ -369,7 +369,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
369
369
|
`,this._currentUserQuery=u.gql`query CurrentUserAndRoles {
|
|
370
370
|
${this._innerCurrentUserQueryString}
|
|
371
371
|
CurrentUserTenantContext
|
|
372
|
-
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject=new w.BehaviorSubject("unknown"),this._socketReconnectedSubject=new w.Subject,this._isDisposingSocketIntentionally=!1,this._disarmPongWatchdog=null,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=1800*1e3,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=300*1e3,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=600*1e3,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,this._taskGraphFrameStreams=new Map,this._cacheInvalidationSubscription=null;const e=v.GetGlobalObjectStore();if(e&&e[
|
|
372
|
+
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject=new w.BehaviorSubject("unknown"),this._socketReconnectedSubject=new w.Subject,this._isDisposingSocketIntentionally=!1,this._disarmPongWatchdog=null,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=1800*1e3,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=300*1e3,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=600*1e3,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,this._taskGraphFrameStreams=new Map,this._cacheInvalidationSubscription=null;const e=v.GetGlobalObjectStore();if(e&&e[f._globalStoreKey])return e[f._globalStoreKey];e&&(e[f._globalStoreKey]=this)}static{this.VerboseCacheInvalidationLogging=!1}static{this._globalStoreKey="___SINGLETON__GraphQLDataProvider"}static get Instance(){const e=v.GetGlobalObjectStore();return e?e[f._globalStoreKey]:void 0}get ConfigData(){return this._configData}get AI(){return this._aiClient||(this._aiClient=new K(this)),this._aiClient}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}async InternalExecuteQueryFromSpec(e,t){throw new Error("ExecuteQueryFromSpec is not supported by this provider.")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return ne.v4()}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 r=this.LocalStoragePrefix+"sessionId";await t.SetItem(r,e)}}catch{}}async GetPreferredUUID(e){const t=await this.GetStoredSessionID();return e||!t?this.GenerateUUID():t}async Config(e,t,r,s){try{return await this.connectClient(e,r,s),super.Config(e)}catch(n){throw c.LogError(n),n}}async Connect(e){await this.connectClient(e,!1,!1)}async connectClient(e,t,r){if(this._configData=e,t||f.Instance!==this)this._sessionId=await this.GetPreferredUUID(r),this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId,e.MJAPIKey,e.UserAPIKey),await this.saveStoredSessionID(this._sessionId);else{f.Instance._configData=e,f.Instance._sessionId===void 0&&(f.Instance._sessionId=await this.GetPreferredUUID(r));const s=f.Instance._client;(!s||this.isBuiltWithOtherCredentials(s,e))&&(f.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,f.Instance._sessionId,e.MJAPIKey,e.UserAPIKey)),await f.Instance.saveStoredSessionID(f.Instance._sessionId),this._sessionId=f.Instance._sessionId,this._client=f.Instance._client}}isBuiltWithOtherCredentials(e,t){const r=H.get(e);return r!==void 0&&r!==z(t.URL,t.Token,t.MJAPIKey,t.UserAPIKey)}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}SetDynamicHeader(e,t){this._dynamicHeaders.set(e,t),this._client&&this._client.setHeader(e,t),f.Instance&&f.Instance!==this&&f.Instance._configData===this._configData&&(f.Instance._dynamicHeaders.set(e,t),f.Instance._client&&f.Instance._client.setHeader(e,t))}RemoveDynamicHeader(e){this._dynamicHeaders.delete(e),this._client&&this._client.setHeader(e,""),f.Instance&&f.Instance!==this&&f.Instance._configData===this._configData&&(f.Instance._dynamicHeaders.delete(e),f.Instance._client&&f.Instance._client.setHeader(e,""))}GetDynamicHeaders(){return this._dynamicHeaders}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const t=this.ConvertBackToMJFields(e.CurrentUser),{Roles:r,...s}=t,n=(r??[]).map(i=>this.ConvertBackToMJFields(i)),a=new c.UserInfo(this,{...s,UserRoles:n});return e.CurrentUserTenantContext&&typeof e.CurrentUserTenantContext=="object"&&(a.TenantContext=e.CurrentUserTenantContext),a}}async InternalRunQuery(e,t){if(e.SQL)return this.RunAdhocQuery(e.SQL,e.MaxRows,e.TimeoutSeconds,e.StartRow);if(e.QueryID)return this.RunQueryByID(e.QueryID,e.CategoryID,e.CategoryPath,t,e.Parameters,e.MaxRows,e.StartRow,e.Enrichment,e.DataSource);if(e.QueryName)return this.RunQueryByName(e.QueryName,e.CategoryID,e.CategoryPath,t,e.Parameters,e.MaxRows,e.StartRow,e.Enrichment,e.DataSource);throw new Error("No SQL, QueryID, or QueryName provided to RunQuery")}async RunAdhocQuery(e,t,r,s){const n=u.gql`
|
|
373
373
|
query ExecuteAdhocQuery($input: AdhocQueryInput!) {
|
|
374
374
|
ExecuteAdhocQuery(input: $input) {
|
|
375
375
|
${this.QueryReturnFieldList}
|
|
@@ -387,13 +387,13 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
387
387
|
${this.QueryReturnFieldList}
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
`,m={QueryID:e};t!==void 0&&(m.CategoryID=t),r!==void 0&&(m.CategoryPath=r),n!==void 0&&(m.Parameters=n),a!==void 0&&(m.MaxRows=a),i!==void 0&&(m.StartRow=i),o!==void 0&&(m.Enrichment=o),y!==void 0&&(m.DataSource=y);const
|
|
390
|
+
`,m={QueryID:e};t!==void 0&&(m.CategoryID=t),r!==void 0&&(m.CategoryPath=r),n!==void 0&&(m.Parameters=n),a!==void 0&&(m.MaxRows=a),i!==void 0&&(m.StartRow=i),o!==void 0&&(m.Enrichment=o),y!==void 0&&(m.DataSource=y);const I=await this.ExecuteGQL(g,m);if(I&&I.GetQueryData)return this.TransformQueryPayload(I.GetQueryData)}async RunQueryByName(e,t,r,s,n,a,i,o,y){const g=u.gql`
|
|
391
391
|
query GetQueryDataByNameQuery($QueryName: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int, $Enrichment: JSONObject, $DataSource: String) {
|
|
392
392
|
GetQueryDataByName(QueryName: $QueryName, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow, Enrichment: $Enrichment, DataSource: $DataSource) {
|
|
393
393
|
${this.QueryReturnFieldList}
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
`,m={QueryName:e};t!==void 0&&(m.CategoryID=t),r!==void 0&&(m.CategoryPath=r),n!==void 0&&(m.Parameters=n),a!==void 0&&(m.MaxRows=a),i!==void 0&&(m.StartRow=i),o!==void 0&&(m.Enrichment=o),y!==void 0&&(m.DataSource=y);const
|
|
396
|
+
`,m={QueryName:e};t!==void 0&&(m.CategoryID=t),r!==void 0&&(m.CategoryPath=r),n!==void 0&&(m.Parameters=n),a!==void 0&&(m.MaxRows=a),i!==void 0&&(m.StartRow=i),o!==void 0&&(m.Enrichment=o),y!==void 0&&(m.DataSource=y);const I=await this.ExecuteGQL(g,m);if(I&&I.GetQueryDataByName)return this.TransformQueryPayload(I.GetQueryDataByName)}get QueryReturnFieldList(){return`
|
|
397
397
|
Success
|
|
398
398
|
QueryID
|
|
399
399
|
QueryName
|
|
@@ -418,7 +418,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
`,a=(await this.ExecuteGQL(s,{input:r}))?.RunQueriesWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map(o=>{if((o.status==="stale"||o.status==="no_validation")&&o.Results){const y=JSON.parse(o.Results);return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,results:y,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}});return{success:a.success,results:i,errorMessage:a.errorMessage}}catch(r){return c.LogError(`Error in RunQueriesWithCacheCheck: ${r}`),{success:!1,results:[],errorMessage:r instanceof Error?r.message:String(r)}}}async InternalRunView(e,t){try{let r="",s="";if(e){const n={};let a,i;if(e.ViewEntity)i=e.ViewEntity,a=i.Entity;else{const{entityName:D,v:h}=await this.getEntityNameAndUserView(e,t);i=h,a=D}const o=this.EntityByName(a);if(!o)throw new Error(`Entity ${a} not found in metadata`);let y=!1;const g=c.getGraphQLTypeNameBase(o);e.ViewID?(r=`Run${g}ViewByID`,s="RunViewByIDInput",n.ViewID=e.ViewID):e.ViewName?(r=`Run${g}ViewByName`,s="RunViewByNameInput",n.ViewName=e.ViewName):(y=!0,r=`Run${g}DynamicView`,s="RunDynamicViewInput",n.EntityName=e.EntityName),n.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",n.OrderBy=e.OrderBy?e.OrderBy:"",n.UserSearchString=e.UserSearchString?e.UserSearchString:"",n.Fields=e.Fields,n.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,e.MaxRows!==void 0&&(n.MaxRows=e.MaxRows),e.StartRow!==void 0&&(n.StartRow=e.StartRow),n.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,n.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(n.AuditLogDescription=e.AuditLogDescription),e.BypassCache!==void 0&&(n.BypassCache=e.BypassCache),e.DataSource!==void 0&&(n.DataSource=e.DataSource),y||(n.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",n.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,n.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",n.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1),e.Aggregates&&e.Aggregates.length>0&&(n.Aggregates=e.Aggregates.map(D=>({expression:D.expression,alias:D.alias})));const m=this.getViewRunTimeFieldList(o,i,e,y),
|
|
421
|
+
`,a=(await this.ExecuteGQL(s,{input:r}))?.RunQueriesWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map(o=>{if((o.status==="stale"||o.status==="no_validation")&&o.Results){const y=JSON.parse(o.Results);return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,results:y,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}});return{success:a.success,results:i,errorMessage:a.errorMessage}}catch(r){return c.LogError(`Error in RunQueriesWithCacheCheck: ${r}`),{success:!1,results:[],errorMessage:r instanceof Error?r.message:String(r)}}}async InternalRunView(e,t){try{let r="",s="";if(e){const n={};let a,i;if(e.ViewEntity)i=e.ViewEntity,a=i.Entity;else{const{entityName:D,v:h}=await this.getEntityNameAndUserView(e,t);i=h,a=D}const o=this.EntityByName(a);if(!o)throw new Error(`Entity ${a} not found in metadata`);let y=!1;const g=c.getGraphQLTypeNameBase(o);e.ViewID?(r=`Run${g}ViewByID`,s="RunViewByIDInput",n.ViewID=e.ViewID):e.ViewName?(r=`Run${g}ViewByName`,s="RunViewByNameInput",n.ViewName=e.ViewName):(y=!0,r=`Run${g}DynamicView`,s="RunDynamicViewInput",n.EntityName=e.EntityName),n.ExtraFilter=e.ExtraFilter?e.ExtraFilter:"",n.OrderBy=e.OrderBy?e.OrderBy:"",n.UserSearchString=e.UserSearchString?e.UserSearchString:"",n.Fields=e.Fields,n.IgnoreMaxRows=e.IgnoreMaxRows?e.IgnoreMaxRows:!1,e.MaxRows!==void 0&&(n.MaxRows=e.MaxRows),e.StartRow!==void 0&&(n.StartRow=e.StartRow),n.ForceAuditLog=e.ForceAuditLog?e.ForceAuditLog:!1,n.ResultType=e.ResultType?e.ResultType:"simple",e.AuditLogDescription&&e.AuditLogDescription.length>0&&(n.AuditLogDescription=e.AuditLogDescription),e.BypassCache!==void 0&&(n.BypassCache=e.BypassCache),e.DataSource!==void 0&&(n.DataSource=e.DataSource),e.IncludeBinaryFields!==void 0&&(n.IncludeBinaryFields=e.IncludeBinaryFields),y||(n.ExcludeUserViewRunID=e.ExcludeUserViewRunID?e.ExcludeUserViewRunID:"",n.ExcludeDataFromAllPriorViewRuns=e.ExcludeDataFromAllPriorViewRuns?e.ExcludeDataFromAllPriorViewRuns:!1,n.OverrideExcludeFilter=e.OverrideExcludeFilter?e.OverrideExcludeFilter:"",n.SaveViewResults=e.SaveViewResults?e.SaveViewResults:!1),e.Aggregates&&e.Aggregates.length>0&&(n.Aggregates=e.Aggregates.map(D=>({expression:D.expression,alias:D.alias})));const m=this.getViewRunTimeFieldList(o,i,e,y),I=e.Aggregates&&e.Aggregates.length>0?`
|
|
422
422
|
AggregateResults {
|
|
423
423
|
alias
|
|
424
424
|
expression
|
|
@@ -437,9 +437,9 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
437
437
|
TotalRowCount
|
|
438
438
|
ExecutionTime
|
|
439
439
|
Success
|
|
440
|
-
ErrorMessage${
|
|
440
|
+
ErrorMessage${I}
|
|
441
441
|
}
|
|
442
|
-
}`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const E=await this.ExecuteGQL(S,{input:n});if(E&&E[r]){const D=E[r].AggregateResults;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Received aggregate results:",{entityName:a,aggregateResultCount:D?.length||0,aggregateResults:D,aggregateExecutionTime:E[r].AggregateExecutionTime});const h=E[r].Results;if(h&&h.length>0){const R=o.Fields.filter(C=>C.CodeName!==C.Name&&C.CodeName!==void 0);h.forEach(C=>{this.ConvertBackToMJFields(C),R.forEach(
|
|
442
|
+
}`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const E=await this.ExecuteGQL(S,{input:n});if(E&&E[r]){const D=E[r].AggregateResults;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Received aggregate results:",{entityName:a,aggregateResultCount:D?.length||0,aggregateResults:D,aggregateExecutionTime:E[r].AggregateExecutionTime});const h=E[r].Results;if(h&&h.length>0){const R=o.Fields.filter(C=>C.CodeName!==C.Name&&C.CodeName!==void 0);h.forEach(C=>{this.ConvertBackToMJFields(C),R.forEach(b=>{C[b.Name]=C[b.CodeName]})})}return E[r]}}else throw"No parameters passed to RunView";return null}catch(r){throw c.LogError(r),r}}async InternalRunViews(e,t){try{let r=[],s=[],n=[];for(const g of e){let m="",I="";const S={};let E=null,D=null;if(g.ViewEntity)D=g.ViewEntity,E=D.Get("Entity");else{const{entityName:C,v:b}=await this.getEntityNameAndUserView(g,t);D=b,E=C}const h=this.EntityByName(E);if(!h)throw new Error(`Entity ${E} not found in metadata`);s.push(h);let p=!1;const R=c.getGraphQLTypeNameBase(h);g.ViewID?(m=`Run${R}ViewByID`,I="RunViewByIDInput",S.ViewID=g.ViewID):g.ViewName?(m=`Run${R}ViewByName`,I="RunViewByNameInput",S.ViewName=g.ViewName):(p=!0,m=`Run${R}DynamicView`,I="RunDynamicViewInput",S.EntityName=g.EntityName),S.ExtraFilter=g.ExtraFilter||"",S.OrderBy=g.OrderBy||"",S.UserSearchString=g.UserSearchString||"",S.Fields=g.Fields,S.IgnoreMaxRows=g.IgnoreMaxRows||!1,g.MaxRows!==void 0&&(S.MaxRows=g.MaxRows),g.StartRow!==void 0&&(S.StartRow=g.StartRow),g.AfterKey&&(S.AfterKey={KeyValuePairs:g.AfterKey.KeyValuePairs}),S.ForceAuditLog=g.ForceAuditLog||!1,S.ResultType=g.ResultType||"simple",g.AuditLogDescription&&g.AuditLogDescription.length>0&&(S.AuditLogDescription=g.AuditLogDescription),g.BypassCache!==void 0&&(S.BypassCache=g.BypassCache),g.DataSource!==void 0&&(S.DataSource=g.DataSource),g.IncludeBinaryFields!==void 0&&(S.IncludeBinaryFields=g.IncludeBinaryFields),p||(S.ExcludeUserViewRunID=g.ExcludeUserViewRunID||"",S.ExcludeDataFromAllPriorViewRuns=g.ExcludeDataFromAllPriorViewRuns||!1,S.OverrideExcludeFilter=g.OverrideExcludeFilter||"",S.SaveViewResults=g.SaveViewResults||!1),g.Aggregates&&g.Aggregates.length>0&&(S.Aggregates=g.Aggregates.map(C=>({expression:C.expression,alias:C.alias}))),r.push(S),n.push(...this.getViewRunTimeFieldList(h,D,g,p))}const i=e.some(g=>g.Aggregates&&g.Aggregates.length>0)?`
|
|
443
443
|
AggregateResults {
|
|
444
444
|
alias
|
|
445
445
|
expression
|
|
@@ -464,7 +464,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
464
464
|
Success
|
|
465
465
|
ErrorMessage${i}
|
|
466
466
|
}
|
|
467
|
-
}`,y=await this.ExecuteGQL(o,{input:r});if(y&&y.RunViews){const g=y.RunViews;for(const[m,
|
|
467
|
+
}`,y=await this.ExecuteGQL(o,{input:r});if(y&&y.RunViews){const g=y.RunViews;for(const[m,I]of g.entries())I.Results=I.Results.map(S=>{let E=JSON.parse(S.Data);return this.ConvertBackToMJFields(E),E});return g}return null}catch(r){throw c.LogError(r),r}}async RunViewsWithCacheCheck(e,t){try{const r=e.map(o=>({params:{EntityName:o.params.EntityName||"",ExtraFilter:o.params.ExtraFilter||"",OrderBy:o.params.OrderBy||"",Fields:o.params.Fields,UserSearchString:o.params.UserSearchString||"",IgnoreMaxRows:o.params.IgnoreMaxRows||!1,MaxRows:o.params.MaxRows,StartRow:o.params.StartRow,AfterKey:o.params.AfterKey?{KeyValuePairs:o.params.AfterKey.KeyValuePairs}:null,ForceAuditLog:o.params.ForceAuditLog||!1,AuditLogDescription:o.params.AuditLogDescription||"",ResultType:o.params.ResultType||"simple",Aggregates:o.params.Aggregates??null,DataSource:o.params.DataSource,IncludeBinaryFields:o.params.IncludeBinaryFields},cacheStatus:o.cacheStatus?{maxUpdatedAt:o.cacheStatus.maxUpdatedAt,rowCount:o.cacheStatus.rowCount}:null})),s=u.gql`
|
|
468
468
|
query RunViewsWithCacheCheckQuery($input: [RunViewWithCacheCheckInput!]!) {
|
|
469
469
|
RunViewsWithCacheCheck(input: $input) {
|
|
470
470
|
success
|
|
@@ -503,7 +503,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
`,a=(await this.ExecuteGQL(s,{input:r}))?.RunViewsWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map((o,y)=>{const g=e[y];if(o.status==="differential"&&o.differentialData){const m=o.differentialData.updatedRows.map(
|
|
506
|
+
`,a=(await this.ExecuteGQL(s,{input:r}))?.RunViewsWithCacheCheck;if(!a)return{success:!1,results:[],errorMessage:"No response from server"};const i=a.results.map((o,y)=>{const g=e[y];if(o.status==="differential"&&o.differentialData){const m=o.differentialData.updatedRows.map(I=>{const S=JSON.parse(I.Data);return this.ConvertBackToMJFields(S),S});return{viewIndex:o.viewIndex,status:o.status,results:void 0,differentialData:{updatedRows:m,deletedRecordIDs:o.differentialData.deletedRecordIDs},maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}if(o.status==="stale"&&o.Results){const m=o.Results.map(S=>{const E=JSON.parse(S.Data);return this.ConvertBackToMJFields(E),E}),I=o.aggregateResults?.map(S=>({expression:S.expression,alias:S.alias,value:S.value!==void 0&&S.value!==null?JSON.parse(S.value):null,error:S.error}));return{viewIndex:o.viewIndex,status:o.status,results:m,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage,aggregateResults:I}}return{viewIndex:o.viewIndex,status:o.status,results:void 0,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}});return{success:a.success,results:i,errorMessage:a.errorMessage}}catch(r){return c.LogError(r),{success:!1,results:[],errorMessage:r instanceof Error?r.message:String(r)}}}async getEntityNameAndUserView(e,t){let r,s;if(e.EntityName)r=e.EntityName;else if(e.ViewID)s=await V.ViewInfo.GetViewEntity(e.ViewID,t),r=s.Entity;else if(e.ViewName)s=await V.ViewInfo.GetViewEntityByName(e.ViewName,t),r=s.Entity;else throw new Error("No EntityName, ViewID or ViewName passed to RunView");return{entityName:r,v:s}}getViewRunTimeFieldList(e,t,r,s){const n=[];if(r.Fields){for(const a of e.PrimaryKeys)r.Fields.find(i=>i.trim().toLowerCase()===a.Name.toLowerCase())===void 0&&n.push(M.MapFieldName(a.Name));r.Fields.forEach(a=>{n.push(M.MapFieldName(a))})}else if(s)e.Fields.forEach(a=>{(!a.IsBinaryFieldType||r.IncludeBinaryFields===!0)&&n.push(M.MapFieldName(a.CodeName))});else{for(const a of e.PrimaryKeys)n.find(i=>i.trim().toLowerCase()===a.Name.toLowerCase())===void 0&&n.push(M.MapFieldName(a.Name));t.Columns.forEach(a=>{a.hidden===!1&&!n.find(i=>i.trim().toLowerCase()===a.EntityField?.Name.trim().toLowerCase())&&a.EntityField&&(a.EntityField.IsBinaryFieldType&&r.IncludeBinaryFields!==!0||n.push(M.MapFieldName(a.EntityField.CodeName)))})}return n}get ProviderType(){return c.ProviderType.Network}async GetRecordChanges(e,t){try{const r={EntityName:"MJ: Record Changes",ExtraFilter:`RecordID = '${t.Values()}' AND Entity = '${e}'`},s=await this.RunView(r);return s?s.Results.sort((n,a)=>n.ChangedAt>a.ChangedAt?-1:1):null}catch(r){throw c.LogError(r),r}}async GetRecordDependencies(e,t){try{const r=u.gql`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
507
507
|
GetRecordDependencies(entityName: $entityName, CompositeKey: $CompositeKey) {
|
|
508
508
|
EntityName
|
|
509
509
|
RelatedEntityName
|
|
@@ -563,7 +563,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
563
563
|
handle
|
|
564
564
|
errorMessage
|
|
565
565
|
}
|
|
566
|
-
}`;let n,a;r.onProgress&&(n=this.GenerateUUID(),a=this.Subscribe(
|
|
566
|
+
}`;let n,a;r.onProgress&&(n=this.GenerateUUID(),a=this.Subscribe(fe,{channelId:n}).subscribe({next:l(i=>{const o=i?.RemoteOperationProgress?.ProgressJSON;if(o)try{r.onProgress(JSON.parse(o))}catch{}},"next"),error:l(()=>{},"error")}),await new Promise(i=>setTimeout(i,400)));try{const o=(await this.ExecuteGQL(s,{operationKey:e,inputJSON:JSON.stringify(t??null),invokeMode:r.mode??"attached",progressChannelId:n??null}))?.ExecuteRemoteOperation;return o?{Success:!!o.success,ResultCode:o.resultCode??void 0,Output:o.outputJSON!=null?JSON.parse(o.outputJSON):void 0,Handle:o.handle??void 0,ErrorMessage:o.errorMessage??void 0}:{Success:!1,ResultCode:"NO_RESPONSE",ErrorMessage:"No response from ExecuteRemoteOperation"}}catch(i){return{Success:!1,ResultCode:"TRANSPORT_ERROR",ErrorMessage:i instanceof Error?i.message:String(i)}}finally{a?.unsubscribe()}}async MergeRecords(e,t,r){const s=this.Entities.find(n=>n.Name.trim().toLowerCase()===e.EntityName.trim().toLowerCase());if(!s||!s.AllowRecordMerge)throw new Error(`Entity ${e.EntityName} does not allow record merging, check the AllowRecordMerge property in the entity metadata`);try{const n=u.gql`mutation MergeRecordsMutation ($request: RecordMergeRequest!) {
|
|
567
567
|
MergeRecords(request: $request) {
|
|
568
568
|
Success
|
|
569
569
|
OverallStatus
|
|
@@ -580,34 +580,34 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
580
580
|
Message
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
}`,a={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(n,{request:a}))?.MergeRecords}catch(n){return c.LogError(n),{Success:!1,OverallStatus:n&&n.message?n.message:n,RecordStatus:[],RecordMergeLogID:"",Request:e}}}getDeniedReadFieldNamesForCurrentUser(e){return!e?.EnableFieldLevelSecurity||!this.CurrentUser?new Set:e.GetDeniedReadFields(this.CurrentUser)}fieldSecurityTransportSelection(e){return e?.EnableFieldLevelSecurity?c.ReadableFieldsTransportKey:""}ApplyServerFieldAccess(e,t){if(!t||typeof t!="object")return t;const r=t,s=r[c.ReadableFieldsTransportKey];if(delete r[c.ReadableFieldsTransportKey],Array.isArray(s)){const a=new Set(s.map(i=>String(i).trim().toLowerCase()));for(const i of e.Fields)a.has(i.Name.trim().toLowerCase())||(delete r[i.Name],delete r[i.CodeName]);return t}const n=this.getDeniedReadFieldNamesForCurrentUser(e);if(n.size===0)return t;for(const a of e.Fields)n.has(a.Name.trim().toLowerCase())&&(r[a.Name]===null&&delete r[a.Name],r[a.CodeName]===null&&delete r[a.CodeName]);return t}async Save(e,t,r){if(r?.IsParentEntitySave){const n=new c.BaseEntityResult;return n.StartedAt=new Date,n.EndedAt=new Date,n.Type=e.IsSaved?"update":"create",n.Success=!0,n.NewValues=e.GetAll(),e.RegisterResultHistoryEntry(n),n.NewValues}const s=new c.BaseEntityResult;try{e.RegisterTransactionPreprocessing();const n={input:{}},a=e.IsSaved?"Update":"Create";s.StartedAt=new Date,s.Type=e.IsSaved?"update":"create",s.OriginalValues=e.Fields.map(h=>({FieldName:h.CodeName,Value:h.Value})),e.RegisterResultHistoryEntry(s);const i=c.getGraphQLTypeNameBase(e.EntityInfo),o=`${a}${i}`,y=!e.IsSaved&&e.EntityInfo.IsChildType&&e.ISAParent?.IsSaved===!0,g=this.getDeniedReadFieldNamesForCurrentUser(e.EntityInfo),m=l(h=>g.has(h.trim().toLowerCase()),"isDeniedRead"),
|
|
584
|
-
${e.Fields.filter(h=>!m(h.Name)).map(h=>
|
|
583
|
+
}`,a={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(n,{request:a}))?.MergeRecords}catch(n){return c.LogError(n),{Success:!1,OverallStatus:n&&n.message?n.message:n,RecordStatus:[],RecordMergeLogID:"",Request:e}}}getDeniedReadFieldNamesForCurrentUser(e){return!e?.EnableFieldLevelSecurity||!this.CurrentUser?new Set:e.GetDeniedReadFields(this.CurrentUser)}fieldSecurityTransportSelection(e){return e?.EnableFieldLevelSecurity?c.ReadableFieldsTransportKey:""}ApplyServerFieldAccess(e,t){if(!t||typeof t!="object")return t;const r=t,s=r[c.ReadableFieldsTransportKey];if(delete r[c.ReadableFieldsTransportKey],Array.isArray(s)){const a=new Set(s.map(i=>String(i).trim().toLowerCase()));for(const i of e.Fields)a.has(i.Name.trim().toLowerCase())||(delete r[i.Name],delete r[i.CodeName]);return t}const n=this.getDeniedReadFieldNamesForCurrentUser(e);if(n.size===0)return t;for(const a of e.Fields)n.has(a.Name.trim().toLowerCase())&&(r[a.Name]===null&&delete r[a.Name],r[a.CodeName]===null&&delete r[a.CodeName]);return t}async Save(e,t,r){if(r?.IsParentEntitySave){const n=new c.BaseEntityResult;return n.StartedAt=new Date,n.EndedAt=new Date,n.Type=e.IsSaved?"update":"create",n.Success=!0,n.NewValues=e.GetAll(),e.RegisterResultHistoryEntry(n),n.NewValues}const s=new c.BaseEntityResult;try{e.RegisterTransactionPreprocessing();const n={input:{}},a=e.IsSaved?"Update":"Create";s.StartedAt=new Date,s.Type=e.IsSaved?"update":"create",s.OriginalValues=e.Fields.map(h=>({FieldName:h.CodeName,Value:h.Value})),e.RegisterResultHistoryEntry(s);const i=c.getGraphQLTypeNameBase(e.EntityInfo),o=`${a}${i}`,y=!e.IsSaved&&e.EntityInfo.IsChildType&&e.ISAParent?.IsSaved===!0,g=this.getDeniedReadFieldNamesForCurrentUser(e.EntityInfo),m=l(h=>g.has(h.trim().toLowerCase()),"isDeniedRead"),I=e.Fields.filter(h=>(!h.ReadOnly||h.IsPrimaryKey&&(e.IsSaved||y))&&(h.IsPrimaryKey||!h.NotLoaded&&!m(h.Name))),S=` ${o}(input: $input) {
|
|
584
|
+
${e.Fields.filter(h=>!m(h.Name)).map(h=>M.MapFieldName(h.CodeName)).join(`
|
|
585
585
|
`)}
|
|
586
586
|
${this.fieldSecurityTransportSelection(e.EntityInfo)}
|
|
587
587
|
}`,E=u.gql`mutation ${a}${i} ($input: ${o}Input!) {
|
|
588
588
|
${S}
|
|
589
589
|
}
|
|
590
|
-
`;for(let h=0;h<
|
|
590
|
+
`;for(let h=0;h<I.length;h++){const p=I[h];let R=e.Get(p.Name);if(R)switch(p.EntityFieldInfo.TSType){case c.EntityFieldTSType.Date:R=R.getTime();break;case c.EntityFieldTSType.Boolean:typeof R!="boolean"&&(R=parseInt(R)!==0);break;case c.EntityFieldTSType.Number:if(typeof R!="number"){const C=Number(R);isNaN(C)||(R=C)}break}R===null&&p.EntityFieldInfo.AllowsNull===!1&&(p.EntityFieldInfo.DefaultValue!==null?R=p.EntityFieldInfo.DefaultValue:p.FieldType===c.EntityFieldTSType.Number||p.FieldType===c.EntityFieldTSType.Boolean?R=0:R=""),n.input[M.MapFieldName(p.CodeName)]=R}const D=e.RestoreContext;if(D&&(n.input.RestoreContext___={SourceChangeID:D.SourceChangeID,Reason:D.Reason}),a.trim().toLowerCase()==="update"&&r.SkipOldValuesCheck===!1){const h=[];e.Fields.forEach(p=>{if(p.NotLoaded&&!p.IsPrimaryKey)return;let R=null;p.OldValue!==null&&p.OldValue!==void 0&&(p.EntityFieldInfo.TSType===c.EntityFieldTSType.Date?R=p.OldValue.getTime().toString():p.EntityFieldInfo.TSType===c.EntityFieldTSType.Boolean?R=p.OldValue===!0?"1":"0":typeof p.OldValue!="string"?R=p.OldValue.toString():R=p.OldValue),h.push({Key:M.MapFieldName(p.CodeName),Value:R})}),n.input.OldValues___=h}if(e.TransactionGroup){const h=[{varName:"input",inputType:o+"Input!"}];return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new c.TransactionItem(e,s.Type==="create"?"Create":"Update",S,n,{mutationName:o,mutationInputTypes:h},(p,R)=>{s.EndedAt=new Date,R&&p?(s.Success=!0,s.NewValues=this.ApplyServerFieldAccess(e.EntityInfo,this.ConvertBackToMJFields(p))):(s.Success=!1,s.Message="Transaction failed")})),!0}else{const h=await this.ExecuteGQL(E,n);if(h&&h[o])return s.Success=!0,s.EndedAt=new Date,s.NewValues=this.ApplyServerFieldAccess(e.EntityInfo,this.ConvertBackToMJFields(h[o])),s.NewValues;throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(n){s.Success=!1,s.EndedAt=new Date,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message;const a=n.response?.errors?.[0]?.extensions;return s.Errors=v.DeserializeValidationErrors(a?.validationErrors),s.MessageIncludesErrors=s.Errors.length>0&&a?.messageIncludesValidationErrors===!0,c.LogError(n),null}}async Load(e,t,r=null,s){try{const n={};let a="",i="";for(let S=0;S<t.KeyValuePairs.length;S++){const E=e.Fields.find(R=>R.Name.trim().toLowerCase()===t.KeyValuePairs[S].FieldName.trim().toLowerCase()).EntityFieldInfo,D=t.GetValueByIndex(S),h=E.GraphQLType;i.length>0&&(i+=", "),i+=`$${E.CodeName}: ${h}!`,a.length>0&&(a+=", ");const p=E.CodeName.startsWith("__mj_")?E.CodeName.replace("__mj_","_mj__"):E.CodeName;if(a+=`${p}: $${E.CodeName}`,E.TSType===c.EntityFieldTSType.Number){if(isNaN(t.GetValueByIndex(S)))throw new Error(`Primary Key value ${D} (${E.Name}) is not a valid number`);n[E.CodeName]=parseInt(D)}else n[E.CodeName]=D}const o=r&&r.length>0?this.getRelatedEntityString(e.EntityInfo,r):"",y=c.getGraphQLTypeNameBase(e.EntityInfo),g=this.getDeniedReadFieldNamesForCurrentUser(e.EntityInfo),m=u.gql`query Single${y}${o.length>0?"Full":""} (${i}) {
|
|
591
591
|
${y}(${a}) {
|
|
592
|
-
${e.Fields.filter(S=>!
|
|
592
|
+
${e.Fields.filter(S=>!g.has(S.Name.trim().toLowerCase())).map(S=>S.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?S.CodeName.replace("__mj_","_mj__"):S.CodeName).join(`
|
|
593
593
|
`)}
|
|
594
594
|
${this.fieldSecurityTransportSelection(e.EntityInfo)}
|
|
595
595
|
${o}
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
|
-
`,
|
|
598
|
+
`,I=await this.ExecuteGQL(m,n);return I&&I[y]?this.ApplyServerFieldAccess(e.EntityInfo,this.ConvertBackToMJFields(I[y])):null}catch(n){return c.LogError(n),null}}ConvertBackToMJFields(e){return M.ReverseMapFields(e),e}getRelatedEntityString(e,t){let r="";for(let s=0;s<e.RelatedEntities.length;s++)if(t.indexOf(e.RelatedEntities[s].RelatedEntity)>=0){const n=e.RelatedEntities[s],a=this.EntityByID(n.RelatedEntityID);let i="";n.Type.toLowerCase().trim()==="many to many"?i=`${n.RelatedEntityCodeName}_${n.JoinEntityJoinField.replace(/\s/g,"")}`:i=`${n.RelatedEntityCodeName}_${n.RelatedEntityJoinField.replace(/\s/g,"")}`,r+=`
|
|
599
599
|
${i} {
|
|
600
600
|
${a.Fields.map(o=>o.CodeName).join(`
|
|
601
601
|
`)}
|
|
602
602
|
}
|
|
603
603
|
`}return r}async Delete(e,t,r){if(t?.IsParentEntityDelete){const n=new c.BaseEntityResult;return n.StartedAt=new Date,n.EndedAt=new Date,n.Type="delete",n.Success=!0,e.RegisterResultHistoryEntry(n),!0}const s=new c.BaseEntityResult;try{e.RegisterTransactionPreprocessing(),s.StartedAt=new Date,s.Type="delete",s.OriginalValues=e.Fields.map(E=>({FieldName:E.CodeName,Value:E.Value})),e.RegisterResultHistoryEntry(s);const n={},a=[];let i="",o="",y="";for(let E of e.PrimaryKey.KeyValuePairs){const D=e.Fields.find(p=>p.Name.trim().toLowerCase()===E.FieldName.trim().toLowerCase());n[D.CodeName]=D.Value,a.push({varName:D.CodeName,inputType:D.EntityFieldInfo.GraphQLType+"!"});const h=D.CodeName.startsWith("__mj_")?D.CodeName.replace("__mj_","_mj__"):D.CodeName;i.length>0&&(i+=", "),i+=`${h}: $${D.CodeName}`,o.length>0&&(o+=", "),o+=`$${D.CodeName}: ${D.EntityFieldInfo.GraphQLType}!`,y.length>0&&(y+=`
|
|
604
|
-
`),y+=`${h}`}a.push({varName:"options___",inputType:"DeleteOptionsInput!"}),n.options___={SkipEntityAIActions:t?.SkipEntityAIActions??!1,SkipEntityActions:t?.SkipEntityActions??!1,ReplayOnly:t?.ReplayOnly??!1,IsParentEntityDelete:t?.IsParentEntityDelete??!1,SkipRecordChanges:t?.SkipRecordChanges??!1};const m="Delete"+c.getGraphQLTypeNameBase(e.EntityInfo),
|
|
604
|
+
`),y+=`${h}`}a.push({varName:"options___",inputType:"DeleteOptionsInput!"}),n.options___={SkipEntityAIActions:t?.SkipEntityAIActions??!1,SkipEntityActions:t?.SkipEntityActions??!1,ReplayOnly:t?.ReplayOnly??!1,IsParentEntityDelete:t?.IsParentEntityDelete??!1,SkipRecordChanges:t?.SkipRecordChanges??!1};const m="Delete"+c.getGraphQLTypeNameBase(e.EntityInfo),I=u.gql`${m}(${i}, options___: $options___) {
|
|
605
605
|
${y}
|
|
606
606
|
}
|
|
607
607
|
`,S=u.gql`mutation ${m} (${o}, $options___: DeleteOptionsInput!) {
|
|
608
|
-
${
|
|
608
|
+
${I}
|
|
609
609
|
}
|
|
610
|
-
`;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new c.TransactionItem(e,"Delete",
|
|
610
|
+
`;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new c.TransactionItem(e,"Delete",I,n,{mutationName:m,mutationInputTypes:a},(E,D)=>{if(s.EndedAt=new Date,D&&E){let h=!0;for(const p of e.PrimaryKey.KeyValuePairs)p.Value!==E[p.FieldName]&&(h=!1);h?s.Success=!0:(s.Success=!1,s.Message="Transaction failed to commit")}else s.Success=!1,s.Message="Transaction failed to commit"})),!0;{const E=await this.ExecuteGQL(S,n);if(E&&E[m]){const D=E[m];for(let h of e.PrimaryKey.KeyValuePairs){let p=D[h.FieldName],R=h.Value;if(typeof R=="number"&&(R=R.toString()),typeof p=="number"&&(p=p.toString()),R!==p)throw new Error(`Primary key value mismatch in server Delete response. Field: ${h.FieldName}, Original: ${R}, Returned: ${p}`)}return s.Success=!0,s.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(n){s.EndedAt=new Date,s.Success=!1,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message;const a=n.response?.errors?.[0]?.extensions;return s.Errors=v.DeserializeValidationErrors(a?.validationErrors),s.MessageIncludesErrors=s.Errors.length>0&&a?.messageIncludesValidationErrors===!0,c.LogError(n),!1}}async GetDatasetByName(e,t){const r=u.gql`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
|
|
611
611
|
GetDatasetByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
|
|
612
612
|
DatasetID
|
|
613
613
|
DatasetName
|
|
@@ -616,7 +616,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
616
616
|
LatestUpdateDate
|
|
617
617
|
Results
|
|
618
618
|
}
|
|
619
|
-
}`,s=await this.ExecuteGQL(r,{DatasetName:e,ItemFilters:t});return s&&s.GetDatasetByName&&s.GetDatasetByName.Success?{DatasetID:s.GetDatasetByName.DatasetID,DatasetName:s.GetDatasetByName.DatasetName,Success:s.GetDatasetByName.Success,Status:s.GetDatasetByName.Status,LatestUpdateDate:new Date(s.GetDatasetByName.LatestUpdateDate),Results:JSON.parse(s.GetDatasetByName.Results)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,Results:null}}static{this._datasetStatusQueue=[]}static{this._datasetStatusTimer=null}static{this._datasetStatusCoalesceMs=10}async GetDatasetStatusByName(e,t){return
|
|
619
|
+
}`,s=await this.ExecuteGQL(r,{DatasetName:e,ItemFilters:t});return s&&s.GetDatasetByName&&s.GetDatasetByName.Success?{DatasetID:s.GetDatasetByName.DatasetID,DatasetName:s.GetDatasetByName.DatasetName,Success:s.GetDatasetByName.Success,Status:s.GetDatasetByName.Status,LatestUpdateDate:new Date(s.GetDatasetByName.LatestUpdateDate),Results:JSON.parse(s.GetDatasetByName.Results)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,Results:null}}static{this._datasetStatusQueue=[]}static{this._datasetStatusTimer=null}static{this._datasetStatusCoalesceMs=10}async GetDatasetStatusByName(e,t){return f._datasetStatusCoalesceMs>0&&!t?this.enqueueDatasetStatusCheck(e):this.executeDatasetStatusByName(e,t)}enqueueDatasetStatusCheck(e){return new Promise((t,r)=>{f._datasetStatusQueue.push({datasetName:e,resolve:t,reject:r}),f._datasetStatusTimer||(f._datasetStatusTimer=setTimeout(()=>this.flushDatasetStatusQueue(),f._datasetStatusCoalesceMs))})}async flushDatasetStatusQueue(){f._datasetStatusTimer=null;const e=f._datasetStatusQueue.splice(0);if(e.length===0)return;if(e.length===1){try{const r=await this.executeDatasetStatusByName(e[0].datasetName,e[0].itemFilters);e[0].resolve(r)}catch(r){e[0].reject(r)}return}const t=e.map(r=>r.datasetName);c.LogStatus(`\u26A1 [Coalesce] Batching ${t.length} dataset status checks into 1 request: [${t.join(", ")}]`);try{const r=u.gql`query GetMultipleDatasetStatusByName($DatasetNames: [String!]!) {
|
|
620
620
|
GetMultipleDatasetStatusByName(DatasetNames: $DatasetNames) {
|
|
621
621
|
DatasetID
|
|
622
622
|
DatasetName
|
|
@@ -634,7 +634,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
634
634
|
LatestUpdateDate
|
|
635
635
|
EntityUpdateDates
|
|
636
636
|
}
|
|
637
|
-
}`,s=await this.ExecuteGQL(r,{DatasetName:e,ItemFilters:t});return s&&s.GetDatasetStatusByName&&s.GetDatasetStatusByName.Success?{DatasetID:s.GetDatasetStatusByName.DatasetID,DatasetName:s.GetDatasetStatusByName.DatasetName,Success:s.GetDatasetStatusByName.Success,Status:s.GetDatasetStatusByName.Status,LatestUpdateDate:new Date(s.GetDatasetStatusByName.LatestUpdateDate),EntityUpdateDates:JSON.parse(s.GetDatasetStatusByName.EntityUpdateDates)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,EntityUpdateDates:null}}async CreateTransactionGroup(){return new
|
|
637
|
+
}`,s=await this.ExecuteGQL(r,{DatasetName:e,ItemFilters:t});return s&&s.GetDatasetStatusByName&&s.GetDatasetStatusByName.Success?{DatasetID:s.GetDatasetStatusByName.DatasetID,DatasetName:s.GetDatasetStatusByName.DatasetName,Success:s.GetDatasetStatusByName.Success,Status:s.GetDatasetStatusByName.Status,LatestUpdateDate:new Date(s.GetDatasetStatusByName.LatestUpdateDate),EntityUpdateDates:JSON.parse(s.GetDatasetStatusByName.EntityUpdateDates)}:{DatasetID:"",DatasetName:e,Success:!1,Status:"Unknown",LatestUpdateDate:null,EntityUpdateDates:null}}async CreateTransactionGroup(){return new k(this)}async GetRecordFavoriteStatus(e,t,r){if(!r.Validate().IsValid)return!1;const n=this.EntityByName(t);if(!n)throw new Error(`Entity ${t} not found in metadata`);const a=u.gql`query GetRecordFavoriteStatus($params: UserFavoriteSearchParams!) {
|
|
638
638
|
GetRecordFavoriteStatus(params: $params) {
|
|
639
639
|
Success
|
|
640
640
|
IsFavorite
|
|
@@ -643,7 +643,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
643
643
|
SetRecordFavoriteStatus(params: $params){
|
|
644
644
|
Success
|
|
645
645
|
}
|
|
646
|
-
}`,o=await this.ExecuteGQL(i,{params:{UserID:e,EntityID:a.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)},IsFavorite:s}});if(o&&o.SetRecordFavoriteStatus!==null)return o.SetRecordFavoriteStatus.Success}async InternalGetEntityRecordName(e,t){if(!e||!t||t.KeyValuePairs?.length===0)return null;const r=u.gql`query GetEntityRecordNameQuery ($EntityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
646
|
+
}`,o=await this.ExecuteGQL(i,{params:{UserID:e,EntityID:a.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)},IsFavorite:s}});if(o&&o.SetRecordFavoriteStatus!==null)return o.SetRecordFavoriteStatus.Success}async GetCachedRecordName(e,t,r){const s=this._recordNames.Get(e,t);return!s&&r?this.GetEntityRecordName(e,t):s}HasCachedRecordName(e,t){return this._recordNames.Has(e,t)}GetCachedRecordNameOnlyIfCached(e,t){return this._recordNames.Get(e,t)}SetCachedRecordName(e,t,r){this._recordNames.Set(e,t,r)}async GetEntityRecordName(e,t,r,s=!1){return this._recordNames.GetOrFetch(e,t,s,()=>this.InternalGetEntityRecordName(e,t))}async GetEntityRecordNames(e,t,r=!1){return this._recordNames.GetOrFetchMany(e,r,s=>this.InternalGetEntityRecordNames(s))}async InternalGetEntityRecordName(e,t){if(!e||!t||t.KeyValuePairs?.length===0)return null;const r=u.gql`query GetEntityRecordNameQuery ($EntityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
647
647
|
GetEntityRecordName(EntityName: $EntityName, CompositeKey: $CompositeKey) {
|
|
648
648
|
Success
|
|
649
649
|
Status
|
|
@@ -674,9 +674,9 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
674
674
|
ErrorMessage
|
|
675
675
|
Result
|
|
676
676
|
}
|
|
677
|
-
}`,r=await this.ExecuteGQL(t,{DataContextItemID:e});if(r&&r.GetDataContextItemData){if(r.GetDataContextItemData.Success)return JSON.parse(r.GetDataContextItemData.Result);throw new Error(r.GetDataContextItemData.ErrorMessage)}else throw new Error("GraphQL query failed")}catch(t){throw c.LogError(t),t}}static async ExecuteGQL(e,t,r=!0){return
|
|
677
|
+
}`,r=await this.ExecuteGQL(t,{DataContextItemID:e});if(r&&r.GetDataContextItemData){if(r.GetDataContextItemData.Success)return JSON.parse(r.GetDataContextItemData.Result);throw new Error(r.GetDataContextItemData.ErrorMessage)}else throw new Error("GraphQL query failed")}catch(t){throw c.LogError(t),t}}static async ExecuteGQL(e,t,r=!0){return f.Instance.ExecuteGQL(e,t,r)}static async ExecuteGQLWithProgress(e,t,r,s=!0){return f.Instance.ExecuteGQLWithProgress(e,t,r,s)}async ExecuteGQLWithProgress(e,t,r,s=!0){if(!this._configData?.URL)throw new Error("GraphQLDataProvider is not configured with a URL.");const n=this._configData.URL,a=JSON.stringify({query:e,variables:t});return new Promise((i,o)=>{const y=new XMLHttpRequest;y.open("POST",n),y.setRequestHeader("Content-Type","application/json"),this._sessionId&&y.setRequestHeader("x-session-id",this._sessionId),this._configData?.Token&&y.setRequestHeader("authorization","Bearer "+this._configData.Token),this._configData?.MJAPIKey&&y.setRequestHeader("x-mj-api-key",this._configData.MJAPIKey),this._configData?.UserAPIKey&&y.setRequestHeader("x-api-key",this._configData.UserAPIKey);for(const[g,m]of this._dynamicHeaders)y.setRequestHeader(g,m);y.upload&&r&&(y.upload.onprogress=g=>{if(g.lengthComputable&&g.total>0){const m=Math.min(100,Math.round(g.loaded/g.total*100));r({loaded:g.loaded,total:g.total,percent:m})}}),y.onload=async()=>{if(y.status>=200&&y.status<300)try{const g=JSON.parse(y.responseText);if(g.errors&&g.errors.length>0){const m=g.errors[0];if(m?.extensions?.code?.toUpperCase()?.trim()==="JWT_EXPIRED"&&s){await this.RefreshToken(),i(await this.ExecuteGQLWithProgress(e,t,r,!1));return}o(new Error(m.message||"GraphQL Error"))}else i(g.data)}catch(g){o(g)}else o(new Error(`HTTP error ${y.status}: ${y.statusText}`))},y.onerror=()=>o(new Error("Network error during request")),y.onabort=()=>o(new Error("Request aborted")),y.send(a)})}async ExecuteGQL(e,t,r=!0){try{return await this._client.request(e,t)}catch(s){const n=q(s,this._configData?.LogVariableValues===!0);console.error("[GraphQL] ExecuteGQL error caught:",n);const a=W(s);if(s&&s.response&&s.response.errors?.length>0)if(s.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(r)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw c.LogError("JWT_EXPIRED and refreshTokenIfNeeded is false"),a}else throw a;else throw c.LogError(JSON.stringify(n)),a}}async RefreshToken(){const e=f.Instance&&f.Instance._configData===this._configData;if(e&&f.Instance._refreshPromise)return f.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(f.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&f.Instance&&(f.Instance._refreshPromise=null)}}async performTokenRefresh(){if(this._configData.Data.RefreshTokenFunction)try{const e=await this._configData.Data.RefreshTokenFunction();if(e){this._configData.Token=e;const t=this.CreateNewGraphQLClient(this._configData.URL,this._configData.Token,this._sessionId,this._configData.MJAPIKey,this._configData.UserAPIKey);this._client=t,f.Instance&&f.Instance._configData===this._configData&&(f.Instance._client=t)}else{const t=new Error("Refresh token function returned null or undefined token");throw this.notifyAuthenticationError(t),t}}catch(e){const t=e instanceof Error?e:new Error(String(e));throw this.notifyAuthenticationError(t),e}else{const e=new Error("No refresh token function provided");throw this.notifyAuthenticationError(e),e}}notifyAuthenticationError(e){try{const t=this._configData?.OnAuthenticationError;t&&t(e)}catch(t){console.error("[GraphQLDataProvider] Error in OnAuthenticationError callback:",t)}}static async RefreshToken(){return f.Instance.RefreshToken()}static async ClearClientCache(e=new Set){const t=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);s&&!e.has(s)&&t.push(s)}t.forEach(r=>localStorage.removeItem(r)),await new Promise(r=>{const s=indexedDB.deleteDatabase("MJ_Metadata");s.onsuccess=()=>r(),s.onerror=()=>r(),s.onblocked=()=>r()})}static async clearClientCache(e=new Set){return this.ClearClientCache(e)}CreateNewGraphQLClient(e,t,r,s,n){const a={"x-session-id":r};t&&(a.authorization="Bearer "+t),s&&(a["x-mj-api-key"]=s),n&&(a["x-api-key"]=n);const i=new u.GraphQLClient(e,{headers:a});for(const[o,y]of this._dynamicHeaders)i.setHeader(o,y);return H.set(i,z(e,t,s,n)),i}userInfoString(){return this.infoString(new c.UserInfo(null,null))}userRoleInfoString(){return this.infoString(new c.UserRoleInfo(null))}infoString(e){let t="";const r=Object.keys(e);for(const s of r)s.startsWith("__mj_")?t+=s.replace("__mj_","_mj__")+`
|
|
678
678
|
`:s.startsWith("_")||(t+=s+`
|
|
679
|
-
`);return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new
|
|
679
|
+
`);return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new J:this._localStorageProvider=new c.InMemoryLocalStorageProvider),this._localStorageProvider}get Metadata(){return this}get SocketReconnected$(){return this._socketReconnectedSubject.asObservable()}get SocketConnectivity$(){return this._socketStateSubject.asObservable()}get SocketConnectionState(){return this._socketStateSubject.value}get ActiveSubscriptionCount(){return this._activeSubscriptionCount}ForceSocketReconnect(){this.disposeWSClient()}getOrCreateWSClient(){const e=Date.now();if(this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&this._activeSubscriptionCount===0&&this.disposeWSClient(),!this._wsClient){this._isDisposingSocketIntentionally=!1;const t=se.createClient({url:this.ConfigData.WSURL,connectionParams:l(()=>({Authorization:"Bearer "+this.ConfigData.Token,...this.ConfigData.MJAPIKey?{"x-mj-api-key":this.ConfigData.MJAPIKey}:{},...this.ConfigData.UserAPIKey?{"x-mj-user-api-key":this.ConfigData.UserAPIKey}:{}}),"connectionParams"),keepAlive:Ee,connectionAckWaitTimeout:De,retryAttempts:3,shouldRetry:l(()=>!0,"shouldRetry")});this._wsClient=t,this._wsClientCreatedAt=e;let r=null;const s=l(()=>{r!==null&&(clearTimeout(r),r=null)},"disarmPongWatchdog");this._disarmPongWatchdog=s,t.on("ping",n=>{n||(s(),r=setTimeout(()=>{r=null;try{t.terminate()}catch{}},Re))}),t.on("pong",n=>{n&&s()}),t.on("connected",(n,a,i)=>{this._socketStateSubject.next("connected"),i&&this._socketReconnectedSubject.next()}),t.on("closed",n=>{if(s(),this._wsClient!==t||this._isDisposingSocketIntentionally)return;this._socketStateSubject.next("disconnected"),n?.code===4403&&this._configData.Data.RefreshTokenFunction&&this.RefreshToken().catch(()=>{})}),this._subscriptionCleanupTimer||(this._subscriptionCleanupTimer=setInterval(()=>{this.cleanupStaleSubscriptions()},this.SUBSCRIPTION_CLEANUP_INTERVAL_MS))}return this._wsClient}disposeWSClient(){if(this._wsClient){this._isDisposingSocketIntentionally=!0,this._disarmPongWatchdog?.(),this._disarmPongWatchdog=null;try{this._wsClient.dispose()}catch(e){console.error("[GraphQLDataProvider] Error disposing WebSocket client:",e)}this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject.next("unknown")}}completeAllSubjects(){this._pushStatusSubjects.forEach((e,t)=>{try{e.subject.complete(),e.subscription.unsubscribe()}catch(r){console.error(`[GraphQLDataProvider] Error cleaning up subject for ${t}:`,r)}}),this._pushStatusSubjects.clear(),this._taskGraphFrameStreams.forEach((e,t)=>{try{e.subject.complete(),e.subscription.unsubscribe()}catch(r){console.error(`[GraphQLDataProvider] Error cleaning up frame stream for ${t}:`,r)}}),this._taskGraphFrameStreams.clear()}cleanupStaleSubscriptions(){if(!this._isCleaningUp){this._isCleaningUp=!0;try{const e=Date.now(),t=this._pushStatusSubjects.size,r=Array.from(this._pushStatusSubjects.entries()),s=[];r.forEach(([n,a])=>{const i=e-a.lastRequestedAt,o=e-a.lastEmissionAt;a.activeSubscribers===0&&i>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&o>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&(console.log(`[GraphQLDataProvider] Marking session ${n} for cleanup: activeSubscribers=${a.activeSubscribers}, timeSinceRequested=${Math.round(i/1e3)}s, timeSinceEmission=${Math.round(o/1e3)}s`),s.push(n))}),s.forEach(n=>{const a=this._pushStatusSubjects.get(n);if(a)try{a.subject.complete(),a.subscription.unsubscribe(),this._pushStatusSubjects.delete(n),console.log(`[GraphQLDataProvider] Cleaned up stale subscription for session: ${n}`)}catch(i){console.error(`[GraphQLDataProvider] Error cleaning up subscription for ${n}:`,i)}}),s.length>0&&console.log(`[GraphQLDataProvider] Cleaned up ${s.length} stale subscription(s)`),this._pushStatusSubjects.size===0&&this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&(console.log("[GraphQLDataProvider] Disposing of idle WebSocket client"),this.disposeWSClient())}finally{this._isCleaningUp=!1}}}Subscribe(e,t){return new w.Observable(r=>{const s=this.getOrCreateWSClient();this._activeSubscriptionCount++;const n=s.subscribe({query:e,variables:t},{next:l(a=>{r.next(a.data)},"next"),error:l(async a=>{const i=a;if(i?.extensions?.code==="JWT_EXPIRED"||i?.message?.includes("token has expired")||i?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] WebSocket JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),r.complete()}catch(y){console.error("[GraphQLDataProvider] Failed to refresh token for WebSocket:",y),r.error(y)}}else r.error(a)},"error"),complete:l(()=>{r.complete()},"complete")});return()=>{this._activeSubscriptionCount--,n()}})}subscribe(e,t){return this.Subscribe(e,t)}PushStatusUpdates(e=null){e||(e=this.sessionId);const t=Date.now(),r=this._pushStatusSubjects.get(e);if(r)return r.lastRequestedAt=t,new w.Observable(o=>{r.activeSubscribers++;const y=r.subject.subscribe(o);return()=>{const g=this._pushStatusSubjects.get(e);g&&g.activeSubscribers>0&&g.activeSubscribers--,y.unsubscribe()}});const s=u.gql`subscription StatusUpdates($sessionId: String!) {
|
|
680
680
|
statusUpdates(sessionId: $sessionId) {
|
|
681
681
|
date
|
|
682
682
|
message
|
|
@@ -733,7 +733,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
733
733
|
OriginSessionID
|
|
734
734
|
RecordData
|
|
735
735
|
}
|
|
736
|
-
}`,t=this.Subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:l(r=>{const s=r?.cacheInvalidation;if(!s)return;if(s.OriginSessionID&&s.OriginSessionID===this.sessionId){
|
|
736
|
+
}`,t=this.Subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:l(r=>{const s=r?.cacheInvalidation;if(!s)return;if(s.OriginSessionID&&s.OriginSessionID===this.sessionId){f.VerboseCacheInvalidationLogging&&console.debug(`[GraphQLDataProvider] Skipping self-originated cache invalidation for "${s.EntityName}" (action: ${s.Action})`);return}f.VerboseCacheInvalidationLogging&&console.debug(`[GraphQLDataProvider] Cache invalidation received: ${s.Action} for "${s.EntityName}" from server ${s.SourceServerID?.substring(0,8)||"unknown"}`);const n={type:"remote-invalidate",entityName:s.EntityName,baseEntity:null,provider:this,payload:{primaryKeyValues:s.PrimaryKeyValues,action:s.Action,sourceServerId:s.SourceServerID,timestamp:s.Timestamp,recordData:s.RecordData}};v.MJGlobal.Instance.RaiseEvent({event:v.MJEventType.ComponentEvent,eventCode:c.BaseEntity.BaseEventCode,args:n,component:this})},"next"),error:l(r=>{console.error("[GraphQLDataProvider] Cache invalidation subscription error:",r),this._cacheInvalidationSubscription=null},"error"),complete:l(()=>{console.log("[GraphQLDataProvider] Cache invalidation subscription completed, will re-establish on next WebSocket creation"),this._cacheInvalidationSubscription=null},"complete")})}static{this.ClientMemberRefreshWindowMinMs=15e3}static{this.ClientMemberRefreshWindowJitterMs=3e4}get MetadataMemberRefreshDelayMs(){return f.ClientMemberRefreshWindowMinMs+Math.random()*f.ClientMemberRefreshWindowJitterMs}get MetadataMemberRefreshRearmsOnNewEvents(){return!1}async RefreshAfterMetadataMemberChange(){return this.RefreshIfNeeded(void 0,!0)}UnsubscribeFromCacheInvalidation(){this.CancelPendingMetadataMemberRefresh(),this._cacheInvalidationSubscription&&(this._cacheInvalidationSubscription.unsubscribe(),this._cacheInvalidationSubscription=null)}async FindISAChildEntity(e,t,r){if(!e.IsParentType)return null;const s=`query FindISAChildEntity($EntityName: String!, $RecordID: String!) {
|
|
737
737
|
FindISAChildEntity(EntityName: $EntityName, RecordID: $RecordID) {
|
|
738
738
|
Success
|
|
739
739
|
ChildEntityName
|
|
@@ -745,7 +745,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
745
745
|
ChildEntityNames
|
|
746
746
|
ErrorMessage
|
|
747
747
|
}
|
|
748
|
-
}`;try{const n=await this.ExecuteGQL(s,{EntityName:e.Name,RecordID:t});return n?.FindISAChildEntities?.Success&&n.FindISAChildEntities.ChildEntityNames?n.FindISAChildEntities.ChildEntityNames.map(a=>({ChildEntityName:a})):[]}catch(n){return c.LogError(`FindISAChildEntities failed for ${e.Name}: ${n}`),[]}}}async function
|
|
748
|
+
}`;try{const n=await this.ExecuteGQL(s,{EntityName:e.Name,RecordID:t});return n?.FindISAChildEntities?.Success&&n.FindISAChildEntities.ChildEntityNames?n.FindISAChildEntities.ChildEntityNames.map(a=>({ChildEntityName:a})):[]}catch(n){return c.LogError(`FindISAChildEntities failed for ${e.Name}: ${n}`),[]}}}async function X(d){const e=new f;if(c.SetProvider(e),await e.Config(d),await e.preValidateAndRefresh(),e.Entities.length===0){const t=`SetupGraphQLClient: no entity metadata was loaded from ${d.URL} \u2014 the metadata download failed or returned nothing`,r=e.LastMetadataLoadError;throw r?new Error(`${t}: ${r.message}`,{cause:r}):new Error(`${t}; see the logged GetAllMetadata error`)}return v.MJGlobal.Instance.RaiseEvent({event:v.MJEventType.LoggedIn,eventCode:null,component:this,args:null}),await c.StartupManager.Instance.Startup(),e}l(X,"SetupGraphQLClient");async function ve(d){const e=new f;if(e.Entities.length>0)return e;c.SetProvider(e);try{await e.Connect(d)}catch(t){const r=t instanceof Error?t:new Error(String(t)),s=new Error(`ConnectGraphQLClient: connecting to ${d.URL} failed: ${r.message}`,{cause:r});throw c.LogError(s.message),s}return e}l(ve,"ConnectGraphQLClient");async function Ce(d){return X(d)}l(Ce,"setupGraphQLClient");class we{static{l(this,"SyncRolesAndUsersResult")}}class $e{static{l(this,"RoleInput")}}class Pe{static{l(this,"UserInput")}}class Me{static{l(this,"RolesAndUsersInput")}}var Y=(d=>(d.Create="Create",d.Update="Update",d.CreateOrUpdate="CreateOrUpdate",d.Delete="Delete",d.DeleteWithFilter="DeleteWithFilter",d))(Y||{});class Ne{static{l(this,"ActionItemInput")}}class Le{static{l(this,"SyncDataResult")}constructor(){this.Results=[]}}class be{static{l(this,"ActionItemOutput")}}const Z=`Success
|
|
749
749
|
ErrorMessage
|
|
750
750
|
Query {
|
|
751
751
|
ID
|
|
@@ -800,7 +800,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
800
800
|
QueryID
|
|
801
801
|
RoleID
|
|
802
802
|
Role
|
|
803
|
-
}`;class
|
|
803
|
+
}`;class Ae{static{l(this,"GraphQLSystemUserClient")}get Client(){return this._client}constructor(e,t,r,s){const n={"x-session-id":r};this._sessionId=r,t&&(n.authorization="Bearer "+t),s&&(n["x-mj-api-key"]=s),this._client=new u.GraphQLClient(e,{headers:n})}resolvePlatformSQL(e){if(e!=null)return c.IsPlatformSQL(e)?e.default:e}async GetData(e,t){try{const s=await this.Client.request(`query GetData($input: GetDataInputType!) {
|
|
804
804
|
GetData(input: $input) {
|
|
805
805
|
Success
|
|
806
806
|
ErrorMessages
|
|
@@ -952,11 +952,11 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
952
952
|
}
|
|
953
953
|
}`,r={QueryName:e.QueryName};e.CategoryID!==void 0&&(r.CategoryID=e.CategoryID),e.CategoryPath!==void 0&&(r.CategoryPath=e.CategoryPath),e.Parameters!==void 0&&(r.Parameters=e.Parameters),e.MaxRows!==void 0&&(r.MaxRows=e.MaxRows),e.StartRow!==void 0&&(r.StartRow=e.StartRow),e.Enrichment!==void 0&&(r.Enrichment=e.Enrichment);const s=await this.Client.request(t,r);return s&&s.GetQueryDataByNameSystemUser?{...s.GetQueryDataByNameSystemUser,Results:s.GetQueryDataByNameSystemUser.Results?v.SafeJSONParse(s.GetQueryDataByNameSystemUser.Results):null}:{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return c.LogError(`GraphQLSystemUserClient::GetQueryDataByNameSystemUser - Error executing query - ${t}`),{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:t.toString()}}}async CreateQuery(e){try{const t=`mutation CreateQueryExtended($input: CreateQuerySystemUserInput!) {
|
|
954
954
|
CreateQueryExtended(input: $input) {
|
|
955
|
-
${
|
|
955
|
+
${Z}
|
|
956
956
|
}
|
|
957
957
|
}`,r=await this.Client.request(t,{input:e});return r&&r.CreateQueryExtended?r.CreateQueryExtended:{Success:!1,ErrorMessage:"Failed to create query"}}catch(t){return c.LogError(`GraphQLSystemUserClient::CreateQuery - Error creating query - ${t}`),{Success:!1,ErrorMessage:t.toString()}}}async UpdateQuery(e){try{const t=`mutation UpdateQueryExtended($input: UpdateQuerySystemUserInput!) {
|
|
958
958
|
UpdateQueryExtended(input: $input) {
|
|
959
|
-
${
|
|
959
|
+
${Z}
|
|
960
960
|
}
|
|
961
961
|
}`,r=await this.Client.request(t,{input:e});return r&&r.UpdateQueryExtended?r.UpdateQueryExtended:{Success:!1,ErrorMessage:"Failed to update query"}}catch(t){return c.LogError(`GraphQLSystemUserClient::UpdateQuery - Error updating query - ${t}`),{Success:!1,ErrorMessage:t.toString()}}}async DeleteQuery(e,t){try{if(!e||e.trim()==="")return c.LogError("GraphQLSystemUserClient::DeleteQuery - Invalid query ID: ID cannot be null or empty"),{Success:!1,ErrorMessage:"Invalid query ID: ID cannot be null or empty"};const r=`mutation DeleteQueryExtended($ID: String!, $options: DeleteOptionsInput) {
|
|
962
962
|
DeleteQueryExtended(ID: $ID, options: $options) {
|
|
@@ -1203,7 +1203,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1203
1203
|
ErrorMessage
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
|
-
`,s={EntityNames:e,UserEmail:t},n=await this.Client.request(r,s);if(n?.CheckEntityPermissionsSystemUser){const a=n.CheckEntityPermissionsSystemUser;return{Success:a.Success,Results:(a.Results||[]).map(i=>({EntityName:i.EntityName,CanRead:i.CanRead})),ErrorMessage:a.ErrorMessage}}return{Success:!1,Results:[],ErrorMessage:"Invalid response from server"}}catch(r){return c.LogError(`GraphQLSystemUserClient::CheckEntityPermissionsSystemUser - Error checking entity permissions - ${r}`),{Success:!1,Results:[],ErrorMessage:r instanceof Error?r.message:String(r)}}}}class
|
|
1206
|
+
`,s={EntityNames:e,UserEmail:t},n=await this.Client.request(r,s);if(n?.CheckEntityPermissionsSystemUser){const a=n.CheckEntityPermissionsSystemUser;return{Success:a.Success,Results:(a.Results||[]).map(i=>({EntityName:i.EntityName,CanRead:i.CanRead})),ErrorMessage:a.ErrorMessage}}return{Success:!1,Results:[],ErrorMessage:"Invalid response from server"}}catch(r){return c.LogError(`GraphQLSystemUserClient::CheckEntityPermissionsSystemUser - Error checking entity permissions - ${r}`),{Success:!1,Results:[],ErrorMessage:r instanceof Error?r.message:String(r)}}}}class Te{static{l(this,"GetDataOutput")}}class xe{static{l(this,"SimpleRemoteEntityOutput")}}class Fe{static{l(this,"SimpleRemoteEntity")}}class Ge{static{l(this,"SimpleRemoteEntityField")}}class qe{static{l(this,"GraphQLActionClient")}constructor(e){this._dataProvider=e}async RunAction(e,t,r=!1){try{const s=this.serializeActionParameters(t),n=this.createActionVariables(e,s,r),a=await this.executeActionMutation(n);return this.processActionResult(a,t)}catch(s){return this.handleActionError(s,t)}}serializeActionParameters(e){if(e)return e.map(t=>{let r=t.Value;return r!=null&&typeof r=="object"&&(r=JSON.stringify(r)),{...t,Value:r}})}createActionVariables(e,t,r=!1){return{input:{ActionID:e,Params:t,SkipActionLog:r}}}async executeActionMutation(e){const t=u.gql`
|
|
1207
1207
|
mutation RunAction($input: RunActionInput!) {
|
|
1208
1208
|
RunAction(input: $input) {
|
|
1209
1209
|
Success
|
|
@@ -1220,63 +1220,63 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1220
1220
|
ResultData
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
|
-
`;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(r){c.LogError(`Failed to parse entity action result data: ${r}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return c.LogError(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}}class
|
|
1223
|
+
`;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(r){c.LogError(`Failed to parse entity action result data: ${r}`)}return{Success:e.RunEntityAction.Success,Message:e.RunEntityAction.Message,RunParams:null,LogEntry:null,...t}}handleEntityActionError(e){const t=e;return c.LogError(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}}class Qe{static{l(this,"GraphQLListsClient")}constructor(e){this.dataProvider=e}async PreviewListDelta(e){const t=u.gql`
|
|
1224
1224
|
query PreviewListDelta($input: ComputeDeltaInput!) {
|
|
1225
1225
|
PreviewListDelta(input: $input) {
|
|
1226
1226
|
...ListDeltaFields
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
|
-
${
|
|
1230
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{input:{Target:e.Target,Source:
|
|
1229
|
+
${ee}
|
|
1230
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{input:{Target:e.Target,Source:_(e.Source),Mode:e.Mode}});return te(r?.PreviewListDelta)}async ApplyListDelta(e){const t=u.gql`
|
|
1231
1231
|
mutation ApplyListDelta($input: ApplyDeltaInput!) {
|
|
1232
1232
|
ApplyListDelta(input: $input) {
|
|
1233
1233
|
...ApplyResultFields
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
|
-
${
|
|
1237
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{input:{TargetListId:e.Delta.TargetListId,EntityName:e.Delta.EntityName,ToAdd:e.Delta.ToAdd,ToRemove:e.Delta.ToRemove,Unchanged:e.Delta.Unchanged,AddCount:e.Delta.Counts.Add,RemoveCount:e.Delta.Counts.Remove,UnchangedCount:e.Delta.Counts.Unchanged,SourceTotal:e.Delta.Counts.SourceTotal,TargetTotal:e.Delta.Counts.TargetTotal,DeltaToken:e.Delta.DeltaToken,ConfirmDrops:e.ConfirmDrops}});return
|
|
1236
|
+
${T}
|
|
1237
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{input:{TargetListId:e.Delta.TargetListId,EntityName:e.Delta.EntityName,ToAdd:e.Delta.ToAdd,ToRemove:e.Delta.ToRemove,Unchanged:e.Delta.Unchanged,AddCount:e.Delta.Counts.Add,RemoveCount:e.Delta.Counts.Remove,UnchangedCount:e.Delta.Counts.Unchanged,SourceTotal:e.Delta.Counts.SourceTotal,TargetTotal:e.Delta.Counts.TargetTotal,DeltaToken:e.Delta.DeltaToken,ConfirmDrops:e.ConfirmDrops}});return x(r?.ApplyListDelta)}async MaterializeFromView(e,t){const r=u.gql`
|
|
1238
1238
|
mutation MaterializeListFromView($viewId: String!, $options: MaterializeOptionsInput!) {
|
|
1239
1239
|
MaterializeListFromView(viewId: $viewId, options: $options) {
|
|
1240
1240
|
...ApplyResultFields
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
|
-
${
|
|
1244
|
-
`,s=await this.dataProvider.ExecuteGQL(r,{viewId:e,options:{ListName:t.ListName,CategoryId:t.CategoryId,Description:t.Description,RememberLineage:t.RememberLineage,UseSnapshot:t.UseSnapshot,RefreshMode:t.RefreshMode}});return
|
|
1243
|
+
${T}
|
|
1244
|
+
`,s=await this.dataProvider.ExecuteGQL(r,{viewId:e,options:{ListName:t.ListName,CategoryId:t.CategoryId,Description:t.Description,RememberLineage:t.RememberLineage,UseSnapshot:t.UseSnapshot,RefreshMode:t.RefreshMode}});return x(s?.MaterializeListFromView)}async AddViewResultsToList(e,t){const r=u.gql`
|
|
1245
1245
|
mutation AddViewResultsToList($viewId: String!, $listId: String!) {
|
|
1246
1246
|
AddViewResultsToList(viewId: $viewId, listId: $listId) {
|
|
1247
1247
|
...ApplyResultFields
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
|
-
${
|
|
1251
|
-
`,s=await this.dataProvider.ExecuteGQL(r,{viewId:e,listId:t});return
|
|
1250
|
+
${T}
|
|
1251
|
+
`,s=await this.dataProvider.ExecuteGQL(r,{viewId:e,listId:t});return x(s?.AddViewResultsToList)}async RefreshFromSource(e){const t=u.gql`
|
|
1252
1252
|
mutation RefreshListFromSource($listId: String!, $mode: String!, $confirmDrops: Boolean!) {
|
|
1253
1253
|
RefreshListFromSource(listId: $listId, mode: $mode, confirmDrops: $confirmDrops) {
|
|
1254
1254
|
...ApplyResultFields
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
${
|
|
1258
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{listId:e.ListId,mode:e.Mode,confirmDrops:e.ConfirmDrops});return
|
|
1257
|
+
${T}
|
|
1258
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{listId:e.ListId,mode:e.Mode,confirmDrops:e.ConfirmDrops});return x(r?.RefreshListFromSource)}async ComposeLists(e){const t=u.gql`
|
|
1259
1259
|
mutation ComposeLists($input: ComposeListsInput!) {
|
|
1260
1260
|
ComposeLists(input: $input) {
|
|
1261
1261
|
...ListDeltaFields
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
${
|
|
1265
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{input:{Op:e.Op,Inputs:e.Inputs.map(
|
|
1264
|
+
${ee}
|
|
1265
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{input:{Op:e.Op,Inputs:e.Inputs.map(_),Target:e.Target?_(e.Target):null}});return te(r?.ComposeLists)}async Share(e){const t=u.gql`
|
|
1266
1266
|
mutation ShareList($input: ShareListInput!) {
|
|
1267
1267
|
ShareList(input: $input) {
|
|
1268
1268
|
...ShareResultFields
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
${
|
|
1272
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{input:{ListID:e.ListID,Target:
|
|
1271
|
+
${Q}
|
|
1272
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{input:{ListID:e.ListID,Target:Ue(e.Target),PermissionLevel:e.PermissionLevel}});return U(r?.ShareList)}async Unshare(e){const t=u.gql`
|
|
1273
1273
|
mutation UnshareList($permissionId: String!) {
|
|
1274
1274
|
UnshareList(permissionId: $permissionId) {
|
|
1275
1275
|
...ShareResultFields
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
|
-
${
|
|
1279
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{permissionId:e});return
|
|
1278
|
+
${Q}
|
|
1279
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{permissionId:e});return U(r?.UnshareList)}async Invite(e){const t=u.gql`
|
|
1280
1280
|
mutation InviteToList($input: InviteToListInput!) {
|
|
1281
1281
|
InviteToList(input: $input) {
|
|
1282
1282
|
Success
|
|
@@ -1303,8 +1303,8 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1303
1303
|
...ShareResultFields
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
|
-
${
|
|
1307
|
-
`,r=await this.dataProvider.ExecuteGQL(t,{invitationId:e});return
|
|
1306
|
+
${Q}
|
|
1307
|
+
`,r=await this.dataProvider.ExecuteGQL(t,{invitationId:e});return U(r?.RevokeListInvitation)}async GetSharesForList(e){const t=u.gql`
|
|
1308
1308
|
query ListSharesForList($listId: String!) {
|
|
1309
1309
|
ListSharesForList(listId: $listId) {
|
|
1310
1310
|
PermissionID
|
|
@@ -1320,7 +1320,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1320
1320
|
CreatedAt
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
|
-
`;return((await this.dataProvider.ExecuteGQL(t,{listId:e}))?.ListSharesForList??[]).map(
|
|
1323
|
+
`;return((await this.dataProvider.ExecuteGQL(t,{listId:e}))?.ListSharesForList??[]).map(_e)}async ListsSharedWithMe(){const e=u.gql`
|
|
1324
1324
|
query ListsSharedWithMe {
|
|
1325
1325
|
ListsSharedWithMe {
|
|
1326
1326
|
ListID
|
|
@@ -1330,7 +1330,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1330
1330
|
SharedAt
|
|
1331
1331
|
}
|
|
1332
1332
|
}
|
|
1333
|
-
`;return((await this.dataProvider.ExecuteGQL(e,{}))?.ListsSharedWithMe??[]).map(s=>({ListID:s.ListID,ListName:s.ListName,PermissionLevel:s.PermissionLevel,SharedByUserID:s.SharedByUserID??null,SharedAt:new Date(s.SharedAt)}))}}const
|
|
1333
|
+
`;return((await this.dataProvider.ExecuteGQL(e,{}))?.ListsSharedWithMe??[]).map(s=>({ListID:s.ListID,ListName:s.ListName,PermissionLevel:s.PermissionLevel,SharedByUserID:s.SharedByUserID??null,SharedAt:new Date(s.SharedAt)}))}}const ee=u.gql`
|
|
1334
1334
|
fragment ListDeltaFields on ListDeltaType {
|
|
1335
1335
|
TargetListId
|
|
1336
1336
|
EntityName
|
|
@@ -1351,7 +1351,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1351
1351
|
}
|
|
1352
1352
|
DeltaToken
|
|
1353
1353
|
}
|
|
1354
|
-
`,
|
|
1354
|
+
`,T=u.gql`
|
|
1355
1355
|
fragment ApplyResultFields on ApplyListResultType {
|
|
1356
1356
|
Success
|
|
1357
1357
|
ResultCode
|
|
@@ -1363,14 +1363,14 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1363
1363
|
FailedCount
|
|
1364
1364
|
Errors
|
|
1365
1365
|
}
|
|
1366
|
-
`,
|
|
1366
|
+
`,Q=u.gql`
|
|
1367
1367
|
fragment ShareResultFields on ShareResultType {
|
|
1368
1368
|
Success
|
|
1369
1369
|
ResultCode
|
|
1370
1370
|
Message
|
|
1371
1371
|
PermissionID
|
|
1372
1372
|
}
|
|
1373
|
-
`;function
|
|
1373
|
+
`;function Ue(d){return d.kind==="user"?{Kind:"user",UserID:d.userId}:{Kind:"role",RoleID:d.roleId}}l(Ue,"serializeShareTarget");function U(d){if(!d||typeof d!="object")throw new Error("GraphQLListsClient: empty/invalid ShareResult response");const e=d;return{Success:e.Success,ResultCode:e.ResultCode,Message:e.Message,PermissionID:e.PermissionID??void 0}}l(U,"parseShareResult");function _e(d){const e=d,t=e.Target.Kind==="user"?{kind:"user",userId:e.Target.UserID}:{kind:"role",roleId:e.Target.RoleID};return{PermissionID:e.PermissionID,ListID:e.ListID,Target:t,PermissionLevel:e.PermissionLevel,Status:e.Status,SharedByUserID:e.SharedByUserID??null,CreatedAt:new Date(e.CreatedAt)}}l(_e,"parseShareSummary");function _(d){switch(d.kind){case"list":return{Kind:"list",ListID:d.listId};case"view":return{Kind:"view",ViewID:d.viewId};case"adhoc":return{Kind:"adhoc",EntityName:d.entityName,ExtraFilter:d.extraFilter}}}l(_,"serializeListSource");function te(d){if(!d||typeof d!="object")throw new Error("GraphQLListsClient: empty/invalid ListDelta response from server");const e=d;return{TargetListId:e.TargetListId,EntityName:e.EntityName,ToAdd:e.ToAdd,ToRemove:e.ToRemove,Unchanged:e.Unchanged,Counts:e.Counts,Warnings:e.Warnings.map(Oe),DeltaToken:e.DeltaToken}}l(te,"parseListDelta");function Oe(d){let e;if(d.DetailsJSON)try{e=JSON.parse(d.DetailsJSON)}catch(t){c.LogError(`GraphQLListsClient: failed to parse warning details JSON: ${t}`)}return{Code:d.Code,Message:d.Message,Details:e}}l(Oe,"parseWarning");function x(d){if(!d||typeof d!="object")throw new Error("GraphQLListsClient: empty/invalid ApplyResult response from server");const e=d;return{Success:e.Success,ResultCode:e.ResultCode,Message:e.Message,CreatedListId:e.CreatedListId??void 0,TargetListId:e.TargetListId??void 0,Counts:e.AddedCount!=null||e.RemovedCount!=null||e.FailedCount!=null?{Added:e.AddedCount??0,Removed:e.RemovedCount??0,Failed:e.FailedCount??0}:void 0,Errors:e.Errors??void 0}}l(x,"parseApplyResult");class Ve{static{l(this,"GraphQLEncryptionClient")}constructor(e){this._dataProvider=e}async CreateAPIKey(e){try{const t=this.createAPIKeyVariables(e),r=await this.executeCreateAPIKeyMutation(t);return this.processCreateAPIKeyResult(r)}catch(t){return this.handleCreateAPIKeyError(t)}}createAPIKeyVariables(e){return{input:{Label:e.Label,Description:e.Description,ExpiresAt:e.ExpiresAt?.toISOString(),ScopeIDs:e.ScopeIDs}}}async executeCreateAPIKeyMutation(e){const t=u.gql`
|
|
1374
1374
|
mutation CreateAPIKey($input: CreateAPIKeyInput!) {
|
|
1375
1375
|
CreateAPIKey(input: $input) {
|
|
1376
1376
|
Success
|
|
@@ -1386,7 +1386,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1386
1386
|
Error
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
|
-
`,s=await this._dataProvider.ExecuteGQL(t,{apiKeyId:e});return s?.RevokeAPIKey?{Success:s.RevokeAPIKey.Success,Error:s.RevokeAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}catch(t){const r=t;return c.LogError(`Error revoking API key: ${r.message}`),{Success:!1,Error:`Error: ${r.message}`}}}}class
|
|
1389
|
+
`,s=await this._dataProvider.ExecuteGQL(t,{apiKeyId:e});return s?.RevokeAPIKey?{Success:s.RevokeAPIKey.Success,Error:s.RevokeAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}catch(t){const r=t;return c.LogError(`Error revoking API key: ${r.message}`),{Success:!1,Error:`Error: ${r.message}`}}}}class ke{static{l(this,"GraphQLClusterClient")}constructor(e){this._dataProvider=e}async RunClusterAnalysis(e){try{const t=u.gql`
|
|
1390
1390
|
mutation RunClusterAnalysis($input: RunClusterAnalysisInput!) {
|
|
1391
1391
|
RunClusterAnalysis(input: $input) {
|
|
1392
1392
|
Success
|
|
@@ -1402,7 +1402,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1402
1402
|
AnalysisID
|
|
1403
1403
|
}
|
|
1404
1404
|
}
|
|
1405
|
-
`,s=(await this._dataProvider.ExecuteGQL(t,{input:e}))?.RunClusterAnalysis;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return c.LogError("GraphQLClusterClient.RunClusterAnalysis failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=this.parseMetrics(e),r=v.SafeJSONParse(e.ClustersJSON)??[],s=v.SafeJSONParse(e.PointsJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Metrics:t,Clusters:r,Points:s,AnalysisID:e.AnalysisID}}parseMetrics(e){const t=v.SafeJSONParse(e.MetricsJSON);return t||{SilhouetteScore:e.SilhouetteScore,ClusterCount:e.ClusterCount,ComputationTimeMs:e.ComputationTimeMs,RecordCount:e.RecordCount,OutlierCount:e.OutlierCount}}errorResult(e){return{Success:!1,ErrorMessage:e,Metrics:{SilhouetteScore:0,ClusterCount:0,ComputationTimeMs:0,RecordCount:0,OutlierCount:0},Clusters:[],Points:[]}}}class
|
|
1405
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{input:e}))?.RunClusterAnalysis;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return c.LogError("GraphQLClusterClient.RunClusterAnalysis failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=this.parseMetrics(e),r=v.SafeJSONParse(e.ClustersJSON)??[],s=v.SafeJSONParse(e.PointsJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Metrics:t,Clusters:r,Points:s,AnalysisID:e.AnalysisID}}parseMetrics(e){const t=v.SafeJSONParse(e.MetricsJSON);return t||{SilhouetteScore:e.SilhouetteScore,ClusterCount:e.ClusterCount,ComputationTimeMs:e.ComputationTimeMs,RecordCount:e.RecordCount,OutlierCount:e.OutlierCount}}errorResult(e){return{Success:!1,ErrorMessage:e,Metrics:{SilhouetteScore:0,ClusterCount:0,ComputationTimeMs:0,RecordCount:0,OutlierCount:0},Clusters:[],Points:[]}}}class Ke{static{l(this,"GraphQLLiveKitClient")}constructor(e){this._dataProvider=e}async MintClientToken(e){try{const t=u.gql`
|
|
1406
1406
|
mutation MintLiveKitClientToken($input: MintLiveKitClientTokenInput!) {
|
|
1407
1407
|
MintLiveKitClientToken(input: $input) {
|
|
1408
1408
|
Success
|
|
@@ -1437,7 +1437,15 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1437
1437
|
mutation InviteUsersToLiveKitRoom($roomName: String!, $userIDs: [String!]!) {
|
|
1438
1438
|
InviteUsersToLiveKitRoom(roomName: $roomName, userIDs: $userIDs)
|
|
1439
1439
|
}
|
|
1440
|
-
`;return(await this._dataProvider.ExecuteGQL(r,{roomName:e,userIDs:t}))?.InviteUsersToLiveKitRoom===!0}catch(r){return c.LogError("GraphQLLiveKitClient.InviteUsers failed",void 0,r),!1}}async
|
|
1440
|
+
`;return(await this._dataProvider.ExecuteGQL(r,{roomName:e,userIDs:t}))?.InviteUsersToLiveKitRoom===!0}catch(r){return c.LogError("GraphQLLiveKitClient.InviteUsers failed",void 0,r),!1}}async GetRoomTurnState(e){try{const t=u.gql`
|
|
1441
|
+
query GetLiveKitRoomTurnState($roomName: String!) {
|
|
1442
|
+
GetLiveKitRoomTurnState(roomName: $roomName) {
|
|
1443
|
+
Success
|
|
1444
|
+
ErrorMessage
|
|
1445
|
+
StateJSON
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{roomName:e}))?.GetLiveKitRoomTurnState;if(!s)throw new Error("Invalid response from server");const n=s.StateJSON?JSON.parse(s.StateJSON):null;return{Success:s.Success,ErrorMessage:s.ErrorMessage,State:s.Success?n:null}}catch(t){const r=t;return c.LogError("GraphQLLiveKitClient.GetRoomTurnState failed",void 0,r),{Success:!1,ErrorMessage:r.message||"Unknown error",State:null}}}async GetRealtimeModelVoices(){try{const e=u.gql`
|
|
1441
1449
|
query GetRealtimeModelVoices {
|
|
1442
1450
|
GetRealtimeModelVoices {
|
|
1443
1451
|
ModelID
|
|
@@ -1467,7 +1475,51 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1467
1475
|
RecordingFileID
|
|
1468
1476
|
}
|
|
1469
1477
|
}
|
|
1470
|
-
`,{egressID:e},"StopLiveKitRecording",e)}async runRecordingMutation(e,t,r,s){try{const a=(await this._dataProvider.ExecuteGQL(e,t))?.[r];if(!a)throw new Error("Invalid response from server");return a}catch(n){const a=n;return c.LogError(`GraphQLLiveKitClient.${r} failed`,void 0,a),{Success:!1,ErrorMessage:a.message||"Unknown error",EgressID:s,Status:""}}}}
|
|
1478
|
+
`,{egressID:e},"StopLiveKitRecording",e)}async runRecordingMutation(e,t,r,s){try{const a=(await this._dataProvider.ExecuteGQL(e,t))?.[r];if(!a)throw new Error("Invalid response from server");return a}catch(n){const a=n;return c.LogError(`GraphQLLiveKitClient.${r} failed`,void 0,a),{Success:!1,ErrorMessage:a.message||"Unknown error",EgressID:s,Status:""}}}}const O=`
|
|
1479
|
+
OfferID
|
|
1480
|
+
RoomName
|
|
1481
|
+
Mode
|
|
1482
|
+
Summary
|
|
1483
|
+
CallerLabel
|
|
1484
|
+
AgentName
|
|
1485
|
+
Status
|
|
1486
|
+
CreatedAt
|
|
1487
|
+
ExpiresAt
|
|
1488
|
+
InteractionID
|
|
1489
|
+
`;class Be{static{l(this,"GraphQLHandoffClient")}constructor(e){this._dataProvider=e}async GetMyOffers(){try{const e=u.gql`
|
|
1490
|
+
query MyHandoffOffers {
|
|
1491
|
+
MyHandoffOffers {
|
|
1492
|
+
${O}
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
`;return(await this._dataProvider.ExecuteGQL(e,{}))?.MyHandoffOffers??[]}catch(e){return c.LogError("GraphQLHandoffClient.GetMyOffers failed",void 0,e),[]}}async AcceptOffer(e){try{const t=u.gql`
|
|
1496
|
+
mutation AcceptHandoffOffer($offerID: String!) {
|
|
1497
|
+
AcceptHandoffOffer(offerID: $offerID) {
|
|
1498
|
+
Success
|
|
1499
|
+
ErrorMessage
|
|
1500
|
+
RoomName
|
|
1501
|
+
Offer {
|
|
1502
|
+
${O}
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{offerID:e}))?.AcceptHandoffOffer;if(!s)throw new Error("Invalid response from server");return s}catch(t){const r=t;return c.LogError("GraphQLHandoffClient.AcceptOffer failed",void 0,r),{Success:!1,ErrorMessage:r.message||"Unknown error",RoomName:""}}}async DeclineOffer(e){try{const t=u.gql`
|
|
1507
|
+
mutation DeclineHandoffOffer($offerID: String!) {
|
|
1508
|
+
DeclineHandoffOffer(offerID: $offerID) {
|
|
1509
|
+
Success
|
|
1510
|
+
ErrorMessage
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{offerID:e}))?.DeclineHandoffOffer;if(!s)throw new Error("Invalid response from server");return s}catch(t){const r=t;return c.LogError("GraphQLHandoffClient.DeclineOffer failed",void 0,r),{Success:!1,ErrorMessage:r.message||"Unknown error"}}}ObserveOfferChanges(){const e=u.gql`
|
|
1514
|
+
subscription HandoffOfferChanges {
|
|
1515
|
+
HandoffOfferChanges {
|
|
1516
|
+
Kind
|
|
1517
|
+
Offer {
|
|
1518
|
+
${O}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
`;return this._dataProvider.Subscribe(e).pipe(w.map(t=>t?.HandoffOfferChanges),w.filter(t=>t!=null))}}class je{static{l(this,"GraphQLClassifyClient")}constructor(e){this._dataProvider=e}async GenerateSeedTaxonomy(e){try{const t=u.gql`
|
|
1471
1523
|
mutation GenerateSeedTaxonomy($sourceID: String!, $sampleSize: Int!) {
|
|
1472
1524
|
GenerateSeedTaxonomy(sourceID: $sourceID, sampleSize: $sampleSize) {
|
|
1473
1525
|
Success
|
|
@@ -1477,7 +1529,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1477
1529
|
NodesJSON
|
|
1478
1530
|
}
|
|
1479
1531
|
}
|
|
1480
|
-
`,s=(await this._dataProvider.ExecuteGQL(t,{sourceID:e.SourceID,sampleSize:e.SampleSize}))?.GenerateSeedTaxonomy;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return c.LogError("GraphQLClassifyClient.GenerateSeedTaxonomy failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=v.SafeJSONParse(e.NodesJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Method:e.Method,SampleSize:e.SampleSize,Nodes:t}}errorResult(e){return{Success:!1,ErrorMessage:e,SampleSize:0,Nodes:[]}}}class
|
|
1532
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{sourceID:e.SourceID,sampleSize:e.SampleSize}))?.GenerateSeedTaxonomy;if(!s)throw new Error("Invalid response from server");return this.parseResult(s)}catch(t){const r=t;return c.LogError("GraphQLClassifyClient.GenerateSeedTaxonomy failed",void 0,r),this.errorResult(r.message||"Unknown error occurred")}}parseResult(e){const t=v.SafeJSONParse(e.NodesJSON)??[];return{Success:e.Success,ErrorMessage:e.ErrorMessage,Method:e.Method,SampleSize:e.SampleSize,Nodes:t}}errorResult(e){return{Success:!1,ErrorMessage:e,SampleSize:0,Nodes:[]}}}class Je{static{l(this,"GraphQLTestingClient")}constructor(e){this._dataProvider=e}async RunTest(e){try{const t=this.buildRunTestMutation(),r=this.buildRunTestVariables(e),s={};return await $.Execute({dataProvider:this._dataProvider,mutation:t,variables:r,mutationFieldName:"RunTest",operationLabel:"RunTest",validateAck:l(n=>n?.success===!0,"validateAck"),isCompletionEvent:l(n=>this.isTestCompletionEvent(n,e.testId),"isCompletionEvent"),extractResult:l(n=>this.extractTestResult(n),"extractResult"),onMessage:l(n=>{this.captureTestRunId(n,s),e.onProgress&&this.forwardTestProgress(n,e.onProgress)},"onMessage"),onStall:l(()=>this.reconcileTestRun(s),"onStall"),createErrorResult:l(n=>({success:!1,errorMessage:n,result:null}),"createErrorResult")})}catch(t){return this.handleError(t,"RunTest")}}async RunTestSuite(e){try{const t=this.buildRunTestSuiteMutation(),r=this.buildRunTestSuiteVariables(e);return await $.Execute({dataProvider:this._dataProvider,mutation:t,variables:r,mutationFieldName:"RunTestSuite",operationLabel:"RunTestSuite",validateAck:l(s=>s?.success===!0,"validateAck"),isCompletionEvent:l(s=>this.isSuiteCompletionEvent(s,e.suiteId),"isCompletionEvent"),extractResult:l(s=>this.extractSuiteResult(s),"extractResult"),onMessage:e.onProgress?s=>this.forwardTestProgress(s,e.onProgress):void 0,createErrorResult:l(s=>({success:!1,errorMessage:s,result:null}),"createErrorResult")})}catch(t){return this.handleError(t,"RunTestSuite")}}async IsTestRunning(e){try{const t=u.gql`
|
|
1481
1533
|
query IsTestRunning($testId: String!) {
|
|
1482
1534
|
IsTestRunning(testId: $testId)
|
|
1483
1535
|
}
|
|
@@ -1535,7 +1587,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1535
1587
|
result
|
|
1536
1588
|
}
|
|
1537
1589
|
}
|
|
1538
|
-
`}buildRunTestVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0;return{testId:e.testId,verbose:e.verbose,environment:e.environment,tags:t,variables:r,fireAndForget:!0}}buildRunTestSuiteVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0,s=e.selectedTestIds&&e.selectedTestIds.length>0?JSON.stringify(e.selectedTestIds):void 0;return{suiteId:e.suiteId,verbose:e.verbose,environment:e.environment,parallel:e.parallel,tags:t,variables:r,selectedTestIds:s,sequenceStart:e.sequenceStart,sequenceEnd:e.sequenceEnd,fireAndForget:!0}}isTestCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetComplete"&&r?.type==="complete"&&r?.testId===t}isSuiteCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetSuiteComplete"&&r?.type==="complete"&&r?.suiteId===t}captureTestRunId(e,t){if(e.resolver!=="RunTestResolver")return;const s=e.data?.testRunId;s&&(t.id=s)}async reconcileTestRun(e){if(!e.id)return"continue";const t=await this._dataProvider.RunView({EntityName:"MJ: Test Runs",ExtraFilter:`ID='${e.id}'`,ResultType:"entity_object",BypassCache:!0}),r=t.Success?t.Results?.[0]:void 0;if(!r||r.Status==="Pending"||r.Status==="Running")return"continue";const s=r.Status==="Passed";return{resolve:{success:s,errorMessage:s?void 0:`Test run ${r.Status}`,result:null}}}extractTestResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?v.SafeJSONParse(t.result):null}}extractSuiteResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?v.SafeJSONParse(t.result):null}}forwardTestProgress(e,t){if(e.resolver==="RunTestResolver"&&e.type==="TestExecutionProgress"&&e.status==="ok"){const s=e.data?.progress;s&&t(s)}}handleError(e,t){const r=e.message;return c.LogError(`${t} failed: ${r}`),{success:!1,errorMessage:r.includes("Failed to fetch")||r.includes("NetworkError")?"Lost connection to the server. The test may still be running. Please refresh to check the latest status.":r,result:null}}}class
|
|
1590
|
+
`}buildRunTestVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0;return{testId:e.testId,verbose:e.verbose,environment:e.environment,tags:t,variables:r,fireAndForget:!0}}buildRunTestSuiteVariables(e){const t=e.tags&&e.tags.length>0?JSON.stringify(e.tags):void 0,r=e.variables?JSON.stringify(e.variables):void 0,s=e.selectedTestIds&&e.selectedTestIds.length>0?JSON.stringify(e.selectedTestIds):void 0;return{suiteId:e.suiteId,verbose:e.verbose,environment:e.environment,parallel:e.parallel,tags:t,variables:r,selectedTestIds:s,sequenceStart:e.sequenceStart,sequenceEnd:e.sequenceEnd,fireAndForget:!0}}isTestCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetComplete"&&r?.type==="complete"&&r?.testId===t}isSuiteCompletionEvent(e,t){const r=e.data;return e.resolver==="RunTestResolver"&&e.type==="FireAndForgetSuiteComplete"&&r?.type==="complete"&&r?.suiteId===t}captureTestRunId(e,t){if(e.resolver!=="RunTestResolver")return;const s=e.data?.testRunId;s&&(t.id=s)}async reconcileTestRun(e){if(!e.id)return"continue";const t=await this._dataProvider.RunView({EntityName:"MJ: Test Runs",ExtraFilter:`ID='${e.id}'`,ResultType:"entity_object",BypassCache:!0}),r=t.Success?t.Results?.[0]:void 0;if(!r||r.Status==="Pending"||r.Status==="Running")return"continue";const s=r.Status==="Passed";return{resolve:{success:s,errorMessage:s?void 0:`Test run ${r.Status}`,result:null}}}extractTestResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?v.SafeJSONParse(t.result):null}}extractSuiteResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?v.SafeJSONParse(t.result):null}}forwardTestProgress(e,t){if(e.resolver==="RunTestResolver"&&e.type==="TestExecutionProgress"&&e.status==="ok"){const s=e.data?.progress;s&&t(s)}}handleError(e,t){const r=e.message;return c.LogError(`${t} failed: ${r}`),{success:!1,errorMessage:r.includes("Failed to fetch")||r.includes("NetworkError")?"Lost connection to the server. The test may still be running. Please refresh to check the latest status.":r,result:null}}}class We{static{l(this,"GraphQLComponentRegistryClient")}constructor(e){this._dataProvider=e}async GetRegistryComponent(e){try{const t=u.gql`
|
|
1539
1591
|
query GetRegistryComponent(
|
|
1540
1592
|
$registryName: String!,
|
|
1541
1593
|
$namespace: String!,
|
|
@@ -1619,7 +1671,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1619
1671
|
error
|
|
1620
1672
|
}
|
|
1621
1673
|
}
|
|
1622
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return c.LogError(t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}}class
|
|
1674
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return c.LogError(t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}}class He{static{l(this,"GraphQLVersionHistoryClient")}constructor(e){this._dataProvider=e}async CreateLabel(e){let t;try{e.OnProgress&&(t=this._dataProvider.PushStatusUpdates(this._dataProvider.sessionId).subscribe(a=>{try{const i=JSON.parse(a);i.resolver==="VersionHistoryResolver"&&i.type==="CreateLabelProgress"&&i.status==="ok"&&i.data&&e.OnProgress(i.data)}catch{}}));const r=u.gql`
|
|
1623
1675
|
mutation CreateVersionLabel($input: CreateVersionLabelInput!, $sessionId: String) {
|
|
1624
1676
|
CreateVersionLabel(input: $input, sessionId: $sessionId) {
|
|
1625
1677
|
Success
|
|
@@ -1635,7 +1687,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1635
1687
|
}
|
|
1636
1688
|
}
|
|
1637
1689
|
}
|
|
1638
|
-
`,s={input:this.buildInput(e),sessionId:this._dataProvider.sessionId},n=await this._dataProvider.ExecuteGQL(r,s);return this.processResult(n)}catch(r){const s=r instanceof Error?r.message:String(r);return c.LogError(`GraphQLVersionHistoryClient.CreateLabel error: ${s}`),{Success:!1,Error:s}}finally{t&&t.unsubscribe()}}buildInput(e){const t={Name:e.Name};return e.Description!=null&&(t.Description=e.Description),e.Scope!=null&&(t.Scope=e.Scope),e.EntityName!=null&&(t.EntityName=e.EntityName),e.ParentID!=null&&(t.ParentID=e.ParentID),e.ExternalSystemID!=null&&(t.ExternalSystemID=e.ExternalSystemID),e.IncludeDependencies!=null&&(t.IncludeDependencies=e.IncludeDependencies),e.MaxDepth!=null&&(t.MaxDepth=e.MaxDepth),e.ExcludeEntities!=null&&(t.ExcludeEntities=e.ExcludeEntities),e.RecordKeys&&e.RecordKeys.length>0&&(t.RecordKeys=e.RecordKeys.map(r=>({Key:r.Key,Value:r.Value}))),t}processResult(e){const t=e?.CreateVersionLabel;if(!t)return{Success:!1,Error:"Invalid response from server."};const r=Array.isArray(t.CaptureErrors)?t.CaptureErrors.map(s=>({EntityName:s.EntityName??"",RecordID:s.RecordID??"",ErrorMessage:s.ErrorMessage??""})):void 0;return{Success:t.Success,LabelID:t.LabelID,LabelName:t.LabelName,ItemsCaptured:t.ItemsCaptured,SyntheticSnapshotsCreated:t.SyntheticSnapshotsCreated,Error:t.Error,CaptureErrors:r}}}class
|
|
1690
|
+
`,s={input:this.buildInput(e),sessionId:this._dataProvider.sessionId},n=await this._dataProvider.ExecuteGQL(r,s);return this.processResult(n)}catch(r){const s=r instanceof Error?r.message:String(r);return c.LogError(`GraphQLVersionHistoryClient.CreateLabel error: ${s}`),{Success:!1,Error:s}}finally{t&&t.unsubscribe()}}buildInput(e){const t={Name:e.Name};return e.Description!=null&&(t.Description=e.Description),e.Scope!=null&&(t.Scope=e.Scope),e.EntityName!=null&&(t.EntityName=e.EntityName),e.ParentID!=null&&(t.ParentID=e.ParentID),e.ExternalSystemID!=null&&(t.ExternalSystemID=e.ExternalSystemID),e.IncludeDependencies!=null&&(t.IncludeDependencies=e.IncludeDependencies),e.MaxDepth!=null&&(t.MaxDepth=e.MaxDepth),e.ExcludeEntities!=null&&(t.ExcludeEntities=e.ExcludeEntities),e.RecordKeys&&e.RecordKeys.length>0&&(t.RecordKeys=e.RecordKeys.map(r=>({Key:r.Key,Value:r.Value}))),t}processResult(e){const t=e?.CreateVersionLabel;if(!t)return{Success:!1,Error:"Invalid response from server."};const r=Array.isArray(t.CaptureErrors)?t.CaptureErrors.map(s=>({EntityName:s.EntityName??"",RecordID:s.RecordID??"",ErrorMessage:s.ErrorMessage??""})):void 0;return{Success:t.Success,LabelID:t.LabelID,LabelName:t.LabelName,ItemsCaptured:t.ItemsCaptured,SyntheticSnapshotsCreated:t.SyntheticSnapshotsCreated,Error:t.Error,CaptureErrors:r}}}class ze{static{l(this,"GraphQLFileStorageClient")}constructor(e){this._dataProvider=e}async ListObjects(e,t="",r){try{const s=u.gql`
|
|
1639
1691
|
query ListStorageObjects($input: ListStorageObjectsInput!) {
|
|
1640
1692
|
ListStorageObjects(input: $input) {
|
|
1641
1693
|
objects {
|
|
@@ -1736,7 +1788,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1736
1788
|
failedAccounts
|
|
1737
1789
|
}
|
|
1738
1790
|
}
|
|
1739
|
-
`,n={input:{AccountIDs:e,Query:t,MaxResultsPerAccount:r?.maxResultsPerAccount,FileTypes:r?.fileTypes,SearchContent:r?.searchContent}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.SearchAcrossAccounts)throw new Error("Invalid response from server");const i=a.SearchAcrossAccounts;return{accountResults:i.accountResults.map(o=>({accountId:o.accountID,accountName:o.accountName,success:o.success,errorMessage:o.errorMessage,results:o.results.map(y=>({path:y.path,name:y.name,size:y.size,contentType:y.contentType,lastModified:new Date(y.lastModified),relevance:y.relevance,excerpt:y.excerpt,matchInFilename:y.matchInFilename,objectId:y.objectId})),totalMatches:o.totalMatches,hasMore:o.hasMore,nextPageToken:o.nextPageToken})),totalResultsReturned:i.totalResultsReturned,successfulAccounts:i.successfulAccounts,failedAccounts:i.failedAccounts}}catch(s){const n=s;return c.LogError(`Error searching across accounts: ${n}`),{accountResults:[],totalResultsReturned:0,successfulAccounts:0,failedAccounts:e.length}}}}class
|
|
1791
|
+
`,n={input:{AccountIDs:e,Query:t,MaxResultsPerAccount:r?.maxResultsPerAccount,FileTypes:r?.fileTypes,SearchContent:r?.searchContent}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.SearchAcrossAccounts)throw new Error("Invalid response from server");const i=a.SearchAcrossAccounts;return{accountResults:i.accountResults.map(o=>({accountId:o.accountID,accountName:o.accountName,success:o.success,errorMessage:o.errorMessage,results:o.results.map(y=>({path:y.path,name:y.name,size:y.size,contentType:y.contentType,lastModified:new Date(y.lastModified),relevance:y.relevance,excerpt:y.excerpt,matchInFilename:y.matchInFilename,objectId:y.objectId})),totalMatches:o.totalMatches,hasMore:o.hasMore,nextPageToken:o.nextPageToken})),totalResultsReturned:i.totalResultsReturned,successfulAccounts:i.successfulAccounts,failedAccounts:i.failedAccounts}}catch(s){const n=s;return c.LogError(`Error searching across accounts: ${n}`),{accountResults:[],totalResultsReturned:0,successfulAccounts:0,failedAccounts:e.length}}}}class Xe{static{l(this,"GraphQLSearchClient")}constructor(e){this._dataProvider=e}async ExecuteSearch(e){try{const t=this.buildSearchKnowledgeMutation(),r=this.prepareSearchVariables(e),s=await this._dataProvider.ExecuteGQL(t,r);return this.processSearchKnowledgeResult(s)}catch(t){return this.handleSearchError(t)}}async PreviewSearch(e,t){try{const r=this.buildPreviewSearchMutation(),s=this.preparePreviewVariables(e,t),n=await this._dataProvider.ExecuteGQL(r,s);return this.processPreviewSearchResult(n)}catch(r){return this.handleSearchError(r)}}buildSearchKnowledgeMutation(){return u.gql`
|
|
1740
1792
|
mutation SearchKnowledge($query: String!, $maxResults: Float, $filters: SearchFiltersInput, $minScore: Float, $scopeIDs: [ID!], $searchContext: SearchContextInput) {
|
|
1741
1793
|
SearchKnowledge(query: $query, maxResults: $maxResults, filters: $filters, minScore: $minScore, scopeIDs: $scopeIDs, searchContext: $searchContext) {
|
|
1742
1794
|
Success
|
|
@@ -1877,7 +1929,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
1877
1929
|
ElapsedMs
|
|
1878
1930
|
ErrorMessage
|
|
1879
1931
|
}
|
|
1880
|
-
}`;n=this._dataProvider.subscribe(o,{streamID:i.StreamID}).subscribe({next:l(y=>{const g=y?.SearchStreamEvents;g&&(t.next(g),g.Phase==="final"?(t.complete(),n?.unsubscribe()):g.Phase==="error"&&(t.error(new Error(g.ErrorMessage??"Stream error")),n?.unsubscribe()))},"next"),error:l(y=>t.error(y),"error")})}catch(a){t.error(a)}})(),()=>{n?.unsubscribe()}})}prepareFilters(e){const t={};return e.EntityNames!==void 0&&e.EntityNames.length>0&&(t.EntityNames=e.EntityNames),e.SourceTypes!==void 0&&e.SourceTypes.length>0&&(t.SourceTypes=e.SourceTypes),e.Tags!==void 0&&e.Tags.length>0&&(t.Tags=e.Tags),t}preparePreviewVariables(e,t){const r={query:e};return t!==void 0&&(r.maxResults=t),r}processSearchKnowledgeResult(e){if(!e?.SearchKnowledge)throw new Error("Invalid response from server");const t=e.SearchKnowledge;return this.mapSearchResponse(t)}processPreviewSearchResult(e){if(!e?.PreviewSearch)throw new Error("Invalid response from server");const t=e.PreviewSearch;return this.mapSearchResponse(t)}mapSearchResponse(e){return{Success:e.Success,Results:(e.Results||[]).map(t=>this.mapResultItem(t)),TotalCount:e.TotalCount,ElapsedMs:e.ElapsedMs,SourceCounts:this.mapSourceCounts(e.SourceCounts),Providers:(e.Providers||[]).map(t=>({ID:t.ID,Name:t.Name,DisplayName:t.DisplayName,Icon:t.Icon,SourceType:t.SourceType,Priority:t.Priority})),ErrorMessage:e.ErrorMessage}}mapResultItem(e){return{ID:e.ID,EntityName:e.EntityName,EntityDisplayName:e.EntityDisplayName,RecordID:e.RecordID,SourceType:e.SourceType,ResultType:e.ResultType,Title:e.Title,Snippet:e.Snippet,Score:e.Score,ScoreBreakdown:this.mapScoreBreakdown(e.ScoreBreakdown),Tags:e.Tags||[],EntityIcon:e.EntityIcon,RecordName:e.RecordName,MatchedAt:e.MatchedAt,RawMetadata:e.RawMetadata,ProviderId:e.ProviderId,ProviderLabel:e.ProviderLabel,ProviderIcon:e.ProviderIcon}}mapScoreBreakdown(e){if(!e)return{};const t={};return e.Vector!==void 0&&(t.Vector=e.Vector),e.FullText!==void 0&&(t.FullText=e.FullText),e.Entity!==void 0&&(t.Entity=e.Entity),e.Storage!==void 0&&(t.Storage=e.Storage),t}mapSourceCounts(e){return e?{Vector:e.Vector??0,FullText:e.FullText??0,Entity:e.Entity??0,Storage:e.Storage??0}:{Vector:0,FullText:0,Entity:0,Storage:0}}handleSearchError(e){const t=e;return c.LogError(`Error executing search: ${t}`),{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,SourceCounts:{Vector:0,FullText:0,Entity:0,Storage:0},Providers:[],ErrorMessage:`Error: ${t.message}`}}}class
|
|
1932
|
+
}`;n=this._dataProvider.subscribe(o,{streamID:i.StreamID}).subscribe({next:l(y=>{const g=y?.SearchStreamEvents;g&&(t.next(g),g.Phase==="final"?(t.complete(),n?.unsubscribe()):g.Phase==="error"&&(t.error(new Error(g.ErrorMessage??"Stream error")),n?.unsubscribe()))},"next"),error:l(y=>t.error(y),"error")})}catch(a){t.error(a)}})(),()=>{n?.unsubscribe()}})}prepareFilters(e){const t={};return e.EntityNames!==void 0&&e.EntityNames.length>0&&(t.EntityNames=e.EntityNames),e.SourceTypes!==void 0&&e.SourceTypes.length>0&&(t.SourceTypes=e.SourceTypes),e.Tags!==void 0&&e.Tags.length>0&&(t.Tags=e.Tags),t}preparePreviewVariables(e,t){const r={query:e};return t!==void 0&&(r.maxResults=t),r}processSearchKnowledgeResult(e){if(!e?.SearchKnowledge)throw new Error("Invalid response from server");const t=e.SearchKnowledge;return this.mapSearchResponse(t)}processPreviewSearchResult(e){if(!e?.PreviewSearch)throw new Error("Invalid response from server");const t=e.PreviewSearch;return this.mapSearchResponse(t)}mapSearchResponse(e){return{Success:e.Success,Results:(e.Results||[]).map(t=>this.mapResultItem(t)),TotalCount:e.TotalCount,ElapsedMs:e.ElapsedMs,SourceCounts:this.mapSourceCounts(e.SourceCounts),Providers:(e.Providers||[]).map(t=>({ID:t.ID,Name:t.Name,DisplayName:t.DisplayName,Icon:t.Icon,SourceType:t.SourceType,Priority:t.Priority})),ErrorMessage:e.ErrorMessage}}mapResultItem(e){return{ID:e.ID,EntityName:e.EntityName,EntityDisplayName:e.EntityDisplayName,RecordID:e.RecordID,SourceType:e.SourceType,ResultType:e.ResultType,Title:e.Title,Snippet:e.Snippet,Score:e.Score,ScoreBreakdown:this.mapScoreBreakdown(e.ScoreBreakdown),Tags:e.Tags||[],EntityIcon:e.EntityIcon,RecordName:e.RecordName,MatchedAt:e.MatchedAt,RawMetadata:e.RawMetadata,ProviderId:e.ProviderId,ProviderLabel:e.ProviderLabel,ProviderIcon:e.ProviderIcon}}mapScoreBreakdown(e){if(!e)return{};const t={};return e.Vector!==void 0&&(t.Vector=e.Vector),e.FullText!==void 0&&(t.FullText=e.FullText),e.Entity!==void 0&&(t.Entity=e.Entity),e.Storage!==void 0&&(t.Storage=e.Storage),t}mapSourceCounts(e){return e?{Vector:e.Vector??0,FullText:e.FullText??0,Entity:e.Entity??0,Storage:e.Storage??0}:{Vector:0,FullText:0,Entity:0,Storage:0}}handleSearchError(e){const t=e;return c.LogError(`Error executing search: ${t}`),{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,SourceCounts:{Vector:0,FullText:0,Entity:0,Storage:0},Providers:[],ErrorMessage:`Error: ${t.message}`}}}class Ye{static{l(this,"GraphQLIntegrationClient")}constructor(e){this._dataProvider=e}async DiscoverObjects(e){try{const t=u.gql`
|
|
1881
1933
|
query IntegrationDiscoverObjects($companyIntegrationID: String!) {
|
|
1882
1934
|
IntegrationDiscoverObjects(companyIntegrationID: $companyIntegrationID) {
|
|
1883
1935
|
Success
|
|
@@ -2028,7 +2080,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
2028
2080
|
PipelineSteps { Name Status DurationMs Message }
|
|
2029
2081
|
GitCommitSuccess APIRestarted
|
|
2030
2082
|
}
|
|
2031
|
-
}`,y={Connectors:e.map(m=>({CompanyIntegrationID:m.CompanyIntegrationID,SourceObjects:m.SourceObjects.map(
|
|
2083
|
+
}`,y={Connectors:e.map(m=>({CompanyIntegrationID:m.CompanyIntegrationID,SourceObjects:m.SourceObjects.map(I=>({SourceObjectID:I.SourceObjectID??null,SourceObjectName:I.SourceObjectName??null,Fields:I.Fields??null}))})),StartSync:t,FullSync:r,SyncScope:s},g=(await this._dataProvider.ExecuteGQL(o,{input:y,platform:n,skipGitCommit:a,skipRestart:i}))?.IntegrationApplyAllBatch;return g?{Success:g.Success,Message:g.Message,Steps:g.PipelineSteps,GitCommitSuccess:g.GitCommitSuccess,APIRestarted:g.APIRestarted,EntityMapsCreated:g.ConnectorResults?.[0]?.EntityMapsCreated,SyncRunID:g.ConnectorResults?.[0]?.SyncRunID,Warnings:g.ConnectorResults?.flatMap(m=>m.Warnings??[])}:{Success:!1,Message:"No response"}}catch(o){return{Success:!1,Message:o.message}}}async ApplyAll(e,t,r="sqlserver",s=!1,n=!1){try{const a=u.gql`mutation IntegrationApplyAll(
|
|
2032
2084
|
$input: ApplyAllInput!, $platform: String!, $skipGitCommit: Boolean!, $skipRestart: Boolean!
|
|
2033
2085
|
) {
|
|
2034
2086
|
IntegrationApplyAll(input: $input, platform: $platform, skipGitCommit: $skipGitCommit, skipRestart: $skipRestart) {
|
|
@@ -2070,7 +2122,7 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
2070
2122
|
IntegrationGetConnectorCapabilities(companyIntegrationID: $companyIntegrationID) {
|
|
2071
2123
|
Success Message SupportsGet SupportsCreate SupportsUpdate SupportsDelete SupportsSearch
|
|
2072
2124
|
}
|
|
2073
|
-
}`;return(await this._dataProvider.ExecuteGQL(t,{companyIntegrationID:e}))?.IntegrationGetConnectorCapabilities??{Success:!1,Message:"No response"}}catch(t){return{Success:!1,Message:t.message}}}handleError(e,t){const r=e;return c.LogError(`Error in integration discovery: ${r}`),{Success:!1,Message:`Error: ${r.message}`,Data:t}}}const
|
|
2125
|
+
}`;return(await this._dataProvider.ExecuteGQL(t,{companyIntegrationID:e}))?.IntegrationGetConnectorCapabilities??{Success:!1,Message:"No response"}}catch(t){return{Success:!1,Message:t.message}}}handleError(e,t){const r=e;return c.LogError(`Error in integration discovery: ${r}`),{Success:!1,Message:`Error: ${r.message}`,Data:t}}}const Ze=u.gql`
|
|
2074
2126
|
query TailConversationEvents($conversationDetailID: String!, $sinceSeq: Int) {
|
|
2075
2127
|
TailConversationEvents(conversationDetailID: $conversationDetailID, sinceSeq: $sinceSeq) {
|
|
2076
2128
|
Success
|
|
@@ -2093,5 +2145,142 @@ ${e.stackFrames}`:this.stack}}function j(d){return d instanceof x?d:new x(G(d))}
|
|
|
2093
2145
|
DetailStatus
|
|
2094
2146
|
}
|
|
2095
2147
|
}
|
|
2096
|
-
`;class
|
|
2148
|
+
`;class et{static{l(this,"GraphQLConversationClient")}constructor(e){this._dataProvider=e}async TailConversationEvents(e,t=0){const r=Math.max(0,Math.floor(t));try{const n=(await this._dataProvider.ExecuteGQL(Ze,{conversationDetailID:e,sinceSeq:r}))?.TailConversationEvents;return n?{...n,Events:n.Events??[],LatestSeq:typeof n.LatestSeq=="number"?n.LatestSeq:r}:this.failure(r,"Invalid response from server")}catch(s){const n=s instanceof Error?s.message:String(s);return this.failure(r,`TailConversationEvents failed: ${n}`)}}failure(e,t){return{Success:!1,Message:t,Events:[],LatestSeq:e,IsInFlight:!0}}}const L=`
|
|
2149
|
+
ID
|
|
2150
|
+
Title
|
|
2151
|
+
Description
|
|
2152
|
+
HostUserID
|
|
2153
|
+
HostUserName
|
|
2154
|
+
RoomName
|
|
2155
|
+
Status
|
|
2156
|
+
ScheduledStartAt
|
|
2157
|
+
ScheduledEndAt
|
|
2158
|
+
StartedAt
|
|
2159
|
+
EndedAt
|
|
2160
|
+
AllowPhoneDialIn
|
|
2161
|
+
DialInPhoneNumberID
|
|
2162
|
+
DialInPhoneNumber
|
|
2163
|
+
DialInCode
|
|
2164
|
+
RecordingPolicy
|
|
2165
|
+
ConversationID
|
|
2166
|
+
CreatedAt
|
|
2167
|
+
UpdatedAt
|
|
2168
|
+
Participants {
|
|
2169
|
+
ID
|
|
2170
|
+
MeetingID
|
|
2171
|
+
UserID
|
|
2172
|
+
UserName
|
|
2173
|
+
UserEmail
|
|
2174
|
+
AgentID
|
|
2175
|
+
AgentName
|
|
2176
|
+
ExternalName
|
|
2177
|
+
ExternalEmail
|
|
2178
|
+
ExternalPhone
|
|
2179
|
+
Role
|
|
2180
|
+
InviteStatus
|
|
2181
|
+
JoinedAt
|
|
2182
|
+
LeftAt
|
|
2183
|
+
}
|
|
2184
|
+
`;class tt{static{l(this,"GraphQLMeetingClient")}constructor(e){e&&"ExecuteGQL"in e?this._dataProvider=e:this._dataProvider=f.Instance}async GetMeeting(e){return this.Meeting(e)}async MyMeetings(e){try{const t=u.gql`
|
|
2185
|
+
query MyMeetings($status: String) {
|
|
2186
|
+
MyMeetings(status: $status) {
|
|
2187
|
+
${L}
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{status:e}))?.MyMeetings??[]}catch(t){return c.LogError(`GraphQLMeetingClient.MyMeetings error: ${t instanceof Error?t.message:String(t)}`),[]}}async Meeting(e){try{const t=u.gql`
|
|
2191
|
+
query Meeting($id: String!) {
|
|
2192
|
+
Meeting(id: $id) {
|
|
2193
|
+
${L}
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{id:e}))?.Meeting??null}catch(t){return c.LogError(`GraphQLMeetingClient.Meeting error: ${t instanceof Error?t.message:String(t)}`),null}}async MeetingParticipants(e){try{const t=u.gql`
|
|
2197
|
+
query MeetingParticipants($meetingID: String!) {
|
|
2198
|
+
MeetingParticipants(meetingID: $meetingID) {
|
|
2199
|
+
ID
|
|
2200
|
+
MeetingID
|
|
2201
|
+
UserID
|
|
2202
|
+
UserName
|
|
2203
|
+
UserEmail
|
|
2204
|
+
AgentID
|
|
2205
|
+
AgentName
|
|
2206
|
+
ExternalName
|
|
2207
|
+
ExternalEmail
|
|
2208
|
+
ExternalPhone
|
|
2209
|
+
Role
|
|
2210
|
+
InviteStatus
|
|
2211
|
+
JoinedAt
|
|
2212
|
+
LeftAt
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{meetingID:e}))?.MeetingParticipants??[]}catch(t){return c.LogError(`GraphQLMeetingClient.MeetingParticipants error: ${t instanceof Error?t.message:String(t)}`),[]}}async AvailableDialInPhoneNumbers(){try{const e=u.gql`
|
|
2216
|
+
query AvailableDialInPhoneNumbers {
|
|
2217
|
+
AvailableDialInPhoneNumbers {
|
|
2218
|
+
ID
|
|
2219
|
+
Number
|
|
2220
|
+
Label
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
`;return(await this._dataProvider.ExecuteGQL(e,{}))?.AvailableDialInPhoneNumbers??[]}catch(e){return c.LogError(`GraphQLMeetingClient.AvailableDialInPhoneNumbers error: ${e instanceof Error?e.message:String(e)}`),[]}}async CreateMeeting(e){try{const t=u.gql`
|
|
2224
|
+
mutation CreateMeeting($input: CreateMeetingInput!) {
|
|
2225
|
+
CreateMeeting(input: $input) {
|
|
2226
|
+
Success
|
|
2227
|
+
ErrorMessage
|
|
2228
|
+
Meeting {
|
|
2229
|
+
${L}
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{input:e}))?.CreateMeeting??{Success:!1,ErrorMessage:"No response"}}catch(t){const r=t instanceof Error?t.message:String(t);return c.LogError(`GraphQLMeetingClient.CreateMeeting error: ${r}`),{Success:!1,ErrorMessage:r}}}async UpdateMeeting(e){try{const t=u.gql`
|
|
2234
|
+
mutation UpdateMeeting($input: UpdateMeetingInput!) {
|
|
2235
|
+
UpdateMeeting(input: $input) {
|
|
2236
|
+
Success
|
|
2237
|
+
ErrorMessage
|
|
2238
|
+
Meeting {
|
|
2239
|
+
${L}
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{input:e}))?.UpdateMeeting??{Success:!1,ErrorMessage:"No response"}}catch(t){const r=t instanceof Error?t.message:String(t);return c.LogError(`GraphQLMeetingClient.UpdateMeeting error: ${r}`),{Success:!1,ErrorMessage:r}}}async StartMeeting(e){try{const t=u.gql`
|
|
2244
|
+
mutation StartMeeting($meetingID: String!) {
|
|
2245
|
+
StartMeeting(meetingID: $meetingID) {
|
|
2246
|
+
Success
|
|
2247
|
+
ErrorMessage
|
|
2248
|
+
RoomName
|
|
2249
|
+
ClientToken
|
|
2250
|
+
Meeting {
|
|
2251
|
+
${L}
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{meetingID:e}))?.StartMeeting??{Success:!1,ErrorMessage:"No response"}}catch(t){const r=t instanceof Error?t.message:String(t);return c.LogError(`GraphQLMeetingClient.StartMeeting error: ${r}`),{Success:!1,ErrorMessage:r}}}async EndMeeting(e){try{const t=u.gql`
|
|
2256
|
+
mutation EndMeeting($meetingID: String!) {
|
|
2257
|
+
EndMeeting(meetingID: $meetingID) {
|
|
2258
|
+
Success
|
|
2259
|
+
ErrorMessage
|
|
2260
|
+
Meeting {
|
|
2261
|
+
${L}
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{meetingID:e}))?.EndMeeting??{Success:!1,ErrorMessage:"No response"}}catch(t){const r=t instanceof Error?t.message:String(t);return c.LogError(`GraphQLMeetingClient.EndMeeting error: ${r}`),{Success:!1,ErrorMessage:r}}}async CancelMeeting(e){try{const t=u.gql`
|
|
2266
|
+
mutation CancelMeeting($meetingID: String!) {
|
|
2267
|
+
CancelMeeting(meetingID: $meetingID) {
|
|
2268
|
+
Success
|
|
2269
|
+
ErrorMessage
|
|
2270
|
+
Meeting {
|
|
2271
|
+
${L}
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{meetingID:e}))?.CancelMeeting??{Success:!1,ErrorMessage:"No response"}}catch(t){const r=t instanceof Error?t.message:String(t);return c.LogError(`GraphQLMeetingClient.CancelMeeting error: ${r}`),{Success:!1,ErrorMessage:r}}}async RSVPMeeting(e){try{const t=u.gql`
|
|
2276
|
+
mutation RSVPMeeting($input: RSVPMeetingInput!) {
|
|
2277
|
+
RSVPMeeting(input: $input) {
|
|
2278
|
+
Success
|
|
2279
|
+
ErrorMessage
|
|
2280
|
+
Meeting {
|
|
2281
|
+
${L}
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{input:e}))?.RSVPMeeting??{Success:!1,ErrorMessage:"No response"}}catch(t){const r=t instanceof Error?t.message:String(t);return c.LogError(`GraphQLMeetingClient.RSVPMeeting error: ${r}`),{Success:!1,ErrorMessage:r}}}}Object.defineProperty(exports,"gql",{enumerable:!0,get:l(function(){return u.gql},"get")}),exports.ActionItemInput=Ne,exports.ActionItemOutput=be,exports.BrowserIndexedDBStorageProvider=J,exports.BrowserStorageProviderBase=B,exports.ConnectGraphQLClient=ve,exports.FieldMapper=N,exports.FireAndForgetHelper=$,exports.GetDataOutput=Te,exports.GraphQLAIClient=K,exports.GraphQLActionClient=qe,exports.GraphQLClassifyClient=je,exports.GraphQLClusterClient=ke,exports.GraphQLComponentRegistryClient=We,exports.GraphQLConversationClient=et,exports.GraphQLDataProvider=f,exports.GraphQLEncryptionClient=Ve,exports.GraphQLFileStorageClient=ze,exports.GraphQLHandoffClient=Be,exports.GraphQLIntegrationClient=Ye,exports.GraphQLListsClient=Qe,exports.GraphQLLiveKitClient=Ke,exports.GraphQLMeetingClient=tt,exports.GraphQLProviderConfigData=Ie,exports.GraphQLSearchClient=Xe,exports.GraphQLSystemUserClient=Ae,exports.GraphQLTestingClient=Je,exports.GraphQLTransactionGroup=k,exports.GraphQLVersionHistoryClient=He,exports.PACKAGE_VERSION=A,exports.RoleInput=$e,exports.RolesAndUsersInput=Me,exports.SafeGraphQLError=F,exports.SanitizeGraphQLError=q,exports.SetupGraphQLClient=X,exports.SimpleRemoteEntity=Fe,exports.SimpleRemoteEntityField=Ge,exports.SimpleRemoteEntityOutput=xe,exports.SyncDataAction=Y,exports.SyncDataResult=Le,exports.SyncRolesAndUsersResult=we,exports.ToSafeGraphQLError=W,exports.UserInput=Pe,exports.setupGraphQLClient=Ce;
|
|
2097
2286
|
//# sourceMappingURL=index.cjs.map
|