@memberjunction/graphql-dataprovider 2.18.2 → 2.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -61,6 +61,11 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
61
61
|
* This getter is not implemented for the GraphQLDataProvider class.
|
|
62
62
|
*/
|
|
63
63
|
get DatabaseConnection(): any;
|
|
64
|
+
/**
|
|
65
|
+
* The connection string for each GraphQLProvider instance is simply the URL for the GraphQL endpoint. This is because each GraphQLDataProvider instance can be configured with a different URL and each URL
|
|
66
|
+
* is a unique combination of host/port/etc.
|
|
67
|
+
*/
|
|
68
|
+
get InstanceConnectionString(): string;
|
|
64
69
|
GenerateUUID(): string;
|
|
65
70
|
/**
|
|
66
71
|
* The GraphQLDataProvider uses a prefix for local storage that is equal to the URL of the GraphQL endpoint. This is because the GraphQLDataProvider can be configured multiple times with different URLs and each
|
package/dist/index.d.mts
CHANGED
|
@@ -61,6 +61,11 @@ declare class GraphQLDataProvider extends ProviderBase implements IEntityDataPro
|
|
|
61
61
|
* This getter is not implemented for the GraphQLDataProvider class.
|
|
62
62
|
*/
|
|
63
63
|
get DatabaseConnection(): any;
|
|
64
|
+
/**
|
|
65
|
+
* The connection string for each GraphQLProvider instance is simply the URL for the GraphQL endpoint. This is because each GraphQLDataProvider instance can be configured with a different URL and each URL
|
|
66
|
+
* is a unique combination of host/port/etc.
|
|
67
|
+
*/
|
|
68
|
+
get InstanceConnectionString(): string;
|
|
64
69
|
GenerateUUID(): string;
|
|
65
70
|
/**
|
|
66
71
|
* The GraphQLDataProvider uses a prefix for local storage that is equal to the URL of the GraphQL endpoint. This is because the GraphQLDataProvider can be configured multiple times with different URLs and each
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var B=Object.defineProperty;var E=(V,e)=>B(V,"name",{value:e,configurable:!0});import{gql as w,GraphQLClient as A}from"graphql-request";import{gql as pe}from"graphql-request";import{ProviderConfigDataBase as K,ProviderBase as O,LogError as h,UserInfo as U,ProviderType as q,BaseEntityResult as M,EntityFieldTSType as g,TransactionItem as k,UserRoleInfo as b,TransactionGroupBase as J,TransactionResult as j,SetProvider as W}from"@memberjunction/core";import{ViewInfo as Q}from"@memberjunction/core-entities";import{openDB as z}from"@tempfix/idb";import{Observable as H}from"rxjs";import{createClient as X}from"graphql-ws";import{v4 as Z}from"uuid";import{MJGlobal as Y,MJEventType as ee}from"@memberjunction/global";const
|
|
1
|
+
var B=Object.defineProperty;var E=(V,e)=>B(V,"name",{value:e,configurable:!0});import{gql as w,GraphQLClient as A}from"graphql-request";import{gql as pe}from"graphql-request";import{ProviderConfigDataBase as K,ProviderBase as O,LogError as h,UserInfo as U,ProviderType as q,BaseEntityResult as M,EntityFieldTSType as g,TransactionItem as k,UserRoleInfo as b,TransactionGroupBase as J,TransactionResult as j,SetProvider as W}from"@memberjunction/core";import{ViewInfo as Q}from"@memberjunction/core-entities";import{openDB as z}from"@tempfix/idb";import{Observable as H}from"rxjs";import{createClient as X}from"graphql-ws";import{v4 as Z}from"uuid";import{MJGlobal as Y,MJEventType as ee}from"@memberjunction/global";const _=class _{constructor(){this._fieldMap={__mj_CreatedAt:"_mj__CreatedAt",__mj_UpdatedAt:"_mj__UpdatedAt",__mj_DeletedAt:"_mj__DeletedAt"}}MapFields(e){if(e)for(const a in e)a in this._fieldMap&&(e[this._fieldMap[a]]=e[a],delete e[a]);return e}MapFieldName(e){return this._fieldMap[e]??e}ReverseMapFieldName(e){return Object.entries(this._fieldMap).find(([a,s])=>s===e)?.[0]??e}ReverseMapFields(e){const a=Object.fromEntries(Object.entries(this._fieldMap).map(([s,t])=>[t,s]));for(const s in e)s in a&&(e[a[s]]=e[s],delete e[s]);return e}};E(_,"FieldMapper");let I=_;const G=class G extends K{get Token(){return this.Data.Token}set Token(e){this.Data.Token=e}get URL(){return this.Data.URL}get WSURL(){return this.Data.WSURL}get RefreshTokenFunction(){return this.Data.RefreshFunction}constructor(e,a,s,t,r,c,n){super({Token:e,URL:a,WSURL:s,RefreshTokenFunction:t},r,c,n)}};E(G,"GraphQLProviderConfigData");let C=G;const R=class R extends O{constructor(){super(),this._innerCurrentUserQueryString=`CurrentUser {
|
|
2
2
|
${this.userInfoString()}
|
|
3
3
|
UserRoles_UserIDArray {
|
|
4
4
|
${this.userRoleInfoString()}
|
|
@@ -6,7 +6,7 @@ var B=Object.defineProperty;var E=(V,e)=>B(V,"name",{value:e,configurable:!0});i
|
|
|
6
6
|
}
|
|
7
7
|
`,this._currentUserQuery=w`query CurrentUserAndRoles {
|
|
8
8
|
${this._innerCurrentUserQueryString}
|
|
9
|
-
}`,this._wsClient=null,this._pushStatusRequests=[],R._instance||(R._instance=this)}static get Instance(){return R._instance}get ConfigData(){return this._configData}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}GenerateUUID(){return Z()}get LocalStoragePrefix(){return this._configData.URL.replace(/[^a-zA-Z0-9]/g,"_")+"."}async Config(e,a){try{const s=this.GenerateUUID();return a?(this._sessionId=s,this._configData=e,this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId)):(R.Instance._sessionId===void 0&&(R.Instance._sessionId=s),R.Instance._configData=e,R.Instance._client||(R.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,R.Instance._sessionId))),super.Config(e)}catch(s){throw h(s),s}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const a=this.ConvertBackToMJFields(e.CurrentUser),s=a.UserRoles_UserIDArray.map(t=>this.ConvertBackToMJFields(t));return a.UserRoles_UserIDArray=s,new U(this,{...a,UserRoles:s})}}async RunReport(e,a){const s=w`
|
|
9
|
+
}`,this._wsClient=null,this._pushStatusRequests=[],R._instance||(R._instance=this)}static get Instance(){return R._instance}get ConfigData(){return this._configData}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return Z()}get LocalStoragePrefix(){return this._configData.URL.replace(/[^a-zA-Z0-9]/g,"_")+"."}async Config(e,a){try{const s=this.GenerateUUID();return a?(this._sessionId=s,this._configData=e,this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId)):(R.Instance._sessionId===void 0&&(R.Instance._sessionId=s),R.Instance._configData=e,R.Instance._client||(R.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,R.Instance._sessionId))),super.Config(e)}catch(s){throw h(s),s}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const a=this.ConvertBackToMJFields(e.CurrentUser),s=a.UserRoles_UserIDArray.map(t=>this.ConvertBackToMJFields(t));return a.UserRoles_UserIDArray=s,new U(this,{...a,UserRoles:s})}}async RunReport(e,a){const s=w`
|
|
10
10
|
query GetReportDataQuery ($ReportID: String!) {
|
|
11
11
|
GetReportData(ReportID: $ReportID) {
|
|
12
12
|
Success
|