@softistx/janus 0.0.0-stage → 0.74.0
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/LICENSE +21 -0
- package/README.md +2929 -2
- package/dist/auth/api-keys/authenticate-key.d.ts +21 -0
- package/dist/auth/api-keys/authenticate-key.d.ts.map +1 -0
- package/dist/auth/api-keys/bound.d.ts +11 -0
- package/dist/auth/api-keys/bound.d.ts.map +1 -0
- package/dist/auth/api-keys/count.d.ts +8 -0
- package/dist/auth/api-keys/count.d.ts.map +1 -0
- package/dist/auth/api-keys/create/checks.d.ts +42 -0
- package/dist/auth/api-keys/create/checks.d.ts.map +1 -0
- package/dist/auth/api-keys/create/index.d.ts +10 -0
- package/dist/auth/api-keys/create/index.d.ts.map +1 -0
- package/dist/auth/api-keys/events.d.ts +22 -0
- package/dist/auth/api-keys/events.d.ts.map +1 -0
- package/dist/auth/api-keys/expiry.d.ts +11 -0
- package/dist/auth/api-keys/expiry.d.ts.map +1 -0
- package/dist/auth/api-keys/flows.d.ts +13 -0
- package/dist/auth/api-keys/flows.d.ts.map +1 -0
- package/dist/auth/api-keys/index.d.ts +11 -0
- package/dist/auth/api-keys/index.d.ts.map +1 -0
- package/dist/auth/api-keys/read.d.ts +10 -0
- package/dist/auth/api-keys/read.d.ts.map +1 -0
- package/dist/auth/api-keys/shape.d.ts +24 -0
- package/dist/auth/api-keys/shape.d.ts.map +1 -0
- package/dist/auth/api-keys/to-api-key.d.ts +8 -0
- package/dist/auth/api-keys/to-api-key.d.ts.map +1 -0
- package/dist/auth/api-keys/token.d.ts +23 -0
- package/dist/auth/api-keys/token.d.ts.map +1 -0
- package/dist/auth/api-keys/user-bound.d.ts +10 -0
- package/dist/auth/api-keys/user-bound.d.ts.map +1 -0
- package/dist/auth/at.d.ts +9 -0
- package/dist/auth/at.d.ts.map +1 -0
- package/dist/auth/avatar/any-type.d.ts +13 -0
- package/dist/auth/avatar/any-type.d.ts.map +1 -0
- package/dist/auth/avatar/flows.d.ts +7 -0
- package/dist/auth/avatar/flows.d.ts.map +1 -0
- package/dist/auth/avatar/id.d.ts +10 -0
- package/dist/auth/avatar/id.d.ts.map +1 -0
- package/dist/auth/avatar/index.d.ts +7 -0
- package/dist/auth/avatar/index.d.ts.map +1 -0
- package/dist/auth/avatar/remove.d.ts +10 -0
- package/dist/auth/avatar/remove.d.ts.map +1 -0
- package/dist/auth/avatar/set.d.ts +12 -0
- package/dist/auth/avatar/set.d.ts.map +1 -0
- package/dist/auth/concurrency-limit.d.ts +13 -0
- package/dist/auth/concurrency-limit.d.ts.map +1 -0
- package/dist/auth/config/api-keys-config.d.ts +33 -0
- package/dist/auth/config/api-keys-config.d.ts.map +1 -0
- package/dist/auth/config/hasher.d.ts +22 -0
- package/dist/auth/config/hasher.d.ts.map +1 -0
- package/dist/auth/config/index.d.ts +24 -0
- package/dist/auth/config/index.d.ts.map +1 -0
- package/dist/auth/config/invitations-config.d.ts +74 -0
- package/dist/auth/config/invitations-config.d.ts.map +1 -0
- package/dist/auth/config/janus-config.d.ts +233 -0
- package/dist/auth/config/janus-config.d.ts.map +1 -0
- package/dist/auth/config/magic-link-config.d.ts +6 -0
- package/dist/auth/config/magic-link-config.d.ts.map +1 -0
- package/dist/auth/config/names.d.ts +9 -0
- package/dist/auth/config/names.d.ts.map +1 -0
- package/dist/auth/config/normalize.d.ts +26 -0
- package/dist/auth/config/normalize.d.ts.map +1 -0
- package/dist/auth/config/passkeys-config.d.ts +49 -0
- package/dist/auth/config/passkeys-config.d.ts.map +1 -0
- package/dist/auth/config/password-config.d.ts +22 -0
- package/dist/auth/config/password-config.d.ts.map +1 -0
- package/dist/auth/config/reserved.d.ts +14 -0
- package/dist/auth/config/reserved.d.ts.map +1 -0
- package/dist/auth/config/resolve-api-keys.d.ts +5 -0
- package/dist/auth/config/resolve-api-keys.d.ts.map +1 -0
- package/dist/auth/config/resolve-config.d.ts +9 -0
- package/dist/auth/config/resolve-config.d.ts.map +1 -0
- package/dist/auth/config/resolve-cookie.d.ts +5 -0
- package/dist/auth/config/resolve-cookie.d.ts.map +1 -0
- package/dist/auth/config/resolve-devices.d.ts +5 -0
- package/dist/auth/config/resolve-devices.d.ts.map +1 -0
- package/dist/auth/config/resolve-invitation-types.d.ts +5 -0
- package/dist/auth/config/resolve-invitation-types.d.ts.map +1 -0
- package/dist/auth/config/resolve-invitations.d.ts +5 -0
- package/dist/auth/config/resolve-invitations.d.ts.map +1 -0
- package/dist/auth/config/resolve-magic-link.d.ts +4 -0
- package/dist/auth/config/resolve-magic-link.d.ts.map +1 -0
- package/dist/auth/config/resolve-passkeys.d.ts +5 -0
- package/dist/auth/config/resolve-passkeys.d.ts.map +1 -0
- package/dist/auth/config/resolve-second-factor.d.ts +5 -0
- package/dist/auth/config/resolve-second-factor.d.ts.map +1 -0
- package/dist/auth/config/resolve-social.d.ts +17 -0
- package/dist/auth/config/resolve-social.d.ts.map +1 -0
- package/dist/auth/config/resolve-throttle.d.ts +37 -0
- package/dist/auth/config/resolve-throttle.d.ts.map +1 -0
- package/dist/auth/config/resolve-type.d.ts +6 -0
- package/dist/auth/config/resolve-type.d.ts.map +1 -0
- package/dist/auth/config/resolved-config.d.ts +126 -0
- package/dist/auth/config/resolved-config.d.ts.map +1 -0
- package/dist/auth/config/social-config.d.ts +154 -0
- package/dist/auth/config/social-config.d.ts.map +1 -0
- package/dist/auth/config/user-type.d.ts +79 -0
- package/dist/auth/config/user-type.d.ts.map +1 -0
- package/dist/auth/config/warn-throttle-window.d.ts +14 -0
- package/dist/auth/config/warn-throttle-window.d.ts.map +1 -0
- package/dist/auth/context/create-context.d.ts +31 -0
- package/dist/auth/context/create-context.d.ts.map +1 -0
- package/dist/auth/context/index.d.ts +17 -0
- package/dist/auth/context/index.d.ts.map +1 -0
- package/dist/auth/context/logins.d.ts +28 -0
- package/dist/auth/context/logins.d.ts.map +1 -0
- package/dist/auth/context/password.d.ts +34 -0
- package/dist/auth/context/password.d.ts.map +1 -0
- package/dist/auth/context/records.d.ts +27 -0
- package/dist/auth/context/records.d.ts.map +1 -0
- package/dist/auth/context/user.d.ts +21 -0
- package/dist/auth/context/user.d.ts.map +1 -0
- package/dist/auth/context/validate-fields.d.ts +12 -0
- package/dist/auth/context/validate-fields.d.ts.map +1 -0
- package/dist/auth/counter-key.d.ts +20 -0
- package/dist/auth/counter-key.d.ts.map +1 -0
- package/dist/auth/derived-keys.d.ts +9 -0
- package/dist/auth/derived-keys.d.ts.map +1 -0
- package/dist/auth/devices/cookie.d.ts +56 -0
- package/dist/auth/devices/cookie.d.ts.map +1 -0
- package/dist/auth/devices/hint.d.ts +42 -0
- package/dist/auth/devices/hint.d.ts.map +1 -0
- package/dist/auth/devices/index.d.ts +11 -0
- package/dist/auth/devices/index.d.ts.map +1 -0
- package/dist/auth/devices/report.d.ts +11 -0
- package/dist/auth/devices/report.d.ts.map +1 -0
- package/dist/auth/devices/token.d.ts +13 -0
- package/dist/auth/devices/token.d.ts.map +1 -0
- package/dist/auth/email-flows/any-type-change-email.d.ts +18 -0
- package/dist/auth/email-flows/any-type-change-email.d.ts.map +1 -0
- package/dist/auth/email-flows/any-type-reset-password.d.ts +19 -0
- package/dist/auth/email-flows/any-type-reset-password.d.ts.map +1 -0
- package/dist/auth/email-flows/any-type-verify-email.d.ts +18 -0
- package/dist/auth/email-flows/any-type-verify-email.d.ts.map +1 -0
- package/dist/auth/email-flows/change-email-token.d.ts +47 -0
- package/dist/auth/email-flows/change-email-token.d.ts.map +1 -0
- package/dist/auth/email-flows/change-email.d.ts +17 -0
- package/dist/auth/email-flows/change-email.d.ts.map +1 -0
- package/dist/auth/email-flows/confirm-reset.d.ts +16 -0
- package/dist/auth/email-flows/confirm-reset.d.ts.map +1 -0
- package/dist/auth/email-flows/email-token.d.ts +30 -0
- package/dist/auth/email-flows/email-token.d.ts.map +1 -0
- package/dist/auth/email-flows/flows.d.ts +13 -0
- package/dist/auth/email-flows/flows.d.ts.map +1 -0
- package/dist/auth/email-flows/index.d.ts +10 -0
- package/dist/auth/email-flows/index.d.ts.map +1 -0
- package/dist/auth/email-flows/owner-of.d.ts +17 -0
- package/dist/auth/email-flows/owner-of.d.ts.map +1 -0
- package/dist/auth/email-flows/prove-first.d.ts +45 -0
- package/dist/auth/email-flows/prove-first.d.ts.map +1 -0
- package/dist/auth/email-flows/reset-password.d.ts +17 -0
- package/dist/auth/email-flows/reset-password.d.ts.map +1 -0
- package/dist/auth/email-flows/set-email-verified.d.ts +19 -0
- package/dist/auth/email-flows/set-email-verified.d.ts.map +1 -0
- package/dist/auth/email-flows/verify-email.d.ts +25 -0
- package/dist/auth/email-flows/verify-email.d.ts.map +1 -0
- package/dist/auth/email-sign-in.d.ts +51 -0
- package/dist/auth/email-sign-in.d.ts.map +1 -0
- package/dist/auth/events.d.ts +166 -0
- package/dist/auth/events.d.ts.map +1 -0
- package/dist/auth/first-proof.d.ts +43 -0
- package/dist/auth/first-proof.d.ts.map +1 -0
- package/dist/auth/hashers.d.ts +52 -0
- package/dist/auth/hashers.d.ts.map +1 -0
- package/dist/auth/index.d.ts +22 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/invitations/accept.d.ts +10 -0
- package/dist/auth/invitations/accept.d.ts.map +1 -0
- package/dist/auth/invitations/change-pending.d.ts +17 -0
- package/dist/auth/invitations/change-pending.d.ts.map +1 -0
- package/dist/auth/invitations/claim.d.ts +31 -0
- package/dist/auth/invitations/claim.d.ts.map +1 -0
- package/dist/auth/invitations/events.d.ts +46 -0
- package/dist/auth/invitations/events.d.ts.map +1 -0
- package/dist/auth/invitations/find-invitee.d.ts +20 -0
- package/dist/auth/invitations/find-invitee.d.ts.map +1 -0
- package/dist/auth/invitations/find-pending.d.ts +5 -0
- package/dist/auth/invitations/find-pending.d.ts.map +1 -0
- package/dist/auth/invitations/flows.d.ts +7 -0
- package/dist/auth/invitations/flows.d.ts.map +1 -0
- package/dist/auth/invitations/history-input.d.ts +29 -0
- package/dist/auth/invitations/history-input.d.ts.map +1 -0
- package/dist/auth/invitations/history.d.ts +10 -0
- package/dist/auth/invitations/history.d.ts.map +1 -0
- package/dist/auth/invitations/index.d.ts +11 -0
- package/dist/auth/invitations/index.d.ts.map +1 -0
- package/dist/auth/invitations/input.d.ts +30 -0
- package/dist/auth/invitations/input.d.ts.map +1 -0
- package/dist/auth/invitations/invited-type.d.ts +22 -0
- package/dist/auth/invitations/invited-type.d.ts.map +1 -0
- package/dist/auth/invitations/invitee.d.ts +11 -0
- package/dist/auth/invitations/invitee.d.ts.map +1 -0
- package/dist/auth/invitations/issue.d.ts +9 -0
- package/dist/auth/invitations/issue.d.ts.map +1 -0
- package/dist/auth/invitations/limit.d.ts +7 -0
- package/dist/auth/invitations/limit.d.ts.map +1 -0
- package/dist/auth/invitations/password-invitee.d.ts +18 -0
- package/dist/auth/invitations/password-invitee.d.ts.map +1 -0
- package/dist/auth/invitations/passwordless-invitee.d.ts +13 -0
- package/dist/auth/invitations/passwordless-invitee.d.ts.map +1 -0
- package/dist/auth/invitations/preview.d.ts +8 -0
- package/dist/auth/invitations/preview.d.ts.map +1 -0
- package/dist/auth/invitations/read.d.ts +10 -0
- package/dist/auth/invitations/read.d.ts.map +1 -0
- package/dist/auth/invitations/resend.d.ts +12 -0
- package/dist/auth/invitations/resend.d.ts.map +1 -0
- package/dist/auth/invitations/to-invitation.d.ts +11 -0
- package/dist/auth/invitations/to-invitation.d.ts.map +1 -0
- package/dist/auth/invitations/write.d.ts +17 -0
- package/dist/auth/invitations/write.d.ts.map +1 -0
- package/dist/auth/issuers/cache.d.ts +21 -0
- package/dist/auth/issuers/cache.d.ts.map +1 -0
- package/dist/auth/issuers/create.d.ts +18 -0
- package/dist/auth/issuers/create.d.ts.map +1 -0
- package/dist/auth/issuers/index.d.ts +3 -0
- package/dist/auth/issuers/index.d.ts.map +1 -0
- package/dist/auth/issuers/types.d.ts +45 -0
- package/dist/auth/issuers/types.d.ts.map +1 -0
- package/dist/auth/janus.d.ts +39 -0
- package/dist/auth/janus.d.ts.map +1 -0
- package/dist/auth/magic-link.d.ts +25 -0
- package/dist/auth/magic-link.d.ts.map +1 -0
- package/dist/auth/mail-requests.d.ts +55 -0
- package/dist/auth/mail-requests.d.ts.map +1 -0
- package/dist/auth/one-time/codes.d.ts +46 -0
- package/dist/auth/one-time/codes.d.ts.map +1 -0
- package/dist/auth/one-time/index.d.ts +15 -0
- package/dist/auth/one-time/index.d.ts.map +1 -0
- package/dist/auth/one-time/issue.d.ts +45 -0
- package/dist/auth/one-time/issue.d.ts.map +1 -0
- package/dist/auth/one-time/refusals.d.ts +26 -0
- package/dist/auth/one-time/refusals.d.ts.map +1 -0
- package/dist/auth/one-time/spend.d.ts +24 -0
- package/dist/auth/one-time/spend.d.ts.map +1 -0
- package/dist/auth/one-time/window.d.ts +50 -0
- package/dist/auth/one-time/window.d.ts.map +1 -0
- package/dist/auth/outage.d.ts +66 -0
- package/dist/auth/outage.d.ts.map +1 -0
- package/dist/auth/parse-sealing-keys.d.ts +26 -0
- package/dist/auth/parse-sealing-keys.d.ts.map +1 -0
- package/dist/auth/passkeys/assert.d.ts +51 -0
- package/dist/auth/passkeys/assert.d.ts.map +1 -0
- package/dist/auth/passkeys/assertion-options.d.ts +9 -0
- package/dist/auth/passkeys/assertion-options.d.ts.map +1 -0
- package/dist/auth/passkeys/challenge.d.ts +19 -0
- package/dist/auth/passkeys/challenge.d.ts.map +1 -0
- package/dist/auth/passkeys/commit.d.ts +33 -0
- package/dist/auth/passkeys/commit.d.ts.map +1 -0
- package/dist/auth/passkeys/flows.d.ts +13 -0
- package/dist/auth/passkeys/flows.d.ts.map +1 -0
- package/dist/auth/passkeys/index.d.ts +12 -0
- package/dist/auth/passkeys/index.d.ts.map +1 -0
- package/dist/auth/passkeys/manage.d.ts +11 -0
- package/dist/auth/passkeys/manage.d.ts.map +1 -0
- package/dist/auth/passkeys/name.d.ts +4 -0
- package/dist/auth/passkeys/name.d.ts.map +1 -0
- package/dist/auth/passkeys/register.d.ts +20 -0
- package/dist/auth/passkeys/register.d.ts.map +1 -0
- package/dist/auth/passkeys/registration-options.d.ts +22 -0
- package/dist/auth/passkeys/registration-options.d.ts.map +1 -0
- package/dist/auth/passkeys/remove-all.d.ts +26 -0
- package/dist/auth/passkeys/remove-all.d.ts.map +1 -0
- package/dist/auth/passkeys/sign-in-options.d.ts +12 -0
- package/dist/auth/passkeys/sign-in-options.d.ts.map +1 -0
- package/dist/auth/passkeys/sign-in.d.ts +21 -0
- package/dist/auth/passkeys/sign-in.d.ts.map +1 -0
- package/dist/auth/passkeys/verifier.d.ts +113 -0
- package/dist/auth/passkeys/verifier.d.ts.map +1 -0
- package/dist/auth/passkeys/view.d.ts +5 -0
- package/dist/auth/passkeys/view.d.ts.map +1 -0
- package/dist/auth/passkeys/wiring.d.ts +24 -0
- package/dist/auth/passkeys/wiring.d.ts.map +1 -0
- package/dist/auth/password-written.d.ts +55 -0
- package/dist/auth/password-written.d.ts.map +1 -0
- package/dist/auth/port/assert-api-keys.d.ts +21 -0
- package/dist/auth/port/assert-api-keys.d.ts.map +1 -0
- package/dist/auth/port/assert-invitations.d.ts +15 -0
- package/dist/auth/port/assert-invitations.d.ts.map +1 -0
- package/dist/auth/port/assert-stores.d.ts +16 -0
- package/dist/auth/port/assert-stores.d.ts.map +1 -0
- package/dist/auth/port/memory/api-keys/capabilities.d.ts +8 -0
- package/dist/auth/port/memory/api-keys/capabilities.d.ts.map +1 -0
- package/dist/auth/port/memory/api-keys/index.d.ts +13 -0
- package/dist/auth/port/memory/api-keys/index.d.ts.map +1 -0
- package/dist/auth/port/memory/api-keys/pages.d.ts +7 -0
- package/dist/auth/port/memory/api-keys/pages.d.ts.map +1 -0
- package/dist/auth/port/memory/copy.d.ts +6 -0
- package/dist/auth/port/memory/copy.d.ts.map +1 -0
- package/dist/auth/port/memory/index.d.ts +10 -0
- package/dist/auth/port/memory/index.d.ts.map +1 -0
- package/dist/auth/port/memory/invitations-pending.d.ts +6 -0
- package/dist/auth/port/memory/invitations-pending.d.ts.map +1 -0
- package/dist/auth/port/memory/invitations.d.ts +12 -0
- package/dist/auth/port/memory/invitations.d.ts.map +1 -0
- package/dist/auth/port/memory/passkeys.d.ts +9 -0
- package/dist/auth/port/memory/passkeys.d.ts.map +1 -0
- package/dist/auth/port/memory/sessions.d.ts +4 -0
- package/dist/auth/port/memory/sessions.d.ts.map +1 -0
- package/dist/auth/port/memory/social-links.d.ts +10 -0
- package/dist/auth/port/memory/social-links.d.ts.map +1 -0
- package/dist/auth/port/memory/stores.d.ts +26 -0
- package/dist/auth/port/memory/stores.d.ts.map +1 -0
- package/dist/auth/port/memory/tokens.d.ts +4 -0
- package/dist/auth/port/memory/tokens.d.ts.map +1 -0
- package/dist/auth/port/memory/user-index.d.ts +20 -0
- package/dist/auth/port/memory/user-index.d.ts.map +1 -0
- package/dist/auth/port/memory/user-update.d.ts +10 -0
- package/dist/auth/port/memory/user-update.d.ts.map +1 -0
- package/dist/auth/port/memory/users.d.ts +4 -0
- package/dist/auth/port/memory/users.d.ts.map +1 -0
- package/dist/auth/port/types/api-keys.d.ts +199 -0
- package/dist/auth/port/types/api-keys.d.ts.map +1 -0
- package/dist/auth/port/types/credentials.d.ts +46 -0
- package/dist/auth/port/types/credentials.d.ts.map +1 -0
- package/dist/auth/port/types/index.d.ts +75 -0
- package/dist/auth/port/types/index.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/index.d.ts +15 -0
- package/dist/auth/port/types/invitations/index.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/page.d.ts +52 -0
- package/dist/auth/port/types/invitations/page.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/records.d.ts +101 -0
- package/dist/auth/port/types/invitations/records.d.ts.map +1 -0
- package/dist/auth/port/types/invitations/store.d.ts +82 -0
- package/dist/auth/port/types/invitations/store.d.ts.map +1 -0
- package/dist/auth/port/types/json.d.ts +27 -0
- package/dist/auth/port/types/json.d.ts.map +1 -0
- package/dist/auth/port/types/passkeys.d.ts +94 -0
- package/dist/auth/port/types/passkeys.d.ts.map +1 -0
- package/dist/auth/port/types/sessions.d.ts +142 -0
- package/dist/auth/port/types/sessions.d.ts.map +1 -0
- package/dist/auth/port/types/social-links.d.ts +72 -0
- package/dist/auth/port/types/social-links.d.ts.map +1 -0
- package/dist/auth/port/types/stores.d.ts +48 -0
- package/dist/auth/port/types/stores.d.ts.map +1 -0
- package/dist/auth/port/types/tokens.d.ts +168 -0
- package/dist/auth/port/types/tokens.d.ts.map +1 -0
- package/dist/auth/port/types/users.d.ts +260 -0
- package/dist/auth/port/types/users.d.ts.map +1 -0
- package/dist/auth/prepared.d.ts +21 -0
- package/dist/auth/prepared.d.ts.map +1 -0
- package/dist/auth/proven-sign-in.d.ts +22 -0
- package/dist/auth/proven-sign-in.d.ts.map +1 -0
- package/dist/auth/sealer-for.d.ts +44 -0
- package/dist/auth/sealer-for.d.ts.map +1 -0
- package/dist/auth/sealing.d.ts +36 -0
- package/dist/auth/sealing.d.ts.map +1 -0
- package/dist/auth/second-factor/activate.d.ts +9 -0
- package/dist/auth/second-factor/activate.d.ts.map +1 -0
- package/dist/auth/second-factor/app-code-attempts.d.ts +47 -0
- package/dist/auth/second-factor/app-code-attempts.d.ts.map +1 -0
- package/dist/auth/second-factor/challenge.d.ts +15 -0
- package/dist/auth/second-factor/challenge.d.ts.map +1 -0
- package/dist/auth/second-factor/codes-left.d.ts +14 -0
- package/dist/auth/second-factor/codes-left.d.ts.map +1 -0
- package/dist/auth/second-factor/disable.d.ts +10 -0
- package/dist/auth/second-factor/disable.d.ts.map +1 -0
- package/dist/auth/second-factor/enroll.d.ts +6 -0
- package/dist/auth/second-factor/enroll.d.ts.map +1 -0
- package/dist/auth/second-factor/factor.d.ts +33 -0
- package/dist/auth/second-factor/factor.d.ts.map +1 -0
- package/dist/auth/second-factor/flows.d.ts +36 -0
- package/dist/auth/second-factor/flows.d.ts.map +1 -0
- package/dist/auth/second-factor/lifecycle.d.ts +14 -0
- package/dist/auth/second-factor/lifecycle.d.ts.map +1 -0
- package/dist/auth/second-factor/passkey-confirm.d.ts +21 -0
- package/dist/auth/second-factor/passkey-confirm.d.ts.map +1 -0
- package/dist/auth/second-factor/recovery-codes.d.ts +36 -0
- package/dist/auth/second-factor/recovery-codes.d.ts.map +1 -0
- package/dist/auth/second-factor/recovery.d.ts +20 -0
- package/dist/auth/second-factor/recovery.d.ts.map +1 -0
- package/dist/auth/second-factor/redeem.d.ts +42 -0
- package/dist/auth/second-factor/redeem.d.ts.map +1 -0
- package/dist/auth/second-factor/refusal.d.ts +6 -0
- package/dist/auth/second-factor/refusal.d.ts.map +1 -0
- package/dist/auth/second-factor/regenerate.d.ts +12 -0
- package/dist/auth/second-factor/regenerate.d.ts.map +1 -0
- package/dist/auth/second-factor/reseal.d.ts +17 -0
- package/dist/auth/second-factor/reseal.d.ts.map +1 -0
- package/dist/auth/second-factor/spend-recovery-code.d.ts +15 -0
- package/dist/auth/second-factor/spend-recovery-code.d.ts.map +1 -0
- package/dist/auth/secrets.d.ts +17 -0
- package/dist/auth/secrets.d.ts.map +1 -0
- package/dist/auth/sessions/amr.d.ts +36 -0
- package/dist/auth/sessions/amr.d.ts.map +1 -0
- package/dist/auth/sessions/authenticate.d.ts +12 -0
- package/dist/auth/sessions/authenticate.d.ts.map +1 -0
- package/dist/auth/sessions/collect-expired.d.ts +15 -0
- package/dist/auth/sessions/collect-expired.d.ts.map +1 -0
- package/dist/auth/sessions/cookie.d.ts +9 -0
- package/dist/auth/sessions/cookie.d.ts.map +1 -0
- package/dist/auth/sessions/fresh.d.ts +35 -0
- package/dist/auth/sessions/fresh.d.ts.map +1 -0
- package/dist/auth/sessions/index.d.ts +12 -0
- package/dist/auth/sessions/index.d.ts.map +1 -0
- package/dist/auth/sessions/open-session.d.ts +22 -0
- package/dist/auth/sessions/open-session.d.ts.map +1 -0
- package/dist/auth/sessions/presented-token.d.ts +25 -0
- package/dist/auth/sessions/presented-token.d.ts.map +1 -0
- package/dist/auth/sessions/shared-api.d.ts +17 -0
- package/dist/auth/sessions/shared-api.d.ts.map +1 -0
- package/dist/auth/sessions/standing.d.ts +32 -0
- package/dist/auth/sessions/standing.d.ts.map +1 -0
- package/dist/auth/shared-api.d.ts +142 -0
- package/dist/auth/shared-api.d.ts.map +1 -0
- package/dist/auth/sign-in-attempts.d.ts +45 -0
- package/dist/auth/sign-in-attempts.d.ts.map +1 -0
- package/dist/auth/sign-in-code.d.ts +26 -0
- package/dist/auth/sign-in-code.d.ts.map +1 -0
- package/dist/auth/social/attach.d.ts +31 -0
- package/dist/auth/social/attach.d.ts.map +1 -0
- package/dist/auth/social/begin.d.ts +30 -0
- package/dist/auth/social/begin.d.ts.map +1 -0
- package/dist/auth/social/complete-link.d.ts +17 -0
- package/dist/auth/social/complete-link.d.ts.map +1 -0
- package/dist/auth/social/complete.d.ts +54 -0
- package/dist/auth/social/complete.d.ts.map +1 -0
- package/dist/auth/social/cookie.d.ts +16 -0
- package/dist/auth/social/cookie.d.ts.map +1 -0
- package/dist/auth/social/find-provider.d.ts +23 -0
- package/dist/auth/social/find-provider.d.ts.map +1 -0
- package/dist/auth/social/finish.d.ts +60 -0
- package/dist/auth/social/finish.d.ts.map +1 -0
- package/dist/auth/social/flow-cookie-value.d.ts +26 -0
- package/dist/auth/social/flow-cookie-value.d.ts.map +1 -0
- package/dist/auth/social/flow-secret.d.ts +40 -0
- package/dist/auth/social/flow-secret.d.ts.map +1 -0
- package/dist/auth/social/index.d.ts +19 -0
- package/dist/auth/social/index.d.ts.map +1 -0
- package/dist/auth/social/link-holder.d.ts +33 -0
- package/dist/auth/social/link-holder.d.ts.map +1 -0
- package/dist/auth/social/provider-call.d.ts +31 -0
- package/dist/auth/social/provider-call.d.ts.map +1 -0
- package/dist/auth/social/redeem.d.ts +45 -0
- package/dist/auth/social/redeem.d.ts.map +1 -0
- package/dist/auth/social/return-to.d.ts +18 -0
- package/dist/auth/social/return-to.d.ts.map +1 -0
- package/dist/auth/social/sign-in.d.ts +41 -0
- package/dist/auth/social/sign-in.d.ts.map +1 -0
- package/dist/auth/social/sign-up.d.ts +37 -0
- package/dist/auth/social/sign-up.d.ts.map +1 -0
- package/dist/auth/social/start.d.ts +21 -0
- package/dist/auth/social/start.d.ts.map +1 -0
- package/dist/auth/social/step-up-proof.d.ts +26 -0
- package/dist/auth/social/step-up-proof.d.ts.map +1 -0
- package/dist/auth/social/step-up-request.d.ts +28 -0
- package/dist/auth/social/step-up-request.d.ts.map +1 -0
- package/dist/auth/social/step-up.d.ts +19 -0
- package/dist/auth/social/step-up.d.ts.map +1 -0
- package/dist/auth/social/types-of.d.ts +12 -0
- package/dist/auth/social/types-of.d.ts.map +1 -0
- package/dist/auth/social/unlink.d.ts +23 -0
- package/dist/auth/social/unlink.d.ts.map +1 -0
- package/dist/auth/social/wiring.d.ts +10 -0
- package/dist/auth/social/wiring.d.ts.map +1 -0
- package/dist/auth/standard-schema.d.ts +41 -0
- package/dist/auth/standard-schema.d.ts.map +1 -0
- package/dist/auth/step-up/codes.d.ts +35 -0
- package/dist/auth/step-up/codes.d.ts.map +1 -0
- package/dist/auth/step-up/flows.d.ts +18 -0
- package/dist/auth/step-up/flows.d.ts.map +1 -0
- package/dist/auth/step-up/open.d.ts +23 -0
- package/dist/auth/step-up/open.d.ts.map +1 -0
- package/dist/auth/step-up/passkey.d.ts +31 -0
- package/dist/auth/step-up/passkey.d.ts.map +1 -0
- package/dist/auth/step-up/request.d.ts +15 -0
- package/dist/auth/step-up/request.d.ts.map +1 -0
- package/dist/auth/step-up/spend.d.ts +4 -0
- package/dist/auth/step-up/spend.d.ts.map +1 -0
- package/dist/auth/totp.d.ts +36 -0
- package/dist/auth/totp.d.ts.map +1 -0
- package/dist/auth/types/api-keys-of.d.ts +19 -0
- package/dist/auth/types/api-keys-of.d.ts.map +1 -0
- package/dist/auth/types/api-keys.d.ts +164 -0
- package/dist/auth/types/api-keys.d.ts.map +1 -0
- package/dist/auth/types/avatar.d.ts +72 -0
- package/dist/auth/types/avatar.d.ts.map +1 -0
- package/dist/auth/types/change-email.d.ts +82 -0
- package/dist/auth/types/change-email.d.ts.map +1 -0
- package/dist/auth/types/checks.d.ts +147 -0
- package/dist/auth/types/checks.d.ts.map +1 -0
- package/dist/auth/types/email-flows.d.ts +117 -0
- package/dist/auth/types/email-flows.d.ts.map +1 -0
- package/dist/auth/types/find-by-email.d.ts +31 -0
- package/dist/auth/types/find-by-email.d.ts.map +1 -0
- package/dist/auth/types/find-or-create.d.ts +59 -0
- package/dist/auth/types/find-or-create.d.ts.map +1 -0
- package/dist/auth/types/index.d.ts +38 -0
- package/dist/auth/types/index.d.ts.map +1 -0
- package/dist/auth/types/inference.d.ts +62 -0
- package/dist/auth/types/inference.d.ts.map +1 -0
- package/dist/auth/types/invitations/api.d.ts +203 -0
- package/dist/auth/types/invitations/api.d.ts.map +1 -0
- package/dist/auth/types/invitations/history.d.ts +87 -0
- package/dist/auth/types/invitations/history.d.ts.map +1 -0
- package/dist/auth/types/invitations/index.d.ts +10 -0
- package/dist/auth/types/invitations/index.d.ts.map +1 -0
- package/dist/auth/types/invitations/invitation.d.ts +76 -0
- package/dist/auth/types/invitations/invitation.d.ts.map +1 -0
- package/dist/auth/types/invitations/issue-type.d.ts +15 -0
- package/dist/auth/types/invitations/issue-type.d.ts.map +1 -0
- package/dist/auth/types/invitations-of.d.ts +26 -0
- package/dist/auth/types/invitations-of.d.ts.map +1 -0
- package/dist/auth/types/janus.d.ts +51 -0
- package/dist/auth/types/janus.d.ts.map +1 -0
- package/dist/auth/types/magic-link.d.ts +69 -0
- package/dist/auth/types/magic-link.d.ts.map +1 -0
- package/dist/auth/types/passkeys.d.ts +183 -0
- package/dist/auth/types/passkeys.d.ts.map +1 -0
- package/dist/auth/types/password.d.ts +113 -0
- package/dist/auth/types/password.d.ts.map +1 -0
- package/dist/auth/types/prepared.d.ts +68 -0
- package/dist/auth/types/prepared.d.ts.map +1 -0
- package/dist/auth/types/proven-sign-in.d.ts +43 -0
- package/dist/auth/types/proven-sign-in.d.ts.map +1 -0
- package/dist/auth/types/reset-password.d.ts +46 -0
- package/dist/auth/types/reset-password.d.ts.map +1 -0
- package/dist/auth/types/second-factor.d.ts +164 -0
- package/dist/auth/types/second-factor.d.ts.map +1 -0
- package/dist/auth/types/session.d.ts +68 -0
- package/dist/auth/types/session.d.ts.map +1 -0
- package/dist/auth/types/shared-api.d.ts +96 -0
- package/dist/auth/types/shared-api.d.ts.map +1 -0
- package/dist/auth/types/sign-in.d.ts +102 -0
- package/dist/auth/types/sign-in.d.ts.map +1 -0
- package/dist/auth/types/social-flow.d.ts +28 -0
- package/dist/auth/types/social-flow.d.ts.map +1 -0
- package/dist/auth/types/social-step-up.d.ts +38 -0
- package/dist/auth/types/social-step-up.d.ts.map +1 -0
- package/dist/auth/types/social.d.ts +201 -0
- package/dist/auth/types/social.d.ts.map +1 -0
- package/dist/auth/types/step-up.d.ts +133 -0
- package/dist/auth/types/step-up.d.ts.map +1 -0
- package/dist/auth/types/type-api.d.ts +29 -0
- package/dist/auth/types/type-api.d.ts.map +1 -0
- package/dist/auth/types/user-type.d.ts +106 -0
- package/dist/auth/types/user-type.d.ts.map +1 -0
- package/dist/auth/types/user.d.ts +62 -0
- package/dist/auth/types/user.d.ts.map +1 -0
- package/dist/auth/types/verify-email.d.ts +190 -0
- package/dist/auth/types/verify-email.d.ts.map +1 -0
- package/dist/auth/users/any-type-api.d.ts +6 -0
- package/dist/auth/users/any-type-api.d.ts.map +1 -0
- package/dist/auth/users/by-login.d.ts +10 -0
- package/dist/auth/users/by-login.d.ts.map +1 -0
- package/dist/auth/users/change-password.d.ts +26 -0
- package/dist/auth/users/change-password.d.ts.map +1 -0
- package/dist/auth/users/delete.d.ts +10 -0
- package/dist/auth/users/delete.d.ts.map +1 -0
- package/dist/auth/users/email-move-guard.d.ts +20 -0
- package/dist/auth/users/email-move-guard.d.ts.map +1 -0
- package/dist/auth/users/email-prefix.d.ts +23 -0
- package/dist/auth/users/email-prefix.d.ts.map +1 -0
- package/dist/auth/users/fields-patch.d.ts +21 -0
- package/dist/auth/users/fields-patch.d.ts.map +1 -0
- package/dist/auth/users/find-by-email.d.ts +11 -0
- package/dist/auth/users/find-by-email.d.ts.map +1 -0
- package/dist/auth/users/find-many.d.ts +29 -0
- package/dist/auth/users/find-many.d.ts.map +1 -0
- package/dist/auth/users/find-or-create.d.ts +12 -0
- package/dist/auth/users/find-or-create.d.ts.map +1 -0
- package/dist/auth/users/flow-types.d.ts +15 -0
- package/dist/auth/users/flow-types.d.ts.map +1 -0
- package/dist/auth/users/index.d.ts +9 -0
- package/dist/auth/users/index.d.ts.map +1 -0
- package/dist/auth/users/insert.d.ts +15 -0
- package/dist/auth/users/insert.d.ts.map +1 -0
- package/dist/auth/users/name-prefix.d.ts +19 -0
- package/dist/auth/users/name-prefix.d.ts.map +1 -0
- package/dist/auth/users/password-flows.d.ts +11 -0
- package/dist/auth/users/password-flows.d.ts.map +1 -0
- package/dist/auth/users/record-flows.d.ts +11 -0
- package/dist/auth/users/record-flows.d.ts.map +1 -0
- package/dist/auth/users/sign-in.d.ts +24 -0
- package/dist/auth/users/sign-in.d.ts.map +1 -0
- package/dist/auth/users/sign-up.d.ts +13 -0
- package/dist/auth/users/sign-up.d.ts.map +1 -0
- package/dist/auth/users/type-api.d.ts +10 -0
- package/dist/auth/users/type-api.d.ts.map +1 -0
- package/dist/auth/users/update.d.ts +16 -0
- package/dist/auth/users/update.d.ts.map +1 -0
- package/dist/background/background.d.ts +22 -0
- package/dist/background/background.d.ts.map +1 -0
- package/dist/chunks/index-2ttdcz7n.js +354 -0
- package/dist/chunks/index-2ttdcz7n.js.map +16 -0
- package/dist/chunks/index-5dxynm32.js +85 -0
- package/dist/chunks/index-5dxynm32.js.map +10 -0
- package/dist/chunks/index-7h34nqrm.js +732 -0
- package/dist/chunks/index-7h34nqrm.js.map +24 -0
- package/dist/chunks/index-ftz0ne6j.js +127 -0
- package/dist/chunks/index-ftz0ne6j.js.map +11 -0
- package/dist/chunks/index-n8jxmxeg.js +64 -0
- package/dist/chunks/index-n8jxmxeg.js.map +11 -0
- package/dist/conformance/api-keys/cases/bound.d.ts +3 -0
- package/dist/conformance/api-keys/cases/bound.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/expiry.d.ts +3 -0
- package/dist/conformance/api-keys/cases/expiry.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/index.d.ts +4 -0
- package/dist/conformance/api-keys/cases/index.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/insert.d.ts +3 -0
- package/dist/conformance/api-keys/cases/insert.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/outage.d.ts +3 -0
- package/dist/conformance/api-keys/cases/outage.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/revoke.d.ts +3 -0
- package/dist/conformance/api-keys/cases/revoke.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/touch.d.ts +3 -0
- package/dist/conformance/api-keys/cases/touch.d.ts.map +1 -0
- package/dist/conformance/api-keys/cases/user-bound.d.ts +3 -0
- package/dist/conformance/api-keys/cases/user-bound.d.ts.map +1 -0
- package/dist/conformance/api-keys/describe.d.ts +20 -0
- package/dist/conformance/api-keys/describe.d.ts.map +1 -0
- package/dist/conformance/api-keys/fixtures.d.ts +4 -0
- package/dist/conformance/api-keys/fixtures.d.ts.map +1 -0
- package/dist/conformance/api-keys/index.d.ts +18 -0
- package/dist/conformance/api-keys/index.d.ts.map +1 -0
- package/dist/conformance/api-keys/reference.d.ts +4 -0
- package/dist/conformance/api-keys/reference.d.ts.map +1 -0
- package/dist/conformance/api-keys/types.d.ts +42 -0
- package/dist/conformance/api-keys/types.d.ts.map +1 -0
- package/dist/conformance/assert.d.ts +40 -0
- package/dist/conformance/assert.d.ts.map +1 -0
- package/dist/conformance/cases/outage.d.ts +3 -0
- package/dist/conformance/cases/outage.d.ts.map +1 -0
- package/dist/conformance/cases/outage.passkeys.d.ts +12 -0
- package/dist/conformance/cases/outage.passkeys.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/deletion.d.ts +4 -0
- package/dist/conformance/cases/passkeys/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/index.d.ts +8 -0
- package/dist/conformance/cases/passkeys/index.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/inserts.d.ts +4 -0
- package/dist/conformance/cases/passkeys/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/reads.d.ts +4 -0
- package/dist/conformance/cases/passkeys/reads.d.ts.map +1 -0
- package/dist/conformance/cases/passkeys/uses.d.ts +4 -0
- package/dist/conformance/cases/passkeys/uses.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/deletion.d.ts +4 -0
- package/dist/conformance/cases/sessions/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/extension.d.ts +4 -0
- package/dist/conformance/cases/sessions/extension.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/index.d.ts +4 -0
- package/dist/conformance/cases/sessions/index.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/inserts.d.ts +4 -0
- package/dist/conformance/cases/sessions/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/list.d.ts +4 -0
- package/dist/conformance/cases/sessions/list.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/reads.d.ts +4 -0
- package/dist/conformance/cases/sessions/reads.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/reauthentication.d.ts +4 -0
- package/dist/conformance/cases/sessions/reauthentication.d.ts.map +1 -0
- package/dist/conformance/cases/sessions/revocation.d.ts +4 -0
- package/dist/conformance/cases/sessions/revocation.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/deletion.d.ts +4 -0
- package/dist/conformance/cases/social-links/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/index.d.ts +8 -0
- package/dist/conformance/cases/social-links/index.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/inserts.d.ts +4 -0
- package/dist/conformance/cases/social-links/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/social-links/reads.d.ts +4 -0
- package/dist/conformance/cases/social-links/reads.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/attempts.d.ts +7 -0
- package/dist/conformance/cases/tokens/attempts.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/change-email.d.ts +8 -0
- package/dist/conformance/cases/tokens/change-email.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/deletion.d.ts +4 -0
- package/dist/conformance/cases/tokens/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/index.d.ts +4 -0
- package/dist/conformance/cases/tokens/index.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/inserts.d.ts +7 -0
- package/dist/conformance/cases/tokens/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/kinds.d.ts +7 -0
- package/dist/conformance/cases/tokens/kinds.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/redemption.d.ts +7 -0
- package/dist/conformance/cases/tokens/redemption.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/social-flow.d.ts +8 -0
- package/dist/conformance/cases/tokens/social-flow.d.ts.map +1 -0
- package/dist/conformance/cases/tokens/spending.d.ts +7 -0
- package/dist/conformance/cases/tokens/spending.d.ts.map +1 -0
- package/dist/conformance/cases/users/avatar.d.ts +8 -0
- package/dist/conformance/cases/users/avatar.d.ts.map +1 -0
- package/dist/conformance/cases/users/batch.d.ts +8 -0
- package/dist/conformance/cases/users/batch.d.ts.map +1 -0
- package/dist/conformance/cases/users/deletion.d.ts +4 -0
- package/dist/conformance/cases/users/deletion.d.ts.map +1 -0
- package/dist/conformance/cases/users/index.d.ts +4 -0
- package/dist/conformance/cases/users/index.d.ts.map +1 -0
- package/dist/conformance/cases/users/inserts.d.ts +4 -0
- package/dist/conformance/cases/users/inserts.d.ts.map +1 -0
- package/dist/conformance/cases/users/listing.d.ts +4 -0
- package/dist/conformance/cases/users/listing.d.ts.map +1 -0
- package/dist/conformance/cases/users/patches.d.ts +7 -0
- package/dist/conformance/cases/users/patches.d.ts.map +1 -0
- package/dist/conformance/cases/users/reads.d.ts +7 -0
- package/dist/conformance/cases/users/reads.d.ts.map +1 -0
- package/dist/conformance/cases/users/second-factor.d.ts +16 -0
- package/dist/conformance/cases/users/second-factor.d.ts.map +1 -0
- package/dist/conformance/cases/users/versions.d.ts +7 -0
- package/dist/conformance/cases/users/versions.d.ts.map +1 -0
- package/dist/conformance/describe.d.ts +82 -0
- package/dist/conformance/describe.d.ts.map +1 -0
- package/dist/conformance/fixtures.d.ts +31 -0
- package/dist/conformance/fixtures.d.ts.map +1 -0
- package/dist/conformance/index.d.ts +46 -0
- package/dist/conformance/index.d.ts.map +1 -0
- package/dist/conformance/index.js +4442 -0
- package/dist/conformance/index.js.map +86 -0
- package/dist/conformance/invitations/cases/actors.d.ts +3 -0
- package/dist/conformance/invitations/cases/actors.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/find-pending.d.ts +3 -0
- package/dist/conformance/invitations/cases/find-pending.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/imported.d.ts +3 -0
- package/dist/conformance/invitations/cases/imported.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/index.d.ts +4 -0
- package/dist/conformance/invitations/cases/index.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/insert.d.ts +3 -0
- package/dist/conformance/invitations/cases/insert.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/list-lapsed.d.ts +3 -0
- package/dist/conformance/invitations/cases/list-lapsed.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/list-status.d.ts +3 -0
- package/dist/conformance/invitations/cases/list-status.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/list.d.ts +3 -0
- package/dist/conformance/invitations/cases/list.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/outage.d.ts +3 -0
- package/dist/conformance/invitations/cases/outage.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/scope.d.ts +3 -0
- package/dist/conformance/invitations/cases/scope.d.ts.map +1 -0
- package/dist/conformance/invitations/cases/update.d.ts +3 -0
- package/dist/conformance/invitations/cases/update.d.ts.map +1 -0
- package/dist/conformance/invitations/describe.d.ts +20 -0
- package/dist/conformance/invitations/describe.d.ts.map +1 -0
- package/dist/conformance/invitations/fixtures.d.ts +4 -0
- package/dist/conformance/invitations/fixtures.d.ts.map +1 -0
- package/dist/conformance/invitations/index.d.ts +18 -0
- package/dist/conformance/invitations/index.d.ts.map +1 -0
- package/dist/conformance/invitations/reference.d.ts +4 -0
- package/dist/conformance/invitations/reference.d.ts.map +1 -0
- package/dist/conformance/invitations/types.d.ts +34 -0
- package/dist/conformance/invitations/types.d.ts.map +1 -0
- package/dist/conformance/reference.d.ts +13 -0
- package/dist/conformance/reference.d.ts.map +1 -0
- package/dist/conformance/relations/cases/deletion.d.ts +4 -0
- package/dist/conformance/relations/cases/deletion.d.ts.map +1 -0
- package/dist/conformance/relations/cases/holders.d.ts +9 -0
- package/dist/conformance/relations/cases/holders.d.ts.map +1 -0
- package/dist/conformance/relations/cases/index.d.ts +4 -0
- package/dist/conformance/relations/cases/index.d.ts.map +1 -0
- package/dist/conformance/relations/cases/outage.d.ts +3 -0
- package/dist/conformance/relations/cases/outage.d.ts.map +1 -0
- package/dist/conformance/relations/cases/reads.d.ts +8 -0
- package/dist/conformance/relations/cases/reads.d.ts.map +1 -0
- package/dist/conformance/relations/cases/traversal.d.ts +7 -0
- package/dist/conformance/relations/cases/traversal.d.ts.map +1 -0
- package/dist/conformance/relations/cases/writes.d.ts +4 -0
- package/dist/conformance/relations/cases/writes.d.ts.map +1 -0
- package/dist/conformance/relations/describe.d.ts +20 -0
- package/dist/conformance/relations/describe.d.ts.map +1 -0
- package/dist/conformance/relations/fixtures.d.ts +8 -0
- package/dist/conformance/relations/fixtures.d.ts.map +1 -0
- package/dist/conformance/relations/index.d.ts +18 -0
- package/dist/conformance/relations/index.d.ts.map +1 -0
- package/dist/conformance/relations/reference.d.ts +4 -0
- package/dist/conformance/relations/reference.d.ts.map +1 -0
- package/dist/conformance/relations/types.d.ts +34 -0
- package/dist/conformance/relations/types.d.ts.map +1 -0
- package/dist/conformance/types.d.ts +79 -0
- package/dist/conformance/types.d.ts.map +1 -0
- package/dist/errors/janus-error/base.d.ts +47 -0
- package/dist/errors/janus-error/base.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.credentials.d.ts +36 -0
- package/dist/errors/janus-error/codes.credentials.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.d.ts +23 -0
- package/dist/errors/janus-error/codes.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.invitations.d.ts +52 -0
- package/dist/errors/janus-error/codes.invitations.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.one-time.d.ts +63 -0
- package/dist/errors/janus-error/codes.one-time.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.records.d.ts +86 -0
- package/dist/errors/janus-error/codes.records.d.ts.map +1 -0
- package/dist/errors/janus-error/codes.social.d.ts +88 -0
- package/dist/errors/janus-error/codes.social.d.ts.map +1 -0
- package/dist/errors/janus-error/index.d.ts +17 -0
- package/dist/errors/janus-error/index.d.ts.map +1 -0
- package/dist/errors/janus-error/options.d.ts +105 -0
- package/dist/errors/janus-error/options.d.ts.map +1 -0
- package/dist/errors/janus-error/refusals.d.ts +151 -0
- package/dist/errors/janus-error/refusals.d.ts.map +1 -0
- package/dist/errors/janus-error/status.d.ts +21 -0
- package/dist/errors/janus-error/status.d.ts.map +1 -0
- package/dist/errors/janus-error/store.d.ts +36 -0
- package/dist/errors/janus-error/store.d.ts.map +1 -0
- package/dist/ids/derived.d.ts +25 -0
- package/dist/ids/derived.d.ts.map +1 -0
- package/dist/ids/id.d.ts +55 -0
- package/dist/ids/id.d.ts.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6948 -0
- package/dist/index.js.map +208 -0
- package/dist/pagination/cursor-page.d.ts +53 -0
- package/dist/pagination/cursor-page.d.ts.map +1 -0
- package/dist/permissions/bound-model.d.ts +10 -0
- package/dist/permissions/bound-model.d.ts.map +1 -0
- package/dist/permissions/can.d.ts +13 -0
- package/dist/permissions/can.d.ts.map +1 -0
- package/dist/permissions/engine.d.ts +49 -0
- package/dist/permissions/engine.d.ts.map +1 -0
- package/dist/permissions/holders.d.ts +12 -0
- package/dist/permissions/holders.d.ts.map +1 -0
- package/dist/permissions/index.d.ts +36 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +924 -0
- package/dist/permissions/index.js.map +28 -0
- package/dist/permissions/input.d.ts +43 -0
- package/dist/permissions/input.d.ts.map +1 -0
- package/dist/permissions/list.d.ts +16 -0
- package/dist/permissions/list.d.ts.map +1 -0
- package/dist/permissions/model/can.d.ts +41 -0
- package/dist/permissions/model/can.d.ts.map +1 -0
- package/dist/permissions/model/config.d.ts +36 -0
- package/dist/permissions/model/config.d.ts.map +1 -0
- package/dist/permissions/model/constraint.d.ts +37 -0
- package/dist/permissions/model/constraint.d.ts.map +1 -0
- package/dist/permissions/model/ctx.d.ts +23 -0
- package/dist/permissions/model/ctx.d.ts.map +1 -0
- package/dist/permissions/model/define.d.ts +78 -0
- package/dist/permissions/model/define.d.ts.map +1 -0
- package/dist/permissions/model/from-field.d.ts +31 -0
- package/dist/permissions/model/from-field.d.ts.map +1 -0
- package/dist/permissions/model/grant.d.ts +81 -0
- package/dist/permissions/model/grant.d.ts.map +1 -0
- package/dist/permissions/model/list.d.ts +48 -0
- package/dist/permissions/model/list.d.ts.map +1 -0
- package/dist/permissions/model/names.d.ts +51 -0
- package/dist/permissions/model/names.d.ts.map +1 -0
- package/dist/permissions/model/permissions.d.ts +48 -0
- package/dist/permissions/model/permissions.d.ts.map +1 -0
- package/dist/permissions/model/refs.d.ts +36 -0
- package/dist/permissions/model/refs.d.ts.map +1 -0
- package/dist/permissions/model/refusal.d.ts +13 -0
- package/dist/permissions/model/refusal.d.ts.map +1 -0
- package/dist/permissions/model/unions.d.ts +3 -0
- package/dist/permissions/model/unions.d.ts.map +1 -0
- package/dist/permissions/model/when.d.ts +16 -0
- package/dist/permissions/model/when.d.ts.map +1 -0
- package/dist/permissions/port/holders.d.ts +38 -0
- package/dist/permissions/port/holders.d.ts.map +1 -0
- package/dist/permissions/port/memory.d.ts +17 -0
- package/dist/permissions/port/memory.d.ts.map +1 -0
- package/dist/permissions/port/types.d.ts +101 -0
- package/dist/permissions/port/types.d.ts.map +1 -0
- package/dist/permissions/replace.d.ts +25 -0
- package/dist/permissions/replace.d.ts.map +1 -0
- package/dist/permissions/resolve/declared-names.d.ts +24 -0
- package/dist/permissions/resolve/declared-names.d.ts.map +1 -0
- package/dist/permissions/resolve/refuse-data-beyond-root.d.ts +11 -0
- package/dist/permissions/resolve/refuse-data-beyond-root.d.ts.map +1 -0
- package/dist/permissions/resolve/refuse-loops.d.ts +10 -0
- package/dist/permissions/resolve/refuse-loops.d.ts.map +1 -0
- package/dist/permissions/resolve/resolve-model.d.ts +13 -0
- package/dist/permissions/resolve/resolve-model.d.ts.map +1 -0
- package/dist/permissions/resolve/resolve-relation.d.ts +9 -0
- package/dist/permissions/resolve/resolve-relation.d.ts.map +1 -0
- package/dist/permissions/resolve/resolve-rule.d.ts +12 -0
- package/dist/permissions/resolve/resolve-rule.d.ts.map +1 -0
- package/dist/permissions/resolve/resolved.d.ts +52 -0
- package/dist/permissions/resolve/resolved.d.ts.map +1 -0
- package/dist/permissions/resolve/step.d.ts +4 -0
- package/dist/permissions/resolve/step.d.ts.map +1 -0
- package/dist/permissions/reverse.d.ts +53 -0
- package/dist/permissions/reverse.d.ts.map +1 -0
- package/dist/permissions/walk.d.ts +29 -0
- package/dist/permissions/walk.d.ts.map +1 -0
- package/dist/stores/guard.d.ts +24 -0
- package/dist/stores/guard.d.ts.map +1 -0
- package/dist/stores/storable.d.ts +15 -0
- package/dist/stores/storable.d.ts.map +1 -0
- package/dist/subjects/notation.d.ts +39 -0
- package/dist/subjects/notation.d.ts.map +1 -0
- package/dist/subjects/subject.d.ts +128 -0
- package/dist/subjects/subject.d.ts.map +1 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +26 -0
- package/dist/testing/index.js.map +10 -0
- package/dist/time/clock.d.ts +31 -0
- package/dist/time/clock.d.ts.map +1 -0
- package/dist/time/duration.d.ts +23 -0
- package/dist/time/duration.d.ts.map +1 -0
- package/docs/README.md +46 -0
- package/docs/guide/adapters.md +861 -0
- package/docs/guide/api-keys.md +316 -0
- package/docs/guide/avatars.md +334 -0
- package/docs/guide/devices.md +441 -0
- package/docs/guide/email-flows.md +880 -0
- package/docs/guide/errors.md +180 -0
- package/docs/guide/events.md +467 -0
- package/docs/guide/invitations.md +465 -0
- package/docs/guide/issuers.md +107 -0
- package/docs/guide/magic-link.md +580 -0
- package/docs/guide/migrating-invitations.md +142 -0
- package/docs/guide/passkeys.md +425 -0
- package/docs/guide/passwords.md +325 -0
- package/docs/guide/permissions.md +719 -0
- package/docs/guide/second-factor.md +1124 -0
- package/docs/guide/sessions.md +521 -0
- package/docs/guide/sign-in-code.md +631 -0
- package/docs/guide/social.md +648 -0
- package/docs/guide/step-up.md +262 -0
- package/docs/guide/users.md +557 -0
- package/docs/guide/vocabulary.md +316 -0
- package/docs/roadmap.md +102 -0
- package/docs/troubleshooting.md +3318 -0
- package/package.json +77 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/ids/id.ts", "../src/auth/port/memory/copy.ts", "../src/auth/port/memory/api-keys/pages.ts", "../src/auth/port/memory/api-keys/capabilities.ts", "../src/auth/port/memory/api-keys/index.ts", "../src/auth/port/memory/invitations-pending.ts", "../src/auth/port/memory/invitations.ts", "../src/auth/port/memory/passkeys.ts", "../src/auth/port/memory/sessions.ts", "../src/auth/port/memory/social-links.ts", "../src/auth/port/memory/tokens.ts", "../src/auth/port/memory/user-index.ts", "../src/auth/port/memory/user-update.ts", "../src/auth/port/memory/users.ts", "../src/auth/port/memory/stores.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * An id — of a user, a session: a UUIDv7, lowercase, hyphenated.\n *\n * **The core mints it, not the store**, and that decision pays for itself three\n * times over:\n *\n * - A UUIDv7 leads with a 48-bit millisecond timestamp, so ids sort in\n * creation order as strings. The pagination cursor is therefore *the last\n * id* — one index on the id, and the ordering is already total. A\n * store-minted id would need a `createdAt` index plus the id as a tiebreak,\n * because a timestamp alone is not a total order, and an opaque cursor per\n * adapter.\n * - `insertUser` becomes **idempotent under retry**: the id is decided\n * before the call, so a retry after a timeout writes the same row rather\n * than a second user.\n * - Every adapter reports the same shape, so moving an application from one\n * adapter to another is a copy rather than a rewrite of every stored\n * reference.\n *\n * The price, stated plainly: an adapter cannot reuse an existing numeric primary\n * key. It gets a `uuid` column, or a 36-character string, and the monotonic\n * prefix gives it the index locality a UUIDv4 destroys.\n */\nexport type Id = string;\n\nconst HEX: readonly string[] = Array.from({ length: 256 }, (_, i) =>\n\ti.toString(16).padStart(2, '0'),\n);\n\nlet lastMs = -1;\nlet sequence = 0;\n\n/**\n * The 12-bit sequence UUIDv7 keeps for ordering inside one millisecond.\n *\n * RFC 9562 calls this the \"replace leftmost random bits with an increased clock\n * precision\" method. Without it, two ids minted in the same millisecond order\n * by their random tail — still a total order, which is all the port requires,\n * but not creation order, and \"newest first\" would then be wrong for anything\n * created in a burst. A signup storm is exactly such a burst.\n */\nconst SEQUENCE_MAX = 0xfff;\n\n/**\n * A fresh id.\n *\n * Strictly increasing: within one millisecond it uses the sequence, and if that\n * overflows — more than 4096 ids in a millisecond, which no real\n * application reaches — it borrows the next millisecond rather than repeating\n * one. Across processes the 62 random bits of the tail are what keep two machines\n * apart.\n */\nexport function mintId(now: number = Date.now()): Id {\n\tlet ms = now;\n\n\tif (ms === lastMs) {\n\t\tsequence += 1;\n\t\tif (sequence > SEQUENCE_MAX) {\n\t\t\t// Borrow from the next millisecond. This keeps ids strictly\n\t\t\t// increasing at the cost of a timestamp a hair ahead of the clock,\n\t\t\t// which is the right trade: a repeated id would break the cursor.\n\t\t\tms = lastMs + 1;\n\t\t\tsequence = 0;\n\t\t}\n\t} else if (ms > lastMs) {\n\t\tsequence = 0;\n\t} else {\n\t\t// The clock went backwards — an NTP step, or a container resumed. Hold\n\t\t// the last millisecond and keep counting, so ids stay ordered even\n\t\t// though they stop matching the wall clock for a moment.\n\t\tms = lastMs;\n\t\tsequence += 1;\n\t\tif (sequence > SEQUENCE_MAX) {\n\t\t\tms = lastMs + 1;\n\t\t\tsequence = 0;\n\t\t}\n\t}\n\n\tlastMs = ms;\n\n\tconst bytes = new Uint8Array(16);\n\tcrypto.getRandomValues(bytes.subarray(8));\n\n\tbytes[0] = (ms / 2 ** 40) & 0xff;\n\tbytes[1] = (ms / 2 ** 32) & 0xff;\n\tbytes[2] = (ms / 2 ** 24) & 0xff;\n\tbytes[3] = (ms / 2 ** 16) & 0xff;\n\tbytes[4] = (ms / 2 ** 8) & 0xff;\n\tbytes[5] = ms & 0xff;\n\t// Version 7 in the high nibble, the sequence's top 4 bits below it.\n\tbytes[6] = 0x70 | ((sequence >> 8) & 0x0f);\n\tbytes[7] = sequence & 0xff;\n\t// Variant 10 in the two high bits of byte 8; the rest of it stays random.\n\tbytes[8] = 0x80 | ((bytes[8] as number) & 0x3f);\n\n\treturn `${HEX[bytes[0] as number]}${HEX[bytes[1] as number]}${HEX[bytes[2] as number]}${HEX[bytes[3] as number]}-${HEX[bytes[4] as number]}${HEX[bytes[5] as number]}-${HEX[bytes[6] as number]}${HEX[bytes[7] as number]}-${HEX[bytes[8] as number]}${HEX[bytes[9] as number]}-${HEX[bytes[10] as number]}${HEX[bytes[11] as number]}${HEX[bytes[12] as number]}${HEX[bytes[13] as number]}${HEX[bytes[14] as number]}${HEX[bytes[15] as number]}`;\n}\n\nconst UUID_V7 =\n\t/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;\n\n/**\n * Whether this string is an id this package could have minted.\n *\n * Used by an adapter to answer `null` for a malformed id **without reaching the\n * store**: an id arrives off a URL, and one of the wrong shape is \"no such\n * user\", not an outage and not a query. Rejecting it here also keeps a\n * hand-written id out of a store that would then hold something the cursor\n * cannot order.\n */\nexport function isId(value: string): boolean {\n\treturn UUID_V7.test(value);\n}\n\n/**\n * When this id was minted, from the id itself.\n *\n * Offered because the timestamp is *in* the id, so a `createdAt` column is a\n * convenience rather than the truth — and an adapter that loses one can still\n * answer. It is not a substitute for `createdAt`: the sequence may have borrowed\n * a millisecond, and a clock that stepped backwards is held rather than\n * followed, so this is accurate to the millisecond and no further.\n */\nexport function mintedAt(id: Id): Date {\n\tconst hex = id.replace(/-/g, '').slice(0, 12);\n\treturn new Date(Number.parseInt(hex, 16));\n}\n",
|
|
6
|
+
"/**\n * A deep copy: every record goes in and comes out through it, so a caller that\n * mutates what it passed or what it got back cannot reach the store.\n */\nexport const copy = <T>(value: T): T => structuredClone(value);\n",
|
|
7
|
+
"import type { CursorPage } from '../../../../pagination/cursor-page';\nimport type {\n\tApiKeyBound,\n\tApiKeyId,\n\tApiKeyPageRequest,\n\tApiKeyRecord,\n} from '../../types';\nimport { copy } from '../copy';\n\nexport function sameBound(\n\tstored: ApiKeyBound | undefined,\n\tbound: ApiKeyBound,\n): boolean {\n\treturn (\n\t\tstored !== undefined && stored.type === bound.type && stored.id === bound.id\n\t);\n}\n\n/** One page of the keys that match, in id order — a Map keeps insertion order, not id order. */\nexport function pageWhere(\n\tbyId: Map<ApiKeyId, ApiKeyRecord>,\n\t{ first, after }: ApiKeyPageRequest,\n\tmatches: (stored: ApiKeyRecord) => boolean,\n): CursorPage<ApiKeyRecord> {\n\tconst ids = [...byId.values()]\n\t\t.filter(matches)\n\t\t.map((key) => key.id)\n\t\t.filter((id) => after === null || id > after)\n\t\t.sort();\n\tconst pageIds = ids.slice(0, first);\n\tconst last = pageIds.at(-1);\n\n\treturn {\n\t\titems: pageIds.map((id) => copy(byId.get(id) as ApiKeyRecord)),\n\t\tnextCursor: ids.length > first && last !== undefined ? last : null,\n\t};\n}\n\nexport function deleteWhere(\n\tbyId: Map<ApiKeyId, ApiKeyRecord>,\n\tmatches: (stored: ApiKeyRecord) => boolean,\n): number {\n\tlet deleted = 0;\n\n\tfor (const [id, stored] of byId) {\n\t\tif (matches(stored)) {\n\t\t\tbyId.delete(id);\n\t\t\tdeleted += 1;\n\t\t}\n\t}\n\n\treturn deleted;\n}\n",
|
|
8
|
+
"import type {\n\tApiKeyBoundMethods,\n\tApiKeyExpiryNoticeMethods,\n\tApiKeyId,\n\tApiKeyRecord,\n\tApiKeyUserBoundMethods,\n} from '../../types';\nimport { pageWhere, sameBound } from './pages';\n\n/** The memory store's `bound` capability, over its map. */\nexport function boundMethods(\n\tbyId: Map<ApiKeyId, ApiKeyRecord>,\n): ApiKeyBoundMethods {\n\treturn {\n\t\tasync listBoundApiKeys(bound, page) {\n\t\t\treturn pageWhere(byId, page, (key) => sameBound(key.bound, bound));\n\t\t},\n\n\t\tasync revokeBoundApiKeys(userId, bound, at) {\n\t\t\tlet revoked = 0;\n\n\t\t\tfor (const [id, stored] of byId) {\n\t\t\t\tif (\n\t\t\t\t\tstored.userId === userId &&\n\t\t\t\t\tstored.revokedAt === null &&\n\t\t\t\t\tsameBound(stored.bound, bound)\n\t\t\t\t) {\n\t\t\t\t\tbyId.set(id, { ...stored, revokedAt: new Date(at) });\n\t\t\t\t\trevoked += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn revoked;\n\t\t},\n\t};\n}\n\n/** The memory store's `userBound` capability, over its map. */\nexport function userBoundMethods(\n\tbyId: Map<ApiKeyId, ApiKeyRecord>,\n): ApiKeyUserBoundMethods {\n\treturn {\n\t\tasync listUserBoundApiKeys(userId, bound, page) {\n\t\t\treturn pageWhere(\n\t\t\t\tbyId,\n\t\t\t\tpage,\n\t\t\t\t(key) =>\n\t\t\t\t\tkey.userId === userId &&\n\t\t\t\t\t(bound === null\n\t\t\t\t\t\t? key.bound === undefined\n\t\t\t\t\t\t: sameBound(key.bound, bound)),\n\t\t\t);\n\t\t},\n\t};\n}\n\n/** The memory store's `expiryNotice` capability, over its map. */\nexport function expiryNoticeMethods(\n\tbyId: Map<ApiKeyId, ApiKeyRecord>,\n): ApiKeyExpiryNoticeMethods {\n\treturn {\n\t\tasync listExpiringApiKeys({ now, before, first, after }) {\n\t\t\treturn pageWhere(\n\t\t\t\tbyId,\n\t\t\t\t{ first, after },\n\t\t\t\t(key) =>\n\t\t\t\t\tkey.revokedAt === null &&\n\t\t\t\t\tkey.expiryNotifiedAt === undefined &&\n\t\t\t\t\tkey.expiresAt.getTime() > now.getTime() &&\n\t\t\t\t\tkey.expiresAt.getTime() <= before.getTime(),\n\t\t\t);\n\t\t},\n\n\t\tasync markApiKeyExpiryNotified(id, at) {\n\t\t\tconst stored = byId.get(id);\n\t\t\tif (stored === undefined || stored.expiryNotifiedAt !== undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tbyId.set(id, { ...stored, expiryNotifiedAt: new Date(at) });\n\t\t\treturn true;\n\t\t},\n\t};\n}\n",
|
|
9
|
+
"import type {\n\tApiKeyBoundMethods,\n\tApiKeyExpiryNoticeMethods,\n\tApiKeyId,\n\tApiKeyRecord,\n\tApiKeyStore,\n\tApiKeyUserBoundMethods,\n} from '../../types';\nimport { copy } from '../copy';\nimport {\n\tboundMethods,\n\texpiryNoticeMethods,\n\tuserBoundMethods,\n} from './capabilities';\nimport { deleteWhere, pageWhere } from './pages';\n\n/**\n * The API key store in memory: the reference implementation of\n * {@link ApiKeyStore}, shipped for a consumer's unit tests and for an adapter\n * author to compare against.\n *\n * Every method is `async` and every record is copied in and out, as the other\n * in-memory stores do. `touchApiKey` reads and writes with no `await` between\n * the two, so concurrent calls on a stale key see exactly one winner. It has\n * every optional capability: `bound`, `userBound` and `expiryNotice`.\n */\nexport function createMemoryApiKeys(): ApiKeyStore &\n\tApiKeyBoundMethods &\n\tApiKeyUserBoundMethods &\n\tApiKeyExpiryNoticeMethods {\n\tconst byId = new Map<ApiKeyId, ApiKeyRecord>();\n\n\treturn {\n\t\tasync insertApiKey(record) {\n\t\t\tif (!byId.has(record.id)) byId.set(record.id, copy(record));\n\t\t},\n\n\t\tasync findApiKey(id) {\n\t\t\tconst stored = byId.get(id);\n\t\t\treturn stored === undefined ? null : copy(stored);\n\t\t},\n\n\t\tasync listUserApiKeys(userId, page) {\n\t\t\treturn pageWhere(byId, page, (key) => key.userId === userId);\n\t\t},\n\n\t\tasync touchApiKey(id, at, staleBefore) {\n\t\t\tconst stored = byId.get(id);\n\t\t\tif (stored === undefined || stored.revokedAt !== null) return false;\n\t\t\tif (\n\t\t\t\tstored.lastUsedAt !== null &&\n\t\t\t\tstored.lastUsedAt.getTime() >= staleBefore.getTime()\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tbyId.set(id, { ...stored, lastUsedAt: new Date(at) });\n\t\t\treturn true;\n\t\t},\n\n\t\tasync revokeApiKey(id, at) {\n\t\t\tconst stored = byId.get(id);\n\t\t\tif (stored === undefined) return false;\n\n\t\t\tif (stored.revokedAt === null) {\n\t\t\t\tbyId.set(id, { ...stored, revokedAt: new Date(at) });\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\tasync revokeUserApiKeys(userId, at) {\n\t\t\tlet revoked = 0;\n\n\t\t\tfor (const [id, stored] of byId) {\n\t\t\t\tif (stored.userId === userId && stored.revokedAt === null) {\n\t\t\t\t\tbyId.set(id, { ...stored, revokedAt: new Date(at) });\n\t\t\t\t\trevoked += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn revoked;\n\t\t},\n\n\t\tasync deleteUserApiKeys(userId) {\n\t\t\treturn deleteWhere(byId, (stored) => stored.userId === userId);\n\t\t},\n\n\t\tasync deleteExpiredApiKeys(before) {\n\t\t\treturn deleteWhere(\n\t\t\t\tbyId,\n\t\t\t\t(stored) => stored.expiresAt.getTime() <= before.getTime(),\n\t\t\t);\n\t\t},\n\t\t...boundMethods(byId),\n\t\t...userBoundMethods(byId),\n\t\t...expiryNoticeMethods(byId),\n\t};\n}\n",
|
|
10
|
+
"import type { InvitationId, InvitationRecord } from '../types';\nimport { copy } from './copy';\n\ntype Invitations = Map<InvitationId, InvitationRecord>;\n\nexport function holdsPending(\n\tbyId: Invitations,\n\trecord: InvitationRecord,\n): boolean {\n\tfor (const other of byId.values()) {\n\t\tif (\n\t\t\tother.id !== record.id &&\n\t\t\tother.status === 'pending' &&\n\t\t\tother.scope === record.scope &&\n\t\t\tother.email === record.email\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport function findPendingInvitation(\n\tbyId: Invitations,\n\tscope: string,\n\temail: string,\n): InvitationRecord | null {\n\tfor (const stored of byId.values()) {\n\t\tif (\n\t\t\tstored.status === 'pending' &&\n\t\t\tstored.scope === scope &&\n\t\t\tstored.email === email\n\t\t) {\n\t\t\treturn copy(stored);\n\t\t}\n\t}\n\treturn null;\n}\n",
|
|
11
|
+
"import { StoreConflict } from '../../../errors/janus-error';\nimport type {\n\tInvitationFilter,\n\tInvitationId,\n\tInvitationRecord,\n\tInvitationStore,\n} from '../types';\nimport { copy } from './copy';\nimport { findPendingInvitation, holdsPending } from './invitations-pending';\n\n/**\n * The invitation store in memory: the reference implementation of\n * {@link InvitationStore}, shipped for a consumer's unit tests and for an\n * adapter author to compare against.\n *\n * Every method is `async` and every record is copied in and out. A write reads\n * and writes with no `await` between the two, so concurrent claims on one\n * version see exactly one winner.\n */\nexport function createMemoryInvitations(): InvitationStore {\n\tconst byId: Invitations = new Map();\n\n\treturn {\n\t\tinsertInvitation: async (record) => insertInvitation(byId, record),\n\t\tfindInvitation: async (id) => findInvitation(byId, id),\n\t\tfindInvitationByCodeHash: async (codeHash) =>\n\t\t\tfindInvitationByCodeHash(byId, codeHash),\n\t\tlistScopeInvitations: async (scope, query) =>\n\t\t\tlistScopeInvitations(byId, scope, query),\n\t\tfindPendingInvitation: async (scope, email) =>\n\t\t\tfindPendingInvitation(byId, scope, email),\n\t\tcountScopeInvitations: async (scope, filter) =>\n\t\t\tcountScopeInvitations(byId, scope, filter),\n\t\tcountPendingInvitations: async (scope, now) =>\n\t\t\tcountPendingInvitations(byId, scope, now),\n\t\tupdateInvitation: async (id, ifVersion, patch) =>\n\t\t\tupdateInvitation(byId, id, ifVersion, patch),\n\t\tdeleteScopeInvitations: async (scope) =>\n\t\t\tdeleteWhere(byId, (stored) => stored.scope === scope),\n\t\tdeleteExpiredInvitations: async (before) =>\n\t\t\tdeleteWhere(\n\t\t\t\tbyId,\n\t\t\t\t(stored) => stored.expiresAt.getTime() <= before.getTime(),\n\t\t\t),\n\t};\n}\n\ntype Invitations = Map<InvitationId, InvitationRecord>;\n\nfunction insertInvitation(\n\tbyId: Invitations,\n\trecord: InvitationRecord,\n): boolean {\n\tif (byId.has(record.id)) return true;\n\tif (record.status === 'pending' && holdsPending(byId, record)) return false;\n\tbyId.set(record.id, copy(record));\n\treturn true;\n}\n\nfunction findInvitation(\n\tbyId: Invitations,\n\tid: InvitationId,\n): InvitationRecord | null {\n\tconst stored = byId.get(id);\n\treturn stored === undefined ? null : copy(stored);\n}\n\nfunction findInvitationByCodeHash(\n\tbyId: Invitations,\n\tcodeHash: string,\n): InvitationRecord | null {\n\tfor (const stored of byId.values()) {\n\t\tif (stored.codeHash === codeHash) return copy(stored);\n\t}\n\treturn null;\n}\n\nfunction listScopeInvitations(\n\tbyId: Invitations,\n\tscope: string,\n\t{\n\t\tstatus,\n\t\tfirst,\n\t\tafter,\n\t\trole = null,\n\t\tref = null,\n\t\torder = 'asc',\n\t\tlapsed = null,\n\t}: Parameters<InvitationStore['listScopeInvitations']>[1],\n): { items: InvitationRecord[]; nextCursor: string | null } {\n\tconst desc = order === 'desc';\n\t// A Map keeps insertion order, not id order.\n\tconst ids = [...byId.values()]\n\t\t.filter((invitation) =>\n\t\t\tmatches(invitation, scope, { status, role, ref, lapsed }),\n\t\t)\n\t\t.map((invitation) => invitation.id)\n\t\t.filter((id) => after === null || (desc ? id < after : id > after))\n\t\t.sort();\n\tif (desc) ids.reverse();\n\tconst pageIds = ids.slice(0, first);\n\tconst last = pageIds.at(-1);\n\n\treturn {\n\t\titems: pageIds.map((id) => copy(byId.get(id) as InvitationRecord)),\n\t\tnextCursor: ids.length > first && last !== undefined ? last : null,\n\t};\n}\n\nfunction matches(\n\tinvitation: InvitationRecord,\n\tscope: string,\n\tfilter: InvitationFilter,\n): boolean {\n\treturn (\n\t\tinvitation.scope === scope &&\n\t\t(filter.status === null || invitation.status === filter.status) &&\n\t\t(filter.role === null || invitation.role === filter.role) &&\n\t\t(filter.ref === null || (invitation.ref ?? null) === filter.ref) &&\n\t\tkeptByLapsed(invitation, filter.lapsed)\n\t);\n}\n\n/** Lapsed: stored `pending` with `expiresAt` at or before `now`. */\nfunction keptByLapsed(\n\tinvitation: InvitationRecord,\n\tlapsed: InvitationFilter['lapsed'] | null,\n): boolean {\n\tif (lapsed == null) return true;\n\tconst isLapsed =\n\t\tinvitation.status === 'pending' &&\n\t\tinvitation.expiresAt.getTime() <= lapsed.now.getTime();\n\treturn lapsed.mode === 'only' ? isLapsed : !isLapsed;\n}\n\nfunction countScopeInvitations(\n\tbyId: Invitations,\n\tscope: string,\n\tfilter: InvitationFilter,\n): number {\n\tlet count = 0;\n\tfor (const stored of byId.values()) {\n\t\tif (matches(stored, scope, filter)) count += 1;\n\t}\n\treturn count;\n}\n\nfunction countPendingInvitations(\n\tbyId: Invitations,\n\tscope: string,\n\tnow: Date,\n): number {\n\tlet count = 0;\n\tfor (const stored of byId.values()) {\n\t\tif (\n\t\t\tstored.scope === scope &&\n\t\t\tstored.status === 'pending' &&\n\t\t\tstored.expiresAt.getTime() > now.getTime()\n\t\t) {\n\t\t\tcount += 1;\n\t\t}\n\t}\n\treturn count;\n}\n\nfunction updateInvitation(\n\tbyId: Invitations,\n\tid: InvitationId,\n\tifVersion: number,\n\tpatch: Parameters<InvitationStore['updateInvitation']>[2],\n): InvitationRecord | null {\n\tconst stored = byId.get(id);\n\tif (stored === undefined) return null;\n\n\tif (stored.version !== ifVersion) {\n\t\tthrow new StoreConflict(\n\t\t\t'version',\n\t\t\t`updateInvitation: expected version ${ifVersion}, found ${stored.version}`,\n\t\t\t{\n\t\t\t\texpectedVersion: ifVersion,\n\t\t\t\tactualVersion: stored.version,\n\t\t\t\toperation: 'updateInvitation',\n\t\t\t},\n\t\t);\n\t}\n\n\tconst next: InvitationRecord = {\n\t\t...stored,\n\t\t...definedOnly(patch),\n\t\tversion: stored.version + 1,\n\t};\n\tif (next.status === 'pending' && holdsPending(byId, next)) {\n\t\tthrow new StoreConflict(\n\t\t\t'pending',\n\t\t\t'updateInvitation: another pending invitation holds this scope and address',\n\t\t\t{ operation: 'updateInvitation' },\n\t\t);\n\t}\n\n\tbyId.set(id, copy(next));\n\treturn copy(next);\n}\n\n/** A key present with `undefined` is absent, never an erasure. */\nfunction definedOnly<T extends object>(patch: T): Partial<T> {\n\treturn Object.fromEntries(\n\t\tObject.entries(patch).filter(([, value]) => value !== undefined),\n\t) as Partial<T>;\n}\n\nfunction deleteWhere(\n\tbyId: Invitations,\n\tmatches: (stored: InvitationRecord) => boolean,\n): number {\n\tlet deleted = 0;\n\n\tfor (const [id, stored] of byId) {\n\t\tif (matches(stored)) {\n\t\t\tbyId.delete(id);\n\t\t\tdeleted += 1;\n\t\t}\n\t}\n\n\treturn deleted;\n}\n",
|
|
12
|
+
"import type { PasskeyRecord, PasskeyStore } from '../types';\nimport { copy } from './copy';\n\n/**\n * The passkey store in memory, by `credentialId`: bytes compared as they are.\n *\n * Each method checks and writes with no `await` between the two, which on one\n * event loop is what an atomic insert-if-absent or conditional write is.\n */\nexport function memoryPasskeyStore(): PasskeyStore {\n\tconst byCredential = new Map<string, PasskeyRecord>();\n\n\treturn {\n\t\tasync insertPasskey(record) {\n\t\t\tconst held = byCredential.get(record.credentialId);\n\t\t\tif (held !== undefined) return copy(held);\n\n\t\t\tbyCredential.set(record.credentialId, copy(record));\n\t\t\treturn copy(record);\n\t\t},\n\n\t\tasync findPasskey(credentialId) {\n\t\t\tconst stored = byCredential.get(credentialId);\n\t\t\treturn stored === undefined ? null : copy(stored);\n\t\t},\n\n\t\tasync listUserPasskeys(userId) {\n\t\t\treturn [...byCredential.values()]\n\t\t\t\t.filter((passkey) => passkey.userId === userId)\n\t\t\t\t.map(copy);\n\t\t},\n\n\t\tasync recordPasskeyUse(userId, credentialId, use, ifCounter) {\n\t\t\tconst stored = byCredential.get(credentialId);\n\t\t\tif (stored?.userId !== userId || stored.counter !== ifCounter) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst updated: PasskeyRecord = {\n\t\t\t\t...stored,\n\t\t\t\tcounter: use.counter,\n\t\t\t\tbackedUp: use.backedUp,\n\t\t\t\tlastUsedAt: new Date(use.lastUsedAt),\n\t\t\t};\n\t\t\tbyCredential.set(credentialId, updated);\n\t\t\treturn copy(updated);\n\t\t},\n\n\t\tasync renamePasskey(userId, credentialId, name) {\n\t\t\tconst stored = byCredential.get(credentialId);\n\t\t\tif (stored?.userId !== userId) return false;\n\n\t\t\tbyCredential.set(credentialId, { ...stored, name });\n\t\t\treturn true;\n\t\t},\n\n\t\tasync deletePasskey(userId, credentialId) {\n\t\t\tif (byCredential.get(credentialId)?.userId !== userId) return false;\n\n\t\t\tbyCredential.delete(credentialId);\n\t\t\treturn true;\n\t\t},\n\n\t\tasync deleteUserPasskeys(userId) {\n\t\t\tlet deleted = 0;\n\n\t\t\tfor (const [key, stored] of byCredential) {\n\t\t\t\tif (stored.userId === userId) {\n\t\t\t\t\tbyCredential.delete(key);\n\t\t\t\t\tdeleted += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn deleted;\n\t\t},\n\t};\n}\n",
|
|
13
|
+
"import type { SessionId, SessionRecord, SessionStore } from '../types';\nimport { copy } from './copy';\n\n/** What the in-memory session store holds: the records, and the index on their token hashes. */\ninterface SessionIndex {\n\treadonly byId: Map<SessionId, SessionRecord>;\n\treadonly byTokenHash: Map<string, SessionId>;\n}\n\n/** The session store in memory. */\nexport function memorySessionStore(): SessionStore {\n\tconst index: SessionIndex = {\n\t\tbyId: new Map<SessionId, SessionRecord>(),\n\t\tbyTokenHash: new Map<string, SessionId>(),\n\t};\n\tconst { byId, byTokenHash } = index;\n\n\treturn {\n\t\tasync insertSession(record) {\n\t\t\tif (byId.has(record.id)) return;\n\n\t\t\tconst written = copy(record);\n\t\t\tbyId.set(written.id, written);\n\t\t\tbyTokenHash.set(written.tokenHash, written.id);\n\t\t},\n\n\t\tasync findSessionByTokenHash(tokenHash) {\n\t\t\tconst id = byTokenHash.get(tokenHash);\n\t\t\tconst stored = id === undefined ? undefined : byId.get(id);\n\t\t\treturn stored === undefined ? null : copy(stored);\n\t\t},\n\n\t\tasync extendSession(id, expiresAt, lastUsedAt) {\n\t\t\treturn standingWrite(index, id, {\n\t\t\t\texpiresAt: new Date(expiresAt),\n\t\t\t\t...(lastUsedAt === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: { lastUsedAt: new Date(lastUsedAt) }),\n\t\t\t});\n\t\t},\n\n\t\tasync reauthenticateSession(id, at, amr) {\n\t\t\treturn standingWrite(index, id, {\n\t\t\t\tauthenticatedAt: new Date(at),\n\t\t\t\t...(amr === undefined ? {} : { amr: [...amr] }),\n\t\t\t});\n\t\t},\n\n\t\tasync revokeSession(id, at) {\n\t\t\tconst stored = byId.get(id);\n\t\t\tif (stored === undefined) return false;\n\n\t\t\tif (stored.revokedAt === null) revoke(index, id, stored, at);\n\t\t\treturn true;\n\t\t},\n\n\t\tasync listUserSessions(userId, now) {\n\t\t\tconst listed: SessionRecord[] = [];\n\t\t\tfor (const stored of byId.values()) {\n\t\t\t\tif (\n\t\t\t\t\tstored.userId === userId &&\n\t\t\t\t\tstored.revokedAt === null &&\n\t\t\t\t\tstored.expiresAt.getTime() > now.getTime()\n\t\t\t\t) {\n\t\t\t\t\tlisted.push(copy(stored));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn listed;\n\t\t},\n\n\t\tasync revokeUserSessions(userId, at, except, issuedBefore) {\n\t\t\tlet revoked = 0;\n\n\t\t\tfor (const [id, stored] of byId) {\n\t\t\t\tif (\n\t\t\t\t\tstored.userId === userId &&\n\t\t\t\t\tstored.revokedAt === null &&\n\t\t\t\t\tid !== except &&\n\t\t\t\t\t(issuedBefore === undefined ||\n\t\t\t\t\t\tstored.createdAt.getTime() < issuedBefore.getTime())\n\t\t\t\t) {\n\t\t\t\t\trevoke(index, id, stored, at);\n\t\t\t\t\trevoked += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn revoked;\n\t\t},\n\n\t\tasync deleteUserSessions(userId) {\n\t\t\treturn deleteWhere(index, (stored) => stored.userId === userId);\n\t\t},\n\n\t\tasync deleteExpiredSessions(before) {\n\t\t\treturn deleteWhere(\n\t\t\t\tindex,\n\t\t\t\t(stored) => stored.expiresAt.getTime() <= before.getTime(),\n\t\t\t);\n\t\t},\n\t};\n}\n\n/**\n * Writes `patch` on a session **only while it is not revoked**, and answers\n * it as written — or `null` for none, or a revoked one, never brought back.\n */\nfunction standingWrite(\n\t{ byId }: SessionIndex,\n\tid: SessionId,\n\tpatch: Pick<\n\t\tPartial<SessionRecord>,\n\t\t'expiresAt' | 'authenticatedAt' | 'lastUsedAt' | 'amr'\n\t>,\n): SessionRecord | null {\n\tconst stored = byId.get(id);\n\tif (stored === undefined || stored.revokedAt !== null) return null;\n\n\tconst written: SessionRecord = { ...stored, ...patch };\n\tbyId.set(id, written);\n\treturn copy(written);\n}\n\nfunction revoke(\n\t{ byId }: SessionIndex,\n\tid: SessionId,\n\tstored: SessionRecord,\n\tat: Date,\n): void {\n\tbyId.set(id, { ...stored, revokedAt: new Date(at) });\n}\n\n/** Deletes every session `matches` accepts, from both maps, and counts them. */\nfunction deleteWhere(\n\t{ byId, byTokenHash }: SessionIndex,\n\tmatches: (stored: SessionRecord) => boolean,\n): number {\n\tlet deleted = 0;\n\n\tfor (const [id, stored] of byId) {\n\t\tif (matches(stored)) {\n\t\t\tbyId.delete(id);\n\t\t\tbyTokenHash.delete(stored.tokenHash);\n\t\t\tdeleted += 1;\n\t\t}\n\t}\n\n\treturn deleted;\n}\n",
|
|
14
|
+
"import type { SocialLinkRecord, SocialLinkStore } from '../types';\nimport { copy } from './copy';\n\n/**\n * The social link store in memory, by `(provider, accountId)`: bytes compared\n * as they are, so `'Abc'` and `'abc'` are two accounts.\n *\n * `insertSocialLink` checks and writes with no `await` between the two, which\n * on one event loop is what an atomic insert-if-absent is.\n */\nexport function memorySocialLinkStore(): SocialLinkStore {\n\tconst byPair = new Map<string, SocialLinkRecord>();\n\n\treturn {\n\t\tasync insertSocialLink(record) {\n\t\t\tconst key = keyOf(record.provider, record.accountId);\n\t\t\tconst held = byPair.get(key);\n\t\t\tif (held !== undefined) return copy(held);\n\n\t\t\tbyPair.set(key, copy(record));\n\t\t\treturn copy(record);\n\t\t},\n\n\t\tasync findSocialLink(provider, accountId) {\n\t\t\tconst stored = byPair.get(keyOf(provider, accountId));\n\t\t\treturn stored === undefined ? null : copy(stored);\n\t\t},\n\n\t\tasync listUserSocialLinks(userId) {\n\t\t\treturn [...byPair.values()]\n\t\t\t\t.filter((link) => link.userId === userId)\n\t\t\t\t.map(copy);\n\t\t},\n\n\t\tasync countSocialLinks(provider) {\n\t\t\tlet count = 0;\n\t\t\tfor (const link of byPair.values()) {\n\t\t\t\tif (link.provider === provider) count += 1;\n\t\t\t}\n\t\t\treturn count;\n\t\t},\n\n\t\tasync deleteSocialLink(userId, provider, accountId) {\n\t\t\tconst key = keyOf(provider, accountId);\n\t\t\tif (byPair.get(key)?.userId !== userId) return false;\n\n\t\t\tbyPair.delete(key);\n\t\t\treturn true;\n\t\t},\n\n\t\tasync deleteUserSocialLinks(userId) {\n\t\t\tlet deleted = 0;\n\n\t\t\tfor (const [key, stored] of byPair) {\n\t\t\t\tif (stored.userId === userId) {\n\t\t\t\t\tbyPair.delete(key);\n\t\t\t\t\tdeleted += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn deleted;\n\t\t},\n\t};\n}\n\n/** An unambiguous key: a JSON array cannot be confused across the two parts. */\nfunction keyOf(provider: string, accountId: string): string {\n\treturn JSON.stringify([provider, accountId]);\n}\n",
|
|
15
|
+
"import type { Id } from '../../../ids/id';\nimport type { TokenKind, TokenRecord, TokenStore } from '../types';\nimport { copy } from './copy';\n\n/** The token store in memory, by token hash. */\nexport function memoryTokenStore(): TokenStore {\n\tconst byTokenHash = new Map<string, TokenRecord>();\n\n\treturn {\n\t\tasync insertToken(record) {\n\t\t\tif (byTokenHash.has(record.tokenHash)) return;\n\t\t\tbyTokenHash.set(record.tokenHash, copy(record));\n\t\t},\n\n\t\tasync consumeToken(tokenHash, kind, at, userId) {\n\t\t\treturn consume(byTokenHash, tokenHash, kind, at, userId);\n\t\t},\n\n\t\tasync countAttempt(tokenHash, kind) {\n\t\t\treturn count(byTokenHash, tokenHash, kind);\n\t\t},\n\n\t\tasync spendUserTokens(userId, kind, at, except) {\n\t\t\tlet spent = 0;\n\n\t\t\tfor (const [tokenHash, stored] of byTokenHash) {\n\t\t\t\tif (\n\t\t\t\t\ttokenHash !== except &&\n\t\t\t\t\tstored.userId === userId &&\n\t\t\t\t\tstored.kind === kind &&\n\t\t\t\t\tstored.spentAt === null\n\t\t\t\t) {\n\t\t\t\t\tbyTokenHash.set(tokenHash, { ...stored, spentAt: new Date(at) });\n\t\t\t\t\tspent += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn spent;\n\t\t},\n\n\t\tasync deleteUserTokens(userId) {\n\t\t\tlet deleted = 0;\n\n\t\t\tfor (const [tokenHash, stored] of byTokenHash) {\n\t\t\t\tif (stored.userId === userId) {\n\t\t\t\t\tbyTokenHash.delete(tokenHash);\n\t\t\t\t\tdeleted += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn deleted;\n\t\t},\n\n\t\tasync deleteExpiredTokens(before) {\n\t\t\tlet deleted = 0;\n\n\t\t\tfor (const [tokenHash, stored] of byTokenHash) {\n\t\t\t\tif (stored.expiresAt.getTime() <= before.getTime()) {\n\t\t\t\t\tbyTokenHash.delete(tokenHash);\n\t\t\t\t\tdeleted += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn deleted;\n\t\t},\n\t};\n}\n\n/**\n * Spends the token and answers it as it was. No `await` between the read and\n * the write: on one event loop that is what makes the pair a single\n * conditional write. With `userId`, another user's token matches nothing.\n */\nfunction consume(\n\tbyTokenHash: Map<string, TokenRecord>,\n\ttokenHash: string,\n\tkind: TokenKind,\n\tat: Date,\n\tuserId: Id | undefined,\n): TokenRecord | null {\n\tconst stored = byTokenHash.get(tokenHash);\n\tif (stored === undefined || stored.kind !== kind) return null;\n\tif (userId !== undefined && stored.userId !== userId) return null;\n\n\tconst before = copy(stored);\n\tif (stored.spentAt === null) {\n\t\tbyTokenHash.set(tokenHash, { ...stored, spentAt: new Date(at) });\n\t}\n\n\treturn before;\n}\n\n/** Counts one attempt: the same single conditional write, no `await` between the read and the write. */\nfunction count(\n\tbyTokenHash: Map<string, TokenRecord>,\n\ttokenHash: string,\n\tkind: TokenKind,\n): TokenRecord | null {\n\tconst stored = byTokenHash.get(tokenHash);\n\tif (stored === undefined || stored.kind !== kind) return null;\n\tif (stored.spentAt !== null) return copy(stored);\n\n\tconst counted = { ...stored, attempts: stored.attempts + 1 };\n\tbyTokenHash.set(tokenHash, counted);\n\treturn copy(counted);\n}\n",
|
|
16
|
+
"import { StoreConflict } from '../../../errors/janus-error';\nimport type { Id } from '../../../ids/id';\nimport type { UserRecord } from '../types';\n\n/** What the in-memory user store holds: the records, and the unique index on their logins. */\nexport interface UserIndex {\n\treadonly byId: Map<Id, UserRecord>;\n\t/** The unique index: (type, login) key → the id holding it. */\n\treadonly byLogin: Map<string, Id>;\n}\n\n/** The unique key of one login. `\\u0000` cannot occur in a type name the core accepts. */\nexport const keyOf = (type: string, login: string): string =>\n\t`${type}\\u0000${login}`;\n\n/** The first of `logins` held by a user of `type` other than `id`. */\nexport const takenBy = (\n\t{ byLogin }: UserIndex,\n\ttype: string,\n\tlogins: readonly string[],\n\tid: Id,\n): string | undefined =>\n\tlogins.find((login) => {\n\t\tconst holder = byLogin.get(keyOf(type, login));\n\t\treturn holder !== undefined && holder !== id;\n\t});\n\n/** The conflict a login held by another user of `type` is refused with. */\nexport const taken = (operation: string, type: string, login: string) =>\n\tnew StoreConflict(\n\t\t'login',\n\t\t`${operation}: the login is taken by another ${type}`,\n\t\t{ login, userType: type, operation },\n\t);\n\n/** Points every login of `record` at its id. */\nexport function indexLogins({ byLogin }: UserIndex, record: UserRecord): void {\n\tfor (const login of record.logins) {\n\t\tbyLogin.set(keyOf(record.type, login), record.id);\n\t}\n}\n\n/** Frees every login of `record`. */\nexport function dropLogins({ byLogin }: UserIndex, record: UserRecord): void {\n\tfor (const login of record.logins) {\n\t\tbyLogin.delete(keyOf(record.type, login));\n\t}\n}\n",
|
|
17
|
+
"import { NotFoundError, StoreConflict } from '../../../errors/janus-error';\nimport type { Id } from '../../../ids/id';\nimport type { UserPatch, UserRecord } from '../types';\nimport { copy } from './copy';\nimport {\n\tdropLogins,\n\tindexLogins,\n\ttaken,\n\ttakenBy,\n\ttype UserIndex,\n} from './user-index';\n\n/**\n * `updateUser` in memory: refused for an unknown id, a version that moved or\n * a login held by another user — checked, then written, in one synchronous\n * step.\n */\nexport function updateStored(\n\tindex: UserIndex,\n\tid: Id,\n\tpatch: UserPatch,\n\tifVersion: number,\n): UserRecord {\n\tconst stored = index.byId.get(id);\n\n\tif (stored === undefined) {\n\t\tthrow new NotFoundError('updateUser: no user has this id', {\n\t\t\tuserId: id,\n\t\t\toperation: 'updateUser',\n\t\t});\n\t}\n\n\tif (stored.version !== ifVersion) {\n\t\tthrow new StoreConflict(\n\t\t\t'version',\n\t\t\t`updateUser: expected version ${ifVersion}, found ${stored.version}`,\n\t\t\t{\n\t\t\t\tuserId: id,\n\t\t\t\texpectedVersion: ifVersion,\n\t\t\t\tactualVersion: stored.version,\n\t\t\t\toperation: 'updateUser',\n\t\t\t},\n\t\t);\n\t}\n\n\tif (patch.logins !== undefined) {\n\t\tconst collision = takenBy(index, stored.type, patch.logins, id);\n\t\tif (collision !== undefined) {\n\t\t\tthrow taken('updateUser', stored.type, collision);\n\t\t}\n\t}\n\n\tconst written = applyPatch(stored, copy(patch));\n\n\tindex.byId.set(id, written);\n\tif (patch.logins !== undefined) {\n\t\tdropLogins(index, stored);\n\t\tindexLogins(index, written);\n\t}\n\n\treturn copy(written);\n}\n\n/**\n * The record a patch produces: the fields it names, replaced whole; the fields\n * it does not name, untouched.\n *\n * Reads each field by name rather than spreading the patch, so a key the port\n * does not declare — `version`, `id`, `type`, `createdAt`, or a `snake_case`\n * typo from JavaScript — never reaches the record. A key present as\n * `undefined` is absent, never an erasure.\n */\nfunction applyPatch(stored: UserRecord, patch: UserPatch): UserRecord {\n\tconst { nameKey: _kept, ...unnamed } = stored;\n\tconst nameKey = patch.nameKey === undefined ? _kept : patch.nameKey;\n\treturn {\n\t\t...unnamed,\n\t\t...(nameKey === undefined || nameKey === null ? {} : { nameKey }),\n\t\tschemaVersion: patch.schemaVersion ?? stored.schemaVersion,\n\t\tactive: patch.active ?? stored.active,\n\t\tfields: patch.fields ?? stored.fields,\n\t\tlogins: patch.logins ?? stored.logins,\n\t\tpassword: patch.password === undefined ? stored.password : patch.password,\n\t\tsecondFactor:\n\t\t\tpatch.secondFactor === undefined\n\t\t\t\t? stored.secondFactor\n\t\t\t\t: patch.secondFactor,\n\t\tavatar: patch.avatar === undefined ? stored.avatar : patch.avatar,\n\t\temailVerifiedAt:\n\t\t\tpatch.emailVerifiedAt === undefined\n\t\t\t\t? stored.emailVerifiedAt\n\t\t\t\t: patch.emailVerifiedAt,\n\t\tversion: stored.version + 1,\n\t\tupdatedAt: patch.updatedAt,\n\t};\n}\n",
|
|
18
|
+
"import type { Id } from '../../../ids/id';\nimport type { UserRecord, UserStore } from '../types';\nimport { copy } from './copy';\nimport {\n\tdropLogins,\n\tindexLogins,\n\tkeyOf,\n\ttaken,\n\ttakenBy,\n\ttype UserIndex,\n} from './user-index';\nimport { updateStored } from './user-update';\n\n/** The user store in memory: the records by id, and the unique index on logins. */\nexport function memoryUserStore(): UserStore {\n\tconst index: UserIndex = {\n\t\tbyId: new Map<Id, UserRecord>(),\n\t\tbyLogin: new Map<string, Id>(),\n\t};\n\tconst { byId, byLogin } = index;\n\n\treturn {\n\t\tasync insertUser(record) {\n\t\t\tconst stored = byId.get(record.id);\n\t\t\tif (stored !== undefined) return copy(stored);\n\n\t\t\tconst collision = takenBy(index, record.type, record.logins, record.id);\n\t\t\tif (collision !== undefined) {\n\t\t\t\tthrow taken('insertUser', record.type, collision);\n\t\t\t}\n\n\t\t\tconst written = copy(record);\n\t\t\tbyId.set(written.id, written);\n\t\t\tindexLogins(index, written);\n\n\t\t\treturn copy(written);\n\t\t},\n\n\t\tasync findUser(id) {\n\t\t\tconst stored = byId.get(id);\n\t\t\treturn stored === undefined ? null : copy(stored);\n\t\t},\n\n\t\tasync findUsers(ids) {\n\t\t\treturn [...new Set(ids)].flatMap((id) => {\n\t\t\t\tconst stored = byId.get(id);\n\t\t\t\treturn stored === undefined ? [] : [copy(stored)];\n\t\t\t});\n\t\t},\n\n\t\tasync findUserByLogin(type, login) {\n\t\t\tconst id = byLogin.get(keyOf(type, login));\n\t\t\tconst stored = id === undefined ? undefined : byId.get(id);\n\t\t\treturn stored === undefined ? null : copy(stored);\n\t\t},\n\n\t\tasync listUsers({ type, loginPrefix, namePrefix, after, limit }) {\n\t\t\t// A Map keeps insertion order, not id order: a retried insert or an\n\t\t\t// id minted on another machine can land out of sequence.\n\t\t\tconst ids = [...byId.values()]\n\t\t\t\t.filter(\n\t\t\t\t\t(user) =>\n\t\t\t\t\t\tuser.type === type &&\n\t\t\t\t\t\tholdsPrefix(user, loginPrefix) &&\n\t\t\t\t\t\tnamedPrefix(user, namePrefix),\n\t\t\t\t)\n\t\t\t\t.map((user) => user.id)\n\t\t\t\t.filter((id) => after === null || id > after)\n\t\t\t\t.sort();\n\t\t\tconst pageIds = ids.slice(0, limit);\n\t\t\tconst last = pageIds.at(-1);\n\n\t\t\treturn {\n\t\t\t\titems: pageIds.map((id) => copy(byId.get(id) as UserRecord)),\n\t\t\t\tnextCursor: ids.length > limit && last !== undefined ? last : null,\n\t\t\t};\n\t\t},\n\n\t\tasync countUsers({ type, loginPrefix, namePrefix }) {\n\t\t\tlet count = 0;\n\t\t\tfor (const user of byId.values()) {\n\t\t\t\tif (\n\t\t\t\t\tuser.type === type &&\n\t\t\t\t\tholdsPrefix(user, loginPrefix) &&\n\t\t\t\t\tnamedPrefix(user, namePrefix)\n\t\t\t\t) {\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t},\n\n\t\tasync updateUser(id, patch, ifVersion) {\n\t\t\treturn updateStored(index, id, patch, ifVersion);\n\t\t},\n\n\t\tasync deleteUser(id) {\n\t\t\tconst stored = byId.get(id);\n\t\t\tif (stored === undefined) return false;\n\n\t\t\tbyId.delete(id);\n\t\t\tdropLogins(index, stored);\n\t\t\treturn true;\n\t\t},\n\t};\n}\n\n/** Whether the user holds a login starting with the prefix; every user does when there is none. */\nfunction holdsPrefix(user: UserRecord, prefix: string | undefined): boolean {\n\treturn (\n\t\tprefix === undefined ||\n\t\tuser.logins.some((login) => login.startsWith(prefix))\n\t);\n}\n\n/** Whether the user's name key starts with the prefix; every user does when there is none. */\nfunction namedPrefix(user: UserRecord, prefix: string | undefined): boolean {\n\treturn prefix === undefined || user.nameKey?.startsWith(prefix) === true;\n}\n",
|
|
19
|
+
"import type { JanusStores } from '../types';\nimport { memoryPasskeyStore } from './passkeys';\nimport { memorySessionStore } from './sessions';\nimport { memorySocialLinkStore } from './social-links';\nimport { memoryTokenStore } from './tokens';\nimport { memoryUserStore } from './users';\n\n/**\n * The reference implementation of the store port, in memory — the optional\n * `socialLinks` and `passkeys` slots included.\n *\n * **Shipped and documented, not a test helper.** It is what a consumer uses in\n * their own unit tests, and what an adapter author compares against when a\n * conformance case they do not understand turns red. So it keeps the six rules\n * for real rather than approximately:\n *\n * - uniqueness is a constraint — an index checked and written inside the same\n * synchronous step, which is what atomic means on one event loop;\n * - `consumeToken` reads and writes with no `await` between the two, so twenty\n * concurrent calls see exactly one unspent token;\n * - every record is **copied in and copied out**, so a caller that mutates what\n * it passed or what it got back cannot reach the store — the in-memory\n * version of \"bytes round-trip\";\n * - a patch applies only the fields it names, and only the fields the port\n * declares: a stray `version` or `id` in a patch from JavaScript is ignored,\n * not written.\n *\n * Every method is `async` even though none waits on anything: a caller that\n * forgot an `await` must fail here the way it would against a real database.\n */\nexport function createMemoryStores(): JanusStores {\n\treturn {\n\t\tusers: memoryUserStore(),\n\t\tsessions: memorySessionStore(),\n\t\ttokens: memoryTokenStore(),\n\t\tsocialLinks: memorySocialLinkStore(),\n\t\tpasskeys: memoryPasskeyStore(),\n\t};\n}\n"
|
|
20
|
+
],
|
|
21
|
+
"mappings": ";;;;;;AAyBA,IAAM,MAAyB,MAAM,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,GAAG,MAC9D,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAC/B;AAEA,IAAI,SAAS;AACb,IAAI,WAAW;AAWf,IAAM,eAAe;AAWd,SAAS,OAAM,CAAC,MAAc,KAAK,IAAI,GAAO;AAAA,EACpD,IAAI,KAAK;AAAA,EAET,IAAI,OAAO,QAAQ;AAAA,IAClB,YAAY;AAAA,IACZ,IAAI,WAAW,cAAc;AAAA,MAI5B,KAAK,SAAS;AAAA,MACd,WAAW;AAAA,IACZ;AAAA,EACD,EAAE,KAAK,IAAI,KAAK,QAAQ;AAAA,IACvB,WAAW;AAAA,EACZ,EAAE,KAAK;AAAA,IAIN,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,IAAI,WAAW,cAAc;AAAA,MAC5B,KAAK,SAAS;AAAA,MACd,WAAW;AAA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AmB;AAAA,IAC7B,QAAQ,iBAAiB;AAAA,IACzB,aAAa,sBAAsB;AAAA,IACnC,UAAU,mBAAmB;AAAA,EAC9B;AAAA;",
|
|
22
|
+
"debugId": "FE4DC62DCBE8117364756E2164756E21",
|
|
23
|
+
"names": []
|
|
24
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import {
|
|
2
|
+
invalidCursor2,
|
|
3
|
+
isSubjectSet2,
|
|
4
|
+
formatTuple2
|
|
5
|
+
} from "./index-2ttdcz7n.js";
|
|
6
|
+
|
|
7
|
+
// src/permissions/port/holders.ts
|
|
8
|
+
var holderCursor2 = (holder) => `${holder.type.length}:${holder.type}${holder.id}`;
|
|
9
|
+
function readHolderCursor2(where, cursor) {
|
|
10
|
+
const head = /^(0|[1-9]\d{0,8}):/.exec(cursor);
|
|
11
|
+
const length = head === null ? -1 : Number(head[1]);
|
|
12
|
+
const start = head === null ? 0 : head[0].length;
|
|
13
|
+
if (length < 0 || start + length > cursor.length) {
|
|
14
|
+
throw invalidCursor2(where, cursor);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
type: cursor.slice(start, start + length),
|
|
18
|
+
id: cursor.slice(start + length)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var idMatches2 = (id, search) => id.toLowerCase().includes(search.toLowerCase());
|
|
22
|
+
var compare = (a, b) => {
|
|
23
|
+
if (a.type !== b.type)
|
|
24
|
+
return a.type < b.type ? -1 : 1;
|
|
25
|
+
if (a.id !== b.id)
|
|
26
|
+
return a.id < b.id ? -1 : 1;
|
|
27
|
+
return 0;
|
|
28
|
+
};
|
|
29
|
+
function pageOfHolders2(holders, {
|
|
30
|
+
after,
|
|
31
|
+
limit,
|
|
32
|
+
search
|
|
33
|
+
}, where = "findHolders") {
|
|
34
|
+
const from = after === null ? null : readHolderCursor2(where, after);
|
|
35
|
+
const rest = holders.filter((holder) => (from === null || compare(holder, from) > 0) && (search === null || idMatches2(holder.id, search))).sort(compare);
|
|
36
|
+
const items = rest.slice(0, limit).map((holder) => ({ type: holder.type, id: holder.id }));
|
|
37
|
+
const last = items.at(-1);
|
|
38
|
+
return {
|
|
39
|
+
items,
|
|
40
|
+
nextCursor: rest.length > limit && last !== undefined ? holderCursor2(last) : null
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/permissions/port/memory.ts
|
|
45
|
+
function createMemoryRelations2() {
|
|
46
|
+
const tuples = new Map;
|
|
47
|
+
return {
|
|
48
|
+
async write({ add = [], remove = [] }) {
|
|
49
|
+
for (const tuple of remove)
|
|
50
|
+
tuples.delete(formatTuple2(tuple));
|
|
51
|
+
for (const tuple of add)
|
|
52
|
+
tuples.set(formatTuple2(tuple), copyTuple(tuple));
|
|
53
|
+
},
|
|
54
|
+
async has(tuple) {
|
|
55
|
+
return tuples.has(formatTuple2(tuple));
|
|
56
|
+
},
|
|
57
|
+
async findSubjectSets(object, relation) {
|
|
58
|
+
const sets = [];
|
|
59
|
+
for (const tuple of tuples.values()) {
|
|
60
|
+
if (on(tuple, object, relation) && isSubjectSet2(tuple.subject)) {
|
|
61
|
+
sets.push(copySubject(tuple.subject));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return sets;
|
|
65
|
+
},
|
|
66
|
+
async findEntities(object, relation) {
|
|
67
|
+
const entities = [];
|
|
68
|
+
for (const tuple of tuples.values()) {
|
|
69
|
+
if (on(tuple, object, relation) && !isSubjectSet2(tuple.subject)) {
|
|
70
|
+
entities.push(copySubject(tuple.subject));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return entities;
|
|
74
|
+
},
|
|
75
|
+
async findHolders({ object, relation, after, limit, search }) {
|
|
76
|
+
const entities = [];
|
|
77
|
+
for (const tuple of tuples.values()) {
|
|
78
|
+
if (on(tuple, object, relation) && !isSubjectSet2(tuple.subject)) {
|
|
79
|
+
entities.push(tuple.subject);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return pageOfHolders2(entities, { after, limit, search });
|
|
83
|
+
},
|
|
84
|
+
async findObjects(request) {
|
|
85
|
+
return findObjects(tuples.values(), request);
|
|
86
|
+
},
|
|
87
|
+
async deleteEntity(entity) {
|
|
88
|
+
let deleted = 0;
|
|
89
|
+
for (const [key, tuple] of tuples) {
|
|
90
|
+
if (sameEntity(tuple.object, entity) || sameEntity(tuple.subject, entity)) {
|
|
91
|
+
tuples.delete(key);
|
|
92
|
+
deleted += 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return deleted;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
var sameEntity = (a, b) => a.type === b.type && a.id === b.id;
|
|
100
|
+
var sameSubject = (a, b) => sameEntity(a, b) && (isSubjectSet2(a) ? isSubjectSet2(b) && a.relation === b.relation : !isSubjectSet2(b));
|
|
101
|
+
var on = (tuple, object, relation) => tuple.relation === relation && sameEntity(tuple.object, object);
|
|
102
|
+
function findObjects(tuples, { type, relation, subject, after, limit }) {
|
|
103
|
+
const ids = [
|
|
104
|
+
...new Set([...tuples].filter((tuple) => tuple.object.type === type && tuple.relation === relation && sameSubject(tuple.subject, subject) && (after === null || tuple.object.id > after)).map((tuple) => tuple.object.id))
|
|
105
|
+
].sort();
|
|
106
|
+
const items = ids.slice(0, limit);
|
|
107
|
+
const last = items.at(-1);
|
|
108
|
+
return {
|
|
109
|
+
items,
|
|
110
|
+
nextCursor: ids.length > limit && last !== undefined ? last : null
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function copySubject(subject) {
|
|
114
|
+
return isSubjectSet2(subject) ? { type: subject.type, id: subject.id, relation: subject.relation } : { type: subject.type, id: subject.id };
|
|
115
|
+
}
|
|
116
|
+
function copyTuple(tuple) {
|
|
117
|
+
return {
|
|
118
|
+
object: { type: tuple.object.type, id: tuple.object.id },
|
|
119
|
+
relation: tuple.relation,
|
|
120
|
+
subject: copySubject(tuple.subject)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { holderCursor2, readHolderCursor2, idMatches2, pageOfHolders2, createMemoryRelations2 };
|
|
125
|
+
|
|
126
|
+
//# debugId=5183DFA9AFC1F83564756E2164756E21
|
|
127
|
+
//# sourceMappingURL=index-ftz0ne6j.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/permissions/port/holders.ts", "../src/permissions/port/memory.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * What an adapter needs to page the holders of a relation: the request, the\n * cursor and the search, written once so every store orders and cuts the same\n * way. The reference store and the core's fallback use `pageOfHolders`.\n */\n\nimport type { CursorPage } from '../../pagination/cursor-page';\nimport { invalidCursor } from '../../pagination/cursor-page';\nimport type { Entity } from '../../subjects/subject';\n\n/** Which holders a page lists: the single entities holding `relation` on `object`. */\nexport interface HolderPageRequest {\n\treadonly object: Entity;\n\treadonly relation: string;\n\t/**\n\t * The `nextCursor` of the previous page, or `null` for the first. Minted by\n\t * {@link holderCursor}; read by {@link readHolderCursor}, which refuses any\n\t * other string.\n\t */\n\treadonly after: string | null;\n\t/** Already bounded by the core, between 1 and `MAX_PAGE_SIZE`. */\n\treadonly limit: number;\n\t/**\n\t * A text the holder's id contains, ignoring case, or `null` for no filter.\n\t * Never empty, and a literal: `%`, `_` and `.` match themselves.\n\t */\n\treadonly search: string | null;\n}\n\n/**\n * The cursor that follows `holder`: opaque, ordered by type then id. The\n * type's length comes first, so any id round-trips and nothing is parsed\n * with a `catch` (the scan holds this directory to none).\n */\nexport const holderCursor = (holder: Entity): string =>\n\t`${holder.type.length}:${holder.type}${holder.id}`;\n\n/** The holder a cursor follows; throws `InvalidCursorError` for any other string. */\nexport function readHolderCursor(where: string, cursor: string): Entity {\n\tconst head = /^(0|[1-9]\\d{0,8}):/.exec(cursor);\n\tconst length = head === null ? -1 : Number(head[1]);\n\tconst start = head === null ? 0 : head[0].length;\n\tif (length < 0 || start + length > cursor.length) {\n\t\tthrow invalidCursor(where, cursor);\n\t}\n\treturn {\n\t\ttype: cursor.slice(start, start + length),\n\t\tid: cursor.slice(start + length),\n\t};\n}\n\n/** Whether `id` contains `search`, ignoring case. */\nexport const idMatches = (id: string, search: string): boolean =>\n\tid.toLowerCase().includes(search.toLowerCase());\n\nconst compare = (a: Entity, b: Entity): number => {\n\tif (a.type !== b.type) return a.type < b.type ? -1 : 1;\n\tif (a.id !== b.id) return a.id < b.id ? -1 : 1;\n\treturn 0;\n};\n\n/** `holders` ordered by type then id, cut after the cursor and by the search, one page. */\nexport function pageOfHolders(\n\tholders: readonly Entity[],\n\t{\n\t\tafter,\n\t\tlimit,\n\t\tsearch,\n\t}: Pick<HolderPageRequest, 'after' | 'limit' | 'search'>,\n\twhere = 'findHolders',\n): CursorPage<Entity> {\n\tconst from = after === null ? null : readHolderCursor(where, after);\n\tconst rest = holders\n\t\t.filter(\n\t\t\t(holder) =>\n\t\t\t\t(from === null || compare(holder, from) > 0) &&\n\t\t\t\t(search === null || idMatches(holder.id, search)),\n\t\t)\n\t\t.sort(compare);\n\tconst items = rest\n\t\t.slice(0, limit)\n\t\t.map((holder): Entity => ({ type: holder.type, id: holder.id }));\n\tconst last = items.at(-1);\n\treturn {\n\t\titems,\n\t\tnextCursor:\n\t\t\trest.length > limit && last !== undefined ? holderCursor(last) : null,\n\t};\n}\n",
|
|
6
|
+
"import type { CursorPage } from '../../pagination/cursor-page';\nimport { formatTuple } from '../../subjects/notation';\nimport {\n\ttype Entity,\n\tisSubjectSet,\n\ttype RelationTuple,\n\ttype Subject,\n\ttype SubjectSet,\n} from '../../subjects/subject';\nimport { pageOfHolders } from './holders';\nimport type { ObjectPageRequest, RelationStore } from './types';\n\n/**\n * The reference implementation of the relation store, in memory.\n *\n * **Shipped and documented, not a test helper**, like `createMemoryStores()`:\n * what a consumer uses in their own tests, and what an adapter author compares\n * against. It favours being obviously right over being fast — every query\n * scans — and keeps the rules for real:\n *\n * - a tuple is unique because its key is its notation, and one `Map` holds it;\n * - `write` checks nothing it could fail on half-way, so it is all or nothing\n * on one event loop;\n * - every tuple is copied in and out, so a caller cannot reach the store by\n * mutating what it passed or got back.\n */\nexport function createMemoryRelations(): RelationStore {\n\tconst tuples = new Map<string, RelationTuple>();\n\n\treturn {\n\t\tasync write({ add = [], remove = [] }) {\n\t\t\tfor (const tuple of remove) tuples.delete(formatTuple(tuple));\n\t\t\tfor (const tuple of add) tuples.set(formatTuple(tuple), copyTuple(tuple));\n\t\t},\n\n\t\tasync has(tuple) {\n\t\t\treturn tuples.has(formatTuple(tuple));\n\t\t},\n\n\t\tasync findSubjectSets(object, relation) {\n\t\t\tconst sets: SubjectSet[] = [];\n\t\t\tfor (const tuple of tuples.values()) {\n\t\t\t\tif (on(tuple, object, relation) && isSubjectSet(tuple.subject)) {\n\t\t\t\t\tsets.push(copySubject(tuple.subject) as SubjectSet);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn sets;\n\t\t},\n\n\t\tasync findEntities(object, relation) {\n\t\t\tconst entities: Entity[] = [];\n\t\t\tfor (const tuple of tuples.values()) {\n\t\t\t\tif (on(tuple, object, relation) && !isSubjectSet(tuple.subject)) {\n\t\t\t\t\tentities.push(copySubject(tuple.subject));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn entities;\n\t\t},\n\n\t\tasync findHolders({ object, relation, after, limit, search }) {\n\t\t\tconst entities: Entity[] = [];\n\t\t\tfor (const tuple of tuples.values()) {\n\t\t\t\tif (on(tuple, object, relation) && !isSubjectSet(tuple.subject)) {\n\t\t\t\t\tentities.push(tuple.subject);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn pageOfHolders(entities, { after, limit, search });\n\t\t},\n\n\t\tasync findObjects(request) {\n\t\t\treturn findObjects(tuples.values(), request);\n\t\t},\n\n\t\tasync deleteEntity(entity) {\n\t\t\tlet deleted = 0;\n\t\t\tfor (const [key, tuple] of tuples) {\n\t\t\t\tif (\n\t\t\t\t\tsameEntity(tuple.object, entity) ||\n\t\t\t\t\tsameEntity(tuple.subject, entity)\n\t\t\t\t) {\n\t\t\t\t\ttuples.delete(key);\n\t\t\t\t\tdeleted += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn deleted;\n\t\t},\n\t};\n}\n\nconst sameEntity = (a: Entity, b: Entity) => a.type === b.type && a.id === b.id;\n\nconst sameSubject = (a: Subject, b: Subject) =>\n\tsameEntity(a, b) &&\n\t(isSubjectSet(a)\n\t\t? isSubjectSet(b) && a.relation === b.relation\n\t\t: !isSubjectSet(b));\n\nconst on = (tuple: RelationTuple, object: Entity, relation: string) =>\n\ttuple.relation === relation && sameEntity(tuple.object, object);\n\n/** One page of the ids of the objects `subject` is related to, ascending. */\nfunction findObjects(\n\ttuples: Iterable<RelationTuple>,\n\t{ type, relation, subject, after, limit }: ObjectPageRequest,\n): CursorPage<string> {\n\tconst ids = [\n\t\t...new Set(\n\t\t\t[...tuples]\n\t\t\t\t.filter(\n\t\t\t\t\t(tuple) =>\n\t\t\t\t\t\ttuple.object.type === type &&\n\t\t\t\t\t\ttuple.relation === relation &&\n\t\t\t\t\t\tsameSubject(tuple.subject, subject) &&\n\t\t\t\t\t\t(after === null || tuple.object.id > after),\n\t\t\t\t)\n\t\t\t\t.map((tuple) => tuple.object.id),\n\t\t),\n\t].sort();\n\tconst items = ids.slice(0, limit);\n\tconst last = items.at(-1);\n\n\treturn {\n\t\titems,\n\t\tnextCursor: ids.length > limit && last !== undefined ? last : null,\n\t};\n}\n\n/** Field by field, so nothing but the declared shape reaches the store. */\nfunction copySubject(subject: Subject): Subject {\n\treturn isSubjectSet(subject)\n\t\t? { type: subject.type, id: subject.id, relation: subject.relation }\n\t\t: { type: subject.type, id: subject.id };\n}\n\nfunction copyTuple(tuple: RelationTuple): RelationTuple {\n\treturn {\n\t\tobject: { type: tuple.object.type, id: tuple.object.id },\n\t\trelation: tuple.relation,\n\t\tsubject: copySubject(tuple.subject),\n\t};\n}\n"
|
|
7
|
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A,EACD,EAAE,KAAK;AAAA,EACP,MAAM,QAAQ,IAAI,MAAM,GAAG,KAAK;AAAA,EAChC,MAAM,OAAO,MAAM,GAAG,EAAE;AAAA,EAExB,OAAO;AAAA,IACN;AAAA,IACA,YAAY,IAAI,SAAS,SAAS,SAAS,YAAY,OAAO;AAAA,EAC/D;AAAA;AAID,SAAS,WAAW,CAAC,SAA2B;AAAA,EAC/C,OAAO,cAAa,OAAO,IACxB,EAAE,MAAM,QAAQ,MAAM,IAAI,QAAQ,IAAI,UAAU,QAAQ,SAAS,IACjE,EAAE,MAAM,QAAQ,MAAM,IAAI,QAAQ,GAAG;AAAA;AAGzC,SAAS,SAAS,CAAC,OAAqC;AAAA,EACvD,OAAO;AAAA,IACN,QAAQ,EAAE,MAAM,MAAM,OAAO,MAAM,IAAI,MAAM,OAAO,GAAG;AAAA,IACvD,UAAU,MAAM;AAAA,IAChB,SAAS,YAAY,MAAM,OAAO;AAAA,EACnC;AAAA;",
|
|
9
|
+
"debugId": "5183DFA9AFC1F83564756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
JanusError2,
|
|
3
|
+
StoreFailure2
|
|
4
|
+
} from "./index-2ttdcz7n.js";
|
|
5
|
+
|
|
6
|
+
// src/stores/guard.ts
|
|
7
|
+
var ANSWERS_NOTHING = new Set([
|
|
8
|
+
"insertSession",
|
|
9
|
+
"insertToken",
|
|
10
|
+
"insertApiKey",
|
|
11
|
+
"write"
|
|
12
|
+
]);
|
|
13
|
+
function guardStore(slot, store) {
|
|
14
|
+
const guarded = {};
|
|
15
|
+
for (const method of methodsOf(store)) {
|
|
16
|
+
const original = store[method];
|
|
17
|
+
if (typeof original !== "function")
|
|
18
|
+
continue;
|
|
19
|
+
guarded[method] = async (...args) => {
|
|
20
|
+
let answer;
|
|
21
|
+
try {
|
|
22
|
+
answer = await original.apply(store, args);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
throw asFailure(error, slot, method);
|
|
25
|
+
}
|
|
26
|
+
if (answer === undefined && !ANSWERS_NOTHING.has(method)) {
|
|
27
|
+
throw new StoreFailure2(`${slot}.${method} answered undefined: an absence is null, so this store forgot to answer`, { slot, operation: method });
|
|
28
|
+
}
|
|
29
|
+
return answer;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return guarded;
|
|
33
|
+
}
|
|
34
|
+
function methodsOf(store) {
|
|
35
|
+
const names = new Set;
|
|
36
|
+
for (let proto = store;proto !== null && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {
|
|
37
|
+
for (const name of Object.getOwnPropertyNames(proto)) {
|
|
38
|
+
if (name !== "constructor")
|
|
39
|
+
names.add(name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return [...names];
|
|
43
|
+
}
|
|
44
|
+
function asFailure(error, slot, method) {
|
|
45
|
+
if (error instanceof JanusError2)
|
|
46
|
+
return error;
|
|
47
|
+
return new StoreFailure2(`${slot}.${method}: the store could not answer`, {
|
|
48
|
+
slot,
|
|
49
|
+
operation: method,
|
|
50
|
+
cause: error
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function guardRelations(store) {
|
|
54
|
+
return guardStore("relations", store);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/stores/storable.ts
|
|
58
|
+
var isStorable = (value) => !value.includes("\x00") && value.isWellFormed();
|
|
59
|
+
var UNSTORABLE = "holds a NUL character or a lone surrogate, which no store can keep";
|
|
60
|
+
|
|
61
|
+
export { guardStore, guardRelations, isStorable, UNSTORABLE };
|
|
62
|
+
|
|
63
|
+
//# debugId=5905640CBBCF2F6264756E2164756E21
|
|
64
|
+
//# sourceMappingURL=index-n8jxmxeg.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/stores/guard.ts", "../src/stores/storable.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * **The one place a store's answer is caught**, shared by both sides of the\n * package: the identity stores and the relation store reach a caller only\n * through {@link guardStore}.\n *\n * - A `JanusError` the store threw passes through, so `instanceof` holds.\n * - **Anything else it threw is a failure** — `StoreFailure`, naming the slot\n * and the method, with the original as `cause`. Never an absence.\n * - `undefined` where the port says `null` is a store that forgot to answer,\n * and becomes `StoreFailure` rather than \"not found\".\n *\n * The `catch` below always rethrows; `src/auth/outage.scan.spec.ts` holds it to that.\n */\n\nimport {\n\ttype JanusError,\n\tJanusError as JanusErrorClass,\n\tStoreFailure,\n} from '../errors/janus-error';\nimport type { RelationStore } from '../permissions/port/types';\n\n/** A store the guard names in a `StoreFailure`: `users`, `sessions`, `tokens` or `relations`. */\nexport type StoreSlot = NonNullable<StoreFailure['slot']>;\n\n/**\n * The methods whose answer is legitimately nothing: `undefined` from them is\n * not a forgotten `return`. Every other method answers a value, `null`,\n * `false`, `0` or a page — **never `undefined`**.\n */\nconst ANSWERS_NOTHING = new Set([\n\t'insertSession',\n\t'insertToken',\n\t'insertApiKey',\n\t'write',\n]);\n\nexport function guardStore<S extends object>(slot: StoreSlot, store: S): S {\n\tconst guarded: Record<string, unknown> = {};\n\n\tfor (const method of methodsOf(store)) {\n\t\tconst original = (store as Record<string, unknown>)[method];\n\t\tif (typeof original !== 'function') continue;\n\n\t\tguarded[method] = async (...args: unknown[]) => {\n\t\t\tlet answer: unknown;\n\n\t\t\ttry {\n\t\t\t\tanswer = await original.apply(store, args);\n\t\t\t} catch (error) {\n\t\t\t\t// Rethrown, always. The only question is under which class.\n\t\t\t\tthrow asFailure(error, slot, method);\n\t\t\t}\n\n\t\t\tif (answer === undefined && !ANSWERS_NOTHING.has(method)) {\n\t\t\t\tthrow new StoreFailure(\n\t\t\t\t\t`${slot}.${method} answered undefined: an absence is null, so this store forgot to answer`,\n\t\t\t\t\t{ slot, operation: method },\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn answer;\n\t\t};\n\t}\n\n\treturn guarded as S;\n}\n\n/** Own and prototype methods, so a class-based store is guarded like a literal. */\nfunction methodsOf(store: object): string[] {\n\tconst names = new Set<string>();\n\n\tfor (\n\t\tlet proto: object | null = store;\n\t\tproto !== null && proto !== Object.prototype;\n\t\tproto = Object.getPrototypeOf(proto)\n\t) {\n\t\tfor (const name of Object.getOwnPropertyNames(proto)) {\n\t\t\tif (name !== 'constructor') names.add(name);\n\t\t}\n\t}\n\n\treturn [...names];\n}\n\nfunction asFailure(\n\terror: unknown,\n\tslot: StoreSlot,\n\tmethod: string,\n): JanusError {\n\tif (error instanceof JanusErrorClass) return error;\n\n\t// The message names where, never what: a driver's message may hold a\n\t// connection string, and a connection string holds a password. It is kept\n\t// as `cause`, for the operator's logs.\n\treturn new StoreFailure(`${slot}.${method}: the store could not answer`, {\n\t\tslot,\n\t\toperation: method,\n\t\tcause: error,\n\t});\n}\n\n/**\n * The relation store, guarded the same way: the permission engine's only way\n * to a store, so a failure there is `STORE_FAILED` and never a denial.\n */\nexport function guardRelations(store: RelationStore): RelationStore {\n\treturn guardStore('relations', store);\n}\n",
|
|
6
|
+
"/**\n * What every store can keep. PostgreSQL refuses `\\u0000` in `text` and\n * `jsonb`, and a lone surrogate in `jsonb`; MongoDB and the memory store keep\n * both. The core refuses them before a store is asked, so a request that sends\n * one is answered the same way on every adapter — not `STORE_FAILED` on one of\n * them, a 503 for a database that is up.\n *\n * Shared by both sides of the package, like `guard.ts`: a string from a\n * request reaches the identity stores and the relation store alike.\n */\n\n/** Whether every store can keep this string. */\nexport const isStorable = (value: string): boolean =>\n\t!value.includes('\\u0000') && value.isWellFormed();\n\n/** What an issue says about a string no store can keep. */\nexport const UNSTORABLE =\n\t'holds a NUL character or a lone surrogate, which no store can keep';\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;;;;;AA6BA,IAAM,kBAAkB,IAAI,IAAI;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAEM,SAAS,UAA4B,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M,SAAS,MAAQ,KAAK,MAAM,aAAa;AAG1C,IAAM,aACZ;",
|
|
9
|
+
"debugId": "5905640CBBCF2F6264756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bound.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/bound.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAe3C,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EA0IjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expiry.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/expiry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAgB3C,eAAO,MAAM,iBAAiB,EAAE,SAAS,UAAU,EA+HlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAQ3C,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAOjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/insert.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,eAAO,MAAM,iBAAiB,EAAE,SAAS,UAAU,EA6JlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outage.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/outage.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,UAAU,CAAC;AA4EzD,eAAO,MAAM,iBAAiB,EAAE,SAAS,UAAU,EAkFlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revoke.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/revoke.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,eAAO,MAAM,iBAAiB,EAAE,SAAS,UAAU,EAwIlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touch.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/touch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAoGjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-bound.d.ts","sourceRoot":"","sources":["../../../../src/conformance/api-keys/cases/user-bound.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAY3C,eAAO,MAAM,oBAAoB,EAAE,SAAS,UAAU,EA4JrD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ConformanceRunner } from '../types';
|
|
2
|
+
import type { ApiKeyCase, ApiKeyHarness } from './types';
|
|
3
|
+
/** Every case, in the order they are described. */
|
|
4
|
+
export declare const allApiKeyCases: readonly ApiKeyCase[];
|
|
5
|
+
/** Runs one case against a freshly opened store, and closes it, pass or fail. */
|
|
6
|
+
export declare function runApiKeyCase(apiKeyCase: ApiKeyCase, harness: ApiKeyHarness): Promise<{
|
|
7
|
+
readonly skipped: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly passed: true;
|
|
10
|
+
}>;
|
|
11
|
+
/** Describes the whole API key suite under the adapter's test runner. */
|
|
12
|
+
export declare function describeApiKeyStores(options: {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly harness: ApiKeyHarness;
|
|
15
|
+
readonly runner?: ConformanceRunner;
|
|
16
|
+
/** Case ids to skip, each with the reason — reported, never silent. */
|
|
17
|
+
readonly skip?: Readonly<Record<string, string>>;
|
|
18
|
+
readonly faults?: boolean;
|
|
19
|
+
}): void;
|
|
20
|
+
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../../src/conformance/api-keys/describe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGlD,OAAO,KAAK,EACX,UAAU,EACV,aAAa,EAGb,MAAM,SAAS,CAAC;AAEjB,mDAAmD;AACnD,eAAO,MAAM,cAAc,EAAE,SAAS,UAAU,EAG/C,CAAC;AAEF,iFAAiF;AACjF,wBAAsB,aAAa,CAClC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,aAAa,GACpB,OAAO,CAAC;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,CAAC,CAcnE;AAkCD,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,IAAI,CASP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/conformance/api-keys/fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,qDAAqD;AACrD,wBAAgB,MAAM,CAAC,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,YAAY,CAY1E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conformance suite of the API key store port — what an adapter author
|
|
3
|
+
* runs against `ApiKeyStore`, as `describeRelationStores` is run against the
|
|
4
|
+
* relation port.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { describe, it } from 'bun:test';
|
|
8
|
+
* import { describeApiKeyStores } from '@softistx/janus/conformance';
|
|
9
|
+
*
|
|
10
|
+
* describeApiKeyStores({ name: 'my adapter', harness, runner: { describe, it } });
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export { apiKeyStoreCases } from './cases';
|
|
14
|
+
export { apiKeyOutageCases } from './cases/outage';
|
|
15
|
+
export { allApiKeyCases, describeApiKeyStores, runApiKeyCase, } from './describe';
|
|
16
|
+
export { referenceApiKeyHarness } from './reference';
|
|
17
|
+
export type { ApiKeyCase, ApiKeyContext, ApiKeyFaults, ApiKeyHarness, ApiKeyMethod, ApiKeyNeed, OpenedApiKeys, } from './types';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/conformance/api-keys/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACN,cAAc,EACd,oBAAoB,EACpB,aAAa,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,aAAa,GACb,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/conformance/api-keys/reference.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,8EAA8E;AAC9E,wBAAgB,sBAAsB,IAAI,aAAa,CA8BtD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ApiKeyStore } from '../../auth/port/types';
|
|
2
|
+
/** A method of the API key store. */
|
|
3
|
+
export type ApiKeyMethod = keyof ApiKeyStore & string;
|
|
4
|
+
/** How the suite makes one API key store method fail, for the outage cases. */
|
|
5
|
+
export interface ApiKeyFaults {
|
|
6
|
+
/**
|
|
7
|
+
* Fails `method`, and only it: the other methods keep answering, because
|
|
8
|
+
* the outage cases read the store back to prove a rejected write changed
|
|
9
|
+
* nothing.
|
|
10
|
+
*/
|
|
11
|
+
fail(method: ApiKeyMethod): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export interface OpenedApiKeys {
|
|
14
|
+
/** Empty: every case writes what it reads. */
|
|
15
|
+
readonly store: ApiKeyStore;
|
|
16
|
+
readonly faults?: ApiKeyFaults;
|
|
17
|
+
close?(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export interface ApiKeyHarness {
|
|
20
|
+
/** Called once per case, so no case sees another's keys. */
|
|
21
|
+
open(): Promise<OpenedApiKeys>;
|
|
22
|
+
}
|
|
23
|
+
export interface ApiKeyContext {
|
|
24
|
+
readonly store: ApiKeyStore;
|
|
25
|
+
readonly faults: ApiKeyFaults | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What a case needs beyond the required methods: the harness's `faults`, or
|
|
29
|
+
* one of the store's optional capabilities — `bound` (`listBoundApiKeys` and
|
|
30
|
+
* `revokeBoundApiKeys`) or `expiryNotice` (`listExpiringApiKeys` and
|
|
31
|
+
* `markApiKeyExpiryNotified`). A store without it skips the case, with the
|
|
32
|
+
* reason.
|
|
33
|
+
*/
|
|
34
|
+
export type ApiKeyNeed = 'faults' | 'bound' | 'userBound' | 'expiryNotice';
|
|
35
|
+
export interface ApiKeyCase {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly group: 'apiKeys' | 'outage';
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly needs?: ApiKeyNeed | readonly ApiKeyNeed[];
|
|
40
|
+
run(context: ApiKeyContext): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/conformance/api-keys/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qCAAqC;AACrC,MAAM,MAAM,YAAY,GAAG,MAAM,WAAW,GAAG,MAAM,CAAC;AAEtD,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC5B;;;;OAIG;IACH,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,aAAa;IAC7B,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC7B,4DAA4D;IAC5D,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,IAA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