@based/client 3.3.0 → 4.0.2

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 (211) hide show
  1. package/README.md +32 -336
  2. package/dist/Emitter.d.ts +7 -6
  3. package/dist/Emitter.js +31 -6
  4. package/dist/Emitter.js.map +1 -1
  5. package/dist/authState/parseAuthState.d.ts +3 -0
  6. package/dist/authState/parseAuthState.js +51 -0
  7. package/dist/authState/parseAuthState.js.map +1 -0
  8. package/dist/authState/updateAuthState.d.ts +3 -0
  9. package/dist/authState/updateAuthState.js +15 -0
  10. package/dist/authState/updateAuthState.js.map +1 -0
  11. package/dist/channel/cleanUp.d.ts +2 -0
  12. package/dist/channel/cleanUp.js +32 -0
  13. package/dist/channel/cleanUp.js.map +1 -0
  14. package/dist/channel/index.d.ts +12 -0
  15. package/dist/channel/index.js +67 -0
  16. package/dist/channel/index.js.map +1 -0
  17. package/dist/genObserveId.d.ts +1 -0
  18. package/dist/genObserveId.js +12 -0
  19. package/dist/genObserveId.js.map +1 -0
  20. package/dist/getTargetInfo.d.ts +6 -0
  21. package/dist/getTargetInfo.js +14 -0
  22. package/dist/getTargetInfo.js.map +1 -0
  23. package/dist/getUrlFromOpts.d.ts +3 -0
  24. package/dist/getUrlFromOpts.js +27 -0
  25. package/dist/getUrlFromOpts.js.map +1 -0
  26. package/dist/incoming/debug.d.ts +9 -0
  27. package/dist/incoming/debug.js +132 -0
  28. package/dist/incoming/debug.js.map +1 -0
  29. package/dist/incoming/index.d.ts +2 -0
  30. package/dist/incoming/index.js +341 -0
  31. package/dist/incoming/index.js.map +1 -0
  32. package/dist/incoming/protocol.d.ts +9 -0
  33. package/dist/incoming/protocol.js +62 -0
  34. package/dist/incoming/protocol.js.map +1 -0
  35. package/dist/index.d.ts +70 -127
  36. package/dist/index.js +225 -15
  37. package/dist/index.js.map +1 -1
  38. package/dist/outgoing/debug.d.ts +8 -0
  39. package/dist/outgoing/debug.js +70 -0
  40. package/dist/outgoing/debug.js.map +1 -0
  41. package/dist/outgoing/index.d.ts +14 -0
  42. package/dist/outgoing/index.js +227 -0
  43. package/dist/outgoing/index.js.map +1 -0
  44. package/dist/outgoing/protocol.d.ts +24 -0
  45. package/dist/outgoing/protocol.js +200 -0
  46. package/dist/outgoing/protocol.js.map +1 -0
  47. package/dist/persistentStorage/browser.d.ts +5 -0
  48. package/dist/persistentStorage/browser.js +150 -0
  49. package/dist/persistentStorage/browser.js.map +1 -0
  50. package/dist/persistentStorage/index.d.ts +6 -0
  51. package/dist/persistentStorage/index.js +56 -0
  52. package/dist/persistentStorage/index.js.map +1 -0
  53. package/dist/persistentStorage/node.d.ts +6 -0
  54. package/dist/persistentStorage/node.js +104 -0
  55. package/dist/persistentStorage/node.js.map +1 -0
  56. package/dist/query/index.d.ts +17 -0
  57. package/dist/query/index.js +112 -0
  58. package/dist/query/index.js.map +1 -0
  59. package/dist/stream/fetch.d.ts +4 -0
  60. package/dist/stream/fetch.js +38 -0
  61. package/dist/stream/fetch.js.map +1 -0
  62. package/dist/stream/index.d.ts +4 -0
  63. package/dist/stream/index.js +65 -0
  64. package/dist/stream/index.js.map +1 -0
  65. package/dist/stream/nodeStream.d.ts +6 -0
  66. package/dist/stream/nodeStream.js +114 -0
  67. package/dist/stream/nodeStream.js.map +1 -0
  68. package/dist/stream/types.d.ts +37 -0
  69. package/dist/stream/types.js +8 -0
  70. package/dist/stream/types.js.map +1 -0
  71. package/dist/stream/uploadFileBrowser.d.ts +4 -0
  72. package/dist/stream/uploadFileBrowser.js +106 -0
  73. package/dist/stream/uploadFileBrowser.js.map +1 -0
  74. package/dist/types/auth.d.ts +11 -0
  75. package/dist/{selvaTypes/get.js → types/auth.js} +1 -1
  76. package/dist/types/auth.js.map +1 -0
  77. package/dist/types/cache.d.ts +6 -0
  78. package/dist/{selvaTypes/set.js → types/cache.js} +1 -1
  79. package/dist/types/cache.js.map +1 -0
  80. package/dist/types/channel.d.ts +25 -0
  81. package/dist/types/channel.js +3 -0
  82. package/dist/types/channel.js.map +1 -0
  83. package/dist/types/error.d.ts +37 -0
  84. package/dist/types/error.js +41 -0
  85. package/dist/types/error.js.map +1 -0
  86. package/dist/types/events.d.ts +34 -0
  87. package/dist/{selvaTypes/schema.js → types/events.js} +1 -1
  88. package/dist/types/events.js.map +1 -0
  89. package/dist/types/functions.d.ts +8 -0
  90. package/dist/types/functions.js +3 -0
  91. package/dist/types/functions.js.map +1 -0
  92. package/dist/types/generic.d.ts +22 -0
  93. package/dist/types/generic.js +3 -0
  94. package/dist/types/generic.js.map +1 -0
  95. package/dist/types/index.d.ts +6 -0
  96. package/dist/{subscriptions → types}/index.js +6 -10
  97. package/dist/types/index.js.map +1 -0
  98. package/dist/types/observe.d.ts +46 -0
  99. package/dist/types/observe.js +3 -0
  100. package/dist/types/observe.js.map +1 -0
  101. package/dist/websocket/index.d.ts +1 -1
  102. package/dist/websocket/index.js +19 -5
  103. package/dist/websocket/index.js.map +1 -1
  104. package/dist/websocket/types.d.ts +0 -0
  105. package/dist/websocket/types.js +0 -0
  106. package/dist/websocket/types.js.map +0 -0
  107. package/dist/websocket/urlLoader.d.ts +0 -0
  108. package/dist/websocket/urlLoader.js +0 -0
  109. package/dist/websocket/urlLoader.js.map +0 -0
  110. package/package.json +18 -27
  111. package/dist/Client.d.ts +0 -80
  112. package/dist/Client.js +0 -271
  113. package/dist/Client.js.map +0 -1
  114. package/dist/auth.d.ts +0 -13
  115. package/dist/auth.js +0 -87
  116. package/dist/auth.js.map +0 -1
  117. package/dist/createError.d.ts +0 -3
  118. package/dist/createError.js +0 -67
  119. package/dist/createError.js.map +0 -1
  120. package/dist/debug.d.ts +0 -2
  121. package/dist/debug.js +0 -21
  122. package/dist/debug.js.map +0 -1
  123. package/dist/file/fetch.d.ts +0 -6
  124. package/dist/file/fetch.js +0 -27
  125. package/dist/file/fetch.js.map +0 -1
  126. package/dist/file/getUrl.d.ts +0 -4
  127. package/dist/file/getUrl.js +0 -42
  128. package/dist/file/getUrl.js.map +0 -1
  129. package/dist/file/index.d.ts +0 -6
  130. package/dist/file/index.js +0 -95
  131. package/dist/file/index.js.map +0 -1
  132. package/dist/file/stream/browser.d.ts +0 -7
  133. package/dist/file/stream/browser.js +0 -17
  134. package/dist/file/stream/browser.js.map +0 -1
  135. package/dist/file/stream/index.d.ts +0 -7
  136. package/dist/file/stream/index.js +0 -86
  137. package/dist/file/stream/index.js.map +0 -1
  138. package/dist/file/uploadFileBrowser.d.ts +0 -3
  139. package/dist/file/uploadFileBrowser.js +0 -72
  140. package/dist/file/uploadFileBrowser.js.map +0 -1
  141. package/dist/findPrefix.d.ts +0 -3
  142. package/dist/findPrefix.js +0 -20
  143. package/dist/findPrefix.js.map +0 -1
  144. package/dist/idleTimeout.d.ts +0 -3
  145. package/dist/idleTimeout.js +0 -17
  146. package/dist/idleTimeout.js.map +0 -1
  147. package/dist/observable/index.d.ts +0 -28
  148. package/dist/observable/index.js +0 -84
  149. package/dist/observable/index.js.map +0 -1
  150. package/dist/printBasedObject.d.ts +0 -4
  151. package/dist/printBasedObject.js +0 -76
  152. package/dist/printBasedObject.js.map +0 -1
  153. package/dist/queue.d.ts +0 -5
  154. package/dist/queue.js +0 -53
  155. package/dist/queue.js.map +0 -1
  156. package/dist/request.d.ts +0 -6
  157. package/dist/request.js +0 -67
  158. package/dist/request.js.map +0 -1
  159. package/dist/selvaTypes/get.d.ts +0 -97
  160. package/dist/selvaTypes/get.js.map +0 -1
  161. package/dist/selvaTypes/schema.d.ts +0 -89
  162. package/dist/selvaTypes/schema.js.map +0 -1
  163. package/dist/selvaTypes/set.d.ts +0 -73
  164. package/dist/selvaTypes/set.js.map +0 -1
  165. package/dist/subscriptions/addGetSubscriber.d.ts +0 -3
  166. package/dist/subscriptions/addGetSubscriber.js +0 -87
  167. package/dist/subscriptions/addGetSubscriber.js.map +0 -1
  168. package/dist/subscriptions/addSubscriber.d.ts +0 -2
  169. package/dist/subscriptions/addSubscriber.js +0 -136
  170. package/dist/subscriptions/addSubscriber.js.map +0 -1
  171. package/dist/subscriptions/generateId.d.ts +0 -1
  172. package/dist/subscriptions/generateId.js +0 -11
  173. package/dist/subscriptions/generateId.js.map +0 -1
  174. package/dist/subscriptions/incomingSubscription.d.ts +0 -3
  175. package/dist/subscriptions/incomingSubscription.js +0 -87
  176. package/dist/subscriptions/incomingSubscription.js.map +0 -1
  177. package/dist/subscriptions/incomingSubscriptionDiff.d.ts +0 -3
  178. package/dist/subscriptions/incomingSubscriptionDiff.js +0 -85
  179. package/dist/subscriptions/incomingSubscriptionDiff.js.map +0 -1
  180. package/dist/subscriptions/index.d.ts +0 -10
  181. package/dist/subscriptions/index.js.map +0 -1
  182. package/dist/subscriptions/logoutSubscriptions.d.ts +0 -3
  183. package/dist/subscriptions/logoutSubscriptions.js +0 -36
  184. package/dist/subscriptions/logoutSubscriptions.js.map +0 -1
  185. package/dist/subscriptions/removeSendSubscriptionDataFromQueue.d.ts +0 -2
  186. package/dist/subscriptions/removeSendSubscriptionDataFromQueue.js +0 -14
  187. package/dist/subscriptions/removeSendSubscriptionDataFromQueue.js.map +0 -1
  188. package/dist/subscriptions/removeSubscriber.d.ts +0 -2
  189. package/dist/subscriptions/removeSubscriber.js +0 -44
  190. package/dist/subscriptions/removeSubscriber.js.map +0 -1
  191. package/dist/subscriptions/removeUnsubscribesFromQueue.d.ts +0 -2
  192. package/dist/subscriptions/removeUnsubscribesFromQueue.js +0 -14
  193. package/dist/subscriptions/removeUnsubscribesFromQueue.js.map +0 -1
  194. package/dist/subscriptions/sendAllSubscriptions.d.ts +0 -2
  195. package/dist/subscriptions/sendAllSubscriptions.js +0 -114
  196. package/dist/subscriptions/sendAllSubscriptions.js.map +0 -1
  197. package/dist/token.d.ts +0 -4
  198. package/dist/token.js +0 -35
  199. package/dist/token.js.map +0 -1
  200. package/dist/track.d.ts +0 -8
  201. package/dist/track.js +0 -71
  202. package/dist/track.js.map +0 -1
  203. package/docs/auth-based-ui-howto.md +0 -74
  204. package/docs/auth-howto.md +0 -166
  205. package/docs/auth.md +0 -93
  206. package/docs/authorize.md +0 -56
  207. package/docs/files.md +0 -66
  208. package/docs/get-started.md +0 -60
  209. package/docs/get.md +0 -759
  210. package/docs/schema.md +0 -244
  211. package/docs/set.md +0 -652
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Observable = exports.CompoundObservable = void 0;
4
- const subscriptions_1 = require("../subscriptions");
5
- class Subscription {
6
- constructor(client, subscriberId, subId) {
7
- this.closed = false;
8
- this.client = client;
9
- this.subId = subId;
10
- this.subscriberId = subscriberId;
11
- }
12
- unsubscribe() {
13
- this.closed = true;
14
- (0, subscriptions_1.removeSubscriber)(this.client, this.subId, this.subscriberId);
15
- }
16
- }
17
- class CompoundSubscription {
18
- constructor(client, subs) {
19
- this.closed = false;
20
- this.client = client;
21
- this.subs = subs;
22
- }
23
- unsubscribe() {
24
- if (this.closed) {
25
- return;
26
- }
27
- this.closed = true;
28
- for (const sub of this.subs) {
29
- sub.unsubscribe();
30
- }
31
- }
32
- }
33
- class CompoundObservable {
34
- constructor(client, components) {
35
- this.client = client;
36
- this.components = components;
37
- }
38
- subscribe(onNext, onError,
39
- // eslint-disable-next-line
40
- onComplete) {
41
- const sharedResult = { data: {} };
42
- const subs = [];
43
- for (const { key, obs } of this.components) {
44
- const sub = obs.subscribe((d) => {
45
- if (key === '') {
46
- Object.assign(sharedResult.data, d);
47
- onNext(sharedResult);
48
- return;
49
- }
50
- sharedResult.data[key] = d;
51
- onNext(sharedResult);
52
- }, onError);
53
- subs.push(sub);
54
- }
55
- return new CompoundSubscription(this.client, subs);
56
- }
57
- }
58
- exports.CompoundObservable = CompoundObservable;
59
- class Observable {
60
- constructor(client, a, b) {
61
- this.client = client;
62
- this.subId =
63
- typeof a === 'string'
64
- ? (0, subscriptions_1.generateSubscriptionId)(b, a)
65
- : (0, subscriptions_1.generateSubscriptionId)(a);
66
- this.name = typeof a === 'string' ? a : null;
67
- this.payload = typeof a === 'string' ? b : a;
68
- }
69
- subscribe(onNext, onError,
70
- // eslint-disable-next-line
71
- onComplete) {
72
- const [, subscriberId] = (0, subscriptions_1.addSubscriber)(this.client, this.payload, onNext, (err) => {
73
- if (err) {
74
- console.error(err);
75
- if (onError) {
76
- onError(err);
77
- }
78
- }
79
- }, onError, this.subId, this.name);
80
- return new Subscription(this.client, subscriberId, this.subId);
81
- }
82
- }
83
- exports.Observable = Observable;
84
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observable/index.ts"],"names":[],"mappings":";;;AAIA,oDAIyB;AAMzB,MAAM,YAAY;IAIhB,YAAY,MAAmB,EAAE,YAAoB,EAAE,KAAa;QAW7D,WAAM,GAAY,KAAK,CAAA;QAV5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,WAAW;QACT,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAA,gCAAgB,EAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IAC9D,CAAC;CAGF;AAED,MAAM,oBAAoB;IAIxB,YAAY,MAAmB,EAAE,IAAqB;QAiB/C,WAAM,GAAY,KAAK,CAAA;QAhB5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,OAAM;SACP;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAElB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE;YAC3B,GAAG,CAAC,WAAW,EAAE,CAAA;SAClB;IACH,CAAC;CAGF;AAYD,MAAa,kBAAkB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AC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED,SAAS,CACP,MAAsB,EACtB,OAA8B;IAC9B,2BAA2B;IAC3B,UAA8B;QAE9B,MAAM,CAAC,EAAE,YAAY,CAAC,GAAG,IAAA,6BAAa,EACpC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,OAAO,EACZ,MAAM,EACN,CAAC,GAAG,EAAE,EAAE;YACN,IAAI,GAAG,EAAE;gBACP,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBAClB,IAAI,OAAO,EAAE;oBACX,OAAO,CAAC,GAAG,CAAC,CAAA;iBACb;aACF;QACH,CAAC,EACD,OAAO,EACP,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,IAAI,CACV,CAAA;QACD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IAChE,CAAC;CAUF;AAzDD,gCAyDC"}
@@ -1,4 +0,0 @@
1
- import { GenericObject } from '@based/types';
2
- export declare const color: (str: string, color: 'white' | 'blue' | 'red' | 'green' | 'brightBlue' | 'brightRed') => string;
3
- declare const printBasedObject: (obj: GenericObject, indent?: number, noBrackets?: boolean, name?: string, isError?: boolean) => string[];
4
- export default printBasedObject;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.color = void 0;
4
- const color = (str, color) => {
5
- if (typeof window !== 'undefined') {
6
- // can also add colors / styling in console
7
- return str;
8
- }
9
- const colors = {
10
- white: '\u001b[37;1m',
11
- reset: '\u001b[0m',
12
- blue: '\u001b[34m',
13
- red: '\u001b[31m',
14
- green: '\u001b[32m',
15
- brightBlue: '\u001b[34;1m',
16
- brightRed: '\u001b[31;1m',
17
- };
18
- return `${colors[color]}${str}${colors.reset}`;
19
- };
20
- exports.color = color;
21
- const printBasedObject = (obj, indent = 0, noBrackets = false, name = '', isError = false) => {
22
- let prefix = '';
23
- for (let i = 0; i < indent; i++) {
24
- prefix += ' ';
25
- }
26
- const lines = noBrackets
27
- ? []
28
- : name
29
- ? [prefix + `${(0, exports.color)(name, isError ? 'brightRed' : 'white')} {`]
30
- : [prefix + '{'];
31
- let needComma = false;
32
- if (!noBrackets) {
33
- prefix += ' ';
34
- indent += 1;
35
- }
36
- for (const k in obj) {
37
- const value = obj[k];
38
- const field = k[0] === '$' ? (0, exports.color)(k, 'white') : k;
39
- if (needComma) {
40
- lines[lines.length - 1] += ',';
41
- }
42
- if (Array.isArray(value)) {
43
- lines.push(`${prefix} ${field}: [`);
44
- for (let i = 0; i < value.length; i++) {
45
- const v = value[i];
46
- lines.push(...(v && typeof v === 'object'
47
- ? printBasedObject(v, indent + 4)
48
- : [`${prefix} ${v}`]));
49
- if (i !== value.length - 1) {
50
- lines[lines.length - 1] += ',';
51
- }
52
- }
53
- lines.push(`${prefix} ]`);
54
- }
55
- else if (value && typeof value === 'object') {
56
- lines.push(`${prefix} ${field}: {`);
57
- lines.push(...printBasedObject(value, indent + 2, true));
58
- lines.push(`${prefix} }`);
59
- }
60
- else {
61
- // if (typeof value === 'number') {
62
- // value = color(String(value), 'green')
63
- // } else if (value === true || value === false) {
64
- // value = color(String(value), 'green')
65
- // }
66
- lines.push(`${prefix} ${field}: ${value}`);
67
- }
68
- needComma = true;
69
- }
70
- if (!noBrackets) {
71
- lines.push(prefix.slice(0, -1) + '}');
72
- }
73
- return lines;
74
- };
75
- exports.default = printBasedObject;
76
- //# sourceMappingURL=printBasedObject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printBasedObject.js","sourceRoot":"","sources":["../src/printBasedObject.ts"],"names":[],"mappings":";;;AAEO,MAAM,KAAK,GAAG,CACnB,GAAW,EACX,KA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K,CAAC,IAAI,CAAC,GAAG,MAAM,KAAK,CAAC,CAAA;SAC3B;aAAM;YACL,qCAAqC;YACrC,4CAA4C;YAC5C,oDAAoD;YACpD,4CAA4C;YAC5C,MAAM;YACN,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,KAAK,KAAK,KAAK,KAAK,EAAE,CAAC,CAAA;SAC5C;QACD,SAAS,GAAG,IAAI,CAAA;KACjB;IACD,IAAI,CAAC,UAAU,EAAE;QACf,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAA;KACtC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,kBAAe,gBAAgB,CAAA"}
package/dist/queue.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { BasedClient, TrackMessage } from '.';
2
- import { AuthMessage, Message } from '@based/types';
3
- export declare const addToQueue: (client: BasedClient, msg: Message | TrackMessage | AuthMessage) => void;
4
- export declare const drainQueue: (client: BasedClient) => void;
5
- export declare const stopDrainQueue: (client: BasedClient) => void;
package/dist/queue.js DELETED
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.stopDrainQueue = exports.drainQueue = exports.addToQueue = void 0;
7
- const types_1 = require("@based/types");
8
- const idleTimeout_1 = __importDefault(require("./idleTimeout"));
9
- const addToQueue = (client, msg) => {
10
- if (msg[0] === types_1.RequestTypes.Unsubscribe ||
11
- msg[0] === types_1.RequestTypes.Subscription ||
12
- msg[0] === types_1.RequestTypes.SendSubscriptionData ||
13
- msg[0] === types_1.RequestTypes.GetSubscription) {
14
- client.subscriptionQueue.push(msg);
15
- }
16
- else {
17
- client.queue.push(msg);
18
- }
19
- if (client.connected && !client.drainInProgress) {
20
- (0, exports.drainQueue)(client);
21
- }
22
- };
23
- exports.addToQueue = addToQueue;
24
- const drainQueue = (client) => {
25
- if (client.connected &&
26
- !client.drainInProgress &&
27
- (client.queue.length || client.subscriptionQueue.length) &&
28
- !client.isLogginIn) {
29
- client.drainInProgress = true;
30
- client.drainTimeout = setTimeout(() => {
31
- client.drainInProgress = false;
32
- if (client.queue.length || client.subscriptionQueue.length) {
33
- const queue = [...client.queue, ...client.subscriptionQueue];
34
- client.queue = [];
35
- client.subscriptionQueue = [];
36
- if (client.debugInternal) {
37
- client.debugInternal(queue, 'outgoing');
38
- }
39
- client.connection.ws.send(JSON.stringify(queue));
40
- (0, idleTimeout_1.default)(client);
41
- }
42
- }, 0);
43
- }
44
- };
45
- exports.drainQueue = drainQueue;
46
- const stopDrainQueue = (client) => {
47
- if (client.drainInProgress) {
48
- clearTimeout(client.drainTimeout);
49
- client.drainInProgress = false;
50
- }
51
- };
52
- exports.stopDrainQueue = stopDrainQueue;
53
- //# sourceMappingURL=queue.js.map
package/dist/queue.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":";;;;;;AACA,wCAAiE;AACjE,gEAAuC;AAEhC,MAAM,UAAU,GAAG,CACxB,MAAmB,EACnB,GAAyC,EACzC,EAAE;IACF,IACE,GAAG,CAAC,CAAC,CAAC,KAAK,oBAAY,CAAC,WAAW;QACnC,GAAG,CAAC,CAAC,CAAC,KAAK,oBAAY,CAAC,YAAY;QACpC,GAAG,CAAC,CAAC,CAAC,KAAK,oBAAY,CAAC,oBAAoB;QAC5C,GAAG,CAAC,CAAC,CAAC,KAAK,oBAAY,CAAC,eAAe,EACvC;QACA,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACnC;SAAM;QACL,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACvB;IACD,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,eAAe,EAA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AAM,CAAC,eAAe,GAAG,KAAK,CAAA;KAC/B;AACH,CAAC,CAAA;AALY,QAAA,cAAc,kBAK1B"}
package/dist/request.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { BasedClient } from '.';
2
- import { RequestData, RequestTypes } from '@based/types';
3
- export declare const addRequest: (client: BasedClient, type: Exclude<RequestTypes, RequestTypes.Subscription | RequestTypes.SubscriptionDiff | RequestTypes.SendSubscriptionData | RequestTypes.Unsubscribe | RequestTypes.GetSubscription | RequestTypes.Token | RequestTypes.Track>, payload: any, resolve: (val?: any) => void, reject: (err: Error) => void, name?: string, isRetry?: boolean) => void;
4
- export declare const abortRequest: () => void;
5
- export declare const cleanUpRequests: () => void;
6
- export declare const incomingRequest: (client: BasedClient, data: RequestData) => void;
package/dist/request.js DELETED
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.incomingRequest = exports.cleanUpRequests = exports.abortRequest = exports.addRequest = void 0;
7
- const queue_1 = require("./queue");
8
- const types_1 = require("@based/types");
9
- const createError_1 = __importDefault(require("./createError"));
10
- let requestIdCnt = 0;
11
- const addRequest = (client, type,
12
- // TODO: Changed to Exclude so don't have to update
13
- // these lists every time.
14
- // Check why the above should not be here. Maybe create it's own type
15
- // old:
16
- // | RequestTypes.Set
17
- // | RequestTypes.Get
18
- // | RequestTypes.Configuration
19
- // | RequestTypes.GetConfiguration
20
- // | RequestTypes.Delete
21
- // | RequestTypes.Copy
22
- // | RequestTypes.Digest
23
- // | RequestTypes.Call
24
- // | RequestTypes.RemoveType
25
- // | RequestTypes.RemoveField
26
- // | RequestTypes.Auth,
27
- payload, resolve, reject, name, isRetry) => {
28
- const id = ++requestIdCnt;
29
- client.requestCallbacks[id] = {
30
- resolve,
31
- reject,
32
- type,
33
- payload,
34
- name,
35
- isRetry,
36
- };
37
- if (type === types_1.RequestTypes.Call) {
38
- (0, queue_1.addToQueue)(client, [type, name, id, payload]);
39
- }
40
- else {
41
- (0, queue_1.addToQueue)(client, [type, id, payload]);
42
- }
43
- };
44
- exports.addRequest = addRequest;
45
- const abortRequest = () => {
46
- // if its still in queue remove from queue
47
- };
48
- exports.abortRequest = abortRequest;
49
- const cleanUpRequests = () => {
50
- // on re-connect and not in queue anymore - need to remove in that case
51
- };
52
- exports.cleanUpRequests = cleanUpRequests;
53
- const incomingRequest = (client, data) => {
54
- const [, reqId, payload, err] = data;
55
- const cb = client.requestCallbacks[reqId];
56
- if (cb) {
57
- delete client.requestCallbacks[reqId];
58
- if (err) {
59
- cb.reject((0, createError_1.default)(err));
60
- }
61
- else {
62
- cb.resolve(payload);
63
- }
64
- }
65
- };
66
- exports.incomingRequest = incomingRequest;
67
- //# sourceMappingURL=request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":";;;;;;AACA,mCAAoC;AACpC,wCAAwD;AACxD,gEAAuC;AAEvC,IAAI,YAAY,GAAG,CAAC,CAAA;AAEb,MAAM,UAAU,GAAG,CACxB,MAAmB,EACnB,IASC;AACD,mDAAmD;AACnD,0BAA0B;AAC1B,qEAAqE;AACrE,OAAO;AACP,qBAAqB;AACrB,qBAAqB;AACrB,+BAA+B;AAC/B,kCAAkC;AAClC,wBAAwB;AACxB,sBAAsB;AACtB,wBAAwB;AACxB,sBAAsB;AACtB,4BAA4B;AAC5B,6BAA6B;AAC7B,uBAAuB;AACvB,OAAY,EACZ,OAA4B,EAC5B,MAA4B,EAC5B,IAAa,EACb,OAAiB,EACjB,EAAE;IACF,MAAM,EAAE,GAAG,EAAE,YAAY,CAAA;IACzB,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG;QAC5B,OAAO;QACP,MAAM;QACN,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,OAAO;KACR,CAAA;IAED,IAAI,IAAI,KAAK,oBAAY,CAAC,IAAI,EAAE;QAC9B,IAAA,kBAAU,EAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAA;KAC9C;SAAM;QACL,IAAA,kBAAU,EAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAA;KACxC;AACH,CAAC,CAAA;AAhDY,QAAA,UAAU,cAgDtB;AAEM,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,0CAA0C;AAC5C,CAAC,CAAA;AAFY,QAAA,YAAY,gBAExB;AAEM,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,uEAAuE;AACzE,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B;AAEM,MAAM,eAAe,GAAG,CAAC,MAAmB,EAAE,IAAiB,EAAE,EAAE;IACxE,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;IAEpC,MAAM,EAAE,GAAG,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACzC,IAAI,EAAE,EAAE;QACN,OAAO,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;QACrC,IAAI,GAAG,EAAE;YACP,EAAE,CAAC,MAAM,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,CAAA;SAC5B;aAAM;YACL,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;SACpB;KACF;AACH,CAAC,CAAA;AAZY,QAAA,eAAe,mBAY3B"}
@@ -1,97 +0,0 @@
1
- declare type Id = string;
2
- export declare type Value = (string | number) | (string | number)[];
3
- export declare type FilterAST = {
4
- $field: string;
5
- $operator: '=' | '>' | '<' | '..' | '!=' | 'has' | 'distance' | 'exists' | 'notExists' | 'textSearch';
6
- $value?: Value;
7
- hasNow?: true;
8
- };
9
- export declare type Fork = {
10
- $and?: (Fork | FilterAST)[];
11
- $or?: (Fork | FilterAST)[];
12
- ids?: string[];
13
- isFork: true;
14
- };
15
- export declare type Inherit = boolean | {
16
- $type?: string | string[];
17
- $item?: Id | Id[];
18
- $merge?: boolean;
19
- $deepMerge?: boolean;
20
- $required?: Id | Id[];
21
- };
22
- export declare type GeoFilter = {
23
- $operator: 'distance';
24
- $field: string;
25
- $value: {
26
- $lat: number;
27
- $lon: number;
28
- $radius: number;
29
- };
30
- $and?: Filter;
31
- $or?: Filter;
32
- };
33
- export declare type ExistsFilter = {
34
- $operator: 'exists' | 'notExists';
35
- $field: string;
36
- $value?: undefined;
37
- $and?: Filter;
38
- $or?: Filter;
39
- };
40
- export declare type Filter = ExistsFilter | GeoFilter | {
41
- $operator: '=' | '!=' | '>' | '<' | '..' | 'has' | 'textSearch';
42
- $field: string;
43
- $value: string | number | (string | number)[];
44
- $and?: Filter;
45
- $or?: Filter;
46
- };
47
- export declare type TraverseOptions = {
48
- $db?: string;
49
- $id?: string;
50
- $field: string;
51
- };
52
- export declare type Find = {
53
- $db?: string;
54
- $traverse?: 'descendants' | 'ancestors' | string | string[] | TraverseOptions;
55
- $filter?: Filter | Filter[];
56
- $find?: Find;
57
- };
58
- export declare type Sort = {
59
- $field: string;
60
- $order?: 'asc' | 'desc';
61
- };
62
- export declare type List = true | {
63
- $offset?: number;
64
- $limit?: number;
65
- $sort?: Sort | Sort[];
66
- $find?: Find;
67
- $inherit?: Inherit;
68
- };
69
- export declare type GetField<T> = {
70
- $field?: string | string[];
71
- $inherit?: Inherit;
72
- $list?: List;
73
- $find?: Find;
74
- $default?: T;
75
- $all?: boolean;
76
- $value?: any;
77
- };
78
- export declare type Item = {
79
- [key: string]: any;
80
- };
81
- export declare type GetItem<T = Item> = {
82
- [P in keyof T]?: T[P] extends Item[] ? GetItem<T>[] | true : T[P] extends object ? (GetItem<T[P]> & GetField<T>) | true : T[P] extends number ? T[P] | GetField<T[P]> | true : T[P] extends string ? T[P] | GetField<T[P]> | true : T[P] extends boolean ? T[P] | GetField<T[P]> : (T[P] & GetField<T[P]>) | true;
83
- } & GetField<T> & {
84
- [key: string]: any;
85
- };
86
- export declare type GetOptions = GetItem & {
87
- $trigger?: {
88
- $event: 'created' | 'updated' | 'deleted';
89
- $filter?: Filter;
90
- };
91
- $id?: Id | Id[];
92
- $alias?: string | string[];
93
- $version?: string;
94
- $language?: string;
95
- $rawAncestors?: true;
96
- };
97
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/selvaTypes/get.ts"],"names":[],"mappings":""}
@@ -1,89 +0,0 @@
1
- export declare type Id = string;
2
- export declare type TypesDb = {
3
- idSize: number;
4
- } & {
5
- [key: string]: string;
6
- };
7
- export declare type GetSchemaResult = {
8
- schema: Schema;
9
- searchIndexes: SearchIndexes;
10
- };
11
- export declare type FieldType = 'float' | 'boolean' | 'number' | 'int' | 'reference' | 'references' | 'string' | 'text' | 'id' | 'digest' | 'url' | 'email' | 'phone' | 'geo' | 'type' | 'timestamp';
12
- export declare type SearchSchema = Record<string, string[]>;
13
- export declare type SearchIndexes = Record<string, SearchSchema>;
14
- export declare type Search = {
15
- index?: string;
16
- type: ('EXISTS' | 'TAG' | 'TEXT' | 'NUMERIC' | 'SORTABLE' | 'TEXT-LANGUAGE' | 'TEXT-LANGUAGE-SUG')[];
17
- } | true;
18
- export declare type SearchRaw = {
19
- index?: string;
20
- type: ('EXISTS' | 'TAG' | 'TEXT' | 'NUMERIC' | 'SORTABLE' | 'TEXT-LANGUAGE' | 'GEO' | 'TEXT-LANGUAGE-SUG')[];
21
- };
22
- export declare type FieldSchemaObject = {
23
- type: 'object';
24
- properties: {
25
- [key: string]: FieldSchema;
26
- };
27
- meta?: any;
28
- };
29
- export declare type FieldSchemaJson = {
30
- type: 'json';
31
- properties?: {
32
- [key: string]: FieldSchema;
33
- };
34
- search?: SearchRaw | Search;
35
- meta?: any;
36
- };
37
- export declare type FieldSchemaRecord = {
38
- type: 'record';
39
- values: FieldSchema;
40
- search?: SearchRaw | Search;
41
- meta?: any;
42
- };
43
- export declare type FieldSchemaOther = {
44
- search?: SearchRaw | Search;
45
- type: FieldType;
46
- meta?: any;
47
- };
48
- export declare type FieldSchemaArrayLike = {
49
- search?: {
50
- index?: string;
51
- type: 'TAG'[];
52
- };
53
- type: 'set' | 'array';
54
- items: FieldSchema;
55
- meta?: any;
56
- };
57
- export declare type FieldSchema = FieldSchemaObject | FieldSchemaJson | FieldSchemaArrayLike | FieldSchemaOther | FieldSchemaRecord;
58
- export declare type Fields = Record<string, FieldSchema>;
59
- export declare type HierarchySchema = false | {
60
- [key: string]: false | {
61
- excludeAncestryWith: string[];
62
- } | {
63
- includeAncestryWith: string[];
64
- };
65
- };
66
- export declare type TypeSchema = {
67
- prefix?: string;
68
- hierarchy?: HierarchySchema;
69
- fields?: Fields;
70
- };
71
- export declare type Types = {
72
- [key: string]: TypeSchema;
73
- };
74
- export declare type Schema = {
75
- sha?: string;
76
- languages?: string[];
77
- types: Types;
78
- rootType: Pick<TypeSchema, 'fields' | 'prefix'>;
79
- idSeedCounter?: number;
80
- prefixToTypeMapping?: Record<string, string>;
81
- };
82
- export declare type SchemaOptions = {
83
- sha?: string;
84
- languages?: string[];
85
- types?: Types;
86
- rootType: Pick<TypeSchema, 'fields' | 'prefix'>;
87
- idSeedCounter?: number;
88
- prefixToTypeMapping?: Record<string, string>;
89
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/selvaTypes/schema.ts"],"names":[],"mappings":""}
@@ -1,73 +0,0 @@
1
- declare type Id = string;
2
- export declare type BaseItem = {
3
- [key: string]: any;
4
- };
5
- export declare type ExternalId = string;
6
- export declare type RedisSetParams = Id[] | {
7
- $value?: string[] | Id;
8
- $add?: Id[] | Id | SetItem[];
9
- $delete?: Id[] | Id | true;
10
- $noRoot?: boolean;
11
- };
12
- export declare type HierarchySet = RedisSetParams & {
13
- $hierarchy?: boolean;
14
- };
15
- export declare type SetExtraOptions<T> = {
16
- $default?: T;
17
- $value?: T;
18
- $merge?: boolean;
19
- $field?: string | string[];
20
- $source?: string | {
21
- $overwrite?: boolean | string[];
22
- $name: string;
23
- };
24
- };
25
- export declare type SetExtraCounterOptions = {
26
- $increment?: number;
27
- };
28
- export declare type SetItem<T = BaseItem> = {
29
- [P in keyof T]?: T[P] extends BaseItem[] ? SetItem<T>[] : T[P] extends object ? SetItem<T[P]> & SetExtraOptions<T> : T[P] extends number ? T[P] | (SetExtraOptions<T[P]> & SetExtraCounterOptions) : T[P] extends string ? T[P] | SetExtraOptions<T[P]> : T[P] extends boolean ? T[P] | SetExtraOptions<T[P]> : T[P] | (T[P] & SetExtraOptions<T[P]>);
30
- };
31
- export declare type BatchRefFieldOpts = {
32
- resetReference?: string;
33
- last?: boolean;
34
- };
35
- export declare type BatchOpts = {
36
- batchId: string;
37
- refField?: BatchRefFieldOpts;
38
- last?: boolean;
39
- };
40
- export declare type SetOptions = SetItem & {
41
- $id?: Id;
42
- $operation?: 'upsert' | 'insert' | 'update';
43
- $_batchOpts?: BatchOpts;
44
- $language?: string;
45
- $merge?: boolean;
46
- $version?: string;
47
- children?: HierarchySet | SetItem[];
48
- parents?: HierarchySet | SetItem[];
49
- externalId?: ExternalId[] | {
50
- $add?: ExternalId[] | ExternalId;
51
- $delete?: ExternalId[] | ExternalId;
52
- $value?: ExternalId[];
53
- };
54
- auth?: {
55
- password?: string;
56
- google?: string;
57
- facebook?: string;
58
- role?: {
59
- id?: RedisSetParams;
60
- type?: 'admin' | 'owner' | 'user';
61
- };
62
- };
63
- };
64
- export declare type SetMetaResponse = {
65
- id: string;
66
- updated: boolean;
67
- fields: {
68
- changed: Set<string>;
69
- unchanged: Set<string>;
70
- errored: Record<string, string>;
71
- };
72
- };
73
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"set.js","sourceRoot":"","sources":["../../src/selvaTypes/set.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import { BasedClient } from '..';
2
- import { GenericObject } from '@based/types';
3
- export declare const addGetSubscriber: (client: BasedClient, query: any, onInitial: (err: Error | null, subscriptionId?: number, subscriberId?: number, data?: GenericObject) => void, subscriptionId?: number, name?: string) => void;