@quesmed/types-rn 2.0.4

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.
Files changed (183) hide show
  1. package/gql_input_output_types/User.d.ts +12 -0
  2. package/gql_input_output_types/User.js +2 -0
  3. package/gql_input_output_types/index.d.ts +75 -0
  4. package/gql_input_output_types/index.js +2 -0
  5. package/index.d.ts +22 -0
  6. package/index.js +124 -0
  7. package/models/Author.d.ts +14 -0
  8. package/models/Author.js +2 -0
  9. package/models/Blog.d.ts +15 -0
  10. package/models/Blog.js +2 -0
  11. package/models/Book.d.ts +22 -0
  12. package/models/Book.js +2 -0
  13. package/models/Card.d.ts +16 -0
  14. package/models/Card.js +2 -0
  15. package/models/Chapter.d.ts +15 -0
  16. package/models/Chapter.js +2 -0
  17. package/models/Concept.d.ts +15 -0
  18. package/models/Concept.js +2 -0
  19. package/models/Difficulty.d.ts +6 -0
  20. package/models/Difficulty.js +10 -0
  21. package/models/Feedback.d.ts +8 -0
  22. package/models/Feedback.js +2 -0
  23. package/models/File.d.ts +10 -0
  24. package/models/File.js +2 -0
  25. package/models/Marksheet.d.ts +36 -0
  26. package/models/Marksheet.js +2 -0
  27. package/models/MockTest.d.ts +22 -0
  28. package/models/MockTest.js +2 -0
  29. package/models/OsceMarksheet.d.ts +105 -0
  30. package/models/OsceMarksheet.js +103 -0
  31. package/models/OsceStation.d.ts +54 -0
  32. package/models/OsceStation.js +45 -0
  33. package/models/Picture.d.ts +14 -0
  34. package/models/Picture.js +2 -0
  35. package/models/Promo.d.ts +14 -0
  36. package/models/Promo.js +2 -0
  37. package/models/Question.d.ts +115 -0
  38. package/models/Question.js +43 -0
  39. package/models/Subscription.d.ts +17 -0
  40. package/models/Subscription.js +9 -0
  41. package/models/Todo.d.ts +33 -0
  42. package/models/Todo.js +2 -0
  43. package/models/Token.d.ts +9 -0
  44. package/models/Token.js +2 -0
  45. package/models/Topic.d.ts +32 -0
  46. package/models/Topic.js +13 -0
  47. package/models/Type.d.ts +7 -0
  48. package/models/Type.js +2 -0
  49. package/models/University.d.ts +5 -0
  50. package/models/University.js +2 -0
  51. package/models/User.d.ts +119 -0
  52. package/models/User.js +70 -0
  53. package/models/Video.d.ts +26 -0
  54. package/models/Video.js +2 -0
  55. package/models/index.d.ts +24 -0
  56. package/models/index.js +36 -0
  57. package/package.json +35 -0
  58. package/resolvers/apollo.d.ts +8 -0
  59. package/resolvers/apollo.js +2 -0
  60. package/resolvers/fragments/blog.d.ts +1 -0
  61. package/resolvers/fragments/blog.js +17 -0
  62. package/resolvers/fragments/chapter.d.ts +1 -0
  63. package/resolvers/fragments/chapter.js +25 -0
  64. package/resolvers/fragments/concept.d.ts +3 -0
  65. package/resolvers/fragments/concept.js +79 -0
  66. package/resolvers/fragments/index.d.ts +7 -0
  67. package/resolvers/fragments/index.js +19 -0
  68. package/resolvers/fragments/osce.d.ts +5 -0
  69. package/resolvers/fragments/osce.js +139 -0
  70. package/resolvers/fragments/picture.d.ts +1 -0
  71. package/resolvers/fragments/picture.js +22 -0
  72. package/resolvers/fragments/user.d.ts +1 -0
  73. package/resolvers/fragments/user.js +39 -0
  74. package/resolvers/fragments/video.d.ts +2 -0
  75. package/resolvers/fragments/video.js +58 -0
  76. package/resolvers/index.d.ts +12 -0
  77. package/resolvers/index.js +38 -0
  78. package/resolvers/mutation/admin/algoliaSync.d.ts +9 -0
  79. package/resolvers/mutation/admin/algoliaSync.js +2 -0
  80. package/resolvers/mutation/admin/index.d.ts +2 -0
  81. package/resolvers/mutation/admin/index.js +14 -0
  82. package/resolvers/mutation/admin/token.d.ts +25 -0
  83. package/resolvers/mutation/admin/token.js +2 -0
  84. package/resolvers/mutation/index.d.ts +5 -0
  85. package/resolvers/mutation/index.js +30 -0
  86. package/resolvers/mutation/restricted/agora.d.ts +10 -0
  87. package/resolvers/mutation/restricted/agora.js +11 -0
  88. package/resolvers/mutation/restricted/contactUs.d.ts +17 -0
  89. package/resolvers/mutation/restricted/contactUs.js +2 -0
  90. package/resolvers/mutation/restricted/index.d.ts +10 -0
  91. package/resolvers/mutation/restricted/index.js +22 -0
  92. package/resolvers/mutation/restricted/marksheet.d.ts +41 -0
  93. package/resolvers/mutation/restricted/marksheet.js +2 -0
  94. package/resolvers/mutation/restricted/mockTest.d.ts +16 -0
  95. package/resolvers/mutation/restricted/mockTest.js +2 -0
  96. package/resolvers/mutation/restricted/osce.d.ts +87 -0
  97. package/resolvers/mutation/restricted/osce.js +222 -0
  98. package/resolvers/mutation/restricted/questionDiscussion.d.ts +24 -0
  99. package/resolvers/mutation/restricted/questionDiscussion.js +2 -0
  100. package/resolvers/mutation/restricted/todo.d.ts +32 -0
  101. package/resolvers/mutation/restricted/todo.js +2 -0
  102. package/resolvers/mutation/restricted/token.d.ts +21 -0
  103. package/resolvers/mutation/restricted/token.js +2 -0
  104. package/resolvers/mutation/restricted/users.d.ts +29 -0
  105. package/resolvers/mutation/restricted/users.js +11 -0
  106. package/resolvers/mutation/restricted/video.d.ts +6 -0
  107. package/resolvers/mutation/restricted/video.js +2 -0
  108. package/resolvers/mutation/stripe.d.ts +11 -0
  109. package/resolvers/mutation/stripe.js +2 -0
  110. package/resolvers/mutation/users.d.ts +32 -0
  111. package/resolvers/mutation/users.js +2 -0
  112. package/resolvers/mutation/validUserToken/index.d.ts +1 -0
  113. package/resolvers/mutation/validUserToken/index.js +13 -0
  114. package/resolvers/mutation/validUserToken/user.d.ts +14 -0
  115. package/resolvers/mutation/validUserToken/user.js +2 -0
  116. package/resolvers/query/admin/getUserToken.d.ts +5 -0
  117. package/resolvers/query/admin/getUserToken.js +2 -0
  118. package/resolvers/query/admin/index.d.ts +1 -0
  119. package/resolvers/query/admin/index.js +13 -0
  120. package/resolvers/query/author.d.ts +3 -0
  121. package/resolvers/query/author.js +2 -0
  122. package/resolvers/query/blog.d.ts +15 -0
  123. package/resolvers/query/blog.js +36 -0
  124. package/resolvers/query/book.d.ts +8 -0
  125. package/resolvers/query/book.js +2 -0
  126. package/resolvers/query/feedback.d.ts +3 -0
  127. package/resolvers/query/feedback.js +2 -0
  128. package/resolvers/query/index.d.ts +11 -0
  129. package/resolvers/query/index.js +36 -0
  130. package/resolvers/query/restricted/index.d.ts +10 -0
  131. package/resolvers/query/restricted/index.js +22 -0
  132. package/resolvers/query/restricted/marksheet.d.ts +47 -0
  133. package/resolvers/query/restricted/marksheet.js +2 -0
  134. package/resolvers/query/restricted/mockTests.d.ts +10 -0
  135. package/resolvers/query/restricted/mockTests.js +2 -0
  136. package/resolvers/query/restricted/osce.d.ts +45 -0
  137. package/resolvers/query/restricted/osce.js +118 -0
  138. package/resolvers/query/restricted/quesBook.d.ts +7 -0
  139. package/resolvers/query/restricted/quesBook.js +17 -0
  140. package/resolvers/query/restricted/replication.d.ts +32 -0
  141. package/resolvers/query/restricted/replication.js +184 -0
  142. package/resolvers/query/restricted/todos.d.ts +15 -0
  143. package/resolvers/query/restricted/todos.js +2 -0
  144. package/resolvers/query/restricted/topics.d.ts +10 -0
  145. package/resolvers/query/restricted/topics.js +2 -0
  146. package/resolvers/query/restricted/university.d.ts +15 -0
  147. package/resolvers/query/restricted/university.js +2 -0
  148. package/resolvers/query/restricted/user.d.ts +13 -0
  149. package/resolvers/query/restricted/user.js +2 -0
  150. package/resolvers/query/restricted/video.d.ts +11 -0
  151. package/resolvers/query/restricted/video.js +2 -0
  152. package/resolvers/query/sample.d.ts +26 -0
  153. package/resolvers/query/sample.js +98 -0
  154. package/resolvers/query/subscription.d.ts +3 -0
  155. package/resolvers/query/subscription.js +2 -0
  156. package/resolvers/query/university.d.ts +6 -0
  157. package/resolvers/query/university.js +2 -0
  158. package/resolvers/query/user.d.ts +13 -0
  159. package/resolvers/query/user.js +2 -0
  160. package/resolvers/query/video.d.ts +15 -0
  161. package/resolvers/query/video.js +2 -0
  162. package/resolvers/subscription/index.d.ts +1 -0
  163. package/resolvers/subscription/index.js +13 -0
  164. package/resolvers/subscription/osce.d.ts +66 -0
  165. package/resolvers/subscription/osce.js +108 -0
  166. package/resolvers/types.d.ts +10 -0
  167. package/resolvers/types.js +2 -0
  168. package/utils/commonFunctions.d.ts +9 -0
  169. package/utils/commonFunctions.js +256 -0
  170. package/utils/index.d.ts +9 -0
  171. package/utils/index.js +42 -0
  172. package/utils/lightgallery.d.ts +9 -0
  173. package/utils/lightgallery.js +88 -0
  174. package/utils/offlineLink.d.ts +64 -0
  175. package/utils/offlineLink.js +221 -0
  176. package/utils/random.d.ts +1 -0
  177. package/utils/random.js +20 -0
  178. package/utils/uuid4.d.ts +107 -0
  179. package/utils/uuid4.js +282 -0
  180. package/utils/webSocketLink.d.ts +7 -0
  181. package/utils/webSocketLink.js +22 -0
  182. package/utils/wordsToNumber.d.ts +1 -0
  183. package/utils/wordsToNumber.js +48 -0
