electrodb 2.15.0 → 3.0.1

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 CHANGED
@@ -16,15 +16,19 @@
16
16
 
17
17
  _Please submit issues/feedback or reach out on Twitter [@tinkertamper](https://twitter.com/tinkertamper)._
18
18
 
19
+ <a href="https://electrodb.dev/en/core-concepts/v3-migration/"><h1 align="center">ElectroDB v3 now released</h1></a>
20
+
21
+ <p align="center">Visit the <a href="https://electrodb.dev/en/core-concepts/v3-migration/">v3 migration page</a> to learn more about this new update.</p>
22
+
19
23
  ---
20
24
 
21
- <a href="https://electrodb.dev"><h1 align="center">New: Documentation now found at ElectroDB.dev</h1></a>
25
+ <a href="https://electrodb.dev"><h1 align="center">Documentation now found at ElectroDB.dev</h1></a>
22
26
 
23
- <p align="center">ElectroDB's new website for Documentation is now live at <a href="https://electrodb.dev">www.ElectroDB.dev</a>.</p>
27
+ <p align="center">ElectroDB's new website for Documentation is now live at <a href="https://electrodb.dev">electrodb.dev</a>.</p>
24
28
 
25
29
  ---
26
30
 
27
- <a href="https://electrodb.fun"><h1 align="center">Introducing: The NEW ElectroDB Playground</h1></a>
31
+ <a href="https://electrodb.fun"><h1 align="center">The NEW ElectroDB Playground</h1></a>
28
32
 
29
33
  <p align="center">
30
34
  <a href="https://electrodb.fun"><img width="400" src="https://github.com/tywalch/electrodb/blob/master/assets/playground.jpg?raw=true"></a>
package/index.d.ts CHANGED
@@ -2536,12 +2536,9 @@ export interface QueryOptions {
2536
2536
  listeners?: Array<ElectroEventListener>;
2537
2537
  logger?: ElectroEventListener;
2538
2538
  data?: "raw" | "includeKeys" | "attributes";
2539
-
2540
- /** @depricated use 'data=raw' instead */
2541
- raw?: boolean;
2542
- /** @depricated use 'data=includeKeys' instead */
2543
- includeKeys?: boolean;
2544
2539
  order?: "asc" | "desc";
2540
+
2541
+ consistent?: boolean;
2545
2542
  }
2546
2543
 
2547
2544
  // subset of QueryOptions
@@ -2581,7 +2578,7 @@ export interface PutQueryOptions extends QueryOptions {
2581
2578
  response?: "default" | "none" | "all_old" | "all_new";
2582
2579
  }
2583
2580
 
2584
- export interface ParamOptions {
2581
+ export type ParamOptions = {
2585
2582
  cursor?: string | null;
2586
2583
  params?: object;
2587
2584
  table?: string;
@@ -2594,7 +2591,8 @@ export interface ParamOptions {
2594
2591
  | "all_new"
2595
2592
  | "updated_new";
2596
2593
  order?: "asc" | "desc";
2597
- }
2594
+ consistent?: boolean;
2595
+ } & QueryExecutionComparisonParts;
2598
2596
 
2599
2597
  export interface BulkOptions extends QueryOptions {
2600
2598
  unprocessed?: "raw" | "item";
@@ -2609,11 +2607,6 @@ export type OptionalDefaultEntityIdentifiers = {
2609
2607
 
2610
2608
  interface GoBatchGetTerminalOptions<Attributes> {
2611
2609
  data?: "raw" | "includeKeys" | "attributes";
2612
- /** @depricated use 'data=raw' instead */
2613
- raw?: boolean;
2614
- /** @depricated use 'data=raw' instead */
2615
- includeKeys?: boolean;
2616
-
2617
2610
  table?: string;
2618
2611
  limit?: number;
2619
2612
  params?: object;
@@ -2626,15 +2619,23 @@ interface GoBatchGetTerminalOptions<Attributes> {
2626
2619
  preserveBatchOrder?: boolean;
2627
2620
  listeners?: Array<ElectroEventListener>;
2628
2621
  logger?: ElectroEventListener;
2622
+ consistent?: boolean;
2629
2623
  }
2630
2624
 
2631
- interface ServiceQueryGoTerminalOptions {
2625
+ export type ExecutionOptionCompare = "keys" | "attributes" | "v2";
2626
+
2627
+ export type QueryExecutionComparisonParts = {
2628
+ compare?: "keys" | "attributes"
2629
+ } | {
2630
+ /**
2631
+ * @deprecated 'v2' exists to ease user migration to ElectroDB v3. Support for this option will eventually be dropped.
2632
+ */
2633
+ compare?: "v2"
2634
+ }
2635
+
2636
+ type ServiceQueryGoTerminalOptions = {
2632
2637
  cursor?: string | null;
2633
2638
  data?: "raw" | "includeKeys" | "attributes";
2634
- /** @depricated use 'data=raw' instead */
2635
- raw?: boolean;
2636
- /** @depricated use 'data=raw' instead */
2637
- includeKeys?: boolean;
2638
2639
  table?: string;
2639
2640
  limit?: number;
2640
2641
  params?: object;
@@ -2645,15 +2646,12 @@ interface ServiceQueryGoTerminalOptions {
2645
2646
  logger?: ElectroEventListener;
2646
2647
  order?: "asc" | "desc";
2647
2648
  hydrate?: boolean;
2648
- }
2649
+ consistent?: boolean;
2650
+ } & QueryExecutionComparisonParts;
2649
2651
 
2650
- interface GoQueryTerminalOptions<Attributes> {
2652
+ type GoQueryTerminalOptions<Attributes> = {
2651
2653
  cursor?: string | null;
2652
2654
  data?: "raw" | "includeKeys" | "attributes";
2653
- /** @depricated use 'data=raw' instead */
2654
- raw?: boolean;
2655
- /** @depricated use 'data=raw' instead */
2656
- includeKeys?: boolean;
2657
2655
  table?: string;
2658
2656
  limit?: number;
2659
2657
  count?: number;
@@ -2666,7 +2664,8 @@ interface GoQueryTerminalOptions<Attributes> {
2666
2664
  logger?: ElectroEventListener;
2667
2665
  order?: "asc" | "desc";
2668
2666
  hydrate?: boolean;
2669
- }
2667
+ consistent?: boolean;
2668
+ } & QueryExecutionComparisonParts;
2670
2669
 
2671
2670
  interface TransactWriteQueryOptions {
2672
2671
  data?: "raw" | "includeKeys" | "attributes";
@@ -2688,13 +2687,15 @@ interface TransactGetQueryOptions<Attributes> {
2688
2687
  attributes?: ReadonlyArray<Attributes>;
2689
2688
  listeners?: Array<ElectroEventListener>;
2690
2689
  logger?: ElectroEventListener;
2690
+ consistent?: boolean;
2691
2691
  }
2692
2692
 
2693
- export interface ParamTerminalOptions<Attributes> {
2693
+ export type ParamTerminalOptions<Attributes> = {
2694
2694
  table?: string;
2695
2695
  limit?: number;
2696
2696
  params?: object;
2697
2697
  originalErr?: boolean;
2698
+ consistent?: boolean;
2698
2699
  attributes?: ReadonlyArray<Attributes>;
2699
2700
  response?:
2700
2701
  | "default"
@@ -2704,7 +2705,7 @@ export interface ParamTerminalOptions<Attributes> {
2704
2705
  | "all_new"
2705
2706
  | "updated_new";
2706
2707
  order?: "asc" | "desc";
2707
- }
2708
+ } & QueryExecutionComparisonParts;
2708
2709
 
2709
2710
  type GoBatchGetTerminal<
2710
2711
  A extends string,
@@ -2912,16 +2913,14 @@ export type DeleteRecordOperationGo<ResponseType, Keys> = <
2912
2913
  options?: Options,
2913
2914
  ) => Options extends infer O
2914
2915
  ? "response" extends keyof O
2915
- ? O["response"] extends "all_new"
2916
- ? Promise<{ data: T }>
2917
- : O["response"] extends "all_old"
2918
- ? Promise<{ data: T }>
2916
+ ? O["response"] extends "all_old"
2917
+ ? Promise<{ data: T | null }>
2919
2918
  : O["response"] extends "default"
2920
- ? Promise<{ data: Keys }>
2921
- : O["response"] extends "none"
2922
- ? Promise<{ data: null }>
2923
- : Promise<{ data: Partial<T> }>
2924
- : Promise<{ data: Keys }>
2919
+ ? Promise<{ data: Keys }>
2920
+ : O["response"] extends "none"
2921
+ ? Promise<{ data: null }>
2922
+ : Promise<{ data: Keys | null }>
2923
+ : Promise<{ data: Keys }>
2925
2924
  : never;
2926
2925
 
2927
2926
  export type BatchWriteGo<ResponseType> = <O extends BulkOptions>(
@@ -3002,10 +3001,7 @@ export interface NestedBooleanAttribute {
3002
3001
  readonly get?: (val: boolean, item: any) => boolean | undefined | void;
3003
3002
  readonly set?: (val?: boolean, item?: any) => boolean | undefined | void;
3004
3003
  readonly default?: boolean | (() => boolean);
3005
- readonly validate?:
3006
- | ((val: boolean) => boolean)
3007
- | ((val: boolean) => void)
3008
- | ((val: boolean) => string | void);
3004
+ readonly validate?: ((val: boolean) => boolean)
3009
3005
  readonly field?: string;
3010
3006
  }
3011
3007
 
@@ -3017,10 +3013,7 @@ export interface BooleanAttribute {
3017
3013
  readonly get?: (val: boolean, item: any) => boolean | undefined | void;
3018
3014
  readonly set?: (val?: boolean, item?: any) => boolean | undefined | void;
3019
3015
  readonly default?: boolean | (() => boolean);
3020
- readonly validate?:
3021
- | ((val: boolean) => boolean)
3022
- | ((val: boolean) => void)
3023
- | ((val: boolean) => string | void);
3016
+ readonly validate?: ((val: boolean) => boolean)
3024
3017
  readonly field?: string;
3025
3018
  readonly label?: string;
3026
3019
  readonly watch?: ReadonlyArray<string> | "*";
@@ -3038,10 +3031,7 @@ export interface NestedNumberAttribute {
3038
3031
  readonly get?: (val: number, item: any) => number | undefined | void;
3039
3032
  readonly set?: (val?: number, item?: any) => number | undefined | void;
3040
3033
  readonly default?: number | (() => number);
3041
- readonly validate?:
3042
- | ((val: number) => boolean)
3043
- | ((val: number) => void)
3044
- | ((val: number) => string | void);
3034
+ readonly validate?: ((val: number) => boolean)
3045
3035
  readonly field?: string;
3046
3036
  }
3047
3037
 
@@ -3053,10 +3043,7 @@ export interface NumberAttribute {
3053
3043
  readonly get?: (val: number, item: any) => number | undefined | void;
3054
3044
  readonly set?: (val?: number, item?: any) => number | undefined | void;
3055
3045
  readonly default?: number | (() => number);
3056
- readonly validate?:
3057
- | ((val: number) => boolean)
3058
- | ((val: number) => void)
3059
- | ((val: number) => string | void);
3046
+ readonly validate?: ((val: number) => boolean)
3060
3047
  readonly field?: string;
3061
3048
  readonly label?: string;
3062
3049
  readonly watch?: ReadonlyArray<string> | "*";
@@ -3076,8 +3063,6 @@ export interface NestedStringAttribute {
3076
3063
  readonly default?: string | (() => string);
3077
3064
  readonly validate?:
3078
3065
  | ((val: string) => boolean)
3079
- | ((val: string) => void)
3080
- | ((val: string) => string | void)
3081
3066
  | RegExp;
3082
3067
  readonly field?: string;
3083
3068
  }
@@ -3092,8 +3077,6 @@ export interface StringAttribute {
3092
3077
  readonly default?: string | (() => string);
3093
3078
  readonly validate?:
3094
3079
  | ((val: string) => boolean)
3095
- | ((val: string) => void)
3096
- | ((val: string) => string | void)
3097
3080
  | RegExp;
3098
3081
  readonly field?: string;
3099
3082
  readonly label?: string;
@@ -3112,10 +3095,7 @@ export interface NestedEnumAttribute {
3112
3095
  readonly get?: (val: any, item: any) => any | undefined | void;
3113
3096
  readonly set?: (val?: any, item?: any) => any | undefined | void;
3114
3097
  readonly default?: string | (() => string);
3115
- readonly validate?:
3116
- | ((val: any) => boolean)
3117
- | ((val: any) => void)
3118
- | ((val: any) => string | void);
3098
+ readonly validate?: ((val: any) => boolean)
3119
3099
  readonly field?: string;
3120
3100
  readonly label?: string;
3121
3101
  }
@@ -3128,10 +3108,7 @@ export interface EnumAttribute {
3128
3108
  readonly get?: (val: any, item: any) => any | undefined | void;
3129
3109
  readonly set?: (val?: any, item?: any) => any | undefined | void;
3130
3110
  readonly default?: string | (() => string);
3131
- readonly validate?:
3132
- | ((val: any) => boolean)
3133
- | ((val: any) => void)
3134
- | ((val: any) => string | void);
3111
+ readonly validate?: ((val: any) => boolean)
3135
3112
  readonly field?: string;
3136
3113
  readonly label?: string;
3137
3114
  readonly watch?: ReadonlyArray<string> | "*";
@@ -3145,10 +3122,7 @@ export interface NestedAnyAttribute {
3145
3122
  readonly get?: (val: any, item: any) => any | undefined | void;
3146
3123
  readonly set?: (val?: any, item?: any) => any | undefined | void;
3147
3124
  readonly default?: any | (() => any);
3148
- readonly validate?:
3149
- | ((val: any) => boolean)
3150
- | ((val: any) => void)
3151
- | ((val: any) => string | void);
3125
+ readonly validate?: ((val: any) => boolean)
3152
3126
  readonly field?: string;
3153
3127
  }
3154
3128
 
@@ -3160,10 +3134,7 @@ export interface AnyAttribute {
3160
3134
  readonly get?: (val: any, item: any) => any | undefined | void;
3161
3135
  readonly set?: (val?: any, item?: any) => any | undefined | void;
3162
3136
  readonly default?: any | (() => any);
3163
- readonly validate?:
3164
- | ((val: any) => boolean)
3165
- | ((val: any) => void)
3166
- | ((val: any) => string | void);
3137
+ readonly validate?: ((val: any) => boolean)
3167
3138
  readonly field?: string;
3168
3139
  readonly label?: string;
3169
3140
  readonly watch?: ReadonlyArray<string> | "*";
@@ -3186,10 +3157,7 @@ export interface NestedMapAttribute {
3186
3157
  item?: any,
3187
3158
  ) => Record<string, any> | undefined | void;
3188
3159
  readonly default?: Record<string, any> | (() => Record<string, any>);
3189
- readonly validate?:
3190
- | ((val: Record<string, any>) => boolean)
3191
- | ((val: Record<string, any>) => void)
3192
- | ((val: Record<string, any>) => string | void);
3160
+ readonly validate?: ((val: Record<string, any>) => boolean)
3193
3161
  readonly field?: string;
3194
3162
  }
3195
3163
 
@@ -3210,10 +3178,7 @@ export interface MapAttribute {
3210
3178
  item?: any,
3211
3179
  ) => Record<string, any> | undefined | void;
3212
3180
  readonly default?: Record<string, any> | (() => Record<string, any>);
3213
- readonly validate?:
3214
- | ((val: Record<string, any>) => boolean)
3215
- | ((val: Record<string, any>) => void)
3216
- | ((val: Record<string, any>) => string | void);
3181
+ readonly validate?: ((val: Record<string, any>) => boolean)
3217
3182
  readonly field?: string;
3218
3183
  readonly watch?: ReadonlyArray<string> | "*";
3219
3184
  }
@@ -3233,10 +3198,7 @@ export interface NestedCustomListAttribute {
3233
3198
  item?: any,
3234
3199
  ) => Array<any> | undefined | void;
3235
3200
  readonly default?: Array<any> | (() => Array<any>);
3236
- readonly validate?:
3237
- | ((val: Array<any>) => boolean)
3238
- | ((val: Array<any>) => void)
3239
- | ((val: Array<any>) => string | void);
3201
+ readonly validate?: ((val: Array<any>) => boolean)
3240
3202
  }
3241
3203
 
3242
3204
  export interface NestedStringListAttribute {
@@ -3251,8 +3213,6 @@ export interface NestedStringListAttribute {
3251
3213
  readonly default?: string | (() => string);
3252
3214
  readonly validate?:
3253
3215
  | ((val: string) => boolean)
3254
- | ((val: string) => void)
3255
- | ((val: string) => string | void)
3256
3216
  | RegExp;
3257
3217
  readonly field?: string;
3258
3218
  };
@@ -3268,10 +3228,7 @@ export interface NestedStringListAttribute {
3268
3228
  item?: any,
3269
3229
  ) => Array<string> | undefined | void;
3270
3230
  readonly default?: Array<string> | (() => Array<string>);
3271
- readonly validate?:
3272
- | ((val: Array<string>) => boolean)
3273
- | ((val: Array<string>) => void)
3274
- | ((val: Array<string>) => string | void);
3231
+ readonly validate?: ((val: Array<string>) => boolean)
3275
3232
  }
3276
3233
 
3277
3234
  export interface StringListAttribute {
@@ -3286,8 +3243,6 @@ export interface StringListAttribute {
3286
3243
  readonly default?: string | (() => string);
3287
3244
  readonly validate?:
3288
3245
  | ((val: string) => boolean)
3289
- | ((val: string) => void)
3290
- | ((val: string) => string | void)
3291
3246
  | RegExp;
3292
3247
  readonly field?: string;
3293
3248
  };
@@ -3303,10 +3258,7 @@ export interface StringListAttribute {
3303
3258
  item?: any,
3304
3259
  ) => Array<string> | undefined | void;
3305
3260
  readonly default?: Array<string> | (() => Array<string>);
3306
- readonly validate?:
3307
- | ((val: Array<string>) => boolean)
3308
- | ((val: Array<string>) => void)
3309
- | ((val: Array<string>) => string | void);
3261
+ readonly validate?: ((val: Array<string>) => boolean)
3310
3262
  readonly watch?: ReadonlyArray<string> | "*";
3311
3263
  }
3312
3264
 
@@ -3325,10 +3277,7 @@ export interface NestedNumberListAttribute {
3325
3277
  item?: any,
3326
3278
  ) => Array<number> | undefined | void;
3327
3279
  readonly default?: Array<number> | (() => Array<number>);
3328
- readonly validate?:
3329
- | ((val: Array<number>) => boolean)
3330
- | ((val: Array<number>) => void)
3331
- | ((val: Array<number>) => string | void);
3280
+ readonly validate?: ((val: Array<number>) => boolean)
3332
3281
  readonly field?: string;
3333
3282
  }
3334
3283
 
@@ -3347,10 +3296,7 @@ export interface NumberListAttribute {
3347
3296
  item?: any,
3348
3297
  ) => Array<number> | undefined | void;
3349
3298
  readonly default?: Array<number> | (() => Array<number>);
3350
- readonly validate?:
3351
- | ((val: Array<number>) => boolean)
3352
- | ((val: Array<number>) => void)
3353
- | ((val: Array<number>) => string | void);
3299
+ readonly validate?: ((val: Array<number>) => boolean)
3354
3300
  readonly field?: string;
3355
3301
  readonly watch?: ReadonlyArray<string> | "*";
3356
3302
  }
@@ -3370,10 +3316,7 @@ export interface NestedMapListAttribute {
3370
3316
  item?: any,
3371
3317
  ) => Record<string, any>[] | undefined | void;
3372
3318
  readonly default?: Record<string, any>[] | (() => Record<string, any>[]);
3373
- readonly validate?:
3374
- | ((val: Record<string, any>[]) => boolean)
3375
- | ((val: Record<string, any>[]) => void)
3376
- | ((val: Record<string, any>[]) => string | void);
3319
+ readonly validate?: ((val: Record<string, any>[]) => boolean)
3377
3320
  readonly field?: string;
3378
3321
  }
3379
3322
 
@@ -3392,10 +3335,7 @@ export interface NestedAnyListAttribute {
3392
3335
  item?: any,
3393
3336
  ) => Record<string, any>[] | undefined | void;
3394
3337
  readonly default?: Record<string, any>[] | (() => Record<string, any>[]);
3395
- readonly validate?:
3396
- | ((val: Record<string, any>[]) => boolean)
3397
- | ((val: Record<string, any>[]) => void)
3398
- | ((val: Record<string, any>[]) => string | void);
3338
+ readonly validate?: ((val: Record<string, any>[]) => boolean)
3399
3339
  readonly field?: string;
3400
3340
  }
3401
3341
 
@@ -3414,10 +3354,7 @@ export interface MapListAttribute {
3414
3354
  item?: any,
3415
3355
  ) => Record<string, any>[] | undefined | void;
3416
3356
  readonly default?: Record<string, any>[] | (() => Record<string, any>[]);
3417
- readonly validate?:
3418
- | ((val: Record<string, any>[]) => boolean)
3419
- | ((val: Record<string, any>[]) => void)
3420
- | ((val: Record<string, any>[]) => string | void);
3357
+ readonly validate?: ((val: Record<string, any>[]) => boolean)
3421
3358
  readonly field?: string;
3422
3359
  readonly watch?: ReadonlyArray<string> | "*";
3423
3360
  }
@@ -3437,10 +3374,7 @@ export interface CustomListAttribute {
3437
3374
  item?: any,
3438
3375
  ) => Array<any> | undefined | void;
3439
3376
  readonly default?: Array<any> | (() => Array<any>);
3440
- readonly validate?:
3441
- | ((val: Array<any>) => boolean)
3442
- | ((val: Array<any>) => void)
3443
- | ((val: Array<any>) => string | void);
3377
+ readonly validate?: ((val: Array<any>) => boolean);
3444
3378
  readonly field?: string;
3445
3379
  readonly watch?: ReadonlyArray<string> | "*";
3446
3380
  }
@@ -3460,10 +3394,7 @@ export interface AnyListAttribute {
3460
3394
  item?: any,
3461
3395
  ) => Array<any> | undefined | void;
3462
3396
  readonly default?: Array<any> | (() => Array<any>);
3463
- readonly validate?:
3464
- | ((val: Array<any>) => boolean)
3465
- | ((val: Array<any>) => void)
3466
- | ((val: Array<any>) => string | void);
3397
+ readonly validate?: ((val: Array<any>) => boolean)
3467
3398
  readonly field?: string;
3468
3399
  readonly watch?: ReadonlyArray<string> | "*";
3469
3400
  }
@@ -3485,8 +3416,6 @@ export interface NestedStringSetAttribute {
3485
3416
  readonly default?: Array<string> | (() => Array<string>);
3486
3417
  readonly validate?:
3487
3418
  | ((val: Array<string>) => boolean)
3488
- | ((val: Array<string>) => void)
3489
- | ((val: Array<string>) => string | void)
3490
3419
  | RegExp;
3491
3420
  readonly field?: string;
3492
3421
  }
@@ -3506,11 +3435,7 @@ export interface NestedEnumNumberSetAttribute {
3506
3435
  item?: any,
3507
3436
  ) => Array<number> | undefined | void;
3508
3437
  readonly default?: Array<number> | (() => Array<number>);
3509
- readonly validate?:
3510
- | ((val: Array<number>) => boolean)
3511
- | ((val: Array<number>) => void)
3512
- | ((val: Array<number>) => string | void)
3513
- | RegExp;
3438
+ readonly validate?: ((val: Array<number>) => boolean)
3514
3439
  readonly field?: string;
3515
3440
  }
3516
3441
 
@@ -3529,11 +3454,7 @@ export interface EnumNumberSetAttribute {
3529
3454
  item?: any,
3530
3455
  ) => Array<number> | undefined | void;
3531
3456
  readonly default?: Array<number> | (() => Array<number>);
3532
- readonly validate?:
3533
- | ((val: Array<number>) => boolean)
3534
- | ((val: Array<number>) => void)
3535
- | ((val: Array<number>) => string | void)
3536
- | RegExp;
3457
+ readonly validate?: ((val: Array<number>) => boolean)
3537
3458
  readonly field?: string;
3538
3459
  readonly watch?: ReadonlyArray<string> | "*";
3539
3460
  }
@@ -3555,8 +3476,6 @@ export interface NestedEnumStringSetAttribute {
3555
3476
  readonly default?: Array<string> | (() => Array<string>);
3556
3477
  readonly validate?:
3557
3478
  | ((val: Array<string>) => boolean)
3558
- | ((val: Array<string>) => void)
3559
- | ((val: Array<string>) => string | void)
3560
3479
  | RegExp;
3561
3480
  readonly field?: string;
3562
3481
  }
@@ -3578,8 +3497,6 @@ export interface EnumStringSetAttribute {
3578
3497
  readonly default?: Array<string> | (() => Array<string>);
3579
3498
  readonly validate?:
3580
3499
  | ((val: Array<string>) => boolean)
3581
- | ((val: Array<string>) => void)
3582
- | ((val: Array<string>) => string | void)
3583
3500
  | RegExp;
3584
3501
  readonly field?: string;
3585
3502
  readonly watch?: ReadonlyArray<string> | "*";
@@ -3602,8 +3519,6 @@ export interface StringSetAttribute {
3602
3519
  readonly default?: Array<string> | (() => Array<string>);
3603
3520
  readonly validate?:
3604
3521
  | ((val: Array<string>) => boolean)
3605
- | ((val: Array<string>) => void)
3606
- | ((val: Array<string>) => string | void)
3607
3522
  | RegExp;
3608
3523
  readonly field?: string;
3609
3524
  readonly watch?: ReadonlyArray<string> | "*";
@@ -3624,10 +3539,7 @@ export interface NestedNumberSetAttribute {
3624
3539
  item?: any,
3625
3540
  ) => Array<number> | undefined | void;
3626
3541
  readonly default?: Array<number> | (() => Array<number>);
3627
- readonly validate?:
3628
- | ((val: Array<number>) => boolean)
3629
- | ((val: Array<number>) => void)
3630
- | ((val: Array<number>) => string | void);
3542
+ readonly validate?: ((val: Array<number>) => boolean)
3631
3543
  readonly field?: string;
3632
3544
  }
3633
3545
 
@@ -3646,10 +3558,7 @@ export interface NumberSetAttribute {
3646
3558
  item?: any,
3647
3559
  ) => Array<number> | undefined | void;
3648
3560
  readonly default?: Array<number> | (() => Array<number>);
3649
- readonly validate?:
3650
- | ((val: Array<number>) => boolean)
3651
- | ((val: Array<number>) => void)
3652
- | ((val: Array<number>) => string | void);
3561
+ readonly validate?: ((val: Array<number>) => boolean)
3653
3562
  readonly field?: string;
3654
3563
  readonly watch?: ReadonlyArray<string> | "*";
3655
3564
  }
@@ -3673,10 +3582,7 @@ type CustomAttribute = {
3673
3582
  readonly get?: (val: any, item: any) => any | undefined | void;
3674
3583
  readonly set?: (val?: any, item?: any) => any | undefined | void;
3675
3584
  readonly default?: any | (() => any);
3676
- readonly validate?:
3677
- | ((val: any) => boolean)
3678
- | ((val: any) => void)
3679
- | ((val: any) => string | void);
3585
+ readonly validate?: ((val: any) => boolean)
3680
3586
  readonly field?: string;
3681
3587
  readonly watch?: ReadonlyArray<string> | "*";
3682
3588
  };
@@ -3689,10 +3595,7 @@ type NestedCustomAttribute = {
3689
3595
  readonly get?: (val: any, item: any) => any | undefined | void;
3690
3596
  readonly set?: (val?: any, item?: any) => any | undefined | void;
3691
3597
  readonly default?: any | (() => any);
3692
- readonly validate?:
3693
- | ((val: any) => boolean)
3694
- | ((val: any) => void)
3695
- | ((val: any) => string | void);
3598
+ readonly validate?: ((val: any) => boolean)
3696
3599
  readonly field?: string;
3697
3600
  };
3698
3601
 
@@ -5367,7 +5270,6 @@ export class Entity<
5367
5270
  TableIndexCompositeAttributes<A, F, C, S>
5368
5271
  >;
5369
5272
  query: Queries<A, F, C, S>;
5370
- conversions: Conversions<A, F, C, S>;
5371
5273
 
5372
5274
  parse<Options extends ParseOptions<keyof ResponseItem<A, F, C, S>>>(
5373
5275
  item: ParseSingleInput,
@@ -5404,6 +5306,13 @@ export class Entity<
5404
5306
  client: any;
5405
5307
  }
5406
5308
 
5309
+ declare function createConversions<
5310
+ A extends string,
5311
+ F extends string,
5312
+ C extends string,
5313
+ S extends Schema<A, F, C>,
5314
+ >(entity: Entity<A,F,C,S>): Conversions<A, F, C, S>;
5315
+
5407
5316
  export class TransactWriteEntity<
5408
5317
  A extends string,
5409
5318
  F extends string,
@@ -5778,10 +5687,7 @@ type CustomAttributeDefinition<T> = {
5778
5687
  readonly get?: (val: T, item: any) => T | undefined | void;
5779
5688
  readonly set?: (val?: T, item?: any) => T | undefined | void;
5780
5689
  readonly default?: T | (() => T);
5781
- readonly validate?:
5782
- | ((val: T) => boolean)
5783
- | ((val: T) => void)
5784
- | ((val: T) => string | void);
5690
+ readonly validate?: ((val: T) => boolean)
5785
5691
  readonly field?: string;
5786
5692
  readonly watch?: ReadonlyArray<string> | "*";
5787
5693
  };
@@ -5811,4 +5717,4 @@ declare function createSchema<
5811
5717
  F extends string,
5812
5718
  C extends string,
5813
5719
  S extends Schema<A, F, C>,
5814
- >(schema: S): S;
5720
+ >(schema: S): S;
package/index.js CHANGED
@@ -15,15 +15,24 @@ const {
15
15
  ElectroUserValidationError,
16
16
  ElectroAttributeValidationError,
17
17
  } = require("./src/errors");
18
+ const { createConversions } = require("./src/conversions");
19
+
20
+ const {
21
+ ComparisonTypes
22
+ } = require('./src/types');
18
23
 
19
24
  module.exports = {
20
25
  Entity,
21
26
  Service,
22
27
  ElectroError,
23
28
  createSchema,
29
+ ComparisonTypes,
24
30
  CustomAttributeType,
25
31
  createCustomAttribute,
26
32
  ElectroValidationError,
27
33
  createGetTransaction,
28
34
  createWriteTransaction,
35
+ ElectroUserValidationError,
36
+ ElectroAttributeValidationError,
37
+ createConversions,
29
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrodb",
3
- "version": "2.15.0",
3
+ "version": "3.0.1",
4
4
  "description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
5
5
  "main": "index.js",
6
6
  "scripts": {