@quesmed/types 2.6.84 → 2.6.86

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.
@@ -48,6 +48,7 @@ export interface IUpdateUserSettingsVar {
48
48
  input: Omit<DeepPartial<IUserSettings>, 'id' | 'userId' | 'updatedAt'>;
49
49
  }
50
50
  export type IUpdateUserSettingsData = RestrictedData<IUserSettings & graphqlNormalize, 'updateUserSettings'>;
51
+ export declare const optimisticUpdateUserSettings: (settings: Omit<IUserSettings, 'updatedAt'>) => ({ input }: IUpdateUserSettingsVar) => IUpdateUserSettingsData;
51
52
  export declare const updateCacheOnUpdateUserSettings: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateUserSettingsData>, options: ApolloUpdateOptions<IUpdateUserSettingsVar>) => void;
52
53
  export declare const RENEW_TOKEN: import("@apollo/client").DocumentNode;
53
54
  export type IRenewTokenVar = null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optimisticVideoLearningStatus = exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.optimisticStationLearningStatus = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.optimisticConceptLearningStatus = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.updateCacheOnUpdateUserSettings = exports.UPDATE_USER_SETTINGS = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = void 0;
3
+ exports.optimisticVideoLearningStatus = exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.optimisticStationLearningStatus = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.optimisticConceptLearningStatus = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.updateCacheOnUpdateUserSettings = exports.optimisticUpdateUserSettings = exports.UPDATE_USER_SETTINGS = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const models_1 = require("../../../models");
6
6
  const fragments_1 = require("../../fragments");
@@ -72,6 +72,24 @@ exports.UPDATE_USER_SETTINGS = (0, client_1.gql) `
72
72
  }
73
73
  }
74
74
  `;
75
+ const optimisticUpdateUserSettings = (settings) => ({ input }) => ({
76
+ restricted: {
77
+ updateUserSettings: {
78
+ __typename: 'UserSettings',
79
+ ...settings,
80
+ updatedAt: new Date(),
81
+ globalSettings: {
82
+ ...settings.globalSettings,
83
+ ...input.globalSettings,
84
+ },
85
+ productSettings: {
86
+ ...settings.productSettings,
87
+ ...input.productSettings,
88
+ },
89
+ },
90
+ },
91
+ });
92
+ exports.optimisticUpdateUserSettings = optimisticUpdateUserSettings;
75
93
  const updateCacheOnUpdateUserSettings = (cache, result, options) => {
76
94
  const { updateUserSettings } = result?.data?.restricted || {};
77
95
  const { variables } = options || {};
@@ -87,6 +105,7 @@ const updateCacheOnUpdateUserSettings = (cache, result, options) => {
87
105
  settings: updateUserSettings,
88
106
  },
89
107
  fragment: fragments_1.UPDATE_USER_SETTINGS_FRAGMENT,
108
+ fragmentName: 'UpdateUserSettingsFragment',
90
109
  });
91
110
  };
92
111
  exports.updateCacheOnUpdateUserSettings = updateCacheOnUpdateUserSettings;
@@ -0,0 +1,7 @@
1
+ import { graphqlNormalize, RestrictedData } from '../../types';
2
+ import { IChapter } from '../../../models';
3
+ export interface IChapterVar {
4
+ id: number;
5
+ }
6
+ export type IChapterData = RestrictedData<graphqlNormalize & IChapter, 'chapter'>;
7
+ export declare const CHAPTER: import("@apollo/client").DocumentNode;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHAPTER = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ exports.CHAPTER = (0, client_1.gql) `
6
+ query chapter($id: Int!) {
7
+ restricted {
8
+ chapter(id: $id) {
9
+ id
10
+ explanation
11
+ }
12
+ }
13
+ }
14
+ `;
@@ -1,4 +1,4 @@
1
- export * from './conceptExplanation';
1
+ export * from './chapter';
2
2
  export * from './concepts';
3
3
  export * from './global';
4
4
  export * from './marksheet';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./conceptExplanation"), exports);
17
+ __exportStar(require("./chapter"), exports);
18
18
  __exportStar(require("./concepts"), exports);
19
19
  __exportStar(require("./global"), exports);
20
20
  __exportStar(require("./marksheet"), exports);
@@ -48,6 +48,7 @@ export interface IUpdateUserSettingsVar {
48
48
  input: Omit<DeepPartial<IUserSettings>, 'id' | 'userId' | 'updatedAt'>;
49
49
  }
50
50
  export type IUpdateUserSettingsData = RestrictedData<IUserSettings & graphqlNormalize, 'updateUserSettings'>;
