@quesmed/types 1.4.23 → 1.4.27
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/index.d.ts +1 -0
- package/index.js +5 -4
- package/index.mjs +1 -0
- package/models/User.js +10 -1
- package/models/User.mjs +10 -1
- package/models/index.d.ts +1 -1
- package/models/index.js +1 -1
- package/models/index.mjs +1 -1
- package/package.json +3 -2
- package/resolvers/subscription/osce.d.ts +4 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/index.mjs +1 -0
- package/utils/webSocketLink.d.ts +7 -0
- package/utils/webSocketLink.js +22 -0
- package/utils/webSocketLink.mjs +18 -0
- package/test.d.ts +0 -0
- package/test.js +0 -1
- package/test.mjs +0 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -11,9 +11,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
11
|
}) : function(o, v) {
|
|
12
12
|
o["default"] = v;
|
|
13
13
|
});
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
14
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
15
|
if (mod && mod.__esModule) return mod;
|
|
19
16
|
var result = {};
|
|
@@ -21,8 +18,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
21
18
|
__setModuleDefault(result, mod);
|
|
22
19
|
return result;
|
|
23
20
|
};
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.termsAndConditions = exports.EPlatformId = exports.FCM_TOPICS = exports.ERRORS = exports.utils = void 0;
|
|
25
|
+
exports.termsAndConditions = exports.EPlatformId = exports.FCM_TOPICS = exports.ERRORS = exports.utils = exports.Models = void 0;
|
|
26
|
+
exports.Models = __importStar(require("./models"));
|
|
26
27
|
__exportStar(require("./resolvers"), exports);
|
|
27
28
|
exports.utils = __importStar(require("./utils"));
|
|
28
29
|
exports.ERRORS = {
|
package/index.mjs
CHANGED
package/models/User.js
CHANGED
|
@@ -27,6 +27,9 @@ exports.classYearGroup = {
|
|
|
27
27
|
'Beta Tester': EClassYearGroup.CLINICAL,
|
|
28
28
|
};
|
|
29
29
|
function currentClassYear(createdAtUnix, classYear) {
|
|
30
|
+
if (createdAtUnix === 0) {
|
|
31
|
+
throw new Error('createdAt not given in Unix');
|
|
32
|
+
}
|
|
30
33
|
if (!createdAtUnix) {
|
|
31
34
|
return classYear;
|
|
32
35
|
}
|
|
@@ -38,6 +41,9 @@ function currentClassYear(createdAtUnix, classYear) {
|
|
|
38
41
|
const now = new Date();
|
|
39
42
|
const currentYear = now.getFullYear();
|
|
40
43
|
const createdAt = new Date(createdAtUnix * 1000);
|
|
44
|
+
if (createdAt.getFullYear() > now.getFullYear()) {
|
|
45
|
+
throw new Error('createdAt not given in Unix');
|
|
46
|
+
}
|
|
41
47
|
const createdYear = createdAt.getFullYear();
|
|
42
48
|
let yearsAdded = currentYear - createdYear;
|
|
43
49
|
const createdAcademicYear = new Date(createdYear, 7, 1);
|
|
@@ -56,6 +62,9 @@ function currentClassYear(createdAtUnix, classYear) {
|
|
|
56
62
|
exports.currentClassYear = currentClassYear;
|
|
57
63
|
function currentClassGroup(createdAtUnix, classYear) {
|
|
58
64
|
const currentClass = currentClassYear(createdAtUnix, classYear);
|
|
59
|
-
|
|
65
|
+
if (!exports.classYearGroup.hasOwnProperty(currentClass)) {
|
|
66
|
+
return EClassYearGroup.CLINICAL;
|
|
67
|
+
}
|
|
68
|
+
return exports.classYearGroup[currentClass];
|
|
60
69
|
}
|
|
61
70
|
exports.currentClassGroup = currentClassGroup;
|
package/models/User.mjs
CHANGED
|
@@ -24,6 +24,9 @@ export const classYearGroup = {
|
|
|
24
24
|
'Beta Tester': EClassYearGroup.CLINICAL,
|
|
25
25
|
};
|
|
26
26
|
export function currentClassYear(createdAtUnix, classYear) {
|
|
27
|
+
if (createdAtUnix === 0) {
|
|
28
|
+
throw new Error('createdAt not given in Unix');
|
|
29
|
+
}
|
|
27
30
|
if (!createdAtUnix) {
|
|
28
31
|
return classYear;
|
|
29
32
|
}
|
|
@@ -35,6 +38,9 @@ export function currentClassYear(createdAtUnix, classYear) {
|
|
|
35
38
|
const now = new Date();
|
|
36
39
|
const currentYear = now.getFullYear();
|
|
37
40
|
const createdAt = new Date(createdAtUnix * 1000);
|
|
41
|
+
if (createdAt.getFullYear() > now.getFullYear()) {
|
|
42
|
+
throw new Error('createdAt not given in Unix');
|
|
43
|
+
}
|
|
38
44
|
const createdYear = createdAt.getFullYear();
|
|
39
45
|
let yearsAdded = currentYear - createdYear;
|
|
40
46
|
const createdAcademicYear = new Date(createdYear, 7, 1);
|
|
@@ -52,5 +58,8 @@ export function currentClassYear(createdAtUnix, classYear) {
|
|
|
52
58
|
}
|
|
53
59
|
export function currentClassGroup(createdAtUnix, classYear) {
|
|
54
60
|
const currentClass = currentClassYear(createdAtUnix, classYear);
|
|
55
|
-
|
|
61
|
+
if (!classYearGroup.hasOwnProperty(currentClass)) {
|
|
62
|
+
return EClassYearGroup.CLINICAL;
|
|
63
|
+
}
|
|
64
|
+
return classYearGroup[currentClass];
|
|
56
65
|
}
|
package/models/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './Author';
|
|
2
|
+
export * from './Blog';
|
|
2
3
|
export * from './Book';
|
|
3
4
|
export * from './Card';
|
|
4
5
|
export * from './Chapter';
|
|
@@ -21,4 +22,3 @@ export * from './Type';
|
|
|
21
22
|
export * from './University';
|
|
22
23
|
export * from './User';
|
|
23
24
|
export * from './Video';
|
|
24
|
-
export * from './Blog';
|
package/models/index.js
CHANGED
|
@@ -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("./Card"), exports);
|
|
16
17
|
__exportStar(require("./Chapter"), exports);
|
|
@@ -33,4 +34,3 @@ __exportStar(require("./Type"), exports);
|
|
|
33
34
|
__exportStar(require("./University"), exports);
|
|
34
35
|
__exportStar(require("./User"), exports);
|
|
35
36
|
__exportStar(require("./Video"), exports);
|
|
36
|
-
__exportStar(require("./Blog"), exports);
|
package/models/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './Author';
|
|
2
|
+
export * from './Blog';
|
|
2
3
|
export * from './Book';
|
|
3
4
|
export * from './Card';
|
|
4
5
|
export * from './Chapter';
|
|
@@ -21,4 +22,3 @@ export * from './Type';
|
|
|
21
22
|
export * from './University';
|
|
22
23
|
export * from './User';
|
|
23
24
|
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.
|
|
3
|
+
"version": "1.4.27",
|
|
4
4
|
"description": "Typescript types for Quesmed",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"react-native-expo-image-cache": "^4.1.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"graphql": "^16",
|
|
36
|
+
"graphql": "^16.2.0",
|
|
37
|
+
"graphql-ws": "^5.5.5",
|
|
37
38
|
"react": "^17"
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -50,5 +50,8 @@ export interface IOsceMatchmakingVar {
|
|
|
50
50
|
userId: Id;
|
|
51
51
|
}
|
|
52
52
|
export declare const OSCE_MATCHMAKING_USERS: import("@apollo/client").DocumentNode;
|
|
53
|
-
export declare type IOsceMatchmakingUsersData = RootData<
|
|
53
|
+
export declare type IOsceMatchmakingUsersData = RootData<[
|
|
54
|
+
number,
|
|
55
|
+
number
|
|
56
|
+
], 'osceMatchmakingUsers'>;
|
|
54
57
|
export declare type IOsceMatchmakingUsersVar = null;
|
package/utils/index.d.ts
CHANGED
package/utils/index.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.Uuid4 = void 0;
|
|
|
17
17
|
__exportStar(require("./commonFunctions"), exports);
|
|
18
18
|
__exportStar(require("./lightgallery"), exports);
|
|
19
19
|
__exportStar(require("./offlineLink"), exports);
|
|
20
|
+
__exportStar(require("./webSocketLink"), exports);
|
|
20
21
|
__exportStar(require("./wordsToNumber"), exports);
|
|
21
22
|
const uuid4_1 = __importDefault(require("./uuid4"));
|
|
22
23
|
exports.Uuid4 = uuid4_1.default;
|
package/utils/index.mjs
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApolloLink, FetchResult, Observable, Operation } from '@apollo/client/core';
|
|
2
|
+
import { ClientOptions } from 'graphql-ws';
|
|
3
|
+
export declare class WebSocketLink extends ApolloLink {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(options: ClientOptions);
|
|
6
|
+
request(operation: Operation): Observable<FetchResult>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebSocketLink = void 0;
|
|
4
|
+
const core_1 = require("@apollo/client/core");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
const graphql_ws_1 = require("graphql-ws");
|
|
7
|
+
class WebSocketLink extends core_1.ApolloLink {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super();
|
|
10
|
+
this.client = (0, graphql_ws_1.createClient)(options);
|
|
11
|
+
}
|
|
12
|
+
request(operation) {
|
|
13
|
+
return new core_1.Observable((sink) => {
|
|
14
|
+
return this.client.subscribe(Object.assign(Object.assign({}, operation), { query: (0, graphql_1.print)(operation.query) }), {
|
|
15
|
+
next: sink.next.bind(sink),
|
|
16
|
+
complete: sink.complete.bind(sink),
|
|
17
|
+
error: sink.error.bind(sink),
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.WebSocketLink = WebSocketLink;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApolloLink, Observable, } from '@apollo/client/core';
|
|
2
|
+
import { print } from 'graphql';
|
|
3
|
+
import { createClient } from 'graphql-ws';
|
|
4
|
+
export class WebSocketLink extends ApolloLink {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super();
|
|
7
|
+
this.client = createClient(options);
|
|
8
|
+
}
|
|
9
|
+
request(operation) {
|
|
10
|
+
return new Observable((sink) => {
|
|
11
|
+
return this.client.subscribe(Object.assign(Object.assign({}, operation), { query: print(operation.query) }), {
|
|
12
|
+
next: sink.next.bind(sink),
|
|
13
|
+
complete: sink.complete.bind(sink),
|
|
14
|
+
error: sink.error.bind(sink),
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
package/test.d.ts
DELETED
|
File without changes
|
package/test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/test.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|