@quesmed/types 2.6.289 → 2.6.291

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.
@@ -143,6 +143,8 @@ export interface IOsceStation {
143
143
  userNote: null | IUserStationNote;
144
144
  public: boolean;
145
145
  clinicalData?: IClinicalDataModule[];
146
+ preDefined?: boolean;
147
+ createdBy?: Id;
146
148
  }
147
149
  export interface IOsceStationTopic {
148
150
  id: Id;
@@ -30,6 +30,8 @@ exports.OSCE_STATION_FIELDS = (0, client_1.gql) `
30
30
  name
31
31
  hiddenName
32
32
  status
33
+ createdBy
34
+ preDefined
33
35
  aiEnabled
34
36
  examinerQuestions {
35
37
  index
@@ -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 {
@@ -143,6 +143,8 @@ export interface IOsceStation {
143
143
  userNote: null | IUserStationNote;
144
144
  public: boolean;
145
145
  clinicalData?: IClinicalDataModule[];
146
+ preDefined?: boolean;
147
+ createdBy?: Id;
146
148
  }
147
149
  export interface IOsceStationTopic {
148
150
  id: Id;
@@ -27,6 +27,8 @@ export const OSCE_STATION_FIELDS = gql `
27
27
  name
28
28
  hiddenName
29
29
  status
30
+ createdBy
31
+ preDefined
30
32
  aiEnabled
31
33
  examinerQuestions {
32
34
  index
@@ -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
  }
@@ -74,6 +74,53 @@ export const updateCacheOnUpdateStation = (cache, result, options) => {
74
74
  fragmentName: 'OsceStationFields',
75
75
  });
76
76
  };
77
+ export const DELETE_STATION = gql `
78
+ mutation DeleteStation($stationId: Int!) {
79
+ restricted {
80
+ deleteStation(stationId: $stationId) {
81
+ recordIds
82
+ logFile
83
+ batchId
84
+ status
85
+ data
86
+ message
87
+ errors
88
+ }
89
+ }
90
+ }
91
+ `;
92
+ export const updateCacheOnDeleteStation = (cache, result, options) => {
93
+ const { deleteStation } = result?.data?.restricted || {};
94
+ const { variables } = options || {};
95
+ if (!variables || !deleteStation) {
96
+ return;
97
+ }
98
+ cache.evict({
99
+ id: cache.identify({
100
+ id: variables.stationId,
101
+ __typename: 'OsceStation',
102
+ }),
103
+ });
104
+ cache.gc();
105
+ const prevData = cache.readQuery({
106
+ variables: { solo: false },
107
+ query: OSCE_STATIONS,
108
+ });
109
+ if (prevData) {
110
+ const { osceStations } = prevData.restricted || {};
111
+ cache.writeQuery({
112
+ query: OSCE_STATIONS,
113
+ variables: { solo: false },
114
+ data: {
115
+ ...prevData,
116
+ restricted: {
117
+ ...prevData.restricted,
118
+ osceStations: osceStations?.filter((station) => station.id !== variables.stationId),
119
+ },
120
+ },
121
+ });
122
+ }
123
+ };
77
124
  export const GENERATE_STATION = gql `
78
125
  mutation GenerateStation($input: GenerateStationInput!) {
79
126
  restricted {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.289",
3
+ "version": "2.6.291",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",