@tanstack/query-broadcast-client-experimental 4.0.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 (43) hide show
  1. package/build/cjs/node_modules/broadcast-channel/dist/es/broadcast-channel.js +260 -0
  2. package/build/cjs/node_modules/broadcast-channel/dist/es/broadcast-channel.js.map +1 -0
  3. package/build/cjs/node_modules/broadcast-channel/dist/es/method-chooser.js +83 -0
  4. package/build/cjs/node_modules/broadcast-channel/dist/es/method-chooser.js.map +1 -0
  5. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/indexed-db.js +325 -0
  6. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/indexed-db.js.map +1 -0
  7. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/localstorage.js +193 -0
  8. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/localstorage.js.map +1 -0
  9. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/native.js +88 -0
  10. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/native.js.map +1 -0
  11. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/simulate.js +77 -0
  12. package/build/cjs/node_modules/broadcast-channel/dist/es/methods/simulate.js.map +1 -0
  13. package/build/cjs/node_modules/broadcast-channel/dist/es/options.js +41 -0
  14. package/build/cjs/node_modules/broadcast-channel/dist/es/options.js.map +1 -0
  15. package/build/cjs/node_modules/broadcast-channel/dist/es/util.js +77 -0
  16. package/build/cjs/node_modules/broadcast-channel/dist/es/util.js.map +1 -0
  17. package/build/cjs/node_modules/oblivious-set/dist/es/index.js +83 -0
  18. package/build/cjs/node_modules/oblivious-set/dist/es/index.js.map +1 -0
  19. package/build/stats-html.html +1 -1
  20. package/build/stats.json +427 -0
  21. package/build/types/query-broadcast-client-experimental/src/index.d.ts +7 -0
  22. package/build/types/query-core/src/focusManager.d.ts +16 -0
  23. package/build/types/query-core/src/hydration.d.ts +34 -0
  24. package/build/types/query-core/src/index.d.ts +20 -0
  25. package/build/types/query-core/src/infiniteQueryBehavior.d.ts +15 -0
  26. package/build/types/query-core/src/infiniteQueryObserver.d.ts +18 -0
  27. package/build/types/query-core/src/logger.d.ts +8 -0
  28. package/build/types/query-core/src/mutation.d.ts +70 -0
  29. package/build/types/query-core/src/mutationCache.d.ts +52 -0
  30. package/build/types/query-core/src/mutationObserver.d.ts +23 -0
  31. package/build/types/query-core/src/notifyManager.d.ts +18 -0
  32. package/build/types/query-core/src/onlineManager.d.ts +16 -0
  33. package/build/types/query-core/src/queriesObserver.d.ts +23 -0
  34. package/build/types/query-core/src/query.d.ts +119 -0
  35. package/build/types/query-core/src/queryCache.d.ts +59 -0
  36. package/build/types/query-core/src/queryClient.d.ts +65 -0
  37. package/build/types/query-core/src/queryObserver.d.ts +61 -0
  38. package/build/types/query-core/src/removable.d.ts +9 -0
  39. package/build/types/query-core/src/retryer.d.ts +33 -0
  40. package/build/types/query-core/src/subscribable.d.ts +10 -0
  41. package/build/types/query-core/src/types.d.ts +417 -0
  42. package/build/types/query-core/src/utils.d.ts +99 -0
  43. package/package.json +2 -2
