@memberjunction/graphql-dataprovider 2.121.0 → 2.122.1
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 +56 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -16
- package/dist/index.d.mts +119 -16
- package/dist/index.mjs +53 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1656,12 +1656,16 @@ interface QueryField {
|
|
|
1656
1656
|
QueryID: string;
|
|
1657
1657
|
Name: string;
|
|
1658
1658
|
Description?: string;
|
|
1659
|
-
Type?: string;
|
|
1660
1659
|
Sequence: number;
|
|
1661
1660
|
SQLBaseType?: string;
|
|
1662
1661
|
SQLFullType?: string;
|
|
1662
|
+
SourceEntityID?: string;
|
|
1663
|
+
SourceEntity?: string;
|
|
1664
|
+
SourceFieldName?: string;
|
|
1663
1665
|
IsComputed: boolean;
|
|
1664
1666
|
ComputationDescription?: string;
|
|
1667
|
+
IsSummary?: boolean;
|
|
1668
|
+
SummaryDescription?: string;
|
|
1665
1669
|
}
|
|
1666
1670
|
/**
|
|
1667
1671
|
* Type for query parameter information
|
|
@@ -1670,10 +1674,12 @@ interface QueryParameter {
|
|
|
1670
1674
|
ID: string;
|
|
1671
1675
|
QueryID: string;
|
|
1672
1676
|
Name: string;
|
|
1677
|
+
Description?: string;
|
|
1673
1678
|
Type: string;
|
|
1674
|
-
DefaultValue?: string;
|
|
1675
|
-
Comments?: string;
|
|
1676
1679
|
IsRequired: boolean;
|
|
1680
|
+
DefaultValue?: string;
|
|
1681
|
+
SampleValue?: string;
|
|
1682
|
+
ValidationFilters?: string;
|
|
1677
1683
|
}
|
|
1678
1684
|
/**
|
|
1679
1685
|
* Type for query entity information
|
|
@@ -1682,8 +1688,7 @@ interface QueryEntity {
|
|
|
1682
1688
|
ID: string;
|
|
1683
1689
|
QueryID: string;
|
|
1684
1690
|
EntityID: string;
|
|
1685
|
-
|
|
1686
|
-
Sequence: number;
|
|
1691
|
+
Entity?: string;
|
|
1687
1692
|
}
|
|
1688
1693
|
/**
|
|
1689
1694
|
* Type for query permission information
|
|
@@ -1692,7 +1697,7 @@ interface QueryPermission {
|
|
|
1692
1697
|
ID: string;
|
|
1693
1698
|
QueryID: string;
|
|
1694
1699
|
RoleID: string;
|
|
1695
|
-
|
|
1700
|
+
Role?: string;
|
|
1696
1701
|
}
|
|
1697
1702
|
/**
|
|
1698
1703
|
* Result type for CreateQuery mutation calls - contains creation success status and query data
|
|
@@ -1707,9 +1712,49 @@ interface CreateQueryResult {
|
|
|
1707
1712
|
*/
|
|
1708
1713
|
ErrorMessage?: string;
|
|
1709
1714
|
/**
|
|
1710
|
-
*
|
|
1715
|
+
* Unique identifier of the created query (optional)
|
|
1716
|
+
*/
|
|
1717
|
+
ID?: string;
|
|
1718
|
+
/**
|
|
1719
|
+
* Display name of the created query (optional)
|
|
1720
|
+
*/
|
|
1721
|
+
Name?: string;
|
|
1722
|
+
/**
|
|
1723
|
+
* Description of the created query (optional)
|
|
1724
|
+
*/
|
|
1725
|
+
Description?: string;
|
|
1726
|
+
/**
|
|
1727
|
+
* Category ID the query belongs to (optional)
|
|
1728
|
+
*/
|
|
1729
|
+
CategoryID?: string;
|
|
1730
|
+
/**
|
|
1731
|
+
* Category name the query belongs to (optional)
|
|
1732
|
+
*/
|
|
1733
|
+
Category?: string;
|
|
1734
|
+
/**
|
|
1735
|
+
* SQL query text (optional)
|
|
1736
|
+
*/
|
|
1737
|
+
SQL?: string;
|
|
1738
|
+
/**
|
|
1739
|
+
* Query status: Pending, Approved, Rejected, or Expired (optional)
|
|
1740
|
+
*/
|
|
1741
|
+
Status?: string;
|
|
1742
|
+
/**
|
|
1743
|
+
* Quality rank indicator (optional)
|
|
1744
|
+
*/
|
|
1745
|
+
QualityRank?: number;
|
|
1746
|
+
/**
|
|
1747
|
+
* Embedding vector for semantic search (optional)
|
|
1748
|
+
*/
|
|
1749
|
+
EmbeddingVector?: string;
|
|
1750
|
+
/**
|
|
1751
|
+
* ID of the embedding model used (optional)
|
|
1752
|
+
*/
|
|
1753
|
+
EmbeddingModelID?: string;
|
|
1754
|
+
/**
|
|
1755
|
+
* Name of the embedding model used (optional)
|
|
1711
1756
|
*/
|
|
1712
|
-
|
|
1757
|
+
EmbeddingModelName?: string;
|
|
1713
1758
|
/**
|
|
1714
1759
|
* Array of fields discovered in the query (optional)
|
|
1715
1760
|
*/
|
|
@@ -1805,9 +1850,49 @@ interface UpdateQueryResult {
|
|
|
1805
1850
|
*/
|
|
1806
1851
|
ErrorMessage?: string;
|
|
1807
1852
|
/**
|
|
1808
|
-
*
|
|
1853
|
+
* Unique identifier of the updated query (optional)
|
|
1854
|
+
*/
|
|
1855
|
+
ID?: string;
|
|
1856
|
+
/**
|
|
1857
|
+
* Display name of the updated query (optional)
|
|
1858
|
+
*/
|
|
1859
|
+
Name?: string;
|
|
1860
|
+
/**
|
|
1861
|
+
* Description of the updated query (optional)
|
|
1862
|
+
*/
|
|
1863
|
+
Description?: string;
|
|
1864
|
+
/**
|
|
1865
|
+
* Category ID the query belongs to (optional)
|
|
1866
|
+
*/
|
|
1867
|
+
CategoryID?: string;
|
|
1868
|
+
/**
|
|
1869
|
+
* Category name the query belongs to (optional)
|
|
1870
|
+
*/
|
|
1871
|
+
Category?: string;
|
|
1872
|
+
/**
|
|
1873
|
+
* SQL query text (optional)
|
|
1874
|
+
*/
|
|
1875
|
+
SQL?: string;
|
|
1876
|
+
/**
|
|
1877
|
+
* Query status: Pending, Approved, Rejected, or Expired (optional)
|
|
1878
|
+
*/
|
|
1879
|
+
Status?: string;
|
|
1880
|
+
/**
|
|
1881
|
+
* Quality rank indicator (optional)
|
|
1882
|
+
*/
|
|
1883
|
+
QualityRank?: number;
|
|
1884
|
+
/**
|
|
1885
|
+
* Embedding vector for semantic search (optional)
|
|
1886
|
+
*/
|
|
1887
|
+
EmbeddingVector?: string;
|
|
1888
|
+
/**
|
|
1889
|
+
* ID of the embedding model used (optional)
|
|
1809
1890
|
*/
|
|
1810
|
-
|
|
1891
|
+
EmbeddingModelID?: string;
|
|
1892
|
+
/**
|
|
1893
|
+
* Name of the embedding model used (optional)
|
|
1894
|
+
*/
|
|
1895
|
+
EmbeddingModelName?: string;
|
|
1811
1896
|
/**
|
|
1812
1897
|
* Array of fields discovered in the query (optional)
|
|
1813
1898
|
*/
|
|
@@ -1851,9 +1936,13 @@ interface DeleteQueryResult {
|
|
|
1851
1936
|
*/
|
|
1852
1937
|
ErrorMessage?: string;
|
|
1853
1938
|
/**
|
|
1854
|
-
*
|
|
1939
|
+
* Unique identifier of the deleted query (optional)
|
|
1940
|
+
*/
|
|
1941
|
+
ID?: string;
|
|
1942
|
+
/**
|
|
1943
|
+
* Display name of the deleted query (optional)
|
|
1855
1944
|
*/
|
|
1856
|
-
|
|
1945
|
+
Name?: string;
|
|
1857
1946
|
}
|
|
1858
1947
|
|
|
1859
1948
|
/**
|
|
@@ -2259,21 +2348,35 @@ type ComponentQueryParameterValue = {
|
|
|
2259
2348
|
* Name of the parameter
|
|
2260
2349
|
*/
|
|
2261
2350
|
name: string;
|
|
2351
|
+
/**
|
|
2352
|
+
* Whether this parameter must be provided when executing the query.
|
|
2353
|
+
*/
|
|
2354
|
+
isRequired: boolean;
|
|
2262
2355
|
/**
|
|
2263
2356
|
* Value of the parameter. If the value is '@runtime', it indicates that the component will determine the value at runtime.
|
|
2264
2357
|
* If anything other than '@runtime' is specified, it is a hardcoded value that the component will use.
|
|
2265
2358
|
*/
|
|
2266
|
-
value
|
|
2359
|
+
value?: string;
|
|
2267
2360
|
/**
|
|
2268
2361
|
* When specifying '@runtime' for the value, populate this field with a value that can be used to test the query to validate it runs. It doesn't need
|
|
2269
2362
|
* to be a value that is valid in the sense of being in the database, but is of the right type. For example if the
|
|
2270
2363
|
* parameter is a number, date or string, include a test value of that type. **Note** if the parameter is for a UNIQUEIDENTIFIER column
|
|
2271
2364
|
* type make sure to use a valid UUID format otherwise the query will FAIL.
|
|
2272
2365
|
*/
|
|
2273
|
-
testValue
|
|
2366
|
+
testValue?: string;
|
|
2367
|
+
/**
|
|
2368
|
+
* Data type of the parameter (e.g., 'string', 'int', 'uniqueidentifier', 'datetime', 'decimal').
|
|
2369
|
+
* This helps the component generator understand how to properly format and pass the parameter value.
|
|
2370
|
+
*/
|
|
2371
|
+
type?: string;
|
|
2372
|
+
/**
|
|
2373
|
+
* Example value demonstrating the proper format for this parameter.
|
|
2374
|
+
* Preferred over testValue for component generation as it aligns with SkipQueryParamInfo.SampleValue naming.
|
|
2375
|
+
*/
|
|
2376
|
+
sampleValue?: string;
|
|
2274
2377
|
/**
|
|
2275
|
-
* Description of the parameter and how it is used in the query. This is
|
|
2276
|
-
* the
|
|
2378
|
+
* Description of the parameter and how it is used in the query. This is important for helping
|
|
2379
|
+
* the component developer understand what the parameter is for and how to determine its value.
|
|
2277
2380
|
*/
|
|
2278
2381
|
description?: string;
|
|
2279
2382
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1656,12 +1656,16 @@ interface QueryField {
|
|
|
1656
1656
|
QueryID: string;
|
|
1657
1657
|
Name: string;
|
|
1658
1658
|
Description?: string;
|
|
1659
|
-
Type?: string;
|
|
1660
1659
|
Sequence: number;
|
|
1661
1660
|
SQLBaseType?: string;
|
|
1662
1661
|
SQLFullType?: string;
|
|
1662
|
+
SourceEntityID?: string;
|
|
1663
|
+
SourceEntity?: string;
|
|
1664
|
+
SourceFieldName?: string;
|
|
1663
1665
|
IsComputed: boolean;
|
|
1664
1666
|
ComputationDescription?: string;
|
|
1667
|
+
IsSummary?: boolean;
|
|
1668
|
+
SummaryDescription?: string;
|
|
1665
1669
|
}
|
|
1666
1670
|
/**
|
|
1667
1671
|
* Type for query parameter information
|
|
@@ -1670,10 +1674,12 @@ interface QueryParameter {
|
|
|
1670
1674
|
ID: string;
|
|
1671
1675
|
QueryID: string;
|
|
1672
1676
|
Name: string;
|
|
1677
|
+
Description?: string;
|
|
1673
1678
|
Type: string;
|
|
1674
|
-
DefaultValue?: string;
|
|
1675
|
-
Comments?: string;
|
|
1676
1679
|
IsRequired: boolean;
|
|
1680
|
+
DefaultValue?: string;
|
|
1681
|
+
SampleValue?: string;
|
|
1682
|
+
ValidationFilters?: string;
|
|
1677
1683
|
}
|
|
1678
1684
|
/**
|
|
1679
1685
|
* Type for query entity information
|
|
@@ -1682,8 +1688,7 @@ interface QueryEntity {
|
|
|
1682
1688
|
ID: string;
|
|
1683
1689
|
QueryID: string;
|
|
1684
1690
|
EntityID: string;
|
|
1685
|
-
|
|
1686
|
-
Sequence: number;
|
|
1691
|
+
Entity?: string;
|
|
1687
1692
|
}
|
|
1688
1693
|
/**
|
|
1689
1694
|
* Type for query permission information
|
|
@@ -1692,7 +1697,7 @@ interface QueryPermission {
|
|
|
1692
1697
|
ID: string;
|
|
1693
1698
|
QueryID: string;
|
|
1694
1699
|
RoleID: string;
|
|
1695
|
-
|
|
1700
|
+
Role?: string;
|
|
1696
1701
|
}
|
|
1697
1702
|
/**
|
|
1698
1703
|
* Result type for CreateQuery mutation calls - contains creation success status and query data
|
|
@@ -1707,9 +1712,49 @@ interface CreateQueryResult {
|
|
|
1707
1712
|
*/
|
|
1708
1713
|
ErrorMessage?: string;
|
|
1709
1714
|
/**
|
|
1710
|
-
*
|
|
1715
|
+
* Unique identifier of the created query (optional)
|
|
1716
|
+
*/
|
|
1717
|
+
ID?: string;
|
|
1718
|
+
/**
|
|
1719
|
+
* Display name of the created query (optional)
|
|
1720
|
+
*/
|
|
1721
|
+
Name?: string;
|
|
1722
|
+
/**
|
|
1723
|
+
* Description of the created query (optional)
|
|
1724
|
+
*/
|
|
1725
|
+
Description?: string;
|
|
1726
|
+
/**
|
|
1727
|
+
* Category ID the query belongs to (optional)
|
|
1728
|
+
*/
|
|
1729
|
+
CategoryID?: string;
|
|
1730
|
+
/**
|
|
1731
|
+
* Category name the query belongs to (optional)
|
|
1732
|
+
*/
|
|
1733
|
+
Category?: string;
|
|
1734
|
+
/**
|
|
1735
|
+
* SQL query text (optional)
|
|
1736
|
+
*/
|
|
1737
|
+
SQL?: string;
|
|
1738
|
+
/**
|
|
1739
|
+
* Query status: Pending, Approved, Rejected, or Expired (optional)
|
|
1740
|
+
*/
|
|
1741
|
+
Status?: string;
|
|
1742
|
+
/**
|
|
1743
|
+
* Quality rank indicator (optional)
|
|
1744
|
+
*/
|
|
1745
|
+
QualityRank?: number;
|
|
1746
|
+
/**
|
|
1747
|
+
* Embedding vector for semantic search (optional)
|
|
1748
|
+
*/
|
|
1749
|
+
EmbeddingVector?: string;
|
|
1750
|
+
/**
|
|
1751
|
+
* ID of the embedding model used (optional)
|
|
1752
|
+
*/
|
|
1753
|
+
EmbeddingModelID?: string;
|
|
1754
|
+
/**
|
|
1755
|
+
* Name of the embedding model used (optional)
|
|
1711
1756
|
*/
|
|
1712
|
-
|
|
1757
|
+
EmbeddingModelName?: string;
|
|
1713
1758
|
/**
|
|
1714
1759
|
* Array of fields discovered in the query (optional)
|
|
1715
1760
|
*/
|
|
@@ -1805,9 +1850,49 @@ interface UpdateQueryResult {
|
|
|
1805
1850
|
*/
|
|
1806
1851
|
ErrorMessage?: string;
|
|
1807
1852
|
/**
|
|
1808
|
-
*
|
|
1853
|
+
* Unique identifier of the updated query (optional)
|
|
1854
|
+
*/
|
|
1855
|
+
ID?: string;
|
|
1856
|
+
/**
|
|
1857
|
+
* Display name of the updated query (optional)
|
|
1858
|
+
*/
|
|
1859
|
+
Name?: string;
|
|
1860
|
+
/**
|
|
1861
|
+
* Description of the updated query (optional)
|
|
1862
|
+
*/
|
|
1863
|
+
Description?: string;
|
|
1864
|
+
/**
|
|
1865
|
+
* Category ID the query belongs to (optional)
|
|
1866
|
+
*/
|
|
1867
|
+
CategoryID?: string;
|
|
1868
|
+
/**
|
|
1869
|
+
* Category name the query belongs to (optional)
|
|
1870
|
+
*/
|
|
1871
|
+
Category?: string;
|
|
1872
|
+
/**
|
|
1873
|
+
* SQL query text (optional)
|
|
1874
|
+
*/
|
|
1875
|
+
SQL?: string;
|
|
1876
|
+
/**
|
|
1877
|
+
* Query status: Pending, Approved, Rejected, or Expired (optional)
|
|
1878
|
+
*/
|
|
1879
|
+
Status?: string;
|
|
1880
|
+
/**
|
|
1881
|
+
* Quality rank indicator (optional)
|
|
1882
|
+
*/
|
|
1883
|
+
QualityRank?: number;
|
|
1884
|
+
/**
|
|
1885
|
+
* Embedding vector for semantic search (optional)
|
|
1886
|
+
*/
|
|
1887
|
+
EmbeddingVector?: string;
|
|
1888
|
+
/**
|
|
1889
|
+
* ID of the embedding model used (optional)
|
|
1809
1890
|
*/
|
|
1810
|
-
|
|
1891
|
+
EmbeddingModelID?: string;
|
|
1892
|
+
/**
|
|
1893
|
+
* Name of the embedding model used (optional)
|
|
1894
|
+
*/
|
|
1895
|
+
EmbeddingModelName?: string;
|
|
1811
1896
|
/**
|
|
1812
1897
|
* Array of fields discovered in the query (optional)
|
|
1813
1898
|
*/
|
|
@@ -1851,9 +1936,13 @@ interface DeleteQueryResult {
|
|
|
1851
1936
|
*/
|
|
1852
1937
|
ErrorMessage?: string;
|
|
1853
1938
|
/**
|
|
1854
|
-
*
|
|
1939
|
+
* Unique identifier of the deleted query (optional)
|
|
1940
|
+
*/
|
|
1941
|
+
ID?: string;
|
|
1942
|
+
/**
|
|
1943
|
+
* Display name of the deleted query (optional)
|
|
1855
1944
|
*/
|
|
1856
|
-
|
|
1945
|
+
Name?: string;
|
|
1857
1946
|
}
|
|
1858
1947
|
|
|
1859
1948
|
/**
|
|
@@ -2259,21 +2348,35 @@ type ComponentQueryParameterValue = {
|
|
|
2259
2348
|
* Name of the parameter
|
|
2260
2349
|
*/
|
|
2261
2350
|
name: string;
|
|
2351
|
+
/**
|
|
2352
|
+
* Whether this parameter must be provided when executing the query.
|
|
2353
|
+
*/
|
|
2354
|
+
isRequired: boolean;
|
|
2262
2355
|
/**
|
|
2263
2356
|
* Value of the parameter. If the value is '@runtime', it indicates that the component will determine the value at runtime.
|
|
2264
2357
|
* If anything other than '@runtime' is specified, it is a hardcoded value that the component will use.
|
|
2265
2358
|
*/
|
|
2266
|
-
value
|
|
2359
|
+
value?: string;
|
|
2267
2360
|
/**
|
|
2268
2361
|
* When specifying '@runtime' for the value, populate this field with a value that can be used to test the query to validate it runs. It doesn't need
|
|
2269
2362
|
* to be a value that is valid in the sense of being in the database, but is of the right type. For example if the
|
|
2270
2363
|
* parameter is a number, date or string, include a test value of that type. **Note** if the parameter is for a UNIQUEIDENTIFIER column
|
|
2271
2364
|
* type make sure to use a valid UUID format otherwise the query will FAIL.
|
|
2272
2365
|
*/
|
|
2273
|
-
testValue
|
|
2366
|
+
testValue?: string;
|
|
2367
|
+
/**
|
|
2368
|
+
* Data type of the parameter (e.g., 'string', 'int', 'uniqueidentifier', 'datetime', 'decimal').
|
|
2369
|
+
* This helps the component generator understand how to properly format and pass the parameter value.
|
|
2370
|
+
*/
|
|
2371
|
+
type?: string;
|
|
2372
|
+
/**
|
|
2373
|
+
* Example value demonstrating the proper format for this parameter.
|
|
2374
|
+
* Preferred over testValue for component generation as it aligns with SkipQueryParamInfo.SampleValue naming.
|
|
2375
|
+
*/
|
|
2376
|
+
sampleValue?: string;
|
|
2274
2377
|
/**
|
|
2275
|
-
* Description of the parameter and how it is used in the query. This is
|
|
2276
|
-
* the
|
|
2378
|
+
* Description of the parameter and how it is used in the query. This is important for helping
|
|
2379
|
+
* the component developer understand what the parameter is for and how to determine its value.
|
|
2277
2380
|
*/
|
|
2278
2381
|
description?: string;
|
|
2279
2382
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var $e=Object.defineProperty;var S=(D,e)=>$e(D,"name",{value:e,configurable:!0});var R;import{gql as m,GraphQLClient as Se}from"graphql-request";import{gql as Ye}from"graphql-request";import{TransactionGroupBase as Pe,TransactionResult as ve,LogError as l,LogStatusEx as N,ProviderConfigDataBase as Ne,ProviderBase as Ce,UserInfo as he,ProviderType as be,BaseEntityResult as fe,EntityFieldTSType as E,TransactionItem as Re,UserRoleInfo as Te,SetProvider as Ve,IsVerboseLoggingEnabled as xe}from"@memberjunction/core";import{ViewInfo as Ie}from"@memberjunction/core-entities";import{openDB as
|
|
1
|
+
var $e=Object.defineProperty;var S=(D,e)=>$e(D,"name",{value:e,configurable:!0});var R;import{gql as m,GraphQLClient as Se}from"graphql-request";import{gql as Ye}from"graphql-request";import{TransactionGroupBase as Pe,TransactionResult as ve,LogError as l,LogStatusEx as N,ProviderConfigDataBase as Ne,ProviderBase as Ce,UserInfo as he,ProviderType as be,BaseEntityResult as fe,EntityFieldTSType as E,TransactionItem as Re,UserRoleInfo as Te,SetProvider as Ve,IsVerboseLoggingEnabled as xe}from"@memberjunction/core";import{ViewInfo as Ie}from"@memberjunction/core-entities";import{openDB as Me}from"@tempfix/idb";import{Observable as C,Subject as Ge,Subscription as Ae}from"rxjs";import{createClient as Fe}from"graphql-ws";import{v4 as Qe}from"uuid";import{SafeJSONParse as $,MJGlobal as Le,MJEventType as Ue}from"@memberjunction/global";const z=class z{constructor(){this._fieldMap={__mj_CreatedAt:"_mj__CreatedAt",__mj_UpdatedAt:"_mj__UpdatedAt",__mj_DeletedAt:"_mj__DeletedAt"}}MapFields(e){if(e)for(const t in e)t in this._fieldMap&&(e[this._fieldMap[t]]=e[t],delete e[t]);return e}MapFieldName(e){return this._fieldMap[e]??e}ReverseMapFieldName(e){return Object.entries(this._fieldMap).find(([t,r])=>r===e)?.[0]??e}ReverseMapFields(e){const t=Object.fromEntries(Object.entries(this._fieldMap).map(([r,s])=>[s,r]));for(const r in e)r in t&&(e[t[r]]=e[r],delete e[r]);return e}};S(z,"FieldMapper");let v=z;const H=class H extends Pe{constructor(e){super(),this._provider=e}async HandleSubmit(){const e=m`
|
|
2
2
|
mutation ExecuteTransactionGroup($group: TransactionInputType!) {
|
|
3
3
|
ExecuteTransactionGroup(group: $group) {
|
|
4
4
|
Success
|
|
@@ -150,7 +150,7 @@ var $e=Object.defineProperty;var S=(D,e)=>$e(D,"name",{value:e,configurable:!0})
|
|
|
150
150
|
}
|
|
151
151
|
`,this._currentUserQuery=m`query CurrentUserAndRoles {
|
|
152
152
|
${this._innerCurrentUserQueryString}
|
|
153
|
-
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=30*60*1e3,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=5*60*1e3,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=10*60*1e3,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,R._instance||(R._instance=this)}static get Instance(){return R._instance}get ConfigData(){return this._configData}sanitizeGraphQLName(e){if(!e||e.length===0)return"";let t=e.replace(/[^A-Za-z0-9_]/g,"");return t.startsWith("__")&&(t=t.substring(2)),t=t.replace(/_/g,""),t.length===0||/^[0-9]/.test(t)?"_"+t:t}getGraphQLTypeNameBase(e){const t=e.SchemaName.trim().toLowerCase()===R.MJ_CORE_SCHEMA.trim().toLowerCase()?"MJ":this.sanitizeGraphQLName(e.SchemaName),r=this.sanitizeGraphQLName(e.BaseTable);return`${t}${r}`}get AI(){return this._aiClient||(this._aiClient=new T(this)),this._aiClient}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return
|
|
153
|
+
}`,this._wsClient=null,this._wsClientCreatedAt=null,this._pushStatusSubjects=new Map,this._activeSubscriptionCount=0,this.WS_CLIENT_MAX_AGE_MS=30*60*1e3,this.SUBSCRIPTION_CLEANUP_INTERVAL_MS=5*60*1e3,this.SUBSCRIPTION_IDLE_TIMEOUT_MS=10*60*1e3,this._subscriptionCleanupTimer=null,this._isCleaningUp=!1,R._instance||(R._instance=this)}static get Instance(){return R._instance}get ConfigData(){return this._configData}sanitizeGraphQLName(e){if(!e||e.length===0)return"";let t=e.replace(/[^A-Za-z0-9_]/g,"");return t.startsWith("__")&&(t=t.substring(2)),t=t.replace(/_/g,""),t.length===0||/^[0-9]/.test(t)?"_"+t:t}getGraphQLTypeNameBase(e){const t=e.SchemaName.trim().toLowerCase()===R.MJ_CORE_SCHEMA.trim().toLowerCase()?"MJ":this.sanitizeGraphQLName(e.SchemaName),r=this.sanitizeGraphQLName(e.BaseTable);return`${t}${r}`}get AI(){return this._aiClient||(this._aiClient=new T(this)),this._aiClient}get DatabaseConnection(){throw new Error("DatabaseConnection not implemented for the GraphQLDataProvider")}get InstanceConnectionString(){return this._configData.URL}GenerateUUID(){return Qe()}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 r?(this._configData=e,this._sessionId=await this.GetPreferredUUID(s),this._client=this.CreateNewGraphQLClient(e.URL,e.Token,this._sessionId,e.MJAPIKey),await this.SaveStoredSessionID(this._sessionId)):(R.Instance._configData=e,R.Instance._sessionId===void 0&&(R.Instance._sessionId=await this.GetPreferredUUID(s)),R.Instance._client||(R.Instance._client=this.CreateNewGraphQLClient(e.URL,e.Token,R.Instance._sessionId,e.MJAPIKey)),await R.Instance.SaveStoredSessionID(R.Instance._sessionId)),super.Config(e)}catch(n){throw l(n),n}}get sessionId(){return this._sessionId}get AllowRefresh(){return!0}async GetCurrentUser(){const e=await this.ExecuteGQL(this._currentUserQuery,null);if(e){const t=this.ConvertBackToMJFields(e.CurrentUser),r=t.UserRoles_UserIDArray.map(s=>this.ConvertBackToMJFields(s));return t.UserRoles_UserIDArray=r,new he(this,{...t,UserRoles:r})}}async RunReport(e,t){const r=m`
|
|
154
154
|
query GetReportDataQuery ($ReportID: String!) {
|
|
155
155
|
GetReportData(ReportID: $ReportID) {
|
|
156
156
|
Success
|
|
@@ -348,14 +348,14 @@ var $e=Object.defineProperty;var S=(D,e)=>$e(D,"name",{value:e,configurable:!0})
|
|
|
348
348
|
}
|
|
349
349
|
}`,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 l(t),t}}static async ExecuteGQL(e,t,r=!0){return R.Instance.ExecuteGQL(e,t,r)}async ExecuteGQL(e,t,r=!0){try{return await this._client.request(e,t)}catch(s){if(s&&s.response&&s.response.errors?.length>0)if(s.response.errors[0]?.extensions?.code?.toUpperCase().trim()==="JWT_EXPIRED"){if(r)return await this.RefreshToken(),await this.ExecuteGQL(e,t,!1);throw l("JWT_EXPIRED and refreshTokenIfNeeded is false"),s}else throw s;else throw l(s),s}}async RefreshToken(){if(this._configData.Data.RefreshTokenFunction){const e=await this._configData.Data.RefreshTokenFunction();if(e)this._configData.Token=e,this._client=this.CreateNewGraphQLClient(this._configData.URL,this._configData.Token,this._sessionId,this._configData.MJAPIKey);else throw new Error("Refresh token function returned null or undefined token")}else throw new Error("No refresh token function provided")}static async RefreshToken(){return R.Instance.RefreshToken()}CreateNewGraphQLClient(e,t,r,s){const n={"x-session-id":r};return t&&(n.authorization="Bearer "+t),s&&(n["x-mj-api-key"]=s),new Se(e,{headers:n})}userInfoString(){return this.infoString(new he(null,null))}userRoleInfoString(){return this.infoString(new Te(null))}infoString(e){let t="";const r=Object.keys(e);for(const s of r)s.startsWith("__mj_")?t+=s.replace("__mj_","_mj__")+`
|
|
350
350
|
`:s.startsWith("_")||(t+=s+`
|
|
351
|
-
`);return t}get LocalStorageProvider(){return this._localStorageProvider||(this._localStorageProvider=new
|
|
351
|
+
`);return t}get LocalStorageProvider(){return this._localStorageProvider||(this._localStorageProvider=new M),this._localStorageProvider}get Metadata(){return this}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._wsClient=Fe({url:this.ConfigData.WSURL,connectionParams:{Authorization:"Bearer "+this.ConfigData.Token},keepAlive:3e4,retryAttempts:3,shouldRetry:()=>!0}),this._wsClientCreatedAt=e,this._subscriptionCleanupTimer||(this._subscriptionCleanupTimer=setInterval(()=>{this.cleanupStaleSubscriptions()},this.SUBSCRIPTION_CLEANUP_INTERVAL_MS))),this._wsClient}disposeWSClient(){if(this._wsClient){try{this._wsClient.dispose()}catch(e){console.error("[GraphQLDataProvider] Error disposing WebSocket client:",e)}this._wsClient=null,this._wsClientCreatedAt=null}}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 o=e-a.lastRequestedAt,i=e-a.lastEmissionAt;a.activeSubscribers===0&&o>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&i>=this.SUBSCRIPTION_IDLE_TIMEOUT_MS&&(console.log(`[GraphQLDataProvider] Marking session ${n} for cleanup: activeSubscribers=${a.activeSubscribers}, timeSinceRequested=${Math.round(o/1e3)}s, timeSinceEmission=${Math.round(i/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(o){console.error(`[GraphQLDataProvider] Error cleaning up subscription for ${n}:`,o)}}),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 C(r=>{const s=this.getOrCreateWSClient();this._activeSubscriptionCount++;const n=s.subscribe({query:e,variables:t},{next:a=>{r.next(a.data)},error:a=>{r.error(a)},complete:()=>{r.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 C(i=>{r.activeSubscribers++;const u=r.subject.subscribe(i);return()=>{const g=this._pushStatusSubjects.get(e);g&&g.activeSubscribers>0&&g.activeSubscribers--,u.unsubscribe()}});const s=m`subscription StatusUpdates($sessionId: String!) {
|
|
352
352
|
statusUpdates(sessionId: $sessionId) {
|
|
353
353
|
date
|
|
354
354
|
message
|
|
355
355
|
sessionId
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
`,n=new Ge,a=this.getOrCreateWSClient(),o=new
|
|
358
|
+
`,n=new Ge,a=this.getOrCreateWSClient(),o=new Ae;return o.add(new C(i=>{const u=a.subscribe({query:s,variables:{sessionId:e}},{next:g=>{const p=this._pushStatusSubjects.get(e);p&&(p.lastEmissionAt=Date.now()),i.next(g.data.statusUpdates.message)},error:g=>{i.error(g)},complete:()=>{i.complete()}});return this._activeSubscriptionCount++,()=>{this._activeSubscriptionCount--,u()}}).subscribe({next:i=>n.next(i),error:i=>{n.error(i),this._pushStatusSubjects.delete(e)},complete:()=>{n.complete(),this._pushStatusSubjects.delete(e)}})),this._pushStatusSubjects.set(e,{subject:n,subscription:o,createdAt:t,lastRequestedAt:t,lastEmissionAt:t,activeSubscribers:0}),new C(i=>{const u=this._pushStatusSubjects.get(e);u&&u.activeSubscribers++;const g=n.subscribe(i);return()=>{const p=this._pushStatusSubjects.get(e);p&&p.activeSubscribers>0&&p.activeSubscribers--,g.unsubscribe()}})}disposeWebSocketResources(){this._subscriptionCleanupTimer&&(clearInterval(this._subscriptionCleanupTimer),this._subscriptionCleanupTimer=null),this.completeAllSubjects(),this._activeSubscriptionCount=0,this.disposeWSClient()}},S(R,"_GraphQLDataProvider"),R);De.MJ_CORE_SCHEMA="__mj";let we=De;const Y=class Y{constructor(){this._localStorage={}}async GetItem(e){return new Promise(t=>{this._localStorage.hasOwnProperty(e)?t(this._localStorage[e]):t(null)})}async SetItem(e,t){return new Promise(r=>{this._localStorage[e]=t,r()})}async Remove(e){return new Promise(t=>{this._localStorage.hasOwnProperty(e)&&delete this._localStorage[e],t()})}};S(Y,"BrowserStorageProviderBase");let x=Y;const _e="MJ_Metadata",P="Metadata_KVPairs",ee=class ee extends x{constructor(){super(),this.dbPromise=Me(_e,1,{upgrade(e){e.objectStoreNames.contains(P)||e.createObjectStore(P)}})}async setItem(e,t){const s=(await this.dbPromise).transaction(P,"readwrite");await s.objectStore(P).put(t,e),await s.done}async getItem(e){return await(await this.dbPromise).transaction(P).objectStore(P).get(e)}async remove(e){const r=(await this.dbPromise).transaction(P,"readwrite");await r.objectStore(P).delete(e),await r.done}};S(ee,"BrowserIndexedDBStorageProvider");let M=ee;async function qe(D){const e=new we;return Ve(e),await e.Config(D),Le.Instance.RaiseEvent({event:Ue.LoggedIn,eventCode:null,component:this,args:null}),e}S(qe,"setupGraphQLClient");const te=class te{};S(te,"SyncRolesAndUsersResult");let G=te;const re=class re{};S(re,"RoleInput");let A=re;const se=class se{};S(se,"UserInput");let F=se;const ne=class ne{};S(ne,"RolesAndUsersInput");let Q=ne;var Ee=(D=>(D.Create="Create",D.Update="Update",D.CreateOrUpdate="CreateOrUpdate",D.Delete="Delete",D.DeleteWithFilter="DeleteWithFilter",D))(Ee||{});const ae=class ae{};S(ae,"ActionItemInput");let L=ae;const ie=class ie{constructor(){this.Results=[]}};S(ie,"SyncDataResult");let U=ie;const oe=class oe{};S(oe,"ActionItemOutput");let _=oe;const ue=class ue{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 Se(e,{headers:n})}async GetData(e,t){try{const s=await this.Client.request(`query GetData($input: GetDataInputType!) {
|
|
359
359
|
GetData(input: $input) {
|
|
360
360
|
Success
|
|
361
361
|
ErrorMessages
|
|
@@ -509,86 +509,118 @@ var $e=Object.defineProperty;var S=(D,e)=>$e(D,"name",{value:e,configurable:!0})
|
|
|
509
509
|
CreateQuerySystemUser(input: $input) {
|
|
510
510
|
Success
|
|
511
511
|
ErrorMessage
|
|
512
|
-
|
|
512
|
+
ID
|
|
513
|
+
Name
|
|
514
|
+
Description
|
|
515
|
+
CategoryID
|
|
516
|
+
Category
|
|
517
|
+
SQL
|
|
518
|
+
Status
|
|
519
|
+
QualityRank
|
|
520
|
+
EmbeddingVector
|
|
521
|
+
EmbeddingModelID
|
|
522
|
+
EmbeddingModelName
|
|
513
523
|
Fields {
|
|
514
524
|
ID
|
|
515
525
|
QueryID
|
|
516
526
|
Name
|
|
517
527
|
Description
|
|
518
|
-
Type
|
|
519
528
|
Sequence
|
|
520
529
|
SQLBaseType
|
|
521
530
|
SQLFullType
|
|
531
|
+
SourceEntityID
|
|
532
|
+
SourceEntity
|
|
533
|
+
SourceFieldName
|
|
522
534
|
IsComputed
|
|
523
535
|
ComputationDescription
|
|
536
|
+
IsSummary
|
|
537
|
+
SummaryDescription
|
|
524
538
|
}
|
|
525
539
|
Parameters {
|
|
526
540
|
ID
|
|
527
541
|
QueryID
|
|
528
542
|
Name
|
|
543
|
+
Description
|
|
529
544
|
Type
|
|
530
|
-
DefaultValue
|
|
531
|
-
Comments
|
|
532
545
|
IsRequired
|
|
546
|
+
DefaultValue
|
|
547
|
+
SampleValue
|
|
548
|
+
ValidationFilters
|
|
533
549
|
}
|
|
534
550
|
Entities {
|
|
535
551
|
ID
|
|
536
552
|
QueryID
|
|
537
553
|
EntityID
|
|
538
|
-
|
|
554
|
+
Entity
|
|
539
555
|
}
|
|
540
556
|
Permissions {
|
|
541
557
|
ID
|
|
542
558
|
QueryID
|
|
543
559
|
RoleID
|
|
544
|
-
|
|
560
|
+
Role
|
|
545
561
|
}
|
|
546
562
|
}
|
|
547
|
-
}`,{input:e});return r&&r.CreateQuerySystemUser?r.CreateQuerySystemUser
|
|
563
|
+
}`,{input:e});return r&&r.CreateQuerySystemUser?r.CreateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to create query"}}catch(t){return l(`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!) {
|
|
548
564
|
UpdateQuerySystemUser(input: $input) {
|
|
549
565
|
Success
|
|
550
566
|
ErrorMessage
|
|
551
|
-
|
|
567
|
+
ID
|
|
568
|
+
Name
|
|
569
|
+
Description
|
|
570
|
+
CategoryID
|
|
571
|
+
Category
|
|
572
|
+
SQL
|
|
573
|
+
Status
|
|
574
|
+
QualityRank
|
|
575
|
+
EmbeddingVector
|
|
576
|
+
EmbeddingModelID
|
|
577
|
+
EmbeddingModelName
|
|
552
578
|
Fields {
|
|
553
579
|
ID
|
|
554
580
|
QueryID
|
|
555
581
|
Name
|
|
556
582
|
Description
|
|
557
|
-
Type
|
|
558
583
|
Sequence
|
|
559
584
|
SQLBaseType
|
|
560
585
|
SQLFullType
|
|
586
|
+
SourceEntityID
|
|
587
|
+
SourceEntity
|
|
588
|
+
SourceFieldName
|
|
561
589
|
IsComputed
|
|
562
590
|
ComputationDescription
|
|
591
|
+
IsSummary
|
|
592
|
+
SummaryDescription
|
|
563
593
|
}
|
|
564
594
|
Parameters {
|
|
565
595
|
ID
|
|
566
596
|
QueryID
|
|
567
597
|
Name
|
|
598
|
+
Description
|
|
568
599
|
Type
|
|
569
|
-
DefaultValue
|
|
570
|
-
Comments
|
|
571
600
|
IsRequired
|
|
601
|
+
DefaultValue
|
|
602
|
+
SampleValue
|
|
603
|
+
ValidationFilters
|
|
572
604
|
}
|
|
573
605
|
Entities {
|
|
574
606
|
ID
|
|
575
607
|
QueryID
|
|
576
608
|
EntityID
|
|
577
|
-
|
|
578
|
-
Sequence
|
|
609
|
+
Entity
|
|
579
610
|
}
|
|
580
611
|
Permissions {
|
|
581
612
|
ID
|
|
582
613
|
QueryID
|
|
583
614
|
RoleID
|
|
584
|
-
|
|
615
|
+
Role
|
|
585
616
|
}
|
|
586
617
|
}
|
|
587
|
-
}`,{input:e});return r&&r.UpdateQuerySystemUser?r.UpdateQuerySystemUser
|
|
618
|
+
}`,{input:e});return r&&r.UpdateQuerySystemUser?r.UpdateQuerySystemUser:{Success:!1,ErrorMessage:"Failed to update query"}}catch(t){return l(`GraphQLSystemUserClient::UpdateQuery - Error updating query - ${t}`),{Success:!1,ErrorMessage:t.toString()}}}async DeleteQuery(e,t){try{if(!e||e.trim()==="")return l("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) {
|
|
588
619
|
DeleteQuerySystemResolver(ID: $ID, options: $options) {
|
|
589
620
|
Success
|
|
590
621
|
ErrorMessage
|
|
591
|
-
|
|
622
|
+
ID
|
|
623
|
+
Name
|
|
592
624
|
}
|
|
593
625
|
}`,s={ID:e};t!==void 0&&(s.options=t);const n=await this.Client.request(r,s);return n&&n.DeleteQuerySystemResolver?n.DeleteQuerySystemResolver:{Success:!1,ErrorMessage:"Failed to delete query"}}catch(r){return l(`GraphQLSystemUserClient::DeleteQuery - Error deleting query - ${r}`),{Success:!1,ErrorMessage:r.toString()}}}async RunAIPrompt(e){try{const t=m`
|
|
594
626
|
query RunAIPromptSystemUser(
|
|
@@ -855,5 +887,5 @@ var $e=Object.defineProperty;var S=(D,e)=>$e(D,"name",{value:e,configurable:!0})
|
|
|
855
887
|
error
|
|
856
888
|
}
|
|
857
889
|
}
|
|
858
|
-
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return l(t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}};S(ge,"GraphQLComponentRegistryClient");let W=ge;export{
|
|
890
|
+
`,r=await this._dataProvider.ExecuteGQL(t,{feedback:e});return r&&r.SendComponentFeedback?r.SendComponentFeedback:{success:!1,error:"No response from server"}}catch(t){return l(t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}};S(ge,"GraphQLComponentRegistryClient");let W=ge;export{L as ActionItemInput,_ as ActionItemOutput,v as FieldMapper,O as GetDataOutput,T as GraphQLAIClient,J as GraphQLActionClient,W as GraphQLComponentRegistryClient,we as GraphQLDataProvider,V as GraphQLProviderConfigData,q as GraphQLSystemUserClient,j as GraphQLTestingClient,b as GraphQLTransactionGroup,A as RoleInput,Q as RolesAndUsersInput,k as SimpleRemoteEntity,K as SimpleRemoteEntityField,B as SimpleRemoteEntityOutput,Ee as SyncDataAction,U as SyncDataResult,G as SyncRolesAndUsersResult,F as UserInput,Ye as gql,qe as setupGraphQLClient};
|
|
859
891
|
//# sourceMappingURL=index.mjs.map
|