@quesmed/types-rn 2.6.289 → 2.6.290

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.289",
3
+ "version": "2.6.290",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -1,6 +1,6 @@
1
1
  import { ApolloCache } from '@apollo/client';
2
2
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
3
- import { IClinicalDataModule, Id, IOsceStation, IOsceStationPhaseTimer, IStationExaminerQuestion } from '../../../models';
3
+ import { IClinicalDataModule, Id, IOsceStation, IOsceStationPhaseTimer, IResultData, IStationExaminerQuestion } from '../../../models';
4
4
  import { IAssetBinding } from '../../../models/Picture';
5
5
  import { graphqlNormalize, RestrictedData } from '../../types';
6
6
  import { EOsceType } from '../../../models';
@@ -68,6 +68,12 @@ export interface IUpdateStationVar {
68
68
  };
69
69
  }
70
70
  export declare const updateCacheOnUpdateStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateStationData>, options: ApolloUpdateOptions<IUpdateStationVar>) => void;
71
+ export declare const DELETE_STATION: import("@apollo/client").DocumentNode;
72
+ export interface IDeleteStationVar {
73
+ stationId: Id;
74
+ }
75
+ export type IDeleteStationData = RestrictedData<graphqlNormalize & IResultData, 'deleteStation'>;
76
+ export declare const updateCacheOnDeleteStation: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IDeleteStationData>, options: ApolloUpdateOptions<IDeleteStationVar>) => void;
71
77
  export interface IGenerateStationSession {
72
78
  sessionId: string;
73
79
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GENERATE_STATION = exports.updateCacheOnUpdateStation = exports.UPDATE_STATION = exports.updateCacheOnCreateStation = exports.CREATE_STATION = void 0;
3
+ exports.GENERATE_STATION = exports.updateCacheOnDeleteStation = exports.DELETE_STATION = exports.updateCacheOnUpdateStation = exports.UPDATE_STATION = exports.updateCacheOnCreateStation = exports.CREATE_STATION = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const osce_1 = require("../../fragments/osce");
6
6
  const restricted_1 = require("../../query/restricted");
@@ -79,6 +79,54 @@ const updateCacheOnUpdateStation = (cache, result, options) => {
79
79
  });
80
80
  };
81
81
  exports.updateCacheOnUpdateStation = updateCacheOnUpdateStation;
82
+ exports.DELETE_STATION = (0, client_1.gql) `
83
+ mutation DeleteStation($stationId: Int!) {
84
+ restricted {
85
+ deleteStation(stationId: $stationId) {
86
+ recordIds
87
+ logFile
88
+ batchId
89
+ status
90
+ data
91
+ message
92
+ errors
93
+ }
94
+ }
95
+ }
96
+ `;
97
+ const updateCacheOnDeleteStation = (cache, result, options) => {
98
+ const { deleteStation } = result?.data?.restricted || {};
99
+ const { variables } = options || {};
100
+ if (!variables || !deleteStation) {
101
+ return;
102
+ }
103
+ cache.evict({
104
+ id: cache.identify({
105
+ id: variables.stationId,
106
+ __typename: 'OsceStation',
107
+ }),
108
+ });
109
+ cache.gc();
110
+ const prevData = cache.readQuery({
111
+ variables: { solo: false },
112
+ query: restricted_1.OSCE_STATIONS,
113
+ });
114
+ if (prevData) {
115
+ const { osceStations } = prevData.restricted || {};
116
+ cache.writeQuery({
117
+ query: restricted_1.OSCE_STATIONS,
118
+ variables: { solo: false },
119
+ data: {
120
+ ...prevData,
121
+ restricted: {
122
+ ...prevData.restricted,
123
+ osceStations: osceStations?.filter((station) => station.id !== variables.stationId),
124
+ },
125
+ },
126
+ });
127
+ }
128
+ };
129
+ exports.updateCacheOnDeleteStation = updateCacheOnDeleteStation;
82
130
  exports.GENERATE_STATION = (0, client_1.gql) `
83
131
  mutation GenerateStation($input: GenerateStationInput!) {
84
132
  restricted {