@quesmed/types 1.4.11 → 1.4.15

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.
@@ -0,0 +1,15 @@
1
+ import { Id } from './Type';
2
+ export interface IBlogTag {
3
+ id: Id;
4
+ createdAt: number | Date;
5
+ name: string;
6
+ }
7
+ export interface IBlogPost {
8
+ id: Id;
9
+ createdAt: number | Date;
10
+ updatedAt: number | Date;
11
+ title: string;
12
+ body: string;
13
+ tags?: IBlogTag[];
14
+ relatedBlogPosts?: IBlogPost[];
15
+ }
package/models/Blog.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export {};
package/models/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './Type';
21
21
  export * from './University';
22
22
  export * from './User';
23
23
  export * from './Video';
24
+ export * from './Blog';
package/models/index.js CHANGED
@@ -33,3 +33,4 @@ __exportStar(require("./Type"), exports);
33
33
  __exportStar(require("./University"), exports);
34
34
  __exportStar(require("./User"), exports);
35
35
  __exportStar(require("./Video"), exports);
36
+ __exportStar(require("./Blog"), exports);
package/models/index.mjs CHANGED
@@ -21,3 +21,4 @@ export * from './Type';
21
21
  export * from './University';
22
22
  export * from './User';
23
23
  export * from './Video';
24
+ export * from './Blog';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "1.4.11",
3
+ "version": "1.4.15",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -0,0 +1 @@
1
+ export declare const BLOG_POST_FIELDS: import("@apollo/client").DocumentNode;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BLOG_POST_FIELDS = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ exports.BLOG_POST_FIELDS = (0, client_1.gql) `
6
+ fragment BlogPostFields on BlogPost {
7
+ id
8
+ createdAt
9
+ updatedAt
10
+ title
11
+ body
12
+ tags {
13
+ id
14
+ name
15
+ }
16
+ }
17
+ `;
@@ -0,0 +1,14 @@
1
+ import { gql } from '@apollo/client';
2
+ export const BLOG_POST_FIELDS = gql `
3
+ fragment BlogPostFields on BlogPost {
4
+ id
5
+ createdAt
6
+ updatedAt
7
+ title
8
+ body
9
+ tags {
10
+ id
11
+ name
12
+ }
13
+ }
14
+ `;
@@ -0,0 +1,12 @@
1
+ import { IBlogPost } from '../../models';
2
+ import { graphqlNormalize, RootData } from '../types';
3
+ export declare const BLOG_POST: import("@apollo/client").DocumentNode;
4
+ export interface IBlogPostVar {
5
+ id: number;
6
+ }
7
+ export declare type IBlogPostData = RootData<graphqlNormalize & IBlogPost, 'blogPost'>;
8
+ export declare const BLOG_POSTS: import("@apollo/client").DocumentNode;
9
+ export interface IBlogPostsVar {
10
+ tagIds: number[];
11
+ }
12
+ export declare type IBlogPostsData = RootData<(graphqlNormalize & IBlogPost)[], 'blogPosts'>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BLOG_POSTS = exports.BLOG_POST = void 0;
4
+ const client_1 = require("@apollo/client");
5
+ const blog_1 = require("../fragments/blog");
6
+ exports.BLOG_POST = (0, client_1.gql) `
7
+ ${blog_1.BLOG_POST_FIELDS}
8
+ query BlogPost($id: Int!) {
9
+ blogPost(id: $id) {
10
+ ...BlogPostFields
11
+ relatedBlogPosts {
12
+ ...BlogPostFields
13
+ }
14
+ }
15
+ }
16
+ `;
17
+ exports.BLOG_POSTS = (0, client_1.gql) `
18
+ ${blog_1.BLOG_POST_FIELDS}
19
+ query BlogPosts($tags: [Int]!) {
20
+ blogPosts(tags: $tags) {
21
+ ...BlogPostFields
22
+ relatedBlogPosts {
23
+ ...BlogPostFields
24
+ }
25
+ }
26
+ }
27
+ `;
@@ -0,0 +1,24 @@
1
+ import { gql } from '@apollo/client';
2
+ import { BLOG_POST_FIELDS } from '../fragments/blog';
3
+ export const BLOG_POST = gql `
4
+ ${BLOG_POST_FIELDS}
5
+ query BlogPost($id: Int!) {
6
+ blogPost(id: $id) {
7
+ ...BlogPostFields
8
+ relatedBlogPosts {
9
+ ...BlogPostFields
10
+ }
11
+ }
12
+ }
13
+ `;
14
+ export const BLOG_POSTS = gql `
15
+ ${BLOG_POST_FIELDS}
16
+ query BlogPosts($tags: [Int]!) {
17
+ blogPosts(tags: $tags) {
18
+ ...BlogPostFields
19
+ relatedBlogPosts {
20
+ ...BlogPostFields
21
+ }
22
+ }
23
+ }
24
+ `;
@@ -1,4 +1,5 @@
1
1
  export * from './author';
