@quesmed/types 2.6.305 → 2.6.307

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.
@@ -87,37 +87,28 @@ exports.UPSERT_CONCEPT_NOTE = (0, client_1.gql) `
87
87
  }
88
88
  }
89
89
  `;
90
- const resolveConceptCacheId = (cache, conceptId) => {
91
- for (const [cacheId, value] of Object.entries(cache.extract())) {
92
- if (value &&
93
- typeof value === 'object' &&
94
- '__typename' in value &&
95
- value.__typename === 'Concept' &&
96
- value.id === conceptId) {
97
- return cacheId;
98
- }
99
- }
100
- return (cache.identify({
101
- id: conceptId,
102
- __typename: 'Concept',
103
- }) ?? undefined);
104
- };
90
+ const resolveConceptCacheIds = (cache, conceptId) => Object.entries(cache.extract())
91
+ .filter(([, value]) => value &&
92
+ typeof value === 'object' &&
93
+ '__typename' in value &&
94
+ value.__typename === 'Concept' &&
95
+ // Concept.id is cached as a string; conceptId is an Int
96
+ String(value.id) === String(conceptId))
97
+ .map(([cacheId]) => cacheId);
105
98
  const updateCacheOnUpsertConceptNote = (cache, result, options) => {
106
99
  const { upsertConceptNote } = result?.data?.restricted || {};
107
100
  const { variables } = options || {};
108
101
  if (!variables) {
109
102
  return;
110
103
  }
111
- const cacheId = resolveConceptCacheId(cache, variables.conceptId);
112
- if (!cacheId) {
113
- return;
114
- }
115
- cache.writeFragment({
116
- id: cacheId,
117
- fragment: fragments_1.UPSERT_CONCEPT_NOTE_FRAGMENT,
118
- data: {
119
- userNote: upsertConceptNote,
120
- },
104
+ resolveConceptCacheIds(cache, variables.conceptId).forEach((cacheId) => {
105
+ cache.writeFragment({
106
+ id: cacheId,
107
+ fragment: fragments_1.UPSERT_CONCEPT_NOTE_FRAGMENT,
108
+ data: {
109
+ userNote: upsertConceptNote,
110
+ },
111
+ });
121
112
  });
122
113
  };
123
114
  exports.updateCacheOnUpsertConceptNote = updateCacheOnUpsertConceptNote;
@@ -21,6 +21,23 @@ export interface ILoginUserVar {
21
21
  days: number;
22
22
  }
23
23
  export type ILoginUserData = RootData<string, 'loginUser'>;
24
+ export declare const LOGIN_WITH_SSO: import("@apollo/client").DocumentNode;
25
+ export interface ILoginWithSsoVar {
26
+ code: string;
27
+ days: number;
28
+ codeVerifier?: string;
29
+ }
30
+ export type ILoginWithSsoData = RootData<string, 'loginWithSso'>;
31
+ export type ISsoCheckResponse = {
32
+ enabled: false;
33
+ } | {
34
+ enabled: true;
35
+ required: boolean;
36
+ name: string;
37
+ slug: string;
38
+ };
39
+ export type SsoCallbackError = 'no_connection' | 'no_account' | 'invalid_state' | 'idp_error' | 'invalid_request';
40
+ export declare const SSO_REQUIRED_MESSAGE = "Your university requires sign-in with university SSO.";
24
41
  export declare const REGISTER_USER: import("@apollo/client").DocumentNode;
25
42
  export interface RegisterUserInput {
26
43
  displayName?: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RESET_PASSWORD = exports.RESET_PASSWORD_PREP = exports.REGISTER_USER = exports.LOGIN_USER = exports.REGISTER_ADMIN = exports.LOGIN_ADMIN = void 0;
3
+ exports.RESET_PASSWORD = exports.RESET_PASSWORD_PREP = exports.REGISTER_USER = exports.SSO_REQUIRED_MESSAGE = exports.LOGIN_WITH_SSO = exports.LOGIN_USER = exports.REGISTER_ADMIN = exports.LOGIN_ADMIN = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  exports.LOGIN_ADMIN = (0, client_1.gql) `
6
6
  mutation LoginAdmin($username: String!, $password: String!, $days: Int!) {
@@ -27,6 +27,13 @@ exports.LOGIN_USER = (0, client_1.gql) `
27
27
  loginUser(username: $username, password: $password, days: $days)
28
28
  }
29
29
  `;
30
+ exports.LOGIN_WITH_SSO = (0, client_1.gql) `
31
+ mutation LoginWithSso($code: String!, $days: Int!, $codeVerifier: String) {
32
+ loginWithSso(code: $code, days: $days, codeVerifier: $codeVerifier)
33
+ }
34
+ `;
35
+ // loginUser / resetPasswordPrep / resetPassword error when ssoRequired is on
36
+ exports.SSO_REQUIRED_MESSAGE = 'Your university requires sign-in with university SSO.';
30
37
  exports.REGISTER_USER = (0, client_1.gql) `
31
38
  mutation RegisterUser($userData: RegisterUser!) {
32
39
  registerUser(userData: $userData)
@@ -82,37 +82,28 @@ export const UPSERT_CONCEPT_NOTE = gql `
82
82
  }
83
83
  }
84
84
  `;
85
- const resolveConceptCacheId = (cache, conceptId) => {
86
- for (const [cacheId, value] of Object.entries(cache.extract())) {
87
- if (value &&
88
- typeof value === 'object' &&
89
- '__typename' in value &&
90
- value.__typename === 'Concept' &&
91
- value.id === conceptId) {
92
- return cacheId;
93
- }
94
- }
95
- return (cache.identify({
96
- id: conceptId,
97
- __typename: 'Concept',
98
- }) ?? undefined);
99
- };
85
+ const resolveConceptCacheIds = (cache, conceptId) => Object.entries(cache.extract())
86
+ .filter(([, value]) => value &&
87
+ typeof value === 'object' &&
88
+ '__typename' in value &&
89
+ value.__typename === 'Concept' &&
90
+ // Concept.id is cached as a string; conceptId is an Int
91
+ String(value.id) === String(conceptId))
92
+ .map(([cacheId]) => cacheId);
100
93
  export const updateCacheOnUpsertConceptNote = (cache, result, options) => {
101
94
  const { upsertConceptNote } = result?.data?.restricted || {};
102
95
  const { variables } = options || {};
103
96
  if (!variables) {
104
97
  return;
105
98
  }
106
- const cacheId = resolveConceptCacheId(cache, variables.conceptId);
107
- if (!cacheId) {
108
- return;
109
- }
110
- cache.writeFragment({
111
- id: cacheId,
112
- fragment: UPSERT_CONCEPT_NOTE_FRAGMENT,
113
- data: {
114
- userNote: upsertConceptNote,
115
- },
99
+ resolveConceptCacheIds(cache, variables.conceptId).forEach((cacheId) => {
100
+ cache.writeFragment({
101
+ id: cacheId,
102
+ fragment: UPSERT_CONCEPT_NOTE_FRAGMENT,
103
+ data: {
104
+ userNote: upsertConceptNote,
105
+ },
106
+ });
116
107
  });
117
108
  };
118
109
  export const optimisticUpsertConceptNote = (data) => {
@@ -21,6 +21,23 @@ export interface ILoginUserVar {
21
21
  days: number;
22
22
  }
23
23
  export type ILoginUserData = RootData<string, 'loginUser'>;
24
+ export declare const LOGIN_WITH_SSO: import("@apollo/client").DocumentNode;
25
+ export interface ILoginWithSsoVar {
26
+ code: string;
27
+ days: number;
28
+ codeVerifier?: string;
29
+ }
30
+ export type ILoginWithSsoData = RootData<string, 'loginWithSso'>;
31
+ export type ISsoCheckResponse = {
32
+ enabled: false;
33
+ } | {
34
+ enabled: true;
35
+ required: boolean;
36
+ name: string;
37
+ slug: string;
38
+ };
39
+ export type SsoCallbackError = 'no_connection' | 'no_account' | 'invalid_state' | 'idp_error' | 'invalid_request';
40
+ export declare const SSO_REQUIRED_MESSAGE = "Your university requires sign-in with university SSO.";
24
41
  export declare const REGISTER_USER: import("@apollo/client").DocumentNode;
25
42
  export interface RegisterUserInput {
26
43
  displayName?: string;
@@ -24,6 +24,13 @@ export const LOGIN_USER = gql `
24
24
  loginUser(username: $username, password: $password, days: $days)
25
25
  }
26
26
  `;
27
+ export const LOGIN_WITH_SSO = gql `
28
+ mutation LoginWithSso($code: String!, $days: Int!, $codeVerifier: String) {
29
+ loginWithSso(code: $code, days: $days, codeVerifier: $codeVerifier)
30
+ }
31
+ `;
32
+ // loginUser / resetPasswordPrep / resetPassword error when ssoRequired is on
33
+ export const SSO_REQUIRED_MESSAGE = 'Your university requires sign-in with university SSO.';
27
34
  export const REGISTER_USER = gql `
28
35
  mutation RegisterUser($userData: RegisterUser!) {
29
36
  registerUser(userData: $userData)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.305",
3
+ "version": "2.6.307",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",