51
+ export declare const optimisticUpdateUserSettings: (settings: Omit<IUserSettings, 'updatedAt'>) => ({ input }: IUpdateUserSettingsVar) => IUpdateUserSettingsData;
51
52
  export declare const updateCacheOnUpdateUserSettings: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateUserSettingsData>, options: ApolloUpdateOptions<IUpdateUserSettingsVar>) => void;
52
53
  export declare const RENEW_TOKEN: import("@apollo/client").DocumentNode;
53
54
  export type IRenewTokenVar = null;
@@ -69,6 +69,23 @@ export const UPDATE_USER_SETTINGS = gql `
69
69
  }
70
70
  }
71
71
  `;
72
+ export const optimisticUpdateUserSettings = (settings) => ({ input }) => ({
73
+ restricted: {
74
+ updateUserSettings: {
75
+ __typename: 'UserSettings',
76
+ ...settings,
77
+ updatedAt: new Date(),
78
+ globalSettings: {
79
+ ...settings.globalSettings,
80
+ ...input.globalSettings,
81
+ },
82
+ productSettings: {
83
+ ...settings.productSettings,
84
+ ...input.productSettings,
85
+ },
86
+ },
87
+ },
88
+ });
72
89
  export const updateCacheOnUpdateUserSettings = (cache, result, options) => {
73
90
  const { updateUserSettings } = result?.data?.restricted || {};
74
91
  const { variables } = options || {};
@@ -84,6 +101,7 @@ export const updateCacheOnUpdateUserSettings = (cache, result, options) => {
84
101
  settings: updateUserSettings,
85
102
  },
86
103
  fragment: UPDATE_USER_SETTINGS_FRAGMENT,
104
+ fragmentName: 'UpdateUserSettingsFragment',
87
105
  });
88
106
  };
89
107
  export const RENEW_TOKEN = gql `
@@ -0,0 +1,7 @@
1
+ import { graphqlNormalize, RestrictedData } from '../../types';
2
+ import { IChapter } from '../../../models';
3
+ export interface IChapterVar {
4
+ id: number;
5
+ }
6
+ export type IChapterData = RestrictedData<graphqlNormalize & IChapter, 'chapter'>;
7
+ export declare const CHAPTER: import("@apollo/client").DocumentNode;
@@ -0,0 +1,11 @@
1
+ import { gql } from '@apollo/client';
2
+ export const CHAPTER = gql `
3
+ query chapter($id: Int!) {
4
+ restricted {
5
+ chapter(id: $id) {
6
+ id
7
+ explanation
8
+ }
9
+ }
10
+ }
11
+ `;
@@ -1,4 +1,4 @@
1
- export * from './conceptExplanation';
1
+ export * from './chapter';
2
2
  export * from './concepts';
3
3
  export * from './global';
4
4
  export * from './marksheet';
@@ -1,4 +1,4 @@
1
- export * from './conceptExplanation';
1
+ export * from './chapter';
2
2
  export * from './concepts';
3
3
  export * from './global';
4
4
  export * from './marksheet';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.84",
3
+ "version": "2.6.86",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -1,12 +0,0 @@
1
- import { graphqlNormalize, RestrictedData } from '../../types';
2
- export interface IQuesBookDict {
3
- topicId: number;
4
- conceptId: number;
5
- chapterId: number;
6
- explanation: string;
7
- }
8
- export interface IConceptExplanationVar {
9
- chapterId: number;
10
- }
11
- export type IConceptExplanationData = RestrictedData<graphqlNormalize & string, 'conceptExplanation'>;
12
- export declare const CONCEPT_EXPLANATION: import("@apollo/client").DocumentNode;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONCEPT_EXPLANATION = void 0;
4
- const client_1 = require("@apollo/client");
5
- exports.CONCEPT_EXPLANATION = (0, client_1.gql) `
6
- query conceptExplanation($chapterId: Int!) {
7
- restricted {
8
- conceptExplanation(chapterId: $chapterId)
9
- }
10
- }
11
- `;
@@ -1,12 +0,0 @@
1
- import { graphqlNormalize, RestrictedData } from '../../types';
2
- export interface IQuesBookDict {
3
- topicId: number;
4
- conceptId: number;
5
- chapterId: number;
6
- explanation: string;
7
- }
8
- export interface IConceptExplanationVar {
9
- chapterId: number;
10
- }
11
- export type IConceptExplanationData = RestrictedData<graphqlNormalize & string, 'conceptExplanation'>;
12
- export declare const CONCEPT_EXPLANATION: import("@apollo/client").DocumentNode;
@@ -1,8 +0,0 @@
1
- import { gql } from '@apollo/client';
2
- export const CONCEPT_EXPLANATION = gql `
3
- query conceptExplanation($chapterId: Int!) {
4
- restricted {
5
- conceptExplanation(chapterId: $chapterId)
6
- }
7
- }
8
- `;