@functionalcms/svelte-components 4.15.0 → 4.16.1

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.
@@ -1,6 +1,7 @@
1
1
  export { authenticationHandle } from './auth/authenticationHandle.js';
2
2
  export { default as authorizationHandle } from './auth/authorizationHandle.js';
3
3
  export { default as errorHandler } from './auth/errorHandle.js';
4
+ export { default as getRedirection } from './server-side/redirection.js';
4
5
  export { redisSessionProvider } from './auth/redisSessionProvider.js';
5
6
  export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
6
7
  export { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
@@ -1,6 +1,7 @@
1
1
  export { authenticationHandle } from './auth/authenticationHandle.js';
2
2
  export { default as authorizationHandle } from './auth/authorizationHandle.js';
3
3
  export { default as errorHandler } from './auth/errorHandle.js';
4
+ export { default as getRedirection } from './server-side/redirection.js';
4
5
  export { redisSessionProvider } from './auth/redisSessionProvider.js';
5
6
  export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.js';
6
7
  export { userAuthenticationProvider } from './auth/userAuthenticationProvider.js';
@@ -1,6 +1,7 @@
1
1
  export { authenticationHandle } from './auth/authenticationHandle.ts';
2
2
  export { default as authorizationHandle } from './auth/authorizationHandle.ts';
3
3
  export { default as errorHandler } from './auth/errorHandle.ts';
4
+ export { default as getRedirection } from './server-side/redirection.ts';
4
5
  export { redisSessionProvider } from './auth/redisSessionProvider.ts';
5
6
  export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.ts';
6
7
  export { userAuthenticationProvider } from './auth/userAuthenticationProvider.ts';
@@ -1,6 +1,7 @@
1
1
  export { authenticationHandle } from './auth/authenticationHandle.ts';
2
2
  export { default as authorizationHandle } from './auth/authorizationHandle.ts';
3
3
  export { default as errorHandler } from './auth/errorHandle.ts';
4
+ export { default as getRedirection } from './server-side/redirection.ts';
4
5
  export { redisSessionProvider } from './auth/redisSessionProvider.ts';
5
6
  export { machineAuthenticationProvider } from './auth/machineAuthenticationProvider.ts';
6
7
  export { userAuthenticationProvider } from './auth/userAuthenticationProvider.ts';
@@ -0,0 +1,6 @@
1
+ import { type Handle } from '@sveltejs/kit';
2
+ declare const getRedirection: (redirects: Array<{
3
+ path: string;
4
+ destination: string;
5
+ }>) => Handle;
6
+ export default getRedirection;
@@ -0,0 +1,16 @@
1
+ import { redirect } from '@sveltejs/kit';
2
+ const getRedirection = (redirects) => {
3
+ const redirection = async ({ event, resolve }) => {
4
+ const { url } = event;
5
+ const redirectUrl = redirects.find(redirect => redirect.path === url.pathname);
6
+ ;
7
+ if (redirectUrl) {
8
+ throw redirect(307, redirectUrl.destination);
9
+ }
10
+ else {
11
+ return await resolve(event);
12
+ }
13
+ };
14
+ return redirection;
15
+ };
16
+ export default getRedirection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "4.15.0",
3
+ "version": "4.16.1",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [