ais-common-lib
A library of common utilities and components for Nuxt 3 applications
2,105
| Install | |
|---|---|
npm install ais-common-lib |
|
| Latest Version: | 1.0.38 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 23, 2026 |
| Links: | npm |
Maintainer: rudolfxjacobs
ais-common-lib
A Nuxt 3 module providing API fetch composables for API interaction.
Features
- Manage API requests with built-in authentication
- Create/Update/Delete operations simplified
Composables
- authFetch: Authenticated API requests
- basicFetch: Simple non-authenticated API requests
- authMiddleware:
handleAuthFlow,checkAccount,checkBasicAuth,checkSuperAuth, andcheckEmailVerificationhelpers - useUser: Reactive auth state including
emailVerifiedandpendingEmailcomputed values
Session clearing semantics
Auth state (localStorage tokens + runtimeConfig.public.*) is only cleared by removeHeaders(), which runs on:
- an explicit
logout()call (after itsconfirm()passes, or immediately whenconfirmLogout=false) - a
401/403fromcheckAccount(network errors and 5xx keep the session so transient backend failures don't log users out) - a
401that survives the axios interceptor's refresh-and-retry flow (catchError), or a failed token refresh in the interceptor itself
Error-log payload redaction
catchError posts diagnostics to errorLogUrl — everything goes through
logRedaction.ts first so passwords, tokens, and personal data never leave
the browser:
- key denylist — any object/FormData/header key containing
token|password|secret|authorization|credential|signature, or matching a sensitive segment (otp,cvv,code,pin,key,session,csrf,address,postal,dob,passport, …) collapses to"[REDACTED]". Segment matching meansshipping/laptopdon't trippin/otp. - string masks — JWTs (
eyJ…),sor_shopper tokens,Bearer/Basiccreds,?token=/&key=query params, emails (***@domain), SA phone numbers, and 13–19-digit runs (SA IDs, card PANs) are masked inside every remaining string. apiis masked and capped at 255 chars (serverCharField); oversizeddata/error/headersserialize to a{truncated, preview}marker;FormDatafiles become"[file]"; depth caps at 8.
Quick Setup
- Add
ais-common-libdependency to your project
# Using npm
npm install ais-common-lib
# Using yarn
yarn add ais-common-lib
# Using pnpm
pnpm add ais-common-lib
- Add
ais-common-libto themodulessection ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'ais-common-lib'
],
aisCommonLib: {
// module options
apiBase: 'https://api.example.com'
profileUrl: 'https://api.example.com/profile',
errorLogUrl: 'https://api.example.com/errorlog'
}
})
Usage
AuthFetch Composable
<script setup>
const response = get("api/endpoint");
</script>
BasicFetch Composable
<script setup>
const response = basicGet("api/endpoint");
</script>
Development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the package
npm run build
License
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.38 | ^3.0.0 | MIT | |
| 1.0.37 | ^3.0.0 | MIT | |
| 1.0.36 | ^3.0.0 | MIT | |
| 1.0.35 | ^3.0.0 | MIT | |
| 1.0.34 | ^3.0.0 | MIT | |
| 1.0.33 | ^3.0.0 | MIT | |
| 1.0.32 | ^3.0.0 | MIT | |
| 1.0.31 | ^3.0.0 | MIT | |
| 1.0.30 | ^3.0.0 | MIT | |
| 1.0.29 | ^3.0.0 | MIT | |
| 1.0.28 | ^3.0.0 | MIT | |
| 1.0.27 | ^3.0.0 | MIT | |
| 1.0.24 | ^3.0.0 | MIT | |
| 1.0.23 | ^3.0.0 | MIT | |
| 1.0.22 | ^3.0.0 | MIT | |
| 1.0.21 | ^3.0.0 | MIT | |
| 1.0.20 | ^3.0.0 | MIT | |
| 1.0.19 | ^3.0.0 | MIT | |
| 1.0.18 | ^3.0.0 | MIT | |
| 1.0.17 | ^3.0.0 | MIT | |
| 1.0.16 | ^3.5.17 | MIT | |
| 1.0.15 | ^3.0.0 | MIT | |
| 1.0.14 | ^3.0.0 | MIT | |
| 1.0.13 | ^3.0.0 | MIT | |
| 1.0.12 | ^3.0.0 | MIT | |
| 1.0.11 | ^3.0.0 | MIT | |
| 1.0.10 | ^3.0.0 | MIT | |
| 1.0.9 | ^3.0.0 | MIT | |
| 1.0.8 | ^3.0.0 | MIT | |
| 1.0.7 | ^3.0.0 | MIT |
Showing the latest 30 of 35. See every release on npm