@scayle/storefront-nuxt 7.48.2 → 7.50.0
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 +25 -0
- package/dist/index.mjs +1 -0
- package/dist/module.json +2 -2
- package/dist/module.mjs +3 -3
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.mjs +3 -1
- package/dist/runtime/composables/core/useIDP.d.ts +1 -1
- package/dist/runtime/composables/core/useRpc.d.ts +2 -2
- package/dist/runtime/composables/core/useRpc.mjs +14 -11
- package/dist/runtime/composables/core/useUser.d.ts +1 -1
- package/dist/runtime/composables/storefront/useBasket.d.ts +1 -1
- package/dist/runtime/composables/storefront/useBrand.d.ts +1 -1
- package/dist/runtime/composables/storefront/useBrands.d.ts +1 -1
- package/dist/runtime/composables/storefront/useCategories.d.ts +1 -1
- package/dist/runtime/composables/storefront/useCurrentPromotions.d.ts +1 -1
- package/dist/runtime/composables/storefront/useFacet.d.ts +4 -4
- package/dist/runtime/composables/storefront/useFilters.d.ts +1 -1
- package/dist/runtime/composables/storefront/useNavigationTree.d.ts +1 -1
- package/dist/runtime/composables/storefront/useNavigationTrees.d.ts +1 -1
- package/dist/runtime/composables/storefront/useOrder.d.ts +1 -1
- package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +1 -1
- package/dist/runtime/composables/storefront/useProduct.d.ts +1 -1
- package/dist/runtime/composables/storefront/useProducts.d.ts +1 -1
- package/dist/runtime/composables/storefront/useProductsByIds.d.ts +1 -1
- package/dist/runtime/composables/storefront/useProductsCount.d.ts +1 -1
- package/dist/runtime/composables/storefront/usePromotions.d.ts +1 -1
- package/dist/runtime/composables/storefront/usePromotionsByIds.d.ts +1 -1
- package/dist/runtime/composables/storefront/useShopConfiguration.d.ts +1 -1
- package/dist/runtime/composables/storefront/useUserAddresses.d.ts +1 -1
- package/dist/runtime/composables/storefront/useVariant.d.ts +1 -1
- package/dist/runtime/composables/storefront/useWishlist.d.ts +1 -1
- package/dist/runtime/error/handler.d.ts +1 -1
- package/dist/runtime/handler.d.ts +1 -1
- package/dist/runtime/handler.mjs +15 -5
- package/dist/runtime/rpc/rpcCall.d.ts +1 -1
- package/dist/runtime/rpc/rpcCall.mjs +2 -1
- package/dist/runtime/server/middleware/bootstrap.mjs +1 -24
- package/package.json +22 -20
- package/dist/runtime/server/middleware/oauth.d.ts +0 -3
- package/dist/runtime/server/middleware/oauth.mjs +0 -112
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.50.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Update to `nuxt@3.9.1` and `vue@3.4.7` (_For detailed changes see [Blog post: Nuxt 3.9](https://nuxt.com/blog/v3-9) and [Blog post: Announcing Vue 3.4](https://blog.vuejs.org/posts/vue-3-4)_)
|
|
8
|
+
|
|
9
|
+
**Please note that `@scayle/storefront-nuxt` is now compatible with `nuxt@9.0.0` or higher!**
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @scayle/h3-session@0.3.5
|
|
15
|
+
|
|
16
|
+
## 7.49.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- Support `Response` returns in RPC methods
|
|
21
|
+
- Handle 401 from CO and delete session
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
- @scayle/storefront-core@7.36.0
|
|
27
|
+
|
|
3
28
|
## 7.48.2
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/dist/index.mjs
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -45,7 +45,7 @@ const module = defineNuxtModule({
|
|
|
45
45
|
name: PACKAGE_NAME,
|
|
46
46
|
configKey: "storefront",
|
|
47
47
|
compatibility: {
|
|
48
|
-
nuxt: "^3.
|
|
48
|
+
nuxt: "^3.9.0"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
// Default configuration options of the Nuxt module
|
|
@@ -148,8 +148,8 @@ const module = defineNuxtModule({
|
|
|
148
148
|
}
|
|
149
149
|
if (nuxt.options.runtimeConfig.storefront.shopSelector === "path") {
|
|
150
150
|
const stores = Array.isArray(nuxt.options.runtimeConfig.storefront.stores) ? nuxt.options.runtimeConfig.storefront.stores : Object.values(nuxt.options.runtimeConfig.storefront.stores);
|
|
151
|
-
stores.forEach((
|
|
152
|
-
const base = `/${
|
|
151
|
+
stores.forEach((iteratedStore) => {
|
|
152
|
+
const base = `/${iteratedStore.path}${apiBasePath}`;
|
|
153
153
|
addCacheServerHandlers(base);
|
|
154
154
|
addRPCServerHandlers(base);
|
|
155
155
|
});
|
package/dist/rpc.d.mts
CHANGED
|
@@ -9,6 +9,6 @@ import 'unstorage';
|
|
|
9
9
|
* It makes an HTTP request on the client and direct call on the server using $fetch
|
|
10
10
|
* https://nuxt.com/docs/api/utils/dollarfetch
|
|
11
11
|
*/
|
|
12
|
-
declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Awaited<RpcMethodReturnType<N>>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
|
|
12
|
+
declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
|
|
13
13
|
|
|
14
14
|
export { rpcCall };
|
package/dist/rpc.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ import 'unstorage';
|
|
|
9
9
|
* It makes an HTTP request on the client and direct call on the server using $fetch
|
|
10
10
|
* https://nuxt.com/docs/api/utils/dollarfetch
|
|
11
11
|
*/
|
|
12
|
-
declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Awaited<RpcMethodReturnType<N>>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
|
|
12
|
+
declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
|
|
13
13
|
|
|
14
14
|
export { rpcCall };
|
package/dist/rpc.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { unwrap } from '@scayle/storefront-core/dist/utils/response';
|
|
2
|
+
|
|
1
3
|
const rpcCall = (nuxtApp, method, shop) => {
|
|
2
4
|
const fetch = nuxtApp.ssrContext?.event.$fetch ?? $fetch;
|
|
3
5
|
return async (params = void 0) => {
|
|
@@ -11,7 +13,7 @@ const rpcCall = (nuxtApp, method, shop) => {
|
|
|
11
13
|
"x-shop-id": shop.shopId.toString()
|
|
12
14
|
}
|
|
13
15
|
});
|
|
14
|
-
return data;
|
|
16
|
+
return await unwrap(data);
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
|
|
@@ -4,7 +4,7 @@ export declare const useIDP: () => Promise<{
|
|
|
4
4
|
}>;
|
|
5
5
|
fetching: import("vue").Ref<boolean>;
|
|
6
6
|
fetch: () => Promise<void>;
|
|
7
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
7
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
8
8
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
9
9
|
handleIDPLoginCallback: (params: string) => Promise<{
|
|
10
10
|
message: string;
|
|
@@ -7,11 +7,11 @@ export interface RpcOptions {
|
|
|
7
7
|
lazy?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export type Status = 'idle' | 'pending' | 'success' | 'error';
|
|
10
|
-
export declare const useRpc: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Awaited<RpcMethodReturnType<N>>, TParams = P extends RpcContext ? undefined : P>(method: N, key: string, params?: any, options?: RpcOptions) => Promise<{
|
|
10
|
+
export declare const useRpc: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TParams = P extends RpcContext ? undefined : P>(method: N, key: string, params?: any, options?: RpcOptions) => Promise<{
|
|
11
11
|
data: import("vue").Ref<TResult>;
|
|
12
12
|
fetching: import("vue").Ref<boolean>;
|
|
13
13
|
fetch: () => Promise<void>;
|
|
14
|
-
error: import("vue").Ref<NuxtError | undefined>;
|
|
14
|
+
error: import("vue").Ref<NuxtError<unknown> | undefined>;
|
|
15
15
|
status: import("vue").Ref<Status>;
|
|
16
16
|
}>;
|
|
17
17
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unwrap } from "@scayle/storefront-core/dist/utils/response";
|
|
1
2
|
import { useNuxtApp, useState, createError } from "nuxt/app";
|
|
2
3
|
import { useCoreLog } from "../useCoreLog.mjs";
|
|
3
4
|
import { resolveError } from "../../error/handler.mjs";
|
|
@@ -33,17 +34,19 @@ export const useRpc = async (method, key, params, options = { autoFetch: true, l
|
|
|
33
34
|
fetching.value = true;
|
|
34
35
|
const apiBasePath = currentShop.value?.apiBasePath ?? "/api";
|
|
35
36
|
const fetch2 = getFetch(nuxtApp, log);
|
|
36
|
-
data.value = await
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
data.value = await unwrap(
|
|
38
|
+
await fetch2(`/rpc/${method}`, {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
method: "POST",
|
|
41
|
+
body: {
|
|
42
|
+
payload: toValue(params)
|
|
43
|
+
},
|
|
44
|
+
baseURL: apiBasePath,
|
|
45
|
+
headers: {
|
|
46
|
+
"x-shop-id": currentShop.value?.shopId + ""
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
);
|
|
47
50
|
} catch (e) {
|
|
48
51
|
error.value = handleError(e);
|
|
49
52
|
} finally {
|
|
@@ -11,6 +11,6 @@ export declare function useUser({ autoFetch, lazy, key, }?: ExtendedUseUserParam
|
|
|
11
11
|
forceRefresh: () => Promise<void>;
|
|
12
12
|
updateUser: (payload: Partial<ShopUser>) => Promise<void>;
|
|
13
13
|
updatePassword: (payload: UpdatePasswordParams) => Promise<void>;
|
|
14
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
14
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
15
15
|
status: import("vue").Ref<import("./useRpc").Status>;
|
|
16
16
|
}>;
|
|
@@ -49,7 +49,7 @@ export declare function useBasket({ params, options, key, }?: UseBasketOptions):
|
|
|
49
49
|
fromBasketKey: string;
|
|
50
50
|
toBasketKey: string;
|
|
51
51
|
}) => Promise<any>;
|
|
52
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
52
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
53
53
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
54
54
|
}>;
|
|
55
55
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useBrand({ params, options, key, }?: Options): Promise<{
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").Brand>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useBrands({ params, options, key, }?: Options): Promise<
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").BrandsEndpointResponseData>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -13,7 +13,7 @@ export declare function useCategories({ params, options, key, }?: Options): Prom
|
|
|
13
13
|
}>;
|
|
14
14
|
fetching: import("vue").Ref<boolean>;
|
|
15
15
|
fetch: () => Promise<void>;
|
|
16
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
16
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
17
17
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
18
18
|
getCategoryById: (id: number, includeHidden?: true) => Promise<import("@scayle/storefront-core").Category>;
|
|
19
19
|
}>;
|
|
@@ -10,7 +10,7 @@ export declare function useCurrentPromotions({ params, options, key, }?: Options
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -16,22 +16,22 @@ export declare function useFacet({ key, params, }?: Options): Promise<{
|
|
|
16
16
|
filtersFetching: import("vue").Ref<boolean>;
|
|
17
17
|
unfilteredCount: import("vue").ComputedRef<number>;
|
|
18
18
|
filterStatus: import("vue").Ref<import("../core/useRpc").Status>;
|
|
19
|
-
filterError: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
19
|
+
filterError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
20
20
|
productCountData: import("vue").Ref<import("@scayle/storefront-core").FetchProductsCountResponse>;
|
|
21
21
|
refreshProductCount: ({ where, }?: FilterParams) => Promise<void>;
|
|
22
22
|
productCountFetching: import("vue").Ref<boolean>;
|
|
23
|
-
productCountError: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
23
|
+
productCountError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
24
24
|
productCountStatus: import("vue").Ref<import("../core/useRpc").Status>;
|
|
25
25
|
products: import("vue").ComputedRef<import("@scayle/storefront-core").Product[]>;
|
|
26
26
|
pagination: import("vue").ComputedRef<import("@scayle/storefront-core").Pagination>;
|
|
27
27
|
productsFetching: import("vue").Ref<boolean>;
|
|
28
28
|
filterProducts: ({ where, page, sort, orFiltersOperator, }: FilterParams) => Promise<void>;
|
|
29
|
-
productError: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
29
|
+
productError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
30
30
|
productStatus: import("vue").Ref<import("../core/useRpc").Status>;
|
|
31
31
|
categories: import("vue").ComputedRef<import("@scayle/storefront-core").Category | import("@scayle/storefront-core").Category[]>;
|
|
32
32
|
selectedCategory: import("vue").ComputedRef<import("@scayle/storefront-core").Category | undefined>;
|
|
33
33
|
categoriesFetching: import("vue").Ref<boolean>;
|
|
34
|
-
categoriesError: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
34
|
+
categoriesError: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
35
35
|
categoriesStatus: import("vue").Ref<import("../core/useRpc").Status>;
|
|
36
36
|
fetchProducts: ({ path, page, perPage, where, sort, pricePromotionKey, cache, orFiltersOperator, }: FilterParams & {
|
|
37
37
|
path: string;
|
|
@@ -10,7 +10,7 @@ export declare function useFilters({ params, options, key, }?: Options): Promise
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").FetchFiltersResponse>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useNavigationTree({ params, options, key, }?: Options):
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").NavigationTree>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useNavigationTrees({ params, options, key, }?: Options):
|
|
|
10
10
|
data: import("vue").Ref<import("@aboutyou/backbone").NavigationAllEndpointResponseData>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -83,7 +83,7 @@ export declare function useOrder<P = {
|
|
|
83
83
|
}>;
|
|
84
84
|
fetching: import("vue").Ref<boolean>;
|
|
85
85
|
fetch: () => Promise<void>;
|
|
86
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
86
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
87
87
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
88
88
|
}>;
|
|
89
89
|
export {};
|
|
@@ -83,7 +83,7 @@ export declare function useOrderConfirmation<P = {
|
|
|
83
83
|
}>;
|
|
84
84
|
fetching: import("vue").Ref<boolean>;
|
|
85
85
|
fetch: () => Promise<void>;
|
|
86
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
86
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
87
87
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
88
88
|
}>;
|
|
89
89
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useProduct({ params, options, key, }?: Options): Promise
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").Product>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -14,7 +14,7 @@ export declare function useProducts({ params, options, key, }?: Options): Promis
|
|
|
14
14
|
})>;
|
|
15
15
|
fetching: import("vue").Ref<boolean>;
|
|
16
16
|
fetch: () => Promise<void>;
|
|
17
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
17
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
18
18
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
19
19
|
}>;
|
|
20
20
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useProductsByIds({ params, options, key, }?: Options): P
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").Product[]>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useProductsCount({ params, options, key, }?: Options): P
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").FetchProductsCountResponse>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function usePromotions({ params, options, key, }?: Options): Prom
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function usePromotionsByIds({ params, options, key, }?: Options):
|
|
|
10
10
|
data: import("vue").Ref<import("@scayle/storefront-core").PromotionsResponseData>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -7,7 +7,7 @@ export declare function useShopConfiguration({ options, key, }?: Options): Promi
|
|
|
7
7
|
data: import("vue").Ref<import("@aboutyou/backbone/endpoints/shopconfiguration/shopconfiguration").ShopConfigurationResponseData>;
|
|
8
8
|
fetching: import("vue").Ref<boolean>;
|
|
9
9
|
fetch: () => Promise<void>;
|
|
10
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
10
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
11
11
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
12
12
|
}>;
|
|
13
13
|
export {};
|
|
@@ -7,7 +7,7 @@ export declare function useUserAddresses({ options, key, }?: Options): Promise<{
|
|
|
7
7
|
data: import("vue").Ref<import("@scayle/storefront-core").ShopUserAddress[]>;
|
|
8
8
|
fetching: import("vue").Ref<boolean>;
|
|
9
9
|
fetch: () => Promise<void>;
|
|
10
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
10
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
11
11
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
12
12
|
}>;
|
|
13
13
|
export {};
|
|
@@ -10,7 +10,7 @@ export declare function useVariant({ params, options, key, }?: Options): Promise
|
|
|
10
10
|
data: import("vue").Ref<import("@aboutyou/backbone/endpoints/variants/variantsByIds").VariantDetail[]>;
|
|
11
11
|
fetching: import("vue").Ref<boolean>;
|
|
12
12
|
fetch: () => Promise<void>;
|
|
13
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
13
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
14
14
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
15
15
|
}>;
|
|
16
16
|
export {};
|
|
@@ -42,7 +42,7 @@ export declare function useWishlist({ params, options, key, }?: Options): Promis
|
|
|
42
42
|
} | {
|
|
43
43
|
productId: number;
|
|
44
44
|
}) => boolean;
|
|
45
|
-
error: import("vue").Ref<import("nuxt/app").NuxtError | undefined>;
|
|
45
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
46
46
|
status: import("vue").Ref<import("../core/useRpc").Status>;
|
|
47
47
|
}>;
|
|
48
48
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const resolveError: (error: Error | unknown) => {
|
|
2
|
-
statusCode:
|
|
2
|
+
statusCode: 500 | 401 | 400 | 100 | 101 | 102 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
3
3
|
statusMessage: string;
|
|
4
4
|
name: string;
|
|
5
5
|
};
|
|
@@ -5,4 +5,4 @@ import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnTyp
|
|
|
5
5
|
* @param payload
|
|
6
6
|
* @param rpcContext
|
|
7
7
|
*/
|
|
8
|
-
export declare const handler: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Awaited<RpcMethodReturnType<N>>, TakesParameters = P extends RpcContext ? undefined : boolean, TParams = TakesParameters extends undefined ? null : P>(method: N, payload: TParams, rpcContext: RpcContext) => Promise<TResult>;
|
|
8
|
+
export declare const handler: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Awaited<RpcMethodReturnType<N>>, TakesParameters = P extends RpcContext ? undefined : boolean, TParams = TakesParameters extends undefined ? null : P>(method: N, payload: TParams, rpcContext: RpcContext) => Promise<TResult | Response>;
|
package/dist/runtime/handler.mjs
CHANGED
|
@@ -11,14 +11,24 @@ export const handler = async (method, payload, rpcContext) => {
|
|
|
11
11
|
const log = rpcContext.log.space("sfc").space("rpc");
|
|
12
12
|
return await log.time(`Calling RPC method: ${method}`, async () => {
|
|
13
13
|
const fun = rpcMethods[method];
|
|
14
|
-
|
|
14
|
+
try {
|
|
15
|
+
if (fun.length === 1) {
|
|
16
|
+
return await fun(
|
|
17
|
+
rpcContext
|
|
18
|
+
);
|
|
19
|
+
}
|
|
15
20
|
return await fun(
|
|
21
|
+
payload,
|
|
16
22
|
rpcContext
|
|
17
23
|
);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
if (e instanceof Error) {
|
|
26
|
+
return new Response(JSON.stringify({ message: e.message }), {
|
|
27
|
+
status: 500
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
return new Response(null, { status: 500 });
|
|
31
|
+
}
|
|
18
32
|
}
|
|
19
|
-
return await fun(
|
|
20
|
-
payload,
|
|
21
|
-
rpcContext
|
|
22
|
-
);
|
|
23
33
|
});
|
|
24
34
|
};
|
|
@@ -6,4 +6,4 @@ import type { PublicShopConfig } from '../../types/module';
|
|
|
6
6
|
* It makes an HTTP request on the client and direct call on the server using $fetch
|
|
7
7
|
* https://nuxt.com/docs/api/utils/dollarfetch
|
|
8
8
|
*/
|
|
9
|
-
export declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Awaited<RpcMethodReturnType<N>>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
|
|
9
|
+
export declare const rpcCall: <N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TakesParameters = P extends RpcContext ? undefined : boolean>(nuxtApp: NuxtApp, method: N, shop: PublicShopConfig) => TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { unwrap } from "@scayle/storefront-core/dist/utils/response";
|
|
1
2
|
export const rpcCall = (nuxtApp, method, shop) => {
|
|
2
3
|
const fetch = nuxtApp.ssrContext?.event.$fetch ?? $fetch;
|
|
3
4
|
return async (params = void 0) => {
|
|
@@ -11,6 +12,6 @@ export const rpcCall = (nuxtApp, method, shop) => {
|
|
|
11
12
|
"x-shop-id": shop.shopId.toString()
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
|
-
return data;
|
|
15
|
+
return await unwrap(data);
|
|
15
16
|
};
|
|
16
17
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineEventHandler, getRequestURL } from "h3";
|
|
2
|
-
import {
|
|
2
|
+
import { decodeJwt } from "jose";
|
|
3
3
|
import { randomUUID } from "uncrypto";
|
|
4
4
|
import { useSession } from "@scayle/h3-session";
|
|
5
5
|
import { buildContext } from "../../context.mjs";
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
getCurrentShopForRequest,
|
|
10
10
|
getPublicShopData
|
|
11
11
|
} from "./bootstrap.utils.mjs";
|
|
12
|
-
import { useOauth } from "./oauth.mjs";
|
|
13
12
|
import { useRedirects } from "./redirects.mjs";
|
|
14
13
|
import { useRuntimeConfig } from "#imports";
|
|
15
14
|
const getShopConfig = (event, config) => {
|
|
@@ -20,26 +19,6 @@ const getShopConfig = (event, config) => {
|
|
|
20
19
|
);
|
|
21
20
|
return $shopConfig;
|
|
22
21
|
};
|
|
23
|
-
async function handleOauth(event, storefrontConfig, log) {
|
|
24
|
-
if (!storefrontConfig.oauth.apiHost) {
|
|
25
|
-
log.error("oauth.apiHost must be set in the module options.");
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
if (!storefrontConfig.oauth.clientId) {
|
|
29
|
-
log.error("oauth.clientId must be set in the module options.");
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
if (!storefrontConfig.oauth.clientSecret) {
|
|
33
|
-
log.error("oauth.clientSecret must be set in the module options.");
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
const authURL = storefrontConfig.oauth.apiHost;
|
|
37
|
-
const JWKS = createRemoteJWKSet(new URL("/.well-known/jwks.json", authURL), {
|
|
38
|
-
cacheMaxAge: 5 * 60 * 1e3
|
|
39
|
-
// Cache Keys for 5 minutes.
|
|
40
|
-
});
|
|
41
|
-
await useOauth(event, JWKS);
|
|
42
|
-
}
|
|
43
22
|
async function bootstrap(event, url, $shopConfig, $storefrontConfig, apiBasePath, config) {
|
|
44
23
|
const log = event.context.$log;
|
|
45
24
|
const bootstrapLog = log.space("bootstrap");
|
|
@@ -129,7 +108,6 @@ export default defineEventHandler(async (event) => {
|
|
|
129
108
|
}
|
|
130
109
|
const $shopConfig = getShopConfig(event, config);
|
|
131
110
|
const apiBasePath = ($storefrontConfig.shopSelector === "path" && $shopConfig.path ? `/${$shopConfig.path}` : "") + ($shopConfig.apiBasePath || $storefrontConfig.apiBasePath || "/api");
|
|
132
|
-
const log = event.context.$log;
|
|
133
111
|
if (!event.context.$rpcContext) {
|
|
134
112
|
await bootstrap(
|
|
135
113
|
event,
|
|
@@ -143,7 +121,6 @@ export default defineEventHandler(async (event) => {
|
|
|
143
121
|
if ($storefrontConfig.redirects?.enabled && !url.pathname.startsWith(apiBasePath)) {
|
|
144
122
|
await useRedirects(event);
|
|
145
123
|
}
|
|
146
|
-
await handleOauth(event, $storefrontConfig, log);
|
|
147
124
|
} catch (e) {
|
|
148
125
|
console.error(e);
|
|
149
126
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.50.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
"test:watch": "vitest watch"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@nuxt/kit": "3.
|
|
64
|
-
"@scayle/h3-session": "0.3.
|
|
65
|
-
"@scayle/storefront-core": "7.
|
|
63
|
+
"@nuxt/kit": "3.9.1",
|
|
64
|
+
"@scayle/h3-session": "0.3.5",
|
|
65
|
+
"@scayle/storefront-core": "7.36.0",
|
|
66
66
|
"@scayle/unstorage-compression-driver": "0.1.1",
|
|
67
67
|
"@vueuse/core": "10.7.1",
|
|
68
68
|
"consola": "3.2.3",
|
|
69
69
|
"core-js": "3.35.0",
|
|
70
70
|
"defu": "6.1.4",
|
|
71
|
-
"h3": "1.
|
|
71
|
+
"h3": "1.10.0",
|
|
72
72
|
"jose": "4.15.4",
|
|
73
73
|
"knitwork": "1.0.0",
|
|
74
74
|
"nitropack": "2.8.1",
|
|
@@ -81,36 +81,38 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@nuxt/module-builder": "0.5.5",
|
|
84
|
-
"@nuxt/schema": "3.
|
|
84
|
+
"@nuxt/schema": "3.9.1",
|
|
85
85
|
"@nuxt/test-utils": "3.9.0",
|
|
86
86
|
"@scayle/eslint-config-storefront": "3.2.6",
|
|
87
87
|
"@scayle/prettier-config-storefront": "2.0.2",
|
|
88
|
-
"@types/node": "20.10.
|
|
88
|
+
"@types/node": "20.10.8",
|
|
89
89
|
"eslint": "8.56.0",
|
|
90
90
|
"eslint-formatter-gitlab": "5.1.0",
|
|
91
91
|
"node-mocks-http": "1.14.1",
|
|
92
|
-
"nuxt": "3.
|
|
92
|
+
"nuxt": "3.9.1",
|
|
93
93
|
"prettier": "3.0.0",
|
|
94
94
|
"publint": "0.2.7",
|
|
95
95
|
"vitest": "1.1.3",
|
|
96
96
|
"vue-tsc": "1.8.27"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"nuxt": ">=3.
|
|
99
|
+
"nuxt": ">=3.9.1",
|
|
100
100
|
"unstorage": ">= 1.10.1",
|
|
101
|
-
"vue": ">=3.
|
|
101
|
+
"vue": ">=3.4.7"
|
|
102
102
|
},
|
|
103
103
|
"resolutions": {
|
|
104
|
-
"
|
|
105
|
-
"@vue/
|
|
106
|
-
"@vue/
|
|
107
|
-
"@vue/compiler-
|
|
108
|
-
"@vue/compiler-
|
|
109
|
-
"@vue/
|
|
110
|
-
"@vue/reactivity": "3.
|
|
111
|
-
"@vue/runtime-core": "3.
|
|
112
|
-
"@vue/runtime-dom": "3.
|
|
113
|
-
"@vue/server-renderer": "3.
|
|
104
|
+
"h3": "1.10.1",
|
|
105
|
+
"@vue/compiler-core": "3.4.7",
|
|
106
|
+
"@vue/shared": "3.4.7",
|
|
107
|
+
"@vue/compiler-dom": "3.4.7",
|
|
108
|
+
"@vue/compiler-sfc": "3.4.7",
|
|
109
|
+
"@vue/compiler-ssr": "3.4.7",
|
|
110
|
+
"@vue/reactivity": "3.4.7",
|
|
111
|
+
"@vue/runtime-core": "3.4.7",
|
|
112
|
+
"@vue/runtime-dom": "3.4.7",
|
|
113
|
+
"@vue/server-renderer": "3.4.7",
|
|
114
|
+
"@nuxt/kit": "3.9.1",
|
|
115
|
+
"@nuxt/schema": "3.9.1"
|
|
114
116
|
},
|
|
115
117
|
"volta": {
|
|
116
118
|
"node": "20.10.0"
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { errors as joseErrors, jwtVerify } from "jose";
|
|
2
|
-
import { rpcMethods } from "@scayle/storefront-core";
|
|
3
|
-
async function updateSession(event, data) {
|
|
4
|
-
const session = event.context.session;
|
|
5
|
-
Object.assign(session.data, data);
|
|
6
|
-
await session.save();
|
|
7
|
-
}
|
|
8
|
-
const updateUser = async (event) => {
|
|
9
|
-
const session = event.context.session;
|
|
10
|
-
const user = await rpcMethods.fetchUser(
|
|
11
|
-
{ accessToken: session.data.accessToken, callback: "" },
|
|
12
|
-
event.context.$rpcContext
|
|
13
|
-
);
|
|
14
|
-
await updateSession(event, {
|
|
15
|
-
user
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
const updateAccessTokenWithRefreshToken = async (event, sessionData, log) => {
|
|
19
|
-
if (!sessionData?.refreshToken) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
const context = event.context.$rpcContext;
|
|
24
|
-
const { success } = await rpcMethods.refreshAccessToken(context);
|
|
25
|
-
if (!success) {
|
|
26
|
-
await revokeTokensAndDestroySession(event, log);
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
await updateUser(event);
|
|
31
|
-
return true;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
log.error("api/oauth/me", {
|
|
34
|
-
message: "fetching user failed",
|
|
35
|
-
error: e
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
} catch (e) {
|
|
39
|
-
log.error("v1/oauth/token", {
|
|
40
|
-
message: "refresh access token failed, so the local tokens were deleted",
|
|
41
|
-
error: e
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
};
|
|
46
|
-
const revokeTokensAndDestroySession = async (event, log) => {
|
|
47
|
-
log.debug("revokeTokensAndDestroySession");
|
|
48
|
-
const context = event.context.$rpcContext;
|
|
49
|
-
try {
|
|
50
|
-
await rpcMethods.oauthRevokeToken(context);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
log.error("v1/oauth/tokens", {
|
|
53
|
-
message: "error when revoking an access token",
|
|
54
|
-
error: e
|
|
55
|
-
});
|
|
56
|
-
} finally {
|
|
57
|
-
await context.destroySession();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const updateSessionWithUser = async (event, sessionData, log) => {
|
|
61
|
-
try {
|
|
62
|
-
const user = await rpcMethods.fetchUser(
|
|
63
|
-
{ accessToken: sessionData.accessToken, callback: "" },
|
|
64
|
-
event.context.$rpcContext
|
|
65
|
-
);
|
|
66
|
-
await updateSession(event, {
|
|
67
|
-
user
|
|
68
|
-
});
|
|
69
|
-
} catch (e) {
|
|
70
|
-
log.error("api/oauth/me", {
|
|
71
|
-
message: "fetching user failed",
|
|
72
|
-
error: e
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
export async function useOauth(event, jwks) {
|
|
77
|
-
const context = event.context.$rpcContext;
|
|
78
|
-
const log = event.context.$rpcContext.log.space("core").space("session");
|
|
79
|
-
const sessionData = event.context.session.data;
|
|
80
|
-
log.debug("validating oauth");
|
|
81
|
-
if (!sessionData?.accessToken && !sessionData?.refreshToken) {
|
|
82
|
-
log.debug("no tokens saved on session; skipping validation");
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (!sessionData?.accessToken) {
|
|
86
|
-
log.debug("destroying session");
|
|
87
|
-
await context.destroySession();
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
log.debug("validating existing session");
|
|
92
|
-
await jwtVerify(sessionData.accessToken, jwks, { clockTolerance: 5 });
|
|
93
|
-
if (!sessionData?.user) {
|
|
94
|
-
log.debug("updating user session");
|
|
95
|
-
await updateSessionWithUser(event, sessionData, log);
|
|
96
|
-
}
|
|
97
|
-
return;
|
|
98
|
-
} catch (e) {
|
|
99
|
-
log.debug("error validating session");
|
|
100
|
-
if (e instanceof joseErrors.JWTExpired) {
|
|
101
|
-
log.debug("token expired");
|
|
102
|
-
const wasTokenSuccessfullyRefreshed = await updateAccessTokenWithRefreshToken(event, sessionData, log);
|
|
103
|
-
if (wasTokenSuccessfullyRefreshed) {
|
|
104
|
-
log.debug("token successfully refreshed");
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
log.error("Could not verify JWT", e);
|
|
109
|
-
}
|
|
110
|
-
log.debug("revoking token and destroying session");
|
|
111
|
-
await revokeTokensAndDestroySession(event, log);
|
|
112
|
-
}
|