@entro314labs/entro-auth 1.8.0-beta.12 → 1.8.0-beta.13
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/dist/_virtual/_rolldown/runtime.mjs +4 -4
- package/dist/api/dispatch.d.mts +1 -1
- package/dist/api/dispatch.mjs +4 -4
- package/dist/api/index.d.mts +6 -6
- package/dist/api/index.mjs +7 -7
- package/dist/api/middlewares/authorization.mjs +1 -1
- package/dist/api/middlewares/origin-check.mjs +4 -4
- package/dist/api/rate-limiter/index.mjs +1 -1
- package/dist/api/routes/account.mjs +5 -5
- package/dist/api/routes/callback.mjs +3 -3
- package/dist/api/routes/email-verification.d.mts +1 -1
- package/dist/api/routes/email-verification.mjs +6 -6
- package/dist/api/routes/error.mjs +2 -2
- package/dist/api/routes/id-token-nonce.mjs +3 -3
- package/dist/api/routes/ok.mjs +1 -1
- package/dist/api/routes/password.mjs +4 -4
- package/dist/api/routes/session.d.mts +1 -1
- package/dist/api/routes/session.mjs +3 -3
- package/dist/api/routes/sign-in.mjs +5 -5
- package/dist/api/routes/sign-out.mjs +2 -2
- package/dist/api/routes/sign-up.d.mts +1 -1
- package/dist/api/routes/sign-up.mjs +6 -6
- package/dist/api/routes/update-session.d.mts +1 -1
- package/dist/api/routes/update-session.mjs +3 -3
- package/dist/api/routes/update-user.d.mts +1 -1
- package/dist/api/routes/update-user.mjs +4 -4
- package/dist/api/to-auth-endpoints.mjs +2 -2
- package/dist/auth/base.mjs +2 -2
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/auth/trusted-origins.mjs +1 -1
- package/dist/client/config.d.mts +6 -6
- package/dist/client/config.mjs +2 -2
- package/dist/client/index.d.mts +2 -2
- package/dist/client/lynx/index.d.mts +3 -3
- package/dist/client/lynx/index.mjs +1 -1
- package/dist/client/lynx/lynx-store.d.mts +1 -1
- package/dist/client/lynx/lynx-store.mjs +1 -1
- package/dist/client/path-to-object.d.mts +3 -3
- package/dist/client/proxy.mjs +2 -2
- package/dist/client/query.d.mts +2 -2
- package/dist/client/query.mjs +1 -1
- package/dist/client/react/index.d.mts +3 -3
- package/dist/client/react/index.mjs +1 -1
- package/dist/client/react/react-store.mjs +1 -1
- package/dist/client/session-atom.d.mts +2 -2
- package/dist/client/session-atom.mjs +1 -1
- package/dist/client/solid/index.d.mts +4 -4
- package/dist/client/solid/index.mjs +1 -1
- package/dist/client/svelte/index.d.mts +4 -4
- package/dist/client/svelte/index.mjs +1 -1
- package/dist/client/types.d.mts +9 -9
- package/dist/client/vanilla.d.mts +4 -4
- package/dist/client/vanilla.mjs +1 -1
- package/dist/client/vue/index.d.mts +4 -4
- package/dist/client/vue/index.mjs +1 -1
- package/dist/context/create-context.mjs +9 -9
- package/dist/context/helpers.mjs +4 -4
- package/dist/context/init-minimal.mjs +1 -1
- package/dist/context/init.mjs +1 -1
- package/dist/context/secret-utils.mjs +1 -1
- package/dist/cookies/index.d.mts +3 -3
- package/dist/cookies/index.mjs +7 -7
- package/dist/cookies/jwt.mjs +1 -1
- package/dist/cookies/session-store.mjs +3 -3
- package/dist/crypto/index.d.mts +1 -1
- package/dist/crypto/index.mjs +4 -4
- package/dist/crypto/jwt.mjs +1 -2
- package/dist/crypto/password.d.mts +10 -5
- package/dist/crypto/password.mjs +5 -5
- package/dist/db/adapter-kysely.mjs +1 -1
- package/dist/db/get-migration.d.mts +1 -1
- package/dist/db/get-migration.mjs +6 -6
- package/dist/db/get-schema.mjs +1 -1
- package/dist/db/index.mjs +1 -1
- package/dist/db/internal-adapter.d.mts +2 -2
- package/dist/db/internal-adapter.mjs +8 -8
- package/dist/db/revoke-unproven-account-access.d.mts +1 -1
- package/dist/db/schema.d.mts +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/integrations/next-js.mjs +1 -1
- package/dist/integrations/node.d.mts +1 -1
- package/dist/integrations/svelte-kit.d.mts +1 -1
- package/dist/integrations/svelte-kit.mjs +1 -1
- package/dist/integrations/tanstack-start-solid.mjs +1 -1
- package/dist/integrations/tanstack-start.mjs +1 -1
- package/dist/oauth2/account-key.mjs +1 -2
- package/dist/oauth2/callback.mjs +1 -1
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/link-account.mjs +4 -4
- package/dist/oauth2/state.d.mts +1 -1
- package/dist/oauth2/state.mjs +1 -1
- package/dist/{package.mjs → package.json.mjs} +1 -1
- package/dist/plugins/access/types.d.mts +1 -1
- package/dist/plugins/admin/admin.d.mts +5 -5
- package/dist/plugins/admin/admin.mjs +2 -2
- package/dist/plugins/admin/client.d.mts +1 -1
- package/dist/plugins/admin/error-codes.d.mts +1 -1
- package/dist/plugins/admin/routes.mjs +5 -5
- package/dist/plugins/admin/types.d.mts +1 -1
- package/dist/plugins/anonymous/index.mjs +4 -4
- package/dist/plugins/anonymous/types.d.mts +2 -2
- package/dist/plugins/bearer/index.mjs +3 -3
- package/dist/plugins/captcha/index.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +1 -1
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +1 -1
- package/dist/plugins/custom-session/client.d.mts +1 -1
- package/dist/plugins/custom-session/index.mjs +1 -1
- package/dist/plugins/device-authorization/index.d.mts +8 -8
- package/dist/plugins/device-authorization/index.mjs +2 -2
- package/dist/plugins/device-authorization/routes.d.mts +2 -2
- package/dist/plugins/device-authorization/routes.mjs +5 -4
- package/dist/plugins/email-otp/index.mjs +1 -1
- package/dist/plugins/email-otp/routes.mjs +4 -4
- package/dist/plugins/generic-oauth/index.d.mts +2 -2
- package/dist/plugins/generic-oauth/index.mjs +6 -6
- package/dist/plugins/generic-oauth/providers/index.d.mts +38 -0
- package/dist/plugins/generic-oauth/providers/line.mjs +1 -1
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +2 -2
- package/dist/plugins/haveibeenpwned/index.mjs +4 -4
- package/dist/plugins/jwt/client.d.mts +3 -3
- package/dist/plugins/jwt/cookie-cache.mjs +2 -2
- package/dist/plugins/jwt/index.d.mts +2 -2
- package/dist/plugins/jwt/index.mjs +3 -3
- package/dist/plugins/jwt/sign.d.mts +1 -1
- package/dist/plugins/jwt/sign.mjs +2 -2
- package/dist/plugins/jwt/types.d.mts +2 -2
- package/dist/plugins/jwt/utils.d.mts +1 -1
- package/dist/plugins/jwt/utils.mjs +1 -1
- package/dist/plugins/jwt/verify.d.mts +1 -1
- package/dist/plugins/jwt/verify.mjs +4 -4
- package/dist/plugins/last-login-method/index.mjs +1 -1
- package/dist/plugins/magic-link/index.mjs +2 -2
- package/dist/plugins/multi-session/index.d.mts +1 -1
- package/dist/plugins/multi-session/index.mjs +2 -2
- package/dist/plugins/oauth-popup/client.d.mts +2 -2
- package/dist/plugins/oauth-popup/index.mjs +4 -4
- package/dist/plugins/oauth-proxy/index.mjs +4 -4
- package/dist/plugins/oauth-proxy/utils.mjs +1 -1
- package/dist/plugins/one-tap/client.d.mts +1 -1
- package/dist/plugins/one-tap/client.mjs +1 -1
- package/dist/plugins/one-tap/index.mjs +5 -5
- package/dist/plugins/one-time-token/index.d.mts +1 -1
- package/dist/plugins/one-time-token/index.mjs +3 -4
- package/dist/plugins/open-api/generator.d.mts +4 -4
- package/dist/plugins/open-api/generator.mjs +1 -1
- package/dist/plugins/open-api/index.mjs +1 -1
- package/dist/plugins/organization/adapter.d.mts +3 -3
- package/dist/plugins/organization/adapter.mjs +4 -4
- package/dist/plugins/organization/call.mjs +1 -1
- package/dist/plugins/organization/client.d.mts +3 -3
- package/dist/plugins/organization/client.mjs +1 -1
- package/dist/plugins/organization/has-permission.d.mts +1 -1
- package/dist/plugins/organization/has-permission.mjs +2 -2
- package/dist/plugins/organization/organization.d.mts +1 -1
- package/dist/plugins/organization/organization.mjs +3 -3
- package/dist/plugins/organization/routes/crud-access-control.d.mts +1 -1
- package/dist/plugins/organization/routes/crud-access-control.mjs +3 -3
- package/dist/plugins/organization/routes/crud-invites.d.mts +24 -24
- package/dist/plugins/organization/routes/crud-invites.mjs +4 -4
- package/dist/plugins/organization/routes/crud-members.d.mts +19 -19
- package/dist/plugins/organization/routes/crud-members.mjs +4 -4
- package/dist/plugins/organization/routes/crud-org.d.mts +16 -16
- package/dist/plugins/organization/routes/crud-org.mjs +3 -3
- package/dist/plugins/organization/routes/crud-team.d.mts +1 -1
- package/dist/plugins/organization/routes/crud-team.mjs +4 -4
- package/dist/plugins/organization/schema.d.mts +2 -2
- package/dist/plugins/organization/types.d.mts +2 -2
- package/dist/plugins/phone-number/client.d.mts +4 -4
- package/dist/plugins/phone-number/error-codes.d.mts +4 -4
- package/dist/plugins/phone-number/index.d.mts +4 -4
- package/dist/plugins/phone-number/index.mjs +2 -2
- package/dist/plugins/phone-number/routes.mjs +4 -4
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/index.d.mts +1 -1
- package/dist/plugins/siwe/index.mjs +4 -4
- package/dist/plugins/test-utils/auth-helpers.mjs +1 -1
- package/dist/plugins/test-utils/cookie-builder.mjs +2 -4
- package/dist/plugins/two-factor/backup-codes/index.d.mts +1 -1
- package/dist/plugins/two-factor/backup-codes/index.mjs +4 -4
- package/dist/plugins/two-factor/claim.d.mts +1 -1
- package/dist/plugins/two-factor/claim.mjs +1 -1
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/index.d.mts +4 -4
- package/dist/plugins/two-factor/index.mjs +6 -6
- package/dist/plugins/two-factor/otp/index.d.mts +1 -1
- package/dist/plugins/two-factor/otp/index.mjs +3 -3
- package/dist/plugins/two-factor/totp/index.d.mts +1 -1
- package/dist/plugins/two-factor/totp/index.mjs +5 -5
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/two-factor/verify-two-factor.d.mts +1 -1
- package/dist/plugins/two-factor/verify-two-factor.mjs +2 -2
- package/dist/plugins/username/client.d.mts +1 -1
- package/dist/plugins/username/error-codes.d.mts +1 -1
- package/dist/plugins/username/index.d.mts +6 -6
- package/dist/plugins/username/index.mjs +4 -4
- package/dist/plugins/username/schema.d.mts +4 -4
- package/dist/state.d.mts +2 -2
- package/dist/state.mjs +3 -3
- package/dist/test-utils/http-test-instance.d.mts +7 -7
- package/dist/test-utils/http-test-instance.mjs +1 -1
- package/dist/test-utils/test-instance.d.mts +2 -2
- package/dist/test-utils/test-instance.mjs +4 -4
- package/dist/types/adapter.d.mts +2 -2
- package/dist/types/api.d.mts +1 -1
- package/dist/types/auth.d.mts +2 -2
- package/dist/types/index.d.mts +1 -1
- package/dist/types/models.d.mts +3 -3
- package/dist/types/plugins.d.mts +1 -1
- package/dist/utils/hashing.mjs +1 -1
- package/dist/utils/url.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +28 -28
|
@@ -3,14 +3,14 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __exportAll = (all,
|
|
7
|
-
let target = {};
|
|
6
|
+
var __exportAll = (all, flags) => {
|
|
7
|
+
let target = Object.setPrototypeOf({}, null);
|
|
8
8
|
for (var name in all) __defProp(target, name, {
|
|
9
9
|
get: all[name],
|
|
10
10
|
enumerable: true
|
|
11
11
|
});
|
|
12
|
-
if (!
|
|
13
|
-
return target;
|
|
12
|
+
if (!(flags & 1)) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
package/dist/api/dispatch.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthContext } from "@entro314labs/entro-auth-core";
|
|
2
|
-
import { Endpoint, EndpointContext, InputContext } from "better-call";
|
|
3
2
|
import "@entro314labs/entro-auth-core/api";
|
|
3
|
+
import { Endpoint, EndpointContext, InputContext } from "better-call";
|
|
4
4
|
/**
|
|
5
5
|
* Input accepted by {@link dispatchAuthEndpoint}. `context` must already be a
|
|
6
6
|
* resolved `AuthContext`; the caller owns `baseURL` resolution. A fresh
|
package/dist/api/dispatch.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { isAPIError } from "../utils/is-api-error.mjs";
|
|
2
|
-
import { isRequestLike } from "../utils/url.mjs";
|
|
3
1
|
import { runWithEndpointContext } from "@entro314labs/entro-auth-core/context";
|
|
4
2
|
import { shouldPublishLog } from "@entro314labs/entro-auth-core/env";
|
|
5
3
|
import { APIError } from "@entro314labs/entro-auth-core/error";
|
|
6
|
-
import { createDefu } from "defu";
|
|
7
4
|
import { ATTR_CONTEXT, ATTR_HOOK_TYPE, ATTR_HTTP_ROUTE, ATTR_OPERATION_ID, createWithSpan } from "@entro314labs/entro-auth-core/instrumentation";
|
|
8
|
-
import { kAPIErrorHeaderSymbol, toResponse } from "better-call";
|
|
9
5
|
import { getInternalAuthCompletion } from "@entro314labs/entro-auth-core/utils/auth-completion";
|
|
6
|
+
import { kAPIErrorHeaderSymbol, toResponse } from "better-call";
|
|
7
|
+
import { createDefu } from "defu";
|
|
8
|
+
import { isAPIError } from "../utils/is-api-error.mjs";
|
|
9
|
+
import { isRequestLike } from "../utils/url.mjs";
|
|
10
10
|
// src/api/dispatch.ts
|
|
11
11
|
const defuReplaceArrays = createDefu((obj, key, value) => {
|
|
12
12
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
package/dist/api/index.d.mts
CHANGED
|
@@ -2,6 +2,12 @@ import { OverrideMerge, Prettify as Prettify$1, UnionToIntersection } from "../t
|
|
|
2
2
|
import { AdditionalSessionFieldsInput, AdditionalUserFieldsInput } from "../types/models.mjs";
|
|
3
3
|
import "../index.mjs";
|
|
4
4
|
import "../types/index.mjs";
|
|
5
|
+
import { AuthContext, Awaitable, EntroAuthOptions, EntroAuthPlugin } from "@entro314labs/entro-auth-core";
|
|
6
|
+
import { InternalLogger } from "@entro314labs/entro-auth-core/env";
|
|
7
|
+
import { Middleware } from "better-call";
|
|
8
|
+
import { AuthEndpoint, AuthMiddleware, NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
9
|
+
import { APIError } from "@entro314labs/entro-auth-core/error";
|
|
10
|
+
import { getIP } from "@entro314labs/entro-auth-core/utils/ip";
|
|
5
11
|
import { generateGenericState, parseGenericState } from "../state.mjs";
|
|
6
12
|
import { isAPIError } from "../utils/is-api-error.mjs";
|
|
7
13
|
import { DispatchContext, dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
@@ -24,12 +30,6 @@ import { changeEmail, changePassword, deleteUser, deleteUserCallback, setPasswor
|
|
|
24
30
|
import "./routes/index.mjs";
|
|
25
31
|
import { addOAuthServerContext, getOAuthState } from "./state/oauth.mjs";
|
|
26
32
|
import { getShouldSkipSessionRefresh, setShouldSkipSessionRefresh } from "./state/should-session-refresh.mjs";
|
|
27
|
-
import { AuthContext, Awaitable, EntroAuthOptions, EntroAuthPlugin } from "@entro314labs/entro-auth-core";
|
|
28
|
-
import { InternalLogger } from "@entro314labs/entro-auth-core/env";
|
|
29
|
-
import { APIError } from "@entro314labs/entro-auth-core/error";
|
|
30
|
-
import { getIP } from "@entro314labs/entro-auth-core/utils/ip";
|
|
31
|
-
import { Middleware } from "better-call";
|
|
32
|
-
import { AuthEndpoint, AuthMiddleware, NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
33
33
|
export declare function checkEndpointConflicts(options: EntroAuthOptions, logger: InternalLogger): void;
|
|
34
34
|
export declare function getEndpoints<Option extends EntroAuthOptions>(ctx: Awaitable<AuthContext>, options: Option): {
|
|
35
35
|
api: OverrideMerge<{
|
package/dist/api/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { logger } from "@entro314labs/entro-auth-core/env";
|
|
2
|
+
import { ATTR_CONTEXT, ATTR_HOOK_TYPE, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP_ROUTE, createWithSpan } from "@entro314labs/entro-auth-core/instrumentation";
|
|
3
|
+
import { normalizePathname } from "@entro314labs/entro-auth-core/utils/url";
|
|
4
|
+
import { createRouter } from "better-call";
|
|
1
5
|
import { isAPIError } from "../utils/is-api-error.mjs";
|
|
2
6
|
import { requireOrgRole, requireResourceOwnership } from "./middlewares/authorization.mjs";
|
|
3
7
|
import { formCsrfMiddleware, originCheck, originCheckMiddleware } from "./middlewares/origin-check.mjs";
|
|
@@ -16,17 +20,13 @@ import { signOut } from "./routes/sign-out.mjs";
|
|
|
16
20
|
import { signUpEmail } from "./routes/sign-up.mjs";
|
|
17
21
|
import { updateSession } from "./routes/update-session.mjs";
|
|
18
22
|
import { toAuthEndpoints } from "./to-auth-endpoints.mjs";
|
|
23
|
+
import { NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
24
|
+
import { APIError } from "@entro314labs/entro-auth-core/error";
|
|
25
|
+
import { getIP } from "@entro314labs/entro-auth-core/utils/ip";
|
|
19
26
|
import { generateGenericState, parseGenericState } from "../state.mjs";
|
|
20
27
|
import { dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
21
28
|
import { addOAuthServerContext, getOAuthState } from "./state/oauth.mjs";
|
|
22
29
|
import { getShouldSkipSessionRefresh, setShouldSkipSessionRefresh } from "./state/should-session-refresh.mjs";
|
|
23
|
-
import { logger } from "@entro314labs/entro-auth-core/env";
|
|
24
|
-
import { APIError } from "@entro314labs/entro-auth-core/error";
|
|
25
|
-
import { getIP } from "@entro314labs/entro-auth-core/utils/ip";
|
|
26
|
-
import { ATTR_CONTEXT, ATTR_HOOK_TYPE, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP_ROUTE, createWithSpan } from "@entro314labs/entro-auth-core/instrumentation";
|
|
27
|
-
import { normalizePathname } from "@entro314labs/entro-auth-core/utils/url";
|
|
28
|
-
import { createRouter } from "better-call";
|
|
29
|
-
import { NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
30
30
|
// src/api/index.ts
|
|
31
31
|
function checkEndpointConflicts(options, logger) {
|
|
32
32
|
const endpointRegistry = /* @__PURE__ */ new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { APIError } from "@entro314labs/entro-auth-core/error";
|
|
2
1
|
import { createAuthMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError } from "@entro314labs/entro-auth-core/error";
|
|
3
3
|
// src/api/middlewares/authorization.ts
|
|
4
4
|
/**
|
|
5
5
|
* Middleware that verifies the authenticated user owns a resource.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { matchesOriginPattern } from "../../auth/trusted-origins.mjs";
|
|
2
|
-
import { getBaseURL, getOrigin } from "../../utils/url.mjs";
|
|
3
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
4
|
-
import { normalizePathname } from "@entro314labs/entro-auth-core/utils/url";
|
|
5
1
|
import { createAuthMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
6
3
|
import { deprecate } from "@entro314labs/entro-auth-core/utils/deprecate";
|
|
4
|
+
import { normalizePathname } from "@entro314labs/entro-auth-core/utils/url";
|
|
5
|
+
import { matchesOriginPattern } from "../../auth/trusted-origins.mjs";
|
|
6
|
+
import { getBaseURL, getOrigin } from "../../utils/url.mjs";
|
|
7
7
|
// src/api/middlewares/origin-check.ts
|
|
8
8
|
/**
|
|
9
9
|
* Checks if CSRF should be skipped for backward compatibility.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { wildcardMatch } from "../../utils/wildcard.mjs";
|
|
2
1
|
import { EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
3
2
|
import { createRateLimitKey, getIP } from "@entro314labs/entro-auth-core/utils/ip";
|
|
4
3
|
import { normalizePathname } from "@entro314labs/entro-auth-core/utils/url";
|
|
4
|
+
import { wildcardMatch } from "../../utils/wildcard.mjs";
|
|
5
5
|
// src/api/rate-limiter/index.ts
|
|
6
6
|
const memory = /* @__PURE__ */ new Map();
|
|
7
7
|
const MEMORY_STORE_MAX_ENTRIES = 1e5;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
3
|
+
import { additionalAuthorizationParamsSchema, parseStringBoolean, supportsIdTokenSignIn, verifyProviderIdToken } from "@entro314labs/entro-auth-core/oauth2";
|
|
4
|
+
import { SocialProviderListEnum } from "@entro314labs/entro-auth-core/social-providers";
|
|
5
|
+
import * as z from "zod";
|
|
1
6
|
import { getAwaitableValue } from "../../context/helpers.mjs";
|
|
2
7
|
import { shouldBindAccountCookieToSessionUser } from "../../context/store-capabilities.mjs";
|
|
3
8
|
import { getAccountCookie, setAccountCookie } from "../../cookies/session-store.mjs";
|
|
@@ -12,11 +17,6 @@ import { generateIdTokenNonce, generateState } from "../../oauth2/state.mjs";
|
|
|
12
17
|
import { decryptOAuthToken, encryptAccountTokens, getOAuthCallbackPath, setTokenUtil } from "../../oauth2/utils.mjs";
|
|
13
18
|
import { consumeIssuedIdTokenNonce } from "./id-token-nonce.mjs";
|
|
14
19
|
import { freshSessionMiddleware, getSessionFromCtx, isStateful, sensitiveSessionMiddleware, sessionMiddleware } from "./session.mjs";
|
|
15
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
16
|
-
import { additionalAuthorizationParamsSchema, parseStringBoolean, supportsIdTokenSignIn, verifyProviderIdToken } from "@entro314labs/entro-auth-core/oauth2";
|
|
17
|
-
import { SocialProviderListEnum } from "@entro314labs/entro-auth-core/social-providers";
|
|
18
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
19
|
-
import * as z from "zod";
|
|
20
20
|
// src/api/routes/account.ts
|
|
21
21
|
function parseStoredScopes(scope) {
|
|
22
22
|
if (!scope) return [];
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { appendQueryParams } from "@entro314labs/entro-auth-core/utils/url";
|
|
3
|
+
import * as z from "zod";
|
|
1
4
|
import { getAwaitableValue } from "../../context/helpers.mjs";
|
|
2
5
|
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
3
6
|
import { resolveOAuthAccountFields } from "../../oauth2/account-fields.mjs";
|
|
@@ -8,9 +11,6 @@ import { generateIdTokenNonce, generateState, parseState } from "../../oauth2/st
|
|
|
8
11
|
import { getOAuthCallbackPath } from "../../oauth2/utils.mjs";
|
|
9
12
|
import { HIDE_METADATA } from "../../utils/hide-metadata.mjs";
|
|
10
13
|
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
11
|
-
import { appendQueryParams } from "@entro314labs/entro-auth-core/utils/url";
|
|
12
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
13
|
-
import * as z from "zod";
|
|
14
14
|
// src/api/routes/callback.ts
|
|
15
15
|
const schema = z.object({
|
|
16
16
|
code: z.string().optional(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { User } from "../../types/models.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
2
|
import { GenericEndpointContext } from "@entro314labs/entro-auth-core";
|
|
4
3
|
import * as z from "zod";
|
|
4
|
+
import "../../types/index.mjs";
|
|
5
5
|
export declare function createEmailVerificationToken(secret: string, email: string,
|
|
6
6
|
/**
|
|
7
7
|
* The email to update from
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
3
|
+
import { appendQueryParams } from "@entro314labs/entro-auth-core/utils/url";
|
|
4
|
+
import { jwtVerify } from "jose";
|
|
5
|
+
import { JWTExpired } from "jose/errors";
|
|
6
|
+
import * as z from "zod";
|
|
1
7
|
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
2
8
|
import { signJWT } from "../../crypto/jwt.mjs";
|
|
3
9
|
import { parseUserOutput } from "../../db/schema.mjs";
|
|
4
10
|
import { safeCloneRequest } from "../../utils/request.mjs";
|
|
5
11
|
import { originCheck } from "../middlewares/origin-check.mjs";
|
|
6
12
|
import { getSessionFromCtx } from "./session.mjs";
|
|
7
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
8
|
-
import { appendQueryParams } from "@entro314labs/entro-auth-core/utils/url";
|
|
9
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
10
|
-
import * as z from "zod";
|
|
11
|
-
import { jwtVerify } from "jose";
|
|
12
|
-
import { JWTExpired } from "jose/errors";
|
|
13
13
|
// src/api/routes/email-verification.ts
|
|
14
14
|
async function createEmailVerificationToken(secret, email, updateTo, expiresIn = 3600, extraPayload) {
|
|
15
15
|
return await signJWT({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
2
|
import { isProduction } from "@entro314labs/entro-auth-core/env";
|
|
3
3
|
import { appendQueryParams } from "@entro314labs/entro-auth-core/utils/url";
|
|
4
|
-
import {
|
|
4
|
+
import { HIDE_METADATA } from "../../utils/hide-metadata.mjs";
|
|
5
5
|
// src/api/routes/error.ts
|
|
6
6
|
function sanitize(input) {
|
|
7
7
|
return input.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/&(?!amp;|lt;|gt;|quot;|#39;|#x[0-9a-fA-F]+;|#[0-9]+;)/g, "&");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { generateRandomString } from "../../crypto/random.mjs";
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
3
2
|
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
4
3
|
import { SocialProviderListEnum } from "@entro314labs/entro-auth-core/social-providers";
|
|
5
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
6
4
|
import * as z from "zod";
|
|
5
|
+
import { getAwaitableValue } from "../../context/helpers.mjs";
|
|
6
|
+
import { generateRandomString } from "../../crypto/random.mjs";
|
|
7
7
|
// src/api/routes/id-token-nonce.ts
|
|
8
8
|
const ISSUED_NONCE_EXPIRES_IN_MS = 3e5;
|
|
9
9
|
const ISSUED_NONCE_LENGTH = 32;
|
package/dist/api/routes/ok.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HIDE_METADATA } from "../../utils/hide-metadata.mjs";
|
|
2
1
|
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { HIDE_METADATA } from "../../utils/hide-metadata.mjs";
|
|
3
3
|
// src/api/routes/ok.ts
|
|
4
4
|
const ok = createAuthEndpoint("/ok", {
|
|
5
5
|
method: "GET",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
3
|
+
import { generateId } from "@entro314labs/entro-auth-core/utils/id";
|
|
4
|
+
import * as z from "zod";
|
|
1
5
|
import { getDate } from "../../utils/date.mjs";
|
|
2
6
|
import { assertPasswordNotTooLong, assertPasswordNotTooShort, resetCredentialPassword, validatePassword } from "../../utils/password.mjs";
|
|
3
7
|
import { originCheck } from "../middlewares/origin-check.mjs";
|
|
4
8
|
import { sensitiveSessionMiddleware } from "./session.mjs";
|
|
5
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
6
|
-
import { generateId } from "@entro314labs/entro-auth-core/utils/id";
|
|
7
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
8
|
-
import * as z from "zod";
|
|
9
9
|
// src/api/routes/password.ts
|
|
10
10
|
function redirectError(ctx, callbackURL, query) {
|
|
11
11
|
const url = callbackURL ? new URL(callbackURL, ctx.baseURL) : new URL(`${ctx.baseURL}/error`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Prettify } from "../../types/helper.mjs";
|
|
2
2
|
import { Session, User } from "../../types/models.mjs";
|
|
3
|
-
import "../../types/index.mjs";
|
|
4
3
|
import { EntroAuthOptions, GenericEndpointContext } from "@entro314labs/entro-auth-core";
|
|
5
4
|
import * as z from "zod";
|
|
5
|
+
import "../../types/index.mjs";
|
|
6
6
|
export declare const getSession: <Option extends EntroAuthOptions>() => import("better-call").StrictEndpoint<"/get-session", {
|
|
7
7
|
method: ("GET" | "POST")[];
|
|
8
8
|
operationId: string;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createAuthEndpoint, createAuthMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
3
|
+
import * as z from "zod";
|
|
1
4
|
import { hasServerSessionStore } from "../../context/store-capabilities.mjs";
|
|
2
5
|
import { decodeCookieCache, deleteSessionCookie, expireCookie, setCookieCache, setSessionCookie } from "../../cookies/index.mjs";
|
|
3
6
|
import { createSessionStore, getChunkedCookie, getSessionQuerySchema } from "../../cookies/session-store.mjs";
|
|
@@ -5,9 +8,6 @@ import { parseSessionOutput, parseUserOutput } from "../../db/schema.mjs";
|
|
|
5
8
|
import { getDate } from "../../utils/date.mjs";
|
|
6
9
|
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
7
10
|
import { getShouldSkipSessionRefresh } from "../state/should-session-refresh.mjs";
|
|
8
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
9
|
-
import { createAuthEndpoint, createAuthMiddleware } from "@entro314labs/entro-auth-core/api";
|
|
10
|
-
import * as z from "zod";
|
|
11
11
|
// src/api/routes/session.ts
|
|
12
12
|
const getSession = () => createAuthEndpoint("/get-session", {
|
|
13
13
|
method: ["GET", "POST"],
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
3
|
+
import { additionalAuthorizationParamsSchema, supportsIdTokenSignIn, verifyProviderIdToken } from "@entro314labs/entro-auth-core/oauth2";
|
|
4
|
+
import { SocialProviderListEnum } from "@entro314labs/entro-auth-core/social-providers";
|
|
5
|
+
import * as z from "zod";
|
|
1
6
|
import { getAwaitableValue } from "../../context/helpers.mjs";
|
|
2
7
|
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
3
8
|
import { parseUserOutput } from "../../db/schema.mjs";
|
|
@@ -12,11 +17,6 @@ import { safeCloneRequest } from "../../utils/request.mjs";
|
|
|
12
17
|
import { formCsrfMiddleware } from "../middlewares/origin-check.mjs";
|
|
13
18
|
import { createEmailVerificationToken } from "./email-verification.mjs";
|
|
14
19
|
import { consumeIssuedIdTokenNonce } from "./id-token-nonce.mjs";
|
|
15
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
16
|
-
import { additionalAuthorizationParamsSchema, supportsIdTokenSignIn, verifyProviderIdToken } from "@entro314labs/entro-auth-core/oauth2";
|
|
17
|
-
import { SocialProviderListEnum } from "@entro314labs/entro-auth-core/social-providers";
|
|
18
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
19
|
-
import * as z from "zod";
|
|
20
20
|
// src/api/routes/sign-in.ts
|
|
21
21
|
const socialSignInBodySchema = z.object({
|
|
22
22
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import * as z from "zod";
|
|
1
3
|
import { shouldBindAccountCookieToSessionUser } from "../../context/store-capabilities.mjs";
|
|
2
4
|
import { getAccountCookie } from "../../cookies/session-store.mjs";
|
|
3
5
|
import { deleteSessionCookie } from "../../cookies/index.mjs";
|
|
4
6
|
import { decryptOAuthToken } from "../../oauth2/utils.mjs";
|
|
5
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
6
|
-
import * as z from "zod";
|
|
7
7
|
// src/api/routes/sign-out.ts
|
|
8
8
|
const signOutBodySchema = z.object({
|
|
9
9
|
callbackURL: z.string().meta({ description: "The URL to redirect to after provider logout" }).optional(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AdditionalUserFieldsInput, User } from "../../types/models.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
2
|
import { EntroAuthOptions } from "@entro314labs/entro-auth-core";
|
|
4
3
|
import * as z from "zod";
|
|
4
|
+
import "../../types/index.mjs";
|
|
5
5
|
export declare const signUpEmail: <O extends EntroAuthOptions>() => import("better-call").StrictEndpoint<"/sign-up/email", {
|
|
6
6
|
method: "POST";
|
|
7
7
|
operationId: string;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { queueAfterTransactionHook, runWithTransaction } from "@entro314labs/entro-auth-core/context";
|
|
3
|
+
import { isDevelopment } from "@entro314labs/entro-auth-core/env";
|
|
4
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
5
|
+
import { generateId } from "@entro314labs/entro-auth-core/utils/id";
|
|
6
|
+
import * as z from "zod";
|
|
1
7
|
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
2
8
|
import { buildSyntheticUserOutput, parseUserInput, parseUserOutput } from "../../db/schema.mjs";
|
|
3
9
|
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
@@ -5,12 +11,6 @@ import { assertPasswordNotTooLong, assertPasswordNotTooShort } from "../../utils
|
|
|
5
11
|
import { safeCloneRequest } from "../../utils/request.mjs";
|
|
6
12
|
import { formCsrfMiddleware } from "../middlewares/origin-check.mjs";
|
|
7
13
|
import { createEmailVerificationToken } from "./email-verification.mjs";
|
|
8
|
-
import { queueAfterTransactionHook, runWithTransaction } from "@entro314labs/entro-auth-core/context";
|
|
9
|
-
import { isDevelopment } from "@entro314labs/entro-auth-core/env";
|
|
10
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
11
|
-
import { generateId } from "@entro314labs/entro-auth-core/utils/id";
|
|
12
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
13
|
-
import * as z from "zod";
|
|
14
14
|
// src/api/routes/sign-up.ts
|
|
15
15
|
const signUpEmailBodySchema = z.object({
|
|
16
16
|
name: z.string(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AdditionalSessionFieldsInput } from "../../types/models.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
2
|
import { EntroAuthOptions } from "@entro314labs/entro-auth-core";
|
|
4
3
|
import * as z from "zod";
|
|
4
|
+
import "../../types/index.mjs";
|
|
5
5
|
export declare const updateSession: <O extends EntroAuthOptions>() => import("better-call").StrictEndpoint<"/update-session", {
|
|
6
6
|
method: "POST";
|
|
7
7
|
operationId: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
3
|
+
import * as z from "zod";
|
|
1
4
|
import { deleteSessionCookie, setSessionCookie } from "../../cookies/index.mjs";
|
|
2
5
|
import { parseSessionInput, parseSessionOutput } from "../../db/schema.mjs";
|
|
3
6
|
import { isStateful, sessionMiddleware } from "./session.mjs";
|
|
4
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
5
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
6
|
-
import * as z from "zod";
|
|
7
7
|
// src/api/routes/update-session.ts
|
|
8
8
|
const updateSessionBodySchema = z.record(z.string().meta({ description: "Field name must be a string" }), z.any());
|
|
9
9
|
const updateSession = () => createAuthEndpoint("/update-session", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AdditionalUserFieldsInput } from "../../types/models.mjs";
|
|
2
|
-
import "../../types/index.mjs";
|
|
3
2
|
import { EntroAuthOptions } from "@entro314labs/entro-auth-core";
|
|
4
3
|
import * as z from "zod";
|
|
4
|
+
import "../../types/index.mjs";
|
|
5
5
|
export declare const updateUser: <O extends EntroAuthOptions>() => import("better-call").StrictEndpoint<"/update-user", {
|
|
6
6
|
method: "POST";
|
|
7
7
|
operationId: string;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
2
|
+
import { runWithTransaction } from "@entro314labs/entro-auth-core/context";
|
|
3
|
+
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
4
|
+
import * as z from "zod";
|
|
1
5
|
import { deleteSessionCookie, setSessionCookie } from "../../cookies/index.mjs";
|
|
2
6
|
import { generateRandomString } from "../../crypto/random.mjs";
|
|
3
7
|
import { parseUserInput, parseUserOutput } from "../../db/schema.mjs";
|
|
@@ -5,10 +9,6 @@ import { assertPasswordNotTooLong, assertPasswordNotTooShort } from "../../utils
|
|
|
5
9
|
import { originCheck } from "../middlewares/origin-check.mjs";
|
|
6
10
|
import { createEmailVerificationToken } from "./email-verification.mjs";
|
|
7
11
|
import { getSessionFromCtx, isStateful, sensitiveSessionMiddleware, sessionMiddleware } from "./session.mjs";
|
|
8
|
-
import { runWithTransaction } from "@entro314labs/entro-auth-core/context";
|
|
9
|
-
import { APIError, BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
10
|
-
import { createAuthEndpoint } from "@entro314labs/entro-auth-core/api";
|
|
11
|
-
import * as z from "zod";
|
|
12
12
|
// src/api/routes/update-user.ts
|
|
13
13
|
const updateUserBodySchema = z.record(z.string().meta({ description: "Field name must be a string" }), z.any());
|
|
14
14
|
const updateUser = () => createAuthEndpoint("/update-user", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { hasRequestState, runWithRequestState } from "@entro314labs/entro-auth-core/context";
|
|
2
|
+
import { APIError, EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
1
3
|
import { pickSource, resolveDynamicTrustedProxyHeaders, resolveRequestContext } from "../context/helpers.mjs";
|
|
2
4
|
import { isDynamicBaseURLConfig, isRequestLike } from "../utils/url.mjs";
|
|
3
5
|
import { dispatchAuthEndpoint, getOperationId } from "./dispatch.mjs";
|
|
4
|
-
import { hasRequestState, runWithRequestState } from "@entro314labs/entro-auth-core/context";
|
|
5
|
-
import { APIError, EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
6
6
|
// src/api/to-auth-endpoints.ts
|
|
7
7
|
/**
|
|
8
8
|
* Resolves the per-call `AuthContext` for endpoints with a dynamic `baseURL`.
|
package/dist/auth/base.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { runWithAdapter } from "@entro314labs/entro-auth-core/context";
|
|
2
|
+
import { BASE_ERROR_CODES, EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
1
3
|
import { getEndpoints, router } from "../api/index.mjs";
|
|
2
4
|
import { getTrustedOrigins, getTrustedProviders, resolveDynamicTrustedProxyHeaders, resolveRequestContext } from "../context/helpers.mjs";
|
|
3
5
|
import { getBaseURL, getOrigin, isDynamicBaseURLConfig } from "../utils/url.mjs";
|
|
4
|
-
import { runWithAdapter } from "@entro314labs/entro-auth-core/context";
|
|
5
|
-
import { BASE_ERROR_CODES, EntroAuthError } from "@entro314labs/entro-auth-core/error";
|
|
6
6
|
// src/auth/base.ts
|
|
7
7
|
const createEntroAuth = (options, initFn) => {
|
|
8
8
|
const authContext = initFn(options).then((ctx) => {
|
package/dist/auth/full.d.mts
CHANGED
package/dist/auth/minimal.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
1
2
|
import { getHost, getOrigin, getProtocol } from "../utils/url.mjs";
|
|
2
3
|
import { wildcardMatch } from "../utils/wildcard.mjs";
|
|
3
|
-
import * as z from "zod";
|
|
4
4
|
// src/auth/trusted-origins.ts
|
|
5
5
|
const CONTROL_CHARACTER_PATTERN = /[\u0000-\u001f\u007f-\u009f]/;
|
|
6
6
|
const RELATIVE_URL_PARSER_ORIGIN = "https://entro-auth.invalid";
|
package/dist/client/config.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SessionData } from "./session-atom.mjs";
|
|
2
1
|
import { ClientAtomListener, EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
3
2
|
import { WritableAtom } from "nanostores";
|
|
3
|
+
import { SessionData } from "./session-atom.mjs";
|
|
4
4
|
export declare const getClientConfig: (options?: EntroAuthClientOptions | undefined, loadEnv?: boolean | undefined) => {
|
|
5
5
|
readonly baseURL: string;
|
|
6
6
|
pluginsActions: Record<string, any>;
|
|
@@ -26,18 +26,18 @@ export declare const getClientConfig: (options?: EntroAuthClientOptions | undefi
|
|
|
26
26
|
onResponse: ((context: import("@better-fetch/fetch").ResponseContext) => Promise<Response | void | import("@better-fetch/fetch").ResponseContext> | Response | import("@better-fetch/fetch").ResponseContext | void) | undefined;
|
|
27
27
|
};
|
|
28
28
|
})[];
|
|
29
|
+
method: string;
|
|
30
|
+
window?: null | undefined;
|
|
31
|
+
redirect?: RequestRedirect | undefined;
|
|
32
|
+
mode?: RequestMode | undefined;
|
|
29
33
|
cache?: RequestCache | undefined;
|
|
30
34
|
credentials?: RequestCredentials;
|
|
31
35
|
integrity?: string | undefined;
|
|
32
36
|
keepalive?: boolean | undefined;
|
|
33
|
-
method: string;
|
|
34
|
-
mode?: RequestMode | undefined;
|
|
35
37
|
priority?: RequestPriority | undefined;
|
|
36
|
-
redirect?: RequestRedirect | undefined;
|
|
37
38
|
referrer?: string | undefined;
|
|
38
39
|
referrerPolicy?: ReferrerPolicy | undefined;
|
|
39
40
|
signal?: AbortSignal | null;
|
|
40
|
-
window?: null | undefined;
|
|
41
41
|
onRetry?: ((response: import("@better-fetch/fetch").ResponseContext) => Promise<void> | void) | undefined;
|
|
42
42
|
hookOptions?: {
|
|
43
43
|
cloneResponse?: boolean;
|
|
@@ -61,7 +61,7 @@ export declare const getClientConfig: (options?: EntroAuthClientOptions | undefi
|
|
|
61
61
|
headers?: {} | {
|
|
62
62
|
[x: string]: string | undefined;
|
|
63
63
|
accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
|
|
64
|
-
"content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "
|
|
64
|
+
"content-type"?: ((string & {}) | "application/json" | "application/x-www-form-urlencoded" | "text/plain" | "application/octet-stream" | "multipart/form-data") | undefined;
|
|
65
65
|
authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
|
|
66
66
|
} | undefined;
|
|
67
67
|
body?: any;
|
package/dist/client/config.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { createFetch } from "@better-fetch/fetch";
|
|
2
|
+
import { defu as defu$1 } from "defu";
|
|
1
3
|
import { getBaseURL } from "../utils/url.mjs";
|
|
2
4
|
import { redirectPlugin } from "./fetch-plugins.mjs";
|
|
3
5
|
import { parseJSON } from "./parser.mjs";
|
|
4
6
|
import { getSessionAtom, hydrateSessionAtom } from "./session-atom.mjs";
|
|
5
|
-
import { defu as defu$1 } from "defu";
|
|
6
|
-
import { createFetch } from "@better-fetch/fetch";
|
|
7
7
|
// src/client/config.ts
|
|
8
8
|
const resolvePublicAuthUrl = (basePath) => {
|
|
9
9
|
if (typeof process === "undefined") return void 0;
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EntroAuthOptions, EntroAuthPlugin } from "@entro314labs/entro-auth-core";
|
|
1
2
|
import { BroadcastChannel, BroadcastListener, BroadcastMessage, getGlobalBroadcastChannel, kBroadcastChannel } from "./broadcast-channel.mjs";
|
|
2
3
|
import { isJsonEqual, withEquality } from "./equality.mjs";
|
|
3
4
|
import { FocusListener, FocusManager, kFocusManager } from "./focus-manager.mjs";
|
|
@@ -7,6 +8,7 @@ import { AuthQueryAtom, AuthQueryState, useAuthQuery } from "./query.mjs";
|
|
|
7
8
|
import { SessionRefreshOptions, createSessionRefreshManager } from "./session-refresh.mjs";
|
|
8
9
|
import { ClientAtomListener, ClientStore, EntroAuthClientOptions, EntroAuthClientPlugin, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferSessionFromClient, InferUserFromClient, IsSignal, SessionQueryParams } from "./types.mjs";
|
|
9
10
|
import { AuthClient, createAuthClient } from "./vanilla.mjs";
|
|
11
|
+
import { DBPrimitive } from "@entro314labs/entro-auth-core/db";
|
|
10
12
|
import "../plugins/access/index.mjs";
|
|
11
13
|
import "../plugins/organization/index.mjs";
|
|
12
14
|
import { AccessControl, ArrayElement, ExactRoleStatements, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, Statements, SubArray, Subset } from "../plugins/access/types.mjs";
|
|
@@ -19,8 +21,6 @@ import { hasPermission } from "../plugins/organization/has-permission.mjs";
|
|
|
19
21
|
import { parseRoles } from "../plugins/organization/roles.mjs";
|
|
20
22
|
import { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization } from "../plugins/organization/organization.mjs";
|
|
21
23
|
import { CamelCase, InferCtx, InferRoute, InferRoutes, InferSessionUpdateCtx, InferSignUpEmailCtx, InferUserUpdateCtx, MergeRoutes, PathToObject, ProxyRequest } from "./path-to-object.mjs";
|
|
22
|
-
import { EntroAuthOptions, EntroAuthPlugin } from "@entro314labs/entro-auth-core";
|
|
23
|
-
import { DBPrimitive } from "@entro314labs/entro-auth-core/db";
|
|
24
24
|
export type * from "@entro314labs/entro-auth-core/db";
|
|
25
25
|
export type * from "nanostores";
|
|
26
26
|
export type * from "@better-fetch/fetch";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
2
|
+
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
3
|
+
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
1
4
|
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
2
5
|
import { getClientConfig } from "../config.mjs";
|
|
3
6
|
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
4
7
|
import { useStore } from "./lynx-store.mjs";
|
|
5
|
-
import { EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
6
|
-
import { BASE_ERROR_CODES } from "@entro314labs/entro-auth-core/error";
|
|
7
|
-
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
10
|
type InferResolvedHooks<O extends EntroAuthClientOptions> = O extends {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
1
2
|
import { getClientConfig } from "../config.mjs";
|
|
2
3
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
4
|
import { useStore } from "./lynx-store.mjs";
|
|
4
|
-
import { capitalizeFirstLetter } from "@entro314labs/entro-auth-core/utils/string";
|
|
5
5
|
// src/client/lynx/index.ts
|
|
6
6
|
function getAtomKey(str) {
|
|
7
7
|
return `use${capitalizeFirstLetter(str)}`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InferAdditionalFromClient, InferSessionFromClient, InferUserFromClient } from "./types.mjs";
|
|
1
|
+
import { BetterFetchResponse } from "@better-fetch/fetch";
|
|
3
2
|
import { ClientFetchOption, EntroAuthClientOptions } from "@entro314labs/entro-auth-core";
|
|
4
3
|
import { SocialProviderList } from "@entro314labs/entro-auth-core/social-providers";
|
|
5
4
|
import { Endpoint, InputContext, StandardSchemaV1 as StandardSchemaV1$1 } from "better-call";
|
|
6
|
-
import {
|
|
5
|
+
import { HasRequiredKeys, IsAny, Prettify as Prettify$1, UnionToIntersection } from "../types/helper.mjs";
|
|
6
|
+
import { InferAdditionalFromClient, InferSessionFromClient, InferUserFromClient } from "./types.mjs";
|
|
7
7
|
/**
|
|
8
8
|
* Extract generic OAuth provider IDs from the client options.
|
|
9
9
|
* Supports both `$InferAuth` (server type bridge) and client plugins
|
package/dist/client/proxy.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isAtom } from "../utils/is-atom.mjs";
|
|
2
|
-
import { toKebabCase } from "@entro314labs/entro-auth-core/utils/string";
|
|
3
1
|
import { isPayloadMethod } from "@better-fetch/fetch";
|
|
2
|
+
import { toKebabCase } from "@entro314labs/entro-auth-core/utils/string";
|
|
3
|
+
import { isAtom } from "../utils/is-atom.mjs";
|
|
4
4
|
// src/client/proxy.ts
|
|
5
5
|
function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
|
|
6
6
|
function createProxy(path = []) {
|