electrodb 1.12.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +1 -1
- package/README.md +686 -648
- package/index.d.ts +180 -179
- package/package.json +1 -1
- package/src/clauses.js +15 -32
- package/src/entity.js +176 -89
- package/src/errors.js +6 -0
- package/src/filters.js +2 -2
- package/src/service.js +30 -111
- package/src/types.js +15 -2
- package/src/util.js +24 -0
- package/src/where.js +2 -2
- package/notes +0 -45
- package/output +0 -106
- package/taskdata.json +0 -1
- package/typez.ts +0 -1736
package/index.d.ts
CHANGED
|
@@ -81,11 +81,10 @@ export type CollectionWhereCallback<E extends {[name: string]: Entity<any, any,
|
|
|
81
81
|
export type CollectionWhereClause<E extends {[name: string]: Entity<any, any, any, any>}, A extends string, F extends string, C extends string, S extends Schema<A,F,C>, I extends Partial<AllEntityAttributes<E>>, T> = (where: CollectionWhereCallback<E, I>) => T;
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
export interface
|
|
85
|
-
go:
|
|
84
|
+
export interface ServiceWhereRecordsActionOptions<E extends {[name: string]: Entity<any, any, any, any>}, A extends string, F extends string, C extends string, S extends Schema<A,F,C>, I extends Partial<AllEntityAttributes<E>>, Items, IndexCompositeAttributes> {
|
|
85
|
+
go: ServiceQueryRecordsGo<Items>;
|
|
86
86
|
params: ParamRecord;
|
|
87
|
-
|
|
88
|
-
where: CollectionWhereClause<E,A,F,C,S,I, WhereRecordsActionOptions<E,A,F,C,S,I,Items,IndexCompositeAttributes>>;
|
|
87
|
+
where: CollectionWhereClause<E,A,F,C,S,I, ServiceWhereRecordsActionOptions<E,A,F,C,S,I,Items,IndexCompositeAttributes>>;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
export type CollectionIndexKeys<Entities extends {[name: string]: Entity<any, any, any, any>}, Collections extends CollectionAssociations<Entities>> = {
|
|
@@ -171,7 +170,7 @@ export type CollectionQueries<E extends {[name: string]: Entity<any, any, any, a
|
|
|
171
170
|
]
|
|
172
171
|
>[0]
|
|
173
172
|
>) => {
|
|
174
|
-
go:
|
|
173
|
+
go: ServiceQueryRecordsGo<{
|
|
175
174
|
[EntityResultName in Collections[Collection]]:
|
|
176
175
|
EntityResultName extends keyof E
|
|
177
176
|
? E[EntityResultName] extends Entity<infer A, infer F, infer C, infer S>
|
|
@@ -180,40 +179,13 @@ export type CollectionQueries<E extends {[name: string]: Entity<any, any, any, a
|
|
|
180
179
|
: never
|
|
181
180
|
}>;
|
|
182
181
|
params: ParamRecord;
|
|
183
|
-
page: {
|
|
184
|
-
[EntityResultName in Collections[Collection]]: EntityResultName extends keyof E
|
|
185
|
-
? Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>> extends Partial<AllEntityAttributes<E>>
|
|
186
|
-
?
|
|
187
|
-
PageRecord<
|
|
188
|
-
{
|
|
189
|
-
[EntityResultName in Collections[Collection]]:
|
|
190
|
-
EntityResultName extends keyof E
|
|
191
|
-
? E[EntityResultName] extends Entity<infer A, infer F, infer C, infer S>
|
|
192
|
-
? ResponseItem<A,F,C,S>[]
|
|
193
|
-
: never
|
|
194
|
-
: never
|
|
195
|
-
},
|
|
196
|
-
Partial<
|
|
197
|
-
Spread<
|
|
198
|
-
Collection extends keyof CollectionPageAttributes<E, Collections>
|
|
199
|
-
? CollectionPageAttributes<E, Collections>[Collection]
|
|
200
|
-
: {},
|
|
201
|
-
Collection extends keyof CollectionIndexAttributes<E, Collections>
|
|
202
|
-
? CollectionIndexAttributes<E, Collections>[Collection]
|
|
203
|
-
: {}
|
|
204
|
-
>
|
|
205
|
-
>
|
|
206
|
-
>
|
|
207
|
-
: never
|
|
208
|
-
: never
|
|
209
|
-
}[Collections[Collection]];
|
|
210
182
|
where: {
|
|
211
183
|
[EntityResultName in Collections[Collection]]: EntityResultName extends keyof E
|
|
212
184
|
? E[EntityResultName] extends Entity<infer A, infer F, infer C, infer S>
|
|
213
185
|
? Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>> extends Partial<AllEntityAttributes<E>>
|
|
214
186
|
? CollectionWhereClause<E,A,F,C,S,
|
|
215
187
|
Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>>,
|
|
216
|
-
|
|
188
|
+
ServiceWhereRecordsActionOptions<E,A,F,C,S,
|
|
217
189
|
Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>>,
|
|
218
190
|
{
|
|
219
191
|
[EntityResultName in Collections[Collection]]:
|
|
@@ -260,9 +232,7 @@ export interface ElectroResultsEvent<R extends any = any> {
|
|
|
260
232
|
success: boolean;
|
|
261
233
|
}
|
|
262
234
|
|
|
263
|
-
export type ElectroEvent =
|
|
264
|
-
ElectroQueryEvent
|
|
265
|
-
| ElectroResultsEvent;
|
|
235
|
+
export type ElectroEvent = ElectroQueryEvent | ElectroResultsEvent;
|
|
266
236
|
|
|
267
237
|
export type ElectroEventType = Pick<ElectroEvent, 'type'>;
|
|
268
238
|
|
|
@@ -301,6 +271,16 @@ export type CreateEntityItem<E extends Entity<any, any, any, any>> =
|
|
|
301
271
|
? PutItem<A, F, C, S>
|
|
302
272
|
: never;
|
|
303
273
|
|
|
274
|
+
export type BatchWriteEntityItem<E extends Entity<any, any, any, any>> =
|
|
275
|
+
E extends Entity<infer A, infer F, infer C, infer S>
|
|
276
|
+
? PutItem<A, F, C, S>[]
|
|
277
|
+
: never;
|
|
278
|
+
|
|
279
|
+
export type BatchGetEntityItem<E extends Entity<any, any, any, any>> =
|
|
280
|
+
E extends Entity<infer A, infer F, infer C, infer S>
|
|
281
|
+
? ResponseItem<A, F, C, S>[]
|
|
282
|
+
: never;
|
|
283
|
+
|
|
304
284
|
export type UpdateEntityItem<E extends Entity<any, any, any, any>> =
|
|
305
285
|
E extends Entity<infer A, infer F, infer C, infer S>
|
|
306
286
|
? Partial<ResponseItem<A,F,C,S>>
|
|
@@ -351,19 +331,61 @@ export type CollectionItem<SERVICE extends Service<any>, COLLECTION extends keyo
|
|
|
351
331
|
: never>
|
|
352
332
|
: never
|
|
353
333
|
|
|
334
|
+
export type QueryResponse<E extends Entity<any, any, any, any>> = {
|
|
335
|
+
data: EntityItem<E>[];
|
|
336
|
+
cursor: string | null;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export type CreateEntityResponse<E extends Entity<any, any, any, any>> = {
|
|
340
|
+
data: CreateEntityItem<E>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export type BatchWriteResponse<E extends Entity<any, any, any, any>> =
|
|
344
|
+
E extends Entity<infer A, infer F, infer C, infer S> ? {
|
|
345
|
+
unprocessed: AllTableIndexCompositeAttributes<A,F,C,S>[];
|
|
346
|
+
} : never
|
|
347
|
+
|
|
348
|
+
export type BatchGetResponse<E extends Entity<any, any, any, any>> =
|
|
349
|
+
E extends Entity<infer A, infer F, infer C, infer S> ? {
|
|
350
|
+
data: EntityItem<E>[];
|
|
351
|
+
unprocessed: AllTableIndexCompositeAttributes<A,F,C,S>[];
|
|
352
|
+
} : never;
|
|
353
|
+
|
|
354
|
+
export type UpdateEntityResponse<E extends Entity<any, any, any, any>> = {
|
|
355
|
+
data: UpdateEntityItem<E>;
|
|
356
|
+
}
|
|
357
|
+
export type UpdateAddEntityResponse<E extends Entity<any, any, any, any>> = {
|
|
358
|
+
data: UpdateAddEntityItem<E>;
|
|
359
|
+
}
|
|
360
|
+
export type UpdateSubtractEntityResponse<E extends Entity<any, any, any, any>> = {
|
|
361
|
+
data: UpdateSubtractEntityItem<E>;
|
|
362
|
+
}
|
|
363
|
+
export type UpdateAppendEntityResponse<E extends Entity<any, any, any, any>> = {
|
|
364
|
+
data: UpdateAppendEntityItem<E>;
|
|
365
|
+
}
|
|
366
|
+
export type UpdateRemoveEntityResponse<E extends Entity<any, any, any, any>> = {
|
|
367
|
+
data: UpdateRemoveEntityItem<E>;
|
|
368
|
+
}
|
|
369
|
+
export type UpdateDeleteEntityResponse<E extends Entity<any, any, any, any>> = {
|
|
370
|
+
data: UpdateDeleteEntityItem<E>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export type CollectionResponse<SERVICE extends Service<any>, COLLECTION extends keyof SERVICE["collections"]> = {
|
|
374
|
+
data: CollectionItem<SERVICE, COLLECTION>;
|
|
375
|
+
cursor: string | null;
|
|
376
|
+
}
|
|
377
|
+
|
|
354
378
|
export interface QueryBranches<A extends string,
|
|
355
379
|
F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem, IndexCompositeAttributes> {
|
|
356
380
|
go: GoQueryTerminal<A,F,C,S,ResponseItem>;
|
|
357
381
|
params: ParamTerminal<A,F,C,S,ResponseItem>;
|
|
358
|
-
page: PageQueryTerminal<A,F,C,S,ResponseItem,IndexCompositeAttributes>;
|
|
359
382
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,QueryBranches<A,F,C,S,ResponseItem,IndexCompositeAttributes>>
|
|
360
383
|
}
|
|
361
384
|
|
|
362
385
|
export interface RecordsActionOptions<A extends string,
|
|
363
386
|
F extends string, C extends string, S extends Schema<A,F,C>, Items, IndexCompositeAttributes> {
|
|
364
|
-
go:
|
|
387
|
+
go: QueryRecordsGo<Items>;
|
|
365
388
|
params: ParamRecord;
|
|
366
|
-
page: PageRecord<Items,IndexCompositeAttributes>;
|
|
367
389
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,RecordsActionOptions<A,F,C,S,Items,IndexCompositeAttributes>>;
|
|
368
390
|
}
|
|
369
391
|
|
|
@@ -379,30 +401,24 @@ export interface BatchGetRecordOperationOptions<A extends string, F extends stri
|
|
|
379
401
|
}
|
|
380
402
|
|
|
381
403
|
export interface PutRecordOperationOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseType> {
|
|
382
|
-
go:
|
|
404
|
+
go: PutRecordGo<ResponseType, PutQueryOptions>;
|
|
383
405
|
params: ParamRecord<PutQueryOptions>;
|
|
384
|
-
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,PutRecordOperationOptions<A,F,C,S,ResponseType>>;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export interface UpdateRecordOperationOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseType> {
|
|
388
|
-
go: GoRecord<ResponseType, UpdateQueryOptions>;
|
|
389
|
-
params: ParamRecord<UpdateQueryParams>;
|
|
390
|
-
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,PutRecordOperationOptions<A,F,C,S,ResponseType>>;
|
|
406
|
+
where: WhereClause<A, F, C, S, Item<A, F, C, S, S["attributes"]>, PutRecordOperationOptions<A, F, C, S, ResponseType>>;
|
|
391
407
|
}
|
|
392
408
|
|
|
393
409
|
export interface DeleteRecordOperationOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseType> {
|
|
394
|
-
go:
|
|
410
|
+
go: DeleteRecordOperationGo<ResponseType, DeleteQueryOptions>;
|
|
395
411
|
params: ParamRecord<DeleteQueryOptions>;
|
|
396
412
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,DeleteRecordOperationOptions<A,F,C,S,ResponseType>>;
|
|
397
413
|
}
|
|
398
414
|
|
|
399
|
-
export interface
|
|
400
|
-
go:
|
|
415
|
+
export interface BatchWriteOperationOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseType> {
|
|
416
|
+
go: BatchWriteGo<ResponseType>;
|
|
401
417
|
params: ParamRecord<BulkOptions>;
|
|
402
418
|
}
|
|
403
419
|
|
|
404
420
|
export interface SetRecordActionOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, SetAttr,IndexCompositeAttributes,TableItem> {
|
|
405
|
-
go:
|
|
421
|
+
go: UpdateRecordGo<Partial<TableItem>, UpdateQueryOptions>;
|
|
406
422
|
params: ParamRecord<UpdateQueryParams>;
|
|
407
423
|
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>,IndexCompositeAttributes,TableItem>;
|
|
408
424
|
remove: SetRecord<A,F,C,S, Array<keyof SetItem<A,F,C,S>>,IndexCompositeAttributes,TableItem>;
|
|
@@ -414,8 +430,11 @@ export interface SetRecordActionOptions<A extends string, F extends string, C ex
|
|
|
414
430
|
where: WhereClause<A,F,C,S, Item<A,F,C,S,S["attributes"]>,SetRecordActionOptions<A,F,C,S,SetAttr,IndexCompositeAttributes,TableItem>>;
|
|
415
431
|
}
|
|
416
432
|
|
|
417
|
-
export type SetRecord<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, SetAttr, IndexCompositeAttributes, TableItem> = (properties: SetAttr) =>
|
|
418
|
-
|
|
433
|
+
export type SetRecord<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, SetAttr, IndexCompositeAttributes, TableItem> = (properties: SetAttr) =>
|
|
434
|
+
SetRecordActionOptions<A,F,C,S, SetAttr, IndexCompositeAttributes, TableItem>;
|
|
435
|
+
|
|
436
|
+
export type RemoveRecord<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, RemoveAttr, IndexCompositeAttributes, TableItem> = (properties: RemoveAttr) =>
|
|
437
|
+
SetRecordActionOptions<A,F,C,S, RemoveAttr, IndexCompositeAttributes, TableItem>;
|
|
419
438
|
|
|
420
439
|
export type DataUpdateMethodRecord<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, SetAttr, IndexCompositeAttributes, TableItem> =
|
|
421
440
|
DataUpdateMethod<A,F,C,S, UpdateData<A,F,C,S>, SetRecordActionOptions<A,F,C,S, SetAttr, IndexCompositeAttributes, TableItem>>
|
|
@@ -429,7 +448,6 @@ interface QueryOperations<A extends string, F extends string, C extends string,
|
|
|
429
448
|
begins: (skCompositeAttributes: CompositeAttributes) => QueryBranches<A,F,C,S, ResponseItem,IndexCompositeAttributes>;
|
|
430
449
|
go: GoQueryTerminal<A,F,C,S,ResponseItem>;
|
|
431
450
|
params: ParamTerminal<A,F,C,S,ResponseItem>;
|
|
432
|
-
page: PageQueryTerminal<A,F,C,S,ResponseItem,IndexCompositeAttributes>;
|
|
433
451
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,QueryBranches<A,F,C,S,ResponseItem,IndexCompositeAttributes>>
|
|
434
452
|
}
|
|
435
453
|
|
|
@@ -465,16 +483,22 @@ export type ParseMultiInput = {
|
|
|
465
483
|
export type ReturnValues = "default" | "none" | 'all_old' | 'updated_old' | 'all_new' | 'updated_new';
|
|
466
484
|
|
|
467
485
|
export interface QueryOptions {
|
|
468
|
-
|
|
486
|
+
cursor?: string | null;
|
|
487
|
+
params?: object;
|
|
469
488
|
table?: string;
|
|
470
489
|
limit?: number;
|
|
471
|
-
params?: object;
|
|
472
|
-
includeKeys?: boolean;
|
|
473
490
|
originalErr?: boolean;
|
|
474
491
|
ignoreOwnership?: boolean;
|
|
475
|
-
pages?: number;
|
|
492
|
+
pages?: number | 'all';
|
|
476
493
|
listeners?: Array<ElectroEventListener>;
|
|
477
494
|
logger?: ElectroEventListener;
|
|
495
|
+
data?: 'raw' | 'includeKeys' | 'attributes';
|
|
496
|
+
|
|
497
|
+
/** @depricated use 'data=raw' instead */
|
|
498
|
+
raw?: boolean;
|
|
499
|
+
/** @depricated use 'data=includeKeys' instead */
|
|
500
|
+
includeKeys?: boolean;
|
|
501
|
+
order?: 'asc' | 'desc';
|
|
478
502
|
}
|
|
479
503
|
|
|
480
504
|
// subset of QueryOptions
|
|
@@ -503,15 +527,12 @@ export interface PutQueryOptions extends QueryOptions {
|
|
|
503
527
|
}
|
|
504
528
|
|
|
505
529
|
export interface ParamOptions {
|
|
530
|
+
cursor?: string | null;
|
|
506
531
|
params?: object;
|
|
507
532
|
table?: string;
|
|
508
533
|
limit?: number;
|
|
509
534
|
response?: "default" | "none" | 'all_old' | 'updated_old' | 'all_new' | 'updated_new';
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
export interface PaginationOptions extends QueryOptions {
|
|
513
|
-
pager?: "raw" | "item" | "named";
|
|
514
|
-
limit?: number;
|
|
535
|
+
order?: 'asc' | 'desc';
|
|
515
536
|
}
|
|
516
537
|
|
|
517
538
|
export interface BulkOptions extends QueryOptions {
|
|
@@ -526,11 +547,15 @@ export type OptionalDefaultEntityIdentifiers = {
|
|
|
526
547
|
}
|
|
527
548
|
|
|
528
549
|
interface GoBatchGetTerminalOptions<Attributes> {
|
|
550
|
+
data?: 'raw' | 'includeKeys' | 'attributes';
|
|
551
|
+
/** @depricated use 'data=raw' instead */
|
|
529
552
|
raw?: boolean;
|
|
553
|
+
/** @depricated use 'data=raw' instead */
|
|
554
|
+
includeKeys?: boolean;
|
|
555
|
+
|
|
530
556
|
table?: string;
|
|
531
557
|
limit?: number;
|
|
532
558
|
params?: object;
|
|
533
|
-
includeKeys?: boolean;
|
|
534
559
|
originalErr?: boolean;
|
|
535
560
|
ignoreOwnership?: boolean;
|
|
536
561
|
pages?: number;
|
|
@@ -543,30 +568,22 @@ interface GoBatchGetTerminalOptions<Attributes> {
|
|
|
543
568
|
}
|
|
544
569
|
|
|
545
570
|
interface GoQueryTerminalOptions<Attributes> {
|
|
571
|
+
cursor?: string | null,
|
|
572
|
+
data?: 'raw' | 'includeKeys' | 'attributes';
|
|
573
|
+
/** @depricated use 'data=raw' instead */
|
|
546
574
|
raw?: boolean;
|
|
547
|
-
|
|
548
|
-
limit?: number;
|
|
549
|
-
params?: object;
|
|
575
|
+
/** @depricated use 'data=raw' instead */
|
|
550
576
|
includeKeys?: boolean;
|
|
551
|
-
originalErr?: boolean;
|
|
552
|
-
ignoreOwnership?: boolean;
|
|
553
|
-
pages?: number;
|
|
554
|
-
attributes?: ReadonlyArray<Attributes>;
|
|
555
|
-
listeners?: Array<ElectroEventListener>;
|
|
556
|
-
logger?: ElectroEventListener;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
interface PageQueryTerminalOptions<Attributes> extends GoQueryTerminalOptions<Attributes> {
|
|
560
|
-
pager?: "raw" | "item" | "named";
|
|
561
|
-
raw?: boolean;
|
|
562
577
|
table?: string;
|
|
563
578
|
limit?: number;
|
|
564
|
-
|
|
579
|
+
params?: object;
|
|
565
580
|
originalErr?: boolean;
|
|
566
581
|
ignoreOwnership?: boolean;
|
|
582
|
+
pages?: number | 'all';
|
|
567
583
|
attributes?: ReadonlyArray<Attributes>;
|
|
568
584
|
listeners?: Array<ElectroEventListener>;
|
|
569
585
|
logger?: ElectroEventListener;
|
|
586
|
+
order?: 'asc' | 'desc';
|
|
570
587
|
}
|
|
571
588
|
|
|
572
589
|
export interface ParamTerminalOptions<Attributes> {
|
|
@@ -576,126 +593,108 @@ export interface ParamTerminalOptions<Attributes> {
|
|
|
576
593
|
originalErr?: boolean;
|
|
577
594
|
attributes?: ReadonlyArray<Attributes>;
|
|
578
595
|
response?: "default" | "none" | 'all_old' | 'updated_old' | 'all_new' | 'updated_new';
|
|
596
|
+
order?: 'asc' | 'desc';
|
|
579
597
|
}
|
|
580
598
|
|
|
581
599
|
type GoBatchGetTerminal<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem> = <Options extends GoBatchGetTerminalOptions<keyof ResponseItem>>(options?: Options) =>
|
|
582
600
|
Options extends GoBatchGetTerminalOptions<infer Attr>
|
|
583
601
|
? 'preserveBatchOrder' extends keyof Options
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
[
|
|
588
|
-
Name in keyof ResponseItem as Name extends Attr
|
|
589
|
-
? Name
|
|
590
|
-
: never
|
|
591
|
-
]: ResponseItem[Name]
|
|
592
|
-
} | null>>, Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>>
|
|
593
|
-
]>
|
|
594
|
-
: Promise<[
|
|
595
|
-
Array<Resolve<{
|
|
596
|
-
[
|
|
597
|
-
Name in keyof ResponseItem as Name extends Attr
|
|
598
|
-
? Name
|
|
599
|
-
: never
|
|
600
|
-
]: ResponseItem[Name]
|
|
601
|
-
}>>, Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>>
|
|
602
|
-
]>
|
|
603
|
-
: Promise<[
|
|
604
|
-
Array<Resolve<{
|
|
602
|
+
? Options['preserveBatchOrder'] extends true
|
|
603
|
+
? Promise<{
|
|
604
|
+
data: Array<Resolve<{
|
|
605
605
|
[
|
|
606
606
|
Name in keyof ResponseItem as Name extends Attr
|
|
607
607
|
? Name
|
|
608
608
|
: never
|
|
609
609
|
]: ResponseItem[Name]
|
|
610
|
-
}>>,
|
|
611
|
-
|
|
610
|
+
} | null>>,
|
|
611
|
+
unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>>
|
|
612
|
+
}>
|
|
613
|
+
: Promise<{
|
|
614
|
+
data: Array<Resolve<{
|
|
615
|
+
[
|
|
616
|
+
Name in keyof ResponseItem as Name extends Attr
|
|
617
|
+
? Name
|
|
618
|
+
: never
|
|
619
|
+
]: ResponseItem[Name]
|
|
620
|
+
}>>,
|
|
621
|
+
unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>>
|
|
622
|
+
}>
|
|
623
|
+
: Promise<{
|
|
624
|
+
data: Array<Resolve<{
|
|
625
|
+
[
|
|
626
|
+
Name in keyof ResponseItem as Name extends Attr
|
|
627
|
+
? Name
|
|
628
|
+
: never
|
|
629
|
+
]: ResponseItem[Name]
|
|
630
|
+
}>>,
|
|
631
|
+
unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>>
|
|
632
|
+
}>
|
|
612
633
|
: 'preserveBatchOrder' extends keyof Options
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
634
|
+
? Options['preserveBatchOrder'] extends true
|
|
635
|
+
? { data: Array<Resolve<ResponseItem | null>>, unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>> }
|
|
636
|
+
: { data: Array<Resolve<ResponseItem>>, unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>> }
|
|
637
|
+
: { data: Array<Resolve<ResponseItem>>, unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>> }
|
|
617
638
|
|
|
618
639
|
type GoGetTerminal<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem> = <Options extends GoQueryTerminalOptions<keyof ResponseItem>>(options?: Options) =>
|
|
619
640
|
Options extends GoQueryTerminalOptions<infer Attr>
|
|
620
641
|
? Promise<{
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
627
|
-
: Promise<ResponseItem | null>
|
|
642
|
+
data: {
|
|
643
|
+
[Name in keyof ResponseItem as Name extends Attr
|
|
644
|
+
? Name
|
|
645
|
+
: never]: ResponseItem[Name]
|
|
646
|
+
} | null
|
|
647
|
+
}>
|
|
648
|
+
: Promise<{ data: ResponseItem | null }>
|
|
628
649
|
|
|
629
650
|
export type GoQueryTerminal<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, Item> = <Options extends GoQueryTerminalOptions<keyof Item>>(options?: Options) =>
|
|
630
651
|
Options extends GoQueryTerminalOptions<infer Attr>
|
|
631
|
-
? Promise<
|
|
632
|
-
|
|
633
|
-
Name in keyof Item as Name extends Attr
|
|
634
|
-
? Name
|
|
635
|
-
: never
|
|
636
|
-
]: Item[Name]
|
|
637
|
-
}>>
|
|
638
|
-
: Promise<Array<Item>>
|
|
639
|
-
|
|
640
|
-
export type EntityParseSingleItem<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem> =
|
|
641
|
-
<Options extends ParseOptions<keyof ResponseItem>>(item: ParseSingleInput, options?: Options) =>
|
|
642
|
-
Options extends ParseOptions<infer Attr>
|
|
643
|
-
? {
|
|
652
|
+
? Promise<{
|
|
653
|
+
data: Array<{
|
|
644
654
|
[
|
|
645
|
-
Name in keyof
|
|
655
|
+
Name in keyof Item as Name extends Attr
|
|
646
656
|
? Name
|
|
647
657
|
: never
|
|
648
|
-
]:
|
|
649
|
-
}
|
|
650
|
-
:
|
|
658
|
+
]: Item[Name]
|
|
659
|
+
}>,
|
|
660
|
+
cursor: string | null
|
|
661
|
+
}>
|
|
662
|
+
: Promise<{ data: Array<Item>, cursor: string | null }>
|
|
651
663
|
|
|
652
664
|
export type EntityParseMultipleItems<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem> =
|
|
653
665
|
<Options extends ParseOptions<keyof ResponseItem>>(item: ParseMultiInput, options?: Options) =>
|
|
654
666
|
Options extends ParseOptions<infer Attr>
|
|
655
|
-
?
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
667
|
+
? {
|
|
668
|
+
data: Array<{
|
|
669
|
+
[
|
|
670
|
+
Name in keyof ResponseItem as Name extends Attr
|
|
671
|
+
? Name
|
|
672
|
+
: never
|
|
673
|
+
]: ResponseItem[Name]
|
|
674
|
+
}>,
|
|
675
|
+
cursor?: string | null
|
|
676
|
+
}
|
|
677
|
+
: { data: Array<ResponseItem>, cursor?: string | null }
|
|
663
678
|
|
|
679
|
+
export type ParamTerminal<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem> = <P extends any = any, Options extends ParamTerminalOptions<keyof ResponseItem> = ParamTerminalOptions<keyof ResponseItem>>(options?: Options) => P;
|
|
664
680
|
|
|
665
|
-
export type
|
|
666
|
-
Options extends GoQueryTerminalOptions<infer Attr>
|
|
667
|
-
? Promise<[
|
|
668
|
-
(CompositeAttributes & OptionalDefaultEntityIdentifiers) | null,
|
|
669
|
-
Array<{
|
|
670
|
-
[
|
|
671
|
-
Name in keyof Item as Name extends Attr
|
|
672
|
-
? Name
|
|
673
|
-
: never
|
|
674
|
-
]: Item[Name]
|
|
675
|
-
}>
|
|
676
|
-
]>
|
|
677
|
-
: Promise<[
|
|
678
|
-
(CompositeAttributes & OptionalDefaultEntityIdentifiers) | null,
|
|
679
|
-
Array<ResponseType>
|
|
680
|
-
]>;
|
|
681
|
+
export type ServiceQueryRecordsGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T, cursor: string | null }>;
|
|
681
682
|
|
|
682
|
-
export type
|
|
683
|
+
export type QueryRecordsGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T, cursor: string | null }>;
|
|
683
684
|
|
|
684
|
-
export type
|
|
685
|
+
export type UpdateRecordGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T }>;
|
|
685
686
|
|
|
686
|
-
export type
|
|
687
|
-
O extends infer Options
|
|
688
|
-
? 'preserveBatchOrder' extends keyof Options
|
|
689
|
-
? Options['preserveBatchOrder'] extends true
|
|
690
|
-
? Promise<AlternateResponseType>
|
|
691
|
-
: Promise<ResponseType>
|
|
692
|
-
: Promise<ResponseType>
|
|
693
|
-
: never
|
|
687
|
+
export type PutRecordGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T }>;
|
|
694
688
|
|
|
695
|
-
export type
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
689
|
+
export type DeleteRecordOperationGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T }>;
|
|
690
|
+
|
|
691
|
+
export type BatchWriteGo<ResponseType> = <O extends BulkOptions>(options?: O) =>
|
|
692
|
+
Promise<{ unprocessed: ResponseType }>
|
|
693
|
+
|
|
694
|
+
// export type PageRecord<ResponseType, CompositeAttributes> = (page?: (CompositeAttributes & OptionalDefaultEntityIdentifiers) | null, options?: PaginationOptions) => Promise<[
|
|
695
|
+
// (CompositeAttributes & OptionalDefaultEntityIdentifiers) | null,
|
|
696
|
+
// ResponseType
|
|
697
|
+
// ]>;
|
|
699
698
|
|
|
700
699
|
export type ParamRecord<Options = ParamOptions> = <P>(options?: Options) => P;
|
|
701
700
|
|
|
@@ -1854,13 +1853,15 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1854
1853
|
|
|
1855
1854
|
get(key: AllTableIndexCompositeAttributes<A,F,C,S>): SingleRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1856
1855
|
get(key: AllTableIndexCompositeAttributes<A,F,C,S>[]): BatchGetRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1856
|
+
|
|
1857
1857
|
delete(key: AllTableIndexCompositeAttributes<A,F,C,S>): DeleteRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1858
|
-
delete(key: AllTableIndexCompositeAttributes<A,F,C,S>[]):
|
|
1858
|
+
delete(key: AllTableIndexCompositeAttributes<A,F,C,S>[]): BatchWriteOperationOptions<A,F,C,S, AllTableIndexCompositeAttributes<A,F,C,S>[]>;
|
|
1859
|
+
remove(key: AllTableIndexCompositeAttributes<A,F,C,S>): DeleteRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>
|
|
1859
1860
|
|
|
1860
1861
|
put(record: PutItem<A,F,C,S>): PutRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1861
|
-
put(record: PutItem<A,F,C,S>[]):
|
|
1862
|
+
put(record: PutItem<A,F,C,S>[]): BatchWriteOperationOptions<A,F,C,S, AllTableIndexCompositeAttributes<A,F,C,S>[]>;
|
|
1863
|
+
create(record: PutItem<A,F,C,S>): PutRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>
|
|
1862
1864
|
|
|
1863
|
-
remove(key: AllTableIndexCompositeAttributes<A,F,C,S>): DeleteRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>
|
|
1864
1865
|
update(key: AllTableIndexCompositeAttributes<A,F,C,S>): {
|
|
1865
1866
|
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1866
1867
|
remove: RemoveRecord<A,F,C,S, RemoveItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
@@ -1870,7 +1871,6 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1870
1871
|
delete: SetRecord<A,F,C,S, DeleteItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1871
1872
|
data: DataUpdateMethodRecord<A,F,C,S, Item<A,F,C,S,S["attributes"]>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1872
1873
|
};
|
|
1873
|
-
|
|
1874
1874
|
patch(key: AllTableIndexCompositeAttributes<A,F,C,S>): {
|
|
1875
1875
|
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1876
1876
|
remove: RemoveRecord<A,F,C,S, RemoveItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
@@ -1881,7 +1881,6 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1881
1881
|
data: DataUpdateMethodRecord<A,F,C,S, Item<A,F,C,S,S["attributes"]>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1882
1882
|
};
|
|
1883
1883
|
|
|
1884
|
-
create(record: PutItem<A,F,C,S>): PutRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>
|
|
1885
1884
|
|
|
1886
1885
|
find(record: Partial<Item<A,F,C,S,S["attributes"]>>): RecordsActionOptions<A,F,C,S, ResponseItem<A,F,C,S>[], AllTableIndexCompositeAttributes<A,F,C,S>>;
|
|
1887
1886
|
|
|
@@ -1893,23 +1892,25 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1893
1892
|
parse<Options extends ParseOptions<keyof ResponseItem<A,F,C,S>>>(item: ParseSingleInput, options?: Options):
|
|
1894
1893
|
Options extends ParseOptions<infer Attr>
|
|
1895
1894
|
? {
|
|
1895
|
+
data: {
|
|
1896
1896
|
[
|
|
1897
1897
|
Name in keyof ResponseItem<A,F,C,S> as Name extends Attr
|
|
1898
1898
|
? Name
|
|
1899
1899
|
: never
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1900
|
+
]: ResponseItem<A,F,C,S>[Name]
|
|
1901
|
+
} | null
|
|
1902
|
+
}
|
|
1903
|
+
: { data: ResponseItem<A,F,C,S> | null }
|
|
1903
1904
|
parse<Options extends ParseOptions<keyof ResponseItem<A,F,C,S>>>(item: ParseMultiInput, options?: Options):
|
|
1904
1905
|
Options extends ParseOptions<infer Attr>
|
|
1905
|
-
? Array<{
|
|
1906
|
+
? { data: Array<{
|
|
1906
1907
|
[
|
|
1907
1908
|
Name in keyof ResponseItem<A,F,C,S> as Name extends Attr
|
|
1908
1909
|
? Name
|
|
1909
1910
|
: never
|
|
1910
1911
|
]: ResponseItem<A,F,C,S>[Name]
|
|
1911
|
-
}
|
|
1912
|
-
: Array<ResponseItem<A,F,C,S
|
|
1912
|
+
}>, cursor: string | null }
|
|
1913
|
+
: { data: Array<ResponseItem<A,F,C,S>>, cursor: string | null }
|
|
1913
1914
|
setIdentifier(type: "entity" | "version", value: string): void;
|
|
1914
1915
|
client: any;
|
|
1915
1916
|
}
|