@sqrzro/server 2.0.0-bz.9 → 2.0.0-r19.3
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/auth.js +1 -1
- package/cache.js +1 -1
- package/dist/auth/index.cjs +3 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +110 -0
- package/dist/auth/index.d.ts +110 -6
- package/dist/auth/index.js +3 -6
- package/dist/auth/index.js.map +1 -0
- package/dist/cache/index.cjs +2 -0
- package/dist/cache/index.cjs.map +1 -0
- package/dist/cache/index.d.cts +4 -0
- package/dist/cache/index.d.ts +4 -1
- package/dist/cache/index.js +2 -1
- package/dist/cache/index.js.map +1 -0
- package/dist/database/schema.cjs +2 -0
- package/dist/database/schema.cjs.map +1 -0
- package/dist/database/schema.d.cts +405 -0
- package/dist/database/schema.d.ts +155 -34
- package/dist/database/schema.js +2 -42
- package/dist/database/schema.js.map +1 -0
- package/dist/forms/index.cjs +2 -0
- package/dist/forms/index.cjs.map +1 -0
- package/dist/forms/index.d.cts +50 -0
- package/dist/forms/index.d.ts +50 -3
- package/dist/forms/index.js +2 -3
- package/dist/forms/index.js.map +1 -0
- package/dist/lists/index.cjs +2 -0
- package/dist/lists/index.cjs.map +1 -0
- package/dist/lists/{ListService.d.ts → index.d.cts} +5 -3
- package/dist/lists/index.d.ts +18 -1
- package/dist/lists/index.js +2 -1
- package/dist/lists/index.js.map +1 -0
- package/dist/mail/index.cjs +3 -0
- package/dist/mail/index.cjs.map +1 -0
- package/dist/mail/index.d.cts +19 -0
- package/dist/mail/index.d.ts +19 -1
- package/dist/mail/index.js +3 -1
- package/dist/mail/index.js.map +1 -0
- package/dist/middleware.cjs +2 -0
- package/dist/middleware.cjs.map +1 -0
- package/dist/middleware.d.cts +5 -0
- package/dist/middleware.d.ts +5 -3
- package/dist/middleware.js +2 -30
- package/dist/middleware.js.map +1 -0
- package/dist/url/index.cjs +3 -0
- package/dist/url/index.cjs.map +1 -0
- package/dist/url/{URLService.d.ts → index.d.cts} +9 -2
- package/dist/url/index.d.ts +33 -1
- package/dist/url/index.js +3 -1
- package/dist/url/index.js.map +1 -0
- package/forms.js +1 -1
- package/jest.config.js +7 -0
- package/lists.js +1 -1
- package/mail.js +1 -1
- package/middleware.js +1 -1
- package/next-env.d.ts +5 -0
- package/package.json +77 -46
- package/schema.js +1 -1
- package/url.js +1 -1
- package/database.d.ts +0 -1
- package/database.js +0 -1
- package/dist/auth/AuthService.d.ts +0 -14
- package/dist/auth/AuthService.js +0 -135
- package/dist/auth/ClientService.d.ts +0 -11
- package/dist/auth/ClientService.js +0 -47
- package/dist/auth/LoginRequest.d.ts +0 -4
- package/dist/auth/LoginRequest.js +0 -8
- package/dist/auth/MFARequest.d.ts +0 -4
- package/dist/auth/MFARequest.js +0 -9
- package/dist/auth/MFAService.d.ts +0 -6
- package/dist/auth/MFAService.js +0 -105
- package/dist/auth/PasswordRequest.d.ts +0 -4
- package/dist/auth/PasswordRequest.js +0 -12
- package/dist/auth/PasswordResetRequest.d.ts +0 -4
- package/dist/auth/PasswordResetRequest.js +0 -13
- package/dist/auth/PasswordService.d.ts +0 -8
- package/dist/auth/PasswordService.js +0 -54
- package/dist/auth/SessionService.d.ts +0 -42
- package/dist/auth/SessionService.js +0 -127
- package/dist/auth/interfaces.d.ts +0 -20
- package/dist/auth/interfaces.js +0 -1
- package/dist/cache/CacheService.d.ts +0 -2
- package/dist/cache/CacheService.js +0 -14
- package/dist/database/DatabaseService.d.ts +0 -7
- package/dist/database/DatabaseService.js +0 -12
- package/dist/forms/FormService.d.ts +0 -16
- package/dist/forms/FormService.js +0 -78
- package/dist/forms/ImageService.d.ts +0 -7
- package/dist/forms/ImageService.js +0 -19
- package/dist/forms/ValidationError.d.ts +0 -4
- package/dist/forms/ValidationError.js +0 -7
- package/dist/forms/ValidationService.d.ts +0 -20
- package/dist/forms/ValidationService.js +0 -59
- package/dist/forms/lang.d.ts +0 -2
- package/dist/forms/lang.js +0 -115
- package/dist/lists/ListService.js +0 -28
- package/dist/mail/MailService.d.ts +0 -12
- package/dist/mail/MailService.js +0 -55
- package/dist/url/URLService.js +0 -48
package/dist/url/URLService.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { headers } from 'next/headers';
|
|
2
|
-
/**
|
|
3
|
-
* Uses a number of methods to determine the current origin.
|
|
4
|
-
*
|
|
5
|
-
* First, it checks if an `x-origin` header. This will have been set by the `handleMiddleware`
|
|
6
|
-
* function, further up the chain. For more information on how it is being set, see the
|
|
7
|
-
* `middleware` documentation.
|
|
8
|
-
*
|
|
9
|
-
* There are some situations where middleware is not being applied, such as API routes (because the
|
|
10
|
-
* redirection is not necessary, and API routes handle their own authentication). In these cases,
|
|
11
|
-
* this function tries to piece together the origin from the `x-forwarded-proto` and
|
|
12
|
-
* `x-forwarded-host` headers.
|
|
13
|
-
*
|
|
14
|
-
* Finally, if the origin cannot be determined, an error is thrown.
|
|
15
|
-
*
|
|
16
|
-
* @returns The origin of the current request.
|
|
17
|
-
*/
|
|
18
|
-
export function getOrigin() {
|
|
19
|
-
const origin = headers().get('x-origin');
|
|
20
|
-
if (origin) {
|
|
21
|
-
return origin;
|
|
22
|
-
}
|
|
23
|
-
const proto = headers().get('x-forwarded-proto');
|
|
24
|
-
const host = headers().get('x-forwarded-host');
|
|
25
|
-
if (proto && host) {
|
|
26
|
-
return `${proto}://${host}`;
|
|
27
|
-
}
|
|
28
|
-
throw new Error('No origin could be determined');
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Builds a URL from the current origin and a given pathname. For more information on how the origin
|
|
32
|
-
* is determined, see the `getOrigin` function. This function then just concatenates the origin and
|
|
33
|
-
* the pathname, and performs some cleanup to ensure the URL is valid.
|
|
34
|
-
*
|
|
35
|
-
* @param pathname
|
|
36
|
-
* @returns The URL, with the origin and pathname combined.
|
|
37
|
-
*/
|
|
38
|
-
export function getURL(pathname) {
|
|
39
|
-
const origin = getOrigin();
|
|
40
|
-
if (!pathname) {
|
|
41
|
-
return origin;
|
|
42
|
-
}
|
|
43
|
-
const isSecure = origin.startsWith('https://');
|
|
44
|
-
const protocol = isSecure ? 'https://' : 'http://';
|
|
45
|
-
const originWithoutProtocol = origin.replace(/^https?:\/\//u, '');
|
|
46
|
-
const cleanURL = `${originWithoutProtocol}/${pathname}`.replace(/\/+/gu, '/');
|
|
47
|
-
return `${protocol}${cleanURL}`;
|
|
48
|
-
}
|