@aooth/auth-moost 0.2.6 → 0.2.7
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/index.d.mts +97 -27
- package/dist/index.mjs +238 -128
- package/package.json +29 -26
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { HttpError, TCookieAttributesInput } from "@wooksjs/event-http";
|
|
|
5
5
|
import { FederatedIdentityStore, FederatedProfileSnapshot, MfaMethod, TransferablePolicy, TrustedDeviceRecord, UserAuthError, UserAuthErrorCode, UserCredentials, UserService } from "@aooth/user";
|
|
6
6
|
import { HttpError as HttpError$1 } from "@moostjs/event-http";
|
|
7
7
|
import { FinishWfOpts, WfFinished, useAtscriptWf } from "@atscript/moost-wf";
|
|
8
|
-
import { MoostWf, WfOutlet, WfOutletTokenConfig, WfOutletTriggerConfig, WfStateStore, WfStateStoreMemory, WfStateStrategy } from "@moostjs/event-wf";
|
|
8
|
+
import { MoostWf, WfOutlet, WfOutletTokenConfig, WfOutletTriggerConfig, WfState, WfStateStore, WfStateStoreMemory, WfStateStrategy } from "@moostjs/event-wf";
|
|
9
9
|
import { FederatedLoginService, NormalizedProfile, OAuthProviderRegistry } from "@aooth/idp";
|
|
10
10
|
import { TAtscriptAnnotatedType } from "@atscript/typescript/utils";
|
|
11
11
|
import { AuthCodeStore, AuthorizationServerMetadata, AuthorizationServerMetadata as AuthorizationServerMetadata$1, BuildAuthorizationServerMetadataOptions, BuildProtectedResourceMetadataOptions, ClientRedirectPolicy, DynamicClientRegistration, DynamicClientRegistration as DynamicClientRegistration$1, DynamicClientRegistrationOptions, IdTokenSigner, OidcClaimsResolver, PendingAuthorizationStore, ProtectedResourceMetadata, WwwAuthenticateBearerChallengeOptions, buildAuthorizationServerMetadata, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer } from "@aooth/auth/authz";
|
|
@@ -608,8 +608,9 @@ export declare class SessionEnricherProvider {
|
|
|
608
608
|
* Each `SessionInfo` is mapped through the injectable {@link SessionEnricherProvider}
|
|
609
609
|
* before returning, and the caller's own session is flagged `current: true`.
|
|
610
610
|
* Both reads default to the browser-safe set (ordinary interactive sessions);
|
|
611
|
-
* `?kind=<kind>` segments a non-browser bucket (e.g. `?kind=cli-session`)
|
|
612
|
-
* `?kind=*` returns
|
|
611
|
+
* `?kind=<kind>` segments a non-browser bucket (e.g. `?kind=cli-session`), a
|
|
612
|
+
* comma list takes several (`?kind=session,cli-session`) and `?kind=*` returns
|
|
613
|
+
* every kind.
|
|
613
614
|
* NOT `@Public()` — the auth guard rejects unauthenticated callers with 401 and
|
|
614
615
|
* ARBAC gates each action; a customer enables it with `allow("auth.sessions", "*")`.
|
|
615
616
|
*/
|
|
@@ -699,7 +700,7 @@ declare const HOOK_NAMES: readonly ["around", "beforePersist", "renderEnvelope",
|
|
|
699
700
|
* (a route's hook replaces the provider's hook of the same name).
|
|
700
701
|
*
|
|
701
702
|
* - `around(run)` — wraps everything the request does to workflow state and
|
|
702
|
-
* the outside world (
|
|
703
|
+
* the outside world (access checks, consume/start/resume, `beforePersist`,
|
|
703
704
|
* persist, outlet delivery), e.g. `(run) => db.transaction(run)`. It may
|
|
704
705
|
* call `run()` again after a failure; each run starts over from the request.
|
|
705
706
|
* - `beforePersist(state, pause)` — runs right before a paused state is
|
|
@@ -724,10 +725,30 @@ type WfTriggerHooks = Pick<WfOutletTriggerConfig, (typeof HOOK_NAMES)[number]>;
|
|
|
724
725
|
interface WfTriggerOpts extends WfTriggerHooks {
|
|
725
726
|
/**
|
|
726
727
|
* Workflow ids this trigger may START and RESUME (a leading `/` is ignored).
|
|
727
|
-
* Omitted = unrestricted; `[]` = deny every workflow. A
|
|
728
|
-
*
|
|
728
|
+
* Omitted = unrestricted; `[]` = deny every workflow. A flow is judged by
|
|
729
|
+
* the registered flow a request resolves to (an `onNotFound` flow or a
|
|
730
|
+
* parametric route that catches the id counts as that flow), and an entry
|
|
731
|
+
* admits only a flow registered under exactly that id. A refused start
|
|
732
|
+
* answers 403 `AOOTH_WORKFLOW_NOT_ALLOWED`, a refused resume 403
|
|
733
|
+
* `AOOTH_WORKFLOW_RESUME_NOT_ALLOWED`; a state token minted for a workflow
|
|
734
|
+
* outside the list is not consumed.
|
|
729
735
|
*/
|
|
730
736
|
allow?: string[];
|
|
737
|
+
/**
|
|
738
|
+
* Workflow ids this trigger may RESUME but never START — e.g. a public
|
|
739
|
+
* trigger that continues an invite flow only an admin can issue. Additive to
|
|
740
|
+
* `allow` (a resume needs no `allow` entry); a start is refused (403
|
|
741
|
+
* `AOOTH_WORKFLOW_NOT_ALLOWED`) even when `allow` lists the flow. `block`
|
|
742
|
+
* still wins.
|
|
743
|
+
*/
|
|
744
|
+
resumeOnly?: string[];
|
|
745
|
+
/**
|
|
746
|
+
* Workflow ids this trigger refuses on start AND resume (403
|
|
747
|
+
* `AOOTH_WORKFLOW_NOT_ALLOWED` on a start, `AOOTH_WORKFLOW_RESUME_NOT_ALLOWED`
|
|
748
|
+
* on a resume), whatever `allow` / `resumeOnly` say. An entry also blocks the
|
|
749
|
+
* flow it resolves to (`'user/42'` blocks `'user/:id'`).
|
|
750
|
+
*/
|
|
751
|
+
block?: string[];
|
|
731
752
|
/** Per-endpoint token wire override. Defaults to the provider's wire (`{read:['body','query','cookie'], write:'body', name:'wfs'}`). */
|
|
732
753
|
token?: WfOutletTokenConfig;
|
|
733
754
|
}
|
|
@@ -862,11 +883,19 @@ export declare class WfTriggerProvider {
|
|
|
862
883
|
/** Named strategy registry: every wf starts on `encapsulated` (default); a step calls swapStrategy('store') to move durable, and a magic-link pause swaps to `magic-link`. Built lazily so subclass overrides (storeStrategy/wfStateSecret/magicLinkStore) are in effect. */
|
|
863
884
|
protected stateRegistry(): StateRegistry;
|
|
864
885
|
/**
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
*
|
|
868
|
-
*
|
|
869
|
-
*
|
|
886
|
+
* Read the paused workflow state a resume token (`wfs`) points at, WITHOUT
|
|
887
|
+
* consuming it — e.g. to show what a link is for before its holder acts.
|
|
888
|
+
* The token is resolved exactly as a resume resolves it (its strategy
|
|
889
|
+
* prefix, the strategy's handle hashing and legacy-key rules, the strategy
|
|
890
|
+
* tag), so a peek finds what a resume would. An unknown, expired, malformed
|
|
891
|
+
* or foreign token is `null` — one answer for all. The state carries
|
|
892
|
+
* server-only context: project what you need, never send it as-is.
|
|
893
|
+
*/
|
|
894
|
+
peek(token: string): Promise<WfState | null>;
|
|
895
|
+
/**
|
|
896
|
+
* Handle one trigger request. `opts` is {@link WfTriggerOpts}: the access
|
|
897
|
+
* lists are judged by the wooks trigger before a state token is consumed, and
|
|
898
|
+
* hooks set in `opts` replace the {@link triggerHooks} of the same name.
|
|
870
899
|
*/
|
|
871
900
|
handle(opts?: WfTriggerOpts): Promise<unknown>;
|
|
872
901
|
}
|
|
@@ -878,16 +907,22 @@ export declare class WfTriggerProvider {
|
|
|
878
907
|
* that need to short-circuit (e.g. emit a custom error response) just return a
|
|
879
908
|
* non-undefined value from the overridden handler and the trigger is skipped.
|
|
880
909
|
*
|
|
881
|
-
* `opts`
|
|
910
|
+
* `opts` is `WfTriggerOpts`: the access lists `allow` / `resumeOnly` /
|
|
911
|
+
* `block` and the workflow-trigger hooks (`around`, `beforePersist`,
|
|
882
912
|
* `renderEnvelope`, `restoreOnError`, `maxRestores` — see `WfTriggerHooks`);
|
|
883
|
-
* each
|
|
913
|
+
* each hook set here replaces the provider's `triggerHooks()` hook of the
|
|
884
914
|
* same name for this route.
|
|
885
915
|
*
|
|
916
|
+
* Under `@Inherit()`, re-decorating an overridden handler REPLACES the base
|
|
917
|
+
* route's options as a whole (e.g. a narrower `allow` is the only list
|
|
918
|
+
* checked) — the trigger still runs once per request. An override without
|
|
919
|
+
* its own `@WfTrigger` keeps the base options.
|
|
920
|
+
*
|
|
886
921
|
* The single `useControllerContext().instantiate(...)` call is the one
|
|
887
922
|
* documented escape hatch: interceptors are functions, not classes, so there's
|
|
888
923
|
* no ctor to inject into. Every class still uses constructor injection.
|
|
889
924
|
*/
|
|
890
|
-
export declare const WfTrigger: (opts?: WfTriggerOpts) =>
|
|
925
|
+
export declare const WfTrigger: (opts?: WfTriggerOpts) => MethodDecorator;
|
|
891
926
|
/** Name of the outlet `AuthWorkflow` pauses on for `inviteDelivery: 'deliver' | 'return-link'`. */
|
|
892
927
|
export declare const INVITE_OUTLET = "invite";
|
|
893
928
|
/**
|
|
@@ -897,9 +932,36 @@ export declare const INVITE_OUTLET = "invite";
|
|
|
897
932
|
* (`'return-link'`). The token never rides the response on its own.
|
|
898
933
|
*/
|
|
899
934
|
export declare function createInviteOutlet(): WfOutlet;
|
|
935
|
+
/** What {@link peekInvite} tells about a pending invite — safe to show its holder. */
|
|
936
|
+
interface InvitePeek {
|
|
937
|
+
/** The invited address. */
|
|
938
|
+
email: string;
|
|
939
|
+
/** User id of the issuer — set when the invite was issued from a signed-in session. */
|
|
940
|
+
invitedBy?: string;
|
|
941
|
+
/** Roles the invite grants, when it grants any. */
|
|
942
|
+
roles?: string[];
|
|
943
|
+
/** When the link stops working (ms since epoch), when known. */
|
|
944
|
+
expiresAt?: number;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Read what an invite link (its `wfs` token) is for — the invited address,
|
|
948
|
+
* the issuer, the roles and the link's expiry — WITHOUT consuming it, e.g. to
|
|
949
|
+
* show "Ann invited you as an editor" on the invite page before the invitee
|
|
950
|
+
* acts. Resolves the token through {@link WfTriggerProvider.peek}, then checks
|
|
951
|
+
* it against the account: an invite that was replaced by a re-invite, accepted,
|
|
952
|
+
* cancelled or that is not an invite link reads as `null`, the same as an
|
|
953
|
+
* unknown or expired token.
|
|
954
|
+
*
|
|
955
|
+
* Mount it on your own route and rate-limit that route like invite
|
|
956
|
+
* redemption — e.g. `@RateLimit("30/5m", { id: "app.invite-info" })`.
|
|
957
|
+
*/
|
|
958
|
+
export declare function peekInvite(token: string, deps: {
|
|
959
|
+
trigger: WfTriggerProvider;
|
|
960
|
+
users: UserService;
|
|
961
|
+
}): Promise<InvitePeek | null>;
|
|
900
962
|
/**
|
|
901
963
|
* Caller-identity strategy for a rate-limited route (RL.spec.md §5.3):
|
|
902
|
-
* - `'ip'` — client IP (the public-endpoint mode;
|
|
964
|
+
* - `'ip'` — client IP (the public-endpoint mode; see `requestClientIp`).
|
|
903
965
|
* Evaluated PRE-guard — floods rejected before credential work.
|
|
904
966
|
* - any other string — a NAMED SUBJECT, looked up in the per-event
|
|
905
967
|
* subjects slot (see `setRateLimitSubject`) and evaluated POST-guard so
|
|
@@ -975,10 +1037,11 @@ interface RateLimitInterceptorOptions {
|
|
|
975
1037
|
/** Default key strategy for routes whose `@RateLimit` doesn't set one. Default: `'ip'`. */
|
|
976
1038
|
key?: RateLimitKeyStrategy;
|
|
977
1039
|
/**
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
1040
|
+
* @deprecated Set `trustProxy` (and `proxyHeaders`) on the HTTP app instead;
|
|
1041
|
+
* removed in 0.3. Still honoured, with a one-time warning: `true` trusts
|
|
1042
|
+
* exactly one proxy hop, read from the header family the app's
|
|
1043
|
+
* `proxyHeaders` names. Without it, the client IP is the one the HTTP app
|
|
1044
|
+
* resolves (`useRequest().getIp()`).
|
|
982
1045
|
*/
|
|
983
1046
|
trustProxy?: boolean;
|
|
984
1047
|
/** Emit draft `RateLimit-*` headers on every response of a limited route. Default: `true`. */
|
|
@@ -1007,7 +1070,7 @@ interface RateLimitInterceptorOptions {
|
|
|
1007
1070
|
* ```ts
|
|
1008
1071
|
* app.applyGlobalInterceptors(
|
|
1009
1072
|
* authGuardInterceptor({ ... }),
|
|
1010
|
-
* ...rateLimitInterceptors({ limiter
|
|
1073
|
+
* ...rateLimitInterceptors({ limiter }),
|
|
1011
1074
|
* )
|
|
1012
1075
|
* ```
|
|
1013
1076
|
*
|
|
@@ -1025,8 +1088,12 @@ interface RateLimitInterceptorOptions {
|
|
|
1025
1088
|
*
|
|
1026
1089
|
* Ownership is static per policy (from metadata/options): a route whose
|
|
1027
1090
|
* stacked policies mix both kinds is evaluated by both phases, each checking
|
|
1028
|
-
* its own policies.
|
|
1029
|
-
*
|
|
1091
|
+
* its own policies. Each policy is checked once per event: a per-event record
|
|
1092
|
+
* of the checked policies guards against double counting when the pair is also
|
|
1093
|
+
* attached per-controller (see {@link RateLimited}), and when a request runs
|
|
1094
|
+
* the handler chains of two apps sharing one router (wooks moves on to the next
|
|
1095
|
+
* chain when a handler throws) — the second chain re-answers a policy's
|
|
1096
|
+
* rejection without counting it again and checks only the policies it adds.
|
|
1030
1097
|
*
|
|
1031
1098
|
* On rejection: draft `RateLimit-*` headers + `Retry-After` are written to
|
|
1032
1099
|
* the accumulated response (they survive the throw — wooks renders the error
|
|
@@ -4285,9 +4352,10 @@ export declare class AuthWorkflow {
|
|
|
4285
4352
|
*/
|
|
4286
4353
|
checkTrustedDevice(ctx: AuthWfCtx): Promise<undefined>;
|
|
4287
4354
|
/**
|
|
4288
|
-
* Resolve the client IP from the active HTTP request
|
|
4289
|
-
*
|
|
4290
|
-
*
|
|
4355
|
+
* Resolve the client IP from the active HTTP request — the IP the HTTP app
|
|
4356
|
+
* resolves (its `trustProxy` / `proxyHeaders`), the same one the rate
|
|
4357
|
+
* limiter keys on — swallowing the case where there is no HTTP context
|
|
4358
|
+
* (unit tests that hand-roll the wf runtime).
|
|
4291
4359
|
*/
|
|
4292
4360
|
protected resolveClientIp(): string | undefined;
|
|
4293
4361
|
/**
|
|
@@ -5085,8 +5153,10 @@ export declare const AOOTH_HTTP_MESSAGES: {
|
|
|
5085
5153
|
readonly AOOTH_UNKNOWN_PROVIDER: "Unknown provider '{provider}'";
|
|
5086
5154
|
/** 429 — the one-time codes of this account or address failed too often; answered to every code send and check until the window passes. */
|
|
5087
5155
|
readonly AOOTH_CODE_LIMIT_REACHED: "Too many code attempts. Try again later.";
|
|
5088
|
-
/** 403 — the workflow trigger refused a
|
|
5156
|
+
/** 403 — the workflow trigger refused a START (outside `allow`, in `resumeOnly`, or `block`ed, or an unregistered id under `allow`). Params: `workflow`. */
|
|
5089
5157
|
readonly AOOTH_WORKFLOW_NOT_ALLOWED: "Workflow '{workflow}' is not allowed";
|
|
5158
|
+
/** 403 — a refused RESUME (not in the route's `allow` / `resumeOnly`, or `block`ed). No params: it never names the stored flow. */
|
|
5159
|
+
readonly AOOTH_WORKFLOW_RESUME_NOT_ALLOWED: "Workflow is not allowed";
|
|
5090
5160
|
};
|
|
5091
5161
|
/** A code of {@link AOOTH_HTTP_MESSAGES}. */
|
|
5092
5162
|
type AoothHttpMessageCode = keyof typeof AOOTH_HTTP_MESSAGES;
|
|
@@ -5148,4 +5218,4 @@ interface AuditEvent {
|
|
|
5148
5218
|
interface AuditEmitter {
|
|
5149
5219
|
emit(event: AuditEvent): Promise<void> | void;
|
|
5150
5220
|
}
|
|
5151
|
-
export { type AoothHttpMessageCode, type AoothMessageCode, type AoothMessageParams, type AoothMessages, type AuditEmitter, type AuditEvent, type AuthBindings, type AuthContext, type AuthDeliveryPayload, type AuthEmailEvent, type AuthEmailKind, type AuthEmailOutletDeps, type AuthLoginResponse, type AuthLogoutBody, type AuthOkResponse, type AuthOptions, type AuthRefreshBody, type AuthSmsEvent, type AuthSmsKind, type AuthWfCompletionState, type AuthWfConsentsState, type AuthWfCtx, type AuthWfMagicLinkState, type AuthWfMfaEnrollState, type AuthWfOAuthState, type AuthWfPasswordUiState, type AuthWfPincodeUiState, type AuthWfRecoveryDeliveryMode, type AuthWorkflowOpts, type AuthorizationServerMetadata, type AuthzReauthPolicy, type BuildAuthorizationServerMetadataOptions, type BuildMagicLinkUrl, type BuildProtectedResourceMetadataOptions, type ConcurrencyLimitOptions, type ConnectedAccount, type ConsentDescriptor, type ConsentDescriptorLike, type ConsentEvent, DynamicClientRegistration, type DynamicClientRegistrationOptions, type EmailSender, type EnrichedSession, type IssueResult, type LoginRedirect, type MfaSummary, type MfaTransport, type ProtectedResourceMetadata, type RateLimitBindings, type RateLimitDecision, type RateLimitDecoratorOptions, type RateLimitInterceptorOptions, type RateLimitKeyStrategy, type RateLimitRule, type RateLimitRuleInput, type RateLimitStore, RateLimitStoreMemory, RateLimiter, type RateLimiterOptions, type ResolvedAuthCookieConfig, type ResolvedAuthOptions, type ResolvedAuthWorkflowOpts, type SessionEnricher, type SessionInfo, type SetPasswordCopy, type SmsSender, type SsoProvider, type TAuthMeta, type TRateLimitMeta, type UserAuthErrorBody, type WfTriggerHooks, type WfTriggerOpts, type WwwAuthenticateBearerChallengeOptions, buildAuthorizationServerMetadata, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, generateMagicLinkToken };
|
|
5221
|
+
export { type AoothHttpMessageCode, type AoothMessageCode, type AoothMessageParams, type AoothMessages, type AuditEmitter, type AuditEvent, type AuthBindings, type AuthContext, type AuthDeliveryPayload, type AuthEmailEvent, type AuthEmailKind, type AuthEmailOutletDeps, type AuthLoginResponse, type AuthLogoutBody, type AuthOkResponse, type AuthOptions, type AuthRefreshBody, type AuthSmsEvent, type AuthSmsKind, type AuthWfCompletionState, type AuthWfConsentsState, type AuthWfCtx, type AuthWfMagicLinkState, type AuthWfMfaEnrollState, type AuthWfOAuthState, type AuthWfPasswordUiState, type AuthWfPincodeUiState, type AuthWfRecoveryDeliveryMode, type AuthWorkflowOpts, type AuthorizationServerMetadata, type AuthzReauthPolicy, type BuildAuthorizationServerMetadataOptions, type BuildMagicLinkUrl, type BuildProtectedResourceMetadataOptions, type ConcurrencyLimitOptions, type ConnectedAccount, type ConsentDescriptor, type ConsentDescriptorLike, type ConsentEvent, DynamicClientRegistration, type DynamicClientRegistrationOptions, type EmailSender, type EnrichedSession, type InvitePeek, type IssueResult, type LoginRedirect, type MfaSummary, type MfaTransport, type ProtectedResourceMetadata, type RateLimitBindings, type RateLimitDecision, type RateLimitDecoratorOptions, type RateLimitInterceptorOptions, type RateLimitKeyStrategy, type RateLimitRule, type RateLimitRuleInput, type RateLimitStore, RateLimitStoreMemory, RateLimiter, type RateLimiterOptions, type ResolvedAuthCookieConfig, type ResolvedAuthOptions, type ResolvedAuthWorkflowOpts, type SessionEnricher, type SessionInfo, type SetPasswordCopy, type SmsSender, type SsoProvider, type TAuthMeta, type TRateLimitMeta, type UserAuthErrorBody, type WfTriggerHooks, type WfTriggerOpts, type WwwAuthenticateBearerChallengeOptions, buildAuthorizationServerMetadata, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, generateMagicLinkToken };
|
package/dist/index.mjs
CHANGED
|
@@ -2,14 +2,14 @@ import { C as RemoveMfaConfirmForm, D as StepUpConfirmForm, E as SignupForm, O a
|
|
|
2
2
|
import { Controller, HandlerPaths, Inherit, Inject, InjectMoostLogger, Injectable, Intercept, MoostInit, Optional, Param, Resolve, TInterceptorPriority, defineAfterInterceptor, defineBeforeInterceptor, defineErrorInterceptor, formatMessage, getMoostMate, registerMessages, useControllerContext, useLogger, useTranslate } from "moost";
|
|
3
3
|
import { AuthCredential, AuthError, RATE_LIMIT_MESSAGES, RateLimitStoreMemory, RateLimitStoreMemory as RateLimitStoreMemory$1, RateLimiter, RateLimiter as RateLimiter$1, generateMagicLinkToken, generateOpaqueToken, parseRateLimitRule, pickGoverning } from "@aooth/auth";
|
|
4
4
|
import { current, defineWook, eventTypeKey, key, tryGetCurrent, useLocale } from "@wooksjs/event-core";
|
|
5
|
-
import { HttpError,
|
|
5
|
+
import { HttpError, useAuthorization, useCookies, useHeaders, useRequest, useResponse, useUrlParams } from "@wooksjs/event-http";
|
|
6
6
|
import { createHash, createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
7
7
|
import { useBody } from "@wooksjs/http-body";
|
|
8
8
|
import { ArbacAction, ArbacResource, getArbacMate, useArbac } from "@aooth/arbac-moost";
|
|
9
9
|
import { FederatedIdentityStore, PASSWORD_POLICY_MESSAGES, SEEN_DEVICES_DEFAULT_CAP, USER_AUTH_ERROR_MESSAGES, UserAuthError, UserService, generateMfaCode, generateTotpSecret, generateTotpUri, maskEmail, maskPhone, pickDefinedProfile, verifyTotpCode } from "@aooth/user";
|
|
10
10
|
import { Body, Delete, Get, HttpError as HttpError$1, Post, Query } from "@moostjs/event-http";
|
|
11
11
|
import { createAsHttpOutlet, finishWf, handleAsOutletRequest, useAtscriptWf } from "@atscript/moost-wf";
|
|
12
|
-
import { EncapsulatedStateStrategy, HandleStateStrategy, MoostWf, Step, StepRetriableError, StepTTL, WfStateStoreMemory, Workflow, WorkflowParam, WorkflowSchema, createEmailOutlet, outlet, outletEmail, swapStrategy, useWfFinished, useWfState } from "@moostjs/event-wf";
|
|
12
|
+
import { EncapsulatedStateStrategy, HandleStateStrategy, MoostWf, Step, StepRetriableError, StepTTL, WfStateStoreMemory, Workflow, WorkflowParam, WorkflowSchema, createEmailOutlet, normalizeWfId, outlet, outletEmail, swapStrategy, useWfFinished, useWfState } from "@moostjs/event-wf";
|
|
13
13
|
import { FederatedLoginService, OAuthError, OAuthProviderRegistry, generateRandomState, pkceChallengeFor } from "@aooth/idp";
|
|
14
14
|
import { ClientRegistrationError, DynamicClientRegistration, NoopOidcClaimsResolver, buildAuthorizationServerMetadata, buildAuthorizationServerMetadata as buildAuthorizationServerMetadata$1, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, canonicalizeIssuer as canonicalizeIssuer$1, tokenPolicyToIssueOptions } from "@aooth/auth/authz";
|
|
15
15
|
// \0@oxc-project+runtime@0.155.0/helpers/esm/decorate.js
|
|
@@ -134,8 +134,10 @@ const AOOTH_HTTP_MESSAGES = {
|
|
|
134
134
|
AOOTH_UNKNOWN_PROVIDER: "Unknown provider '{provider}'",
|
|
135
135
|
/** 429 — the one-time codes of this account or address failed too often; answered to every code send and check until the window passes. */
|
|
136
136
|
AOOTH_CODE_LIMIT_REACHED: "Too many code attempts. Try again later.",
|
|
137
|
-
/** 403 — the workflow trigger refused a
|
|
138
|
-
AOOTH_WORKFLOW_NOT_ALLOWED: "Workflow '{workflow}' is not allowed"
|
|
137
|
+
/** 403 — the workflow trigger refused a START (outside `allow`, in `resumeOnly`, or `block`ed, or an unregistered id under `allow`). Params: `workflow`. */
|
|
138
|
+
AOOTH_WORKFLOW_NOT_ALLOWED: "Workflow '{workflow}' is not allowed",
|
|
139
|
+
/** 403 — a refused RESUME (not in the route's `allow` / `resumeOnly`, or `block`ed). No params: it never names the stored flow. */
|
|
140
|
+
AOOTH_WORKFLOW_RESUME_NOT_ALLOWED: "Workflow is not allowed"
|
|
139
141
|
};
|
|
140
142
|
registerMessages(AOOTH_HTTP_MESSAGES);
|
|
141
143
|
/** An `HttpError` with `code`, `params` and the code's English text. */
|
|
@@ -511,8 +513,20 @@ const UserId = () => Resolve(() => useAuth().getUserId());
|
|
|
511
513
|
const rateLimitDecisionKey = key("aooth.rateLimit.decision");
|
|
512
514
|
/** Internal: the installed interceptors' runtime, published on every HTTP event. */
|
|
513
515
|
const rateLimitRuntimeKey = key("aooth.rateLimit.runtime");
|
|
514
|
-
|
|
515
|
-
|
|
516
|
+
const rateLimitCheckedKey = key("aooth.rateLimit.checked");
|
|
517
|
+
/**
|
|
518
|
+
* Internal: the decision of every policy already checked on `limiter` during
|
|
519
|
+
* this event, by `<phase>:<scope>` — the double-count guard (a policy registered
|
|
520
|
+
* twice on the same limiter counts once) and what a later chain on the same
|
|
521
|
+
* event re-answers.
|
|
522
|
+
*/
|
|
523
|
+
function checkedPolicies(ctx, limiter) {
|
|
524
|
+
let byLimiter = ctx.has(rateLimitCheckedKey) ? ctx.get(rateLimitCheckedKey) : void 0;
|
|
525
|
+
if (!byLimiter) ctx.set(rateLimitCheckedKey, byLimiter = /* @__PURE__ */ new Map());
|
|
526
|
+
let checked = byLimiter.get(limiter);
|
|
527
|
+
if (!checked) byLimiter.set(limiter, checked = /* @__PURE__ */ new Map());
|
|
528
|
+
return checked;
|
|
529
|
+
}
|
|
516
530
|
/**
|
|
517
531
|
* Internal: named rate-limit subjects for this event — subject kind
|
|
518
532
|
* (`'user'`, `'tenant'`, …) → resolved caller identity, written via
|
|
@@ -592,7 +606,7 @@ registerMessages(RATE_LIMIT_MESSAGES);
|
|
|
592
606
|
* ```ts
|
|
593
607
|
* app.applyGlobalInterceptors(
|
|
594
608
|
* authGuardInterceptor({ ... }),
|
|
595
|
-
* ...rateLimitInterceptors({ limiter
|
|
609
|
+
* ...rateLimitInterceptors({ limiter }),
|
|
596
610
|
* )
|
|
597
611
|
* ```
|
|
598
612
|
*
|
|
@@ -610,8 +624,12 @@ registerMessages(RATE_LIMIT_MESSAGES);
|
|
|
610
624
|
*
|
|
611
625
|
* Ownership is static per policy (from metadata/options): a route whose
|
|
612
626
|
* stacked policies mix both kinds is evaluated by both phases, each checking
|
|
613
|
-
* its own policies.
|
|
614
|
-
*
|
|
627
|
+
* its own policies. Each policy is checked once per event: a per-event record
|
|
628
|
+
* of the checked policies guards against double counting when the pair is also
|
|
629
|
+
* attached per-controller (see {@link RateLimited}), and when a request runs
|
|
630
|
+
* the handler chains of two apps sharing one router (wooks moves on to the next
|
|
631
|
+
* chain when a handler throws) — the second chain re-answers a policy's
|
|
632
|
+
* rejection without counting it again and checks only the policies it adds.
|
|
615
633
|
*
|
|
616
634
|
* On rejection: draft `RateLimit-*` headers + `Retry-After` are written to
|
|
617
635
|
* the accumulated response (they survive the throw — wooks renders the error
|
|
@@ -631,6 +649,7 @@ function rateLimitInterceptors(opts) {
|
|
|
631
649
|
const limiter = opts?.limiter ?? new RateLimiter$1();
|
|
632
650
|
const emitHeaders = opts?.headers ?? true;
|
|
633
651
|
const trustProxy = opts?.trustProxy ?? false;
|
|
652
|
+
if (opts?.trustProxy !== void 0) warnTrustProxyDeprecated();
|
|
634
653
|
const routeConfigs = /* @__PURE__ */ new WeakMap();
|
|
635
654
|
const resolveRouteConfig = (cc) => {
|
|
636
655
|
const ctor = cc.getController().constructor;
|
|
@@ -683,30 +702,36 @@ function rateLimitInterceptors(opts) {
|
|
|
683
702
|
const ctx = current();
|
|
684
703
|
if (ctx.get(eventTypeKey) !== "http") return;
|
|
685
704
|
if (!ctx.has(rateLimitRuntimeKey)) ctx.set(rateLimitRuntimeKey, runtime);
|
|
686
|
-
const done = ctx.has(rateLimitPhasesKey) ? ctx.get(rateLimitPhasesKey) : [];
|
|
687
|
-
if (done.includes(phase)) return;
|
|
688
705
|
const config = resolveRouteConfig(useControllerContext(ctx));
|
|
689
706
|
if (!config) return;
|
|
690
707
|
const owned = config[phase];
|
|
691
708
|
if (owned.length === 0) return;
|
|
692
|
-
ctx
|
|
709
|
+
const checked = checkedPolicies(ctx, limiter);
|
|
693
710
|
const decisions = [];
|
|
694
711
|
const headers = [];
|
|
695
712
|
for (const policy of owned) {
|
|
696
|
-
const
|
|
713
|
+
const id = `${phase}:${policy.scope}`;
|
|
714
|
+
const seen = checked.get(id);
|
|
715
|
+
if (seen) {
|
|
716
|
+
if (!seen.allowed) answerDecision(seen, [], false, ctx);
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
const subject = await resolveSubject(policy.keyStrategy, ctx);
|
|
697
720
|
if (subject == null) continue;
|
|
698
|
-
|
|
721
|
+
const result = await limiter.check(policy.scope, subject, policy.rules, { ...policy.defaultMessage !== void 0 && { defaultMessage: policy.defaultMessage } });
|
|
722
|
+
checked.set(id, result);
|
|
723
|
+
decisions.push(result);
|
|
699
724
|
headers.push(policy.policyHeader);
|
|
700
725
|
}
|
|
701
|
-
if (ctx.has(rateLimitDecisionKey)) decisions.unshift(ctx.get(rateLimitDecisionKey));
|
|
702
726
|
if (decisions.length === 0) return;
|
|
727
|
+
if (ctx.has(rateLimitDecisionKey)) decisions.unshift(ctx.get(rateLimitDecisionKey));
|
|
703
728
|
const decision = pickGoverning(decisions, (d) => !d.allowed);
|
|
704
729
|
ctx.set(rateLimitDecisionKey, decision);
|
|
705
730
|
answerDecision(decision, headers, emitHeaders, ctx);
|
|
706
731
|
};
|
|
707
732
|
return [defineBeforeInterceptor(() => evaluate("pre"), TInterceptorPriority.BEFORE_GUARD), defineBeforeInterceptor(() => evaluate("post"), TInterceptorPriority.AFTER_GUARD)];
|
|
708
733
|
}
|
|
709
|
-
async function resolveSubject(strategy,
|
|
734
|
+
async function resolveSubject(strategy, ctx) {
|
|
710
735
|
if (typeof strategy === "function") return await strategy();
|
|
711
736
|
if (strategy !== "ip") {
|
|
712
737
|
const subject = getRateLimitSubject(strategy, ctx);
|
|
@@ -719,29 +744,29 @@ async function resolveSubject(strategy, trustProxy, ctx) {
|
|
|
719
744
|
if (strategy === "user" && auth?.userId !== void 0) return `u:${auth.userId}`;
|
|
720
745
|
if (strategy === "session" && auth?.sessionId !== void 0) return `s:${auth.sessionId}`;
|
|
721
746
|
}
|
|
722
|
-
return `ip:${
|
|
747
|
+
return `ip:${requestClientIp(ctx)}`;
|
|
723
748
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
*/
|
|
731
|
-
function clientIp(trustProxy, ctx) {
|
|
732
|
-
const req = useRequest(ctx);
|
|
733
|
-
return trustProxy ? resolveForwarded(req.raw, trustOneHop).ip : req.getIp();
|
|
749
|
+
let warnedTrustProxy = false;
|
|
750
|
+
/** Warn once per process (at registration — no event yet) that the limiter's own `trustProxy` is deprecated. */
|
|
751
|
+
function warnTrustProxyDeprecated() {
|
|
752
|
+
if (warnedTrustProxy) return;
|
|
753
|
+
warnedTrustProxy = true;
|
|
754
|
+
console.warn("[aooth] rateLimitInterceptors({ trustProxy }) is deprecated — still honoured (one hop, using the app's proxyHeaders); removed in 0.3. Set `trustProxy` on the HTTP app instead.");
|
|
734
755
|
}
|
|
735
756
|
/**
|
|
736
|
-
* Internal: the client IP of the current HTTP event
|
|
737
|
-
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
757
|
+
* Internal: the client IP of the current HTTP event — the single source of
|
|
758
|
+
* every client IP aooth keys on (rate limits, one-time-code failure buckets,
|
|
759
|
+
* session metadata, device binding). The IP the HTTP app resolves
|
|
760
|
+
* (`useRequest().getIp()`, governed by the app's `trustProxy` /
|
|
761
|
+
* `proxyHeaders`); with the deprecated `rateLimitInterceptors({ trustProxy:
|
|
762
|
+
* true })` installed, wooks' one-hop resolution (`getIp({ trustProxy: true })`,
|
|
763
|
+
* which reads the app's `proxyHeaders` family). `""` outside an HTTP event.
|
|
740
764
|
*/
|
|
741
765
|
function requestClientIp(ctx = tryGetCurrent()) {
|
|
742
766
|
if (!ctx) return "";
|
|
743
767
|
try {
|
|
744
|
-
|
|
768
|
+
const req = useRequest(ctx);
|
|
769
|
+
return ctx.has(rateLimitRuntimeKey) && ctx.get(rateLimitRuntimeKey).trustProxy ? req.getIp({ trustProxy: true }) : req.getIp();
|
|
745
770
|
} catch {
|
|
746
771
|
return "";
|
|
747
772
|
}
|
|
@@ -778,7 +803,7 @@ async function enforceRateLimit(policy, key, ctx = tryGetCurrent()) {
|
|
|
778
803
|
const runtime = ctx.get(rateLimitRuntimeKey);
|
|
779
804
|
const rules = effectiveRules(runtime.overrides, policy.id, policy.rules);
|
|
780
805
|
if (!rules) return;
|
|
781
|
-
answerDecision(await runtime.limiter.check(policy.id, key ?? `ip:${
|
|
806
|
+
answerDecision(await runtime.limiter.check(policy.id, key ?? `ip:${requestClientIp(ctx)}`, rules), [policyHeader(rules)], runtime.emitHeaders, ctx);
|
|
782
807
|
}
|
|
783
808
|
/** The rules of policy `id` after `policies` overrides — `false` when switched off. */
|
|
784
809
|
function effectiveRules(overrides, id, declared) {
|
|
@@ -1008,6 +1033,11 @@ var BoundedWfStateStoreMemory = class extends WfStateStoreMemory {
|
|
|
1008
1033
|
};
|
|
1009
1034
|
/** Where aooth records, inside a persisted state, which strategy persisted it. */
|
|
1010
1035
|
const STRATEGY_TAG = "aoothStrategy";
|
|
1036
|
+
/**
|
|
1037
|
+
* Where aooth records, inside a persisted state, when it expires (ms; absent =
|
|
1038
|
+
* never, or unknown for a custom strategy).
|
|
1039
|
+
*/
|
|
1040
|
+
const STATE_EXPIRES_KEY = "aoothExpiresAt";
|
|
1011
1041
|
/** Padding aooth adds to encapsulated states (stripped on read). */
|
|
1012
1042
|
const PAD_KEY = "aoothPad";
|
|
1013
1043
|
/** Encapsulated payloads are padded to a multiple of this many bytes. */
|
|
@@ -1023,7 +1053,12 @@ const TAG_REQUIRED = /* @__PURE__ */ new Set([MAGIC_LINK_STRATEGY]);
|
|
|
1023
1053
|
* attempt does not destroy it. States persisted before tagging existed are
|
|
1024
1054
|
* accepted, except by strategies that always tag. Encapsulated states are also
|
|
1025
1055
|
* padded to a {@link PAD_BUCKET}-byte multiple, so the token's length does not
|
|
1026
|
-
* follow the length of what is inside.
|
|
1056
|
+
* follow the length of what is inside. The expiry the strategy applies is
|
|
1057
|
+
* recorded too ({@link STATE_EXPIRES_KEY}), as the strategy reports it through
|
|
1058
|
+
* `expiresAtFor` (the earlier of the persist-time `ttl` / `expiresAt`, else its
|
|
1059
|
+
* own default TTL), so a peek can tell when the token stops working. A strategy
|
|
1060
|
+
* without `expiresAtFor` (a custom one, or a built-in with `persist` overridden)
|
|
1061
|
+
* leaves it unrecorded.
|
|
1027
1062
|
*/
|
|
1028
1063
|
function tagStrategy(name, strategy) {
|
|
1029
1064
|
const pad = strategy instanceof EncapsulatedStateStrategy;
|
|
@@ -1032,13 +1067,16 @@ function tagStrategy(name, strategy) {
|
|
|
1032
1067
|
const tag = state.meta?.[STRATEGY_TAG];
|
|
1033
1068
|
return tag === void 0 ? !TAG_REQUIRED.has(name) : tag === name;
|
|
1034
1069
|
};
|
|
1035
|
-
const tagged = (state) => {
|
|
1036
|
-
const { [PAD_KEY]: _pad, ...meta } = state.meta ?? {};
|
|
1070
|
+
const tagged = (state, options) => {
|
|
1071
|
+
const { [PAD_KEY]: _pad, [STATE_EXPIRES_KEY]: _expires, ...meta } = state.meta ?? {};
|
|
1072
|
+
const reported = strategy.expiresAtFor?.(options);
|
|
1073
|
+
const expiresAt = reported !== void 0 && reported > 0 ? reported : void 0;
|
|
1037
1074
|
const out = {
|
|
1038
1075
|
...state,
|
|
1039
1076
|
meta: {
|
|
1040
1077
|
...meta,
|
|
1041
|
-
[STRATEGY_TAG]: name
|
|
1078
|
+
[STRATEGY_TAG]: name,
|
|
1079
|
+
...expiresAt !== void 0 && { ["aoothExpiresAt"]: expiresAt }
|
|
1042
1080
|
}
|
|
1043
1081
|
};
|
|
1044
1082
|
if (!pad) return out;
|
|
@@ -1055,7 +1093,7 @@ function tagStrategy(name, strategy) {
|
|
|
1055
1093
|
};
|
|
1056
1094
|
};
|
|
1057
1095
|
const wrapped = {
|
|
1058
|
-
persist: (state, options, overrides) => strategy.persist(tagged(state), options, overrides),
|
|
1096
|
+
persist: (state, options, overrides) => strategy.persist(tagged(state, options), options, overrides),
|
|
1059
1097
|
retrieve: async (token) => {
|
|
1060
1098
|
const state = await strategy.retrieve(token);
|
|
1061
1099
|
return accepts(state) ? clean(state) : null;
|
|
@@ -1067,7 +1105,7 @@ function tagStrategy(name, strategy) {
|
|
|
1067
1105
|
}
|
|
1068
1106
|
};
|
|
1069
1107
|
Object.defineProperty(wrapped, "inner", { value: strategy });
|
|
1070
|
-
if (strategy.persistEntry) wrapped.persistEntry = (state, options, overrides) => strategy.persistEntry(tagged(state), options, overrides);
|
|
1108
|
+
if (strategy.persistEntry) wrapped.persistEntry = (state, options, overrides) => strategy.persistEntry(tagged(state, options), options, overrides);
|
|
1071
1109
|
if (strategy.consumeEntry) wrapped.consumeEntry = async (token) => {
|
|
1072
1110
|
if (!accepts(await strategy.retrieve(token))) return null;
|
|
1073
1111
|
const entry = await strategy.consumeEntry(token);
|
|
@@ -1111,49 +1149,45 @@ const HOOK_NAMES = [
|
|
|
1111
1149
|
function deriveWfStateSecret(secret) {
|
|
1112
1150
|
return createHash("sha256").update(secret).digest();
|
|
1113
1151
|
}
|
|
1114
|
-
/** One canonical workflow-id form for allow-list matching: no leading `/`. */
|
|
1115
|
-
function normalizeWfId(id) {
|
|
1116
|
-
return id.replace(/^\/+/, "");
|
|
1117
|
-
}
|
|
1118
|
-
function notAllowed(id) {
|
|
1119
|
-
return aoothHttpError(403, "AOOTH_WORKFLOW_NOT_ALLOWED", { workflow: normalizeWfId(id) });
|
|
1120
|
-
}
|
|
1121
1152
|
/**
|
|
1122
|
-
*
|
|
1123
|
-
*
|
|
1124
|
-
*
|
|
1125
|
-
*
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1153
|
+
* The access refusals the wooks trigger raises, in aooth's public form. The
|
|
1154
|
+
* engine decides (`allow` / `resumeOnly` / `block`, judged on the resolved
|
|
1155
|
+
* flow); aooth keeps its own wire contract:
|
|
1156
|
+
*
|
|
1157
|
+
* - `WF_FORBIDDEN` (403) on a start becomes `AOOTH_WORKFLOW_NOT_ALLOWED` (403,
|
|
1158
|
+
* `workflow` param). On a resume the engine never names the stored flow, so
|
|
1159
|
+
* it becomes `AOOTH_WORKFLOW_RESUME_NOT_ALLOWED` (403, no params, a template
|
|
1160
|
+
* without a placeholder).
|
|
1161
|
+
* - `WF_NOT_FOUND` (404) — a start whose id resolves to no flow while access
|
|
1162
|
+
* lists are set — becomes `AOOTH_WORKFLOW_NOT_ALLOWED` (403) whenever `allow`
|
|
1163
|
+
* is set: unregistered ids answer like unlisted ones, so a probe cannot tell
|
|
1164
|
+
* which ids `allow` lists. With only `resumeOnly` / `block` set it stays 404.
|
|
1165
|
+
*
|
|
1166
|
+
* Anything else passes through untouched. The error is recognised by its body
|
|
1167
|
+
* code, not by class, so a second installed copy of `@wooksjs/event-http` does
|
|
1168
|
+
* not let a raw `WF_FORBIDDEN` through.
|
|
1128
1169
|
*/
|
|
1129
|
-
function
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
};
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
retrieve: (token) => strategy.retrieve(token),
|
|
1137
|
-
consume: async (token) => {
|
|
1138
|
-
await check(token);
|
|
1139
|
-
return strategy.consume(token);
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
if (strategy.persistEntry) guarded.persistEntry = (state, options, overrides) => strategy.persistEntry(state, options, overrides);
|
|
1143
|
-
if (strategy.consumeEntry) guarded.consumeEntry = async (token) => {
|
|
1144
|
-
await check(token);
|
|
1145
|
-
return strategy.consumeEntry(token);
|
|
1146
|
-
};
|
|
1147
|
-
return guarded;
|
|
1170
|
+
function mapRefusal(error, allowed) {
|
|
1171
|
+
const body = error?.body;
|
|
1172
|
+
if (!body || typeof body !== "object") return error;
|
|
1173
|
+
const wfid = typeof body.params?.wfid === "string" ? normalizeWfId(body.params.wfid) : void 0;
|
|
1174
|
+
if (body.code === "WF_FORBIDDEN") return wfid === void 0 ? aoothHttpError(403, "AOOTH_WORKFLOW_RESUME_NOT_ALLOWED") : aoothHttpError(403, "AOOTH_WORKFLOW_NOT_ALLOWED", { workflow: wfid });
|
|
1175
|
+
if (body.code === "WF_NOT_FOUND" && allowed && wfid !== void 0) return aoothHttpError(403, "AOOTH_WORKFLOW_NOT_ALLOWED", { workflow: wfid });
|
|
1176
|
+
return error;
|
|
1148
1177
|
}
|
|
1149
1178
|
/**
|
|
1150
1179
|
* Run one trigger attempt. The invite outlet reads the link callback from a
|
|
1151
1180
|
* slot reserved on the HTTP event; it is reserved per run, so a run that
|
|
1152
|
-
* `around` retries starts clean.
|
|
1181
|
+
* `around` retries starts clean. Access refusals leave in aooth's form
|
|
1182
|
+
* ({@link mapRefusal}).
|
|
1153
1183
|
*/
|
|
1154
|
-
function runTrigger(run) {
|
|
1184
|
+
async function runTrigger(run, allowed) {
|
|
1155
1185
|
reservePendingInviteLink();
|
|
1156
|
-
|
|
1186
|
+
try {
|
|
1187
|
+
return await run();
|
|
1188
|
+
} catch (error) {
|
|
1189
|
+
throw mapRefusal(error, allowed);
|
|
1190
|
+
}
|
|
1157
1191
|
}
|
|
1158
1192
|
let WfTriggerProvider = class WfTriggerProvider {
|
|
1159
1193
|
wf;
|
|
@@ -1271,39 +1305,43 @@ let WfTriggerProvider = class WfTriggerProvider {
|
|
|
1271
1305
|
return this.cachedState;
|
|
1272
1306
|
}
|
|
1273
1307
|
/**
|
|
1274
|
-
*
|
|
1275
|
-
*
|
|
1276
|
-
*
|
|
1277
|
-
*
|
|
1278
|
-
*
|
|
1308
|
+
* Read the paused workflow state a resume token (`wfs`) points at, WITHOUT
|
|
1309
|
+
* consuming it — e.g. to show what a link is for before its holder acts.
|
|
1310
|
+
* The token is resolved exactly as a resume resolves it (its strategy
|
|
1311
|
+
* prefix, the strategy's handle hashing and legacy-key rules, the strategy
|
|
1312
|
+
* tag), so a peek finds what a resume would. An unknown, expired, malformed
|
|
1313
|
+
* or foreign token is `null` — one answer for all. The state carries
|
|
1314
|
+
* server-only context: project what you need, never send it as-is.
|
|
1315
|
+
*/
|
|
1316
|
+
async peek(token) {
|
|
1317
|
+
const i = token.indexOf(".");
|
|
1318
|
+
if (i <= 0 || i === token.length - 1) return null;
|
|
1319
|
+
const strategies = this.stateRegistry().strategies;
|
|
1320
|
+
const name = token.slice(0, i);
|
|
1321
|
+
if (!Object.hasOwn(strategies, name)) return null;
|
|
1322
|
+
return strategies[name].retrieve(token.slice(i + 1));
|
|
1323
|
+
}
|
|
1324
|
+
/**
|
|
1325
|
+
* Handle one trigger request. `opts` is {@link WfTriggerOpts}: the access
|
|
1326
|
+
* lists are judged by the wooks trigger before a state token is consumed, and
|
|
1327
|
+
* hooks set in `opts` replace the {@link triggerHooks} of the same name.
|
|
1279
1328
|
*/
|
|
1280
1329
|
async handle(opts = {}) {
|
|
1281
1330
|
const wfApp = this.wf.getWfApp();
|
|
1282
1331
|
current().set(pincodeKeySlot, this.pincodeKey());
|
|
1283
|
-
const allowed = opts.allow && new Set(opts.allow.map(normalizeWfId));
|
|
1284
|
-
const permits = (schemaId) => !allowed || allowed.has(normalizeWfId(schemaId));
|
|
1285
|
-
const registry = this.stateRegistry();
|
|
1286
|
-
const stateConfig = allowed ? {
|
|
1287
|
-
default: registry.default,
|
|
1288
|
-
strategies: Object.fromEntries(Object.entries(registry.strategies).map(([name, strategy]) => [name, guardStrategy(strategy, permits)]))
|
|
1289
|
-
} : registry;
|
|
1290
1332
|
const deps = {
|
|
1291
|
-
start: (schemaId, context, o) => {
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
eventContext: o?.eventContext ?? current(),
|
|
1304
|
-
strategy: o?.strategy
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1333
|
+
start: (schemaId, context, o) => wfApp.start(schemaId, context, {
|
|
1334
|
+
input: o?.input,
|
|
1335
|
+
eventContext: o?.eventContext ?? current(),
|
|
1336
|
+
strategy: o?.strategy,
|
|
1337
|
+
expectSchemaId: o?.expectSchemaId
|
|
1338
|
+
}),
|
|
1339
|
+
resume: (state, o) => wfApp.resume(state, {
|
|
1340
|
+
input: o?.input,
|
|
1341
|
+
eventContext: o?.eventContext ?? current(),
|
|
1342
|
+
strategy: o?.strategy
|
|
1343
|
+
}),
|
|
1344
|
+
resolveSchemaId: (id, o) => this.wf.resolveSchemaId(id, o)
|
|
1307
1345
|
};
|
|
1308
1346
|
const base = this.triggerHooks();
|
|
1309
1347
|
const hooks = {};
|
|
@@ -1317,10 +1355,15 @@ let WfTriggerProvider = class WfTriggerProvider {
|
|
|
1317
1355
|
return beforePersist?.(state, pause);
|
|
1318
1356
|
};
|
|
1319
1357
|
const around = opts.around ?? base.around;
|
|
1358
|
+
const { allow, resumeOnly, block } = opts;
|
|
1359
|
+
const attempt = (run) => runTrigger(run, allow !== void 0);
|
|
1320
1360
|
return handleAsOutletRequest({
|
|
1321
1361
|
...hooks,
|
|
1322
|
-
|
|
1323
|
-
|
|
1362
|
+
allow,
|
|
1363
|
+
resumeOnly,
|
|
1364
|
+
block,
|
|
1365
|
+
around: around ? (run) => around(() => attempt(run)) : attempt,
|
|
1366
|
+
state: this.stateRegistry(),
|
|
1324
1367
|
outlets: this.outlets,
|
|
1325
1368
|
token: opts.token ?? this.token
|
|
1326
1369
|
}, deps);
|
|
@@ -1329,6 +1372,18 @@ let WfTriggerProvider = class WfTriggerProvider {
|
|
|
1329
1372
|
WfTriggerProvider = __decorate([Injectable(), __decorateMetadata("design:paramtypes", [typeof MoostWf === "undefined" ? Object : MoostWf, typeof AuthCredential === "undefined" ? Object : AuthCredential])], WfTriggerProvider);
|
|
1330
1373
|
// src/wf-trigger/decorator.ts
|
|
1331
1374
|
/**
|
|
1375
|
+
* The ONE trigger interceptor every `@WfTrigger` attaches. moost dedupes
|
|
1376
|
+
* interceptors by handler reference, so a subclass override decorated again
|
|
1377
|
+
* keeps a single trigger; the options ride on the method's metadata, where
|
|
1378
|
+
* the override's own value replaces the inherited one.
|
|
1379
|
+
*/
|
|
1380
|
+
const wfTriggerInterceptor = defineAfterInterceptor(async (response, reply) => {
|
|
1381
|
+
if (await response !== void 0) return;
|
|
1382
|
+
const cc = useControllerContext();
|
|
1383
|
+
const opts = cc.getMethodMeta()?.wfTrigger ?? {};
|
|
1384
|
+
reply(await (await cc.instantiate(WfTriggerProvider)).handle(opts));
|
|
1385
|
+
}, TInterceptorPriority.INTERCEPTOR);
|
|
1386
|
+
/**
|
|
1332
1387
|
* Method decorator that turns a handler into a workflow trigger.
|
|
1333
1388
|
*
|
|
1334
1389
|
* The handler may have an empty body — the interceptor's after-phase invokes
|
|
@@ -1336,19 +1391,33 @@ WfTriggerProvider = __decorate([Injectable(), __decorateMetadata("design:paramty
|
|
|
1336
1391
|
* that need to short-circuit (e.g. emit a custom error response) just return a
|
|
1337
1392
|
* non-undefined value from the overridden handler and the trigger is skipped.
|
|
1338
1393
|
*
|
|
1339
|
-
* `opts`
|
|
1394
|
+
* `opts` is `WfTriggerOpts`: the access lists `allow` / `resumeOnly` /
|
|
1395
|
+
* `block` and the workflow-trigger hooks (`around`, `beforePersist`,
|
|
1340
1396
|
* `renderEnvelope`, `restoreOnError`, `maxRestores` — see `WfTriggerHooks`);
|
|
1341
|
-
* each
|
|
1397
|
+
* each hook set here replaces the provider's `triggerHooks()` hook of the
|
|
1342
1398
|
* same name for this route.
|
|
1343
1399
|
*
|
|
1400
|
+
* Under `@Inherit()`, re-decorating an overridden handler REPLACES the base
|
|
1401
|
+
* route's options as a whole (e.g. a narrower `allow` is the only list
|
|
1402
|
+
* checked) — the trigger still runs once per request. An override without
|
|
1403
|
+
* its own `@WfTrigger` keeps the base options.
|
|
1404
|
+
*
|
|
1344
1405
|
* The single `useControllerContext().instantiate(...)` call is the one
|
|
1345
1406
|
* documented escape hatch: interceptors are functions, not classes, so there's
|
|
1346
1407
|
* no ctor to inject into. Every class still uses constructor injection.
|
|
1347
1408
|
*/
|
|
1348
|
-
const WfTrigger = (opts = {}) =>
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1409
|
+
const WfTrigger = (opts = {}) => {
|
|
1410
|
+
const intercept = Intercept(wfTriggerInterceptor);
|
|
1411
|
+
return (target, key, descriptor) => {
|
|
1412
|
+
let first = false;
|
|
1413
|
+
getMoostMate().decorate((meta) => {
|
|
1414
|
+
first = meta.wfTrigger === void 0;
|
|
1415
|
+
meta.wfTrigger = opts;
|
|
1416
|
+
return meta;
|
|
1417
|
+
})(target, key, descriptor);
|
|
1418
|
+
if (first) intercept(target, key, descriptor);
|
|
1419
|
+
};
|
|
1420
|
+
};
|
|
1352
1421
|
/**
|
|
1353
1422
|
* Build the leg-1 federated-login authorization request — STATELESS, no flow
|
|
1354
1423
|
* store. Mints a fresh non-secret `seed`, DERIVES the PKCE verifier + OIDC nonce
|
|
@@ -4405,7 +4474,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
4405
4474
|
if (Object.keys(extra).length > 0) (ctx.admin ??= {}).form = extra;
|
|
4406
4475
|
const existing = await this.users.findByHandle(email);
|
|
4407
4476
|
const invitedBy = useAuth().getAuthContext()?.userId;
|
|
4408
|
-
const pendingIssuer = existing?.account?.pendingInvitation ? existing.account.invitedBy : void 0;
|
|
4477
|
+
const pendingIssuer = existing?.account?.pendingInvitation ? existing.account.invitedBy ?? void 0 : void 0;
|
|
4409
4478
|
if (invitedBy) (ctx.admin ??= {}).invitedBy = invitedBy;
|
|
4410
4479
|
const action = await this.duplicateInviteCheck({
|
|
4411
4480
|
email,
|
|
@@ -4608,7 +4677,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
4608
4677
|
const user = await this.users.findByIdentifier(ctx.subject);
|
|
4609
4678
|
if (!user) throw this.httpError(410, "INVITE_CANCELLED");
|
|
4610
4679
|
const current = user.account?.inviteNonce;
|
|
4611
|
-
if (current
|
|
4680
|
+
if (current != null && current !== ctx.admin?.inviteNonce) throw this.httpError(410, "INVITE_REPLACED");
|
|
4612
4681
|
return user;
|
|
4613
4682
|
}
|
|
4614
4683
|
/**
|
|
@@ -5232,16 +5301,13 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
|
|
|
5232
5301
|
} else trust.newDevice = true;
|
|
5233
5302
|
}
|
|
5234
5303
|
/**
|
|
5235
|
-
* Resolve the client IP from the active HTTP request
|
|
5236
|
-
*
|
|
5237
|
-
*
|
|
5304
|
+
* Resolve the client IP from the active HTTP request — the IP the HTTP app
|
|
5305
|
+
* resolves (its `trustProxy` / `proxyHeaders`), the same one the rate
|
|
5306
|
+
* limiter keys on — swallowing the case where there is no HTTP context
|
|
5307
|
+
* (unit tests that hand-roll the wf runtime).
|
|
5238
5308
|
*/
|
|
5239
5309
|
resolveClientIp() {
|
|
5240
|
-
|
|
5241
|
-
return useRequest().getIp() || void 0;
|
|
5242
|
-
} catch {
|
|
5243
|
-
return;
|
|
5244
|
-
}
|
|
5310
|
+
return requestClientIp() || void 0;
|
|
5245
5311
|
}
|
|
5246
5312
|
/**
|
|
5247
5313
|
* Resolve the client `User-Agent` from the active HTTP request. Sibling to
|
|
@@ -8620,6 +8686,15 @@ let SessionEnricherProvider = class SessionEnricherProvider {
|
|
|
8620
8686
|
}
|
|
8621
8687
|
};
|
|
8622
8688
|
SessionEnricherProvider = __decorate([Injectable()], SessionEnricherProvider);
|
|
8689
|
+
/**
|
|
8690
|
+
* `?kind=` as the `listSessions` filter: a comma list, values trimmed, empty
|
|
8691
|
+
* ones dropped (none left = the default browser-safe set). A comma list is
|
|
8692
|
+
* the list form — a repeated query key is refused by the HTTP layer.
|
|
8693
|
+
*/
|
|
8694
|
+
function parseKindFilter(kind) {
|
|
8695
|
+
const kinds = kind?.split(",").map((k) => k.trim()).filter((k) => k !== "");
|
|
8696
|
+
return kinds?.length ? kinds : void 0;
|
|
8697
|
+
}
|
|
8623
8698
|
let SessionsController = class SessionsController {
|
|
8624
8699
|
auth;
|
|
8625
8700
|
enricher;
|
|
@@ -8629,9 +8704,10 @@ let SessionsController = class SessionsController {
|
|
|
8629
8704
|
}
|
|
8630
8705
|
async listSessions(kind) {
|
|
8631
8706
|
const auth = useAuth();
|
|
8707
|
+
const kinds = parseKindFilter(kind);
|
|
8632
8708
|
const sessions = await this.auth.listSessions(auth.getUserId(), {
|
|
8633
8709
|
enrich: (s) => this.enricher.enrich(s),
|
|
8634
|
-
...
|
|
8710
|
+
...kinds && { kind: kinds }
|
|
8635
8711
|
});
|
|
8636
8712
|
const current = auth.getSessionId();
|
|
8637
8713
|
for (const s of sessions) s.current = s.sessionId === current;
|
|
@@ -8643,9 +8719,10 @@ let SessionsController = class SessionsController {
|
|
|
8643
8719
|
* granting cross-user visibility.
|
|
8644
8720
|
*/
|
|
8645
8721
|
async listSessionsOf(userId, kind) {
|
|
8722
|
+
const kinds = parseKindFilter(kind);
|
|
8646
8723
|
return await this.auth.listSessions(userId, {
|
|
8647
8724
|
enrich: (s) => this.enricher.enrich(s),
|
|
8648
|
-
...
|
|
8725
|
+
...kinds && { kind: kinds }
|
|
8649
8726
|
});
|
|
8650
8727
|
}
|
|
8651
8728
|
async revokeSession(sessionId) {
|
|
@@ -8704,6 +8781,39 @@ SessionsController = __decorate([
|
|
|
8704
8781
|
ArbacResource("auth.sessions"),
|
|
8705
8782
|
__decorateMetadata("design:paramtypes", [typeof AuthCredential === "undefined" ? Object : AuthCredential, typeof SessionEnricherProvider === "undefined" ? Object : SessionEnricherProvider])
|
|
8706
8783
|
], SessionsController);
|
|
8784
|
+
// src/workflow/invite-peek.ts
|
|
8785
|
+
/** Id of the invite workflow (`AuthWorkflow`'s `@Workflow("auth/invite/start")`). */
|
|
8786
|
+
const INVITE_WORKFLOW = "auth/invite/start";
|
|
8787
|
+
/**
|
|
8788
|
+
* Read what an invite link (its `wfs` token) is for — the invited address,
|
|
8789
|
+
* the issuer, the roles and the link's expiry — WITHOUT consuming it, e.g. to
|
|
8790
|
+
* show "Ann invited you as an editor" on the invite page before the invitee
|
|
8791
|
+
* acts. Resolves the token through {@link WfTriggerProvider.peek}, then checks
|
|
8792
|
+
* it against the account: an invite that was replaced by a re-invite, accepted,
|
|
8793
|
+
* cancelled or that is not an invite link reads as `null`, the same as an
|
|
8794
|
+
* unknown or expired token.
|
|
8795
|
+
*
|
|
8796
|
+
* Mount it on your own route and rate-limit that route like invite
|
|
8797
|
+
* redemption — e.g. `@RateLimit("30/5m", { id: "app.invite-info" })`.
|
|
8798
|
+
*/
|
|
8799
|
+
async function peekInvite(token, deps) {
|
|
8800
|
+
const state = await deps.trigger.peek(token);
|
|
8801
|
+
if (!state || normalizeWfId(state.schemaId) !== INVITE_WORKFLOW) return null;
|
|
8802
|
+
const ctx = state.context;
|
|
8803
|
+
const admin = ctx?.admin;
|
|
8804
|
+
if (!ctx?.subject || !ctx.email || !admin?.emailDispatched) return null;
|
|
8805
|
+
const user = await deps.users.findByIdentifier(ctx.subject);
|
|
8806
|
+
if (!user?.account?.pendingInvitation) return null;
|
|
8807
|
+
const current = user.account.inviteNonce;
|
|
8808
|
+
if (current != null && current !== admin.inviteNonce) return null;
|
|
8809
|
+
const expiresAt = state.meta?.[STATE_EXPIRES_KEY];
|
|
8810
|
+
return {
|
|
8811
|
+
email: ctx.email,
|
|
8812
|
+
...admin.invitedBy && { invitedBy: admin.invitedBy },
|
|
8813
|
+
...admin.roles && admin.roles.length > 0 && { roles: admin.roles },
|
|
8814
|
+
...typeof expiresAt === "number" && { expiresAt }
|
|
8815
|
+
};
|
|
8816
|
+
}
|
|
8707
8817
|
// src/oauth/oauth-tokens.ts
|
|
8708
8818
|
/**
|
|
8709
8819
|
* Explicit string DI token for the ABSTRACT `FederatedIdentityStore`.
|
|
@@ -8903,11 +9013,11 @@ function toConnectedAccount(i) {
|
|
|
8903
9013
|
provider: i.provider,
|
|
8904
9014
|
subject: i.subject,
|
|
8905
9015
|
linkedAt: i.linkedAt,
|
|
8906
|
-
...i.lastLoginAt
|
|
8907
|
-
...i.email
|
|
8908
|
-
...i.emailVerified
|
|
8909
|
-
...i.displayName
|
|
8910
|
-
...i.avatarUrl
|
|
9016
|
+
...i.lastLoginAt != null && { lastLoginAt: i.lastLoginAt },
|
|
9017
|
+
...i.email != null && { email: i.email },
|
|
9018
|
+
...i.emailVerified != null && { emailVerified: i.emailVerified },
|
|
9019
|
+
...i.displayName != null && { displayName: i.displayName },
|
|
9020
|
+
...i.avatarUrl != null && { avatarUrl: i.avatarUrl }
|
|
8911
9021
|
};
|
|
8912
9022
|
}
|
|
8913
9023
|
// src/authz/authorize.controller.ts
|
|
@@ -9449,4 +9559,4 @@ function createAuthEmailOutlet(deps) {
|
|
|
9449
9559
|
await deps.emailSender.send(event);
|
|
9450
9560
|
});
|
|
9451
9561
|
}
|
|
9452
|
-
export { ADD_MFA_WORKFLOW, AOOTH_HTTP_MESSAGES, AOOTH_MESSAGES, AUTHZ_BINDING_COOKIE, AUTH_CODE_STORE_TOKEN, AuthController, AuthGuarded, AuthWorkflow, AuthorizeController, AuthorizeRuntime, CHANGE_PASSWORD_WORKFLOW, CLIENT_REDIRECT_POLICY_TOKEN, ConsentStore, DEFAULT_AUTH_WORKFLOWS, DYNAMIC_CLIENT_STORE_TOKEN, DynamicClientRegistration, FEDERATED_IDENTITY_STORE_TOKEN, INVITE_OUTLET, MAGIC_LINK_OUTLET, MAGIC_LINK_STRATEGY, OAUTH_CSRF_COOKIE, OAuthController, OAuthRuntime, PENDING_AUTHORIZATION_STORE_TOKEN, Public, RESERVED_USER_KEYS, RateLimit, RateLimitStoreMemory, RateLimited, RateLimiter, SessionEnricherProvider, SessionsController, UserId, WfTrigger, WfTriggerProvider, authGuardInterceptor, authzBindingCookieAttrs, buildAuthorizationServerMetadata, buildInviteAlreadyAcceptedEnvelope, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, createAuthEmailOutlet, createInviteOutlet, createMagicLinkOutlet, deriveWfStateSecret, generateMagicLinkToken, getAuthMate, getRateLimitMate, getRateLimitSubject, haversineKm, humanizeUserAgent, isSafeRelativeRedirect, oauthCsrfCookieAttrs, parseInviteRoles, rateLimitInterceptors, renderAoothMessage, resolveAoothMessage, resolveOAuthRedirect, setRateLimitSubject, stripReservedUserKeys, useAuth, useRateLimit, userAuthErrorInterceptor, userAuthErrorToHttp };
|
|
9562
|
+
export { ADD_MFA_WORKFLOW, AOOTH_HTTP_MESSAGES, AOOTH_MESSAGES, AUTHZ_BINDING_COOKIE, AUTH_CODE_STORE_TOKEN, AuthController, AuthGuarded, AuthWorkflow, AuthorizeController, AuthorizeRuntime, CHANGE_PASSWORD_WORKFLOW, CLIENT_REDIRECT_POLICY_TOKEN, ConsentStore, DEFAULT_AUTH_WORKFLOWS, DYNAMIC_CLIENT_STORE_TOKEN, DynamicClientRegistration, FEDERATED_IDENTITY_STORE_TOKEN, INVITE_OUTLET, MAGIC_LINK_OUTLET, MAGIC_LINK_STRATEGY, OAUTH_CSRF_COOKIE, OAuthController, OAuthRuntime, PENDING_AUTHORIZATION_STORE_TOKEN, Public, RESERVED_USER_KEYS, RateLimit, RateLimitStoreMemory, RateLimited, RateLimiter, SessionEnricherProvider, SessionsController, UserId, WfTrigger, WfTriggerProvider, authGuardInterceptor, authzBindingCookieAttrs, buildAuthorizationServerMetadata, buildInviteAlreadyAcceptedEnvelope, buildProtectedResourceMetadata, buildWwwAuthenticateBearerChallenge, canonicalizeIssuer, createAuthEmailOutlet, createInviteOutlet, createMagicLinkOutlet, deriveWfStateSecret, generateMagicLinkToken, getAuthMate, getRateLimitMate, getRateLimitSubject, haversineKm, humanizeUserAgent, isSafeRelativeRedirect, oauthCsrfCookieAttrs, parseInviteRoles, peekInvite, rateLimitInterceptors, renderAoothMessage, resolveAoothMessage, resolveOAuthRedirect, setRateLimitSubject, stripReservedUserKeys, useAuth, useRateLimit, userAuthErrorInterceptor, userAuthErrorToHttp };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aooth/auth-moost",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Moost auth integration for aoothjs — AuthGuard interceptor, useAuth composable, REST endpoints, workflows",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aoothjs",
|
|
@@ -57,35 +57,38 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@atscript/moost-wf": "^0.1.
|
|
61
|
-
"@wooksjs/http-body": "^0.8.
|
|
62
|
-
"@aooth/
|
|
63
|
-
"@aooth/
|
|
64
|
-
"@aooth/
|
|
65
|
-
"@aooth/
|
|
60
|
+
"@atscript/moost-wf": "^0.1.170",
|
|
61
|
+
"@wooksjs/http-body": "^0.8.3",
|
|
62
|
+
"@aooth/arbac-moost": "^0.2.7",
|
|
63
|
+
"@aooth/auth": "0.2.7",
|
|
64
|
+
"@aooth/idp": "0.2.7",
|
|
65
|
+
"@aooth/user": "0.2.7"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@atscript/core": "^0.2.
|
|
69
|
-
"@atscript/db": "^0.1.
|
|
70
|
-
"@atscript/
|
|
71
|
-
"@atscript/
|
|
72
|
-
"@atscript/
|
|
73
|
-
"@atscript/ui
|
|
74
|
-
"@
|
|
75
|
-
"@moostjs/event-
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
68
|
+
"@atscript/core": "^0.2.11",
|
|
69
|
+
"@atscript/db": "^0.1.175",
|
|
70
|
+
"@atscript/db-sqlite": "^0.1.175",
|
|
71
|
+
"@atscript/moost-db": "^0.1.175",
|
|
72
|
+
"@atscript/typescript": "^0.2.11",
|
|
73
|
+
"@atscript/ui": "^0.1.170",
|
|
74
|
+
"@atscript/ui-fns": "^0.1.170",
|
|
75
|
+
"@moostjs/event-http": "^0.7.6",
|
|
76
|
+
"@moostjs/event-wf": "^0.7.6",
|
|
77
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
78
|
+
"better-sqlite3": "^12.6.2",
|
|
79
|
+
"moost": "^0.7.6",
|
|
80
|
+
"unplugin-atscript": "^0.2.11",
|
|
81
|
+
"wooks": "^0.8.3"
|
|
79
82
|
},
|
|
80
83
|
"peerDependencies": {
|
|
81
|
-
"@atscript/moost-wf": "^0.1.
|
|
82
|
-
"@atscript/typescript": "^0.2.
|
|
83
|
-
"@moostjs/event-http": "^0.7.
|
|
84
|
-
"@moostjs/event-wf": "^0.7.
|
|
85
|
-
"@wooksjs/event-core": "^0.8.
|
|
86
|
-
"@wooksjs/event-http": "^0.8.
|
|
87
|
-
"@wooksjs/http-body": "^0.8.
|
|
88
|
-
"moost": "^0.7.
|
|
84
|
+
"@atscript/moost-wf": "^0.1.170",
|
|
85
|
+
"@atscript/typescript": "^0.2.11",
|
|
86
|
+
"@moostjs/event-http": "^0.7.6",
|
|
87
|
+
"@moostjs/event-wf": "^0.7.6",
|
|
88
|
+
"@wooksjs/event-core": "^0.8.3",
|
|
89
|
+
"@wooksjs/event-http": "^0.8.3",
|
|
90
|
+
"@wooksjs/http-body": "^0.8.3",
|
|
91
|
+
"moost": "^0.7.6"
|
|
89
92
|
},
|
|
90
93
|
"peerDependenciesMeta": {
|
|
91
94
|
"@atscript/typescript": {
|