@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.
Files changed (99) hide show
  1. package/auth.js +1 -1
  2. package/cache.js +1 -1
  3. package/dist/auth/index.cjs +3 -0
  4. package/dist/auth/index.cjs.map +1 -0
  5. package/dist/auth/index.d.cts +110 -0
  6. package/dist/auth/index.d.ts +110 -6
  7. package/dist/auth/index.js +3 -6
  8. package/dist/auth/index.js.map +1 -0
  9. package/dist/cache/index.cjs +2 -0
  10. package/dist/cache/index.cjs.map +1 -0
  11. package/dist/cache/index.d.cts +4 -0
  12. package/dist/cache/index.d.ts +4 -1
  13. package/dist/cache/index.js +2 -1
  14. package/dist/cache/index.js.map +1 -0
  15. package/dist/database/schema.cjs +2 -0
  16. package/dist/database/schema.cjs.map +1 -0
  17. package/dist/database/schema.d.cts +405 -0
  18. package/dist/database/schema.d.ts +155 -34
  19. package/dist/database/schema.js +2 -42
  20. package/dist/database/schema.js.map +1 -0
  21. package/dist/forms/index.cjs +2 -0
  22. package/dist/forms/index.cjs.map +1 -0
  23. package/dist/forms/index.d.cts +50 -0
  24. package/dist/forms/index.d.ts +50 -3
  25. package/dist/forms/index.js +2 -3
  26. package/dist/forms/index.js.map +1 -0
  27. package/dist/lists/index.cjs +2 -0
  28. package/dist/lists/index.cjs.map +1 -0
  29. package/dist/lists/{ListService.d.ts → index.d.cts} +5 -3
  30. package/dist/lists/index.d.ts +18 -1
  31. package/dist/lists/index.js +2 -1
  32. package/dist/lists/index.js.map +1 -0
  33. package/dist/mail/index.cjs +3 -0
  34. package/dist/mail/index.cjs.map +1 -0
  35. package/dist/mail/index.d.cts +19 -0
  36. package/dist/mail/index.d.ts +19 -1
  37. package/dist/mail/index.js +3 -1
  38. package/dist/mail/index.js.map +1 -0
  39. package/dist/middleware.cjs +2 -0
  40. package/dist/middleware.cjs.map +1 -0
  41. package/dist/middleware.d.cts +5 -0
  42. package/dist/middleware.d.ts +5 -3
  43. package/dist/middleware.js +2 -30
  44. package/dist/middleware.js.map +1 -0
  45. package/dist/url/index.cjs +3 -0
  46. package/dist/url/index.cjs.map +1 -0
  47. package/dist/url/{URLService.d.ts → index.d.cts} +9 -2
  48. package/dist/url/index.d.ts +33 -1
  49. package/dist/url/index.js +3 -1
  50. package/dist/url/index.js.map +1 -0
  51. package/forms.js +1 -1
  52. package/jest.config.js +7 -0
  53. package/lists.js +1 -1
  54. package/mail.js +1 -1
  55. package/middleware.js +1 -1
  56. package/next-env.d.ts +5 -0
  57. package/package.json +77 -46
  58. package/schema.js +1 -1
  59. package/url.js +1 -1
  60. package/database.d.ts +0 -1
  61. package/database.js +0 -1
  62. package/dist/auth/AuthService.d.ts +0 -14
  63. package/dist/auth/AuthService.js +0 -135
  64. package/dist/auth/ClientService.d.ts +0 -11
  65. package/dist/auth/ClientService.js +0 -47
  66. package/dist/auth/LoginRequest.d.ts +0 -4
  67. package/dist/auth/LoginRequest.js +0 -8
  68. package/dist/auth/MFARequest.d.ts +0 -4
  69. package/dist/auth/MFARequest.js +0 -9
  70. package/dist/auth/MFAService.d.ts +0 -6
  71. package/dist/auth/MFAService.js +0 -105
  72. package/dist/auth/PasswordRequest.d.ts +0 -4
  73. package/dist/auth/PasswordRequest.js +0 -12
  74. package/dist/auth/PasswordResetRequest.d.ts +0 -4
  75. package/dist/auth/PasswordResetRequest.js +0 -13
  76. package/dist/auth/PasswordService.d.ts +0 -8
  77. package/dist/auth/PasswordService.js +0 -54
  78. package/dist/auth/SessionService.d.ts +0 -42
  79. package/dist/auth/SessionService.js +0 -127
  80. package/dist/auth/interfaces.d.ts +0 -20
  81. package/dist/auth/interfaces.js +0 -1
  82. package/dist/cache/CacheService.d.ts +0 -2
  83. package/dist/cache/CacheService.js +0 -14
  84. package/dist/database/DatabaseService.d.ts +0 -7
  85. package/dist/database/DatabaseService.js +0 -12
  86. package/dist/forms/FormService.d.ts +0 -16
  87. package/dist/forms/FormService.js +0 -78
  88. package/dist/forms/ImageService.d.ts +0 -7
  89. package/dist/forms/ImageService.js +0 -19
  90. package/dist/forms/ValidationError.d.ts +0 -4
  91. package/dist/forms/ValidationError.js +0 -7
  92. package/dist/forms/ValidationService.d.ts +0 -20
  93. package/dist/forms/ValidationService.js +0 -59
  94. package/dist/forms/lang.d.ts +0 -2
  95. package/dist/forms/lang.js +0 -115
  96. package/dist/lists/ListService.js +0 -28
  97. package/dist/mail/MailService.d.ts +0 -12
  98. package/dist/mail/MailService.js +0 -55
  99. package/dist/url/URLService.js +0 -48
@@ -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
- }