2
+ export * from './blog';
2
3
  export * from './book';
3
4
  export * from './feedback';
4
5
  export * from './sampleCards';
@@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./author"), exports);
14
+ __exportStar(require("./blog"), exports);
14
15
  __exportStar(require("./book"), exports);
15
16
  __exportStar(require("./feedback"), exports);
16
17
  __exportStar(require("./sampleCards"), exports);
@@ -1,4 +1,5 @@
1
1
  export * from './author';
2
+ export * from './blog';
2
3
  export * from './book';
3
4
  export * from './feedback';
4
5
  export * from './sampleCards';
@@ -102,6 +102,8 @@ exports.SEARCH_OSCE_STATIONS = (0, client_1.gql) `
102
102
  restricted {
103
103
  searchOsceStations(search: $search) {
104
104
  ...OsceStationFields
105
+ attempted
106
+ score
105
107
  }
106
108
  }
107
109
  }
@@ -99,6 +99,8 @@ export const SEARCH_OSCE_STATIONS = gql `
99
99
  restricted {
100
100
  searchOsceStations(search: $search) {
101
101
  ...OsceStationFields
102
+ attempted
103
+ score
102
104
  }
103
105
  }
104
106
  }
@@ -41,7 +41,7 @@ function formatPrescribeAnswer(baseAnswer) {
41
41
  .toLowerCase()
42
42
  .replace(/\s/g, '')
43
43
  .replace(/\//g, '');
44
- if (obj.route.value === 'oral') {
44
+ if (obj.route.value.includes('oral')) {
45
45
  obj.route.value = 'po';
46
46
  }
47
47
  else if (obj.route.value.includes('intravenous')) {
@@ -37,7 +37,7 @@ export function formatPrescribeAnswer(baseAnswer) {
37
37
  .toLowerCase()
38
38
  .replace(/\s/g, '')
39
39
  .replace(/\//g, '');
40
- if (obj.route.value === 'oral') {
40
+ if (obj.route.value.includes('oral')) {
41
41
  obj.route.value = 'po';
42
42
  }
43
43
  else if (obj.route.value.includes('intravenous')) {
package/utils/uuid4.js CHANGED
@@ -202,14 +202,9 @@ class Uuid4 {
202
202
  * @private
203
203
  */
204
204
  static _getRandomArray() {
205
- if (typeof window === 'undefined') {
206
- let crypto = require('crypto');
207
- return Uint8Array.from(crypto.randomBytes(16));
208
- }
209
- // `result` is modified in place.
210
- let result = new Uint8Array(16);
211
- window.crypto.getRandomValues(result);
212
- return result;
205
+ return Uint8Array.from(Array(16)
206
+ .fill(0)
207
+ .map(() => Math.round(Math.random() * 255)));
213
208
  }
214
209
  }
215
210
  /**
package/utils/uuid4.mjs CHANGED
@@ -200,14 +200,9 @@ class Uuid4 {
200
200
  * @private
201
201
  */
202
202
  static _getRandomArray() {
203
- if (typeof window === 'undefined') {
204
- let crypto = require('crypto');
205
- return Uint8Array.from(crypto.randomBytes(16));
206
- }
207
- // `result` is modified in place.
208
- let result = new Uint8Array(16);
209
- window.crypto.getRandomValues(result);
210
- return result;
203
+ return Uint8Array.from(Array(16)
204
+ .fill(0)
205
+ .map(() => Math.round(Math.random() * 255)));
211
206
  }
212
207
  }
213
208
  /**