@exyconn/common 1.0.0 → 2.0.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/README.md +121 -36
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +2330 -176
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +2284 -178
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/utils/index.d.mts +123 -1
- package/dist/client/utils/index.d.ts +123 -1
- package/dist/client/utils/index.js +207 -0
- package/dist/client/utils/index.js.map +1 -1
- package/dist/client/utils/index.mjs +204 -1
- package/dist/client/utils/index.mjs.map +1 -1
- package/dist/index-BLltj-zN.d.ts +1236 -0
- package/dist/index-CIUdLBjA.d.mts +1236 -0
- package/dist/{index-iTKxFa78.d.ts → index-DEzgM15j.d.ts} +10 -2
- package/dist/{index-ClWtDfwk.d.ts → index-DNFVgQx8.d.ts} +544 -2
- package/dist/{index-CcrANHAQ.d.mts → index-DbV04Dx8.d.mts} +10 -2
- package/dist/{index-DSW6JfD-.d.mts → index-DfqEP6Oe.d.mts} +544 -2
- package/dist/index.d.mts +582 -7
- package/dist/index.d.ts +582 -7
- package/dist/index.js +3428 -221
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3430 -223
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +197 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +194 -2
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/utils/index.d.mts +73 -1
- package/dist/server/utils/index.d.ts +73 -1
- package/dist/server/utils/index.js +199 -0
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs +195 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/dist/shared/index.d.mts +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +296 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +274 -1
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +9 -2
- package/dist/index-BNdT-2X4.d.ts +0 -229
- package/dist/index-Du0LLt9f.d.mts +0 -229
package/README.md
CHANGED
|
@@ -14,12 +14,14 @@ pnpm add @exyconn/common
|
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
17
|
+
- 🖥️ **Server utilities** - Response helpers, middleware, logging, database connections
|
|
18
|
+
- 🌐 **Client utilities** - HTTP clients, React hooks, response parsing
|
|
19
|
+
- 📝 **Shared types** - TypeScript interfaces for API responses, users, etc.
|
|
20
|
+
- 🗃️ **Data modules** - Countries, currencies, phone codes, timezones, brand logos
|
|
21
21
|
- ✅ **Validation** - Common patterns, regex, and validation helpers
|
|
22
|
-
-
|
|
22
|
+
- 📅 **Date utilities** - Enhanced date-fns with timezone support
|
|
23
|
+
- 🎨 **Brand Identity** - Complete brand configs with logos, colors, and SEO
|
|
24
|
+
- 🔢 **Enums & Constants** - STATUS, SORT, ROLE, BREAKPOINTS, and more
|
|
23
25
|
|
|
24
26
|
## Usage
|
|
25
27
|
|
|
@@ -128,13 +130,16 @@ import {
|
|
|
128
130
|
### Data Modules
|
|
129
131
|
|
|
130
132
|
```typescript
|
|
131
|
-
// Countries with nested states/cities
|
|
133
|
+
// Countries with nested states/cities + flags
|
|
132
134
|
import {
|
|
133
135
|
countries,
|
|
134
136
|
getCountryByCode,
|
|
135
137
|
getStatesByCountry,
|
|
136
138
|
getCitiesByState,
|
|
137
|
-
searchCountries
|
|
139
|
+
searchCountries,
|
|
140
|
+
getFlag,
|
|
141
|
+
getAllCountriesWithFlags,
|
|
142
|
+
codeToFlag
|
|
138
143
|
} from '@exyconn/common/data/countries';
|
|
139
144
|
|
|
140
145
|
// Currencies
|
|
@@ -156,12 +161,56 @@ import {
|
|
|
156
161
|
getCommonTimezones
|
|
157
162
|
} from '@exyconn/common/data/timezones';
|
|
158
163
|
|
|
159
|
-
//
|
|
164
|
+
// Regex patterns
|
|
160
165
|
import {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
REGEX,
|
|
167
|
+
EMAIL,
|
|
168
|
+
PASSWORD_STRONG,
|
|
169
|
+
PHONE_INTERNATIONAL,
|
|
170
|
+
UUID,
|
|
171
|
+
URL_STRICT
|
|
172
|
+
} from '@exyconn/common/data/regex';
|
|
173
|
+
|
|
174
|
+
// Brand Identity
|
|
175
|
+
import {
|
|
176
|
+
BRANDS,
|
|
177
|
+
APPS,
|
|
178
|
+
getBrandById,
|
|
179
|
+
getBrandByDomain,
|
|
180
|
+
getThemedLogo,
|
|
181
|
+
createAppConfig
|
|
182
|
+
} from '@exyconn/common/data/brand-identity';
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Enums & Constants
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import {
|
|
189
|
+
// Status enums
|
|
190
|
+
STATUS,
|
|
191
|
+
USER_STATUS,
|
|
192
|
+
ORDER_STATUS,
|
|
193
|
+
PAYMENT_STATUS,
|
|
194
|
+
TASK_STATUS,
|
|
195
|
+
|
|
196
|
+
// Sort options
|
|
197
|
+
SORT,
|
|
198
|
+
SORT_DIRECTION,
|
|
199
|
+
|
|
200
|
+
// Roles & permissions
|
|
201
|
+
ROLE,
|
|
202
|
+
PERMISSION_LEVEL,
|
|
203
|
+
|
|
204
|
+
// UI constants
|
|
205
|
+
BREAKPOINTS,
|
|
206
|
+
MEDIA_QUERIES,
|
|
207
|
+
THEME,
|
|
208
|
+
|
|
209
|
+
// Other
|
|
210
|
+
PRIORITY,
|
|
211
|
+
VISIBILITY,
|
|
212
|
+
NOTIFICATION_TYPE
|
|
213
|
+
} from '@exyconn/common/shared/constants/enums';
|
|
165
214
|
```
|
|
166
215
|
|
|
167
216
|
## Data Module Details
|
|
@@ -170,6 +219,7 @@ import {
|
|
|
170
219
|
- 50+ countries with full details
|
|
171
220
|
- Nested states/cities for major countries
|
|
172
221
|
- Includes phone codes, currencies, timezones
|
|
222
|
+
- **NEW:** Emoji flags with `getFlag()` and `codeToFlag()` helpers
|
|
173
223
|
|
|
174
224
|
### Currencies
|
|
175
225
|
- 100+ world currencies
|
|
@@ -185,14 +235,46 @@ import {
|
|
|
185
235
|
- Common timezone presets
|
|
186
236
|
- Search and filter functions
|
|
187
237
|
|
|
188
|
-
###
|
|
189
|
-
|
|
238
|
+
### Regex Patterns
|
|
239
|
+
100+ common regex patterns organized by category:
|
|
240
|
+
- **Email** - Basic, RFC5322, common domains
|
|
241
|
+
- **Password** - Weak to very strong
|
|
242
|
+
- **Phone** - International, US, India, UK
|
|
243
|
+
- **Postal** - ZIP, PIN, UK, Canada, Germany
|
|
244
|
+
- **IDs** - UUID, MongoDB ObjectId, Aadhaar, PAN, SSN
|
|
245
|
+
- **URL** - Basic, strict, domain, localhost
|
|
246
|
+
- **Credit Card** - Visa, Mastercard, Amex, etc.
|
|
247
|
+
- **Date/Time** - ISO, various formats
|
|
248
|
+
- **Colors** - Hex, RGB, RGBA, HSL
|
|
249
|
+
- **And more!**
|
|
250
|
+
|
|
251
|
+
### Brand Identity
|
|
252
|
+
Complete brand configuration for all 5 Exyconn projects:
|
|
253
|
+
- **Logo variants:** light, dark, logoOnly, darkLogoOnly
|
|
254
|
+
- **Colors:** primary, secondary, accent
|
|
255
|
+
- **Contact:** support email, sales email
|
|
256
|
+
- **Social links:** Twitter, LinkedIn, GitHub, etc.
|
|
257
|
+
- **SEO config:** title, description, keywords
|
|
258
|
+
|
|
259
|
+
Projects:
|
|
190
260
|
- **botify.life** - AI/Bot platform
|
|
191
261
|
- **exyconn.com** - Main Exyconn brand
|
|
192
262
|
- **partywings.fun** - Event platform
|
|
193
263
|
- **sibera.work** - Work management
|
|
194
264
|
- **spentiva.com** - Finance platform
|
|
195
265
|
|
|
266
|
+
### Enums & Breakpoints
|
|
267
|
+
Comprehensive enums for consistent data handling:
|
|
268
|
+
- **STATUS** - active, pending, approved, archived...
|
|
269
|
+
- **USER_STATUS** - active, suspended, banned...
|
|
270
|
+
- **ORDER_STATUS** - pending, confirmed, shipped...
|
|
271
|
+
- **PAYMENT_STATUS** - pending, completed, refunded...
|
|
272
|
+
- **TASK_STATUS** - todo, in_progress, done...
|
|
273
|
+
- **SORT** - newest, oldest, alphabetical, popular...
|
|
274
|
+
- **ROLE** - super_admin, admin, user, viewer...
|
|
275
|
+
- **PRIORITY** - low, medium, high, critical
|
|
276
|
+
- **BREAKPOINTS** - xs, sm, md, lg, xl, 2xl (Tailwind-compatible)
|
|
277
|
+
|
|
196
278
|
## React Hooks
|
|
197
279
|
|
|
198
280
|
| Hook | Description |
|
|
@@ -230,28 +312,31 @@ All peer dependencies are optional - only install what you need:
|
|
|
230
312
|
|
|
231
313
|
```
|
|
232
314
|
@exyconn/common
|
|
233
|
-
├── /server
|
|
234
|
-
│ ├── /response
|
|
235
|
-
│ ├── /enums
|
|
236
|
-
│ ├── /logger
|
|
237
|
-
│ ├── /db
|
|
238
|
-
│ ├── /middleware
|
|
239
|
-
│ └── /utils
|
|
240
|
-
├── /client
|
|
241
|
-
│ ├── /http
|
|
242
|
-
│ ├── /hooks
|
|
243
|
-
│ ├── /logger
|
|
244
|
-
│ └── /utils
|
|
245
|
-
├── /shared
|
|
246
|
-
│ ├── /types
|
|
247
|
-
│ ├── /validation
|
|
248
|
-
│
|
|
249
|
-
└── /
|
|
250
|
-
|
|
251
|
-
├── /
|
|
252
|
-
├── /
|
|
253
|
-
├── /
|
|
254
|
-
|
|
315
|
+
├── /server # Server-side utilities
|
|
316
|
+
│ ├── /response # Response helpers
|
|
317
|
+
│ ├── /enums # Status codes/messages
|
|
318
|
+
│ ├── /logger # Winston logger
|
|
319
|
+
│ ├── /db # Database connections
|
|
320
|
+
│ ├── /middleware # Auth middleware
|
|
321
|
+
│ └── /utils # Server utilities
|
|
322
|
+
├── /client # Client-side utilities
|
|
323
|
+
│ ├── /http # Axios HTTP client
|
|
324
|
+
│ ├── /hooks # React hooks
|
|
325
|
+
│ ├── /logger # Browser logger
|
|
326
|
+
│ └── /utils # Client utilities
|
|
327
|
+
├── /shared # Shared between server/client
|
|
328
|
+
│ ├── /types # TypeScript types
|
|
329
|
+
│ ├── /validation # Validation patterns
|
|
330
|
+
│ ├── /constants # Enums, breakpoints, status codes
|
|
331
|
+
│ └── /utils # Date-time utilities
|
|
332
|
+
└── /data # Static data modules
|
|
333
|
+
├── /countries # Countries with states/cities/flags
|
|
334
|
+
├── /currencies # World currencies
|
|
335
|
+
├── /phone-codes # International phone codes
|
|
336
|
+
├── /timezones # Timezones
|
|
337
|
+
├── /regex # Common regex patterns
|
|
338
|
+
├── /brand-identity # Complete brand configs
|
|
339
|
+
└── /logos # Brand logos (deprecated, use brand-identity)
|
|
255
340
|
```
|
|
256
341
|
|
|
257
342
|
## License
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ApiResponse, HttpClientOptions, PaginatedResponse, createHttpClient, isForbidden, isNotFound, isServerError, isStatusError, isSuccess, isUnauthorized, parseError, parseFullResponse, parseResponse, withAbortSignal, withFormData, withTimeout } from './http/index.mjs';
|
|
2
2
|
export { ClientLogger, ClientLoggerConfig, LogLevel, clientLogger, createClientLogger } from './logger/index.mjs';
|
|
3
|
-
export { ApiUrlBuilder, ApiUrlConfig, EventEmitter, addDays, appEvents, camelToKebab, capitalize, capitalizeWords, copyToClipboard, createApiEndpoints, createApiUrlBuilder, createEmptyPaginationMeta, createErrorResponse, createEventEmitter, createSuccessResponse, endOfDay, formatDate, formatDateForInput, formatDateTime, formatDateTimeForInput, formatRelativeTime, getErrorMessage, getNextPage, getPrevPage, getResponseData, hasData, hasMorePages, isClipboardAvailable, isErrorResponse, isFuture, isPast, isSuccessResponse, isToday, kebabToCamel, readFromClipboard, slugify, slugifyUnique, startOfDay, truncate, truncateWords, unslugify } from './utils/index.mjs';
|
|
4
|
-
export {
|
|
3
|
+
export { ApiUrlBuilder, ApiUrlConfig, EventEmitter, NpmRegistryResponse, PackageCheckResult, PackageJson, PackageVersion, addDays, appEvents, camelToKebab, capitalize, capitalizeWords, checkPackage, copyToClipboard, createApiEndpoints, createApiUrlBuilder, createEmptyPaginationMeta, createErrorResponse, createEventEmitter, createSuccessResponse, endOfDay, formatDate, formatDateForInput, formatDateTime, formatDateTimeForInput, formatPackageCheckResult, formatRelativeTime, generateNcuCommand, getErrorMessage, getNextPage, getPrevPage, getResponseData, hasData, hasMorePages, isClipboardAvailable, isErrorResponse, isFuture, isPast, isSuccessResponse, isToday, kebabToCamel, packageCheck, readFromClipboard, slugify, slugifyUnique, startOfDay, truncate, truncateWords, unslugify } from './utils/index.mjs';
|
|
4
|
+
export { aC as BatteryState, aV as Dimensions, aG as GeolocationState, at as MousePosition, aD as NetworkState, a4 as ObjectStateUpdate, aB as OrientationState, aT as RenderInfo, aQ as ScriptStatus, aL as SetValue, aZ as SnackbarSeverity, a_ as SnackbarState, aK as ThemeMode, af as UseContinuousRetryOptions, ag as UseContinuousRetryReturn, aw as UseCopyToClipboardReturn, ad as UseCountdownOptions, ae as UseCountdownReturn, a2 as UseCounterOptions, a3 as UseCounterReturn, ak as UseDocumentTitleOptions, aO as UseFetchOptions, aP as UseFetchReturn, aH as UseGeolocationOptions, aI as UseGeolocationReturn, a7 as UseHistoryStateOptions, a6 as UseHistoryStateReturn, aq as UseHoverReturn, aE as UseIdleOptions, aF as UseIdleReturn, aX as UseIntersectionObserverOptions, aY as UseIntersectionObserverReturn, ao as UseKeyPressOptions, ap as UseKeyPressReturn, a9 as UseListReturn, aM as UseLocalStorageOptions, aU as UseLoggerOptions, ar as UseLongPressOptions, as as UseLongPressReturn, aa as UseMapReturn, aW as UseMeasureReturn, au as UseMouseOptions, av as UseMouseReturn, a5 as UseObjectStateReturn, an as UsePageLeaveOptions, al as UsePageTitleOptions, aJ as UsePreferredLanguageReturn, a8 as UseQueueReturn, aR as UseScriptOptions, aS as UseScriptReturn, aN as UseSessionStorageOptions, ab as UseSetReturn, a$ as UseSnackbarReturn, ac as UseTimeoutReturn, a1 as UseToggleReturn, am as UseVisibilityChangeReturn, aj as UseWindowScrollReturn, ai as WindowScrollPosition, ah as WindowSize, N as useBattery, G as useClickAway, r as useContinuousRetry, K as useCopyToClipboard, q as useCountdown, a as useCounter, k as useDebounce, b as useDefault, v as useDocumentTitle, D as useEventListener, x as useFavicon, V as useFetch, Q as useGeolocation, e as useHistoryState, F as useHover, P as useIdle, $ as useIntersectionObserver, n as useInterval, o as useIntervalWhen, B as useIsClient, az as useIsDesktop, C as useIsFirstRender, ax as useIsMobile, aA as useIsMobileOrTablet, ay as useIsTablet, E as useKeyPress, g as useList, T as useLocalStorage, A as useLockBodyScroll, Z as useLogger, I as useLongPress, h as useMap, _ as useMeasure, L as useMediaQuery, J as useMouse, O as useNetworkState, d as useObjectState, H as useOnClickOutside, M as useOrientation, z as usePageLeave, w as usePageTitle, R as usePreferredLanguage, c as usePrevious, f as useQueue, p as useRandomInterval, Y as useRenderCount, X as useRenderInfo, W as useScript, U as useSessionStorage, j as useSet, a0 as useSnackbar, S as useThemeDetector, l as useThrottle, m as useTimeout, u as useToggle, y as useVisibilityChange, t as useWindowScroll, s as useWindowSize } from '../index-CIUdLBjA.mjs';
|
|
5
5
|
import 'axios';
|
|
6
6
|
import '../response.types-D--UhLJq.mjs';
|
|
7
7
|
import 'react';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ApiResponse, HttpClientOptions, PaginatedResponse, createHttpClient, isForbidden, isNotFound, isServerError, isStatusError, isSuccess, isUnauthorized, parseError, parseFullResponse, parseResponse, withAbortSignal, withFormData, withTimeout } from './http/index.js';
|
|
2
2
|
export { ClientLogger, ClientLoggerConfig, LogLevel, clientLogger, createClientLogger } from './logger/index.js';
|
|
3
|
-
export { ApiUrlBuilder, ApiUrlConfig, EventEmitter, addDays, appEvents, camelToKebab, capitalize, capitalizeWords, copyToClipboard, createApiEndpoints, createApiUrlBuilder, createEmptyPaginationMeta, createErrorResponse, createEventEmitter, createSuccessResponse, endOfDay, formatDate, formatDateForInput, formatDateTime, formatDateTimeForInput, formatRelativeTime, getErrorMessage, getNextPage, getPrevPage, getResponseData, hasData, hasMorePages, isClipboardAvailable, isErrorResponse, isFuture, isPast, isSuccessResponse, isToday, kebabToCamel, readFromClipboard, slugify, slugifyUnique, startOfDay, truncate, truncateWords, unslugify } from './utils/index.js';
|
|
4
|
-
export {
|
|
3
|
+
export { ApiUrlBuilder, ApiUrlConfig, EventEmitter, NpmRegistryResponse, PackageCheckResult, PackageJson, PackageVersion, addDays, appEvents, camelToKebab, capitalize, capitalizeWords, checkPackage, copyToClipboard, createApiEndpoints, createApiUrlBuilder, createEmptyPaginationMeta, createErrorResponse, createEventEmitter, createSuccessResponse, endOfDay, formatDate, formatDateForInput, formatDateTime, formatDateTimeForInput, formatPackageCheckResult, formatRelativeTime, generateNcuCommand, getErrorMessage, getNextPage, getPrevPage, getResponseData, hasData, hasMorePages, isClipboardAvailable, isErrorResponse, isFuture, isPast, isSuccessResponse, isToday, kebabToCamel, packageCheck, readFromClipboard, slugify, slugifyUnique, startOfDay, truncate, truncateWords, unslugify } from './utils/index.js';
|
|
4
|
+
export { aC as BatteryState, aV as Dimensions, aG as GeolocationState, at as MousePosition, aD as NetworkState, a4 as ObjectStateUpdate, aB as OrientationState, aT as RenderInfo, aQ as ScriptStatus, aL as SetValue, aZ as SnackbarSeverity, a_ as SnackbarState, aK as ThemeMode, af as UseContinuousRetryOptions, ag as UseContinuousRetryReturn, aw as UseCopyToClipboardReturn, ad as UseCountdownOptions, ae as UseCountdownReturn, a2 as UseCounterOptions, a3 as UseCounterReturn, ak as UseDocumentTitleOptions, aO as UseFetchOptions, aP as UseFetchReturn, aH as UseGeolocationOptions, aI as UseGeolocationReturn, a7 as UseHistoryStateOptions, a6 as UseHistoryStateReturn, aq as UseHoverReturn, aE as UseIdleOptions, aF as UseIdleReturn, aX as UseIntersectionObserverOptions, aY as UseIntersectionObserverReturn, ao as UseKeyPressOptions, ap as UseKeyPressReturn, a9 as UseListReturn, aM as UseLocalStorageOptions, aU as UseLoggerOptions, ar as UseLongPressOptions, as as UseLongPressReturn, aa as UseMapReturn, aW as UseMeasureReturn, au as UseMouseOptions, av as UseMouseReturn, a5 as UseObjectStateReturn, an as UsePageLeaveOptions, al as UsePageTitleOptions, aJ as UsePreferredLanguageReturn, a8 as UseQueueReturn, aR as UseScriptOptions, aS as UseScriptReturn, aN as UseSessionStorageOptions, ab as UseSetReturn, a$ as UseSnackbarReturn, ac as UseTimeoutReturn, a1 as UseToggleReturn, am as UseVisibilityChangeReturn, aj as UseWindowScrollReturn, ai as WindowScrollPosition, ah as WindowSize, N as useBattery, G as useClickAway, r as useContinuousRetry, K as useCopyToClipboard, q as useCountdown, a as useCounter, k as useDebounce, b as useDefault, v as useDocumentTitle, D as useEventListener, x as useFavicon, V as useFetch, Q as useGeolocation, e as useHistoryState, F as useHover, P as useIdle, $ as useIntersectionObserver, n as useInterval, o as useIntervalWhen, B as useIsClient, az as useIsDesktop, C as useIsFirstRender, ax as useIsMobile, aA as useIsMobileOrTablet, ay as useIsTablet, E as useKeyPress, g as useList, T as useLocalStorage, A as useLockBodyScroll, Z as useLogger, I as useLongPress, h as useMap, _ as useMeasure, L as useMediaQuery, J as useMouse, O as useNetworkState, d as useObjectState, H as useOnClickOutside, M as useOrientation, z as usePageLeave, w as usePageTitle, R as usePreferredLanguage, c as usePrevious, f as useQueue, p as useRandomInterval, Y as useRenderCount, X as useRenderInfo, W as useScript, U as useSessionStorage, j as useSet, a0 as useSnackbar, S as useThemeDetector, l as useThrottle, m as useTimeout, u as useToggle, y as useVisibilityChange, t as useWindowScroll, s as useWindowSize } from '../index-BLltj-zN.js';
|
|
5
5
|
import 'axios';
|
|
6
6
|
import '../response.types-D--UhLJq.js';
|
|
7
7
|
import 'react';
|