@data-fair/lib-vue 1.24.0 → 1.24.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vue",
3
- "version": "1.24.0",
3
+ "version": "1.24.2",
4
4
  "description": "Composables and other utilities for Vue applications in the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "files": [
package/session.js CHANGED
@@ -269,7 +269,9 @@ export async function getSession(initOptions) {
269
269
  goTo(null);
270
270
  };
271
271
  const keepalive = async () => {
272
- if (state.user == null)
272
+ // check cookies.get('id_token') not state.user so that we do a keepalive on expired id tokens
273
+ // as we might have an exchange token
274
+ if (!cookies.get('id_token'))
273
275
  return;
274
276
  if (!ssr) {
275
277
  window.localStorage.setItem('sd-keepalive' + options.sitePath, `${new Date().getTime()}`);
@@ -284,8 +286,8 @@ export async function getSession(initOptions) {
284
286
  else {
285
287
  throw err;
286
288
  }
287
- readState();
288
289
  }
290
+ readState();
289
291
  };
290
292
  const refreshSiteInfo = async () => {
291
293
  console.warn('@data-fair/lib-vue/session refreshSiteInfo is deprecated');
@@ -331,8 +333,7 @@ export async function getSession(initOptions) {
331
333
  // also run an auto-refresh loop
332
334
  if (!ssr && !inIframe && !('triggerCapture' in window)) {
333
335
  const lastKeepalive = window.localStorage.getItem('sd-keepalive' + options.sitePath);
334
- // check cookies.get('id_token') not state.user so that we do a keepalive on expired id tokens
335
- if (cookies.get('id_token') && (!lastKeepalive || (new Date().getTime() - Number(lastKeepalive)) > 10000)) {
336
+ if (!lastKeepalive || (new Date().getTime() - Number(lastKeepalive)) > 10000) {
336
337
  await keepalive();
337
338
  }
338
339
  const refreshLoopDelay = 10 * 60 * 1000; // 10 minutes
package/vite.d.ts CHANGED
@@ -9,3 +9,8 @@ export declare const autoImports: (string | {
9
9
  '@data-fair/lib-vue/async-action.js': string[];
10
10
  '@data-fair/lib-vue/deep-diff.js': string[];
11
11
  })[];
12
+ export declare function ClosePlugin(): {
13
+ name: string;
14
+ buildEnd(error: any): void;
15
+ closeBundle(): never;
16
+ };
package/vite.js CHANGED
@@ -15,3 +15,24 @@ export const autoImports = [
15
15
  '@data-fair/lib-vue/deep-diff.js': ['computedDeepDiff', 'watchDeepDiff'],
16
16
  }
17
17
  ];
18
+ // cf https://stackoverflow.com/questions/75839993/vite-build-hangs-forever/76920975#76920975
19
+ export function ClosePlugin() {
20
+ return {
21
+ name: 'ClosePlugin', // required, will show up in warnings and errors
22
+ // use this to catch errors when building
23
+ buildEnd(error) {
24
+ if (error) {
25
+ console.error(error);
26
+ process.exit(1);
27
+ }
28
+ else {
29
+ console.log('Build ended');
30
+ }
31
+ },
32
+ // use this to catch the end of a build without errors
33
+ closeBundle() {
34
+ console.log('Bundle closed');
35
+ process.exit(0);
36
+ },
37
+ };
38
+ }