prostgles-types 4.0.113 → 4.0.115

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/lib/md5.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  // @ts-ignore
2
2
  export function md5cycle(x, k) {
3
- var a = x[0], b = x[1], c = x[2], d = x[3];
3
+ var a = x[0],
4
+ b = x[1],
5
+ c = x[2],
6
+ d = x[3];
4
7
 
5
8
  a = ff(a, b, c, d, k[0], 7, -680876936);
6
9
  d = ff(d, a, b, c, k[1], 12, -389564586);
@@ -74,7 +77,6 @@ export function md5cycle(x, k) {
74
77
  x[1] = add32(b, x[1]);
75
78
  x[2] = add32(c, x[2]);
76
79
  x[3] = add32(d, x[3]);
77
-
78
80
  }
79
81
 
80
82
  // @ts-ignore
@@ -85,12 +87,12 @@ function cmn(q, a, b, x, s, t) {
85
87
 
86
88
  // @ts-ignore
87
89
  function ff(a, b, c, d, x, s, t) {
88
- return cmn((b & c) | ((~b) & d), a, b, x, s, t);
90
+ return cmn((b & c) | (~b & d), a, b, x, s, t);
89
91
  }
90
92
 
91
93
  // @ts-ignore
92
94
  function gg(a, b, c, d, x, s, t) {
93
- return cmn((b & d) | (c & (~d)), a, b, x, s, t);
95
+ return cmn((b & d) | (c & ~d), a, b, x, s, t);
94
96
  }
95
97
 
96
98
  // @ts-ignore
@@ -100,21 +102,21 @@ function hh(a, b, c, d, x, s, t) {
100
102
 
101
103
  // @ts-ignore
102
104
  function ii(a, b, c, d, x, s, t) {
103
- return cmn(c ^ (b | (~d)), a, b, x, s, t);
105
+ return cmn(c ^ (b | ~d), a, b, x, s, t);
104
106
  }
105
107
 
106
108
  // @ts-ignore
107
109
  function md51(s) {
108
110
  var n = s.length,
109
- state = [1732584193, -271733879, -1732584194, 271733878], i;
111
+ state = [1732584193, -271733879, -1732584194, 271733878],
112
+ i;
110
113
  for (i = 64; i <= s.length; i += 64) {
111
114
  md5cycle(state, md5blk(s.substring(i - 64, i)));
112
115
  }
113
116
  s = s.substring(i - 64);
114
117
  var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
115
- for (i = 0; i < s.length; i++)
116
- tail[i >> 2]! |= s.charCodeAt(i) << ((i % 4) << 3);
117
- tail[i >> 2]! |= 0x80 << ((i % 4) << 3);
118
+ for (i = 0; i < s.length; i++) tail[i >> 2]! |= s.charCodeAt(i) << (i % 4 << 3);
119
+ tail[i >> 2]! |= 0x80 << (i % 4 << 3);
118
120
  if (i > 55) {
119
121
  md5cycle(state, tail);
120
122
  for (i = 0; i < 16; i++) tail[i] = 0;
@@ -140,33 +142,34 @@ function md51(s) {
140
142
  * 8-bit unsigned value arrays.
141
143
  */
142
144
  // @ts-ignore
143
- function md5blk(s) { /* I figured global was faster. */
144
- var md5blks = [], i; /* Andy King said do it this way. */
145
+ function md5blk(s) {
146
+ /* I figured global was faster. */
147
+ var md5blks = [],
148
+ i; /* Andy King said do it this way. */
145
149
  for (i = 0; i < 64; i += 4) {
146
- md5blks[i >> 2] = s.charCodeAt(i)
147
- + (s.charCodeAt(i + 1) << 8)
148
- + (s.charCodeAt(i + 2) << 16)
149
- + (s.charCodeAt(i + 3) << 24);
150
+ md5blks[i >> 2] =
151
+ s.charCodeAt(i) +
152
+ (s.charCodeAt(i + 1) << 8) +
153
+ (s.charCodeAt(i + 2) << 16) +
154
+ (s.charCodeAt(i + 3) << 24);
150
155
  }
151
156
  return md5blks;
152
157
  }
153
158
 
154
- var hex_chr = '0123456789abcdef'.split('');
159
+ var hex_chr = "0123456789abcdef".split("");
155
160
 
156
161
  // @ts-ignore
157
162
  function rhex(n) {
158
- var s = '', j = 0;
159
- for (; j < 4; j++)
160
- s += hex_chr[(n >> (j * 8 + 4)) & 0x0F]!
161
- + hex_chr[(n >> (j * 8)) & 0x0F];
163
+ var s = "",
164
+ j = 0;
165
+ for (; j < 4; j++) s += hex_chr[(n >> (j * 8 + 4)) & 0x0f]! + hex_chr[(n >> (j * 8)) & 0x0f];
162
166
  return s;
163
167
  }
164
168
 
165
169
  // @ts-ignore
166
170
  function hex(x) {
167
- for (var i = 0; i < x.length; i++)
168
- x[i] = rhex(x[i]);
169
- return x.join('');
171
+ for (var i = 0; i < x.length; i++) x[i] = rhex(x[i]);
172
+ return x.join("");
170
173
  }
171
174
 
172
175
  export function md5(s: string) {
@@ -181,14 +184,14 @@ generated by an if clause. */
181
184
 
182
185
  // @ts-ignore
183
186
  function add32(a, b) {
184
- return (a + b) & 0xFFFFFFFF;
187
+ return (a + b) & 0xffffffff;
185
188
  }
186
189
 
187
- if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
190
+ if (md5("hello") != "5d41402abc4b2a76b9719d911017c592") {
188
191
  // @ts-ignore
189
192
  function add32(x, y) {
190
- var lsw = (x & 0xFFFF) + (y & 0xFFFF),
193
+ var lsw = (x & 0xffff) + (y & 0xffff),
191
194
  msw = (x >> 16) + (y >> 16) + (lsw >> 16);
192
- return (msw << 16) | (lsw & 0xFFFF);
195
+ return (msw << 16) | (lsw & 0xffff);
193
196
  }
194
- }
197
+ }
@@ -5,9 +5,9 @@ import { AnyObject } from "./filters";
5
5
  */
6
6
  export type SyncConfig = {
7
7
  id_fields: string[];
8
- synced_field: string;
8
+ synced_field: string;
9
9
  channelName: string;
10
- }
10
+ };
11
11
 
12
12
  /**
13
13
  * If no data on client then will return { c_count: 0 }
@@ -21,36 +21,39 @@ export type ClientSyncInfo = {
21
21
  c_count: number;
22
22
  };
23
23
 
24
- export type onUpdatesParams = {
25
- err?: AnyObject;
26
- } | {
27
-
28
- /**
29
- * TRUE after server had sent/pulled all data and both databases are in sync now.
30
- * Client will notify listeners with all data items
31
- */
32
- isSynced: boolean;
33
- } | {
34
-
35
- /**
36
- * Ordered data
37
- */
38
- data: AnyObject[];
39
- }
24
+ export type onUpdatesParams =
25
+ | {
26
+ err?: AnyObject;
27
+ }
28
+ | {
29
+ /**
30
+ * TRUE after server had sent/pulled all data and both databases are in sync now.
31
+ * Client will notify listeners with all data items
32
+ */
33
+ isSynced: boolean;
34
+ }
35
+ | {
36
+ /**
37
+ * Ordered data
38
+ */
39
+ data: AnyObject[];
40
+ };
40
41
 
41
42
  export type ClientExpressData = Required<ClientSyncInfo> & {
42
43
  data: AnyObject[];
43
- }
44
+ };
44
45
 
45
- export type ClientSyncPullResponse = {
46
- data: AnyObject[];
47
- } | {
48
- err: AnyObject;
49
- }
46
+ export type ClientSyncPullResponse =
47
+ | {
48
+ data: AnyObject[];
49
+ }
50
+ | {
51
+ err: AnyObject;
52
+ };
50
53
 
51
54
  /**
52
55
  * Query sent from server to sync a batch of data
53
- * data must be sorted by
56
+ * data must be sorted by
54
57
  */
55
58
  export type SyncBatchParams = {
56
59
  /**
@@ -74,26 +77,29 @@ export type SyncBatchParams = {
74
77
  * Maxmimum number of rows to take
75
78
  */
76
79
  limit?: number;
77
- }
78
-
80
+ };
79
81
 
80
82
  export type ClientSyncHandles = {
81
83
  /**
82
84
  * Used by client to notify server that data has changed (and send express data if necessary)
83
85
  * Also used by server to request client ClientSyncInfo
84
86
  */
85
- onSyncRequest: (params: SyncBatchParams) => ClientSyncInfo | ClientExpressData | Promise<ClientSyncInfo | ClientExpressData>;
86
-
87
+ onSyncRequest: (
88
+ params: SyncBatchParams
89
+ ) => ClientSyncInfo | ClientExpressData | Promise<ClientSyncInfo | ClientExpressData>;
90
+
87
91
  /**
88
92
  * Used to respond to server with the requested data
89
93
  * @description: server will send { onPullRequest: { from_synced, limit, ...etc } }
90
94
  */
91
- onPullRequest: (params: SyncBatchParams) => ClientSyncPullResponse | Promise<ClientSyncPullResponse>,
92
-
95
+ onPullRequest: (
96
+ params: SyncBatchParams
97
+ ) => ClientSyncPullResponse | Promise<ClientSyncPullResponse>;
98
+
93
99
  /**
94
- * Used to set the data sent by server.
100
+ * Used to set the data sent by server.
95
101
  * Must acknowledge so server can send next batch if necessary
96
102
  * @description: server will send { onUpdates: { data } }
97
103
  */
98
104
  onUpdates: (params: onUpdatesParams) => Promise<true>;
99
- };
105
+ };