@carbonorm/carbonreact 3.0.2 → 3.0.5
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/hoc/deleteRestfulObjectArrays.d.ts +2 -2
- package/dist/hoc/updateRestfulObjectArrays.d.ts +2 -2
- package/dist/index.cjs.js +1272 -155
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1261 -156
- package/dist/index.esm.js.map +1 -1
- package/dist/variables/C6.d.ts +370 -3
- package/package.json +1 -1
- package/src/hoc/KeysMatching.ts +1 -2
- package/src/hoc/deleteRestfulObjectArrays.tsx +46 -8
- package/src/hoc/updateRestfulObjectArrays.tsx +42 -13
- package/src/variables/C6.tsx +1593 -121
package/dist/variables/C6.d.ts
CHANGED
|
@@ -16,11 +16,12 @@ export interface iTypeValidation {
|
|
|
16
16
|
AUTO_INCREMENT: boolean;
|
|
17
17
|
SKIP_COLUMN_IN_POST: boolean;
|
|
18
18
|
}
|
|
19
|
-
export type RestTableNames = 'carbon_carbons' | 'carbon_comments' | 'carbon_documentation' | 'carbon_feature_group_references' | 'carbon_features' | 'carbon_group_references' | 'carbon_groups' | 'carbon_history_logs' | 'carbon_location_references' | 'carbon_locations' | 'carbon_photos' | 'carbon_reports' | 'carbon_user_followers' | 'carbon_user_groups' | 'carbon_user_messages' | 'carbon_user_sessions' | 'carbon_user_tasks' | 'carbon_users';
|
|
20
|
-
export type RestShortTableNames = 'carbons' | 'comments' | 'documentation' | 'feature_group_references' | 'features' | 'group_references' | 'groups' | 'history_logs' | 'location_references' | 'locations' | 'photos' | 'reports' | 'user_followers' | 'user_groups' | 'user_messages' | 'user_sessions' | 'user_tasks' | 'users';
|
|
19
|
+
export type RestTableNames = 'carbon_carbons' | 'carbon_comments' | 'carbon_documentation' | 'carbon_feature_group_references' | 'carbon_features' | 'carbon_group_references' | 'carbon_groups' | 'carbon_history_logs' | 'carbon_location_references' | 'carbon_locations' | 'carbon_photos' | 'carbon_reports' | 'carbon_user_followers' | 'carbon_user_groups' | 'carbon_user_messages' | 'carbon_user_sessions' | 'carbon_user_tasks' | 'carbon_users' | 'carbon_wp_commentmeta' | 'carbon_wp_comments' | 'carbon_wp_links' | 'carbon_wp_options' | 'carbon_wp_postmeta' | 'carbon_wp_posts' | 'carbon_wp_term_relationships' | 'carbon_wp_term_taxonomy' | 'carbon_wp_termmeta' | 'carbon_wp_terms' | 'carbon_wp_usermeta' | 'carbon_wp_users';
|
|
20
|
+
export type RestShortTableNames = 'carbons' | 'comments' | 'documentation' | 'feature_group_references' | 'features' | 'group_references' | 'groups' | 'history_logs' | 'location_references' | 'locations' | 'photos' | 'reports' | 'user_followers' | 'user_groups' | 'user_messages' | 'user_sessions' | 'user_tasks' | 'users' | 'wp_commentmeta' | 'wp_comments' | 'wp_links' | 'wp_options' | 'wp_postmeta' | 'wp_posts' | 'wp_term_relationships' | 'wp_term_taxonomy' | 'wp_termmeta' | 'wp_terms' | 'wp_usermeta' | 'wp_users';
|
|
21
21
|
export interface C6RestfulModel {
|
|
22
22
|
TABLE_NAME: RestShortTableNames;
|
|
23
23
|
PRIMARY: string[];
|
|
24
|
+
PRIMARY_SHORT: string[];
|
|
24
25
|
COLUMNS: stringMap;
|
|
25
26
|
REGEX_VALIDATION: RegExpMap;
|
|
26
27
|
TYPE_VALIDATION: {
|
|
@@ -317,6 +318,254 @@ interface iDefineUsers {
|
|
|
317
318
|
'USER_CREATION_DATE': string;
|
|
318
319
|
}
|
|
319
320
|
export declare const users: C6RestfulModel & iDefineUsers;
|
|
321
|
+
export interface iWp_Commentmeta {
|
|
322
|
+
'meta_id'?: number;
|
|
323
|
+
'comment_id'?: number;
|
|
324
|
+
'meta_key'?: string;
|
|
325
|
+
'meta_value'?: string;
|
|
326
|
+
}
|
|
327
|
+
interface iDefineWp_Commentmeta {
|
|
328
|
+
'META_ID': string;
|
|
329
|
+
'COMMENT_ID': string;
|
|
330
|
+
'META_KEY': string;
|
|
331
|
+
'META_VALUE': string;
|
|
332
|
+
}
|
|
333
|
+
export declare const wp_commentmeta: C6RestfulModel & iDefineWp_Commentmeta;
|
|
334
|
+
export interface iWp_Comments {
|
|
335
|
+
'comment_ID'?: number;
|
|
336
|
+
'comment_post_ID'?: number;
|
|
337
|
+
'comment_author'?: string;
|
|
338
|
+
'comment_author_email'?: string;
|
|
339
|
+
'comment_author_url'?: string;
|
|
340
|
+
'comment_author_IP'?: string;
|
|
341
|
+
'comment_date'?: string;
|
|
342
|
+
'comment_date_gmt'?: string;
|
|
343
|
+
'comment_content'?: string;
|
|
344
|
+
'comment_karma'?: number;
|
|
345
|
+
'comment_approved'?: string;
|
|
346
|
+
'comment_agent'?: string;
|
|
347
|
+
'comment_type'?: string;
|
|
348
|
+
'comment_parent'?: number;
|
|
349
|
+
'user_id'?: number;
|
|
350
|
+
}
|
|
351
|
+
interface iDefineWp_Comments {
|
|
352
|
+
'COMMENT_ID': string;
|
|
353
|
+
'COMMENT_POST_ID': string;
|
|
354
|
+
'COMMENT_AUTHOR': string;
|
|
355
|
+
'COMMENT_AUTHOR_EMAIL': string;
|
|
356
|
+
'COMMENT_AUTHOR_URL': string;
|
|
357
|
+
'COMMENT_AUTHOR_IP': string;
|
|
358
|
+
'COMMENT_DATE': string;
|
|
359
|
+
'COMMENT_DATE_GMT': string;
|
|
360
|
+
'COMMENT_CONTENT': string;
|
|
361
|
+
'COMMENT_KARMA': string;
|
|
362
|
+
'COMMENT_APPROVED': string;
|
|
363
|
+
'COMMENT_AGENT': string;
|
|
364
|
+
'COMMENT_TYPE': string;
|
|
365
|
+
'COMMENT_PARENT': string;
|
|
366
|
+
'USER_ID': string;
|
|
367
|
+
}
|
|
368
|
+
export declare const wp_comments: C6RestfulModel & iDefineWp_Comments;
|
|
369
|
+
export interface iWp_Links {
|
|
370
|
+
'link_id'?: number;
|
|
371
|
+
'link_url'?: string;
|
|
372
|
+
'link_name'?: string;
|
|
373
|
+
'link_image'?: string;
|
|
374
|
+
'link_target'?: string;
|
|
375
|
+
'link_description'?: string;
|
|
376
|
+
'link_visible'?: string;
|
|
377
|
+
'link_owner'?: number;
|
|
378
|
+
'link_rating'?: number;
|
|
379
|
+
'link_updated'?: string;
|
|
380
|
+
'link_rel'?: string;
|
|
381
|
+
'link_notes'?: string;
|
|
382
|
+
'link_rss'?: string;
|
|
383
|
+
}
|
|
384
|
+
interface iDefineWp_Links {
|
|
385
|
+
'LINK_ID': string;
|
|
386
|
+
'LINK_URL': string;
|
|
387
|
+
'LINK_NAME': string;
|
|
388
|
+
'LINK_IMAGE': string;
|
|
389
|
+
'LINK_TARGET': string;
|
|
390
|
+
'LINK_DESCRIPTION': string;
|
|
391
|
+
'LINK_VISIBLE': string;
|
|
392
|
+
'LINK_OWNER': string;
|
|
393
|
+
'LINK_RATING': string;
|
|
394
|
+
'LINK_UPDATED': string;
|
|
395
|
+
'LINK_REL': string;
|
|
396
|
+
'LINK_NOTES': string;
|
|
397
|
+
'LINK_RSS': string;
|
|
398
|
+
}
|
|
399
|
+
export declare const wp_links: C6RestfulModel & iDefineWp_Links;
|
|
400
|
+
export interface iWp_Options {
|
|
401
|
+
'option_id'?: number;
|
|
402
|
+
'option_name'?: string;
|
|
403
|
+
'option_value'?: string;
|
|
404
|
+
'autoload'?: string;
|
|
405
|
+
}
|
|
406
|
+
interface iDefineWp_Options {
|
|
407
|
+
'OPTION_ID': string;
|
|
408
|
+
'OPTION_NAME': string;
|
|
409
|
+
'OPTION_VALUE': string;
|
|
410
|
+
'AUTOLOAD': string;
|
|
411
|
+
}
|
|
412
|
+
export declare const wp_options: C6RestfulModel & iDefineWp_Options;
|
|
413
|
+
export interface iWp_Postmeta {
|
|
414
|
+
'meta_id'?: number;
|
|
415
|
+
'post_id'?: number;
|
|
416
|
+
'meta_key'?: string;
|
|
417
|
+
'meta_value'?: string;
|
|
418
|
+
}
|
|
419
|
+
interface iDefineWp_Postmeta {
|
|
420
|
+
'META_ID': string;
|
|
421
|
+
'POST_ID': string;
|
|
422
|
+
'META_KEY': string;
|
|
423
|
+
'META_VALUE': string;
|
|
424
|
+
}
|
|
425
|
+
export declare const wp_postmeta: C6RestfulModel & iDefineWp_Postmeta;
|
|
426
|
+
export interface iWp_Posts {
|
|
427
|
+
'ID'?: number;
|
|
428
|
+
'post_author'?: number;
|
|
429
|
+
'post_date'?: string;
|
|
430
|
+
'post_date_gmt'?: string;
|
|
431
|
+
'post_content'?: string;
|
|
432
|
+
'post_title'?: string;
|
|
433
|
+
'post_excerpt'?: string;
|
|
434
|
+
'post_status'?: string;
|
|
435
|
+
'comment_status'?: string;
|
|
436
|
+
'ping_status'?: string;
|
|
437
|
+
'post_password'?: string;
|
|
438
|
+
'post_name'?: string;
|
|
439
|
+
'to_ping'?: string;
|
|
440
|
+
'pinged'?: string;
|
|
441
|
+
'post_modified'?: string;
|
|
442
|
+
'post_modified_gmt'?: string;
|
|
443
|
+
'post_content_filtered'?: string;
|
|
444
|
+
'post_parent'?: number;
|
|
445
|
+
'guid'?: string;
|
|
446
|
+
'menu_order'?: number;
|
|
447
|
+
'post_type'?: string;
|
|
448
|
+
'post_mime_type'?: string;
|
|
449
|
+
'comment_count'?: number;
|
|
450
|
+
}
|
|
451
|
+
interface iDefineWp_Posts {
|
|
452
|
+
'ID': string;
|
|
453
|
+
'POST_AUTHOR': string;
|
|
454
|
+
'POST_DATE': string;
|
|
455
|
+
'POST_DATE_GMT': string;
|
|
456
|
+
'POST_CONTENT': string;
|
|
457
|
+
'POST_TITLE': string;
|
|
458
|
+
'POST_EXCERPT': string;
|
|
459
|
+
'POST_STATUS': string;
|
|
460
|
+
'COMMENT_STATUS': string;
|
|
461
|
+
'PING_STATUS': string;
|
|
462
|
+
'POST_PASSWORD': string;
|
|
463
|
+
'POST_NAME': string;
|
|
464
|
+
'TO_PING': string;
|
|
465
|
+
'PINGED': string;
|
|
466
|
+
'POST_MODIFIED': string;
|
|
467
|
+
'POST_MODIFIED_GMT': string;
|
|
468
|
+
'POST_CONTENT_FILTERED': string;
|
|
469
|
+
'POST_PARENT': string;
|
|
470
|
+
'GUID': string;
|
|
471
|
+
'MENU_ORDER': string;
|
|
472
|
+
'POST_TYPE': string;
|
|
473
|
+
'POST_MIME_TYPE': string;
|
|
474
|
+
'COMMENT_COUNT': string;
|
|
475
|
+
}
|
|
476
|
+
export declare const wp_posts: C6RestfulModel & iDefineWp_Posts;
|
|
477
|
+
export interface iWp_Term_Relationships {
|
|
478
|
+
'object_id'?: number;
|
|
479
|
+
'term_taxonomy_id'?: number;
|
|
480
|
+
'term_order'?: number;
|
|
481
|
+
}
|
|
482
|
+
interface iDefineWp_Term_Relationships {
|
|
483
|
+
'OBJECT_ID': string;
|
|
484
|
+
'TERM_TAXONOMY_ID': string;
|
|
485
|
+
'TERM_ORDER': string;
|
|
486
|
+
}
|
|
487
|
+
export declare const wp_term_relationships: C6RestfulModel & iDefineWp_Term_Relationships;
|
|
488
|
+
export interface iWp_Term_Taxonomy {
|
|
489
|
+
'term_taxonomy_id'?: number;
|
|
490
|
+
'term_id'?: number;
|
|
491
|
+
'taxonomy'?: string;
|
|
492
|
+
'description'?: string;
|
|
493
|
+
'parent'?: number;
|
|
494
|
+
'count'?: number;
|
|
495
|
+
}
|
|
496
|
+
interface iDefineWp_Term_Taxonomy {
|
|
497
|
+
'TERM_TAXONOMY_ID': string;
|
|
498
|
+
'TERM_ID': string;
|
|
499
|
+
'TAXONOMY': string;
|
|
500
|
+
'DESCRIPTION': string;
|
|
501
|
+
'PARENT': string;
|
|
502
|
+
'COUNT': string;
|
|
503
|
+
}
|
|
504
|
+
export declare const wp_term_taxonomy: C6RestfulModel & iDefineWp_Term_Taxonomy;
|
|
505
|
+
export interface iWp_Termmeta {
|
|
506
|
+
'meta_id'?: number;
|
|
507
|
+
'term_id'?: number;
|
|
508
|
+
'meta_key'?: string;
|
|
509
|
+
'meta_value'?: string;
|
|
510
|
+
}
|
|
511
|
+
interface iDefineWp_Termmeta {
|
|
512
|
+
'META_ID': string;
|
|
513
|
+
'TERM_ID': string;
|
|
514
|
+
'META_KEY': string;
|
|
515
|
+
'META_VALUE': string;
|
|
516
|
+
}
|
|
517
|
+
export declare const wp_termmeta: C6RestfulModel & iDefineWp_Termmeta;
|
|
518
|
+
export interface iWp_Terms {
|
|
519
|
+
'term_id'?: number;
|
|
520
|
+
'name'?: string;
|
|
521
|
+
'slug'?: string;
|
|
522
|
+
'term_group'?: number;
|
|
523
|
+
}
|
|
524
|
+
interface iDefineWp_Terms {
|
|
525
|
+
'TERM_ID': string;
|
|
526
|
+
'NAME': string;
|
|
527
|
+
'SLUG': string;
|
|
528
|
+
'TERM_GROUP': string;
|
|
529
|
+
}
|
|
530
|
+
export declare const wp_terms: C6RestfulModel & iDefineWp_Terms;
|
|
531
|
+
export interface iWp_Usermeta {
|
|
532
|
+
'umeta_id'?: number;
|
|
533
|
+
'user_id'?: number;
|
|
534
|
+
'meta_key'?: string;
|
|
535
|
+
'meta_value'?: string;
|
|
536
|
+
}
|
|
537
|
+
interface iDefineWp_Usermeta {
|
|
538
|
+
'UMETA_ID': string;
|
|
539
|
+
'USER_ID': string;
|
|
540
|
+
'META_KEY': string;
|
|
541
|
+
'META_VALUE': string;
|
|
542
|
+
}
|
|
543
|
+
export declare const wp_usermeta: C6RestfulModel & iDefineWp_Usermeta;
|
|
544
|
+
export interface iWp_Users {
|
|
545
|
+
'ID'?: number;
|
|
546
|
+
'user_login'?: string;
|
|
547
|
+
'user_pass'?: string;
|
|
548
|
+
'user_nicename'?: string;
|
|
549
|
+
'user_email'?: string;
|
|
550
|
+
'user_url'?: string;
|
|
551
|
+
'user_registered'?: string;
|
|
552
|
+
'user_activation_key'?: string;
|
|
553
|
+
'user_status'?: number;
|
|
554
|
+
'display_name'?: string;
|
|
555
|
+
}
|
|
556
|
+
interface iDefineWp_Users {
|
|
557
|
+
'ID': string;
|
|
558
|
+
'USER_LOGIN': string;
|
|
559
|
+
'USER_PASS': string;
|
|
560
|
+
'USER_NICENAME': string;
|
|
561
|
+
'USER_EMAIL': string;
|
|
562
|
+
'USER_URL': string;
|
|
563
|
+
'USER_REGISTERED': string;
|
|
564
|
+
'USER_ACTIVATION_KEY': string;
|
|
565
|
+
'USER_STATUS': string;
|
|
566
|
+
'DISPLAY_NAME': string;
|
|
567
|
+
}
|
|
568
|
+
export declare const wp_users: C6RestfulModel & iDefineWp_Users;
|
|
320
569
|
export declare const TABLES: {
|
|
321
570
|
carbons: C6RestfulModel & iDefineCarbons;
|
|
322
571
|
comments: C6RestfulModel & iDefineComments;
|
|
@@ -336,6 +585,18 @@ export declare const TABLES: {
|
|
|
336
585
|
user_sessions: C6RestfulModel & iDefineUser_Sessions;
|
|
337
586
|
user_tasks: C6RestfulModel & iDefineUser_Tasks;
|
|
338
587
|
users: C6RestfulModel & iDefineUsers;
|
|
588
|
+
wp_commentmeta: C6RestfulModel & iDefineWp_Commentmeta;
|
|
589
|
+
wp_comments: C6RestfulModel & iDefineWp_Comments;
|
|
590
|
+
wp_links: C6RestfulModel & iDefineWp_Links;
|
|
591
|
+
wp_options: C6RestfulModel & iDefineWp_Options;
|
|
592
|
+
wp_postmeta: C6RestfulModel & iDefineWp_Postmeta;
|
|
593
|
+
wp_posts: C6RestfulModel & iDefineWp_Posts;
|
|
594
|
+
wp_term_relationships: C6RestfulModel & iDefineWp_Term_Relationships;
|
|
595
|
+
wp_term_taxonomy: C6RestfulModel & iDefineWp_Term_Taxonomy;
|
|
596
|
+
wp_termmeta: C6RestfulModel & iDefineWp_Termmeta;
|
|
597
|
+
wp_terms: C6RestfulModel & iDefineWp_Terms;
|
|
598
|
+
wp_usermeta: C6RestfulModel & iDefineWp_Usermeta;
|
|
599
|
+
wp_users: C6RestfulModel & iDefineWp_Users;
|
|
339
600
|
};
|
|
340
601
|
export declare const C6: {
|
|
341
602
|
TABLES: {
|
|
@@ -447,8 +708,102 @@ export declare const COLUMNS: {
|
|
|
447
708
|
'carbon_users.user_education_history': string;
|
|
448
709
|
'carbon_users.user_location': string;
|
|
449
710
|
'carbon_users.user_creation_date': string;
|
|
711
|
+
'carbon_wp_commentmeta.meta_id': string;
|
|
712
|
+
'carbon_wp_commentmeta.comment_id': string;
|
|
713
|
+
'carbon_wp_commentmeta.meta_key': string;
|
|
714
|
+
'carbon_wp_commentmeta.meta_value': string;
|
|
715
|
+
'carbon_wp_comments.comment_ID': string;
|
|
716
|
+
'carbon_wp_comments.comment_post_ID': string;
|
|
717
|
+
'carbon_wp_comments.comment_author': string;
|
|
718
|
+
'carbon_wp_comments.comment_author_email': string;
|
|
719
|
+
'carbon_wp_comments.comment_author_url': string;
|
|
720
|
+
'carbon_wp_comments.comment_author_IP': string;
|
|
721
|
+
'carbon_wp_comments.comment_date': string;
|
|
722
|
+
'carbon_wp_comments.comment_date_gmt': string;
|
|
723
|
+
'carbon_wp_comments.comment_content': string;
|
|
724
|
+
'carbon_wp_comments.comment_karma': string;
|
|
725
|
+
'carbon_wp_comments.comment_approved': string;
|
|
726
|
+
'carbon_wp_comments.comment_agent': string;
|
|
727
|
+
'carbon_wp_comments.comment_type': string;
|
|
728
|
+
'carbon_wp_comments.comment_parent': string;
|
|
729
|
+
'carbon_wp_comments.user_id': string;
|
|
730
|
+
'carbon_wp_links.link_id': string;
|
|
731
|
+
'carbon_wp_links.link_url': string;
|
|
732
|
+
'carbon_wp_links.link_name': string;
|
|
733
|
+
'carbon_wp_links.link_image': string;
|
|
734
|
+
'carbon_wp_links.link_target': string;
|
|
735
|
+
'carbon_wp_links.link_description': string;
|
|
736
|
+
'carbon_wp_links.link_visible': string;
|
|
737
|
+
'carbon_wp_links.link_owner': string;
|
|
738
|
+
'carbon_wp_links.link_rating': string;
|
|
739
|
+
'carbon_wp_links.link_updated': string;
|
|
740
|
+
'carbon_wp_links.link_rel': string;
|
|
741
|
+
'carbon_wp_links.link_notes': string;
|
|
742
|
+
'carbon_wp_links.link_rss': string;
|
|
743
|
+
'carbon_wp_options.option_id': string;
|
|
744
|
+
'carbon_wp_options.option_name': string;
|
|
745
|
+
'carbon_wp_options.option_value': string;
|
|
746
|
+
'carbon_wp_options.autoload': string;
|
|
747
|
+
'carbon_wp_postmeta.meta_id': string;
|
|
748
|
+
'carbon_wp_postmeta.post_id': string;
|
|
749
|
+
'carbon_wp_postmeta.meta_key': string;
|
|
750
|
+
'carbon_wp_postmeta.meta_value': string;
|
|
751
|
+
'carbon_wp_posts.ID': string;
|
|
752
|
+
'carbon_wp_posts.post_author': string;
|
|
753
|
+
'carbon_wp_posts.post_date': string;
|
|
754
|
+
'carbon_wp_posts.post_date_gmt': string;
|
|
755
|
+
'carbon_wp_posts.post_content': string;
|
|
756
|
+
'carbon_wp_posts.post_title': string;
|
|
757
|
+
'carbon_wp_posts.post_excerpt': string;
|
|
758
|
+
'carbon_wp_posts.post_status': string;
|
|
759
|
+
'carbon_wp_posts.comment_status': string;
|
|
760
|
+
'carbon_wp_posts.ping_status': string;
|
|
761
|
+
'carbon_wp_posts.post_password': string;
|
|
762
|
+
'carbon_wp_posts.post_name': string;
|
|
763
|
+
'carbon_wp_posts.to_ping': string;
|
|
764
|
+
'carbon_wp_posts.pinged': string;
|
|
765
|
+
'carbon_wp_posts.post_modified': string;
|
|
766
|
+
'carbon_wp_posts.post_modified_gmt': string;
|
|
767
|
+
'carbon_wp_posts.post_content_filtered': string;
|
|
768
|
+
'carbon_wp_posts.post_parent': string;
|
|
769
|
+
'carbon_wp_posts.guid': string;
|
|
770
|
+
'carbon_wp_posts.menu_order': string;
|
|
771
|
+
'carbon_wp_posts.post_type': string;
|
|
772
|
+
'carbon_wp_posts.post_mime_type': string;
|
|
773
|
+
'carbon_wp_posts.comment_count': string;
|
|
774
|
+
'carbon_wp_term_relationships.object_id': string;
|
|
775
|
+
'carbon_wp_term_relationships.term_taxonomy_id': string;
|
|
776
|
+
'carbon_wp_term_relationships.term_order': string;
|
|
777
|
+
'carbon_wp_term_taxonomy.term_taxonomy_id': string;
|
|
778
|
+
'carbon_wp_term_taxonomy.term_id': string;
|
|
779
|
+
'carbon_wp_term_taxonomy.taxonomy': string;
|
|
780
|
+
'carbon_wp_term_taxonomy.description': string;
|
|
781
|
+
'carbon_wp_term_taxonomy.parent': string;
|
|
782
|
+
'carbon_wp_term_taxonomy.count': string;
|
|
783
|
+
'carbon_wp_termmeta.meta_id': string;
|
|
784
|
+
'carbon_wp_termmeta.term_id': string;
|
|
785
|
+
'carbon_wp_termmeta.meta_key': string;
|
|
786
|
+
'carbon_wp_termmeta.meta_value': string;
|
|
787
|
+
'carbon_wp_terms.term_id': string;
|
|
788
|
+
'carbon_wp_terms.name': string;
|
|
789
|
+
'carbon_wp_terms.slug': string;
|
|
790
|
+
'carbon_wp_terms.term_group': string;
|
|
791
|
+
'carbon_wp_usermeta.umeta_id': string;
|
|
792
|
+
'carbon_wp_usermeta.user_id': string;
|
|
793
|
+
'carbon_wp_usermeta.meta_key': string;
|
|
794
|
+
'carbon_wp_usermeta.meta_value': string;
|
|
795
|
+
'carbon_wp_users.ID': string;
|
|
796
|
+
'carbon_wp_users.user_login': string;
|
|
797
|
+
'carbon_wp_users.user_pass': string;
|
|
798
|
+
'carbon_wp_users.user_nicename': string;
|
|
799
|
+
'carbon_wp_users.user_email': string;
|
|
800
|
+
'carbon_wp_users.user_url': string;
|
|
801
|
+
'carbon_wp_users.user_registered': string;
|
|
802
|
+
'carbon_wp_users.user_activation_key': string;
|
|
803
|
+
'carbon_wp_users.user_status': string;
|
|
804
|
+
'carbon_wp_users.display_name': string;
|
|
450
805
|
};
|
|
451
|
-
export type RestTableInterfaces = iCarbons | iComments | iDocumentation | iFeature_Group_References | iFeatures | iGroup_References | iGroups | iHistory_Logs | iLocation_References | iLocations | iPhotos | iReports | iUser_Followers | iUser_Groups | iUser_Messages | iUser_Sessions | iUser_Tasks | iUsers;
|
|
806
|
+
export type RestTableInterfaces = iCarbons | iComments | iDocumentation | iFeature_Group_References | iFeatures | iGroup_References | iGroups | iHistory_Logs | iLocation_References | iLocations | iPhotos | iReports | iUser_Followers | iUser_Groups | iUser_Messages | iUser_Sessions | iUser_Tasks | iUsers | iWp_Commentmeta | iWp_Comments | iWp_Links | iWp_Options | iWp_Postmeta | iWp_Posts | iWp_Term_Relationships | iWp_Term_Taxonomy | iWp_Termmeta | iWp_Terms | iWp_Usermeta | iWp_Users;
|
|
452
807
|
export type tStatefulApiData<T> = T[] | undefined | null;
|
|
453
808
|
export interface iRestfulObjectArrayTypes {
|
|
454
809
|
carbons: tStatefulApiData<iCarbons>;
|
|
@@ -469,6 +824,18 @@ export interface iRestfulObjectArrayTypes {
|
|
|
469
824
|
user_sessions: tStatefulApiData<iUser_Sessions>;
|
|
470
825
|
user_tasks: tStatefulApiData<iUser_Tasks>;
|
|
471
826
|
users: tStatefulApiData<iUsers>;
|
|
827
|
+
wp_commentmeta: tStatefulApiData<iWp_Commentmeta>;
|
|
828
|
+
wp_comments: tStatefulApiData<iWp_Comments>;
|
|
829
|
+
wp_links: tStatefulApiData<iWp_Links>;
|
|
830
|
+
wp_options: tStatefulApiData<iWp_Options>;
|
|
831
|
+
wp_postmeta: tStatefulApiData<iWp_Postmeta>;
|
|
832
|
+
wp_posts: tStatefulApiData<iWp_Posts>;
|
|
833
|
+
wp_term_relationships: tStatefulApiData<iWp_Term_Relationships>;
|
|
834
|
+
wp_term_taxonomy: tStatefulApiData<iWp_Term_Taxonomy>;
|
|
835
|
+
wp_termmeta: tStatefulApiData<iWp_Termmeta>;
|
|
836
|
+
wp_terms: tStatefulApiData<iWp_Terms>;
|
|
837
|
+
wp_usermeta: tStatefulApiData<iWp_Usermeta>;
|
|
838
|
+
wp_users: tStatefulApiData<iWp_Users>;
|
|
472
839
|
}
|
|
473
840
|
export declare const initialRestfulObjectsState: iRestfulObjectArrayTypes;
|
|
474
841
|
export type tRestfulObjectArrayValues = iRestfulObjectArrayTypes[keyof iRestfulObjectArrayTypes];
|
package/package.json
CHANGED
package/src/hoc/KeysMatching.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CarbonReact from "CarbonReact";
|
|
2
|
-
import {tRestfulObjectArrayValues} from "variables/C6";
|
|
2
|
+
import {tRestfulObjectArrayValues, tStatefulApiData} from "variables/C6";
|
|
3
3
|
import {KeysMatching} from "./KeysMatching";
|
|
4
4
|
|
|
5
5
|
|
|
@@ -9,29 +9,67 @@ export default function deleteRestfulObjectArrays<ObjectType = tRestfulObjectArr
|
|
|
9
9
|
(dataOrCallback: ObjectType[] | (<K extends keyof S>(
|
|
10
10
|
state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null),
|
|
11
11
|
callback?: () => void
|
|
12
|
-
) => ObjectType[]),
|
|
13
|
-
stateKey: KeysMatching<S, ObjectType
|
|
14
|
-
uniqueObjectId: keyof ObjectType,
|
|
12
|
+
) => null|(ObjectType[])),
|
|
13
|
+
stateKey: KeysMatching<S, tStatefulApiData<ObjectType>>,
|
|
14
|
+
uniqueObjectId: (keyof ObjectType) | (keyof ObjectType)[],
|
|
15
15
|
callback?: () => void): void {
|
|
16
16
|
|
|
17
|
+
const uniqueObjectIds = uniqueObjectId instanceof Array ? uniqueObjectId : [uniqueObjectId];
|
|
18
|
+
|
|
17
19
|
return CarbonReact.instance.setState((previousBootstrapState, props) => {
|
|
18
20
|
|
|
19
21
|
let newOrReplacementData: ObjectType[] = [];
|
|
20
22
|
|
|
21
23
|
if (dataOrCallback instanceof Array) {
|
|
24
|
+
|
|
22
25
|
newOrReplacementData = dataOrCallback
|
|
26
|
+
|
|
23
27
|
} else if (dataOrCallback instanceof Function) {
|
|
24
|
-
|
|
28
|
+
|
|
29
|
+
let callbackReturn = dataOrCallback(previousBootstrapState, props);
|
|
30
|
+
|
|
31
|
+
if (null === callbackReturn) {
|
|
32
|
+
|
|
33
|
+
return ;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
newOrReplacementData = callbackReturn;
|
|
38
|
+
|
|
25
39
|
} else {
|
|
40
|
+
|
|
26
41
|
throw Error('The dataOrCallback parameter was not an array or function')
|
|
42
|
+
|
|
27
43
|
}
|
|
28
44
|
|
|
29
|
-
const previousStateProperty = previousBootstrapState[stateKey];
|
|
45
|
+
const previousStateProperty : ObjectType[] = previousBootstrapState[stateKey];
|
|
30
46
|
|
|
31
47
|
return {
|
|
32
48
|
[stateKey]: [
|
|
33
|
-
|
|
34
|
-
|
|
49
|
+
|
|
50
|
+
...previousStateProperty?.filter(item => false === (newOrReplacementData?.find(value => {
|
|
51
|
+
|
|
52
|
+
let isMatch = true;
|
|
53
|
+
|
|
54
|
+
uniqueObjectIds.find(uniqueObjectId => {
|
|
55
|
+
|
|
56
|
+
if (value[uniqueObjectId] !== item[uniqueObjectId]) {
|
|
57
|
+
|
|
58
|
+
isMatch = false;
|
|
59
|
+
|
|
60
|
+
return true;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return false;
|
|
65
|
+
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
return isMatch;
|
|
69
|
+
|
|
70
|
+
}) || false)) || []
|
|
71
|
+
|
|
72
|
+
]
|
|
35
73
|
}
|
|
36
74
|
}, callback);
|
|
37
75
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {tRestfulObjectArrayValues} from "variables/C6";
|
|
1
|
+
import {tRestfulObjectArrayValues, tStatefulApiData} from "variables/C6";
|
|
2
2
|
import CarbonReact from "CarbonReact";
|
|
3
3
|
import {KeysMatching} from "./KeysMatching";
|
|
4
4
|
|
|
@@ -23,35 +23,64 @@ export default function updateRestfulObjectArrays<ObjectType = tRestfulObjectArr
|
|
|
23
23
|
(dataOrCallback: ObjectType[] | (<K extends keyof S>(
|
|
24
24
|
state: ((prevState: Readonly<S>, props: Readonly<P>) => (Pick<S, K> | S | null)) | (Pick<S, K> | S | null),
|
|
25
25
|
callback?: () => void
|
|
26
|
-
) => ObjectType[]),
|
|
27
|
-
stateKey: KeysMatching<S, ObjectType
|
|
28
|
-
uniqueObjectId: keyof ObjectType,
|
|
26
|
+
) => null|(ObjectType[])),
|
|
27
|
+
stateKey: KeysMatching<S, tStatefulApiData<ObjectType>>,
|
|
28
|
+
uniqueObjectId: (keyof ObjectType) | (keyof ObjectType)[],
|
|
29
29
|
insertUpdateOrder: eUpdateInsertMethod = eUpdateInsertMethod.LAST,
|
|
30
30
|
callback?: () => void): void {
|
|
31
31
|
|
|
32
|
+
const uniqueObjectIds = uniqueObjectId instanceof Array ? uniqueObjectId : [uniqueObjectId];
|
|
33
|
+
|
|
32
34
|
const bootstrap = CarbonReact.instance;
|
|
33
35
|
|
|
34
36
|
return bootstrap.setState((previousBootstrapState, props): {} => {
|
|
35
37
|
|
|
36
|
-
let newOrReplacementData: ObjectType[]
|
|
38
|
+
let newOrReplacementData: null|(ObjectType[]) = [];
|
|
37
39
|
|
|
38
40
|
if (dataOrCallback instanceof Array) {
|
|
41
|
+
|
|
39
42
|
newOrReplacementData = dataOrCallback
|
|
43
|
+
|
|
40
44
|
} else if (dataOrCallback instanceof Function) {
|
|
45
|
+
|
|
41
46
|
newOrReplacementData = dataOrCallback(previousBootstrapState, props);
|
|
47
|
+
|
|
42
48
|
} else {
|
|
49
|
+
|
|
43
50
|
throw Error('The dataOrCallback parameter was not an array or function')
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const findUniqueObjectIds = (item : ObjectType, value: ObjectType) => {
|
|
55
|
+
|
|
56
|
+
let isMatch = true;
|
|
57
|
+
|
|
58
|
+
uniqueObjectIds.find(uniqueObjectId => {
|
|
59
|
+
|
|
60
|
+
if (value[uniqueObjectId] !== item[uniqueObjectId]) {
|
|
61
|
+
|
|
62
|
+
isMatch = false;
|
|
63
|
+
|
|
64
|
+
return true;
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return false;
|
|
69
|
+
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return isMatch;
|
|
73
|
+
|
|
44
74
|
}
|
|
45
75
|
|
|
46
|
-
|
|
47
|
-
const previousStateProperty = previousBootstrapState[stateKey];
|
|
76
|
+
const previousStateProperty : ObjectType[] = previousBootstrapState[stateKey];
|
|
48
77
|
|
|
49
|
-
let updatedData = newOrReplacementData
|
|
78
|
+
let updatedData : ObjectType[] = newOrReplacementData?.map(value => {
|
|
50
79
|
return {
|
|
51
|
-
...previousStateProperty?.find(previousValue => previousValue
|
|
80
|
+
...previousStateProperty?.find(previousValue => findUniqueObjectIds(previousValue, value)) || {},
|
|
52
81
|
...value
|
|
53
82
|
}
|
|
54
|
-
})
|
|
83
|
+
}) ?? [];
|
|
55
84
|
|
|
56
85
|
switch (insertUpdateOrder) {
|
|
57
86
|
default:
|
|
@@ -60,14 +89,14 @@ export default function updateRestfulObjectArrays<ObjectType = tRestfulObjectArr
|
|
|
60
89
|
return {
|
|
61
90
|
[stateKey]: null === newOrReplacementData ? null : [
|
|
62
91
|
...updatedData,
|
|
63
|
-
...(previousStateProperty?.filter(item => false === (
|
|
92
|
+
...(previousStateProperty?.filter(item => false === (updatedData?.find(value => findUniqueObjectIds(item, value)) || false)) ?? [])
|
|
64
93
|
]
|
|
65
94
|
}
|
|
66
95
|
|
|
67
96
|
case eUpdateInsertMethod.FIRST:
|
|
68
97
|
return {
|
|
69
98
|
[stateKey]: null === newOrReplacementData ? null : [
|
|
70
|
-
...(previousStateProperty?.filter(item => false === (
|
|
99
|
+
...(previousStateProperty?.filter(item => false === (updatedData?.find(value => findUniqueObjectIds(item, value)) || false)) ?? []),
|
|
71
100
|
...updatedData,
|
|
72
101
|
]
|
|
73
102
|
}
|
|
@@ -77,7 +106,7 @@ export default function updateRestfulObjectArrays<ObjectType = tRestfulObjectArr
|
|
|
77
106
|
[stateKey]: [
|
|
78
107
|
...(previousStateProperty?.map(oldObject => {
|
|
79
108
|
|
|
80
|
-
const index = updatedData.findIndex(item => item
|
|
109
|
+
const index = updatedData.findIndex(item => findUniqueObjectIds(item, oldObject));
|
|
81
110
|
|
|
82
111
|
if (-1 === index) {
|
|
83
112
|
|