@exyconn/common 2.3.2 → 2.3.4
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 +117 -12
- package/dist/client/http/index.d.mts +280 -49
- package/dist/client/http/index.d.ts +280 -49
- package/dist/client/http/index.js +564 -90
- package/dist/client/http/index.js.map +1 -1
- package/dist/client/http/index.mjs +520 -80
- package/dist/client/http/index.mjs.map +1 -1
- package/dist/client/index.d.mts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +573 -316
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +529 -287
- package/dist/client/index.mjs.map +1 -1
- package/dist/client/utils/index.d.mts +3 -279
- package/dist/client/utils/index.d.ts +3 -279
- package/dist/{index-D9a9oxQy.d.ts → index-CdbQ8YPt.d.ts} +51 -39
- package/dist/{index-D3yCCjBZ.d.mts → index-Ckhm_HaX.d.mts} +21 -2
- package/dist/{index-01hoqibP.d.ts → index-br6POSyA.d.ts} +21 -2
- package/dist/{index-DuxL84IW.d.mts → index-guYdqefq.d.mts} +51 -39
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1214 -326
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1226 -338
- package/dist/index.mjs.map +1 -1
- package/dist/packageCheck-B_qfsD6R.d.ts +280 -0
- package/dist/packageCheck-C2_FT_Rl.d.mts +280 -0
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +631 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +625 -2
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/middleware/index.d.mts +283 -2
- package/dist/server/middleware/index.d.ts +283 -2
- package/dist/server/middleware/index.js +761 -0
- package/dist/server/middleware/index.js.map +1 -1
- package/dist/server/middleware/index.mjs +751 -1
- package/dist/server/middleware/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,103 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Format date to readable string
|
|
5
|
-
* @param date - Date to format
|
|
6
|
-
* @param locale - Locale for formatting (default: 'en-US')
|
|
7
|
-
*/
|
|
8
|
-
declare const formatDate: (date: Date | string | number, locale?: string) => string;
|
|
9
|
-
/**
|
|
10
|
-
* Format date with time
|
|
11
|
-
*/
|
|
12
|
-
declare const formatDateTime: (date: Date | string | number, locale?: string) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Format date as relative time (e.g., "2 hours ago")
|
|
15
|
-
*/
|
|
16
|
-
declare const formatRelativeTime: (date: Date | string | number) => string;
|
|
17
|
-
/**
|
|
18
|
-
* Format date for input[type="date"]
|
|
19
|
-
*/
|
|
20
|
-
declare const formatDateForInput: (date: Date | string | number) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Format date for input[type="datetime-local"]
|
|
23
|
-
*/
|
|
24
|
-
declare const formatDateTimeForInput: (date: Date | string | number) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Check if date is today
|
|
27
|
-
*/
|
|
28
|
-
declare const isToday: (date: Date | string | number) => boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Check if date is in the past
|
|
31
|
-
*/
|
|
32
|
-
declare const isPast: (date: Date | string | number) => boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Check if date is in the future
|
|
35
|
-
*/
|
|
36
|
-
declare const isFuture: (date: Date | string | number) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Add days to a date
|
|
39
|
-
*/
|
|
40
|
-
declare const addDays: (date: Date | string | number, days: number) => Date;
|
|
41
|
-
/**
|
|
42
|
-
* Get start of day
|
|
43
|
-
*/
|
|
44
|
-
declare const startOfDay: (date: Date | string | number) => Date;
|
|
45
|
-
/**
|
|
46
|
-
* Get end of day
|
|
47
|
-
*/
|
|
48
|
-
declare const endOfDay: (date: Date | string | number) => Date;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Copy text to clipboard
|
|
52
|
-
* @returns Promise<boolean> - true if successful
|
|
53
|
-
*/
|
|
54
|
-
declare const copyToClipboard: (text: string) => Promise<boolean>;
|
|
55
|
-
/**
|
|
56
|
-
* Read text from clipboard
|
|
57
|
-
* @returns Promise<string | null>
|
|
58
|
-
*/
|
|
59
|
-
declare const readFromClipboard: () => Promise<string | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Check if clipboard API is available
|
|
62
|
-
*/
|
|
63
|
-
declare const isClipboardAvailable: () => boolean;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Generate URL-friendly slug from text
|
|
67
|
-
*/
|
|
68
|
-
declare const slugify: (text: string) => string;
|
|
69
|
-
/**
|
|
70
|
-
* Generate slug with unique suffix
|
|
71
|
-
*/
|
|
72
|
-
declare const slugifyUnique: (text: string) => string;
|
|
73
|
-
/**
|
|
74
|
-
* Convert slug back to readable text
|
|
75
|
-
*/
|
|
76
|
-
declare const unslugify: (slug: string) => string;
|
|
77
|
-
/**
|
|
78
|
-
* Truncate text to specified length with ellipsis
|
|
79
|
-
*/
|
|
80
|
-
declare const truncate: (text: string, maxLength: number, suffix?: string) => string;
|
|
81
|
-
/**
|
|
82
|
-
* Truncate text by words
|
|
83
|
-
*/
|
|
84
|
-
declare const truncateWords: (text: string, maxWords: number, suffix?: string) => string;
|
|
85
|
-
/**
|
|
86
|
-
* Capitalize first letter of each word
|
|
87
|
-
*/
|
|
88
|
-
declare const capitalizeWords: (text: string) => string;
|
|
89
|
-
/**
|
|
90
|
-
* Capitalize first letter only
|
|
91
|
-
*/
|
|
92
|
-
declare const capitalize: (text: string) => string;
|
|
93
|
-
/**
|
|
94
|
-
* Convert camelCase to kebab-case
|
|
95
|
-
*/
|
|
96
|
-
declare const camelToKebab: (text: string) => string;
|
|
97
|
-
/**
|
|
98
|
-
* Convert kebab-case to camelCase
|
|
99
|
-
*/
|
|
100
|
-
declare const kebabToCamel: (text: string) => string;
|
|
1
|
+
export { N as NpmRegistryResponse, J as PackageCheckResult, K as PackageJson, P as PackageVersion, E as addDays, c as camelToKebab, a as capitalize, b as capitalizeWords, L as checkPackage, d as copyToClipboard, e as createEmptyPaginationMeta, f as createErrorResponse, g as createSuccessResponse, G as endOfDay, h as formatDate, z as formatDateForInput, i as formatDateTime, A as formatDateTimeForInput, M as formatPackageCheckResult, j as formatRelativeTime, O as generateNcuCommand, k as getErrorMessage, l as getNextPage, m as getPrevPage, n as getResponseData, o as hasData, p as hasMorePages, I as isClipboardAvailable, q as isErrorResponse, D as isFuture, C as isPast, r as isSuccessResponse, B as isToday, s as kebabToCamel, t as packageCheck, H as readFromClipboard, u as slugify, v as slugifyUnique, F as startOfDay, w as truncate, x as truncateWords, y as unslugify } from '../../packageCheck-C2_FT_Rl.mjs';
|
|
2
|
+
import '../../response.types-D--UhLJq.mjs';
|
|
101
3
|
|
|
102
4
|
/**
|
|
103
5
|
* Event Emitter for client-side event handling
|
|
@@ -226,182 +128,4 @@ declare const createApiEndpoints: (builder: ApiUrlBuilder) => {
|
|
|
226
128
|
};
|
|
227
129
|
};
|
|
228
130
|
|
|
229
|
-
|
|
230
|
-
* Response Parser Utilities
|
|
231
|
-
* Common patterns for parsing API responses
|
|
232
|
-
*/
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Check if response is successful
|
|
236
|
-
*/
|
|
237
|
-
declare const isSuccessResponse: <T>(response: ApiResponse<T>) => response is ApiResponse<T> & {
|
|
238
|
-
success: true;
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Check if response is an error
|
|
242
|
-
*/
|
|
243
|
-
declare const isErrorResponse: <T>(response: ApiResponse<T>) => response is ApiResponse<T> & {
|
|
244
|
-
success: false;
|
|
245
|
-
};
|
|
246
|
-
/**
|
|
247
|
-
* Extract data from response or return default
|
|
248
|
-
*/
|
|
249
|
-
declare const getResponseData: <T>(response: ApiResponse<T>, defaultValue: T) => T;
|
|
250
|
-
/**
|
|
251
|
-
* Extract error message from response
|
|
252
|
-
*/
|
|
253
|
-
declare const getErrorMessage: <T>(response: ApiResponse<T>, defaultMessage?: string) => string;
|
|
254
|
-
/**
|
|
255
|
-
* Check if response has data
|
|
256
|
-
*/
|
|
257
|
-
declare const hasData: <T>(response: ApiResponse<T>) => response is ApiResponse<T> & {
|
|
258
|
-
data: NonNullable<T>;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Check if paginated response has more pages
|
|
262
|
-
*/
|
|
263
|
-
declare const hasMorePages: <T>(response: PaginatedResponse<T>) => boolean;
|
|
264
|
-
/**
|
|
265
|
-
* Get next page number from paginated response
|
|
266
|
-
*/
|
|
267
|
-
declare const getNextPage: <T>(response: PaginatedResponse<T>) => number | null;
|
|
268
|
-
/**
|
|
269
|
-
* Get previous page number from paginated response
|
|
270
|
-
*/
|
|
271
|
-
declare const getPrevPage: <T>(response: PaginatedResponse<T>) => number | null;
|
|
272
|
-
/**
|
|
273
|
-
* Create empty pagination meta
|
|
274
|
-
*/
|
|
275
|
-
declare const createEmptyPaginationMeta: () => PaginationMeta;
|
|
276
|
-
/**
|
|
277
|
-
* Create success response
|
|
278
|
-
*/
|
|
279
|
-
declare const createSuccessResponse: <T>(data: T, message?: string) => ApiResponse<T>;
|
|
280
|
-
/**
|
|
281
|
-
* Create error response
|
|
282
|
-
*/
|
|
283
|
-
declare const createErrorResponse: (message: string, statusCode?: number, error?: string) => ApiResponse<never>;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Package Check Utility
|
|
287
|
-
* Analyzes package.json dependencies and checks for updates
|
|
288
|
-
*
|
|
289
|
-
* Features:
|
|
290
|
-
* - Fetches package.json from URL or file path
|
|
291
|
-
* - Checks all dependency types (dependencies, devDependencies, peerDependencies, optionalDependencies)
|
|
292
|
-
* - Compares versions with npm registry
|
|
293
|
-
* - Provides update suggestions
|
|
294
|
-
* - Supports auto mode with npm-check-updates
|
|
295
|
-
*/
|
|
296
|
-
interface PackageVersion {
|
|
297
|
-
/** Package name */
|
|
298
|
-
name: string;
|
|
299
|
-
/** Current version in package.json */
|
|
300
|
-
current: string;
|
|
301
|
-
/** Latest version available on npm */
|
|
302
|
-
latest: string;
|
|
303
|
-
/** Is update available? */
|
|
304
|
-
hasUpdate: boolean;
|
|
305
|
-
/** Update type: major, minor, patch, or none */
|
|
306
|
-
updateType: 'major' | 'minor' | 'patch' | 'prerelease' | 'none';
|
|
307
|
-
/** Dependency type */
|
|
308
|
-
dependencyType: 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
|
|
309
|
-
}
|
|
310
|
-
interface PackageCheckResult {
|
|
311
|
-
/** Package name from package.json */
|
|
312
|
-
packageName: string;
|
|
313
|
-
/** Current package version */
|
|
314
|
-
packageVersion: string;
|
|
315
|
-
/** Total dependencies checked */
|
|
316
|
-
totalDependencies: number;
|
|
317
|
-
/** Dependencies with updates available */
|
|
318
|
-
outdatedCount: number;
|
|
319
|
-
/** All dependency information */
|
|
320
|
-
dependencies: PackageVersion[];
|
|
321
|
-
/** Dependencies grouped by type */
|
|
322
|
-
byType: {
|
|
323
|
-
dependencies: PackageVersion[];
|
|
324
|
-
devDependencies: PackageVersion[];
|
|
325
|
-
peerDependencies: PackageVersion[];
|
|
326
|
-
optionalDependencies: PackageVersion[];
|
|
327
|
-
};
|
|
328
|
-
/** Dependencies grouped by update type */
|
|
329
|
-
byUpdateType: {
|
|
330
|
-
major: PackageVersion[];
|
|
331
|
-
minor: PackageVersion[];
|
|
332
|
-
patch: PackageVersion[];
|
|
333
|
-
prerelease: PackageVersion[];
|
|
334
|
-
};
|
|
335
|
-
/** Timestamp of check */
|
|
336
|
-
checkedAt: Date;
|
|
337
|
-
/** Errors encountered */
|
|
338
|
-
errors: string[];
|
|
339
|
-
}
|
|
340
|
-
interface PackageJson {
|
|
341
|
-
name?: string;
|
|
342
|
-
version?: string;
|
|
343
|
-
dependencies?: Record<string, string>;
|
|
344
|
-
devDependencies?: Record<string, string>;
|
|
345
|
-
peerDependencies?: Record<string, string>;
|
|
346
|
-
optionalDependencies?: Record<string, string>;
|
|
347
|
-
}
|
|
348
|
-
interface NpmRegistryResponse {
|
|
349
|
-
'dist-tags': {
|
|
350
|
-
latest: string;
|
|
351
|
-
[key: string]: string;
|
|
352
|
-
};
|
|
353
|
-
versions: Record<string, unknown>;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Parse version string, removing range operators
|
|
357
|
-
*/
|
|
358
|
-
declare function parseVersion(version: string): string;
|
|
359
|
-
/**
|
|
360
|
-
* Compare two semver versions
|
|
361
|
-
*/
|
|
362
|
-
declare function compareVersions(current: string, latest: string): 'major' | 'minor' | 'patch' | 'prerelease' | 'none';
|
|
363
|
-
/**
|
|
364
|
-
* Main function to check package.json for updates
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* // From URL
|
|
368
|
-
* const result = await checkPackage('https://raw.githubusercontent.com/user/repo/main/package.json');
|
|
369
|
-
*
|
|
370
|
-
* @example
|
|
371
|
-
* // From object
|
|
372
|
-
* const result = await checkPackage({
|
|
373
|
-
* name: 'my-package',
|
|
374
|
-
* dependencies: { 'lodash': '^4.17.0' }
|
|
375
|
-
* });
|
|
376
|
-
*
|
|
377
|
-
* @example
|
|
378
|
-
* // In Node.js, read file first
|
|
379
|
-
* import fs from 'fs';
|
|
380
|
-
* const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
|
|
381
|
-
* const result = await checkPackage(pkg);
|
|
382
|
-
*/
|
|
383
|
-
declare function checkPackage(source: string | PackageJson): Promise<PackageCheckResult>;
|
|
384
|
-
/**
|
|
385
|
-
* Format check result as human-readable string
|
|
386
|
-
*/
|
|
387
|
-
declare function formatPackageCheckResult(result: PackageCheckResult): string;
|
|
388
|
-
/**
|
|
389
|
-
* Generate ncu (npm-check-updates) command
|
|
390
|
-
*/
|
|
391
|
-
declare function generateNcuCommand(result: PackageCheckResult, options?: {
|
|
392
|
-
updateType?: 'major' | 'minor' | 'patch' | 'all';
|
|
393
|
-
interactive?: boolean;
|
|
394
|
-
upgrade?: boolean;
|
|
395
|
-
}): string;
|
|
396
|
-
/**
|
|
397
|
-
* Package check utilities for client-side usage
|
|
398
|
-
*/
|
|
399
|
-
declare const packageCheck: {
|
|
400
|
-
readonly check: typeof checkPackage;
|
|
401
|
-
readonly format: typeof formatPackageCheckResult;
|
|
402
|
-
readonly generateNcuCommand: typeof generateNcuCommand;
|
|
403
|
-
readonly parseVersion: typeof parseVersion;
|
|
404
|
-
readonly compareVersions: typeof compareVersions;
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
export { ApiUrlBuilder, type ApiUrlConfig, EventEmitter, type NpmRegistryResponse, type PackageCheckResult, type PackageJson, type 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 };
|
|
131
|
+
export { ApiUrlBuilder, type ApiUrlConfig, EventEmitter, appEvents, createApiEndpoints, createApiUrlBuilder, createEventEmitter };
|
|
@@ -1,103 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Format date to readable string
|
|
5
|
-
* @param date - Date to format
|
|
6
|
-
* @param locale - Locale for formatting (default: 'en-US')
|
|
7
|
-
*/
|
|
8
|
-
declare const formatDate: (date: Date | string | number, locale?: string) => string;
|
|
9
|
-
/**
|
|
10
|
-
* Format date with time
|
|
11
|
-
*/
|
|
12
|
-
declare const formatDateTime: (date: Date | string | number, locale?: string) => string;
|
|
13
|
-
/**
|
|
14
|
-
* Format date as relative time (e.g., "2 hours ago")
|
|
15
|
-
*/
|
|
16
|
-
declare const formatRelativeTime: (date: Date | string | number) => string;
|
|
17
|
-
/**
|
|
18
|
-
* Format date for input[type="date"]
|
|
19
|
-
*/
|
|
20
|
-
declare const formatDateForInput: (date: Date | string | number) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Format date for input[type="datetime-local"]
|
|
23
|
-
*/
|
|
24
|
-
declare const formatDateTimeForInput: (date: Date | string | number) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Check if date is today
|
|
27
|
-
*/
|
|
28
|
-
declare const isToday: (date: Date | string | number) => boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Check if date is in the past
|
|
31
|
-
*/
|
|
32
|
-
declare const isPast: (date: Date | string | number) => boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Check if date is in the future
|
|
35
|
-
*/
|
|
36
|
-
declare const isFuture: (date: Date | string | number) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Add days to a date
|
|
39
|
-
*/
|
|
40
|
-
declare const addDays: (date: Date | string | number, days: number) => Date;
|
|
41
|
-
/**
|
|
42
|
-
* Get start of day
|
|
43
|
-
*/
|
|
44
|
-
declare const startOfDay: (date: Date | string | number) => Date;
|
|
45
|
-
/**
|
|
46
|
-
* Get end of day
|
|
47
|
-
*/
|
|
48
|
-
declare const endOfDay: (date: Date | string | number) => Date;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Copy text to clipboard
|
|
52
|
-
* @returns Promise<boolean> - true if successful
|
|
53
|
-
*/
|
|
54
|
-
declare const copyToClipboard: (text: string) => Promise<boolean>;
|
|
55
|
-
/**
|
|
56
|
-
* Read text from clipboard
|
|
57
|
-
* @returns Promise<string | null>
|
|
58
|
-
*/
|
|
59
|
-
declare const readFromClipboard: () => Promise<string | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Check if clipboard API is available
|
|
62
|
-
*/
|
|
63
|
-
declare const isClipboardAvailable: () => boolean;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Generate URL-friendly slug from text
|
|
67
|
-
*/
|
|
68
|
-
declare const slugify: (text: string) => string;
|
|
69
|
-
/**
|
|
70
|
-
* Generate slug with unique suffix
|
|
71
|
-
*/
|
|
72
|
-
declare const slugifyUnique: (text: string) => string;
|
|
73
|
-
/**
|
|
74
|
-
* Convert slug back to readable text
|
|
75
|
-
*/
|
|
76
|
-
declare const unslugify: (slug: string) => string;
|
|
77
|
-
/**
|
|
78
|
-
* Truncate text to specified length with ellipsis
|
|
79
|
-
*/
|
|
80
|
-
declare const truncate: (text: string, maxLength: number, suffix?: string) => string;
|
|
81
|
-
/**
|
|
82
|
-
* Truncate text by words
|
|
83
|
-
*/
|
|
84
|
-
declare const truncateWords: (text: string, maxWords: number, suffix?: string) => string;
|
|
85
|
-
/**
|
|
86
|
-
* Capitalize first letter of each word
|
|
87
|
-
*/
|
|
88
|
-
declare const capitalizeWords: (text: string) => string;
|
|
89
|
-
/**
|
|
90
|
-
* Capitalize first letter only
|
|
91
|
-
*/
|
|
92
|
-
declare const capitalize: (text: string) => string;
|
|
93
|
-
/**
|
|
94
|
-
* Convert camelCase to kebab-case
|
|
95
|
-
*/
|
|
96
|
-
declare const camelToKebab: (text: string) => string;
|
|
97
|
-
/**
|
|
98
|
-
* Convert kebab-case to camelCase
|
|
99
|
-
*/
|
|
100
|
-
declare const kebabToCamel: (text: string) => string;
|
|
1
|
+
export { N as NpmRegistryResponse, J as PackageCheckResult, K as PackageJson, P as PackageVersion, E as addDays, c as camelToKebab, a as capitalize, b as capitalizeWords, L as checkPackage, d as copyToClipboard, e as createEmptyPaginationMeta, f as createErrorResponse, g as createSuccessResponse, G as endOfDay, h as formatDate, z as formatDateForInput, i as formatDateTime, A as formatDateTimeForInput, M as formatPackageCheckResult, j as formatRelativeTime, O as generateNcuCommand, k as getErrorMessage, l as getNextPage, m as getPrevPage, n as getResponseData, o as hasData, p as hasMorePages, I as isClipboardAvailable, q as isErrorResponse, D as isFuture, C as isPast, r as isSuccessResponse, B as isToday, s as kebabToCamel, t as packageCheck, H as readFromClipboard, u as slugify, v as slugifyUnique, F as startOfDay, w as truncate, x as truncateWords, y as unslugify } from '../../packageCheck-B_qfsD6R.js';
|
|
2
|
+
import '../../response.types-D--UhLJq.js';
|
|
101
3
|
|
|
102
4
|
/**
|
|
103
5
|
* Event Emitter for client-side event handling
|
|
@@ -226,182 +128,4 @@ declare const createApiEndpoints: (builder: ApiUrlBuilder) => {
|
|
|
226
128
|
};
|
|
227
129
|
};
|
|
228
130
|
|
|
229
|
-
|
|
230
|
-
* Response Parser Utilities
|
|
231
|
-
* Common patterns for parsing API responses
|
|
232
|
-
*/
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Check if response is successful
|
|
236
|
-
*/
|
|
237
|
-
declare const isSuccessResponse: <T>(response: ApiResponse<T>) => response is ApiResponse<T> & {
|
|
238
|
-
success: true;
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Check if response is an error
|
|
242
|
-
*/
|
|
243
|
-
declare const isErrorResponse: <T>(response: ApiResponse<T>) => response is ApiResponse<T> & {
|
|
244
|
-
success: false;
|
|
245
|
-
};
|
|
246
|
-
/**
|
|
247
|
-
* Extract data from response or return default
|
|
248
|
-
*/
|
|
249
|
-
declare const getResponseData: <T>(response: ApiResponse<T>, defaultValue: T) => T;
|
|
250
|
-
/**
|
|
251
|
-
* Extract error message from response
|
|
252
|
-
*/
|
|
253
|
-
declare const getErrorMessage: <T>(response: ApiResponse<T>, defaultMessage?: string) => string;
|
|
254
|
-
/**
|
|
255
|
-
* Check if response has data
|
|
256
|
-
*/
|
|
257
|
-
declare const hasData: <T>(response: ApiResponse<T>) => response is ApiResponse<T> & {
|
|
258
|
-
data: NonNullable<T>;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* Check if paginated response has more pages
|
|
262
|
-
*/
|
|
263
|
-
declare const hasMorePages: <T>(response: PaginatedResponse<T>) => boolean;
|
|
264
|
-
/**
|
|
265
|
-
* Get next page number from paginated response
|
|
266
|
-
*/
|
|
267
|
-
declare const getNextPage: <T>(response: PaginatedResponse<T>) => number | null;
|
|
268
|
-
/**
|
|
269
|
-
* Get previous page number from paginated response
|
|
270
|
-
*/
|
|
271
|
-
declare const getPrevPage: <T>(response: PaginatedResponse<T>) => number | null;
|
|
272
|
-
/**
|
|
273
|
-
* Create empty pagination meta
|
|
274
|
-
*/
|
|
275
|
-
declare const createEmptyPaginationMeta: () => PaginationMeta;
|
|
276
|
-
/**
|
|
277
|
-
* Create success response
|
|
278
|
-
*/
|
|
279
|
-
declare const createSuccessResponse: <T>(data: T, message?: string) => ApiResponse<T>;
|
|
280
|
-
/**
|
|
281
|
-
* Create error response
|
|
282
|
-
*/
|
|
283
|
-
declare const createErrorResponse: (message: string, statusCode?: number, error?: string) => ApiResponse<never>;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Package Check Utility
|
|
287
|
-
* Analyzes package.json dependencies and checks for updates
|
|
288
|
-
*
|
|
289
|
-
* Features:
|
|
290
|
-
* - Fetches package.json from URL or file path
|
|
291
|
-
* - Checks all dependency types (dependencies, devDependencies, peerDependencies, optionalDependencies)
|
|
292
|
-
* - Compares versions with npm registry
|
|
293
|
-
* - Provides update suggestions
|
|
294
|
-
* - Supports auto mode with npm-check-updates
|
|
295
|
-
*/
|
|
296
|
-
interface PackageVersion {
|
|
297
|
-
/** Package name */
|
|
298
|
-
name: string;
|
|
299
|
-
/** Current version in package.json */
|
|
300
|
-
current: string;
|
|
301
|
-
/** Latest version available on npm */
|
|
302
|
-
latest: string;
|
|
303
|
-
/** Is update available? */
|
|
304
|
-
hasUpdate: boolean;
|
|
305
|
-
/** Update type: major, minor, patch, or none */
|
|
306
|
-
updateType: 'major' | 'minor' | 'patch' | 'prerelease' | 'none';
|
|
307
|
-
/** Dependency type */
|
|
308
|
-
dependencyType: 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
|
|
309
|
-
}
|
|
310
|
-
interface PackageCheckResult {
|
|
311
|
-
/** Package name from package.json */
|
|
312
|
-
packageName: string;
|
|
313
|
-
/** Current package version */
|
|
314
|
-
packageVersion: string;
|
|
315
|
-
/** Total dependencies checked */
|
|
316
|
-
totalDependencies: number;
|
|
317
|
-
/** Dependencies with updates available */
|
|
318
|
-
outdatedCount: number;
|
|
319
|
-
/** All dependency information */
|
|
320
|
-
dependencies: PackageVersion[];
|
|
321
|
-
/** Dependencies grouped by type */
|
|
322
|
-
byType: {
|
|
323
|
-
dependencies: PackageVersion[];
|
|
324
|
-
devDependencies: PackageVersion[];
|
|
325
|
-
peerDependencies: PackageVersion[];
|
|
326
|
-
optionalDependencies: PackageVersion[];
|
|
327
|
-
};
|
|
328
|
-
/** Dependencies grouped by update type */
|
|
329
|
-
byUpdateType: {
|
|
330
|
-
major: PackageVersion[];
|
|
331
|
-
minor: PackageVersion[];
|
|
332
|
-
patch: PackageVersion[];
|
|
333
|
-
prerelease: PackageVersion[];
|
|
334
|
-
};
|
|
335
|
-
/** Timestamp of check */
|
|
336
|
-
checkedAt: Date;
|
|
337
|
-
/** Errors encountered */
|
|
338
|
-
errors: string[];
|
|
339
|
-
}
|
|
340
|
-
interface PackageJson {
|
|
341
|
-
name?: string;
|
|
342
|
-
version?: string;
|
|
343
|
-
dependencies?: Record<string, string>;
|
|
344
|
-
devDependencies?: Record<string, string>;
|
|
345
|
-
peerDependencies?: Record<string, string>;
|
|
346
|
-
optionalDependencies?: Record<string, string>;
|
|
347
|
-
}
|
|
348
|
-
interface NpmRegistryResponse {
|
|
349
|
-
'dist-tags': {
|
|
350
|
-
latest: string;
|
|
351
|
-
[key: string]: string;
|
|
352
|
-
};
|
|
353
|
-
versions: Record<string, unknown>;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Parse version string, removing range operators
|
|
357
|
-
*/
|
|
358
|
-
declare function parseVersion(version: string): string;
|
|
359
|
-
/**
|
|
360
|
-
* Compare two semver versions
|
|
361
|
-
*/
|
|
362
|
-
declare function compareVersions(current: string, latest: string): 'major' | 'minor' | 'patch' | 'prerelease' | 'none';
|
|
363
|
-
/**
|
|
364
|
-
* Main function to check package.json for updates
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* // From URL
|
|
368
|
-
* const result = await checkPackage('https://raw.githubusercontent.com/user/repo/main/package.json');
|
|
369
|
-
*
|
|
370
|
-
* @example
|
|
371
|
-
* // From object
|
|
372
|
-
* const result = await checkPackage({
|
|
373
|
-
* name: 'my-package',
|
|
374
|
-
* dependencies: { 'lodash': '^4.17.0' }
|
|
375
|
-
* });
|
|
376
|
-
*
|
|
377
|
-
* @example
|
|
378
|
-
* // In Node.js, read file first
|
|
379
|
-
* import fs from 'fs';
|
|
380
|
-
* const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
|
|
381
|
-
* const result = await checkPackage(pkg);
|
|
382
|
-
*/
|
|
383
|
-
declare function checkPackage(source: string | PackageJson): Promise<PackageCheckResult>;
|
|
384
|
-
/**
|
|
385
|
-
* Format check result as human-readable string
|
|
386
|
-
*/
|
|
387
|
-
declare function formatPackageCheckResult(result: PackageCheckResult): string;
|
|
388
|
-
/**
|
|
389
|
-
* Generate ncu (npm-check-updates) command
|
|
390
|
-
*/
|
|
391
|
-
declare function generateNcuCommand(result: PackageCheckResult, options?: {
|
|
392
|
-
updateType?: 'major' | 'minor' | 'patch' | 'all';
|
|
393
|
-
interactive?: boolean;
|
|
394
|
-
upgrade?: boolean;
|
|
395
|
-
}): string;
|
|
396
|
-
/**
|
|
397
|
-
* Package check utilities for client-side usage
|
|
398
|
-
*/
|
|
399
|
-
declare const packageCheck: {
|
|
400
|
-
readonly check: typeof checkPackage;
|
|
401
|
-
readonly format: typeof formatPackageCheckResult;
|
|
402
|
-
readonly generateNcuCommand: typeof generateNcuCommand;
|
|
403
|
-
readonly parseVersion: typeof parseVersion;
|
|
404
|
-
readonly compareVersions: typeof compareVersions;
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
export { ApiUrlBuilder, type ApiUrlConfig, EventEmitter, type NpmRegistryResponse, type PackageCheckResult, type PackageJson, type 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 };
|
|
131
|
+
export { ApiUrlBuilder, type ApiUrlConfig, EventEmitter, appEvents, createApiEndpoints, createApiUrlBuilder, createEventEmitter };
|