@quesmed/types 2.6.10 → 2.6.12
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/cjs/models/OsceStation.d.ts +3 -1
- package/dist/cjs/models/OsceStation.js +2 -0
- package/dist/cjs/resolvers/apollo.d.ts +2 -2
- package/dist/cjs/resolvers/mutation/restricted/stripe.d.ts +5 -1
- package/dist/cjs/resolvers/mutation/restricted/stripe.js +30 -2
- package/dist/cjs/resolvers/query/restricted/marksheet.js +2 -0
- package/dist/mjs/models/OsceStation.d.ts +3 -1
- package/dist/mjs/models/OsceStation.js +2 -0
- package/dist/mjs/resolvers/apollo.d.ts +2 -2
- package/dist/mjs/resolvers/mutation/restricted/stripe.d.ts +5 -1
- package/dist/mjs/resolvers/mutation/restricted/stripe.js +28 -1
- package/dist/mjs/resolvers/query/restricted/marksheet.js +2 -0
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@ var EOsceType;
|
|
|
10
10
|
EOsceType[EOsceType["PROCEDURE"] = 4] = "PROCEDURE";
|
|
11
11
|
EOsceType[EOsceType["INTERPRETATION"] = 5] = "INTERPRETATION";
|
|
12
12
|
EOsceType[EOsceType["ABCDE"] = 6] = "ABCDE";
|
|
13
|
+
EOsceType[EOsceType["PRESCRIBING"] = 7] = "PRESCRIBING";
|
|
14
|
+
EOsceType[EOsceType["MIXED"] = 8] = "MIXED";
|
|
13
15
|
})(EOsceType = exports.EOsceType || (exports.EOsceType = {}));
|
|
14
16
|
var EStationPictureType;
|
|
15
17
|
(function (EStationPictureType) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefaultContext, FetchResult } from '@apollo/client';
|
|
2
2
|
export type ApolloUpdateResultRestricted<T> = Omit<FetchResult<T>, 'context'>;
|
|
3
|
-
export interface ApolloUpdateOptions {
|
|
3
|
+
export interface ApolloUpdateOptions<T = Record<string, any>> {
|
|
4
4
|
context?: DefaultContext;
|
|
5
|
-
variables?:
|
|
5
|
+
variables?: T;
|
|
6
6
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { ApolloCache } from '@apollo/client';
|
|
2
|
+
import { ISubscription } from '../../../models';
|
|
3
|
+
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
1
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
2
5
|
export interface ICancelSubscriptionVar {
|
|
3
6
|
subscriptionId: number;
|
|
4
7
|
}
|
|
5
|
-
export type ICancelSubscriptionData = RestrictedData<graphqlNormalize &
|
|
8
|
+
export type ICancelSubscriptionData = RestrictedData<graphqlNormalize & ISubscription, 'cancelSubscription'>;
|
|
6
9
|
export declare const CANCEL_SUBSCRIPTION: import("@apollo/client").DocumentNode;
|
|
10
|
+
export declare const updateSubscriptionOnCancelOrRenew: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICancelSubscriptionData>, options: ApolloUpdateOptions<ICancelSubscriptionVar>) => void;
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CANCEL_SUBSCRIPTION = void 0;
|
|
3
|
+
exports.updateSubscriptionOnCancelOrRenew = exports.CANCEL_SUBSCRIPTION = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
|
+
const restricted_1 = require("../../query/restricted");
|
|
5
6
|
exports.CANCEL_SUBSCRIPTION = (0, client_1.gql) `
|
|
6
7
|
mutation Mutation($subscriptionId: Int!) {
|
|
7
8
|
restricted {
|
|
8
|
-
cancelSubscription(subscriptionId: $subscriptionId)
|
|
9
|
+
cancelSubscription(subscriptionId: $subscriptionId) {
|
|
10
|
+
id
|
|
11
|
+
endedAt
|
|
12
|
+
periodEndAt
|
|
13
|
+
stripeSubscriptionId
|
|
14
|
+
userId
|
|
15
|
+
productId
|
|
16
|
+
}
|
|
9
17
|
}
|
|
10
18
|
}
|
|
11
19
|
`;
|
|
20
|
+
const updateSubscriptionOnCancelOrRenew = (cache, result, options) => {
|
|
21
|
+
const { cancelSubscription } = result?.data?.restricted || {};
|
|
22
|
+
const { variables } = options || {};
|
|
23
|
+
if (!variables || !cancelSubscription) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const prevData = cache.readQuery({
|
|
27
|
+
query: restricted_1.USER,
|
|
28
|
+
});
|
|
29
|
+
if (!prevData) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const { subscriptionId } = variables;
|
|
33
|
+
const { subscriptions } = prevData.restricted.user;
|
|
34
|
+
prevData.restricted.user.subscriptions = subscriptions.map((s) => Number(s.id) === Number(subscriptionId)
|
|
35
|
+
? { ...s, ...cancelSubscription }
|
|
36
|
+
: s);
|
|
37
|
+
cache.writeQuery({ query: restricted_1.USER, data: { ...prevData } });
|
|
38
|
+
};
|
|
39
|
+
exports.updateSubscriptionOnCancelOrRenew = updateSubscriptionOnCancelOrRenew;
|
|
@@ -1019,6 +1019,7 @@ exports.MARKSHEETS = (0, client_1.gql) `
|
|
|
1019
1019
|
marksheets(filter: $filter) {
|
|
1020
1020
|
results {
|
|
1021
1021
|
id
|
|
1022
|
+
source
|
|
1022
1023
|
endedAt
|
|
1023
1024
|
topicNames
|
|
1024
1025
|
correct
|
|
@@ -1057,6 +1058,7 @@ exports.MARKSHEETS_WINDOW = (0, client_1.gql) `
|
|
|
1057
1058
|
date
|
|
1058
1059
|
result {
|
|
1059
1060
|
id
|
|
1061
|
+
source
|
|
1060
1062
|
endedAt
|
|
1061
1063
|
topicNames
|
|
1062
1064
|
correct
|
|
@@ -7,6 +7,8 @@ export var EOsceType;
|
|
|
7
7
|
EOsceType[EOsceType["PROCEDURE"] = 4] = "PROCEDURE";
|
|
8
8
|
EOsceType[EOsceType["INTERPRETATION"] = 5] = "INTERPRETATION";
|
|
9
9
|
EOsceType[EOsceType["ABCDE"] = 6] = "ABCDE";
|
|
10
|
+
EOsceType[EOsceType["PRESCRIBING"] = 7] = "PRESCRIBING";
|
|
11
|
+
EOsceType[EOsceType["MIXED"] = 8] = "MIXED";
|
|
10
12
|
})(EOsceType || (EOsceType = {}));
|
|
11
13
|
export var EStationPictureType;
|
|
12
14
|
(function (EStationPictureType) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefaultContext, FetchResult } from '@apollo/client';
|
|
2
2
|
export type ApolloUpdateResultRestricted<T> = Omit<FetchResult<T>, 'context'>;
|
|
3
|
-
export interface ApolloUpdateOptions {
|
|
3
|
+
export interface ApolloUpdateOptions<T = Record<string, any>> {
|
|
4
4
|
context?: DefaultContext;
|
|
5
|
-
variables?:
|
|
5
|
+
variables?: T;
|
|
6
6
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { ApolloCache } from '@apollo/client';
|
|
2
|
+
import { ISubscription } from '../../../models';
|
|
3
|
+
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
1
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
2
5
|
export interface ICancelSubscriptionVar {
|
|
3
6
|
subscriptionId: number;
|
|
4
7
|
}
|
|
5
|
-
export type ICancelSubscriptionData = RestrictedData<graphqlNormalize &
|
|
8
|
+
export type ICancelSubscriptionData = RestrictedData<graphqlNormalize & ISubscription, 'cancelSubscription'>;
|
|
6
9
|
export declare const CANCEL_SUBSCRIPTION: import("@apollo/client").DocumentNode;
|
|
10
|
+
export declare const updateSubscriptionOnCancelOrRenew: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICancelSubscriptionData>, options: ApolloUpdateOptions<ICancelSubscriptionVar>) => void;
|
|
@@ -1,8 +1,35 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
+
import { USER } from '../../query/restricted';
|
|
2
3
|
export const CANCEL_SUBSCRIPTION = gql `
|
|
3
4
|
mutation Mutation($subscriptionId: Int!) {
|
|
4
5
|
restricted {
|
|
5
|
-
cancelSubscription(subscriptionId: $subscriptionId)
|
|
6
|
+
cancelSubscription(subscriptionId: $subscriptionId) {
|
|
7
|
+
id
|
|
8
|
+
endedAt
|
|
9
|
+
periodEndAt
|
|
10
|
+
stripeSubscriptionId
|
|
11
|
+
userId
|
|
12
|
+
productId
|
|
13
|
+
}
|
|
6
14
|
}
|
|
7
15
|
}
|
|
8
16
|
`;
|
|
17
|
+
export const updateSubscriptionOnCancelOrRenew = (cache, result, options) => {
|
|
18
|
+
const { cancelSubscription } = result?.data?.restricted || {};
|
|
19
|
+
const { variables } = options || {};
|
|
20
|
+
if (!variables || !cancelSubscription) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const prevData = cache.readQuery({
|
|
24
|
+
query: USER,
|
|
25
|
+
});
|
|
26
|
+
if (!prevData) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const { subscriptionId } = variables;
|
|
30
|
+
const { subscriptions } = prevData.restricted.user;
|
|
31
|
+
prevData.restricted.user.subscriptions = subscriptions.map((s) => Number(s.id) === Number(subscriptionId)
|
|
32
|
+
? { ...s, ...cancelSubscription }
|
|
33
|
+
: s);
|
|
34
|
+
cache.writeQuery({ query: USER, data: { ...prevData } });
|
|
35
|
+
};
|
|
@@ -1016,6 +1016,7 @@ export const MARKSHEETS = gql `
|
|
|
1016
1016
|
marksheets(filter: $filter) {
|
|
1017
1017
|
results {
|
|
1018
1018
|
id
|
|
1019
|
+
source
|
|
1019
1020
|
endedAt
|
|
1020
1021
|
topicNames
|
|
1021
1022
|
correct
|
|
@@ -1054,6 +1055,7 @@ export const MARKSHEETS_WINDOW = gql `
|
|
|
1054
1055
|
date
|
|
1055
1056
|
result {
|
|
1056
1057
|
id
|
|
1058
|
+
source
|
|
1057
1059
|
endedAt
|
|
1058
1060
|
topicNames
|
|
1059
1061
|
correct
|