@gnwebsoft/ui 3.0.8 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3OPVOWQK.js +140 -0
- package/dist/chunk-AEOF2TUF.cjs +2273 -0
- package/dist/chunk-ALHC7RLK.js +575 -0
- package/dist/chunk-BRRLB22L.js +72 -0
- package/dist/chunk-CHZU4PZB.js +2273 -0
- package/dist/chunk-EBRUE2WR.cjs +1 -1
- package/dist/chunk-HEHPKM4B.cjs +140 -0
- package/dist/chunk-K2EJ4YKO.cjs +72 -0
- package/dist/chunk-MVPLBJRK.cjs +1 -1
- package/dist/chunk-XY4U6A77.cjs +575 -0
- package/dist/components/index.cjs +1 -1
- package/dist/{enhanced-z-I7EHVS.d.cts → enhanced-CDTkKUlj.d.ts} +5 -5
- package/dist/{enhanced-z-I7EHVS.d.ts → enhanced-ZQoS03Cd.d.cts} +5 -5
- package/dist/events-BcHVCLBz.d.cts +77 -0
- package/dist/events-BcHVCLBz.d.ts +77 -0
- package/dist/hooks/index.cjs +3 -3
- package/dist/hooks/index.d.cts +3 -2
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +67 -6
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +65 -4
- package/dist/types/index.cjs +31 -2
- package/dist/types/index.d.cts +588 -1
- package/dist/types/index.d.ts +588 -1
- package/dist/types/index.js +30 -1
- package/dist/utils/index.cjs +37 -3
- package/dist/utils/index.d.cts +329 -13
- package/dist/utils/index.d.ts +329 -13
- package/dist/utils/index.js +35 -1
- package/dist/wrappers/index.cjs +4 -4
- package/dist/wrappers/index.d.cts +11 -9
- package/dist/wrappers/index.d.ts +11 -9
- package/dist/wrappers/index.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-4H3AFH7A.js +0 -505
- package/dist/chunk-DE62KYFK.js +0 -122
- package/dist/chunk-DEPJRTVT.js +0 -1
- package/dist/chunk-FD57PCAC.cjs +0 -1
- package/dist/chunk-JCXHX2PZ.js +0 -2265
- package/dist/chunk-MW2UCDTI.cjs +0 -2265
- package/dist/chunk-R2YK4LTT.cjs +0 -122
- package/dist/chunk-ZC7FGYL2.cjs +0 -505
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { GridSortModel } from '@mui/x-data-grid';
|
|
2
2
|
export { a as AsyncSelectMultiPayload, A as AsyncSelectPayload } from '../AsyncSelectPayload-B9-6l33R.js';
|
|
3
|
+
export { E as EventOrValue, F as FormChangeEvent, c as GenericEventHandler, G as GenericSyntheticEvent, H as HtmlSelectElement, a as InputChangeEvent, I as InputElement, S as SelectChangeEvent, b as TransformInputHandler, T as TransformOutputHandler, g as createEventValueExtractor, f as extractEventValue, e as isFormChangeEvent, i as isInputChangeEvent, d as isSelectChangeEvent } from '../events-BcHVCLBz.js';
|
|
4
|
+
import 'react';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Type definition for server validation errors structure.
|
|
@@ -213,6 +215,591 @@ interface OperationResponse {
|
|
|
213
215
|
rowsAffected: number;
|
|
214
216
|
}
|
|
215
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Type-safe API request and response utilities
|
|
220
|
+
* @module types/api
|
|
221
|
+
*/
|
|
222
|
+
/**
|
|
223
|
+
* HTTP methods supported by the API
|
|
224
|
+
*/
|
|
225
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
226
|
+
/**
|
|
227
|
+
* Valid JSON primitive types that can be sent in request bodies
|
|
228
|
+
*/
|
|
229
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
230
|
+
/**
|
|
231
|
+
* Valid JSON values (primitives, objects, arrays)
|
|
232
|
+
*/
|
|
233
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
234
|
+
/**
|
|
235
|
+
* JSON object with string keys and JSON values
|
|
236
|
+
*/
|
|
237
|
+
interface JsonObject {
|
|
238
|
+
[key: string]: JsonValue;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* JSON array containing JSON values
|
|
242
|
+
*/
|
|
243
|
+
type JsonArray = JsonValue[];
|
|
244
|
+
/**
|
|
245
|
+
* Type-safe request body - must be JSON-serializable
|
|
246
|
+
*/
|
|
247
|
+
type RequestBody = JsonObject | JsonArray | FormData;
|
|
248
|
+
/**
|
|
249
|
+
* Standard HTTP headers with known header names
|
|
250
|
+
*/
|
|
251
|
+
type HttpHeaders = Record<string, string>;
|
|
252
|
+
/**
|
|
253
|
+
* Options for making HTTP requests (based on fetch API)
|
|
254
|
+
*/
|
|
255
|
+
interface RequestOptions {
|
|
256
|
+
/**
|
|
257
|
+
* HTTP method for the request
|
|
258
|
+
*/
|
|
259
|
+
method: HttpMethod;
|
|
260
|
+
/**
|
|
261
|
+
* Request headers
|
|
262
|
+
*/
|
|
263
|
+
headers?: HttpHeaders;
|
|
264
|
+
/**
|
|
265
|
+
* Request body (string for JSON, FormData for file uploads)
|
|
266
|
+
*/
|
|
267
|
+
body?: string | FormData;
|
|
268
|
+
/**
|
|
269
|
+
* Request credentials mode
|
|
270
|
+
*/
|
|
271
|
+
credentials?: RequestCredentials;
|
|
272
|
+
/**
|
|
273
|
+
* Request mode (cors, no-cors, same-origin)
|
|
274
|
+
*/
|
|
275
|
+
mode?: RequestMode;
|
|
276
|
+
/**
|
|
277
|
+
* Cache mode for the request
|
|
278
|
+
*/
|
|
279
|
+
cache?: RequestCache;
|
|
280
|
+
/**
|
|
281
|
+
* Redirect mode for the request
|
|
282
|
+
*/
|
|
283
|
+
redirect?: RequestRedirect;
|
|
284
|
+
/**
|
|
285
|
+
* Referrer policy for the request
|
|
286
|
+
*/
|
|
287
|
+
referrerPolicy?: ReferrerPolicy;
|
|
288
|
+
/**
|
|
289
|
+
* AbortSignal for request cancellation
|
|
290
|
+
*/
|
|
291
|
+
signal?: AbortSignal;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Configuration options for API calls
|
|
295
|
+
*/
|
|
296
|
+
interface ApiCallOptions {
|
|
297
|
+
/**
|
|
298
|
+
* Custom headers to include in the request
|
|
299
|
+
*/
|
|
300
|
+
headers?: HttpHeaders;
|
|
301
|
+
/**
|
|
302
|
+
* Whether to include authentication token
|
|
303
|
+
* @defaultValue true
|
|
304
|
+
*/
|
|
305
|
+
includeAuth?: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* AbortSignal for request cancellation
|
|
308
|
+
*/
|
|
309
|
+
signal?: AbortSignal;
|
|
310
|
+
/**
|
|
311
|
+
* Custom base URL (overrides default)
|
|
312
|
+
*/
|
|
313
|
+
baseUrl?: string;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Options for fetch operations with any additional parameters
|
|
317
|
+
*/
|
|
318
|
+
interface FetchOptions extends Omit<RequestInit, 'body' | 'headers'> {
|
|
319
|
+
/**
|
|
320
|
+
* Request headers
|
|
321
|
+
*/
|
|
322
|
+
headers?: HttpHeaders;
|
|
323
|
+
/**
|
|
324
|
+
* Request body
|
|
325
|
+
*/
|
|
326
|
+
body?: RequestBody;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Type guard to check if a value is a valid JSON object
|
|
330
|
+
*/
|
|
331
|
+
declare function isJsonObject(value: unknown): value is JsonObject;
|
|
332
|
+
/**
|
|
333
|
+
* Type guard to check if a value is a valid JSON array
|
|
334
|
+
*/
|
|
335
|
+
declare function isJsonArray(value: unknown): value is JsonArray;
|
|
336
|
+
/**
|
|
337
|
+
* Type guard to check if a value is FormData
|
|
338
|
+
*/
|
|
339
|
+
declare function isFormData(value: unknown): value is FormData;
|
|
340
|
+
/**
|
|
341
|
+
* Type guard to check if a value is a valid request body
|
|
342
|
+
*/
|
|
343
|
+
declare function isRequestBody(value: unknown): value is RequestBody;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Utility types and type helpers for enhanced type safety
|
|
347
|
+
*
|
|
348
|
+
* @packageDocumentation
|
|
349
|
+
*/
|
|
350
|
+
/**
|
|
351
|
+
* Makes all properties of T required and non-nullable
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```typescript
|
|
355
|
+
* interface User {
|
|
356
|
+
* id?: string;
|
|
357
|
+
* name?: string | null;
|
|
358
|
+
* }
|
|
359
|
+
*
|
|
360
|
+
* type RequiredUser = DeepRequired<User>;
|
|
361
|
+
* // { id: string; name: string }
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* @public
|
|
365
|
+
*/
|
|
366
|
+
type DeepRequired<T> = {
|
|
367
|
+
[P in keyof T]-?: NonNullable<T[P]>;
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* Makes all properties of T optional
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```typescript
|
|
374
|
+
* interface User {
|
|
375
|
+
* id: string;
|
|
376
|
+
* name: string;
|
|
377
|
+
* }
|
|
378
|
+
*
|
|
379
|
+
* type PartialUser = DeepPartial<User>;
|
|
380
|
+
* // { id?: string; name?: string }
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
* @public
|
|
384
|
+
*/
|
|
385
|
+
type DeepPartial<T> = {
|
|
386
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
387
|
+
};
|
|
388
|
+
/**
|
|
389
|
+
* Makes all properties of T readonly deeply
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```typescript
|
|
393
|
+
* interface User {
|
|
394
|
+
* id: string;
|
|
395
|
+
* profile: {
|
|
396
|
+
* name: string;
|
|
397
|
+
* };
|
|
398
|
+
* }
|
|
399
|
+
*
|
|
400
|
+
* type ReadonlyUser = DeepReadonly<User>;
|
|
401
|
+
* // { readonly id: string; readonly profile: { readonly name: string } }
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* @public
|
|
405
|
+
*/
|
|
406
|
+
type DeepReadonly<T> = {
|
|
407
|
+
readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
|
|
408
|
+
};
|
|
409
|
+
/**
|
|
410
|
+
* Extracts keys from T that are not undefined
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```typescript
|
|
414
|
+
* interface User {
|
|
415
|
+
* id: string;
|
|
416
|
+
* name?: string;
|
|
417
|
+
* email: string | undefined;
|
|
418
|
+
* }
|
|
419
|
+
*
|
|
420
|
+
* type RequiredKeys = RequiredKeys<User>;
|
|
421
|
+
* // 'id'
|
|
422
|
+
* ```
|
|
423
|
+
*
|
|
424
|
+
* @public
|
|
425
|
+
*/
|
|
426
|
+
type RequiredKeys<T> = {
|
|
427
|
+
[K in keyof T]-?: undefined extends T[K] ? never : K;
|
|
428
|
+
}[keyof T];
|
|
429
|
+
/**
|
|
430
|
+
* Extracts keys from T that can be undefined
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* interface User {
|
|
435
|
+
* id: string;
|
|
436
|
+
* name?: string;
|
|
437
|
+
* email: string | undefined;
|
|
438
|
+
* }
|
|
439
|
+
*
|
|
440
|
+
* type OptKeys = OptionalKeys<User>;
|
|
441
|
+
* // 'name' | 'email'
|
|
442
|
+
* ```
|
|
443
|
+
*
|
|
444
|
+
* @public
|
|
445
|
+
*/
|
|
446
|
+
type OptionalKeys<T> = {
|
|
447
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
448
|
+
}[keyof T];
|
|
449
|
+
/**
|
|
450
|
+
* Makes specified keys K of type T required
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* interface User {
|
|
455
|
+
* id?: string;
|
|
456
|
+
* name?: string;
|
|
457
|
+
* email?: string;
|
|
458
|
+
* }
|
|
459
|
+
*
|
|
460
|
+
* type UserWithId = RequireKeys<User, 'id' | 'email'>;
|
|
461
|
+
* // { id: string; name?: string; email: string }
|
|
462
|
+
* ```
|
|
463
|
+
*
|
|
464
|
+
* @public
|
|
465
|
+
*/
|
|
466
|
+
type RequireKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
467
|
+
/**
|
|
468
|
+
* Makes specified keys K of type T optional
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```typescript
|
|
472
|
+
* interface User {
|
|
473
|
+
* id: string;
|
|
474
|
+
* name: string;
|
|
475
|
+
* email: string;
|
|
476
|
+
* }
|
|
477
|
+
*
|
|
478
|
+
* type UserUpdate = PartialKeys<User, 'name' | 'email'>;
|
|
479
|
+
* // { id: string; name?: string; email?: string }
|
|
480
|
+
* ```
|
|
481
|
+
*
|
|
482
|
+
* @public
|
|
483
|
+
*/
|
|
484
|
+
type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
485
|
+
/**
|
|
486
|
+
* Excludes keys K from type T
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* ```typescript
|
|
490
|
+
* interface User {
|
|
491
|
+
* id: string;
|
|
492
|
+
* password: string;
|
|
493
|
+
* email: string;
|
|
494
|
+
* }
|
|
495
|
+
*
|
|
496
|
+
* type PublicUser = ExcludeKeys<User, 'password'>;
|
|
497
|
+
* // { id: string; email: string }
|
|
498
|
+
* ```
|
|
499
|
+
*
|
|
500
|
+
* @public
|
|
501
|
+
*/
|
|
502
|
+
type ExcludeKeys<T, K extends keyof T> = Omit<T, K>;
|
|
503
|
+
/**
|
|
504
|
+
* Picks only keys K from type T
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```typescript
|
|
508
|
+
* interface User {
|
|
509
|
+
* id: string;
|
|
510
|
+
* name: string;
|
|
511
|
+
* email: string;
|
|
512
|
+
* }
|
|
513
|
+
*
|
|
514
|
+
* type UserCredentials = PickKeys<User, 'email'>;
|
|
515
|
+
* // { email: string }
|
|
516
|
+
* ```
|
|
517
|
+
*
|
|
518
|
+
* @public
|
|
519
|
+
*/
|
|
520
|
+
type PickKeys<T, K extends keyof T> = Pick<T, K>;
|
|
521
|
+
/**
|
|
522
|
+
* Extracts the value type from an array type
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* ```typescript
|
|
526
|
+
* type StringArray = string[];
|
|
527
|
+
* type Item = ArrayElement<StringArray>;
|
|
528
|
+
* // string
|
|
529
|
+
* ```
|
|
530
|
+
*
|
|
531
|
+
* @public
|
|
532
|
+
*/
|
|
533
|
+
type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
|
|
534
|
+
/**
|
|
535
|
+
* Extracts the return type of an async function
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* ```typescript
|
|
539
|
+
* async function getUser(): Promise<User> {
|
|
540
|
+
* return { id: '1', name: 'John' };
|
|
541
|
+
* }
|
|
542
|
+
*
|
|
543
|
+
* type User = AsyncReturnType<typeof getUser>;
|
|
544
|
+
* // User
|
|
545
|
+
* ```
|
|
546
|
+
*
|
|
547
|
+
* @public
|
|
548
|
+
*/
|
|
549
|
+
type AsyncReturnType<T extends (...args: readonly unknown[]) => Promise<unknown>> = T extends (...args: readonly unknown[]) => Promise<infer R> ? R : never;
|
|
550
|
+
/**
|
|
551
|
+
* Makes a type nullable (adds null)
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```typescript
|
|
555
|
+
* type Username = string;
|
|
556
|
+
* type NullableUsername = Nullable<Username>;
|
|
557
|
+
* // string | null
|
|
558
|
+
* ```
|
|
559
|
+
*
|
|
560
|
+
* @public
|
|
561
|
+
*/
|
|
562
|
+
type Nullable<T> = T | null;
|
|
563
|
+
/**
|
|
564
|
+
* Makes a type optional (adds undefined)
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```typescript
|
|
568
|
+
* type Username = string;
|
|
569
|
+
* type OptionalUsername = Maybe<Username>;
|
|
570
|
+
* // string | undefined
|
|
571
|
+
* ```
|
|
572
|
+
*
|
|
573
|
+
* @public
|
|
574
|
+
*/
|
|
575
|
+
type Maybe<T> = T | undefined;
|
|
576
|
+
/**
|
|
577
|
+
* Makes a type nullish (adds null and undefined)
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* ```typescript
|
|
581
|
+
* type Username = string;
|
|
582
|
+
* type NullishUsername = Nullish<Username>;
|
|
583
|
+
* // string | null | undefined
|
|
584
|
+
* ```
|
|
585
|
+
*
|
|
586
|
+
* @public
|
|
587
|
+
*/
|
|
588
|
+
type Nullish<T> = T | null | undefined;
|
|
589
|
+
/**
|
|
590
|
+
* Creates a union of all possible paths through an object type
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```typescript
|
|
594
|
+
* interface User {
|
|
595
|
+
* profile: {
|
|
596
|
+
* name: string;
|
|
597
|
+
* address: {
|
|
598
|
+
* city: string;
|
|
599
|
+
* };
|
|
600
|
+
* };
|
|
601
|
+
* }
|
|
602
|
+
*
|
|
603
|
+
* type Paths = ObjectPaths<User>;
|
|
604
|
+
* // 'profile' | 'profile.name' | 'profile.address' | 'profile.address.city'
|
|
605
|
+
* ```
|
|
606
|
+
*
|
|
607
|
+
* @public
|
|
608
|
+
*/
|
|
609
|
+
type ObjectPaths<T> = {
|
|
610
|
+
[K in keyof T & string]: T[K] extends object ? K | `${K}.${ObjectPaths<T[K]>}` : K;
|
|
611
|
+
}[keyof T & string];
|
|
612
|
+
/**
|
|
613
|
+
* Merges two types, with properties from B overriding those in A
|
|
614
|
+
*
|
|
615
|
+
* @example
|
|
616
|
+
* ```typescript
|
|
617
|
+
* interface A {
|
|
618
|
+
* id: number;
|
|
619
|
+
* name: string;
|
|
620
|
+
* }
|
|
621
|
+
*
|
|
622
|
+
* interface B {
|
|
623
|
+
* id: string;
|
|
624
|
+
* email: string;
|
|
625
|
+
* }
|
|
626
|
+
*
|
|
627
|
+
* type Merged = Merge<A, B>;
|
|
628
|
+
* // { id: string; name: string; email: string }
|
|
629
|
+
* ```
|
|
630
|
+
*
|
|
631
|
+
* @public
|
|
632
|
+
*/
|
|
633
|
+
type Merge<A, B> = Omit<A, keyof B> & B;
|
|
634
|
+
/**
|
|
635
|
+
* Ensures a type is serializable (no functions, symbols, undefined)
|
|
636
|
+
*
|
|
637
|
+
* @example
|
|
638
|
+
* ```typescript
|
|
639
|
+
* interface Data {
|
|
640
|
+
* id: string;
|
|
641
|
+
* callback: () => void;
|
|
642
|
+
* value: number;
|
|
643
|
+
* }
|
|
644
|
+
*
|
|
645
|
+
* type SerializableData = Serializable<Data>;
|
|
646
|
+
* // { id: string; value: number }
|
|
647
|
+
* ```
|
|
648
|
+
*
|
|
649
|
+
* @public
|
|
650
|
+
*/
|
|
651
|
+
type Serializable<T> = {
|
|
652
|
+
[K in keyof T as T[K] extends (...args: readonly unknown[]) => unknown ? never : T[K] extends symbol ? never : T[K] extends undefined ? never : K]: T[K] extends object ? Serializable<T[K]> : T[K];
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* Converts a union type to an intersection type
|
|
656
|
+
*
|
|
657
|
+
* @example
|
|
658
|
+
* ```typescript
|
|
659
|
+
* type Union = { a: string } | { b: number };
|
|
660
|
+
* type Intersection = UnionToIntersection<Union>;
|
|
661
|
+
* // { a: string } & { b: number }
|
|
662
|
+
* ```
|
|
663
|
+
*
|
|
664
|
+
* @public
|
|
665
|
+
*/
|
|
666
|
+
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
667
|
+
/**
|
|
668
|
+
* Gets all keys of T whose values extend V
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* ```typescript
|
|
672
|
+
* interface User {
|
|
673
|
+
* id: string;
|
|
674
|
+
* age: number;
|
|
675
|
+
* name: string;
|
|
676
|
+
* active: boolean;
|
|
677
|
+
* }
|
|
678
|
+
*
|
|
679
|
+
* type StringKeys = KeysOfType<User, string>;
|
|
680
|
+
* // 'id' | 'name'
|
|
681
|
+
* ```
|
|
682
|
+
*
|
|
683
|
+
* @public
|
|
684
|
+
*/
|
|
685
|
+
type KeysOfType<T, V> = {
|
|
686
|
+
[K in keyof T]: T[K] extends V ? K : never;
|
|
687
|
+
}[keyof T];
|
|
688
|
+
/**
|
|
689
|
+
* Ensures a value is exactly the type T (no wider types allowed)
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* ```typescript
|
|
693
|
+
* const config: Exact<{ debug: boolean }> = {
|
|
694
|
+
* debug: true,
|
|
695
|
+
* // extra: 'value' // ❌ Error: extra property not allowed
|
|
696
|
+
* };
|
|
697
|
+
* ```
|
|
698
|
+
*
|
|
699
|
+
* @public
|
|
700
|
+
*/
|
|
701
|
+
type Exact<T, Shape = T> = T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? T : never : never;
|
|
702
|
+
/**
|
|
703
|
+
* Creates a branded type for nominal typing
|
|
704
|
+
* This prevents mixing values of the same primitive type
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* ```typescript
|
|
708
|
+
* type UserId = Brand<string, 'UserId'>;
|
|
709
|
+
* type ProductId = Brand<string, 'ProductId'>;
|
|
710
|
+
*
|
|
711
|
+
* const userId: UserId = '123' as UserId;
|
|
712
|
+
* const productId: ProductId = '456' as ProductId;
|
|
713
|
+
*
|
|
714
|
+
* // ❌ Type error: UserId is not assignable to ProductId
|
|
715
|
+
* const test: ProductId = userId;
|
|
716
|
+
* ```
|
|
717
|
+
*
|
|
718
|
+
* @public
|
|
719
|
+
*/
|
|
720
|
+
type Brand<T, TBrand extends string> = T & {
|
|
721
|
+
readonly __brand: TBrand;
|
|
722
|
+
};
|
|
723
|
+
/**
|
|
724
|
+
* Helper to create a branded value
|
|
725
|
+
*
|
|
726
|
+
* @param value - The value to brand
|
|
727
|
+
* @returns The value as a branded type
|
|
728
|
+
*
|
|
729
|
+
* @example
|
|
730
|
+
* ```typescript
|
|
731
|
+
* type UserId = Brand<string, 'UserId'>;
|
|
732
|
+
* const id = brand<string, 'UserId'>('user-123');
|
|
733
|
+
* // id has type UserId
|
|
734
|
+
* ```
|
|
735
|
+
*
|
|
736
|
+
* @public
|
|
737
|
+
*/
|
|
738
|
+
declare function brand<T, TBrand extends string>(value: T): Brand<T, TBrand>;
|
|
739
|
+
/**
|
|
740
|
+
* Removes branding from a branded type
|
|
741
|
+
*
|
|
742
|
+
* @example
|
|
743
|
+
* ```typescript
|
|
744
|
+
* type UserId = Brand<string, 'UserId'>;
|
|
745
|
+
* type PlainId = Unbrand<UserId>;
|
|
746
|
+
* // string
|
|
747
|
+
* ```
|
|
748
|
+
*
|
|
749
|
+
* @public
|
|
750
|
+
*/
|
|
751
|
+
type Unbrand<T> = T extends infer U & {
|
|
752
|
+
readonly __brand: string;
|
|
753
|
+
} ? U : T;
|
|
754
|
+
/**
|
|
755
|
+
* Type-safe Object.keys that preserves key types
|
|
756
|
+
*
|
|
757
|
+
* @param obj - The object to get keys from
|
|
758
|
+
* @returns Array of keys with proper type
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* ```typescript
|
|
762
|
+
* const user = { id: '1', name: 'John' } as const;
|
|
763
|
+
* const keys = typedKeys(user);
|
|
764
|
+
* // keys has type: ('id' | 'name')[]
|
|
765
|
+
* ```
|
|
766
|
+
*
|
|
767
|
+
* @public
|
|
768
|
+
*/
|
|
769
|
+
declare function typedKeys<T extends Record<string, unknown>>(obj: T): Array<keyof T>;
|
|
770
|
+
/**
|
|
771
|
+
* Type-safe Object.entries that preserves key and value types
|
|
772
|
+
*
|
|
773
|
+
* @param obj - The object to get entries from
|
|
774
|
+
* @returns Array of [key, value] tuples with proper types
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* ```typescript
|
|
778
|
+
* const user = { id: '1', age: 30 } as const;
|
|
779
|
+
* const entries = typedEntries(user);
|
|
780
|
+
* // entries has type: ['id', '1'] | ['age', 30]
|
|
781
|
+
* ```
|
|
782
|
+
*
|
|
783
|
+
* @public
|
|
784
|
+
*/
|
|
785
|
+
declare function typedEntries<T extends Record<string, unknown>>(obj: T): Array<[keyof T, T[keyof T]]>;
|
|
786
|
+
/**
|
|
787
|
+
* Type-safe Object.values that preserves value types
|
|
788
|
+
*
|
|
789
|
+
* @param obj - The object to get values from
|
|
790
|
+
* @returns Array of values with proper type
|
|
791
|
+
*
|
|
792
|
+
* @example
|
|
793
|
+
* ```typescript
|
|
794
|
+
* const user = { id: '1', age: 30 };
|
|
795
|
+
* const values = typedValues(user);
|
|
796
|
+
* // values has type: (string | number)[]
|
|
797
|
+
* ```
|
|
798
|
+
*
|
|
799
|
+
* @public
|
|
800
|
+
*/
|
|
801
|
+
declare function typedValues<T extends Record<string, unknown>>(obj: T): Array<T[keyof T]>;
|
|
802
|
+
|
|
216
803
|
interface PostModel<TFilterModel> {
|
|
217
804
|
filterModel?: TFilterModel;
|
|
218
805
|
pageOffset: number;
|
|
@@ -230,4 +817,4 @@ interface ValueLabel {
|
|
|
230
817
|
Label: string;
|
|
231
818
|
}
|
|
232
819
|
|
|
233
|
-
export type
|
|
820
|
+
export { type ApiCallOptions, type ApiResponse, type ArrayElement, type AsyncMultiSelectPayload, type AsyncReturnType, type Brand, type DeepPartial, type DeepReadonly, type DeepRequired, type Exact, type ExcludeKeys, type FetchOptions, type HttpHeaders, type HttpMethod, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type KeysOfType, type ListResponse, type Maybe, type Merge, type Nullable, type Nullish, type ObjectPaths, type OperationResponse, type OptionItem, type OptionItem2, type OptionalKeys, type PartialKeys, type PickKeys, type PostModel, type RequestBody, type RequestOptions, type RequireKeys, type RequiredKeys, type Serializable, type Unbrand, type UnionToIntersection, type ValidationErrors, type ValueLabel, brand, isFormData, isJsonArray, isJsonObject, isRequestBody, typedEntries, typedKeys, typedValues };
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
brand,
|
|
3
|
+
createEventValueExtractor,
|
|
4
|
+
extractEventValue,
|
|
5
|
+
isFormChangeEvent,
|
|
6
|
+
isFormData,
|
|
7
|
+
isInputChangeEvent,
|
|
8
|
+
isJsonArray,
|
|
9
|
+
isJsonObject,
|
|
10
|
+
isRequestBody,
|
|
11
|
+
isSelectChangeEvent,
|
|
12
|
+
typedEntries,
|
|
13
|
+
typedKeys,
|
|
14
|
+
typedValues
|
|
15
|
+
} from "../chunk-BRRLB22L.js";
|
|
16
|
+
export {
|
|
17
|
+
brand,
|
|
18
|
+
createEventValueExtractor,
|
|
19
|
+
extractEventValue,
|
|
20
|
+
isFormChangeEvent,
|
|
21
|
+
isFormData,
|
|
22
|
+
isInputChangeEvent,
|
|
23
|
+
isJsonArray,
|
|
24
|
+
isJsonObject,
|
|
25
|
+
isRequestBody,
|
|
26
|
+
isSelectChangeEvent,
|
|
27
|
+
typedEntries,
|
|
28
|
+
typedKeys,
|
|
29
|
+
typedValues
|
|
30
|
+
};
|
|
2
31
|
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
|
package/dist/utils/index.cjs
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var _chunkZC7FGYL2cjs = require('../chunk-ZC7FGYL2.cjs');
|
|
23
22
|
|
|
24
23
|
|
|
25
24
|
|
|
@@ -37,9 +36,44 @@ var _chunkZC7FGYL2cjs = require('../chunk-ZC7FGYL2.cjs');
|
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
|
|
39
|
+
var _chunkXY4U6A77cjs = require('../chunk-XY4U6A77.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
exports.api = _chunkXY4U6A77cjs.api; exports.api2 = _chunkXY4U6A77cjs.api2; exports.flattenObjectKeys = _chunkXY4U6A77cjs.flattenObjectKeys; exports.getTimezone = _chunkXY4U6A77cjs.getTimezone; exports.handleServerErrors = _chunkXY4U6A77cjs.handleServerErrors; exports.hasProperty = _chunkXY4U6A77cjs.hasProperty; exports.isArray = _chunkXY4U6A77cjs.isArray; exports.isBoolean = _chunkXY4U6A77cjs.isBoolean; exports.isDate = _chunkXY4U6A77cjs.isDate; exports.isDefined = _chunkXY4U6A77cjs.isDefined; exports.isError = _chunkXY4U6A77cjs.isError; exports.isFunction = _chunkXY4U6A77cjs.isFunction; exports.isNonEmptyArray = _chunkXY4U6A77cjs.isNonEmptyArray; exports.isNonEmptyString = _chunkXY4U6A77cjs.isNonEmptyString; exports.isNull = _chunkXY4U6A77cjs.isNull; exports.isNullish = _chunkXY4U6A77cjs.isNullish; exports.isNumber = _chunkXY4U6A77cjs.isNumber; exports.isPromise = _chunkXY4U6A77cjs.isPromise; exports.isRecord = _chunkXY4U6A77cjs.isRecord; exports.isString = _chunkXY4U6A77cjs.isString; exports.isUndefined = _chunkXY4U6A77cjs.isUndefined; exports.matches = _chunkXY4U6A77cjs.matches; exports.propertyExists = _chunkXY4U6A77cjs.propertyExists; exports.readValueAsDate = _chunkXY4U6A77cjs.readValueAsDate; exports.removeLeadingTrailingSlashes = _chunkXY4U6A77cjs.removeLeadingTrailingSlashes; exports.schemaTools = _chunkXY4U6A77cjs.schemaTools; exports.typedWatch = _chunkXY4U6A77cjs.typedWatch; exports.useWatchBatch = _chunkXY4U6A77cjs.useWatchBatch; exports.useWatchBoolean = _chunkXY4U6A77cjs.useWatchBoolean; exports.useWatchConditional = _chunkXY4U6A77cjs.useWatchConditional; exports.useWatchDebounced = _chunkXY4U6A77cjs.useWatchDebounced; exports.useWatchDefault = _chunkXY4U6A77cjs.useWatchDefault; exports.useWatchField = _chunkXY4U6A77cjs.useWatchField; exports.useWatchFields = _chunkXY4U6A77cjs.useWatchFields; exports.useWatchForm = _chunkXY4U6A77cjs.useWatchForm; exports.useWatchSelector = _chunkXY4U6A77cjs.useWatchSelector; exports.useWatchTransform = _chunkXY4U6A77cjs.useWatchTransform;
|
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9idWlsZHMvbGlicy9HTldlYlNvZnQuVUkvcGFja2FnZXMvdWkvZGlzdC91dGlscy9pbmRleC5janMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDRTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNGLHlEQUE4QjtBQUM5QjtBQUNFO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0YscytEQUFDIiwiZmlsZSI6Ii9idWlsZHMvbGlicy9HTldlYlNvZnQuVUkvcGFja2FnZXMvdWkvZGlzdC91dGlscy9pbmRleC5janMifQ==
|