@timardex/cluemart-shared 2.3.0 → 2.3.10

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.
@@ -134,6 +134,8 @@ __export(graphql_exports, {
134
134
  useGetPrivateChats: () => useGetPrivateChats,
135
135
  useGetRelation: () => useGetRelation,
136
136
  useGetRelationByEventAndVendor: () => useGetRelationByEventAndVendor,
137
+ useGetRelationHistories: () => useGetRelationHistories,
138
+ useGetRelationHistory: () => useGetRelationHistory,
137
139
  useGetReportedChatUsers: () => useGetReportedChatUsers,
138
140
  useGetResourceActivity: () => useGetResourceActivity,
139
141
  useGetResourceConnections: () => useGetResourceConnections,
@@ -1613,8 +1615,27 @@ var RELATION_FIELDS_FRAGMENT = import_client11.gql`
1613
1615
  ${RELATION_DATES_FRAGMENT}
1614
1616
  `;
1615
1617
  var GET_RELATION = import_client11.gql`
1616
- query getRelation($_id: ID!, $futureOnly: Boolean = false) {
1617
- relation(_id: $_id, futureOnly: $futureOnly) {
1618
+ query getRelation($_id: ID!) {
1619
+ relation(_id: $_id) {
1620
+ ...RelationFields
1621
+ }
1622
+ }
1623
+ ${RELATION_FIELDS_FRAGMENT}
1624
+ `;
1625
+ var GET_RELATION_HISTORY = import_client11.gql`
1626
+ query getRelationHistory($_id: ID!) {
1627
+ relationHistory(_id: $_id) {
1628
+ ...RelationFields
1629
+ }
1630
+ }
1631
+ ${RELATION_FIELDS_FRAGMENT}
1632
+ `;
1633
+ var GET_RELATION_HISTORIES = import_client11.gql`
1634
+ query getRelationHistories(
1635
+ $resourceId: ID!
1636
+ $resourceType: ResourceTypeEnum!
1637
+ ) {
1638
+ relationHistories(resourceId: $resourceId, resourceType: $resourceType) {
1618
1639
  ...RelationFields
1619
1640
  }
1620
1641
  }
@@ -2989,20 +3010,37 @@ var useDeleteRelation = () => {
2989
3010
 
2990
3011
  // src/graphql/hooks/relation/hooksQuery.ts
2991
3012
  var import_client38 = require("@apollo/client");
2992
- var useGetRelation = (_id, options) => {
3013
+ var useGetRelation = (_id) => {
2993
3014
  const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION, {
2994
- // `relation(futureOnly)` is a projection-specific view of RelationType.
2995
- // If this writes into the normalized RelationType cache, a full-history
2996
- // read (e.g. the statistics screen's `futureOnly: false`) and this one can
2997
- // overwrite each other's `relationDates` for the same entity id. Keep it
2998
- // uncached.
3015
+ // `relation` returns only upcoming dates, which is a projection of
3016
+ // RelationType rather than the stored document. Keep it out of the
3017
+ // normalized cache so it cannot overwrite `relationDates` of the same
3018
+ // entity id for other readers.
2999
3019
  fetchPolicy: "no-cache",
3000
3020
  skip: !_id,
3001
- variables: _id ? { _id, futureOnly: options?.futureOnly ?? false } : void 0
3021
+ variables: _id ? { _id } : void 0
3002
3022
  });
3003
3023
  const relation = data?.relation;
3004
3024
  return { error, loading, refetch, relation };
3005
3025
  };
3026
+ var useGetRelationHistory = (_id) => {
3027
+ const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION_HISTORY, {
3028
+ fetchPolicy: "no-cache",
3029
+ skip: !_id,
3030
+ variables: _id ? { _id } : void 0
3031
+ });
3032
+ const relationHistory = data?.relationHistory;
3033
+ return { error, loading, refetch, relationHistory };
3034
+ };
3035
+ var useGetRelationHistories = (resourceId, resourceType) => {
3036
+ const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION_HISTORIES, {
3037
+ fetchPolicy: "no-cache",
3038
+ skip: !resourceId || !resourceType,
3039
+ variables: { resourceId, resourceType }
3040
+ });
3041
+ const relationHistories = data?.relationHistories || [];
3042
+ return { error, loading, refetch, relationHistories };
3043
+ };
3006
3044
  var useGetRelationByEventAndVendor = (eventId, vendorId) => {
3007
3045
  const { loading, error, data, refetch } = (0, import_client38.useQuery)(GET_RELATION_BY_EVENT_AND_VENDOR, {
3008
3046
  fetchPolicy: "network-only",
@@ -5775,6 +5813,8 @@ function usePaginatedList({
5775
5813
  useGetPrivateChats,
5776
5814
  useGetRelation,
5777
5815
  useGetRelationByEventAndVendor,
5816
+ useGetRelationHistories,
5817
+ useGetRelationHistory,
5778
5818
  useGetReportedChatUsers,
5779
5819
  useGetResourceActivity,
5780
5820
  useGetResourceConnections,