package/utils/uuid4.js ADDED
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Uuid4 {
4
+ /**
5
+ * Generate a custom base 64 encoded UUID v4 (random).
6
+ *
7
+ * @param {Uint8Array} [data] Should normally be `undefined` to create a
8
+ * truly random v4 UUID.
9
+ * @returns {string} Returns a custom base 64 encoded UUID v4.
10
+ */
11
+ static asBase64(data) {
12
+ // Add an initial 4 bit zero pad so result is always 22 chars long.
13
+ const binString = '0000' + Uuid4._asBinString(data);
14
+ let result = '';
15
+ let pieces = [
16
+ 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102,
17
+ 108, 114, 120, 126,
18
+ ];
19
+ for (const piece of pieces) {
20
+ result += Uuid4._base64[binString.substr(piece, 6)];
21
+ }
22
+ return result;
23
+ }
24
+ /**
25
+ * Generate a hexadecimal encoded UUID v4 (random).
26
+ *
27
+ * @param {Uint8Array} [data] Should normally be `undefined` to create a
28
+ * truly random v4 UUID.
29
+ * @returns {string} Returns a hexadecimal encoded UUID v4.
30
+ */
31
+ static asHexString(data) {
32
+ const binString = Uuid4._asBinString(data);
33
+ let hexString = '';
34
+ const pieces = [0, 16, 32, 48, 64, 80, 96, 112];
35
+ for (const piece of pieces) {
36
+ hexString += parseInt(binString.substr(piece, 16), 2)
37
+ .toString(16)
38
+ .padStart(4, '0');
39
+ }
40
+ return hexString;
41
+ }
42
+ /**
43
+ * Generate a standard UUID v4 (random).
44
+ *
45
+ * @param {Uint8Array} [data] Should normally be `undefined` to create a
46
+ * truly random v4 UUID.
47
+ * @returns {string} Returns a standard UUID v4.
48
+ */
49
+ static asUuid(data) {
50
+ const hex = Uuid4.asHexString(data);
51
+ return Uuid4.fromHexStringToUuid(hex);
52
+ }
53
+ /**
54
+ * Convert from a base 64 encoded to a hexadecimal encoded UUID.
55
+ *
56
+ * NOTE: This method does not verify input is valid UUID.
57
+ *
58
+ * @param {string} data A base 64 encoded UUID.
59
+ * @returns {string} Returns a hexadecimal encoded UUID.
60
+ */
61
+ static fromBase64ToHexString(data) {
62
+ if (22 !== data.length) {
63
+ const mess = `Expected base 64 number length of 22 characters but was given length: ${data.length}`;
64
+ throw new RangeError(mess);
65
+ }
66
+ // Need switched keys and values so reverse lookups can be done.
67
+ let flipped = {};
68
+ for (const [key, value] of Object.entries(Uuid4._base64)) {
69
+ flipped[value] = key;
70
+ }
71
+ let binString = '';
72
+ for (let i = 0, len = data.length; i < len; ++i) {
73
+ binString += flipped[data[i]];
74
+ }
75
+ // Cut off 4 bit zero padding.
76
+ binString = binString.substr(-128);
77
+ let hexString = '';
78
+ const pieces = [0, 32, 64, 96];
79
+ for (const piece of pieces) {
80
+ hexString += parseInt(binString.substr(piece, 32), 2)
81
+ .toString(16)
82
+ .padStart(8, '0');
83
+ }
84
+ return hexString;
85
+ }
86
+ /**
87
+ * Convert from a base 64 encoded to a standard UUID.
88
+ *
89
+ * NOTE: This method does not verify input is valid UUID.
90
+ *
91
+ * @param {string} data The base 64 encoded UUID.
92
+ * @returns {string} Returns a standard UUID.
93
+ */
94
+ static fromBase64ToUuid(data) {
95
+ const hexString = Uuid4.fromBase64ToHexString(data);
96
+ return Uuid4.fromHexStringToUuid(hexString);
97
+ }
98
+ /**
99
+ * Convert from a hexadecimal encoded to a base 64 encoded UUID.
100
+ *
101
+ * NOTE: This method does not verify input is valid UUID.
102
+ *
103
+ * @param {string} data The hexadecimal encoded UUID.
104
+ * @returns {string} Returns base 64 encoded UUID.
105
+ */
106
+ static fromHexStringToBase64(data) {
107
+ if (32 !== data.length) {
108
+ const mess = `Expected hex string length of 32 characters but was given length: ${data.length}`;
109
+ throw new RangeError(mess);
110
+ }
111
+ let pieces = [0, 4, 8, 12, 16, 20, 24, 28];
112
+ let binString = '0000';
113
+ for (const piece of pieces) {
114
+ binString += parseInt(data.substr(piece, 4), 16)
115
+ .toString(2)
116
+ .padStart(16, '0');
117
+ }
118
+ let result = '';
119
+ pieces = [
120
+ 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102,
121
+ 108, 114, 120, 126,
122
+ ];
123
+ for (const piece of pieces) {
124
+ result += Uuid4._base64[binString.substr(piece, 6)];
125
+ }
126
+ return result;
127
+ }
128
+ /**
129
+ * Convert from a hexadecimal encoded to a standard UUID.
130
+ *
131
+ * NOTE: This method does not verify input is valid UUID.
132
+ *
133
+ * @param {string} data The hexadecimal encoded UUID.
134
+ * @returns {string} Returns a standard UUID.
135
+ */
136
+ static fromHexStringToUuid(data) {
137
+ if (32 !== data.length) {
138
+ const mess = `Expected hex string length of 32 characters but was given length: ${data.length}`;
139
+ throw new RangeError(mess);
140
+ }
141
+ const pieces = [8, 4, 4, 4, 12];
142
+ let start = 0;
143
+ let hexArray = [];
144
+ for (const piece of pieces) {
145
+ hexArray.push(data.substr(start, piece));
146
+ start += piece;
147
+ }
148
+ return hexArray.join('-');
149
+ }
150
+ /**
151
+ * Convert from a standard UUID to a base 64 encoded UUID.
152
+ *
153
+ * NOTE: This method does not verify input is valid UUID.
154
+ *
155
+ * @param {string} data The standard UUID.
156
+ * @returns {string} Returns base 64 encoded UUID.
157
+ */
158
+ static fromUuidToBase64(data) {
159
+ const hexString = data.replace(/-/g, '');
160
+ return Uuid4.fromHexStringToBase64(hexString);
161
+ }
162
+ /**
163
+ * Convert from a standard UUID to a hexadecimal encoded UUID.
164
+ *
165
+ * NOTE: This method does not verify input is valid UUID.
166
+ *
167
+ * @param {string} data The standard UUID.
168
+ * @returns {string} Returns a hexadecimal encoded UUID.
169
+ */
170
+ static fromUuidToHexString(data) {
171
+ return data.replace(/-/g, '');
172
+ }
173
+ get [Symbol.toStringTag]() {
174
+ return 'Uuid4';
175
+ }
176
+ /**
177
+ * Helper method for the common parts of creating new UUID encoded as a binary string.
178
+ *
179
+ * @param {Uint8Array} [data] Should normally be `undefined` to create a
180
+ * truly random v4 UUID.
181
+ * @returns {string} Returns an UUID encoded as a binary string.
182
+ * @private
183
+ */
184
+ static _asBinString(data) {
185
+ let binArray = data ?? Uuid4._getRandomArray();
186
+ if (16 !== binArray.length) {
187
+ const mess = `Expected data array length of 16 but was given length: ${binArray.length}`;
188
+ throw new RangeError(mess);
189
+ }
190
+ binArray[6] = (binArray[6] & 0x0f) | 0x40;
191
+ binArray[8] = (binArray[8] & 0x3f) | 0x80;
192
+ let binary = '';
193
+ for (const piece of binArray) {
194
+ binary += piece.toString(2).padStart(8, '0');
195
+ }
196
+ return binary;
197
+ }
198
+ /**
199
+ * Used to paste over differences in browser vs node secure random number generation.
200
+ *
201
+ * @returns {Uint8Array} Returns a new random number filled Uint8Array.
202
+ * @private
203
+ */
204
+ static _getRandomArray() {
205
+ return Uint8Array.from(Array(16)
206
+ .fill(0)
207
+ .map(() => Math.round(Math.random() * 255)));
208
+ }
209
+ }
210
+ /**
211
+ * Used in mapping from binary to base 64 during encoding.
212
+ *
213
+ * @type {object}
214
+ * @private
215
+ */
216
+ Uuid4._base64 = {
217
+ '000000': 'A',
218
+ '000001': 'B',
219
+ '000010': 'C',
220
+ '000011': 'D',
221
+ '000100': 'E',
222
+ '000101': 'F',
223
+ '000110': 'G',
224
+ '000111': 'H',
225
+ '001000': 'I',
226
+ '001001': 'J',
227
+ '001010': 'K',
228
+ '001011': 'L',
229
+ '001100': 'M',
230
+ '001101': 'N',
231
+ '001110': 'O',
232
+ '001111': 'P',
233
+ '010000': 'Q',
234
+ '010001': 'R',
235
+ '010010': 'S',
236
+ '010011': 'T',
237
+ '010100': 'U',
238
+ '010101': 'V',
239
+ '010110': 'W',
240
+ '010111': 'X',
241
+ '011000': 'Y',
242
+ '011001': 'Z',
243
+ '011010': 'a',
244
+ '011011': 'b',
245
+ '011100': 'c',
246
+ '011101': 'd',
247
+ '011110': 'e',
248
+ '011111': 'f',
249
+ '100000': 'g',
250
+ '100001': 'h',
251
+ '100010': 'i',
252
+ '100011': 'j',
253
+ '100100': 'k',
254
+ '100101': 'l',
255
+ '100110': 'm',
256
+ '100111': 'n',
257
+ '101000': 'o',
258
+ '101001': 'p',
259
+ '101010': 'q',
260
+ '101011': 'r',
261
+ '101100': 's',
262
+ '101101': 't',
263
+ '101110': 'u',
264
+ '101111': 'v',
265
+ '110000': 'w',
266
+ '110001': 'x',
267
+ '110010': 'y',
268
+ '110011': 'z',
269
+ '110100': '0',
270
+ '110101': '1',
271
+ '110110': '2',
272
+ '110111': '3',
273
+ '111000': '4',
274
+ '111001': '5',
275
+ '111010': '6',
276
+ '111011': '7',
277
+ '111100': '8',
278
+ '111101': '9',
279
+ '111110': '-',
280
+ '111111': '_',
281
+ };
282
+ exports.default = Uuid4;
@@ -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({ ...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 @@
1
+ export declare function wordsToNumber(s: string, checkForDigits?: boolean): number;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wordsToNumber = void 0;
4
+ const Small = {
5
+ zero: 0,
6
+ one: 1,
7
+ two: 2,
8
+ three: 3,
9
+ four: 4,
10
+ five: 5,
11
+ six: 6,
12
+ seven: 7,
13
+ eight: 8,
14
+ nine: 9,
15
+ ten: 10,
16
+ eleven: 11,
17
+ twelve: 12,
18
+ thirteen: 13,
19
+ fourteen: 14,
20
+ fifteen: 15,
21
+ sixteen: 16,
22
+ seventeen: 17,
23
+ eighteen: 18,
24
+ nineteen: 19,
25
+ twenty: 20,
26
+ thirty: 30,
27
+ forty: 40,
28
+ fifty: 50,
29
+ sixty: 60,
30
+ seventy: 70,
31
+ eighty: 80,
32
+ ninety: 90,
33
+ };
34
+ function wordsToNumber(s, checkForDigits = false) {
35
+ const words = s.toString().split(/[\s-]+/);
36
+ let total = 0;
37
+ words.forEach((word) => {
38
+ const wordKey = Small[word];
39
+ if (wordKey !== undefined) {
40
+ total += wordKey;
41
+ }
42
+ else if (checkForDigits && !isNaN(parseFloat(word))) {
43
+ total += parseFloat(word);
44
+ }
45
+ });
46
+ return total;
47
+ }
48
+ exports.wordsToNumber = wordsToNumber;