@@ -0,0 +1,325 @@
1
+ /**
2
+ * query-broadcast-client-experimental
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, '__esModule', { value: true });
14
+
15
+ var util = require('../util.js');
16
+ var index = require('../../../../oblivious-set/dist/es/index.js');
17
+ var options = require('../options.js');
18
+
19
+ /**
20
+ * this method uses indexeddb to store the messages
21
+ * There is currently no observerAPI for idb
22
+ * @link https://github.com/w3c/IndexedDB/issues/51
23
+ */
24
+ var microSeconds = util.microSeconds;
25
+ var DB_PREFIX = 'pubkey.broadcast-channel-0-';
26
+ var OBJECT_STORE_ID = 'messages';
27
+ var type = 'idb';
28
+ function getIdb() {
29
+ if (typeof indexedDB !== 'undefined') return indexedDB;
30
+
31
+ if (typeof window !== 'undefined') {
32
+ if (typeof window.mozIndexedDB !== 'undefined') return window.mozIndexedDB;
33
+ if (typeof window.webkitIndexedDB !== 'undefined') return window.webkitIndexedDB;
34
+ if (typeof window.msIndexedDB !== 'undefined') return window.msIndexedDB;
35
+ }
36
+
37
+ return false;
38
+ }
39
+ function createDatabase(channelName) {
40
+ var IndexedDB = getIdb(); // create table
41
+
42
+ var dbName = DB_PREFIX + channelName;
43
+ var openRequest = IndexedDB.open(dbName, 1);
44
+
45
+ openRequest.onupgradeneeded = function (ev) {
46
+ var db = ev.target.result;
47
+ db.createObjectStore(OBJECT_STORE_ID, {
48
+ keyPath: 'id',
49
+ autoIncrement: true
50
+ });
51
+ };
52
+
53
+ var dbPromise = new Promise(function (res, rej) {
54
+ openRequest.onerror = function (ev) {
55
+ return rej(ev);
56
+ };
57
+
58
+ openRequest.onsuccess = function () {
59
+ res(openRequest.result);
60
+ };
61
+ });
62
+ return dbPromise;
63
+ }
64
+ /**
65
+ * writes the new message to the database
66
+ * so other readers can find it
67
+ */
68
+
69
+ function writeMessage(db, readerUuid, messageJson) {
70
+ var time = new Date().getTime();
71
+ var writeObject = {
72
+ uuid: readerUuid,
73
+ time: time,
74
+ data: messageJson
75
+ };
76
+ var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite');
77
+ return new Promise(function (res, rej) {
78
+ transaction.oncomplete = function () {
79
+ return res();
80
+ };
81
+
82
+ transaction.onerror = function (ev) {
83
+ return rej(ev);
84
+ };
85
+
86
+ var objectStore = transaction.objectStore(OBJECT_STORE_ID);
87
+ objectStore.add(writeObject);
88
+ });
89
+ }
90
+ function getMessagesHigherThan(db, lastCursorId) {
91
+ var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID);
92
+ var ret = [];
93
+
94
+ function openCursor() {
95
+ // Occasionally Safari will fail on IDBKeyRange.bound, this
96
+ // catches that error, having it open the cursor to the first
97
+ // item. When it gets data it will advance to the desired key.
98
+ try {
99
+ var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity);
100
+ return objectStore.openCursor(keyRangeValue);
101
+ } catch (e) {
102
+ return objectStore.openCursor();
103
+ }
104
+ }
105
+
106
+ return new Promise(function (res) {
107
+ openCursor().onsuccess = function (ev) {
108
+ var cursor = ev.target.result;
109
+
110
+ if (cursor) {
111
+ if (cursor.value.id < lastCursorId + 1) {
112
+ cursor["continue"](lastCursorId + 1);
113
+ } else {
114
+ ret.push(cursor.value);
115
+ cursor["continue"]();
116
+ }
117
+ } else {
118
+ res(ret);
119
+ }
120
+ };
121
+ });
122
+ }
123
+ function removeMessageById(db, id) {
124
+ var request = db.transaction([OBJECT_STORE_ID], 'readwrite').objectStore(OBJECT_STORE_ID)["delete"](id);
125
+ return new Promise(function (res) {
126
+ request.onsuccess = function () {
127
+ return res();
128
+ };
129
+ });
130
+ }
131
+ function getOldMessages(db, ttl) {
132
+ var olderThen = new Date().getTime() - ttl;
133
+ var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID);
134
+ var ret = [];
135
+ return new Promise(function (res) {
136
+ objectStore.openCursor().onsuccess = function (ev) {
137
+ var cursor = ev.target.result;
138
+
139
+ if (cursor) {
140
+ var msgObk = cursor.value;
141
+
142
+ if (msgObk.time < olderThen) {
143
+ ret.push(msgObk); //alert("Name for SSN " + cursor.key + " is " + cursor.value.name);
144
+
145
+ cursor["continue"]();
146
+ } else {
147
+ // no more old messages,
148
+ res(ret);
149
+ return;
150
+ }
151
+ } else {
152
+ res(ret);
153
+ }
154
+ };
155
+ });
156
+ }
157
+ function cleanOldMessages(db, ttl) {
158
+ return getOldMessages(db, ttl).then(function (tooOld) {
159
+ return Promise.all(tooOld.map(function (msgObj) {
160
+ return removeMessageById(db, msgObj.id);
161
+ }));
162
+ });
163
+ }
164
+ function create(channelName, options$1) {
165
+ options$1 = options.fillOptionsWithDefaults(options$1);
166
+ return createDatabase(channelName).then(function (db) {
167
+ var state = {
168
+ closed: false,
169
+ lastCursorId: 0,
170
+ channelName: channelName,
171
+ options: options$1,
172
+ uuid: util.randomToken(),
173
+
174
+ /**
175
+ * emittedMessagesIds
176
+ * contains all messages that have been emitted before
177
+ * @type {ObliviousSet}
178
+ */
179
+ eMIs: new index.ObliviousSet(options$1.idb.ttl * 2),
180
+ // ensures we do not read messages in parrallel
181
+ writeBlockPromise: Promise.resolve(),
182
+ messagesCallback: null,
183
+ readQueuePromises: [],
184
+ db: db
185
+ };
186
+ /**
187
+ * Handle abrupt closes that do not originate from db.close().
188
+ * This could happen, for example, if the underlying storage is
189
+ * removed or if the user clears the database in the browser's
190
+ * history preferences.
191
+ */
192
+
193
+ db.onclose = function () {
194
+ state.closed = true;
195
+ if (options$1.idb.onclose) options$1.idb.onclose();
196
+ };
197
+ /**
198
+ * if service-workers are used,
199
+ * we have no 'storage'-event if they post a message,
200
+ * therefore we also have to set an interval
201
+ */
202
+
203
+
204
+ _readLoop(state);
205
+
206
+ return state;
207
+ });
208
+ }
209
+
210
+ function _readLoop(state) {
211
+ if (state.closed) return;
212
+ readNewMessages(state).then(function () {
213
+ return util.sleep(state.options.idb.fallbackInterval);
214
+ }).then(function () {
215
+ return _readLoop(state);
216
+ });
217
+ }
218
+
219
+ function _filterMessage(msgObj, state) {
220
+ if (msgObj.uuid === state.uuid) return false; // send by own
221
+
222
+ if (state.eMIs.has(msgObj.id)) return false; // already emitted
223
+
224
+ if (msgObj.data.time < state.messagesCallbackTime) return false; // older then onMessageCallback
225
+
226
+ return true;
227
+ }
228
+ /**
229
+ * reads all new messages from the database and emits them
230
+ */
231
+
232
+
233
+ function readNewMessages(state) {
234
+ // channel already closed
235
+ if (state.closed) return Promise.resolve(); // if no one is listening, we do not need to scan for new messages
236
+
237
+ if (!state.messagesCallback) return Promise.resolve();
238
+ return getMessagesHigherThan(state.db, state.lastCursorId).then(function (newerMessages) {
239
+ var useMessages = newerMessages
240
+ /**
241
+ * there is a bug in iOS where the msgObj can be undefined some times
242
+ * so we filter them out
243
+ * @link https://github.com/pubkey/broadcast-channel/issues/19
244
+ */
245
+ .filter(function (msgObj) {
246
+ return !!msgObj;
247
+ }).map(function (msgObj) {
248
+ if (msgObj.id > state.lastCursorId) {
249
+ state.lastCursorId = msgObj.id;
250
+ }
251
+
252
+ return msgObj;
253
+ }).filter(function (msgObj) {
254
+ return _filterMessage(msgObj, state);
255
+ }).sort(function (msgObjA, msgObjB) {
256
+ return msgObjA.time - msgObjB.time;
257
+ }); // sort by time
258
+
259
+ useMessages.forEach(function (msgObj) {
260
+ if (state.messagesCallback) {
261
+ state.eMIs.add(msgObj.id);
262
+ state.messagesCallback(msgObj.data);
263
+ }
264
+ });
265
+ return Promise.resolve();
266
+ });
267
+ }
268
+
269
+ function close(channelState) {
270
+ channelState.closed = true;
271
+ channelState.db.close();
272
+ }
273
+ function postMessage(channelState, messageJson) {
274
+ channelState.writeBlockPromise = channelState.writeBlockPromise.then(function () {
275
+ return writeMessage(channelState.db, channelState.uuid, messageJson);
276
+ }).then(function () {
277
+ if (util.randomInt(0, 10) === 0) {
278
+ /* await (do not await) */
279
+ cleanOldMessages(channelState.db, channelState.options.idb.ttl);
280
+ }
281
+ });
282
+ return channelState.writeBlockPromise;
283
+ }
284
+ function onMessage(channelState, fn, time) {
285
+ channelState.messagesCallbackTime = time;
286
+ channelState.messagesCallback = fn;
287
+ readNewMessages(channelState);
288
+ }
289
+ function canBeUsed() {
290
+ if (util.isNode) return false;
291
+ var idb = getIdb();
292
+ if (!idb) return false;
293
+ return true;
294
+ }
295
+ function averageResponseTime(options) {
296
+ return options.idb.fallbackInterval * 2;
297
+ }
298
+ var IndexeDbMethod = {
299
+ create: create,
300
+ close: close,
301
+ onMessage: onMessage,
302
+ postMessage: postMessage,
303
+ canBeUsed: canBeUsed,
304
+ type: type,
305
+ averageResponseTime: averageResponseTime,
306
+ microSeconds: microSeconds
307
+ };
308
+
309
+ exports.averageResponseTime = averageResponseTime;
310
+ exports.canBeUsed = canBeUsed;
311
+ exports.cleanOldMessages = cleanOldMessages;
312
+ exports.close = close;
313
+ exports.create = create;
314
+ exports.createDatabase = createDatabase;
315
+ exports["default"] = IndexeDbMethod;
316
+ exports.getIdb = getIdb;
317
+ exports.getMessagesHigherThan = getMessagesHigherThan;
318
+ exports.getOldMessages = getOldMessages;
319
+ exports.microSeconds = microSeconds;
320
+ exports.onMessage = onMessage;
321
+ exports.postMessage = postMessage;
322
+ exports.removeMessageById = removeMessageById;
323
+ exports.type = type;
324
+ exports.writeMessage = writeMessage;
325
+ //# sourceMappingURL=indexed-db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexed-db.js","sources":["../../../../../../../../../node_modules/broadcast-channel/dist/es/methods/indexed-db.js"],"sourcesContent":["/**\n * this method uses indexeddb to store the messages\n * There is currently no observerAPI for idb\n * @link https://github.com/w3c/IndexedDB/issues/51\n */\nimport { sleep, randomInt, randomToken, microSeconds as micro, isNode } from '../util.js';\nexport var microSeconds = micro;\nimport { ObliviousSet } from 'oblivious-set';\nimport { fillOptionsWithDefaults } from '../options';\nvar DB_PREFIX = 'pubkey.broadcast-channel-0-';\nvar OBJECT_STORE_ID = 'messages';\nexport var type = 'idb';\nexport function getIdb() {\n if (typeof indexedDB !== 'undefined') return indexedDB;\n\n if (typeof window !== 'undefined') {\n if (typeof window.mozIndexedDB !== 'undefined') return window.mozIndexedDB;\n if (typeof window.webkitIndexedDB !== 'undefined') return window.webkitIndexedDB;\n if (typeof window.msIndexedDB !== 'undefined') return window.msIndexedDB;\n }\n\n return false;\n}\nexport function createDatabase(channelName) {\n var IndexedDB = getIdb(); // create table\n\n var dbName = DB_PREFIX + channelName;\n var openRequest = IndexedDB.open(dbName, 1);\n\n openRequest.onupgradeneeded = function (ev) {\n var db = ev.target.result;\n db.createObjectStore(OBJECT_STORE_ID, {\n keyPath: 'id',\n autoIncrement: true\n });\n };\n\n var dbPromise = new Promise(function (res, rej) {\n openRequest.onerror = function (ev) {\n return rej(ev);\n };\n\n openRequest.onsuccess = function () {\n res(openRequest.result);\n };\n });\n return dbPromise;\n}\n/**\n * writes the new message to the database\n * so other readers can find it\n */\n\nexport function writeMessage(db, readerUuid, messageJson) {\n var time = new Date().getTime();\n var writeObject = {\n uuid: readerUuid,\n time: time,\n data: messageJson\n };\n var transaction = db.transaction([OBJECT_STORE_ID], 'readwrite');\n return new Promise(function (res, rej) {\n transaction.oncomplete = function () {\n return res();\n };\n\n transaction.onerror = function (ev) {\n return rej(ev);\n };\n\n var objectStore = transaction.objectStore(OBJECT_STORE_ID);\n objectStore.add(writeObject);\n });\n}\nexport function getAllMessages(db) {\n var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID);\n var ret = [];\n return new Promise(function (res) {\n objectStore.openCursor().onsuccess = function (ev) {\n var cursor = ev.target.result;\n\n if (cursor) {\n ret.push(cursor.value); //alert(\"Name for SSN \" + cursor.key + \" is \" + cursor.value.name);\n\n cursor[\"continue\"]();\n } else {\n res(ret);\n }\n };\n });\n}\nexport function getMessagesHigherThan(db, lastCursorId) {\n var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID);\n var ret = [];\n\n function openCursor() {\n // Occasionally Safari will fail on IDBKeyRange.bound, this\n // catches that error, having it open the cursor to the first\n // item. When it gets data it will advance to the desired key.\n try {\n var keyRangeValue = IDBKeyRange.bound(lastCursorId + 1, Infinity);\n return objectStore.openCursor(keyRangeValue);\n } catch (e) {\n return objectStore.openCursor();\n }\n }\n\n return new Promise(function (res) {\n openCursor().onsuccess = function (ev) {\n var cursor = ev.target.result;\n\n if (cursor) {\n if (cursor.value.id < lastCursorId + 1) {\n cursor[\"continue\"](lastCursorId + 1);\n } else {\n ret.push(cursor.value);\n cursor[\"continue\"]();\n }\n } else {\n res(ret);\n }\n };\n });\n}\nexport function removeMessageById(db, id) {\n var request = db.transaction([OBJECT_STORE_ID], 'readwrite').objectStore(OBJECT_STORE_ID)[\"delete\"](id);\n return new Promise(function (res) {\n request.onsuccess = function () {\n return res();\n };\n });\n}\nexport function getOldMessages(db, ttl) {\n var olderThen = new Date().getTime() - ttl;\n var objectStore = db.transaction(OBJECT_STORE_ID).objectStore(OBJECT_STORE_ID);\n var ret = [];\n return new Promise(function (res) {\n objectStore.openCursor().onsuccess = function (ev) {\n var cursor = ev.target.result;\n\n if (cursor) {\n var msgObk = cursor.value;\n\n if (msgObk.time < olderThen) {\n ret.push(msgObk); //alert(\"Name for SSN \" + cursor.key + \" is \" + cursor.value.name);\n\n cursor[\"continue\"]();\n } else {\n // no more old messages,\n res(ret);\n return;\n }\n } else {\n res(ret);\n }\n };\n });\n}\nexport function cleanOldMessages(db, ttl) {\n return getOldMessages(db, ttl).then(function (tooOld) {\n return Promise.all(tooOld.map(function (msgObj) {\n return removeMessageById(db, msgObj.id);\n }));\n });\n}\nexport function create(channelName, options) {\n options = fillOptionsWithDefaults(options);\n return createDatabase(channelName).then(function (db) {\n var state = {\n closed: false,\n lastCursorId: 0,\n channelName: channelName,\n options: options,\n uuid: randomToken(),\n\n /**\n * emittedMessagesIds\n * contains all messages that have been emitted before\n * @type {ObliviousSet}\n */\n eMIs: new ObliviousSet(options.idb.ttl * 2),\n // ensures we do not read messages in parrallel\n writeBlockPromise: Promise.resolve(),\n messagesCallback: null,\n readQueuePromises: [],\n db: db\n };\n /**\n * Handle abrupt closes that do not originate from db.close().\n * This could happen, for example, if the underlying storage is\n * removed or if the user clears the database in the browser's\n * history preferences.\n */\n\n db.onclose = function () {\n state.closed = true;\n if (options.idb.onclose) options.idb.onclose();\n };\n /**\n * if service-workers are used,\n * we have no 'storage'-event if they post a message,\n * therefore we also have to set an interval\n */\n\n\n _readLoop(state);\n\n return state;\n });\n}\n\nfunction _readLoop(state) {\n if (state.closed) return;\n readNewMessages(state).then(function () {\n return sleep(state.options.idb.fallbackInterval);\n }).then(function () {\n return _readLoop(state);\n });\n}\n\nfunction _filterMessage(msgObj, state) {\n if (msgObj.uuid === state.uuid) return false; // send by own\n\n if (state.eMIs.has(msgObj.id)) return false; // already emitted\n\n if (msgObj.data.time < state.messagesCallbackTime) return false; // older then onMessageCallback\n\n return true;\n}\n/**\n * reads all new messages from the database and emits them\n */\n\n\nfunction readNewMessages(state) {\n // channel already closed\n if (state.closed) return Promise.resolve(); // if no one is listening, we do not need to scan for new messages\n\n if (!state.messagesCallback) return Promise.resolve();\n return getMessagesHigherThan(state.db, state.lastCursorId).then(function (newerMessages) {\n var useMessages = newerMessages\n /**\n * there is a bug in iOS where the msgObj can be undefined some times\n * so we filter them out\n * @link https://github.com/pubkey/broadcast-channel/issues/19\n */\n .filter(function (msgObj) {\n return !!msgObj;\n }).map(function (msgObj) {\n if (msgObj.id > state.lastCursorId) {\n state.lastCursorId = msgObj.id;\n }\n\n return msgObj;\n }).filter(function (msgObj) {\n return _filterMessage(msgObj, state);\n }).sort(function (msgObjA, msgObjB) {\n return msgObjA.time - msgObjB.time;\n }); // sort by time\n\n useMessages.forEach(function (msgObj) {\n if (state.messagesCallback) {\n state.eMIs.add(msgObj.id);\n state.messagesCallback(msgObj.data);\n }\n });\n return Promise.resolve();\n });\n}\n\nexport function close(channelState) {\n channelState.closed = true;\n channelState.db.close();\n}\nexport function postMessage(channelState, messageJson) {\n channelState.writeBlockPromise = channelState.writeBlockPromise.then(function () {\n return writeMessage(channelState.db, channelState.uuid, messageJson);\n }).then(function () {\n if (randomInt(0, 10) === 0) {\n /* await (do not await) */\n cleanOldMessages(channelState.db, channelState.options.idb.ttl);\n }\n });\n return channelState.writeBlockPromise;\n}\nexport function onMessage(channelState, fn, time) {\n channelState.messagesCallbackTime = time;\n channelState.messagesCallback = fn;\n readNewMessages(channelState);\n}\nexport function canBeUsed() {\n if (isNode) return false;\n var idb = getIdb();\n if (!idb) return false;\n return true;\n}\nexport function averageResponseTime(options) {\n return options.idb.fallbackInterval * 2;\n}\nexport default {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};"],"names":["micro","options","fillOptionsWithDefaults","randomToken","ObliviousSet","sleep","randomInt","isNode"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAEU,IAAC,YAAY,GAAGA,kBAAM;AAGhC,IAAI,SAAS,GAAG,6BAA6B,CAAC;AAC9C,IAAI,eAAe,GAAG,UAAU,CAAC;AACvB,IAAC,IAAI,GAAG,MAAM;AACjB,SAAS,MAAM,GAAG;AACzB,EAAE,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,OAAO,SAAS,CAAC;AACzD;AACA,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACrC,IAAI,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,WAAW,EAAE,OAAO,MAAM,CAAC,YAAY,CAAC;AAC/E,IAAI,IAAI,OAAO,MAAM,CAAC,eAAe,KAAK,WAAW,EAAE,OAAO,MAAM,CAAC,eAAe,CAAC;AACrF,IAAI,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE,OAAO,MAAM,CAAC,WAAW,CAAC;AAC7E,GAAG;AACH;AACA,EAAE,OAAO,KAAK,CAAC;AACf,CAAC;AACM,SAAS,cAAc,CAAC,WAAW,EAAE;AAC5C,EAAE,IAAI,SAAS,GAAG,MAAM,EAAE,CAAC;AAC3B;AACA,EAAE,IAAI,MAAM,GAAG,SAAS,GAAG,WAAW,CAAC;AACvC,EAAE,IAAI,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC9C;AACA,EAAE,WAAW,CAAC,eAAe,GAAG,UAAU,EAAE,EAAE;AAC9C,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,IAAI,EAAE,CAAC,iBAAiB,CAAC,eAAe,EAAE;AAC1C,MAAM,OAAO,EAAE,IAAI;AACnB,MAAM,aAAa,EAAE,IAAI;AACzB,KAAK,CA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AK,EAAE,KAAK;AACd,EAAE,SAAS,EAAE,SAAS;AACtB,EAAE,WAAW,EAAE,WAAW;AAC1B,EAAE,SAAS,EAAE,SAAS;AACtB,EAAE,IAAI,EAAE,IAAI;AACZ,EAAE,mBAAmB,EAAE,mBAAmB;AAC1C,EAAE,YAAY,EAAE,YAAY;AAC5B,CAAC;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,193 @@
1
+ /**
2
+ * query-broadcast-client-experimental
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, '__esModule', { value: true });
14
+
15
+ var index = require('../../../../oblivious-set/dist/es/index.js');
16
+ var options = require('../options.js');
17
+ var util = require('../util.js');
18
+
19
+ /**
20
+ * A localStorage-only method which uses localstorage and its 'storage'-event
21
+ * This does not work inside of webworkers because they have no access to locastorage
22
+ * This is basically implemented to support IE9 or your grandmothers toaster.
23
+ * @link https://caniuse.com/#feat=namevalue-storage
24
+ * @link https://caniuse.com/#feat=indexeddb
25
+ */
26
+ var microSeconds = util.microSeconds;
27
+ var KEY_PREFIX = 'pubkey.broadcastChannel-';
28
+ var type = 'localstorage';
29
+ /**
30
+ * copied from crosstab
31
+ * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32
32
+ */
33
+
34
+ function getLocalStorage() {
35
+ var localStorage;
36
+ if (typeof window === 'undefined') return null;
37
+
38
+ try {
39
+ localStorage = window.localStorage;
40
+ localStorage = window['ie8-eventlistener/storage'] || window.localStorage;
41
+ } catch (e) {// New versions of Firefox throw a Security exception
42
+ // if cookies are disabled. See
43
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153
44
+ }
45
+
46
+ return localStorage;
47
+ }
48
+ function storageKey(channelName) {
49
+ return KEY_PREFIX + channelName;
50
+ }
51
+ /**
52
+ * writes the new message to the storage
53
+ * and fires the storage-event so other readers can find it
54
+ */
55
+
56
+ function postMessage(channelState, messageJson) {
57
+ return new Promise(function (res) {
58
+ util.sleep().then(function () {
59
+ var key = storageKey(channelState.channelName);
60
+ var writeObj = {
61
+ token: util.randomToken(),
62
+ time: new Date().getTime(),
63
+ data: messageJson,
64
+ uuid: channelState.uuid
65
+ };
66
+ var value = JSON.stringify(writeObj);
67
+ getLocalStorage().setItem(key, value);
68
+ /**
69
+ * StorageEvent does not fire the 'storage' event
70
+ * in the window that changes the state of the local storage.
71
+ * So we fire it manually
72
+ */
73
+
74
+ var ev = document.createEvent('Event');
75
+ ev.initEvent('storage', true, true);
76
+ ev.key = key;
77
+ ev.newValue = value;
78
+ window.dispatchEvent(ev);
79
+ res();
80
+ });
81
+ });
82
+ }
83
+ function addStorageEventListener(channelName, fn) {
84
+ var key = storageKey(channelName);
85
+
86
+ var listener = function listener(ev) {
87
+ if (ev.key === key) {
88
+ fn(JSON.parse(ev.newValue));
89
+ }
90
+ };
91
+
92
+ window.addEventListener('storage', listener);
93
+ return listener;
94
+ }
95
+ function removeStorageEventListener(listener) {
96
+ window.removeEventListener('storage', listener);
97
+ }
98
+ function create(channelName, options$1) {
99
+ options$1 = options.fillOptionsWithDefaults(options$1);
100
+
101
+ if (!canBeUsed()) {
102
+ throw new Error('BroadcastChannel: localstorage cannot be used');
103
+ }
104
+
105
+ var uuid = util.randomToken();
106
+ /**
107
+ * eMIs
108
+ * contains all messages that have been emitted before
109
+ * @type {ObliviousSet}
110
+ */
111
+
112
+ var eMIs = new index.ObliviousSet(options$1.localstorage.removeTimeout);
113
+ var state = {
114
+ channelName: channelName,
115
+ uuid: uuid,
116
+ eMIs: eMIs // emittedMessagesIds
117
+
118
+ };
119
+ state.listener = addStorageEventListener(channelName, function (msgObj) {
120
+ if (!state.messagesCallback) return; // no listener
121
+
122
+ if (msgObj.uuid === uuid) return; // own message
123
+
124
+ if (!msgObj.token || eMIs.has(msgObj.token)) return; // already emitted
125
+
126
+ if (msgObj.data.time && msgObj.data.time < state.messagesCallbackTime) return; // too old
127
+
128
+ eMIs.add(msgObj.token);
129
+ state.messagesCallback(msgObj.data);
130
+ });
131
+ return state;
132
+ }
133
+ function close(channelState) {
134
+ removeStorageEventListener(channelState.listener);
135
+ }
136
+ function onMessage(channelState, fn, time) {
137
+ channelState.messagesCallbackTime = time;
138
+ channelState.messagesCallback = fn;
139
+ }
140
+ function canBeUsed() {
141
+ if (util.isNode) return false;
142
+ var ls = getLocalStorage();
143
+ if (!ls) return false;
144
+
145
+ try {
146
+ var key = '__broadcastchannel_check';
147
+ ls.setItem(key, 'works');
148
+ ls.removeItem(key);
149
+ } catch (e) {
150
+ // Safari 10 in private mode will not allow write access to local
151
+ // storage and fail with a QuotaExceededError. See
152
+ // https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API#Private_Browsing_Incognito_modes
153
+ return false;
154
+ }
155
+
156
+ return true;
157
+ }
158
+ function averageResponseTime() {
159
+ var defaultTime = 120;
160
+ var userAgent = navigator.userAgent.toLowerCase();
161
+
162
+ if (userAgent.includes('safari') && !userAgent.includes('chrome')) {
163
+ // safari is much slower so this time is higher
164
+ return defaultTime * 2;
165
+ }
166
+
167
+ return defaultTime;
168
+ }
169
+ var LocalstorageMethod = {
170
+ create: create,
171
+ close: close,
172
+ onMessage: onMessage,
173
+ postMessage: postMessage,
174
+ canBeUsed: canBeUsed,
175
+ type: type,
176
+ averageResponseTime: averageResponseTime,
177
+ microSeconds: microSeconds
178
+ };
179
+
180
+ exports.addStorageEventListener = addStorageEventListener;
181
+ exports.averageResponseTime = averageResponseTime;
182
+ exports.canBeUsed = canBeUsed;
183
+ exports.close = close;
184
+ exports.create = create;
185
+ exports["default"] = LocalstorageMethod;
186
+ exports.getLocalStorage = getLocalStorage;
187
+ exports.microSeconds = microSeconds;
188
+ exports.onMessage = onMessage;
189
+ exports.postMessage = postMessage;
190
+ exports.removeStorageEventListener = removeStorageEventListener;
191
+ exports.storageKey = storageKey;
192
+ exports.type = type;
193
+ //# sourceMappingURL=localstorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localstorage.js","sources":["../../../../../../../../../node_modules/broadcast-channel/dist/es/methods/localstorage.js"],"sourcesContent":["/**\n * A localStorage-only method which uses localstorage and its 'storage'-event\n * This does not work inside of webworkers because they have no access to locastorage\n * This is basically implemented to support IE9 or your grandmothers toaster.\n * @link https://caniuse.com/#feat=namevalue-storage\n * @link https://caniuse.com/#feat=indexeddb\n */\nimport { ObliviousSet } from 'oblivious-set';\nimport { fillOptionsWithDefaults } from '../options';\nimport { sleep, randomToken, microSeconds as micro, isNode } from '../util';\nexport var microSeconds = micro;\nvar KEY_PREFIX = 'pubkey.broadcastChannel-';\nexport var type = 'localstorage';\n/**\n * copied from crosstab\n * @link https://github.com/tejacques/crosstab/blob/master/src/crosstab.js#L32\n */\n\nexport function getLocalStorage() {\n var localStorage;\n if (typeof window === 'undefined') return null;\n\n try {\n localStorage = window.localStorage;\n localStorage = window['ie8-eventlistener/storage'] || window.localStorage;\n } catch (e) {// New versions of Firefox throw a Security exception\n // if cookies are disabled. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1028153\n }\n\n return localStorage;\n}\nexport function storageKey(channelName) {\n return KEY_PREFIX + channelName;\n}\n/**\n* writes the new message to the storage\n* and fires the storage-event so other readers can find it\n*/\n\nexport function postMessage(channelState, messageJson) {\n return new Promise(function (res) {\n sleep().then(function () {\n var key = storageKey(channelState.channelName);\n var writeObj = {\n token: randomToken(),\n time: new Date().getTime(),\n data: messageJson,\n uuid: channelState.uuid\n };\n var value = JSON.stringify(writeObj);\n getLocalStorage().setItem(key, value);\n /**\n * StorageEvent does not fire the 'storage' event\n * in the window that changes the state of the local storage.\n * So we fire it manually\n */\n\n var ev = document.createEvent('Event');\n ev.initEvent('storage', true, true);\n ev.key = key;\n ev.newValue = value;\n window.dispatchEvent(ev);\n res();\n });\n });\n}\nexport function addStorageEventListener(channelName, fn) {\n var key = storageKey(channelName);\n\n var listener = function listener(ev) {\n if (ev.key === key) {\n fn(JSON.parse(ev.newValue));\n }\n };\n\n window.addEventListener('storage', listener);\n return listener;\n}\nexport function removeStorageEventListener(listener) {\n window.removeEventListener('storage', listener);\n}\nexport function create(channelName, options) {\n options = fillOptionsWithDefaults(options);\n\n if (!canBeUsed()) {\n throw new Error('BroadcastChannel: localstorage cannot be used');\n }\n\n var uuid = randomToken();\n /**\n * eMIs\n * contains all messages that have been emitted before\n * @type {ObliviousSet}\n */\n\n var eMIs = new ObliviousSet(options.localstorage.removeTimeout);\n var state = {\n channelName: channelName,\n uuid: uuid,\n eMIs: eMIs // emittedMessagesIds\n\n };\n state.listener = addStorageEventListener(channelName, function (msgObj) {\n if (!state.messagesCallback) return; // no listener\n\n if (msgObj.uuid === uuid) return; // own message\n\n if (!msgObj.token || eMIs.has(msgObj.token)) return; // already emitted\n\n if (msgObj.data.time && msgObj.data.time < state.messagesCallbackTime) return; // too old\n\n eMIs.add(msgObj.token);\n state.messagesCallback(msgObj.data);\n });\n return state;\n}\nexport function close(channelState) {\n removeStorageEventListener(channelState.listener);\n}\nexport function onMessage(channelState, fn, time) {\n channelState.messagesCallbackTime = time;\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n if (isNode) return false;\n var ls = getLocalStorage();\n if (!ls) return false;\n\n try {\n var key = '__broadcastchannel_check';\n ls.setItem(key, 'works');\n ls.removeItem(key);\n } catch (e) {\n // Safari 10 in private mode will not allow write access to local\n // storage and fail with a QuotaExceededError. See\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API#Private_Browsing_Incognito_modes\n return false;\n }\n\n return true;\n}\nexport function averageResponseTime() {\n var defaultTime = 120;\n var userAgent = navigator.userAgent.toLowerCase();\n\n if (userAgent.includes('safari') && !userAgent.includes('chrome')) {\n // safari is much slower so this time is higher\n return defaultTime * 2;\n }\n\n return defaultTime;\n}\nexport default {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};"],"names":["micro","sleep","randomToken","options","fillOptionsWithDefaults","ObliviousSet","isNode"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAIU,IAAC,YAAY,GAAGA,kBAAM;AAChC,IAAI,UAAU,GAAG,0BAA0B,CAAC;AAClC,IAAC,IAAI,GAAG,eAAe;AACjC;AACA;AACA;AACA;AACA;AACO,SAAS,eAAe,GAAG;AAClC,EAAE,IAAI,YAAY,CAAC;AACnB,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,OAAO,IAAI,CAAC;AACjD;AACA,EAAE,IAAI;AACN,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;AACvC,IAAI,YAAY,GAAG,MAAM,CAAC,2BAA2B,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC;AAC9E,GAAG,CAAC,OAAO,CAAC,EAAE;AACd;AACA;AACA,GAAG;AACH;AACA,EAAE,OAAO,YAAY,CAAC;AACtB,CAAC;AACM,SAAS,UAAU,CAAC,WAAW,EAAE;AACxC,EAAE,OAAO,UAAU,GAAG,WAAW,CAAC;AAClC,CAAC;AACD;AACA;AACA;AACA;AACA;AACO,SAAS,WAAW,CAAC,YAAY,EAAE,WAAW,EAAE;AACvD,EAAE,OAAO,IAAI,OAAO,CAAC,UAAU,GAAG,EAAE;AACpC,IAAIC,UAAK,EAAE,CAAC,IAAI,CAAC,YAAY;AAC7B,MAAM,IAAI,GAAG,GAAG,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;AACrD,MAAM,IAAI,QAAQ,GAAG;AACrB,QAAQ,KAAK,EAAEC,gBAAW,EAAE;AAC5B,QAAQ,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;AAClC,QAAQ,IAAI,EAAE,WAAW;AACzB,QAAQ,IAAI,EAAE,YAAY,CAAC,IAAI;AAC/B,OAAO,CAAC;AAC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AmB,EAAE,mBAAmB;AAC1C,EAAE,YAAY,EAAE,YAAY;AAC5B,CAAC;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * query-broadcast-client-experimental
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, '__esModule', { value: true });
14
+
15
+ var util = require('../util.js');
16
+
17
+ var microSeconds = util.microSeconds;
18
+ var type = 'native';
19
+ function create(channelName) {
20
+ var state = {
21
+ messagesCallback: null,
22
+ bc: new BroadcastChannel(channelName),
23
+ subFns: [] // subscriberFunctions
24
+
25
+ };
26
+
27
+ state.bc.onmessage = function (msg) {
28
+ if (state.messagesCallback) {
29
+ state.messagesCallback(msg.data);
30
+ }
31
+ };
32
+
33
+ return state;
34
+ }
35
+ function close(channelState) {
36
+ channelState.bc.close();
37
+ channelState.subFns = [];
38
+ }
39
+ function postMessage(channelState, messageJson) {
40
+ try {
41
+ channelState.bc.postMessage(messageJson, false);
42
+ return Promise.resolve();
43
+ } catch (err) {
44
+ return Promise.reject(err);
45
+ }
46
+ }
47
+ function onMessage(channelState, fn) {
48
+ channelState.messagesCallback = fn;
49
+ }
50
+ function canBeUsed() {
51
+ /**
52
+ * in the electron-renderer, isNode will be true even if we are in browser-context
53
+ * so we also check if window is undefined
54
+ */
55
+ if (util.isNode && typeof window === 'undefined') return false;
56
+
57
+ if (typeof BroadcastChannel === 'function') {
58
+ if (BroadcastChannel._pubkey) {
59
+ throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');
60
+ }
61
+
62
+ return true;
63
+ } else return false;
64
+ }
65
+ function averageResponseTime() {
66
+ return 150;
67
+ }
68
+ var NativeMethod = {
69
+ create: create,
70
+ close: close,
71
+ onMessage: onMessage,
72
+ postMessage: postMessage,
73
+ canBeUsed: canBeUsed,
74
+ type: type,
75
+ averageResponseTime: averageResponseTime,
76
+ microSeconds: microSeconds
77
+ };
78
+
79
+ exports.averageResponseTime = averageResponseTime;
80
+ exports.canBeUsed = canBeUsed;
81
+ exports.close = close;
82
+ exports.create = create;
83
+ exports["default"] = NativeMethod;
84
+ exports.microSeconds = microSeconds;
85
+ exports.onMessage = onMessage;
86
+ exports.postMessage = postMessage;
87
+ exports.type = type;
88
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.js","sources":["../../../../../../../../../node_modules/broadcast-channel/dist/es/methods/native.js"],"sourcesContent":["import { microSeconds as micro, isNode } from '../util';\nexport var microSeconds = micro;\nexport var type = 'native';\nexport function create(channelName) {\n var state = {\n messagesCallback: null,\n bc: new BroadcastChannel(channelName),\n subFns: [] // subscriberFunctions\n\n };\n\n state.bc.onmessage = function (msg) {\n if (state.messagesCallback) {\n state.messagesCallback(msg.data);\n }\n };\n\n return state;\n}\nexport function close(channelState) {\n channelState.bc.close();\n channelState.subFns = [];\n}\nexport function postMessage(channelState, messageJson) {\n try {\n channelState.bc.postMessage(messageJson, false);\n return Promise.resolve();\n } catch (err) {\n return Promise.reject(err);\n }\n}\nexport function onMessage(channelState, fn) {\n channelState.messagesCallback = fn;\n}\nexport function canBeUsed() {\n /**\n * in the electron-renderer, isNode will be true even if we are in browser-context\n * so we also check if window is undefined\n */\n if (isNode && typeof window === 'undefined') return false;\n\n if (typeof BroadcastChannel === 'function') {\n if (BroadcastChannel._pubkey) {\n throw new Error('BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill');\n }\n\n return true;\n } else return false;\n}\nexport function averageResponseTime() {\n return 150;\n}\nexport default {\n create: create,\n close: close,\n onMessage: onMessage,\n postMessage: postMessage,\n canBeUsed: canBeUsed,\n type: type,\n averageResponseTime: averageResponseTime,\n microSeconds: microSeconds\n};"],"names":["micro","isNode"],"mappings":";;;;;;;;;;;;;;;;AACU,IAAC,YAAY,GAAG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