@memberjunction/react-runtime 5.32.0 → 5.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -14
- package/CHANGELOG.md +38 -0
- package/dist/324.runtime.umd.js +150 -104
- package/dist/component-manager/component-manager.d.ts.map +1 -1
- package/dist/component-manager/component-manager.js +32 -13
- package/dist/component-manager/component-manager.js.map +1 -1
- package/dist/registry/component-registry-service.d.ts.map +1 -1
- package/dist/registry/component-registry-service.js +5 -6
- package/dist/registry/component-registry-service.js.map +1 -1
- package/dist/registry/component-resolver.d.ts.map +1 -1
- package/dist/registry/component-resolver.js +3 -21
- package/dist/registry/component-resolver.js.map +1 -1
- package/dist/runtime.umd.js +6786 -2767
- package/package.json +6 -6
- package/src/__tests__/component-manager.test.ts +340 -0
- package/src/component-manager/component-manager.ts +62 -43
- package/src/registry/component-registry-service.ts +14 -20
- package/src/registry/component-resolver.ts +11 -32
package/dist/324.runtime.umd.js
CHANGED
|
@@ -9,23 +9,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9
9
|
/* harmony export */ ActionItemInput: () => (/* binding */ be),
|
|
10
10
|
/* harmony export */ ActionItemOutput: () => (/* binding */ Ae),
|
|
11
11
|
/* harmony export */ BrowserIndexedDBStorageProvider: () => (/* binding */ J),
|
|
12
|
-
/* harmony export */ BrowserStorageProviderBase: () => (/* binding */
|
|
12
|
+
/* harmony export */ BrowserStorageProviderBase: () => (/* binding */ K),
|
|
13
13
|
/* harmony export */ FieldMapper: () => (/* binding */ v),
|
|
14
14
|
/* harmony export */ FireAndForgetHelper: () => (/* binding */ P),
|
|
15
15
|
/* harmony export */ GetDataOutput: () => (/* binding */ xe),
|
|
16
16
|
/* harmony export */ GraphQLAIClient: () => (/* binding */ B),
|
|
17
17
|
/* harmony export */ GraphQLActionClient: () => (/* binding */ Qe),
|
|
18
|
-
/* harmony export */ GraphQLComponentRegistryClient: () => (/* binding */
|
|
19
|
-
/* harmony export */ GraphQLDataProvider: () => (/* binding */
|
|
18
|
+
/* harmony export */ GraphQLComponentRegistryClient: () => (/* binding */ Ve),
|
|
19
|
+
/* harmony export */ GraphQLDataProvider: () => (/* binding */ p),
|
|
20
20
|
/* harmony export */ GraphQLEncryptionClient: () => (/* binding */ Ue),
|
|
21
21
|
/* harmony export */ GraphQLFileStorageClient: () => (/* binding */ qe),
|
|
22
22
|
/* harmony export */ GraphQLIntegrationClient: () => (/* binding */ ke),
|
|
23
|
-
/* harmony export */ GraphQLProviderConfigData: () => (/* binding */
|
|
23
|
+
/* harmony export */ GraphQLProviderConfigData: () => (/* binding */ Ee),
|
|
24
24
|
/* harmony export */ GraphQLSearchClient: () => (/* binding */ Oe),
|
|
25
25
|
/* harmony export */ GraphQLSystemUserClient: () => (/* binding */ Me),
|
|
26
|
-
/* harmony export */ GraphQLTestingClient: () => (/* binding */
|
|
26
|
+
/* harmony export */ GraphQLTestingClient: () => (/* binding */ Ge),
|
|
27
27
|
/* harmony export */ GraphQLTransactionGroup: () => (/* binding */ k),
|
|
28
28
|
/* harmony export */ GraphQLVersionHistoryClient: () => (/* binding */ _e),
|
|
29
|
+
/* harmony export */ PACKAGE_VERSION: () => (/* binding */ F),
|
|
29
30
|
/* harmony export */ RoleInput: () => (/* binding */ Ce),
|
|
30
31
|
/* harmony export */ RolesAndUsersInput: () => (/* binding */ Pe),
|
|
31
32
|
/* harmony export */ SimpleRemoteEntity: () => (/* binding */ Fe),
|
|
@@ -39,8 +40,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
39
40
|
/* harmony export */ setupGraphQLClient: () => (/* binding */ ve)
|
|
40
41
|
/* harmony export */ });
|
|
41
42
|
/* harmony import */ var graphql_request__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(215);
|
|
42
|
-
/* harmony import */ var _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
|
|
43
|
-
/* harmony import */ var _memberjunction_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
|
43
|
+
/* harmony import */ var _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(310);
|
|
44
|
+
/* harmony import */ var _memberjunction_global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(232);
|
|
44
45
|
/* harmony import */ var _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(346);
|
|
45
46
|
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(600);
|
|
46
47
|
/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(49);
|
|
@@ -49,7 +50,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
49
50
|
/* harmony import */ var graphql_ws__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(497);
|
|
50
51
|
/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(718);
|
|
51
52
|
/* harmony import */ var _tempfix_idb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(196);
|
|
52
|
-
var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});class v{static{y(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(v.DB_PREFIX)?v.GQL_PREFIX+e.substring(v.DB_PREFIX.length):e}ReverseMapFieldName(e){return e.startsWith(v.GQL_PREFIX)?v.DB_PREFIX+e.substring(v.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 _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionGroupBase */ .
|
|
53
|
+
var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});class v{static{y(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(v.DB_PREFIX)?v.GQL_PREFIX+e.substring(v.DB_PREFIX.length):e}ReverseMapFieldName(e){return e.startsWith(v.GQL_PREFIX)?v.DB_PREFIX+e.substring(v.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 _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionGroupBase */ .VHz{static{y(this,"GraphQLTransactionGroup")}constructor(e){super(),this._provider=e}async HandleSubmit(){const e=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
53
54
|
mutation ExecuteTransactionGroup($group: TransactionInputType!) {
|
|
54
55
|
ExecuteTransactionGroup(group: $group) {
|
|
55
56
|
Success
|
|
@@ -57,7 +58,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
57
58
|
ResultsJSON
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
`,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=[];for(let i=0;i<this.PendingTransactions.length;i++){const o=n.ResultsJSON[i],
|
|
61
|
+
`,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=[];for(let i=0;i<this.PendingTransactions.length;i++){const o=n.ResultsJSON[i],u=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(o),l=this.PendingTransactions[i];a.push(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionResult */ .qTq(l,u,u!==null))}return a}else throw new Error("Failed to execute transaction group")}}const he=900*1e3;class P{static{y(this,"FireAndForgetHelper")}static async Execute(e){const t=e.operationLabel??e.mutationFieldName;let r,s;try{const{promise:n,resolve:a,reject:i}=P.createCompletionPromise();s=P.setupTimeout(i,e.timeoutMs,e.timeoutErrorMessage),r=P.subscribeToPubSub(e,a,s);const o=await P.executeMutation(e);if(!e.validateAck(o)){s&&clearTimeout(s);const u=o?.errorMessage??"Server rejected the request";return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Server rejected: ${u}`),e.createErrorResult(u)}return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${t}] Server accepted, waiting for completion via WebSocket`),await n}catch(n){throw s&&clearTimeout(s),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`[FireAndForget:${t}] Error: ${n.message}`),n}finally{s&&clearTimeout(s),r&&r.unsubscribe()}}static createCompletionPromise(){let e,t;return{promise:new Promise((s,n)=>{e=s,t=n}),resolve:e,reject:t}}static setupTimeout(e,t,r){const s=t??he,n=r??"The operation may still be running on the server but the client timed out after 15 minutes. Please refresh the page to check the latest status.";return setTimeout(()=>{e(new Error(n))},s)}static subscribeToPubSub(e,t,r){const s=e.dataProvider.sessionId,n=e.operationLabel??e.mutationFieldName;return e.dataProvider.PushStatusUpdates(s).subscribe(a=>{try{const i=JSON.parse(a);e.onMessage&&e.onMessage(i),e.isCompletionEvent(i)&&(clearTimeout(r),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[FireAndForget:${n}] Completion event received`),t(e.extractResult(i)))}catch(i){console.error(`[FireAndForget:${n}] Failed to parse PubSub message:`,i)}})}static async executeMutation(e){return(await e.dataProvider.ExecuteGQL(e.mutation,e.variables))[e.mutationFieldName]}}class B{static{y(this,"GraphQLAIClient")}constructor(e){this._dataProvider=e}async RunAIPrompt(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
61
62
|
mutation RunAIPrompt(
|
|
62
63
|
$promptId: String!,
|
|
63
64
|
$data: String,
|
|
@@ -116,7 +117,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
116
117
|
chatResult
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
`,r=this.preparePromptVariables(e),s=await this._dataProvider.ExecuteGQL(t,r);return this.processPromptResult(s)}catch(t){return this.handlePromptError(t)}}preparePromptVariables(e){const t={promptId:e.promptId};return e.data!==void 0&&(t.data=typeof e.data=="object"?JSON.stringify(e.data):e.data),e.templateData!==void 0&&(t.templateData=typeof e.templateData=="object"?JSON.stringify(e.templateData):e.templateData),e.messages!==void 0&&(t.messages=JSON.stringify(e.messages)),e.overrideModelId!==void 0&&(t.overrideModelId=e.overrideModelId),e.overrideVendorId!==void 0&&(t.overrideVendorId=e.overrideVendorId),e.configurationId!==void 0&&(t.configurationId=e.configurationId),e.skipValidation!==void 0&&(t.skipValidation=e.skipValidation),e.responseFormat!==void 0&&(t.responseFormat=e.responseFormat),e.temperature!==void 0&&(t.temperature=e.temperature),e.topP!==void 0&&(t.topP=e.topP),e.topK!==void 0&&(t.topK=e.topK),e.minP!==void 0&&(t.minP=e.minP),e.frequencyPenalty!==void 0&&(t.frequencyPenalty=e.frequencyPenalty),e.presencePenalty!==void 0&&(t.presencePenalty=e.presencePenalty),e.seed!==void 0&&(t.seed=e.seed),e.stopSequences!==void 0&&(t.stopSequences=e.stopSequences),e.includeLogProbs!==void 0&&(t.includeLogProbs=e.includeLogProbs),e.topLogProbs!==void 0&&(t.topLogProbs=e.topLogProbs),e.rerunFromPromptRunID!==void 0&&(t.rerunFromPromptRunID=e.rerunFromPromptRunID),e.systemPromptOverride!==void 0&&(t.systemPromptOverride=e.systemPromptOverride),t}processPromptResult(e){if(!e?.RunAIPrompt)throw new Error("Invalid response from server");const t=e.RunAIPrompt;let r,s,n;try{t.parsedResult&&(r=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .CleanAndParseJSON */ .Ql)(t.parsedResult))}catch{r=t.parsedResult}try{t.validationResult&&(s=JSON.parse(t.validationResult))}catch{s=t.validationResult}try{t.chatResult&&(n=JSON.parse(t.chatResult))}catch{n=t.chatResult}return{success:t.success,output:t.output,parsedResult:r,error:t.error,executionTimeMs:t.executionTimeMs,tokensUsed:t.tokensUsed,promptRunId:t.promptRunId,rawResult:t.rawResult,validationResult:s,chatResult:n}}handlePromptError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
120
|
+
`,r=this.preparePromptVariables(e),s=await this._dataProvider.ExecuteGQL(t,r);return this.processPromptResult(s)}catch(t){return this.handlePromptError(t)}}preparePromptVariables(e){const t={promptId:e.promptId};return e.data!==void 0&&(t.data=typeof e.data=="object"?JSON.stringify(e.data):e.data),e.templateData!==void 0&&(t.templateData=typeof e.templateData=="object"?JSON.stringify(e.templateData):e.templateData),e.messages!==void 0&&(t.messages=JSON.stringify(e.messages)),e.overrideModelId!==void 0&&(t.overrideModelId=e.overrideModelId),e.overrideVendorId!==void 0&&(t.overrideVendorId=e.overrideVendorId),e.configurationId!==void 0&&(t.configurationId=e.configurationId),e.skipValidation!==void 0&&(t.skipValidation=e.skipValidation),e.responseFormat!==void 0&&(t.responseFormat=e.responseFormat),e.temperature!==void 0&&(t.temperature=e.temperature),e.topP!==void 0&&(t.topP=e.topP),e.topK!==void 0&&(t.topK=e.topK),e.minP!==void 0&&(t.minP=e.minP),e.frequencyPenalty!==void 0&&(t.frequencyPenalty=e.frequencyPenalty),e.presencePenalty!==void 0&&(t.presencePenalty=e.presencePenalty),e.seed!==void 0&&(t.seed=e.seed),e.stopSequences!==void 0&&(t.stopSequences=e.stopSequences),e.includeLogProbs!==void 0&&(t.includeLogProbs=e.includeLogProbs),e.topLogProbs!==void 0&&(t.topLogProbs=e.topLogProbs),e.rerunFromPromptRunID!==void 0&&(t.rerunFromPromptRunID=e.rerunFromPromptRunID),e.systemPromptOverride!==void 0&&(t.systemPromptOverride=e.systemPromptOverride),t}processPromptResult(e){if(!e?.RunAIPrompt)throw new Error("Invalid response from server");const t=e.RunAIPrompt;let r,s,n;try{t.parsedResult&&(r=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .CleanAndParseJSON */ .Ql)(t.parsedResult))}catch{r=t.parsedResult}try{t.validationResult&&(s=JSON.parse(t.validationResult))}catch{s=t.validationResult}try{t.chatResult&&(n=JSON.parse(t.chatResult))}catch{n=t.chatResult}return{success:t.success,output:t.output,parsedResult:r,error:t.error,executionTimeMs:t.executionTimeMs,tokensUsed:t.tokensUsed,promptRunId:t.promptRunId,rawResult:t.rawResult,validationResult:s,chatResult:n}}handlePromptError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error running AI prompt: ${t}`),{success:!1,error:t.message||"Unknown error occurred"}}async RunAIAgent(e,t,r){try{const s=this.buildRunAIAgentMutation(),n=this.prepareAgentVariables(e,t,r);return n.fireAndForget=!0,await P.Execute({dataProvider:this._dataProvider,mutation:s,variables:n,mutationFieldName:"RunAIAgent",operationLabel:"RunAIAgent",validateAck:y(a=>a?.success===!0,"validateAck"),isCompletionEvent:y(a=>this.isAgentCompletionEvent(a),"isCompletionEvent"),extractResult:y(a=>this.extractAgentResult(a),"extractResult"),onMessage:e.onProgress?a=>this.forwardAgentProgress(a,e.onProgress):void 0,createErrorResult:y(a=>this.createAgentErrorResult(a),"createErrorResult")})}catch(s){return this.handleAgentError(s)}}buildRunAIAgentMutation(){return (0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
120
121
|
mutation RunAIAgent(
|
|
121
122
|
$agentId: String!,
|
|
122
123
|
$messages: String!,
|
|
@@ -157,7 +158,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
157
158
|
result
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
|
-
`}prepareAgentVariables(e,t,r){const s={agentId:e.agent.ID,messages:JSON.stringify(e.conversationMessages),sessionId:this._dataProvider.sessionId};return e.data!==void 0&&(s.data=typeof e.data=="object"?JSON.stringify(e.data):e.data),e.payload!==void 0&&(s.payload=typeof e.payload=="object"?JSON.stringify(e.payload):e.payload),e.lastRunId!==void 0&&(s.lastRunId=e.lastRunId),e.autoPopulateLastRunPayload!==void 0&&(s.autoPopulateLastRunPayload=e.autoPopulateLastRunPayload),e.configurationId!==void 0&&(s.configurationId=e.configurationId),e.conversationDetailId!==void 0&&(s.conversationDetailId=e.conversationDetailId,s.createArtifacts=!0,s.createNotification=!0),t!==void 0&&(s.sourceArtifactId=t),r!==void 0&&(s.sourceArtifactVersionId=r),s}processAgentResult(e){return (0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e)}handleAgentError(e){const r=e?.message||String(e);(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
161
|
+
`}prepareAgentVariables(e,t,r){const s={agentId:e.agent.ID,messages:JSON.stringify(e.conversationMessages),sessionId:this._dataProvider.sessionId};return e.data!==void 0&&(s.data=typeof e.data=="object"?JSON.stringify(e.data):e.data),e.payload!==void 0&&(s.payload=typeof e.payload=="object"?JSON.stringify(e.payload):e.payload),e.lastRunId!==void 0&&(s.lastRunId=e.lastRunId),e.autoPopulateLastRunPayload!==void 0&&(s.autoPopulateLastRunPayload=e.autoPopulateLastRunPayload),e.configurationId!==void 0&&(s.configurationId=e.configurationId),e.conversationDetailId!==void 0&&(s.conversationDetailId=e.conversationDetailId,s.createArtifacts=!0,s.createNotification=!0),t!==void 0&&(s.sourceArtifactId=t),r!==void 0&&(s.sourceArtifactVersionId=r),s}processAgentResult(e){return (0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e)}handleAgentError(e){const r=e?.message||String(e);(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error running AI agent: ${r}`);const s=r.includes("Failed to fetch")||r.includes("NetworkError"),n=r.includes("timed out")||r.includes("timeout");let a;return s?a="Lost connection to the server. The agent may still be running. Please refresh to check the latest status.":a=r,{success:!1,agentRun:void 0,errorMessage:a}}async RunAIAgentFromConversationDetail(e){try{const t=this.buildConversationDetailMutation(),r=this.prepareConversationDetailVariables(e);return await P.Execute({dataProvider:this._dataProvider,mutation:t,variables:r,mutationFieldName:"RunAIAgentFromConversationDetail",operationLabel:"RunAIAgentFromConversationDetail",validateAck:y(s=>s?.success===!0,"validateAck"),isCompletionEvent:y(s=>this.isConversationDetailCompletionEvent(s,e.conversationDetailId),"isCompletionEvent"),extractResult:y(s=>this.extractAgentResult(s),"extractResult"),onMessage:e.onProgress?s=>this.forwardConversationDetailProgress(s,e.onProgress):void 0,createErrorResult:y(s=>this.createAgentErrorResult(s),"createErrorResult")})}catch(t){return this.handleAgentError(t)}}buildConversationDetailMutation(){return (0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
161
162
|
mutation RunAIAgentFromConversationDetail(
|
|
162
163
|
$conversationDetailId: String!,
|
|
163
164
|
$agentId: String!,
|
|
@@ -219,7 +220,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
219
220
|
executionTimeMs
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
|
-
`,r={systemPrompt:e.systemPrompt};e.messages&&e.messages.length>0&&(r.messages=JSON.stringify(e.messages)),e.preferredModels&&(r.preferredModels=e.preferredModels),e.modelPower&&(r.modelPower=e.modelPower),e.responseFormat&&(r.responseFormat=e.responseFormat);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.ExecuteSimplePrompt)throw new Error("Invalid response from server");const n=s.ExecuteSimplePrompt;let a;if(n.resultObject)try{a=JSON.parse(n.resultObject)}catch{a=n.resultObject}return{success:n.success,result:n.result,resultObject:a,modelName:n.modelName,error:n.error,executionTimeMs:n.executionTimeMs}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
223
|
+
`,r={systemPrompt:e.systemPrompt};e.messages&&e.messages.length>0&&(r.messages=JSON.stringify(e.messages)),e.preferredModels&&(r.preferredModels=e.preferredModels),e.modelPower&&(r.modelPower=e.modelPower),e.responseFormat&&(r.responseFormat=e.responseFormat);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.ExecuteSimplePrompt)throw new Error("Invalid response from server");const n=s.ExecuteSimplePrompt;let a;if(n.resultObject)try{a=JSON.parse(n.resultObject)}catch{a=n.resultObject}return{success:n.success,result:n.result,resultObject:a,modelName:n.modelName,error:n.error,executionTimeMs:n.executionTimeMs}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error executing simple prompt: ${r}`),{success:!1,modelName:"Unknown",error:r.message||"Unknown error occurred"}}}async EmbedText(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
223
224
|
mutation EmbedText(
|
|
224
225
|
$textToEmbed: [String!]!,
|
|
225
226
|
$modelSize: String!
|
|
@@ -234,7 +235,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
234
235
|
error
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
|
-
`,s={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},n=await this._dataProvider.ExecuteGQL(t,s);if(!n?.EmbedText)throw new Error("Invalid response from server");const a=n.EmbedText;return{embeddings:Array.isArray(e.textToEmbed)?a.embeddings:a.embeddings[0],modelName:a.modelName,vectorDimensions:a.vectorDimensions,error:a.error}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
238
|
+
`,s={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},n=await this._dataProvider.ExecuteGQL(t,s);if(!n?.EmbedText)throw new Error("Invalid response from server");const a=n.EmbedText;return{embeddings:Array.isArray(e.textToEmbed)?a.embeddings:a.embeddings[0],modelName:a.modelName,vectorDimensions:a.vectorDimensions,error:a.error}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error generating embeddings: ${r}`),{embeddings:Array.isArray(e.textToEmbed)?[]:[],modelName:"Unknown",vectorDimensions:0,error:r.message||"Unknown error occurred"}}}async RunAutotagPipeline(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
238
239
|
mutation RunAutotagPipeline($contentSourceIDs: [String!], $forceReprocess: Boolean) {
|
|
239
240
|
RunAutotagPipeline(contentSourceIDs: $contentSourceIDs, forceReprocess: $forceReprocess) {
|
|
240
241
|
Success
|
|
@@ -243,7 +244,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
243
244
|
PipelineRunID
|
|
244
245
|
}
|
|
245
246
|
}
|
|
246
|
-
`,r={};e?.contentSourceIDs?.length&&(r.contentSourceIDs=e.contentSourceIDs),e?.forceReprocess&&(r.forceReprocess=!0);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.RunAutotagPipeline)throw new Error("Invalid response from server");return s.RunAutotagPipeline}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
247
|
+
`,r={};e?.contentSourceIDs?.length&&(r.contentSourceIDs=e.contentSourceIDs),e?.forceReprocess&&(r.forceReprocess=!0);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.RunAutotagPipeline)throw new Error("Invalid response from server");return s.RunAutotagPipeline}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.RunAutotagPipeline failed",void 0,r),{Success:!1,Status:"Error",ErrorMessage:r.message||"Unknown error"}}}async PauseClassificationPipeline(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
247
248
|
mutation PauseClassificationPipeline($processRunID: String!) {
|
|
248
249
|
PauseClassificationPipeline(processRunID: $processRunID) {
|
|
249
250
|
Success
|
|
@@ -252,7 +253,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
252
253
|
PipelineRunID
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{processRunID:e});if(!r?.PauseClassificationPipeline)throw new Error("Invalid response from server");return r.PauseClassificationPipeline}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
256
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{processRunID:e});if(!r?.PauseClassificationPipeline)throw new Error("Invalid response from server");return r.PauseClassificationPipeline}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.PauseClassificationPipeline failed",void 0,r),{Success:!1,Status:"Error",ErrorMessage:r.message||"Unknown error"}}}async ResumeClassificationPipeline(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
256
257
|
mutation ResumeClassificationPipeline($processRunID: String!) {
|
|
257
258
|
ResumeClassificationPipeline(processRunID: $processRunID) {
|
|
258
259
|
Success
|
|
@@ -261,7 +262,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
261
262
|
PipelineRunID
|
|
262
263
|
}
|
|
263
264
|
}
|
|
264
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{processRunID:e});if(!r?.ResumeClassificationPipeline)throw new Error("Invalid response from server");return r.ResumeClassificationPipeline}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
265
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{processRunID:e});if(!r?.ResumeClassificationPipeline)throw new Error("Invalid response from server");return r.ResumeClassificationPipeline}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.ResumeClassificationPipeline failed",void 0,r),{Success:!1,Status:"Error",ErrorMessage:r.message||"Unknown error"}}}async PromoteTagSuggestion(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
265
266
|
mutation PromoteTagSuggestion($suggestionID: String!, $strategy: String!, $targetTagID: String) {
|
|
266
267
|
PromoteTagSuggestion(suggestionID: $suggestionID, strategy: $strategy, targetTagID: $targetTagID) {
|
|
267
268
|
Success
|
|
@@ -270,14 +271,14 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
270
271
|
ErrorMessage
|
|
271
272
|
}
|
|
272
273
|
}
|
|
273
|
-
`,r={suggestionID:e.suggestionID,strategy:e.strategy};e.targetTagID&&(r.targetTagID=e.targetTagID);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.PromoteTagSuggestion)throw new Error("Invalid response from server");return s.PromoteTagSuggestion}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
274
|
+
`,r={suggestionID:e.suggestionID,strategy:e.strategy};e.targetTagID&&(r.targetTagID=e.targetTagID);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.PromoteTagSuggestion)throw new Error("Invalid response from server");return s.PromoteTagSuggestion}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.PromoteTagSuggestion failed",void 0,r),{Success:!1,ErrorMessage:r.message||"Unknown error"}}}async RejectTagSuggestion(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
274
275
|
mutation RejectTagSuggestion($suggestionID: String!, $reviewerNotes: String) {
|
|
275
276
|
RejectTagSuggestion(suggestionID: $suggestionID, reviewerNotes: $reviewerNotes) {
|
|
276
277
|
Success
|
|
277
278
|
ErrorMessage
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
|
-
`,r={suggestionID:e.suggestionID};e.reviewerNotes&&(r.reviewerNotes=e.reviewerNotes);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.RejectTagSuggestion)throw new Error("Invalid response from server");return s.RejectTagSuggestion}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
281
|
+
`,r={suggestionID:e.suggestionID};e.reviewerNotes&&(r.reviewerNotes=e.reviewerNotes);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.RejectTagSuggestion)throw new Error("Invalid response from server");return s.RejectTagSuggestion}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.RejectTagSuggestion failed",void 0,r),{Success:!1,ErrorMessage:r.message||"Unknown error"}}}async RebuildTagEmbeddings(){try{const e=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
281
282
|
mutation RebuildTagEmbeddings {
|
|
282
283
|
RebuildTagEmbeddings {
|
|
283
284
|
Success
|
|
@@ -286,7 +287,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
286
287
|
ErrorMessage
|
|
287
288
|
}
|
|
288
289
|
}
|
|
289
|
-
`,t=await this._dataProvider.ExecuteGQL(e,{});if(!t?.RebuildTagEmbeddings)throw new Error("Invalid response from server");return t.RebuildTagEmbeddings}catch(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
290
|
+
`,t=await this._dataProvider.ExecuteGQL(e,{});if(!t?.RebuildTagEmbeddings)throw new Error("Invalid response from server");return t.RebuildTagEmbeddings}catch(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.RebuildTagEmbeddings failed",void 0,t),{Success:!1,Refreshed:0,Total:0,ErrorMessage:t.message||"Unknown error"}}}async RunTagHealth(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
290
291
|
mutation RunTagHealth(
|
|
291
292
|
$minCoOccurrence: Int,
|
|
292
293
|
$minNameSimilarity: Float,
|
|
@@ -309,7 +310,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
309
310
|
ErrorMessage
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
|
-
`,r={};e?.minCoOccurrence!=null&&(r.minCoOccurrence=e.minCoOccurrence),e?.minNameSimilarity!=null&&(r.minNameSimilarity=e.minNameSimilarity),e?.minEmbeddingSimilarity!=null&&(r.minEmbeddingSimilarity=e.minEmbeddingSimilarity),e?.maxUsage!=null&&(r.maxUsage=e.maxUsage),e?.maxImplicitChildren!=null&&(r.maxImplicitChildren=e.maxImplicitChildren);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.RunTagHealth)throw new Error("Invalid response from server");return s.RunTagHealth}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
313
|
+
`,r={};e?.minCoOccurrence!=null&&(r.minCoOccurrence=e.minCoOccurrence),e?.minNameSimilarity!=null&&(r.minNameSimilarity=e.minNameSimilarity),e?.minEmbeddingSimilarity!=null&&(r.minEmbeddingSimilarity=e.minEmbeddingSimilarity),e?.maxUsage!=null&&(r.maxUsage=e.maxUsage),e?.maxImplicitChildren!=null&&(r.maxImplicitChildren=e.maxImplicitChildren);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.RunTagHealth)throw new Error("Invalid response from server");return s.RunTagHealth}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.RunTagHealth failed",void 0,r),{Success:!1,MergeCount:0,LowUsageCount:0,WideNodeCount:0,DurationMs:0,ErrorMessage:r.message||"Unknown error"}}}async VectorizeEntity(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
313
314
|
mutation VectorizeEntity(
|
|
314
315
|
$entityDocumentID: String!,
|
|
315
316
|
$entityID: String!,
|
|
@@ -326,7 +327,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
326
327
|
PipelineRunID
|
|
327
328
|
}
|
|
328
329
|
}
|
|
329
|
-
`,r={entityDocumentID:e.entityDocumentID,entityID:e.entityID};e.batchSize!==void 0&&(r.batchSize=e.batchSize);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.VectorizeEntity)throw new Error("Invalid response from server");return s.VectorizeEntity}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
330
|
+
`,r={entityDocumentID:e.entityDocumentID,entityID:e.entityID};e.batchSize!==void 0&&(r.batchSize=e.batchSize);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.VectorizeEntity)throw new Error("Invalid response from server");return s.VectorizeEntity}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.VectorizeEntity failed",void 0,r),{Success:!1,Status:"Error",ErrorMessage:r.message||"Unknown error"}}}async FetchEntityVectors(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
330
331
|
query FetchEntityVectors(
|
|
331
332
|
$entityDocumentID: String!,
|
|
332
333
|
$maxRecords: Int,
|
|
@@ -348,7 +349,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
348
349
|
}
|
|
349
350
|
}
|
|
350
351
|
}
|
|
351
|
-
`,r={entityDocumentID:e.entityDocumentID};e.maxRecords!==void 0&&(r.maxRecords=e.maxRecords),e.filter!==void 0&&(r.filter=e.filter);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.FetchEntityVectors)throw new Error("Invalid response from server");return s.FetchEntityVectors}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
352
|
+
`,r={entityDocumentID:e.entityDocumentID};e.maxRecords!==void 0&&(r.maxRecords=e.maxRecords),e.filter!==void 0&&(r.filter=e.filter);const s=await this._dataProvider.ExecuteGQL(t,r);if(!s?.FetchEntityVectors)throw new Error("Invalid response from server");return s.FetchEntityVectors}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLAIClient.FetchEntityVectors failed",void 0,r),{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,ErrorMessage:r.message||"Unknown error"}}}}const F="5.34.0",$="default";class K{static{y(this,"BrowserStorageProviderBase")}constructor(){this._storage=new Map}getCategoryMap(e){const t=e||$;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||$).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||$);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||$).set(e,t)}async Remove(e,t){this.getCategoryMap(t||$).delete(e)}async ClearCategory(e){const t=e||$;this._storage.delete(t)}async GetCategoryKeys(e){const t=this._storage.get(e||$);return t?Array.from(t.keys()):[]}}const Ie="MJ_Metadata",fe=0;function Re(){try{const I=F.split("."),e=parseInt(I[0],10),t=parseInt(I[1],10);if(!Number.isFinite(e)||!Number.isFinite(t))throw new Error(`Could not parse major.minor from version "${F}"`);return e*1e3+t+fe}catch(I){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:I,message:"Failed to derive IDB version from PACKAGE_VERSION; using fallback 99999"}),99999}}y(Re,"computeIdbVersion");const De=Re(),j=["mj:default","mj:Metadata","mj:RunViewCache","mj:RunQueryCache","mj:DatasetCache"];class J extends K{static{y(this,"BrowserIndexedDBStorageProvider")}constructor(){super(),this._dbReady=!1,this.dbPromise=(0,_tempfix_idb__WEBPACK_IMPORTED_MODULE_10__/* .openDB */ .P2)(Ie,De,{upgrade:y((e,t,r)=>{try{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[IDBCache] Upgrading IndexedDB schema v${t} \u2192 v${r} (package ${F}). 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){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:s,message:s?.message})}},"upgrade"),blocked:y((e,t)=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`[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=()=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)("[IDBCache] DB schema upgraded in another tab \u2014 closing local connection."),e.close(),this._dbReady=!1}}).catch(e=>{(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:e,message:"IndexedDB initialization failed: "+e?.message})})}get IsReady(){return this._dbReady}isKnownCategory(e){const t=`mj:${e}`;return j.includes(t)}getStoreName(e){const t=e||$;return this.isKnownCategory(t)?`mj:${t}`:"mj:default"}getStoreKey(e,t){const r=t||$;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){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({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(R=>this.getStoreKey(R,t)),o=s.transaction(n,"readonly"),u=o.objectStore(n),l=i.map(R=>u.get(R)),f=await Promise.all(l);await o.done;for(let R=0;R<a.length;R++){const S=f[R];r.set(a[R],S===void 0?null:S)}return r}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({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){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:r,message:r?.message})}}async ClearCategory(e){try{const t=await this.dbPromise,r=e||$,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 u of o)typeof u=="string"&&u.startsWith(n)&&await i.delete(u);await a.done}}catch(t){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:t,message:t?.message})}}async GetCategoryKeys(e){try{const t=await this.dbPromise,r=e||$,s=this.getStoreName(e),i=await t.transaction(s,"readonly").objectStore(s).getAllKeys();if(this.isKnownCategory(r))return i.map(u=>String(u));const o=`[${r}]:`;return i.map(u=>String(u)).filter(u=>u.startsWith(o)).map(u=>u.slice(o.length))}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogErrorEx */ .Q1A)({error:t,message:t?.message}),[]}}}class Ee extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderConfigDataBase */ .dZq{static{y(this,"GraphQLProviderConfigData")}get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get MJAPIKey(){return this.Data.MJAPIKey}set MJAPIKey(e){this.Data.MJAPIKey=e}get UserAPIKey(){return this.Data.UserAPIKey}set UserAPIKey(e){this.Data.UserAPIKey=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}get OnAuthenticationError(){return this.Data.OnAuthenticationError}set OnAuthenticationError(e){this.Data.OnAuthenticationError=e}constructor(e,t,r,s,n,a,i,o,u,l){super({Token:e,URL:t,WSURL:r,MJAPIKey:o,UserAPIKey:u,RefreshTokenFunction:s,OnAuthenticationError:l},n,a,i)}}class p extends _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderBase */ .Dny{static{y(this,"GraphQLDataProvider")}constructor(){super(),this._refreshPromise=null,this._dynamicHeaders=new Map,this._innerCurrentUserQueryString=`CurrentUser {
|
|
352
353
|
${this.userInfoString()}
|
|
353
354
|
MJUserRoles_UserIDArray {
|
|
354
355
|
${this.userRoleInfoString()}
|
|
@@ -357,7 +358,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
357
358
|
`,this._currentUserQuery=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query CurrentUserAndRoles {
|
|
358
359
|
${this._innerCurrentUserQueryString}
|
|
359
360
|
CurrentUserTenantContext
|
|
360
|
-
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject=new rxjs__WEBPACK_IMPORTED_MODULE_6__/* .BehaviorSubject */ .t("unknown"),this._isDisposingSocketIntentionally=!1,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._cacheInvalidationSubscription=null;const e=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .GetGlobalObjectStore */ .Ip)();if(e&&e[
|
|
361
|
+
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._socketStateSubject=new rxjs__WEBPACK_IMPORTED_MODULE_6__/* .BehaviorSubject */ .t("unknown"),this._isDisposingSocketIntentionally=!1,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._cacheInvalidationSubscription=null;const e=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .GetGlobalObjectStore */ .Ip)();if(e&&e[p._globalStoreKey])return e[p._globalStoreKey];e&&(e[p._globalStoreKey]=this)}static{this._globalStoreKey="___SINGLETON__GraphQLDataProvider"}static get Instance(){const e=(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .GetGlobalObjectStore */ .Ip)();return e?e[p._globalStoreKey]:void 0}get ConfigData(){return this._configData}get AI(){return this._aiClient||(this._aiClient=new B(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 (0,uuid__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A)()}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 this._configData=e,r?(this._sessionId=await this.GetPreferredUUID(s),this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId,e.MJAPIKey,e.UserAPIKey),await this.SaveStoredSessionID(this._sessionId)):(p.Instance._configData=e,p.Instance._sessionId===void 0&&(p.Instance._sessionId=await this.GetPreferredUUID(s)),p.Instance._client||(p.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,p.Instance._sessionId,e.MJAPIKey,e.UserAPIKey)),await p.Instance.SaveStoredSessionID(p.Instance._sessionId),this._sessionId=p.Instance._sessionId,this._client=p.Instance._client),super.Config(e)}catch(n){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),n}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}SetDynamicHeader(e,t){this._dynamicHeaders.set(e,t),this._client&&this._client.setHeader(e,t),p.Instance&&p.Instance!==this&&p.Instance._configData===this._configData&&(p.Instance._dynamicHeaders.set(e,t),p.Instance._client&&p.Instance._client.setHeader(e,t))}RemoveDynamicHeader(e){this._dynamicHeaders.delete(e),this._client&&this._client.setHeader(e,""),p.Instance&&p.Instance!==this&&p.Instance._configData===this._configData&&(p.Instance._dynamicHeaders.delete(e),p.Instance._client&&p.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),r=t.MJUserRoles_UserIDArray.map(n=>this.ConvertBackToMJFields(n));t.MJUserRoles_UserIDArray=r;const s=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserInfo */ .oqB(this,{...t,UserRoles:r});return e.CurrentUserTenantContext&&typeof e.CurrentUserTenantContext=="object"&&(s.TenantContext=e.CurrentUserTenantContext),s}}async RunReport(e,t){const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
361
362
|
query GetReportDataQuery ($ReportID: String!) {
|
|
362
363
|
GetReportData(ReportID: $ReportID) {
|
|
363
364
|
Success
|
|
@@ -384,13 +385,13 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
384
385
|
${this.QueryReturnFieldList}
|
|
385
386
|
}
|
|
386
387
|
}
|
|
387
|
-
`,
|
|
388
|
+
`,u={QueryID:e};t!==void 0&&(u.CategoryID=t),r!==void 0&&(u.CategoryPath=r),n!==void 0&&(u.Parameters=n),a!==void 0&&(u.MaxRows=a),i!==void 0&&(u.StartRow=i);const l=await this.ExecuteGQL(o,u);if(l&&l.GetQueryData)return this.TransformQueryPayload(l.GetQueryData)}async RunQueryByName(e,t,r,s,n,a,i){const o=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
388
389
|
query GetQueryDataByNameQuery($QueryName: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
|
|
389
390
|
GetQueryDataByName(QueryName: $QueryName, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
|
|
390
391
|
${this.QueryReturnFieldList}
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
|
-
`,
|
|
394
|
+
`,u={QueryName:e};t!==void 0&&(u.CategoryID=t),r!==void 0&&(u.CategoryPath=r),n!==void 0&&(u.Parameters=n),a!==void 0&&(u.MaxRows=a),i!==void 0&&(u.StartRow=i);const l=await this.ExecuteGQL(o,u);if(l&&l.GetQueryDataByName)return this.TransformQueryPayload(l.GetQueryDataByName)}get QueryReturnFieldList(){return`
|
|
394
395
|
Success
|
|
395
396
|
QueryID
|
|
396
397
|
QueryName
|
|
@@ -399,7 +400,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
399
400
|
TotalRowCount
|
|
400
401
|
ExecutionTime
|
|
401
402
|
ErrorMessage
|
|
402
|
-
AppliedParameters`}TransformQueryPayload(e){try{return{QueryID:e.QueryID,QueryName:e.QueryName,Success:e.Success,Results:JSON.parse(e.Results),RowCount:e.RowCount,TotalRowCount:e.TotalRowCount,ExecutionTime:e.ExecutionTime,ErrorMessage:e.ErrorMessage,AppliedParameters:e.AppliedParameters?JSON.parse(e.AppliedParameters):void 0}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
403
|
+
AppliedParameters`}TransformQueryPayload(e){try{return{QueryID:e.QueryID,QueryName:e.QueryName,Success:e.Success,Results:JSON.parse(e.Results),RowCount:e.RowCount,TotalRowCount:e.TotalRowCount,ExecutionTime:e.ExecutionTime,ErrorMessage:e.ErrorMessage,AppliedParameters:e.AppliedParameters?JSON.parse(e.AppliedParameters):void 0}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error transforming query payload: ${t}`),null}}async RunQueriesWithCacheCheck(e,t){try{const r=e.map(o=>({params:{QueryID:o.params.QueryID||null,QueryName:o.params.QueryName||null,CategoryID:o.params.CategoryID||null,CategoryPath:o.params.CategoryPath||null,Parameters:o.params.Parameters||null,MaxRows:o.params.MaxRows??null,StartRow:o.params.StartRow??null,ForceAuditLog:o.params.ForceAuditLog||!1,AuditLogDescription:o.params.AuditLogDescription||null},cacheStatus:o.cacheStatus?{maxUpdatedAt:o.cacheStatus.maxUpdatedAt,rowCount:o.cacheStatus.rowCount}:null})),s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
403
404
|
query RunQueriesWithCacheCheckQuery($input: [RunQueryWithCacheCheckInput!]!) {
|
|
404
405
|
RunQueriesWithCacheCheck(input: $input) {
|
|
405
406
|
success
|
|
@@ -415,14 +416,14 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
415
416
|
}
|
|
416
417
|
}
|
|
417
418
|
}
|
|
418
|
-
`,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
|
|
419
|
+
`,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 u=JSON.parse(o.Results);return{queryIndex:o.queryIndex,queryId:o.queryId,status:o.status,results:u,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`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:m,v:h}=await this.getEntityNameAndUserView(e,t);i=h,a=m}const o=this.Entities.find(m=>m.Name===a);if(!o)throw new Error(`Entity ${a} not found in metadata`);let u=!1;const l=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(o);e.ViewID?(r=`Run${l}ViewByID`,s="RunViewByIDInput",n.ViewID=e.ViewID):e.ViewName?(r=`Run${l}ViewByName`,s="RunViewByNameInput",n.ViewName=e.ViewName):(u=!0,r=`Run${l}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),u||(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(m=>({expression:m.expression,alias:m.alias})));const f=this.getViewRunTimeFieldList(o,i,e,u),R=e.Aggregates&&e.Aggregates.length>0?`
|
|
419
420
|
AggregateResults {
|
|
420
421
|
alias
|
|
421
422
|
expression
|
|
422
423
|
value
|
|
423
424
|
error
|
|
424
425
|
}
|
|
425
|
-
AggregateExecutionTime`:"",
|
|
426
|
+
AggregateExecutionTime`:"",S=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
426
427
|
query RunViewQuery ($input: ${s}!) {
|
|
427
428
|
${r}(input: $input) {
|
|
428
429
|
Results {
|
|
@@ -436,7 +437,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
436
437
|
Success
|
|
437
438
|
ErrorMessage${R}
|
|
438
439
|
}
|
|
439
|
-
}`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const g=await this.ExecuteGQL(
|
|
440
|
+
}`;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Sending RunView with aggregates:",{entityName:a,queryName:r,aggregateCount:n.Aggregates.length,aggregates:n.Aggregates});const g=await this.ExecuteGQL(S,{input:n});if(g&&g[r]){const m=g[r].AggregateResults;n.Aggregates?.length>0&&console.log("[GraphQLDataProvider] Received aggregate results:",{entityName:a,aggregateResultCount:m?.length||0,aggregateResults:m,aggregateExecutionTime:g[r].AggregateExecutionTime});const h=g[r].Results;if(h&&h.length>0){const w=o.Fields.filter(E=>E.CodeName!==E.Name&&E.CodeName!==void 0);h.forEach(E=>{this.ConvertBackToMJFields(E),w.forEach(T=>{E[T.Name]=E[T.CodeName]})})}return g[r]}}else throw"No parameters passed to RunView";return null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async InternalRunViews(e,t){try{let r=[],s=[],n=[];for(const l of e){let f="",R="";const S={};let g=null,m=null;if(l.ViewEntity)m=l.ViewEntity,g=m.Get("Entity");else{const{entityName:E,v:T}=await this.getEntityNameAndUserView(l,t);m=T,g=E}const h=this.Entities.find(E=>E.Name===g);if(!h)throw new Error(`Entity ${g} not found in metadata`);s.push(h);let D=!1;const w=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(h);l.ViewID?(f=`Run${w}ViewByID`,R="RunViewByIDInput",S.ViewID=l.ViewID):l.ViewName?(f=`Run${w}ViewByName`,R="RunViewByNameInput",S.ViewName=l.ViewName):(D=!0,f=`Run${w}DynamicView`,R="RunDynamicViewInput",S.EntityName=l.EntityName),S.ExtraFilter=l.ExtraFilter||"",S.OrderBy=l.OrderBy||"",S.UserSearchString=l.UserSearchString||"",S.Fields=l.Fields,S.IgnoreMaxRows=l.IgnoreMaxRows||!1,l.MaxRows!==void 0&&(S.MaxRows=l.MaxRows),l.StartRow!==void 0&&(S.StartRow=l.StartRow),l.AfterKey&&(S.AfterKey={KeyValuePairs:l.AfterKey.KeyValuePairs}),S.ForceAuditLog=l.ForceAuditLog||!1,S.ResultType=l.ResultType||"simple",l.AuditLogDescription&&l.AuditLogDescription.length>0&&(S.AuditLogDescription=l.AuditLogDescription),D||(S.ExcludeUserViewRunID=l.ExcludeUserViewRunID||"",S.ExcludeDataFromAllPriorViewRuns=l.ExcludeDataFromAllPriorViewRuns||!1,S.OverrideExcludeFilter=l.OverrideExcludeFilter||"",S.SaveViewResults=l.SaveViewResults||!1),l.Aggregates&&l.Aggregates.length>0&&(S.Aggregates=l.Aggregates.map(E=>({expression:E.expression,alias:E.alias}))),r.push(S),n.push(...this.getViewRunTimeFieldList(h,m,l,D))}const i=e.some(l=>l.Aggregates&&l.Aggregates.length>0)?`
|
|
440
441
|
AggregateResults {
|
|
441
442
|
alias
|
|
442
443
|
expression
|
|
@@ -461,7 +462,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
461
462
|
Success
|
|
462
463
|
ErrorMessage${i}
|
|
463
464
|
}
|
|
464
|
-
}`,
|
|
465
|
+
}`,u=await this.ExecuteGQL(o,{input:r});if(u&&u.RunViews){const l=u.RunViews;for(const[f,R]of l.entries())R.Results=R.Results.map(S=>{let g=JSON.parse(S.Data);return this.ConvertBackToMJFields(g),g});return l}return null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(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"},cacheStatus:o.cacheStatus?{maxUpdatedAt:o.cacheStatus.maxUpdatedAt,rowCount:o.cacheStatus.rowCount}:null})),s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
465
466
|
query RunViewsWithCacheCheckQuery($input: [RunViewWithCacheCheckInput!]!) {
|
|
466
467
|
RunViewsWithCacheCheck(input: $input) {
|
|
467
468
|
success
|
|
@@ -494,7 +495,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
494
495
|
}
|
|
495
496
|
}
|
|
496
497
|
}
|
|
497
|
-
`,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,
|
|
498
|
+
`,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,u)=>{const l=e[u];if(o.status==="differential"&&o.differentialData){const f=o.differentialData.updatedRows.map(R=>{const S=JSON.parse(R.Data);return this.ConvertBackToMJFields(S),S});return{viewIndex:o.viewIndex,status:o.status,results:void 0,differentialData:{updatedRows:f,deletedRecordIDs:o.differentialData.deletedRecordIDs},maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}if(o.status==="stale"&&o.Results){const f=o.Results.map(R=>{const S=JSON.parse(R.Data);return this.ConvertBackToMJFields(S),S});return{viewIndex:o.viewIndex,status:o.status,results:f,maxUpdatedAt:o.maxUpdatedAt,rowCount:o.rowCount,errorMessage:o.errorMessage}}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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(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 _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__/* .ViewInfo */ .o1C.GetViewEntity(e.ViewID,t),r=s.Entity;else if(e.ViewName)s=await _memberjunction_core_entities__WEBPACK_IMPORTED_MODULE_3__/* .ViewInfo */ .o1C.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=[],a=new v;if(r.Fields){for(const i of e.PrimaryKeys)r.Fields.find(o=>o.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&n.push(i.Name);r.Fields.forEach(i=>{n.push(a.MapFieldName(i))})}else if(s)e.Fields.forEach(i=>{i.IsBinaryFieldType||n.push(a.MapFieldName(i.CodeName))});else{for(const i of e.PrimaryKeys)n.find(o=>o.trim().toLowerCase()===i.Name.toLowerCase())===void 0&&n.push(i.Name);t.Columns.forEach(i=>{i.hidden===!1&&!n.find(o=>o.trim().toLowerCase()===i.EntityField?.Name.trim().toLowerCase())&&i.EntityField&&n.push(a.MapFieldName(i.EntityField.CodeName))})}return n}get ProviderType(){return _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .ProviderType */ .cpK.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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}async GetRecordDependencies(e,t){try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetRecordDependenciesQuery ($entityName: String!, $CompositeKey: CompositeKeyInputType!) {
|
|
498
499
|
GetRecordDependencies(entityName: $entityName, CompositeKey: $CompositeKey) {
|
|
499
500
|
EntityName
|
|
500
501
|
RelatedEntityName
|
|
@@ -506,7 +507,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
506
507
|
}
|
|
507
508
|
}
|
|
508
509
|
}
|
|
509
|
-
}`,s={entityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.KeyValuePairs)}};return(await this.ExecuteGQL(r,s))?.GetRecordDependencies}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
510
|
+
}`,s={entityName:e,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(t.KeyValuePairs)}};return(await this.ExecuteGQL(r,s))?.GetRecordDependencies}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),r}}ensureKeyValuePairValueIsString(e){return e.map(t=>({FieldName:t.FieldName,Value:t.Value.toString()}))}async GetRecordDuplicates(e,t){if(!e)return null;const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetRecordDuplicatesQuery ($params: PotentialDuplicateRequestType!) {
|
|
510
511
|
GetRecordDuplicates(params: $params) {
|
|
511
512
|
Status
|
|
512
513
|
ErrorMessage
|
|
@@ -545,32 +546,32 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
545
546
|
Message
|
|
546
547
|
}
|
|
547
548
|
}
|
|
548
|
-
}`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
549
|
-
${e.Fields.map(g=>
|
|
549
|
+
}`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),{Success:!1,OverallStatus:n&&n.message?n.message:n,RecordStatus:[],RecordMergeLogID:"",Request:e}}}async Save(e,t,r){if(r?.IsParentEntitySave){const n=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;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 _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;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(g=>({FieldName:g.CodeName,Value:g.Value})),e.RegisterResultHistoryEntry(s);const i=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),o=`${a}${i}`,u=e.Fields.filter(g=>!g.ReadOnly||g.IsPrimaryKey&&e.IsSaved),l=new v,f=` ${o}(input: $input) {
|
|
550
|
+
${e.Fields.map(g=>l.MapFieldName(g.CodeName)).join(`
|
|
550
551
|
`)}
|
|
551
552
|
}`,R=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation ${a}${i} ($input: ${o}Input!) {
|
|
552
553
|
${f}
|
|
553
554
|
}
|
|
554
|
-
`;for(let g=0;g<
|
|
555
|
-
${
|
|
556
|
-
${e.Fields.filter(
|
|
555
|
+
`;for(let g=0;g<u.length;g++){const m=u[g];let h=e.Get(m.Name);if(h)switch(m.EntityFieldInfo.TSType){case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date:h=h.getTime();break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean:typeof h!="boolean"&&(h=parseInt(h)!==0);break;case _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number:if(typeof h!="number"){const D=Number(h);isNaN(D)||(h=D)}break}h===null&&m.EntityFieldInfo.AllowsNull===!1&&(m.EntityFieldInfo.DefaultValue!==null?h=m.EntityFieldInfo.DefaultValue:m.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number||m.FieldType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?h=0:h=""),n.input[l.MapFieldName(m.CodeName)]=h}const S=e.RestoreContext;if(S&&(n.input.RestoreContext___={SourceChangeID:S.SourceChangeID,Reason:S.Reason}),a.trim().toLowerCase()==="update"&&r.SkipOldValuesCheck===!1){const g=[];e.Fields.forEach(m=>{let h=null;m.OldValue!==null&&m.OldValue!==void 0&&(m.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Date?h=m.OldValue.getTime().toString():m.EntityFieldInfo.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Boolean?h=m.OldValue===!0?"1":"0":typeof m.OldValue!="string"?h=m.OldValue.toString():h=m.OldValue),g.push({Key:l.MapFieldName(m.CodeName),Value:h})}),n.input.OldValues___=g}if(e.TransactionGroup){const g=[{varName:"input",inputType:o+"Input!"}];return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,s.Type==="create"?"Create":"Update",f,n,{mutationName:o,mutationInputTypes:g},(m,h)=>{s.EndedAt=new Date,h&&m?(s.Success=!0,s.NewValues=this.ConvertBackToMJFields(m)):(s.Success=!1,s.Message="Transaction failed")})),!0}else{const g=await this.ExecuteGQL(R,n);if(g&&g[o])return s.Success=!0,s.EndedAt=new Date,s.NewValues=this.ConvertBackToMJFields(g[o]),s.NewValues;throw new Error(`Save failed for ${e.EntityInfo.ClassName}`)}}catch(n){return s.Success=!1,s.EndedAt=new Date,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message,(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(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 g=e.Fields.find(D=>D.Name.trim().toLowerCase()===t.KeyValuePairs[S].FieldName.trim().toLowerCase()).EntityFieldInfo,m=t.GetValueByIndex(S),h=g.GraphQLType;if(i.length>0&&(i+=", "),i+=`$${g.CodeName}: ${h}!`,a.length>0&&(a+=", "),a+=`${g.CodeName}: $${g.CodeName}`,g.TSType===_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .EntityFieldTSType */ .$S8.Number){if(isNaN(t.GetValueByIndex(S)))throw new Error(`Primary Key value ${m} (${g.Name}) is not a valid number`);n[g.CodeName]=parseInt(m)}else n[g.CodeName]=m}const o=r&&r.length>0?this.getRelatedEntityString(e.EntityInfo,r):"",u=(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),l=new v,f=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query Single${u}${o.length>0?"Full":""} (${i}) {
|
|
556
|
+
${u}(${a}) {
|
|
557
|
+
${e.Fields.filter(S=>!S.EntityFieldInfo.IsBinaryFieldType).map(S=>S.EntityFieldInfo.Name.trim().toLowerCase().startsWith("__mj_")?S.CodeName.replace("__mj_","_mj__"):S.CodeName).join(`
|
|
557
558
|
`)}
|
|
558
559
|
${o}
|
|
559
560
|
}
|
|
560
561
|
}
|
|
561
|
-
`,R=await this.ExecuteGQL(f,n);return R&&R[
|
|
562
|
+
`,R=await this.ExecuteGQL(f,n);return R&&R[u]?this.ConvertBackToMJFields(R[u]):null}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),null}}ConvertBackToMJFields(e){return new v().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.Entities.find(o=>(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .UUIDsEqual */ .jd)(o.ID,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+=`
|
|
562
563
|
${i} {
|
|
563
564
|
${a.Fields.map(o=>o.CodeName).join(`
|
|
564
565
|
`)}
|
|
565
566
|
}
|
|
566
|
-
`}return r}async Delete(e,t,r){const s=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .
|
|
567
|
-
`),
|
|
568
|
-
${
|
|
567
|
+
`}return r}async Delete(e,t,r){const s=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntityResult */ .KVj;try{e.RegisterTransactionPreprocessing(),s.StartedAt=new Date,s.Type="delete",s.OriginalValues=e.Fields.map(g=>({FieldName:g.CodeName,Value:g.Value})),e.RegisterResultHistoryEntry(s);const n={},a=[];let i="",o="",u="";for(let g of e.PrimaryKey.KeyValuePairs){const m=e.Fields.find(h=>h.Name.trim().toLowerCase()===g.FieldName.trim().toLowerCase());n[m.CodeName]=m.Value,a.push({varName:m.CodeName,inputType:m.EntityFieldInfo.GraphQLType+"!"}),i.length>0&&(i+=", "),i+=`${m.CodeName}: $${m.CodeName}`,o.length>0&&(o+=", "),o+=`$${m.CodeName}: ${m.EntityFieldInfo.GraphQLType}!`,u.length>0&&(u+=`
|
|
568
|
+
`),u+=`${m.CodeName}`}a.push({varName:"options___",inputType:"DeleteOptionsInput!"}),n.options___={SkipEntityAIActions:t?.SkipEntityAIActions??!1,SkipEntityActions:t?.SkipEntityActions??!1,ReplayOnly:t?.ReplayOnly??!1,IsParentEntityDelete:t?.IsParentEntityDelete??!1};const f="Delete"+(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .getGraphQLTypeNameBase */ .IaG)(e.EntityInfo),R=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`${f}(${i}, options___: $options___) {
|
|
569
|
+
${u}
|
|
569
570
|
}
|
|
570
|
-
`,
|
|
571
|
+
`,S=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation ${f} (${o}, $options___: DeleteOptionsInput!) {
|
|
571
572
|
${R}
|
|
572
573
|
}
|
|
573
|
-
`;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .
|
|
574
|
+
`;if(e.TransactionGroup)return e.RaiseReadyForTransaction(),e.TransactionGroup.AddTransaction(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .TransactionItem */ .U1K(e,"Delete",R,n,{mutationName:f,mutationInputTypes:a},(g,m)=>{if(s.EndedAt=new Date,m&&g){let h=!0;for(const D of e.PrimaryKey.KeyValuePairs)D.Value!==g[D.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 g=await this.ExecuteGQL(S,n);if(g&&g[f]){const m=g[f];for(let h of e.PrimaryKey.KeyValuePairs){let D=m[h.FieldName],w=h.Value;if(typeof w=="number"&&(w=w.toString()),typeof D=="number"&&(D=D.toString()),w!==D)throw new Error(`Primary key value mismatch in server Delete response. Field: ${h.FieldName}, Original: ${w}, Returned: ${D}`)}return s.Success=!0,s.EndedAt=new Date,!0}else throw new Error(`Delete failed for ${e.EntityInfo.Name}: ${e.PrimaryKey.ToString()} `)}}catch(n){return s.EndedAt=new Date,s.Success=!1,s.Message=n.response?.errors?.length>0?n.response.errors[0].message:n.message,(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(n),!1}}async GetDatasetByName(e,t){const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetDatasetByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
|
|
574
575
|
GetDatasetByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
|
|
575
576
|
DatasetID
|
|
576
577
|
DatasetName
|
|
@@ -579,7 +580,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
579
580
|
LatestUpdateDate
|
|
580
581
|
Results
|
|
581
582
|
}
|
|
582
|
-
}`,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
|
|
583
|
+
}`,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 p._datasetStatusCoalesceMs>0&&!t?this.enqueueDatasetStatusCheck(e):this.executeDatasetStatusByName(e,t)}enqueueDatasetStatusCheck(e){return new Promise((t,r)=>{p._datasetStatusQueue.push({datasetName:e,resolve:t,reject:r}),p._datasetStatusTimer||(p._datasetStatusTimer=setTimeout(()=>this.flushDatasetStatusQueue(),p._datasetStatusCoalesceMs))})}async flushDatasetStatusQueue(){p._datasetStatusTimer=null;const e=p._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);(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogStatus */ .b09)(`\u26A1 [Coalesce] Batching ${t.length} dataset status checks into 1 request: [${t.join(", ")}]`);try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetMultipleDatasetStatusByName($DatasetNames: [String!]!) {
|
|
583
584
|
GetMultipleDatasetStatusByName(DatasetNames: $DatasetNames) {
|
|
584
585
|
DatasetID
|
|
585
586
|
DatasetName
|
|
@@ -588,7 +589,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
588
589
|
LatestUpdateDate
|
|
589
590
|
EntityUpdateDates
|
|
590
591
|
}
|
|
591
|
-
}`,n=((await this.ExecuteGQL(r,{DatasetNames:t}))?.GetMultipleDatasetStatusByName||[]).map(a=>({DatasetID:a.DatasetID,DatasetName:a.DatasetName,Success:a.Success,Status:a.Status,LatestUpdateDate:a.LatestUpdateDate?new Date(a.LatestUpdateDate):null,EntityUpdateDates:a.EntityUpdateDates?JSON.parse(a.EntityUpdateDates):null}));for(const a of e){const i=n.find(o=>o.DatasetName===a.datasetName);i?a.resolve(i):a.resolve({DatasetID:"",DatasetName:a.datasetName,Success:!1,Status:"Not found in batch response",LatestUpdateDate:null,EntityUpdateDates:null})}}catch(r){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
592
|
+
}`,n=((await this.ExecuteGQL(r,{DatasetNames:t}))?.GetMultipleDatasetStatusByName||[]).map(a=>({DatasetID:a.DatasetID,DatasetName:a.DatasetName,Success:a.Success,Status:a.Status,LatestUpdateDate:a.LatestUpdateDate?new Date(a.LatestUpdateDate):null,EntityUpdateDates:a.EntityUpdateDates?JSON.parse(a.EntityUpdateDates):null}));for(const a of e){const i=n.find(o=>o.DatasetName===a.datasetName);i?a.resolve(i):a.resolve({DatasetID:"",DatasetName:a.datasetName,Success:!1,Status:"Not found in batch response",LatestUpdateDate:null,EntityUpdateDates:null})}}catch(r){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Dataset status batch failed, falling back to individual calls: ${r}`);const s=e.map(async n=>{try{const a=await this.executeDatasetStatusByName(n.datasetName,n.itemFilters);n.resolve(a)}catch(a){n.reject(a)}});await Promise.all(s)}}async executeDatasetStatusByName(e,t){const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetDatasetStatusByName($DatasetName: String!, $ItemFilters: [DatasetItemFilterTypeGQL!]) {
|
|
592
593
|
GetDatasetStatusByName(DatasetName: $DatasetName, ItemFilters: $ItemFilters) {
|
|
593
594
|
DatasetID
|
|
594
595
|
DatasetName
|
|
@@ -602,7 +603,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
602
603
|
Success
|
|
603
604
|
IsFavorite
|
|
604
605
|
}
|
|
605
|
-
}`,i=await this.ExecuteGQL(a,{params:{UserID:e,EntityID:n.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)}}});if(i&&i.GetRecordFavoriteStatus&&i.GetRecordFavoriteStatus.Success)return i.GetRecordFavoriteStatus.IsFavorite}async SetRecordFavoriteStatus(e,t,r,s,n){const a=this.Entities.find(
|
|
606
|
+
}`,i=await this.ExecuteGQL(a,{params:{UserID:e,EntityID:n.ID,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(r.KeyValuePairs)}}});if(i&&i.GetRecordFavoriteStatus&&i.GetRecordFavoriteStatus.Success)return i.GetRecordFavoriteStatus.IsFavorite}async SetRecordFavoriteStatus(e,t,r,s,n){const a=this.Entities.find(u=>u.Name===t);if(!a)throw new Error(`Entity ${t} not found in metadata`);const i=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation SetRecordFavoriteStatus($params: UserFavoriteSetParams!) {
|
|
606
607
|
SetRecordFavoriteStatus(params: $params){
|
|
607
608
|
Success
|
|
608
609
|
}
|
|
@@ -625,28 +626,28 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
625
626
|
EntityName
|
|
626
627
|
RecordName
|
|
627
628
|
}
|
|
628
|
-
}`,r=await this.ExecuteGQL(t,{info:e.map(s=>({EntityName:s.EntityName,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(s.CompositeKey.KeyValuePairs)}}))});if(r&&r.GetEntityRecordNames)return r.GetEntityRecordNames.map(s=>({...s,CompositeKey:new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .CompositeKey */ .
|
|
629
|
+
}`,r=await this.ExecuteGQL(t,{info:e.map(s=>({EntityName:s.EntityName,CompositeKey:{KeyValuePairs:this.ensureKeyValuePairValueIsString(s.CompositeKey.KeyValuePairs)}}))});if(r&&r.GetEntityRecordNames)return r.GetEntityRecordNames.map(s=>({...s,CompositeKey:new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .CompositeKey */ .BT8(s.CompositeKey.KeyValuePairs)}))}async GetDataContextData(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetDataContextData ($DataContextID: String!) {
|
|
629
630
|
GetDataContextData(DataContextID: $DataContextID) {
|
|
630
631
|
Success
|
|
631
632
|
ErrorMessages
|
|
632
633
|
Results
|
|
633
634
|
}
|
|
634
|
-
}`,r=await this.ExecuteGQL(t,{DataContextID:e});if(r&&r.GetDataContextData){if(r.GetDataContextData.Success)return r.GetDataContextData.Results.map(s=>JSON.parse(s));throw new Error(r.GetDataContextData.ErrorMessages.join(", "))}else throw new Error("GraphQL query failed")}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
635
|
+
}`,r=await this.ExecuteGQL(t,{DataContextID:e});if(r&&r.GetDataContextData){if(r.GetDataContextData.Success)return r.GetDataContextData.Results.map(s=>JSON.parse(s));throw new Error(r.GetDataContextData.ErrorMessages.join(", "))}else throw new Error("GraphQL query failed")}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),t}}async GetDataContextItemData(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`query GetDataContextItemData ($DataContextItemID: String!) {
|
|
635
636
|
GetDataContextItemData(DataContextItemID: $DataContextItemID) {
|
|
636
637
|
Success
|
|
637
638
|
ErrorMessage
|
|
638
639
|
Result
|
|
639
640
|
}
|
|
640
|
-
}`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
641
|
+
}`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),t}}static async ExecuteGQL(e,t,r=!0){return p.Instance.ExecuteGQL(e,t,r)}async ExecuteGQL(e,t,r=!0){try{return await this._client.request(e,t)}catch(s){if(console.error("[GraphQL] ExecuteGQL error caught:",{hasResponse:!!s?.response,hasErrors:!!s?.response?.errors,errorCount:s?.response?.errors?.length,firstError:s?.response?.errors?.[0],errorCode:s?.response?.errors?.[0]?.extensions?.code,errorMessage:s?.response?.errors?.[0]?.message,fullError:s}),s&&s.response&&s.response.errors?.length>0)if(s.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(r)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("JWT_EXPIRED and refreshTokenIfNeeded is false"),s}else throw s;else throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(s),s}}async RefreshToken(){const e=p.Instance&&p.Instance._configData===this._configData;if(e&&p.Instance._refreshPromise)return p.Instance._refreshPromise;if(this._refreshPromise)return this._refreshPromise;console.log("[GraphQL] Starting token refresh..."),this._refreshPromise=this.performTokenRefresh(),e&&(p.Instance._refreshPromise=this._refreshPromise);try{await this._refreshPromise,console.log("[GraphQL] Token refresh completed successfully")}finally{this._refreshPromise=null,e&&p.Instance&&(p.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,p.Instance&&p.Instance._configData===this._configData&&(p.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 p.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()})}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 graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .GraphQLClient */ .l4(e,{headers:a});for(const[o,u]of this._dynamicHeaders)i.setHeader(o,u);return i}userInfoString(){return this.infoString(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserInfo */ .oqB(null,null))}userRoleInfoString(){return this.infoString(new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .UserRoleInfo */ .St$(null))}infoString(e){let t="";const r=Object.keys(e);for(const s of r)s.startsWith("__mj_")?t+=s.replace("__mj_","_mj__")+`
|
|
641
642
|
`:s.startsWith("_")||(t+=s+`
|
|
642
|
-
`);return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new J:this._localStorageProvider=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .InMemoryLocalStorageProvider */ .
|
|
643
|
+
`);return t}get LocalStorageProvider(){return this._localStorageProvider||(typeof indexedDB<"u"?this._localStorageProvider=new J:this._localStorageProvider=new _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .InMemoryLocalStorageProvider */ .KWg),this._localStorageProvider}get Metadata(){return this}get SocketConnectivity$(){return this._socketStateSubject.asObservable()}get SocketConnectionState(){return this._socketStateSubject.value}ForceSocketReconnect(){this.disposeWSClient()}getOrCreateWSClient(){const e=Date.now();return this._wsClient&&this._wsClientCreatedAt&&e-this._wsClientCreatedAt>this.WS_CLIENT_MAX_AGE_MS&&this._activeSubscriptionCount===0&&this.disposeWSClient(),this._wsClient||(this._isDisposingSocketIntentionally=!1,this._wsClient=(0,graphql_ws__WEBPACK_IMPORTED_MODULE_8__/* .createClient */ .UU)({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token},keepAlive:3e4,retryAttempts:3,shouldRetry:y(()=>!0,"shouldRetry")}),this._wsClientCreatedAt=e,this._wsClient.on("connected",()=>{this._socketStateSubject.next("connected")}),this._wsClient.on("closed",()=>{this._isDisposingSocketIntentionally||this._socketStateSubject.next("disconnected")}),this._subscriptionCleanupTimer||(this._subscriptionCleanupTimer=setInterval(()=>{this.cleanupStaleSubscriptions()},this.SUBSCRIPTION_CLEANUP_INTERVAL_MS))),this._wsClient}disposeWSClient(){if(this._wsClient){this._isDisposingSocketIntentionally=!0;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()}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 rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(r=>{const s=this.getOrCreateWSClient();this._activeSubscriptionCount++;const n=s.subscribe({query:e,variables:t},{next:y(a=>{r.next(a.data)},"next"),error:y(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(u){console.error("[GraphQLDataProvider] Failed to refresh token for WebSocket:",u),r.error(u)}}else r.error(a)},"error"),complete:y(()=>{r.complete()},"complete")});return()=>{this._activeSubscriptionCount--,n()}})}PushStatusUpdates(e=null){e||(e=this.sessionId);const t=Date.now(),r=this._pushStatusSubjects.get(e);if(r)return r.lastRequestedAt=t,new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{r.activeSubscribers++;const u=r.subject.subscribe(o);return()=>{const l=this._pushStatusSubjects.get(e);l&&l.activeSubscribers>0&&l.activeSubscribers--,u.unsubscribe()}});const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`subscription StatusUpdates($sessionId: String!) {
|
|
643
644
|
statusUpdates(sessionId: $sessionId) {
|
|
644
645
|
date
|
|
645
646
|
message
|
|
646
647
|
sessionId
|
|
647
648
|
}
|
|
648
649
|
}
|
|
649
|
-
`,n=new rxjs__WEBPACK_IMPORTED_MODULE_5__/* .Subject */ .B,a=this.getOrCreateWSClient(),i=new rxjs__WEBPACK_IMPORTED_MODULE_7__/* .Subscription */ .yU;return i.add(new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{const
|
|
650
|
+
`,n=new rxjs__WEBPACK_IMPORTED_MODULE_5__/* .Subject */ .B,a=this.getOrCreateWSClient(),i=new rxjs__WEBPACK_IMPORTED_MODULE_7__/* .Subscription */ .yU;return i.add(new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{const u=a.subscribe({query:s,variables:{sessionId:e}},{next:y(l=>{const f=this._pushStatusSubjects.get(e);f&&(f.lastEmissionAt=Date.now()),o.next(l.data.statusUpdates.message)},"next"),error:y(async l=>{const f=l;if(f?.extensions?.code==="JWT_EXPIRED"||f?.message?.includes("token has expired")||f?.message?.includes("JWT_EXPIRED")){console.log("[GraphQLDataProvider] PushStatusUpdates JWT token expired, refreshing and reconnecting...");try{await this.RefreshToken(),this.disposeWSClient(),o.complete()}catch(S){console.error("[GraphQLDataProvider] Failed to refresh token for PushStatusUpdates:",S),o.error(S)}}else o.error(l)},"error"),complete:y(()=>{o.complete()},"complete")});return this._activeSubscriptionCount++,()=>{this._activeSubscriptionCount--,u()}}).subscribe({next:y(o=>n.next(o),"next"),error:y(o=>{n.error(o),this._pushStatusSubjects.delete(e)},"error"),complete:y(()=>{n.complete(),this._pushStatusSubjects.delete(e)},"complete")})),this._pushStatusSubjects.set(e,{subject:n,subscription:i,createdAt:t,lastRequestedAt:t,lastEmissionAt:t,activeSubscribers:0}),new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(o=>{const u=this._pushStatusSubjects.get(e);u&&u.activeSubscribers++;const l=n.subscribe(o);return()=>{const f=this._pushStatusSubjects.get(e);f&&f.activeSubscribers>0&&f.activeSubscribers--,l.unsubscribe()}})}disposeWebSocketResources(){this._subscriptionCleanupTimer&&(clearInterval(this._subscriptionCleanupTimer),this._subscriptionCleanupTimer=null),this.UnsubscribeFromCacheInvalidation(),this.completeAllSubjects(),this._activeSubscriptionCount=0,this.disposeWSClient()}ClientToolRequests(e){return this.subscribe(`
|
|
650
651
|
subscription ClientToolRequest($sessionID: String!) {
|
|
651
652
|
ClientToolRequest(sessionID: $sessionID) {
|
|
652
653
|
AgentRunID
|
|
@@ -668,26 +669,26 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
668
669
|
OriginSessionID
|
|
669
670
|
RecordData
|
|
670
671
|
}
|
|
671
|
-
}`,t=this.subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:y(r=>{const s=r?.cacheInvalidation;if(!s)return;if(s.OriginSessionID&&s.OriginSessionID===this.sessionId){console.debug(`[GraphQLDataProvider] Skipping self-originated cache invalidation for "${s.EntityName}" (action: ${s.Action})`);return}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}};_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJGlobal */ .rt.Instance.RaiseEvent({event:_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJEventType */ .UK.ComponentEvent,eventCode:_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntity */ .
|
|
672
|
+
}`,t=this.subscribe(e);this._cacheInvalidationSubscription=t.subscribe({next:y(r=>{const s=r?.cacheInvalidation;if(!s)return;if(s.OriginSessionID&&s.OriginSessionID===this.sessionId){console.debug(`[GraphQLDataProvider] Skipping self-originated cache invalidation for "${s.EntityName}" (action: ${s.Action})`);return}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}};_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJGlobal */ .rt.Instance.RaiseEvent({event:_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJEventType */ .UK.ComponentEvent,eventCode:_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .BaseEntity */ .HCJ.BaseEventCode,args:n,component:this})},"next"),error:y(r=>{console.error("[GraphQLDataProvider] Cache invalidation subscription error:",r),this._cacheInvalidationSubscription=null},"error"),complete:y(()=>{console.log("[GraphQLDataProvider] Cache invalidation subscription completed, will re-establish on next WebSocket creation"),this._cacheInvalidationSubscription=null},"complete")})}UnsubscribeFromCacheInvalidation(){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!) {
|
|
672
673
|
FindISAChildEntity(EntityName: $EntityName, RecordID: $RecordID) {
|
|
673
674
|
Success
|
|
674
675
|
ChildEntityName
|
|
675
676
|
ErrorMessage
|
|
676
677
|
}
|
|
677
|
-
}`;try{const n=await this.ExecuteGQL(s,{EntityName:e.Name,RecordID:t});return n?.FindISAChildEntity?.Success&&n.FindISAChildEntity.ChildEntityName?{ChildEntityName:n.FindISAChildEntity.ChildEntityName}:null}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
678
|
+
}`;try{const n=await this.ExecuteGQL(s,{EntityName:e.Name,RecordID:t});return n?.FindISAChildEntity?.Success&&n.FindISAChildEntity.ChildEntityName?{ChildEntityName:n.FindISAChildEntity.ChildEntityName}:null}catch(n){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`FindISAChildEntity failed for ${e.Name}: ${n}`),null}}async FindISAChildEntities(e,t,r){if(!e.IsParentType)return[];const s=`query FindISAChildEntities($EntityName: String!, $RecordID: String!) {
|
|
678
679
|
FindISAChildEntities(EntityName: $EntityName, RecordID: $RecordID) {
|
|
679
680
|
Success
|
|
680
681
|
ChildEntityNames
|
|
681
682
|
ErrorMessage
|
|
682
683
|
}
|
|
683
|
-
}`;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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
684
|
+
}`;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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`FindISAChildEntities failed for ${e.Name}: ${n}`),[]}}}async function ve(I){const e=new p;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .SetProvider */ .YEN)(e),await e.Config(I),await e.preValidateAndRefresh(),_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJGlobal */ .rt.Instance.RaiseEvent({event:_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .MJEventType */ .UK.LoggedIn,eventCode:null,component:this,args:null}),await _memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .StartupManager */ .jFS.Instance.Startup(),e}y(ve,"setupGraphQLClient");class we{static{y(this,"SyncRolesAndUsersResult")}}class Ce{static{y(this,"RoleInput")}}class $e{static{y(this,"UserInput")}}class Pe{static{y(this,"RolesAndUsersInput")}}var W=(I=>(I.Create="Create",I.Update="Update",I.CreateOrUpdate="CreateOrUpdate",I.Delete="Delete",I.DeleteWithFilter="DeleteWithFilter",I))(W||{});class be{static{y(this,"ActionItemInput")}}class Ne{static{y(this,"SyncDataResult")}constructor(){this.Results=[]}}class Ae{static{y(this,"ActionItemOutput")}}class Me{static{y(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 graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .GraphQLClient */ .l4(e,{headers:n})}resolvePlatformSQL(e){if(e!=null)return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .IsPlatformSQL */ .WVk)(e)?e.default:e}async GetData(e,t){try{const s=await this.Client.request(`query GetData($input: GetDataInputType!) {
|
|
684
685
|
GetData(input: $input) {
|
|
685
686
|
Success
|
|
686
687
|
ErrorMessages
|
|
687
688
|
Queries
|
|
688
689
|
Results
|
|
689
690
|
}
|
|
690
|
-
}`,{input:{Queries:e,Token:t}});return s&&s.GetData?{Success:s.GetData.Success,Results:s.GetData.Results.map(n=>n?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(n):null),ErrorMessages:s.GetData.ErrorMessages,Queries:s.GetData.Queries}:{Success:!1,Results:[],ErrorMessages:s.GetData?.ErrorMessages??["Unknown error"],Queries:s.GetData?.Queries??e}}catch(r){let s=r instanceof Error?r.message:String(r);const n=s.match(/Error: ([^:]+)\./);if(n&&(s=n[1]+"."),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .IsVerboseLoggingEnabled */ .
|
|
691
|
+
}`,{input:{Queries:e,Token:t}});return s&&s.GetData?{Success:s.GetData.Success,Results:s.GetData.Results.map(n=>n?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(n):null),ErrorMessages:s.GetData.ErrorMessages,Queries:s.GetData.Queries}:{Success:!1,Results:[],ErrorMessages:s.GetData?.ErrorMessages??["Unknown error"],Queries:s.GetData?.Queries??e}}catch(r){let s=r instanceof Error?r.message:String(r);const n=s.match(/Error: ([^:]+)\./);if(n&&(s=n[1]+"."),(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .IsVerboseLoggingEnabled */ .l98)()){const a=`GraphQLSystemUserClient::GetData - Error getting data - ${r}`;(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(a)}return{Success:!1,Results:[],ErrorMessages:[s],Queries:e}}}async GetAllRemoteEntities(){try{const t=await this.Client.request(`query GetAllEntities {
|
|
691
692
|
GetAllEntities {
|
|
692
693
|
Success
|
|
693
694
|
ErrorMessage
|
|
@@ -710,7 +711,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
710
711
|
}
|
|
711
712
|
}
|
|
712
713
|
}
|
|
713
|
-
}`);return t&&t.GetAllEntities?t.GetAllEntities:{Success:!1,Results:[],ErrorMessage:t.GetAllEntities?.ErrorMessage??"Unknown error"}}catch(e){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
714
|
+
}`);return t&&t.GetAllEntities?t.GetAllEntities:{Success:!1,Results:[],ErrorMessage:t.GetAllEntities?.ErrorMessage??"Unknown error"}}catch(e){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::GetAllRemoteEntities - Error getting remote entities - ${e}`),{Success:!1,Results:[],ErrorMessage:e}}}async SyncData(e){try{const r=await this.Client.request(`mutation SyncData($items: [ActionItemInputType!]!) {
|
|
714
715
|
SyncData(items: $items) {
|
|
715
716
|
Success
|
|
716
717
|
Results {
|
|
@@ -734,11 +735,11 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
734
735
|
RecordJSON
|
|
735
736
|
}
|
|
736
737
|
}
|
|
737
|
-
}`,{items:e});return r&&r.SyncData?r.SyncData:{Success:!1,Results:[]}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
738
|
+
}`,{items:e});return r&&r.SyncData?r.SyncData:{Success:!1,Results:[]}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::SyncData - Error syncing data - ${t}`),{Success:!1,Results:[]}}}async SyncRolesAndUsers(e){try{const r=await this.Client.request(`mutation SyncRolesAndUsers($data: RolesAndUsersInputType!) {
|
|
738
739
|
SyncRolesAndUsers(data: $data) {
|
|
739
740
|
Success
|
|
740
741
|
}
|
|
741
|
-
}`,{data:e});return r&&r.SyncRolesAndUsers?r.SyncRolesAndUsers:{Success:!1}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
742
|
+
}`,{data:e});return r&&r.SyncRolesAndUsers?r.SyncRolesAndUsers:{Success:!1}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::SyncRolesAndUsers - Error syncing roles and users - ${t}`),{Success:!1}}}async RunViewByName(e){try{const t=`query RunViewByNameSystemUser($input: RunViewByNameInput!) {
|
|
742
743
|
RunViewByNameSystemUser(input: $input) {
|
|
743
744
|
Results {
|
|
744
745
|
PrimaryKey {
|
|
@@ -755,7 +756,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
755
756
|
ErrorMessage
|
|
756
757
|
Success
|
|
757
758
|
}
|
|
758
|
-
}`,r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByNameSystemUser?s.RunViewByNameSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by name"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
759
|
+
}`,r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByNameSystemUser?s.RunViewByNameSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by name"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::RunViewByNameSystemUser - Error running view by name - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunViewByID(e){try{const t=`query RunViewByIDSystemUser($input: RunViewByIDInput!) {
|
|
759
760
|
RunViewByIDSystemUser(input: $input) {
|
|
760
761
|
Results {
|
|
761
762
|
PrimaryKey {
|
|
@@ -772,7 +773,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
772
773
|
ErrorMessage
|
|
773
774
|
Success
|
|
774
775
|
}
|
|
775
|
-
}`,r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByIDSystemUser?s.RunViewByIDSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by ID"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
776
|
+
}`,r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunViewByIDSystemUser?s.RunViewByIDSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute view by ID"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::RunViewByIDSystemUser - Error running view by ID - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunDynamicView(e){try{const t=`query RunDynamicViewSystemUser($input: RunDynamicViewInput!) {
|
|
776
777
|
RunDynamicViewSystemUser(input: $input) {
|
|
777
778
|
Results {
|
|
778
779
|
PrimaryKey {
|
|
@@ -789,7 +790,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
789
790
|
ErrorMessage
|
|
790
791
|
Success
|
|
791
792
|
}
|
|
792
|
-
}`,r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunDynamicViewSystemUser?s.RunDynamicViewSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute dynamic view"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
793
|
+
}`,r={...e,ExtraFilter:this.resolvePlatformSQL(e.ExtraFilter),OrderBy:this.resolvePlatformSQL(e.OrderBy)},s=await this.Client.request(t,{input:r});return s&&s.RunDynamicViewSystemUser?s.RunDynamicViewSystemUser:{Results:[],Success:!1,ErrorMessage:"Failed to execute dynamic view"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::RunDynamicViewSystemUser - Error running dynamic view - ${t}`),{Results:[],Success:!1,ErrorMessage:t.toString()}}}async RunViews(e){try{const t=`query RunViewsSystemUser($input: [RunViewGenericInput!]!) {
|
|
793
794
|
RunViewsSystemUser(input: $input) {
|
|
794
795
|
Results {
|
|
795
796
|
PrimaryKey {
|
|
@@ -806,7 +807,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
806
807
|
ErrorMessage
|
|
807
808
|
Success
|
|
808
809
|
}
|
|
809
|
-
}`,r=e.map(n=>({...n,ExtraFilter:this.resolvePlatformSQL(n.ExtraFilter),OrderBy:this.resolvePlatformSQL(n.OrderBy)})),s=await this.Client.request(t,{input:r});return s&&s.RunViewsSystemUser?s.RunViewsSystemUser:[]}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
810
|
+
}`,r=e.map(n=>({...n,ExtraFilter:this.resolvePlatformSQL(n.ExtraFilter),OrderBy:this.resolvePlatformSQL(n.OrderBy)})),s=await this.Client.request(t,{input:r});return s&&s.RunViewsSystemUser?s.RunViewsSystemUser:[]}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::RunViewsSystemUser - Error running views - ${t}`),[]}}async GetQueryData(e){try{if(e.Parameters!==void 0&&Array.isArray(e.Parameters))throw new Error("Parameters must be a JSON object, not an array. Use {} for empty parameters instead of [].");const t=`query GetQueryDataSystemUser($QueryID: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
|
|
810
811
|
GetQueryDataSystemUser(QueryID: $QueryID, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
|
|
811
812
|
QueryID
|
|
812
813
|
QueryName
|
|
@@ -818,7 +819,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
818
819
|
ErrorMessage
|
|
819
820
|
AppliedParameters
|
|
820
821
|
}
|
|
821
|
-
}`,r={QueryID:e.QueryID};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);const s=await this.Client.request(t,r);return s&&s.GetQueryDataSystemUser?{...s.GetQueryDataSystemUser,Results:s.GetQueryDataSystemUser.Results?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(s.GetQueryDataSystemUser.Results):null}:{QueryID:e.QueryID,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
822
|
+
}`,r={QueryID:e.QueryID};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);const s=await this.Client.request(t,r);return s&&s.GetQueryDataSystemUser?{...s.GetQueryDataSystemUser,Results:s.GetQueryDataSystemUser.Results?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(s.GetQueryDataSystemUser.Results):null}:{QueryID:e.QueryID,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::GetQueryDataSystemUser - Error executing query - ${t}`),{QueryID:e.QueryID,QueryName:"",Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:t.toString()}}}async GetQueryDataByName(e){try{if(e.Parameters!==void 0&&Array.isArray(e.Parameters))throw new Error("Parameters must be a JSON object, not an array. Use {} for empty parameters instead of [].");const t=`query GetQueryDataByNameSystemUser($QueryName: String!, $CategoryID: String, $CategoryPath: String, $Parameters: JSONObject, $MaxRows: Int, $StartRow: Int) {
|
|
822
823
|
GetQueryDataByNameSystemUser(QueryName: $QueryName, CategoryID: $CategoryID, CategoryPath: $CategoryPath, Parameters: $Parameters, MaxRows: $MaxRows, StartRow: $StartRow) {
|
|
823
824
|
QueryID
|
|
824
825
|
QueryName
|
|
@@ -830,7 +831,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
830
831
|
ErrorMessage
|
|
831
832
|
AppliedParameters
|
|
832
833
|
}
|
|
833
|
-
}`,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);const s=await this.Client.request(t,r);return s&&s.GetQueryDataByNameSystemUser?{...s.GetQueryDataByNameSystemUser,Results:s.GetQueryDataByNameSystemUser.Results?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(s.GetQueryDataByNameSystemUser.Results):null}:{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
834
|
+
}`,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);const s=await this.Client.request(t,r);return s&&s.GetQueryDataByNameSystemUser?{...s.GetQueryDataByNameSystemUser,Results:s.GetQueryDataByNameSystemUser.Results?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(s.GetQueryDataByNameSystemUser.Results):null}:{QueryID:"",QueryName:e.QueryName,Success:!1,Results:null,RowCount:0,TotalRowCount:0,ExecutionTime:0,ErrorMessage:"Query execution failed"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`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 r=await this.Client.request(`mutation CreateQuerySystemUser($input: CreateQuerySystemUserInput!) {
|
|
834
835
|
CreateQuerySystemUser(input: $input) {
|
|
835
836
|
Success
|
|
836
837
|
ErrorMessage
|
|
@@ -889,7 +890,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
889
890
|
}
|
|
890
891
|
}
|
|
891
892
|
}
|
|
892
|
-
}`,{input:e});return r&&r.CreateQuerySystemUser?r.CreateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to create query"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
893
|
+
}`,{input:e});return r&&r.CreateQuerySystemUser?r.CreateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to create query"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::CreateQuery - Error creating query - ${t}`),{Success:!1,ErrorMessage:t.toString()}}}async UpdateQuery(e){try{const r=await this.Client.request(`mutation UpdateQuerySystemUser($input: UpdateQuerySystemUserInput!) {
|
|
893
894
|
UpdateQuerySystemUser(input: $input) {
|
|
894
895
|
Success
|
|
895
896
|
ErrorMessage
|
|
@@ -948,14 +949,14 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
948
949
|
}
|
|
949
950
|
}
|
|
950
951
|
}
|
|
951
|
-
}`,{input:e});return r&&r.UpdateQuerySystemUser?r.UpdateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to update query"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
952
|
+
}`,{input:e});return r&&r.UpdateQuerySystemUser?r.UpdateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to update query"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::UpdateQuery - Error updating query - ${t}`),{Success:!1,ErrorMessage:t.toString()}}}async DeleteQuery(e,t){try{if(!e||e.trim()==="")return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)("GraphQLSystemUserClient::DeleteQuery - Invalid query ID: ID cannot be null or empty"),{Success:!1,ErrorMessage:"Invalid query ID: ID cannot be null or empty"};const r=`mutation DeleteQuerySystemResolver($ID: String!, $options: DeleteOptionsInput) {
|
|
952
953
|
DeleteQuerySystemResolver(ID: $ID, options: $options) {
|
|
953
954
|
Success
|
|
954
955
|
ErrorMessage
|
|
955
956
|
ID
|
|
956
957
|
Name
|
|
957
958
|
}
|
|
958
|
-
}`,s={ID:e};t!==void 0&&(s.options={SkipEntityAIActions:t.SkipEntityAIActions??!1,SkipEntityActions:t.SkipEntityActions??!1,ReplayOnly:t.ReplayOnly??!1,IsParentEntityDelete:t.IsParentEntityDelete??!1});const n=await this.Client.request(r,s);return n&&n.DeleteQuerySystemResolver?n.DeleteQuerySystemResolver:{Success:!1,ErrorMessage:"Failed to delete query"}}catch(r){let s="";if(r instanceof Error){if(s=r.message,"cause"in r&&r.cause){const n=r.cause;s+=` | Cause: ${n.message||n}`,"code"in n&&(s+=` | Code: ${n.code}`)}if("response"in r){const n=r.response;n?.status&&(s+=` | HTTP Status: ${n.status}`),n?.errors&&(s+=` | GraphQL Errors: ${JSON.stringify(n.errors)}`)}r.stack&&console.error("DeleteQuery stack trace:",r.stack)}else s=String(r);return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
959
|
+
}`,s={ID:e};t!==void 0&&(s.options={SkipEntityAIActions:t.SkipEntityAIActions??!1,SkipEntityActions:t.SkipEntityActions??!1,ReplayOnly:t.ReplayOnly??!1,IsParentEntityDelete:t.IsParentEntityDelete??!1});const n=await this.Client.request(r,s);return n&&n.DeleteQuerySystemResolver?n.DeleteQuerySystemResolver:{Success:!1,ErrorMessage:"Failed to delete query"}}catch(r){let s="";if(r instanceof Error){if(s=r.message,"cause"in r&&r.cause){const n=r.cause;s+=` | Cause: ${n.message||n}`,"code"in n&&(s+=` | Code: ${n.code}`)}if("response"in r){const n=r.response;n?.status&&(s+=` | HTTP Status: ${n.status}`),n?.errors&&(s+=` | GraphQL Errors: ${JSON.stringify(n.errors)}`)}r.stack&&console.error("DeleteQuery stack trace:",r.stack)}else s=String(r);return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::DeleteQuery - Error deleting query - ${s}`),{Success:!1,ErrorMessage:s}}}async RunAIPrompt(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
959
960
|
query RunAIPromptSystemUser(
|
|
960
961
|
$promptId: String!,
|
|
961
962
|
$data: String,
|
|
@@ -1014,7 +1015,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1014
1015
|
chatResult
|
|
1015
1016
|
}
|
|
1016
1017
|
}
|
|
1017
|
-
`,r=this.preparePromptVariables(e),s=await this.Client.request(t,r);return s&&s.RunAIPromptSystemUser?this.processPromptResult(s.RunAIPromptSystemUser):{success:!1,error:"Failed to execute AI prompt as system user"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1018
|
+
`,r=this.preparePromptVariables(e),s=await this.Client.request(t,r);return s&&s.RunAIPromptSystemUser?this.processPromptResult(s.RunAIPromptSystemUser):{success:!1,error:"Failed to execute AI prompt as system user"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::RunAIPrompt - Error running AI prompt - ${t}`),{success:!1,error:t.toString()}}}async RunAIAgent(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1018
1019
|
query RunAIAgentSystemUser(
|
|
1019
1020
|
$agentId: String!,
|
|
1020
1021
|
$messages: String!,
|
|
@@ -1041,7 +1042,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1041
1042
|
result
|
|
1042
1043
|
}
|
|
1043
1044
|
}
|
|
1044
|
-
`,r=this.prepareAgentVariables(e),s=await this.Client.request(t,r);return s&&s.RunAIAgentSystemUser?this.processAgentResult(s.RunAIAgentSystemUser.result):{success:!1,agentRun:void 0}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1045
|
+
`,r=this.prepareAgentVariables(e),s=await this.Client.request(t,r);return s&&s.RunAIAgentSystemUser?this.processAgentResult(s.RunAIAgentSystemUser.result):{success:!1,agentRun:void 0}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::RunAIAgent - Error running AI agent - ${t}`),{success:!1,agentRun:void 0}}}preparePromptVariables(e){const t={promptId:e.promptId};return e.data!==void 0&&(t.data=typeof e.data=="object"?JSON.stringify(e.data):e.data),e.templateData!==void 0&&(t.templateData=typeof e.templateData=="object"?JSON.stringify(e.templateData):e.templateData),e.messages!==void 0&&(t.messages=JSON.stringify(e.messages)),e.overrideModelId!==void 0&&(t.overrideModelId=e.overrideModelId),e.overrideVendorId!==void 0&&(t.overrideVendorId=e.overrideVendorId),e.configurationId!==void 0&&(t.configurationId=e.configurationId),e.skipValidation!==void 0&&(t.skipValidation=e.skipValidation),e.responseFormat!==void 0&&(t.responseFormat=e.responseFormat),e.temperature!==void 0&&(t.temperature=e.temperature),e.topP!==void 0&&(t.topP=e.topP),e.topK!==void 0&&(t.topK=e.topK),e.minP!==void 0&&(t.minP=e.minP),e.frequencyPenalty!==void 0&&(t.frequencyPenalty=e.frequencyPenalty),e.presencePenalty!==void 0&&(t.presencePenalty=e.presencePenalty),e.seed!==void 0&&(t.seed=e.seed),e.stopSequences!==void 0&&(t.stopSequences=e.stopSequences),e.includeLogProbs!==void 0&&(t.includeLogProbs=e.includeLogProbs),e.topLogProbs!==void 0&&(t.topLogProbs=e.topLogProbs),e.rerunFromPromptRunID!==void 0&&(t.rerunFromPromptRunID=e.rerunFromPromptRunID),e.systemPromptOverride!==void 0&&(t.systemPromptOverride=e.systemPromptOverride),t}prepareAgentVariables(e){const t={agentId:e.agent.ID,messages:JSON.stringify(e.conversationMessages),sessionId:this._sessionId};return e.data!==void 0&&(t.data=typeof e.data=="object"?JSON.stringify(e.data):e.data),e.lastRunId!==void 0&&(t.lastRunId=e.lastRunId),e.autoPopulateLastRunPayload!==void 0&&(t.autoPopulateLastRunPayload=e.autoPopulateLastRunPayload),e.configurationId!==void 0&&(t.configurationId=e.configurationId),t}processPromptResult(e){let t,r,s;try{e.parsedResult&&(t=JSON.parse(e.parsedResult))}catch{t=e.parsedResult}try{e.validationResult&&(r=JSON.parse(e.validationResult))}catch{r=e.validationResult}try{e.chatResult&&(s=JSON.parse(e.chatResult))}catch{s=e.chatResult}return{success:e.success,output:e.output,parsedResult:t,error:e.error,executionTimeMs:e.executionTimeMs,tokensUsed:e.tokensUsed,promptRunId:e.promptRunId,rawResult:e.rawResult,validationResult:r,chatResult:s}}processAgentResult(e){return (0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(e)}async TestQuerySQL(e){try{const r=await this.Client.request(`query TestQuerySQL($input: TestQuerySQLInput!) {
|
|
1045
1046
|
TestQuerySQL(input: $input) {
|
|
1046
1047
|
Success
|
|
1047
1048
|
Results
|
|
@@ -1050,7 +1051,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1050
1051
|
ErrorMessage
|
|
1051
1052
|
AppliedParameters
|
|
1052
1053
|
}
|
|
1053
|
-
}`,{input:e});return r&&r.TestQuerySQL?{Success:r.TestQuerySQL.Success,Results:r.TestQuerySQL.Results?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(r.TestQuerySQL.Results):null,RowCount:r.TestQuerySQL.RowCount,ExecutionTime:r.TestQuerySQL.ExecutionTime,ErrorMessage:r.TestQuerySQL.ErrorMessage,AppliedParameters:r.TestQuerySQL.AppliedParameters?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(r.TestQuerySQL.AppliedParameters):void 0}:{Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:"TestQuerySQL execution failed"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1054
|
+
}`,{input:e});return r&&r.TestQuerySQL?{Success:r.TestQuerySQL.Success,Results:r.TestQuerySQL.Results?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(r.TestQuerySQL.Results):null,RowCount:r.TestQuerySQL.RowCount,ExecutionTime:r.TestQuerySQL.ExecutionTime,ErrorMessage:r.TestQuerySQL.ErrorMessage,AppliedParameters:r.TestQuerySQL.AppliedParameters?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(r.TestQuerySQL.AppliedParameters):void 0}:{Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:"TestQuerySQL execution failed"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::TestQuerySQL - Error testing query SQL - ${t}`),{Success:!1,Results:null,RowCount:0,ExecutionTime:0,ErrorMessage:t instanceof Error?t.message:String(t)}}}async ExecuteSimplePrompt(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1054
1055
|
query ExecuteSimplePromptSystemUser(
|
|
1055
1056
|
$systemPrompt: String!,
|
|
1056
1057
|
$messages: String,
|
|
@@ -1073,7 +1074,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1073
1074
|
executionTimeMs
|
|
1074
1075
|
}
|
|
1075
1076
|
}
|
|
1076
|
-
`,r={systemPrompt:e.systemPrompt};e.messages&&e.messages.length>0&&(r.messages=JSON.stringify(e.messages)),e.preferredModels&&(r.preferredModels=e.preferredModels),e.modelPower&&(r.modelPower=e.modelPower),e.responseFormat&&(r.responseFormat=e.responseFormat);const s=await this.Client.request(t,r);if(!s?.ExecuteSimplePromptSystemUser)return{success:!1,modelName:"Unknown",error:"Failed to execute simple prompt as system user"};const n=s.ExecuteSimplePromptSystemUser;let a;if(n.resultObject)try{a=JSON.parse(n.resultObject)}catch{a=n.resultObject}return{success:n.success,result:n.result,resultObject:a,modelName:n.modelName,error:n.error,executionTimeMs:n.executionTimeMs}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1077
|
+
`,r={systemPrompt:e.systemPrompt};e.messages&&e.messages.length>0&&(r.messages=JSON.stringify(e.messages)),e.preferredModels&&(r.preferredModels=e.preferredModels),e.modelPower&&(r.modelPower=e.modelPower),e.responseFormat&&(r.responseFormat=e.responseFormat);const s=await this.Client.request(t,r);if(!s?.ExecuteSimplePromptSystemUser)return{success:!1,modelName:"Unknown",error:"Failed to execute simple prompt as system user"};const n=s.ExecuteSimplePromptSystemUser;let a;if(n.resultObject)try{a=JSON.parse(n.resultObject)}catch{a=n.resultObject}return{success:n.success,result:n.result,resultObject:a,modelName:n.modelName,error:n.error,executionTimeMs:n.executionTimeMs}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::ExecuteSimplePrompt - Error executing simple prompt - ${t}`),{success:!1,modelName:"Unknown",error:t.toString()}}}async EmbedText(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1077
1078
|
query EmbedTextSystemUser(
|
|
1078
1079
|
$textToEmbed: [String!]!,
|
|
1079
1080
|
$modelSize: String!
|
|
@@ -1088,7 +1089,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1088
1089
|
error
|
|
1089
1090
|
}
|
|
1090
1091
|
}
|
|
1091
|
-
`,s={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},n=await this.Client.request(t,s);if(!n?.EmbedTextSystemUser)return{embeddings:Array.isArray(e.textToEmbed)?[]:[],modelName:"Unknown",vectorDimensions:0,error:"Failed to generate embeddings as system user"};const a=n.EmbedTextSystemUser;return{embeddings:Array.isArray(e.textToEmbed)?a.embeddings:a.embeddings[0],modelName:a.modelName,vectorDimensions:a.vectorDimensions,error:a.error}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1092
|
+
`,s={textToEmbed:Array.isArray(e.textToEmbed)?e.textToEmbed:[e.textToEmbed],modelSize:e.modelSize},n=await this.Client.request(t,s);if(!n?.EmbedTextSystemUser)return{embeddings:Array.isArray(e.textToEmbed)?[]:[],modelName:"Unknown",vectorDimensions:0,error:"Failed to generate embeddings as system user"};const a=n.EmbedTextSystemUser;return{embeddings:Array.isArray(e.textToEmbed)?a.embeddings:a.embeddings[0],modelName:a.modelName,vectorDimensions:a.vectorDimensions,error:a.error}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::EmbedText - Error generating embeddings - ${t}`),{embeddings:Array.isArray(e.textToEmbed)?[]:[],modelName:"Unknown",vectorDimensions:0,error:t.toString()}}}async SearchKnowledge(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1092
1093
|
mutation SearchKnowledgeAsSystemUser($query: String!, $maxResults: Float, $filters: SearchFiltersInput, $minScore: Float) {
|
|
1093
1094
|
SearchKnowledgeAsSystemUser(query: $query, maxResults: $maxResults, filters: $filters, minScore: $minScore) {
|
|
1094
1095
|
Success
|
|
@@ -1135,7 +1136,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1135
1136
|
ErrorMessage
|
|
1136
1137
|
}
|
|
1137
1138
|
}
|
|
1138
|
-
`,r={query:e.Query};if(e.MaxResults!==void 0&&(r.maxResults=e.MaxResults),e.MinScore!==void 0&&(r.minScore=e.MinScore),e.Filters!==void 0){const n={};e.Filters.EntityNames?.length&&(n.EntityNames=e.Filters.EntityNames),e.Filters.SourceTypes?.length&&(n.SourceTypes=e.Filters.SourceTypes),e.Filters.Tags?.length&&(n.Tags=e.Filters.Tags),r.filters=n}const s=await this.Client.request(t,r);return s?.SearchKnowledgeAsSystemUser?this.mapSearchResponse(s.SearchKnowledgeAsSystemUser):this.searchErrorResponse("Invalid response from server")}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1139
|
+
`,r={query:e.Query};if(e.MaxResults!==void 0&&(r.maxResults=e.MaxResults),e.MinScore!==void 0&&(r.minScore=e.MinScore),e.Filters!==void 0){const n={};e.Filters.EntityNames?.length&&(n.EntityNames=e.Filters.EntityNames),e.Filters.SourceTypes?.length&&(n.SourceTypes=e.Filters.SourceTypes),e.Filters.Tags?.length&&(n.Tags=e.Filters.Tags),r.filters=n}const s=await this.Client.request(t,r);return s?.SearchKnowledgeAsSystemUser?this.mapSearchResponse(s.SearchKnowledgeAsSystemUser):this.searchErrorResponse("Invalid response from server")}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::SearchKnowledge - Error executing search - ${t}`),this.searchErrorResponse(t instanceof Error?t.message:String(t))}}async PreviewSearch(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1139
1140
|
mutation PreviewSearchAsSystemUser($query: String!, $maxResults: Float) {
|
|
1140
1141
|
PreviewSearchAsSystemUser(query: $query, maxResults: $maxResults) {
|
|
1141
1142
|
Success
|
|
@@ -1182,7 +1183,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1182
1183
|
ErrorMessage
|
|
1183
1184
|
}
|
|
1184
1185
|
}
|
|
1185
|
-
`,r={query:e.Query};e.MaxResults!==void 0&&(r.maxResults=e.MaxResults);const s=await this.Client.request(t,r);return s?.PreviewSearchAsSystemUser?this.mapSearchResponse(s.PreviewSearchAsSystemUser):this.searchErrorResponse("Invalid response from server")}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1186
|
+
`,r={query:e.Query};e.MaxResults!==void 0&&(r.maxResults=e.MaxResults);const s=await this.Client.request(t,r);return s?.PreviewSearchAsSystemUser?this.mapSearchResponse(s.PreviewSearchAsSystemUser):this.searchErrorResponse("Invalid response from server")}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSystemUserClient::PreviewSearch - Error executing preview search - ${t}`),this.searchErrorResponse(t instanceof Error?t.message:String(t))}}mapSearchResponse(e){return{Success:e.Success,Results:(e.Results||[]).map(t=>({ID:t.ID,EntityName:t.EntityName,RecordID:t.RecordID,SourceType:t.SourceType,ResultType:t.ResultType,Title:t.Title,Snippet:t.Snippet,Score:t.Score,ScoreBreakdown:this.mapScoreBreakdown(t.ScoreBreakdown),Tags:t.Tags||[],EntityIcon:t.EntityIcon,RecordName:t.RecordName,MatchedAt:t.MatchedAt,RawMetadata:t.RawMetadata,ProviderId:t.ProviderId,ProviderLabel:t.ProviderLabel,ProviderIcon:t.ProviderIcon})),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}}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}}searchErrorResponse(e){return{Success:!1,Results:[],TotalCount:0,ElapsedMs:0,SourceCounts:{Vector:0,FullText:0,Entity:0,Storage:0},Providers:[],ErrorMessage:`Error: ${e}`}}}class xe{static{y(this,"GetDataOutput")}}class Te{static{y(this,"SimpleRemoteEntityOutput")}}class Fe{static{y(this,"SimpleRemoteEntity")}}class Le{static{y(this,"SimpleRemoteEntityField")}}class Qe{static{y(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=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1186
1187
|
mutation RunAction($input: RunActionInput!) {
|
|
1187
1188
|
RunAction(input: $input) {
|
|
1188
1189
|
Success
|
|
@@ -1191,7 +1192,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1191
1192
|
ResultData
|
|
1192
1193
|
}
|
|
1193
1194
|
}
|
|
1194
|
-
`;return await this._dataProvider.ExecuteGQL(t,e)}processActionResult(e,t){if(!e?.RunAction)throw new Error("Invalid response from server");let r;try{e.RunAction.ResultData&&(r=JSON.parse(e.RunAction.ResultData))}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1195
|
+
`;return await this._dataProvider.ExecuteGQL(t,e)}processActionResult(e,t){if(!e?.RunAction)throw new Error("Invalid response from server");let r;try{e.RunAction.ResultData&&(r=JSON.parse(e.RunAction.ResultData))}catch(s){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Failed to parse action result data: ${s}`)}return{Success:e.RunAction.Success,Message:e.RunAction.Message,Result:r,LogEntry:null,Params:t||[],RunParams:null}}handleActionError(e,t){const r=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error running action: ${r}`),{Success:!1,Message:`Error: ${r.message}`,Result:null,LogEntry:null,Params:t||[],RunParams:null}}async RunEntityAction(e){try{const t=this.createEntityActionInput(e),r=await this.executeEntityActionMutation(t);return this.processEntityActionResult(r)}catch(t){return this.handleEntityActionError(t)}}createEntityActionInput(e){const t={EntityActionID:e.EntityAction.ID,InvocationType:e.InvocationType.Name,ListID:e.ListID,ViewID:e.ViewID};return e.Params&&(t.Params=this.convertActionParams(e.Params)),e.EntityObject&&this.addEntityInformation(t,e.EntityObject),t}convertActionParams(e){return e.map(t=>{let r=t.Value;return r!=null&&typeof r=="object"&&(r=JSON.stringify(r)),{Name:t.Name,Value:r,Type:t.Type}})}addEntityInformation(e,t){e.EntityName=t.EntityInfo?.Name,t.PrimaryKey&&(e.PrimaryKey=this.convertPrimaryKey(t.PrimaryKey))}convertPrimaryKey(e){return{KeyValuePairs:e.KeyValuePairs.map(t=>this.convertKeyValuePair(t))}}convertKeyValuePair(e){return{FieldName:e.FieldName,Value:e.Value!==null&&e.Value!==void 0?typeof e.Value=="object"?JSON.stringify(e.Value):e.Value.toString():null}}async executeEntityActionMutation(e){const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1195
1196
|
mutation RunEntityAction($input: EntityActionInput!) {
|
|
1196
1197
|
RunEntityAction(input: $input) {
|
|
1197
1198
|
Success
|
|
@@ -1199,7 +1200,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1199
1200
|
ResultData
|
|
1200
1201
|
}
|
|
1201
1202
|
}
|
|
1202
|
-
`;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){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1203
|
+
`;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){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error running entity action: ${t}`),{Success:!1,Message:`Error: ${t.message}`,RunParams:null,LogEntry:null}}}class Ue{static{y(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=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1203
1204
|
mutation CreateAPIKey($input: CreateAPIKeyInput!) {
|
|
1204
1205
|
CreateAPIKey(input: $input) {
|
|
1205
1206
|
Success
|
|
@@ -1208,18 +1209,18 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1208
1209
|
Error
|
|
1209
1210
|
}
|
|
1210
1211
|
}
|
|
1211
|
-
`;return await this._dataProvider.ExecuteGQL(t,e)}processCreateAPIKeyResult(e){const t=e;return t?.CreateAPIKey?{Success:t.CreateAPIKey.Success,RawKey:t.CreateAPIKey.RawKey,APIKeyID:t.CreateAPIKey.APIKeyID,Error:t.CreateAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}handleCreateAPIKeyError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1212
|
+
`;return await this._dataProvider.ExecuteGQL(t,e)}processCreateAPIKeyResult(e){const t=e;return t?.CreateAPIKey?{Success:t.CreateAPIKey.Success,RawKey:t.CreateAPIKey.RawKey,APIKeyID:t.CreateAPIKey.APIKeyID,Error:t.CreateAPIKey.Error}:{Success:!1,Error:"Invalid response from server"}}handleCreateAPIKeyError(e){const t=e;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error creating API key: ${t.message}`),{Success:!1,Error:`Error: ${t.message}`}}async RevokeAPIKey(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1212
1213
|
mutation RevokeAPIKey($apiKeyId: String!) {
|
|
1213
1214
|
RevokeAPIKey(apiKeyId: $apiKeyId) {
|
|
1214
1215
|
Success
|
|
1215
1216
|
Error
|
|
1216
1217
|
}
|
|
1217
1218
|
}
|
|
1218
|
-
`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1219
|
+
`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error revoking API key: ${r.message}`),{Success:!1,Error:`Error: ${r.message}`}}}}class Ge{static{y(this,"GraphQLTestingClient")}constructor(e){this._dataProvider=e}async RunTest(e){try{const t=this.buildRunTestMutation(),r=this.buildRunTestVariables(e);return await P.Execute({dataProvider:this._dataProvider,mutation:t,variables:r,mutationFieldName:"RunTest",operationLabel:"RunTest",validateAck:y(s=>s?.success===!0,"validateAck"),isCompletionEvent:y(s=>this.isTestCompletionEvent(s,e.testId),"isCompletionEvent"),extractResult:y(s=>this.extractTestResult(s),"extractResult"),onMessage:e.onProgress?s=>this.forwardTestProgress(s,e.onProgress):void 0,createErrorResult:y(s=>({success:!1,errorMessage:s,result:null}),"createErrorResult")})}catch(t){return this.handleError(t,"RunTest")}}async RunTestSuite(e){try{const t=this.buildRunTestSuiteMutation(),r=this.buildRunTestSuiteVariables(e);return await P.Execute({dataProvider:this._dataProvider,mutation:t,variables:r,mutationFieldName:"RunTestSuite",operationLabel:"RunTestSuite",validateAck:y(s=>s?.success===!0,"validateAck"),isCompletionEvent:y(s=>this.isSuiteCompletionEvent(s,e.suiteId),"isCompletionEvent"),extractResult:y(s=>this.extractSuiteResult(s),"extractResult"),onMessage:e.onProgress?s=>this.forwardTestProgress(s,e.onProgress):void 0,createErrorResult:y(s=>({success:!1,errorMessage:s,result:null}),"createErrorResult")})}catch(t){return this.handleError(t,"RunTestSuite")}}async IsTestRunning(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1219
1220
|
query IsTestRunning($testId: String!) {
|
|
1220
1221
|
IsTestRunning(testId: $testId)
|
|
1221
1222
|
}
|
|
1222
|
-
`;return(await this._dataProvider.ExecuteGQL(t,{testId:e})).IsTestRunning}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1223
|
+
`;return(await this._dataProvider.ExecuteGQL(t,{testId:e})).IsTestRunning}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error checking test running status: ${t.message}`),!1}}buildRunTestMutation(){return (0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1223
1224
|
mutation RunTest(
|
|
1224
1225
|
$testId: String!,
|
|
1225
1226
|
$verbose: Boolean,
|
|
@@ -1273,7 +1274,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1273
1274
|
result
|
|
1274
1275
|
}
|
|
1275
1276
|
}
|
|
1276
|
-
`}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}extractTestResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(t.result):null}}extractSuiteResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1277
|
+
`}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}extractTestResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(t.result):null}}extractSuiteResult(e){const t=e.data;return{success:t.success,errorMessage:t.errorMessage,executionTimeMs:t.executionTimeMs,result:t.result?(0,_memberjunction_global__WEBPACK_IMPORTED_MODULE_2__/* .SafeJSONParse */ .NG)(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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`${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 Ve{static{y(this,"GraphQLComponentRegistryClient")}constructor(e){this._dataProvider=e}async GetRegistryComponent(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1277
1278
|
query GetRegistryComponent(
|
|
1278
1279
|
$registryName: String!,
|
|
1279
1280
|
$namespace: String!,
|
|
@@ -1294,7 +1295,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1294
1295
|
specification
|
|
1295
1296
|
}
|
|
1296
1297
|
}
|
|
1297
|
-
`,r={registryName:e.registryName,namespace:e.namespace,name:e.name};e.version!==void 0&&(r.version=e.version),e.hash!==void 0&&(r.hash=e.hash);const s=await this._dataProvider.ExecuteGQL(t,r);if(s&&s.GetRegistryComponent){const n=s.GetRegistryComponent;if(n.notModified&&!n.specification)return null;if(n.specification){if(typeof n.specification=="object")return n.specification;try{return JSON.parse(n.specification)}catch(a){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1298
|
+
`,r={registryName:e.registryName,namespace:e.namespace,name:e.name};e.version!==void 0&&(r.version=e.version),e.hash!==void 0&&(r.hash=e.hash);const s=await this._dataProvider.ExecuteGQL(t,r);if(s&&s.GetRegistryComponent){const n=s.GetRegistryComponent;if(n.notModified&&!n.specification)return null;if(n.specification){if(typeof n.specification=="object")return n.specification;try{return JSON.parse(n.specification)}catch(a){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Failed to parse component specification: ${a}`),null}}return null}return null}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),new Error(`Failed to get registry component: ${t instanceof Error?t.message:"Unknown error"}`)}}async GetRegistryComponentWithHash(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1298
1299
|
query GetRegistryComponent(
|
|
1299
1300
|
$registryName: String!,
|
|
1300
1301
|
$namespace: String!,
|
|
@@ -1315,7 +1316,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1315
1316
|
specification
|
|
1316
1317
|
}
|
|
1317
1318
|
}
|
|
1318
|
-
`,r={registryName:e.registryName,namespace:e.namespace,name:e.name};e.version!==void 0&&(r.version=e.version),e.hash!==void 0&&(r.hash=e.hash);const s=await this._dataProvider.ExecuteGQL(t,r);if(s&&s.GetRegistryComponent){const n=s.GetRegistryComponent;let a;if(n.specification)try{a=JSON.parse(n.specification)}catch(i){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1319
|
+
`,r={registryName:e.registryName,namespace:e.namespace,name:e.name};e.version!==void 0&&(r.version=e.version),e.hash!==void 0&&(r.hash=e.hash);const s=await this._dataProvider.ExecuteGQL(t,r);if(s&&s.GetRegistryComponent){const n=s.GetRegistryComponent;let a;if(n.specification)try{a=JSON.parse(n.specification)}catch(i){(0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Failed to parse component specification in GetRegistryComponentWithHash: ${i}`),a=void 0}return{specification:a,hash:n.hash,notModified:n.notModified,message:n.message}}return{specification:void 0,hash:"",notModified:!1,message:"Component not found"}}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),new Error(`Failed to get registry component with hash: ${t instanceof Error?t.message:"Unknown error"}`)}}async SearchRegistryComponents(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1319
1320
|
query SearchRegistryComponents($params: SearchRegistryComponentsInput!) {
|
|
1320
1321
|
SearchRegistryComponents(params: $params) {
|
|
1321
1322
|
components
|
|
@@ -1324,7 +1325,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1324
1325
|
limit
|
|
1325
1326
|
}
|
|
1326
1327
|
}
|
|
1327
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{params:e});if(r&&r.SearchRegistryComponents){const s=r.SearchRegistryComponents;return{components:s.components.map(n=>JSON.parse(n)),total:s.total,offset:s.offset,limit:s.limit}}return{components:[],total:0,offset:0,limit:e.limit||10}}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1328
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{params:e});if(r&&r.SearchRegistryComponents){const s=r.SearchRegistryComponents;return{components:s.components.map(n=>JSON.parse(n)),total:s.total,offset:s.offset,limit:s.limit}}return{components:[],total:0,offset:0,limit:e.limit||10}}catch(t){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),new Error(`Failed to search registry components: ${t instanceof Error?t.message:"Unknown error"}`)}}async ResolveComponentDependencies(e,t){try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1328
1329
|
query ResolveComponentDependencies(
|
|
1329
1330
|
$registryId: String!,
|
|
1330
1331
|
$componentId: String!
|
|
@@ -1349,7 +1350,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1349
1350
|
}
|
|
1350
1351
|
}
|
|
1351
1352
|
}
|
|
1352
|
-
`,s=await this._dataProvider.ExecuteGQL(r,{registryId:e,componentId:t});return s&&s.ResolveComponentDependencies?s.ResolveComponentDependencies:null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1353
|
+
`,s=await this._dataProvider.ExecuteGQL(r,{registryId:e,componentId:t});return s&&s.ResolveComponentDependencies?s.ResolveComponentDependencies:null}catch(r){throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(r),new Error(`Failed to resolve component dependencies: ${r instanceof Error?r.message:"Unknown error"}`)}}async ComponentExists(e){try{return await this.GetRegistryComponent(e)!==null}catch{return!1}}async GetLatestVersion(e,t,r){try{return(await this.GetRegistryComponent({registryName:e,namespace:t,name:r,version:"latest"}))?.version||null}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(s),null}}async SendComponentFeedback(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1353
1354
|
mutation SendComponentFeedback($feedback: ComponentFeedbackInput!) {
|
|
1354
1355
|
SendComponentFeedback(feedback: $feedback) {
|
|
1355
1356
|
success
|
|
@@ -1357,7 +1358,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1357
1358
|
error
|
|
1358
1359
|
}
|
|
1359
1360
|
}
|
|
1360
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1361
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}}class _e{static{y(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=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1361
1362
|
mutation CreateVersionLabel($input: CreateVersionLabelInput!, $sessionId: String) {
|
|
1362
1363
|
CreateVersionLabel(input: $input, sessionId: $sessionId) {
|
|
1363
1364
|
Success
|
|
@@ -1373,7 +1374,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1373
1374
|
}
|
|
1374
1375
|
}
|
|
1375
1376
|
}
|
|
1376
|
-
`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1377
|
+
`,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`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 qe{static{y(this,"GraphQLFileStorageClient")}constructor(e){this._dataProvider=e}async ListObjects(e,t="",r){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1377
1378
|
query ListStorageObjects($input: ListStorageObjectsInput!) {
|
|
1378
1379
|
ListStorageObjects(input: $input) {
|
|
1379
1380
|
objects {
|
|
@@ -1390,34 +1391,34 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1390
1391
|
prefixes
|
|
1391
1392
|
}
|
|
1392
1393
|
}
|
|
1393
|
-
`,n={input:{AccountID:e,Prefix:t,Delimiter:r||"/"}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.ListStorageObjects)throw new Error("Invalid response from server");return{objects:a.ListStorageObjects.objects.map(i=>({...i,lastModified:new Date(i.lastModified)})),prefixes:a.ListStorageObjects.prefixes}}catch(s){const n=s;throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1394
|
+
`,n={input:{AccountID:e,Prefix:t,Delimiter:r||"/"}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.ListStorageObjects)throw new Error("Invalid response from server");return{objects:a.ListStorageObjects.objects.map(i=>({...i,lastModified:new Date(i.lastModified)})),prefixes:a.ListStorageObjects.prefixes}}catch(s){const n=s;throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error listing storage objects: ${n}`),n}}async DirectoryExists(e,t){try{const r=await this.ListObjects(e,t.endsWith("/")?t:`${t}/`,"/");return r.objects.length>0||r.prefixes.length>0}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error checking directory existence: ${r}`),!1}}async CreateDirectory(e,t){try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1394
1395
|
mutation CreateDirectory($input: CreateDirectoryInput!) {
|
|
1395
1396
|
CreateDirectory(input: $input)
|
|
1396
1397
|
}
|
|
1397
|
-
`,s={input:{AccountID:e,Path:t}};return(await this._dataProvider.ExecuteGQL(r,s))?.CreateDirectory??!1}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1398
|
+
`,s={input:{AccountID:e,Path:t}};return(await this._dataProvider.ExecuteGQL(r,s))?.CreateDirectory??!1}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error creating directory: ${r}`),!1}}async ObjectExists(e,t){try{const r=t.substring(0,t.lastIndexOf("/")+1),s=t.substring(t.lastIndexOf("/")+1);return(await this.ListObjects(e,r,"/")).objects.some(a=>a.name===s||a.fullPath===t)}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error checking object existence: ${r}`),!1}}async CreatePreAuthUploadUrl(e,t,r){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1398
1399
|
mutation CreatePreAuthUploadUrl($input: CreatePreAuthUploadUrlInput!) {
|
|
1399
1400
|
CreatePreAuthUploadUrl(input: $input) {
|
|
1400
1401
|
UploadUrl
|
|
1401
1402
|
ProviderKey
|
|
1402
1403
|
}
|
|
1403
1404
|
}
|
|
1404
|
-
`,n={input:{AccountID:e,ObjectName:t,ContentType:r}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.CreatePreAuthUploadUrl)throw new Error("Invalid response from server");return{uploadUrl:a.CreatePreAuthUploadUrl.UploadUrl,providerKey:a.CreatePreAuthUploadUrl.ProviderKey}}catch(s){const n=s;throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1405
|
+
`,n={input:{AccountID:e,ObjectName:t,ContentType:r}},a=await this._dataProvider.ExecuteGQL(s,n);if(!a?.CreatePreAuthUploadUrl)throw new Error("Invalid response from server");return{uploadUrl:a.CreatePreAuthUploadUrl.UploadUrl,providerKey:a.CreatePreAuthUploadUrl.ProviderKey}}catch(s){const n=s;throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error creating pre-auth upload URL: ${n}`),n}}async CreatePreAuthDownloadUrl(e,t){try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1405
1406
|
query CreatePreAuthDownloadUrl($input: CreatePreAuthDownloadUrlInput!) {
|
|
1406
1407
|
CreatePreAuthDownloadUrl(input: $input)
|
|
1407
1408
|
}
|
|
1408
|
-
`,s={input:{AccountID:e,ObjectName:t}},n=await this._dataProvider.ExecuteGQL(r,s);if(n?.CreatePreAuthDownloadUrl===void 0)throw new Error("Invalid response from server");return n.CreatePreAuthDownloadUrl}catch(r){const s=r;throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1409
|
+
`,s={input:{AccountID:e,ObjectName:t}},n=await this._dataProvider.ExecuteGQL(r,s);if(n?.CreatePreAuthDownloadUrl===void 0)throw new Error("Invalid response from server");return n.CreatePreAuthDownloadUrl}catch(r){const s=r;throw (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error creating pre-auth download URL: ${s}`),s}}async DeleteObject(e,t){try{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1409
1410
|
mutation DeleteStorageObject($input: DeleteStorageObjectInput!) {
|
|
1410
1411
|
DeleteStorageObject(input: $input)
|
|
1411
1412
|
}
|
|
1412
|
-
`,s={input:{AccountID:e,ObjectName:t}};return(await this._dataProvider.ExecuteGQL(r,s))?.DeleteStorageObject??!1}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1413
|
+
`,s={input:{AccountID:e,ObjectName:t}};return(await this._dataProvider.ExecuteGQL(r,s))?.DeleteStorageObject??!1}catch(r){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error deleting storage object: ${r}`),!1}}async MoveObject(e,t,r){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1413
1414
|
mutation MoveStorageObject($input: MoveStorageObjectInput!) {
|
|
1414
1415
|
MoveStorageObject(input: $input)
|
|
1415
1416
|
}
|
|
1416
|
-
`,n={input:{AccountID:e,OldName:t,NewName:r}};return(await this._dataProvider.ExecuteGQL(s,n))?.MoveStorageObject??!1}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1417
|
+
`,n={input:{AccountID:e,OldName:t,NewName:r}};return(await this._dataProvider.ExecuteGQL(s,n))?.MoveStorageObject??!1}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error moving storage object: ${s}`),!1}}async CopyObject(e,t,r){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1417
1418
|
mutation CopyStorageObject($input: CopyStorageObjectInput!) {
|
|
1418
1419
|
CopyStorageObject(input: $input)
|
|
1419
1420
|
}
|
|
1420
|
-
`,n={input:{AccountID:e,SourceName:t,DestinationName:r}};return(await this._dataProvider.ExecuteGQL(s,n))?.CopyStorageObject??!1}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1421
|
+
`,n={input:{AccountID:e,SourceName:t,DestinationName:r}};return(await this._dataProvider.ExecuteGQL(s,n))?.CopyStorageObject??!1}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error copying storage object: ${s}`),!1}}async CopyObjectBetweenAccounts(e,t,r,s){try{const n=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1421
1422
|
mutation CopyObjectBetweenAccounts($input: CopyObjectBetweenAccountsInput!) {
|
|
1422
1423
|
CopyObjectBetweenAccounts(input: $input) {
|
|
1423
1424
|
success
|
|
@@ -1429,7 +1430,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1429
1430
|
destinationPath
|
|
1430
1431
|
}
|
|
1431
1432
|
}
|
|
1432
|
-
`,a={input:{SourceAccountID:e,DestinationAccountID:t,SourcePath:r,DestinationPath:s}},i=await this._dataProvider.ExecuteGQL(n,a);if(!i?.CopyObjectBetweenAccounts)throw new Error("Invalid response from server");return{success:i.CopyObjectBetweenAccounts.success,message:i.CopyObjectBetweenAccounts.message,bytesTransferred:i.CopyObjectBetweenAccounts.bytesTransferred,sourceAccount:i.CopyObjectBetweenAccounts.sourceAccount,destinationAccount:i.CopyObjectBetweenAccounts.destinationAccount,sourcePath:i.CopyObjectBetweenAccounts.sourcePath,destinationPath:i.CopyObjectBetweenAccounts.destinationPath}}catch(n){const a=n;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1433
|
+
`,a={input:{SourceAccountID:e,DestinationAccountID:t,SourcePath:r,DestinationPath:s}},i=await this._dataProvider.ExecuteGQL(n,a);if(!i?.CopyObjectBetweenAccounts)throw new Error("Invalid response from server");return{success:i.CopyObjectBetweenAccounts.success,message:i.CopyObjectBetweenAccounts.message,bytesTransferred:i.CopyObjectBetweenAccounts.bytesTransferred,sourceAccount:i.CopyObjectBetweenAccounts.sourceAccount,destinationAccount:i.CopyObjectBetweenAccounts.destinationAccount,sourcePath:i.CopyObjectBetweenAccounts.sourcePath,destinationPath:i.CopyObjectBetweenAccounts.destinationPath}}catch(n){const a=n;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error copying object between accounts: ${a}`),{success:!1,message:a.message,sourceAccount:"",destinationAccount:"",sourcePath:r,destinationPath:s}}}async SearchFiles(e,t,r){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1433
1434
|
query SearchAcrossAccounts($input: SearchAcrossAccountsInput!) {
|
|
1434
1435
|
SearchAcrossAccounts(input: $input) {
|
|
1435
1436
|
accountResults {
|
|
@@ -1457,9 +1458,9 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1457
1458
|
failedAccounts
|
|
1458
1459
|
}
|
|
1459
1460
|
}
|
|
1460
|
-
`,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(
|
|
1461
|
-
mutation SearchKnowledge($query: String!, $maxResults: Float, $filters: SearchFiltersInput, $minScore: Float) {
|
|
1462
|
-
SearchKnowledge(query: $query, maxResults: $maxResults, filters: $filters, minScore: $minScore) {
|
|
1461
|
+
`,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(u=>({path:u.path,name:u.name,size:u.size,contentType:u.contentType,lastModified:new Date(u.lastModified),relevance:u.relevance,excerpt:u.excerpt,matchInFilename:u.matchInFilename,objectId:u.objectId})),totalMatches:o.totalMatches,hasMore:o.hasMore,nextPageToken:o.nextPageToken})),totalResultsReturned:i.totalResultsReturned,successfulAccounts:i.successfulAccounts,failedAccounts:i.failedAccounts}}catch(s){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error searching across accounts: ${s}`),{accountResults:[],totalResultsReturned:0,successfulAccounts:0,failedAccounts:e.length}}}}class Oe{static{y(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 (0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1462
|
+
mutation SearchKnowledge($query: String!, $maxResults: Float, $filters: SearchFiltersInput, $minScore: Float, $scopeIDs: [ID!], $searchContext: SearchContextInput) {
|
|
1463
|
+
SearchKnowledge(query: $query, maxResults: $maxResults, filters: $filters, minScore: $minScore, scopeIDs: $scopeIDs, searchContext: $searchContext) {
|
|
1463
1464
|
Success
|
|
1464
1465
|
Results {
|
|
1465
1466
|
ID
|
|
@@ -1551,7 +1552,52 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1551
1552
|
ErrorMessage
|
|
1552
1553
|
}
|
|
1553
1554
|
}
|
|
1554
|
-
`}prepareSearchVariables(e){const t={query:e.Query};return e.MaxResults!==void 0&&(t.maxResults=e.MaxResults),e.MinScore!==void 0&&(t.minScore=e.MinScore),e.Filters!==void 0&&(t.filters=this.prepareFilters(e.Filters)),
|
|
1555
|
+
`}prepareSearchVariables(e){const t={query:e.Query};return e.MaxResults!==void 0&&(t.maxResults=e.MaxResults),e.MinScore!==void 0&&(t.minScore=e.MinScore),e.Filters!==void 0&&(t.filters=this.prepareFilters(e.Filters)),e.ScopeIDs!==void 0&&e.ScopeIDs.length>0&&(t.scopeIDs=e.ScopeIDs),e.SearchContext!==void 0&&(t.searchContext={PrimaryScopeEntityID:e.SearchContext.PrimaryScopeEntityID,PrimaryScopeRecordID:e.SearchContext.PrimaryScopeRecordID,SecondaryScopes:e.SearchContext.SecondaryScopes}),t}async GetSearchScopes(){try{const e=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1556
|
+
query SearchScopes {
|
|
1557
|
+
SearchScopes {
|
|
1558
|
+
ID
|
|
1559
|
+
Name
|
|
1560
|
+
Description
|
|
1561
|
+
Icon
|
|
1562
|
+
IsGlobal
|
|
1563
|
+
IsDefault
|
|
1564
|
+
IsPersonal
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
`;return((await this._dataProvider.ExecuteGQL(e,{}))?.SearchScopes??[]).map(s=>({ID:s.ID,Name:s.Name,Description:s.Description??void 0,Icon:s.Icon??void 0,IsGlobal:!!s.IsGlobal,IsDefault:!!s.IsDefault,IsPersonal:!!s.IsPersonal}))}catch(e){return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`GraphQLSearchClient.GetSearchScopes failed: ${e instanceof Error?e.message:String(e)}`),[]}}StreamSearch(e){return new rxjs__WEBPACK_IMPORTED_MODULE_4__/* .Observable */ .c(t=>{const r=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1568
|
+
mutation StreamScopedSearch(
|
|
1569
|
+
$query: String!,
|
|
1570
|
+
$maxResults: Float,
|
|
1571
|
+
$minScore: Float,
|
|
1572
|
+
$scopeIDs: [ID!],
|
|
1573
|
+
$searchContext: JSON,
|
|
1574
|
+
$agentID: ID
|
|
1575
|
+
) {
|
|
1576
|
+
StreamScopedSearch(
|
|
1577
|
+
query: $query,
|
|
1578
|
+
maxResults: $maxResults,
|
|
1579
|
+
minScore: $minScore,
|
|
1580
|
+
scopeIDs: $scopeIDs,
|
|
1581
|
+
searchContext: $searchContext,
|
|
1582
|
+
agentID: $agentID
|
|
1583
|
+
) {
|
|
1584
|
+
Success
|
|
1585
|
+
StreamID
|
|
1586
|
+
ErrorMessage
|
|
1587
|
+
}
|
|
1588
|
+
}`,s=this.prepareSearchVariables(e);let n=null;return(async()=>{try{const i=(await this._dataProvider.ExecuteGQL(r,s))?.StreamScopedSearch;if(!i?.Success){t.error(new Error(i?.ErrorMessage??"StreamScopedSearch failed to start"));return}const o=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1589
|
+
subscription SearchStream($streamID: ID!) {
|
|
1590
|
+
SearchStreamEvents(streamID: $streamID) {
|
|
1591
|
+
StreamID
|
|
1592
|
+
Phase
|
|
1593
|
+
ProviderName
|
|
1594
|
+
DurationMs
|
|
1595
|
+
Results { ID EntityName RecordID SourceType Title Snippet Score Tags MatchedAt ProviderId ProviderLabel ProviderIcon }
|
|
1596
|
+
SourceCounts { Vector FullText Entity Storage }
|
|
1597
|
+
ElapsedMs
|
|
1598
|
+
ErrorMessage
|
|
1599
|
+
}
|
|
1600
|
+
}`;n=this._dataProvider.subscribe(o,{streamID:i.StreamID}).subscribe({next:y(u=>{const l=u?.SearchStreamEvents;l&&(t.next(l),l.Phase==="final"?(t.complete(),n?.unsubscribe()):l.Phase==="error"&&(t.error(new Error(l.ErrorMessage??"Stream error")),n?.unsubscribe()))},"next"),error:y(u=>t.error(u),"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,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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`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 ke{static{y(this,"GraphQLIntegrationClient")}constructor(e){this._dataProvider=e}async DiscoverObjects(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1555
1601
|
query IntegrationDiscoverObjects($companyIntegrationID: String!) {
|
|
1556
1602
|
IntegrationDiscoverObjects(companyIntegrationID: $companyIntegrationID) {
|
|
1557
1603
|
Success
|
|
@@ -1587,7 +1633,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1587
1633
|
ServerVersion
|
|
1588
1634
|
}
|
|
1589
1635
|
}
|
|
1590
|
-
`,s=(await this._dataProvider.ExecuteGQL(t,{companyIntegrationID:e}))?.IntegrationTestConnection;if(!s)throw new Error("Invalid response from server");return{Success:s.Success,Message:s.Message,ServerVersion:s.ServerVersion??null}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1636
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{companyIntegrationID:e}))?.IntegrationTestConnection;if(!s)throw new Error("Invalid response from server");return{Success:s.Success,Message:s.Message,ServerVersion:s.ServerVersion??null}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error testing integration connection: ${r}`),{Success:!1,Message:`Error: ${r.message}`,ServerVersion:null}}}async SchemaPreview(e,t,r="sqlserver"){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1591
1637
|
query IntegrationSchemaPreview(
|
|
1592
1638
|
$companyIntegrationID: String!,
|
|
1593
1639
|
$objects: [SchemaPreviewObjectInput!]!,
|
|
@@ -1608,7 +1654,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1608
1654
|
Warnings
|
|
1609
1655
|
}
|
|
1610
1656
|
}
|
|
1611
|
-
`,a=(await this._dataProvider.ExecuteGQL(s,{companyIntegrationID:e,objects:t,platform:r}))?.IntegrationSchemaPreview;if(!a)throw new Error("Invalid response from server");return{Success:a.Success,Message:a.Message,Files:a.Files??[],Warnings:a.Warnings??[]}}catch(s){const n=s;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1657
|
+
`,a=(await this._dataProvider.ExecuteGQL(s,{companyIntegrationID:e,objects:t,platform:r}))?.IntegrationSchemaPreview;if(!a)throw new Error("Invalid response from server");return{Success:a.Success,Message:a.Message,Files:a.Files??[],Warnings:a.Warnings??[]}}catch(s){const n=s;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error generating schema preview: ${n}`),{Success:!1,Message:`Error: ${n.message}`,Files:[],Warnings:[]}}}async PreviewData(e,t,r=5){try{const s=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1612
1658
|
query IntegrationPreviewData(
|
|
1613
1659
|
$companyIntegrationID: String!,
|
|
1614
1660
|
$objectName: String!,
|
|
@@ -1626,7 +1672,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1626
1672
|
}
|
|
1627
1673
|
}
|
|
1628
1674
|
}
|
|
1629
|
-
`,a=(await this._dataProvider.ExecuteGQL(s,{companyIntegrationID:e,objectName:t,limit:r}))?.IntegrationPreviewData;if(!a)throw new Error("Invalid response from server");return{Success:a.Success,Message:a.Message,Records:a.Records??[]}}catch(s){const n=s;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1675
|
+
`,a=(await this._dataProvider.ExecuteGQL(s,{companyIntegrationID:e,objectName:t,limit:r}))?.IntegrationPreviewData;if(!a)throw new Error("Invalid response from server");return{Success:a.Success,Message:a.Message,Records:a.Records??[]}}catch(s){const n=s;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error previewing integration data: ${n}`),{Success:!1,Message:`Error: ${n.message}`,Records:[]}}}async GetDefaultConfig(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`
|
|
1630
1676
|
query IntegrationGetDefaultConfig($companyIntegrationID: String!) {
|
|
1631
1677
|
IntegrationGetDefaultConfig(companyIntegrationID: $companyIntegrationID) {
|
|
1632
1678
|
Success
|
|
@@ -1645,7 +1691,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1645
1691
|
}
|
|
1646
1692
|
}
|
|
1647
1693
|
}
|
|
1648
|
-
`,s=(await this._dataProvider.ExecuteGQL(t,{companyIntegrationID:e}))?.IntegrationGetDefaultConfig;if(!s)throw new Error("Invalid response from server");return{Success:s.Success,Message:s.Message,DefaultSchemaName:s.DefaultSchemaName,DefaultObjects:s.DefaultObjects??[]}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1694
|
+
`,s=(await this._dataProvider.ExecuteGQL(t,{companyIntegrationID:e}))?.IntegrationGetDefaultConfig;if(!s)throw new Error("Invalid response from server");return{Success:s.Success,Message:s.Message,DefaultSchemaName:s.DefaultSchemaName,DefaultObjects:s.DefaultObjects??[]}}catch(t){const r=t;return (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error getting default config: ${r}`),{Success:!1,Message:`Error: ${r.message}`}}}async CreateConnection(e){try{const t=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation IntegrationCreateConnection($input: CreateConnectionInput!) {
|
|
1649
1695
|
IntegrationCreateConnection(input: $input) { Success Message CompanyIntegrationID CredentialID }
|
|
1650
1696
|
}`;return(await this._dataProvider.ExecuteGQL(t,{input:e}))?.IntegrationCreateConnection??{Success:!1,Message:"No response"}}catch(t){return{Success:!1,Message:t.message}}}async UpdateConnection(e,t,r,s){try{const n=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation IntegrationUpdateConnection(
|
|
1651
1697
|
$companyIntegrationID: String!, $credentialValues: String, $configuration: String, $externalSystemID: String
|
|
@@ -1702,7 +1748,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1702
1748
|
PipelineSteps { Name Status DurationMs Message }
|
|
1703
1749
|
GitCommitSuccess APIRestarted
|
|
1704
1750
|
}
|
|
1705
|
-
}`,
|
|
1751
|
+
}`,u={Connectors:e.map(f=>({CompanyIntegrationID:f.CompanyIntegrationID,SourceObjects:f.SourceObjects.map(R=>({SourceObjectID:R.SourceObjectID??null,SourceObjectName:R.SourceObjectName??null,Fields:R.Fields??null}))})),StartSync:t,FullSync:r,SyncScope:s},l=(await this._dataProvider.ExecuteGQL(o,{input:u,platform:n,skipGitCommit:a,skipRestart:i}))?.IntegrationApplyAllBatch;return l?{Success:l.Success,Message:l.Message,Steps:l.PipelineSteps,GitCommitSuccess:l.GitCommitSuccess,APIRestarted:l.APIRestarted,EntityMapsCreated:l.ConnectorResults?.[0]?.EntityMapsCreated,SyncRunID:l.ConnectorResults?.[0]?.SyncRunID,Warnings:l.ConnectorResults?.flatMap(f=>f.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=(0,graphql_request__WEBPACK_IMPORTED_MODULE_0__/* .gql */ .J1)`mutation IntegrationApplyAll(
|
|
1706
1752
|
$input: ApplyAllInput!, $platform: String!, $skipGitCommit: Boolean!, $skipRestart: Boolean!
|
|
1707
1753
|
) {
|
|
1708
1754
|
IntegrationApplyAll(input: $input, platform: $platform, skipGitCommit: $skipGitCommit, skipRestart: $skipRestart) {
|
|
@@ -1744,7 +1790,7 @@ var z=Object.defineProperty;var y=(I,e)=>z(I,"name",{value:e,configurable:!0});c
|
|
|
1744
1790
|
IntegrationGetConnectorCapabilities(companyIntegrationID: $companyIntegrationID) {
|
|
1745
1791
|
Success Message SupportsGet SupportsCreate SupportsUpdate SupportsDelete SupportsSearch
|
|
1746
1792
|
}
|
|
1747
|
-
}`;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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .
|
|
1793
|
+
}`;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 (0,_memberjunction_core__WEBPACK_IMPORTED_MODULE_1__/* .LogError */ .ZI8)(`Error in integration discovery: ${r}`),{Success:!1,Message:`Error: ${r.message}`,Data:t}}}
|
|
1748
1794
|
//# sourceMappingURL=index.mjs.map
|
|
1749
1795
|
|
|
1750
1796
|
|