@ethlete/query 5.33.0 → 5.33.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ethlete/query
|
|
2
2
|
|
|
3
|
+
## 5.33.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4fa6338`](https://github.com/ethlete-io/ethdk/commit/4fa63386c3af60d7843efb59592f7416b04330ac) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix web socket throwing an injection error
|
|
8
|
+
|
|
9
|
+
## 5.33.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`2991beb`](https://github.com/ethlete-io/ethdk/commit/2991beb64d12e3f2341c47ce1cdf954aa00000c0) Thanks [@TomTomB](https://github.com/TomTomB)! - Cleanup secure queries after logout
|
|
14
|
+
|
|
3
15
|
## 5.33.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -2973,6 +2973,7 @@ const createAuthProviderQuery = (config, authProviderConfig) => {
|
|
|
2973
2973
|
};
|
|
2974
2974
|
const createBearerAuthProvider = (options) => {
|
|
2975
2975
|
const route = injectRoute();
|
|
2976
|
+
const client = inject(options.queryClientRef);
|
|
2976
2977
|
const cookieEnabled = signal(options.cookie === undefined ? false : (options.cookie.enabled ?? true));
|
|
2977
2978
|
const cookieOptions = {
|
|
2978
2979
|
expiresInDays: 30,
|
|
@@ -3085,6 +3086,7 @@ const createBearerAuthProvider = (options) => {
|
|
|
3085
3086
|
tokenRefreshQuery?.query.reset();
|
|
3086
3087
|
selectRoleQuery?.query.reset();
|
|
3087
3088
|
latestNonInternalQuery.set(null);
|
|
3089
|
+
client.repository.unbindAllSecure();
|
|
3088
3090
|
};
|
|
3089
3091
|
const enableCookie = () => {
|
|
3090
3092
|
if (isDevMode() && !options.cookie) {
|
|
@@ -4251,7 +4253,7 @@ const setupQueryExecuteState = () => {
|
|
|
4251
4253
|
};
|
|
4252
4254
|
};
|
|
4253
4255
|
const queryExecute = (options) => {
|
|
4254
|
-
const { executeOptions, args, executeState, options: runQueryOptions, internalOptions: internalRunQueryOptions, transformResponse, } = options;
|
|
4256
|
+
const { executeOptions, args, executeState, options: runQueryOptions, internalOptions: internalRunQueryOptions, transformResponse, isSecure, } = options;
|
|
4255
4257
|
const { deps, state, creator, creatorInternals, queryConfig } = executeOptions;
|
|
4256
4258
|
const { key, request } = deps.client.repository.request({
|
|
4257
4259
|
route: creatorInternals.route,
|
|
@@ -4263,6 +4265,7 @@ const queryExecute = (options) => {
|
|
|
4263
4265
|
previousKey: executeState.previousKey(),
|
|
4264
4266
|
internalRunQueryOptions,
|
|
4265
4267
|
runQueryOptions,
|
|
4268
|
+
isSecure,
|
|
4266
4269
|
});
|
|
4267
4270
|
executeState.previousKey.set(key);
|
|
4268
4271
|
const responseSignal = transformResponse ? computed(() => transformResponse(request.response())) : request.response;
|
|
@@ -4353,7 +4356,7 @@ const createQueryRepository = (config) => {
|
|
|
4353
4356
|
if (shouldCache && key) {
|
|
4354
4357
|
const cacheEntry = cache.get(key);
|
|
4355
4358
|
if (cacheEntry) {
|
|
4356
|
-
bind(key, options.destroyRef, cacheEntry.request);
|
|
4359
|
+
bind(key, options.destroyRef, cacheEntry.request, options.isSecure ?? false);
|
|
4357
4360
|
if (!runQueryOptions?.allowCache || cacheEntry.request.isStale()) {
|
|
4358
4361
|
cacheEntry.request.execute({ allowCache: runQueryOptions?.allowCache });
|
|
4359
4362
|
}
|
|
@@ -4373,7 +4376,7 @@ const createQueryRepository = (config) => {
|
|
|
4373
4376
|
});
|
|
4374
4377
|
request.execute();
|
|
4375
4378
|
if (shouldCache && key) {
|
|
4376
|
-
bind(key, options.destroyRef, request);
|
|
4379
|
+
bind(key, options.destroyRef, request, options.isSecure ?? false);
|
|
4377
4380
|
}
|
|
4378
4381
|
return { key, request };
|
|
4379
4382
|
};
|
|
@@ -4390,7 +4393,17 @@ const createQueryRepository = (config) => {
|
|
|
4390
4393
|
}
|
|
4391
4394
|
return true;
|
|
4392
4395
|
};
|
|
4393
|
-
const
|
|
4396
|
+
const unbindAllSecure = () => {
|
|
4397
|
+
for (const [key, cacheEntry] of cache.entries()) {
|
|
4398
|
+
if (cacheEntry.isSecure) {
|
|
4399
|
+
for (const destroyRef of cacheEntry.consumers.keys()) {
|
|
4400
|
+
unbind(key, destroyRef);
|
|
4401
|
+
}
|
|
4402
|
+
cache.delete(key);
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
};
|
|
4406
|
+
const bind = (key, destroyRef, request, isSecure) => {
|
|
4394
4407
|
const destroyListener = destroyRef.onDestroy(() => unbind(key, destroyRef));
|
|
4395
4408
|
const cacheEntry = cache.get(key);
|
|
4396
4409
|
if (cacheEntry) {
|
|
@@ -4402,12 +4415,14 @@ const createQueryRepository = (config) => {
|
|
|
4402
4415
|
cache.set(key, {
|
|
4403
4416
|
consumers,
|
|
4404
4417
|
request,
|
|
4418
|
+
isSecure,
|
|
4405
4419
|
});
|
|
4406
4420
|
}
|
|
4407
4421
|
};
|
|
4408
4422
|
const repository = {
|
|
4409
4423
|
request,
|
|
4410
4424
|
unbind,
|
|
4425
|
+
unbindAllSecure,
|
|
4411
4426
|
};
|
|
4412
4427
|
return repository;
|
|
4413
4428
|
};
|
|
@@ -4506,6 +4521,7 @@ const createSecureExecuteFn = (executeOptions) => {
|
|
|
4506
4521
|
executeState,
|
|
4507
4522
|
args: updatedArgs,
|
|
4508
4523
|
options: runOptions,
|
|
4524
|
+
isSecure: true,
|
|
4509
4525
|
});
|
|
4510
4526
|
};
|
|
4511
4527
|
const exec = (executeArgs) => {
|
|
@@ -5170,6 +5186,8 @@ const createWebSocketClient = (config) => {
|
|
|
5170
5186
|
const isConnected = signal(false);
|
|
5171
5187
|
const joinRoom = (room) => {
|
|
5172
5188
|
const roomFn = typeof room === 'function' ? room : () => room;
|
|
5189
|
+
const pre = previousSignalValue(computed(() => roomFn()));
|
|
5190
|
+
const roomData = signal(null);
|
|
5173
5191
|
const join = (name) => {
|
|
5174
5192
|
socket.emit('join-room', name);
|
|
5175
5193
|
const existingRoom = rooms.get(name);
|
|
@@ -5182,8 +5200,6 @@ const createWebSocketClient = (config) => {
|
|
|
5182
5200
|
rooms.set(name, newRoom);
|
|
5183
5201
|
return newRoom;
|
|
5184
5202
|
};
|
|
5185
|
-
const pre = previousSignalValue(computed(() => roomFn()));
|
|
5186
|
-
const roomData = signal(null);
|
|
5187
5203
|
effect(() => {
|
|
5188
5204
|
const current = roomFn();
|
|
5189
5205
|
untracked(() => {
|
|
@@ -5223,7 +5239,7 @@ const createWebSocketClient = (config) => {
|
|
|
5223
5239
|
socket.on('connect', () => {
|
|
5224
5240
|
isConnected.set(true);
|
|
5225
5241
|
for (const room of rooms.keys()) {
|
|
5226
|
-
|
|
5242
|
+
socket.emit('join-room', room);
|
|
5227
5243
|
}
|
|
5228
5244
|
});
|
|
5229
5245
|
socket.on('disconnect', () => isConnected.set(false));
|