electrodb 1.11.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 +769 -672
- package/index.d.ts +323 -204
- package/index.js +2 -1
- 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/operations.js +7 -1
- package/src/schema.js +39 -11
- package/src/service.js +30 -111
- package/src/types.js +18 -2
- package/src/util.js +24 -0
- package/src/where.js +2 -2
package/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
export type DocumentClientMethod = (parameters: any) => {promise: () => Promise<any>};
|
|
2
3
|
|
|
3
4
|
export type DocumentClient = {
|
|
@@ -80,11 +81,10 @@ export type CollectionWhereCallback<E extends {[name: string]: Entity<any, any,
|
|
|
80
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;
|
|
81
82
|
|
|
82
83
|
|
|
83
|
-
export interface
|
|
84
|
-
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>;
|
|
85
86
|
params: ParamRecord;
|
|
86
|
-
|
|
87
|
-
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>>;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export type CollectionIndexKeys<Entities extends {[name: string]: Entity<any, any, any, any>}, Collections extends CollectionAssociations<Entities>> = {
|
|
@@ -170,7 +170,7 @@ export type CollectionQueries<E extends {[name: string]: Entity<any, any, any, a
|
|
|
170
170
|
]
|
|
171
171
|
>[0]
|
|
172
172
|
>) => {
|
|
173
|
-
go:
|
|
173
|
+
go: ServiceQueryRecordsGo<{
|
|
174
174
|
[EntityResultName in Collections[Collection]]:
|
|
175
175
|
EntityResultName extends keyof E
|
|
176
176
|
? E[EntityResultName] extends Entity<infer A, infer F, infer C, infer S>
|
|
@@ -179,40 +179,13 @@ export type CollectionQueries<E extends {[name: string]: Entity<any, any, any, a
|
|
|
179
179
|
: never
|
|
180
180
|
}>;
|
|
181
181
|
params: ParamRecord;
|
|
182
|
-
page: {
|
|
183
|
-
[EntityResultName in Collections[Collection]]: EntityResultName extends keyof E
|
|
184
|
-
? Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>> extends Partial<AllEntityAttributes<E>>
|
|
185
|
-
?
|
|
186
|
-
PageRecord<
|
|
187
|
-
{
|
|
188
|
-
[EntityResultName in Collections[Collection]]:
|
|
189
|
-
EntityResultName extends keyof E
|
|
190
|
-
? E[EntityResultName] extends Entity<infer A, infer F, infer C, infer S>
|
|
191
|
-
? ResponseItem<A,F,C,S>[]
|
|
192
|
-
: never
|
|
193
|
-
: never
|
|
194
|
-
},
|
|
195
|
-
Partial<
|
|
196
|
-
Spread<
|
|
197
|
-
Collection extends keyof CollectionPageAttributes<E, Collections>
|
|
198
|
-
? CollectionPageAttributes<E, Collections>[Collection]
|
|
199
|
-
: {},
|
|
200
|
-
Collection extends keyof CollectionIndexAttributes<E, Collections>
|
|
201
|
-
? CollectionIndexAttributes<E, Collections>[Collection]
|
|
202
|
-
: {}
|
|
203
|
-
>
|
|
204
|
-
>
|
|
205
|
-
>
|
|
206
|
-
: never
|
|
207
|
-
: never
|
|
208
|
-
}[Collections[Collection]];
|
|
209
182
|
where: {
|
|
210
183
|
[EntityResultName in Collections[Collection]]: EntityResultName extends keyof E
|
|
211
184
|
? E[EntityResultName] extends Entity<infer A, infer F, infer C, infer S>
|
|
212
185
|
? Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>> extends Partial<AllEntityAttributes<E>>
|
|
213
186
|
? CollectionWhereClause<E,A,F,C,S,
|
|
214
187
|
Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>>,
|
|
215
|
-
|
|
188
|
+
ServiceWhereRecordsActionOptions<E,A,F,C,S,
|
|
216
189
|
Pick<AllEntityAttributes<E>, Extract<AllEntityAttributeNames<E>, CollectionAttributes<E,Collections>[Collection]>>,
|
|
217
190
|
{
|
|
218
191
|
[EntityResultName in Collections[Collection]]:
|
|
@@ -259,9 +232,7 @@ export interface ElectroResultsEvent<R extends any = any> {
|
|
|
259
232
|
success: boolean;
|
|
260
233
|
}
|
|
261
234
|
|
|
262
|
-
export type ElectroEvent =
|
|
263
|
-
ElectroQueryEvent
|
|
264
|
-
| ElectroResultsEvent;
|
|
235
|
+
export type ElectroEvent = ElectroQueryEvent | ElectroResultsEvent;
|
|
265
236
|
|
|
266
237
|
export type ElectroEventType = Pick<ElectroEvent, 'type'>;
|
|
267
238
|
|
|
@@ -300,6 +271,16 @@ export type CreateEntityItem<E extends Entity<any, any, any, any>> =
|
|
|
300
271
|
? PutItem<A, F, C, S>
|
|
301
272
|
: never;
|
|
302
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
|
+
|
|
303
284
|
export type UpdateEntityItem<E extends Entity<any, any, any, any>> =
|
|
304
285
|
E extends Entity<infer A, infer F, infer C, infer S>
|
|
305
286
|
? Partial<ResponseItem<A,F,C,S>>
|
|
@@ -350,19 +331,61 @@ export type CollectionItem<SERVICE extends Service<any>, COLLECTION extends keyo
|
|
|
350
331
|
: never>
|
|
351
332
|
: never
|
|
352
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
|
+
|
|
353
378
|
export interface QueryBranches<A extends string,
|
|
354
379
|
F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem, IndexCompositeAttributes> {
|
|
355
380
|
go: GoQueryTerminal<A,F,C,S,ResponseItem>;
|
|
356
381
|
params: ParamTerminal<A,F,C,S,ResponseItem>;
|
|
357
|
-
page: PageQueryTerminal<A,F,C,S,ResponseItem,IndexCompositeAttributes>;
|
|
358
382
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,QueryBranches<A,F,C,S,ResponseItem,IndexCompositeAttributes>>
|
|
359
383
|
}
|
|
360
384
|
|
|
361
385
|
export interface RecordsActionOptions<A extends string,
|
|
362
386
|
F extends string, C extends string, S extends Schema<A,F,C>, Items, IndexCompositeAttributes> {
|
|
363
|
-
go:
|
|
387
|
+
go: QueryRecordsGo<Items>;
|
|
364
388
|
params: ParamRecord;
|
|
365
|
-
page: PageRecord<Items,IndexCompositeAttributes>;
|
|
366
389
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,RecordsActionOptions<A,F,C,S,Items,IndexCompositeAttributes>>;
|
|
367
390
|
}
|
|
368
391
|
|
|
@@ -378,30 +401,24 @@ export interface BatchGetRecordOperationOptions<A extends string, F extends stri
|
|
|
378
401
|
}
|
|
379
402
|
|
|
380
403
|
export interface PutRecordOperationOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseType> {
|
|
381
|
-
go:
|
|
404
|
+
go: PutRecordGo<ResponseType, PutQueryOptions>;
|
|
382
405
|
params: ParamRecord<PutQueryOptions>;
|
|
383
|
-
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,PutRecordOperationOptions<A,F,C,S,ResponseType>>;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
export interface UpdateRecordOperationOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseType> {
|
|
387
|
-
go: GoRecord<ResponseType, UpdateQueryOptions>;
|
|
388
|
-
params: ParamRecord<UpdateQueryParams>;
|
|
389
|
-
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>>;
|
|
390
407
|
}
|
|
391
408
|
|
|
392
409
|
export interface DeleteRecordOperationOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseType> {
|
|
393
|
-
go:
|
|
410
|
+
go: DeleteRecordOperationGo<ResponseType, DeleteQueryOptions>;
|
|
394
411
|
params: ParamRecord<DeleteQueryOptions>;
|
|
395
412
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,DeleteRecordOperationOptions<A,F,C,S,ResponseType>>;
|
|
396
413
|
}
|
|
397
414
|
|
|
398
|
-
export interface
|
|
399
|
-
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>;
|
|
400
417
|
params: ParamRecord<BulkOptions>;
|
|
401
418
|
}
|
|
402
419
|
|
|
403
420
|
export interface SetRecordActionOptions<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, SetAttr,IndexCompositeAttributes,TableItem> {
|
|
404
|
-
go:
|
|
421
|
+
go: UpdateRecordGo<Partial<TableItem>, UpdateQueryOptions>;
|
|
405
422
|
params: ParamRecord<UpdateQueryParams>;
|
|
406
423
|
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>,IndexCompositeAttributes,TableItem>;
|
|
407
424
|
remove: SetRecord<A,F,C,S, Array<keyof SetItem<A,F,C,S>>,IndexCompositeAttributes,TableItem>;
|
|
@@ -413,8 +430,11 @@ export interface SetRecordActionOptions<A extends string, F extends string, C ex
|
|
|
413
430
|
where: WhereClause<A,F,C,S, Item<A,F,C,S,S["attributes"]>,SetRecordActionOptions<A,F,C,S,SetAttr,IndexCompositeAttributes,TableItem>>;
|
|
414
431
|
}
|
|
415
432
|
|
|
416
|
-
export type SetRecord<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, SetAttr, IndexCompositeAttributes, TableItem> = (properties: SetAttr) =>
|
|
417
|
-
|
|
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>;
|
|
418
438
|
|
|
419
439
|
export type DataUpdateMethodRecord<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, SetAttr, IndexCompositeAttributes, TableItem> =
|
|
420
440
|
DataUpdateMethod<A,F,C,S, UpdateData<A,F,C,S>, SetRecordActionOptions<A,F,C,S, SetAttr, IndexCompositeAttributes, TableItem>>
|
|
@@ -428,7 +448,6 @@ interface QueryOperations<A extends string, F extends string, C extends string,
|
|
|
428
448
|
begins: (skCompositeAttributes: CompositeAttributes) => QueryBranches<A,F,C,S, ResponseItem,IndexCompositeAttributes>;
|
|
429
449
|
go: GoQueryTerminal<A,F,C,S,ResponseItem>;
|
|
430
450
|
params: ParamTerminal<A,F,C,S,ResponseItem>;
|
|
431
|
-
page: PageQueryTerminal<A,F,C,S,ResponseItem,IndexCompositeAttributes>;
|
|
432
451
|
where: WhereClause<A,F,C,S,Item<A,F,C,S,S["attributes"]>,QueryBranches<A,F,C,S,ResponseItem,IndexCompositeAttributes>>
|
|
433
452
|
}
|
|
434
453
|
|
|
@@ -464,16 +483,22 @@ export type ParseMultiInput = {
|
|
|
464
483
|
export type ReturnValues = "default" | "none" | 'all_old' | 'updated_old' | 'all_new' | 'updated_new';
|
|
465
484
|
|
|
466
485
|
export interface QueryOptions {
|
|
467
|
-
|
|
486
|
+
cursor?: string | null;
|
|
487
|
+
params?: object;
|
|
468
488
|
table?: string;
|
|
469
489
|
limit?: number;
|
|
470
|
-
params?: object;
|
|
471
|
-
includeKeys?: boolean;
|
|
472
490
|
originalErr?: boolean;
|
|
473
491
|
ignoreOwnership?: boolean;
|
|
474
|
-
pages?: number;
|
|
492
|
+
pages?: number | 'all';
|
|
475
493
|
listeners?: Array<ElectroEventListener>;
|
|
476
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';
|
|
477
502
|
}
|
|
478
503
|
|
|
479
504
|
// subset of QueryOptions
|
|
@@ -502,15 +527,12 @@ export interface PutQueryOptions extends QueryOptions {
|
|
|
502
527
|
}
|
|
503
528
|
|
|
504
529
|
export interface ParamOptions {
|
|
530
|
+
cursor?: string | null;
|
|
505
531
|
params?: object;
|
|
506
532
|
table?: string;
|
|
507
533
|
limit?: number;
|
|
508
534
|
response?: "default" | "none" | 'all_old' | 'updated_old' | 'all_new' | 'updated_new';
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
export interface PaginationOptions extends QueryOptions {
|
|
512
|
-
pager?: "raw" | "item" | "named";
|
|
513
|
-
limit?: number;
|
|
535
|
+
order?: 'asc' | 'desc';
|
|
514
536
|
}
|
|
515
537
|
|
|
516
538
|
export interface BulkOptions extends QueryOptions {
|
|
@@ -525,11 +547,15 @@ export type OptionalDefaultEntityIdentifiers = {
|
|
|
525
547
|
}
|
|
526
548
|
|
|
527
549
|
interface GoBatchGetTerminalOptions<Attributes> {
|
|
550
|
+
data?: 'raw' | 'includeKeys' | 'attributes';
|
|
551
|
+
/** @depricated use 'data=raw' instead */
|
|
528
552
|
raw?: boolean;
|
|
553
|
+
/** @depricated use 'data=raw' instead */
|
|
554
|
+
includeKeys?: boolean;
|
|
555
|
+
|
|
529
556
|
table?: string;
|
|
530
557
|
limit?: number;
|
|
531
558
|
params?: object;
|
|
532
|
-
includeKeys?: boolean;
|
|
533
559
|
originalErr?: boolean;
|
|
534
560
|
ignoreOwnership?: boolean;
|
|
535
561
|
pages?: number;
|
|
@@ -542,30 +568,22 @@ interface GoBatchGetTerminalOptions<Attributes> {
|
|
|
542
568
|
}
|
|
543
569
|
|
|
544
570
|
interface GoQueryTerminalOptions<Attributes> {
|
|
571
|
+
cursor?: string | null,
|
|
572
|
+
data?: 'raw' | 'includeKeys' | 'attributes';
|
|
573
|
+
/** @depricated use 'data=raw' instead */
|
|
545
574
|
raw?: boolean;
|
|
546
|
-
|
|
547
|
-
limit?: number;
|
|
548
|
-
params?: object;
|
|
575
|
+
/** @depricated use 'data=raw' instead */
|
|
549
576
|
includeKeys?: boolean;
|
|
550
|
-
originalErr?: boolean;
|
|
551
|
-
ignoreOwnership?: boolean;
|
|
552
|
-
pages?: number;
|
|
553
|
-
attributes?: ReadonlyArray<Attributes>;
|
|
554
|
-
listeners?: Array<ElectroEventListener>;
|
|
555
|
-
logger?: ElectroEventListener;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
interface PageQueryTerminalOptions<Attributes> extends GoQueryTerminalOptions<Attributes> {
|
|
559
|
-
pager?: "raw" | "item" | "named";
|
|
560
|
-
raw?: boolean;
|
|
561
577
|
table?: string;
|
|
562
578
|
limit?: number;
|
|
563
|
-
|
|
579
|
+
params?: object;
|
|
564
580
|
originalErr?: boolean;
|
|
565
581
|
ignoreOwnership?: boolean;
|
|
582
|
+
pages?: number | 'all';
|
|
566
583
|
attributes?: ReadonlyArray<Attributes>;
|
|
567
584
|
listeners?: Array<ElectroEventListener>;
|
|
568
585
|
logger?: ElectroEventListener;
|
|
586
|
+
order?: 'asc' | 'desc';
|
|
569
587
|
}
|
|
570
588
|
|
|
571
589
|
export interface ParamTerminalOptions<Attributes> {
|
|
@@ -575,126 +593,108 @@ export interface ParamTerminalOptions<Attributes> {
|
|
|
575
593
|
originalErr?: boolean;
|
|
576
594
|
attributes?: ReadonlyArray<Attributes>;
|
|
577
595
|
response?: "default" | "none" | 'all_old' | 'updated_old' | 'all_new' | 'updated_new';
|
|
596
|
+
order?: 'asc' | 'desc';
|
|
578
597
|
}
|
|
579
598
|
|
|
580
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) =>
|
|
581
600
|
Options extends GoBatchGetTerminalOptions<infer Attr>
|
|
582
601
|
? 'preserveBatchOrder' extends keyof Options
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
Name in keyof ResponseItem as Name extends Attr
|
|
597
|
-
? Name
|
|
598
|
-
: never
|
|
599
|
-
]: ResponseItem[Name]
|
|
600
|
-
}>>, Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>>
|
|
601
|
-
]>
|
|
602
|
-
: Promise<[
|
|
603
|
-
Array<Resolve<{
|
|
602
|
+
? Options['preserveBatchOrder'] extends true
|
|
603
|
+
? Promise<{
|
|
604
|
+
data: Array<Resolve<{
|
|
605
|
+
[
|
|
606
|
+
Name in keyof ResponseItem as Name extends Attr
|
|
607
|
+
? Name
|
|
608
|
+
: never
|
|
609
|
+
]: ResponseItem[Name]
|
|
610
|
+
} | null>>,
|
|
611
|
+
unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A,F,C,S>>>
|
|
612
|
+
}>
|
|
613
|
+
: Promise<{
|
|
614
|
+
data: Array<Resolve<{
|
|
604
615
|
[
|
|
605
616
|
Name in keyof ResponseItem as Name extends Attr
|
|
606
617
|
? Name
|
|
607
618
|
: never
|
|
608
619
|
]: ResponseItem[Name]
|
|
609
|
-
}>>,
|
|
610
|
-
|
|
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
|
+
}>
|
|
611
633
|
: 'preserveBatchOrder' extends keyof Options
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
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>>> }
|
|
616
638
|
|
|
617
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) =>
|
|
618
640
|
Options extends GoQueryTerminalOptions<infer Attr>
|
|
619
641
|
? Promise<{
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
: 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 }>
|
|
627
649
|
|
|
628
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) =>
|
|
629
651
|
Options extends GoQueryTerminalOptions<infer Attr>
|
|
630
|
-
? Promise<
|
|
631
|
-
|
|
632
|
-
Name in keyof Item as Name extends Attr
|
|
633
|
-
? Name
|
|
634
|
-
: never
|
|
635
|
-
]: Item[Name]
|
|
636
|
-
}>>
|
|
637
|
-
: Promise<Array<Item>>
|
|
638
|
-
|
|
639
|
-
export type EntityParseSingleItem<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem> =
|
|
640
|
-
<Options extends ParseOptions<keyof ResponseItem>>(item: ParseSingleInput, options?: Options) =>
|
|
641
|
-
Options extends ParseOptions<infer Attr>
|
|
642
|
-
? {
|
|
652
|
+
? Promise<{
|
|
653
|
+
data: Array<{
|
|
643
654
|
[
|
|
644
|
-
Name in keyof
|
|
655
|
+
Name in keyof Item as Name extends Attr
|
|
645
656
|
? Name
|
|
646
657
|
: never
|
|
647
|
-
]:
|
|
648
|
-
}
|
|
649
|
-
:
|
|
658
|
+
]: Item[Name]
|
|
659
|
+
}>,
|
|
660
|
+
cursor: string | null
|
|
661
|
+
}>
|
|
662
|
+
: Promise<{ data: Array<Item>, cursor: string | null }>
|
|
650
663
|
|
|
651
664
|
export type EntityParseMultipleItems<A extends string, F extends string, C extends string, S extends Schema<A,F,C>, ResponseItem> =
|
|
652
665
|
<Options extends ParseOptions<keyof ResponseItem>>(item: ParseMultiInput, options?: Options) =>
|
|
653
666
|
Options extends ParseOptions<infer Attr>
|
|
654
|
-
?
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
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 }
|
|
662
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;
|
|
663
680
|
|
|
664
|
-
export type
|
|
665
|
-
Options extends GoQueryTerminalOptions<infer Attr>
|
|
666
|
-
? Promise<[
|
|
667
|
-
(CompositeAttributes & OptionalDefaultEntityIdentifiers) | null,
|
|
668
|
-
Array<{
|
|
669
|
-
[
|
|
670
|
-
Name in keyof Item as Name extends Attr
|
|
671
|
-
? Name
|
|
672
|
-
: never
|
|
673
|
-
]: Item[Name]
|
|
674
|
-
}>
|
|
675
|
-
]>
|
|
676
|
-
: Promise<[
|
|
677
|
-
(CompositeAttributes & OptionalDefaultEntityIdentifiers) | null,
|
|
678
|
-
Array<ResponseType>
|
|
679
|
-
]>;
|
|
681
|
+
export type ServiceQueryRecordsGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T, cursor: string | null }>;
|
|
680
682
|
|
|
681
|
-
export type
|
|
683
|
+
export type QueryRecordsGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T, cursor: string | null }>;
|
|
682
684
|
|
|
683
|
-
export type
|
|
685
|
+
export type UpdateRecordGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T }>;
|
|
684
686
|
|
|
685
|
-
export type
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
? Options['preserveBatchOrder'] extends true
|
|
689
|
-
? Promise<AlternateResponseType>
|
|
690
|
-
: Promise<ResponseType>
|
|
691
|
-
: Promise<ResponseType>
|
|
692
|
-
: never
|
|
687
|
+
export type PutRecordGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T }>;
|
|
688
|
+
|
|
689
|
+
export type DeleteRecordOperationGo<ResponseType, Options = QueryOptions> = <T = ResponseType>(options?: Options) => Promise<{ data: T }>;
|
|
693
690
|
|
|
694
|
-
export type
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
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
|
+
// ]>;
|
|
698
698
|
|
|
699
699
|
export type ParamRecord<Options = ParamOptions> = <P>(options?: Options) => P;
|
|
700
700
|
|
|
@@ -848,7 +848,6 @@ export interface NestedEnumAttribute {
|
|
|
848
848
|
readonly label?: string;
|
|
849
849
|
}
|
|
850
850
|
|
|
851
|
-
|
|
852
851
|
export interface EnumAttribute {
|
|
853
852
|
readonly type: ReadonlyArray<string>;
|
|
854
853
|
readonly required?: boolean;
|
|
@@ -1032,6 +1031,60 @@ export interface NestedStringSetAttribute {
|
|
|
1032
1031
|
readonly field?: string;
|
|
1033
1032
|
}
|
|
1034
1033
|
|
|
1034
|
+
export interface NestedEnumNumberSetAttribute {
|
|
1035
|
+
readonly type: "set";
|
|
1036
|
+
readonly items: ReadonlyArray<number>;
|
|
1037
|
+
readonly required?: boolean;
|
|
1038
|
+
readonly hidden?: boolean;
|
|
1039
|
+
readonly readOnly?: boolean;
|
|
1040
|
+
readonly get?: (val: Array<number>, item: any) => Array<number> | undefined | void;
|
|
1041
|
+
readonly set?: (val?: Array<number>, item?: any) => Array<number> | undefined | void;
|
|
1042
|
+
readonly default?: Array<number> | (() => Array<number>);
|
|
1043
|
+
readonly validate?: ((val: Array<number>) => boolean) | ((val: Array<number>) => void) | ((val: Array<number>) => string | void) | RegExp;
|
|
1044
|
+
readonly field?: string;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
export interface EnumNumberSetAttribute {
|
|
1048
|
+
readonly type: "set";
|
|
1049
|
+
readonly items: ReadonlyArray<number>;
|
|
1050
|
+
readonly required?: boolean;
|
|
1051
|
+
readonly hidden?: boolean;
|
|
1052
|
+
readonly readOnly?: boolean;
|
|
1053
|
+
readonly get?: (val: Array<number>, item: any) => Array<number> | undefined | void;
|
|
1054
|
+
readonly set?: (val?: Array<number>, item?: any) => Array<number> | undefined | void;
|
|
1055
|
+
readonly default?: Array<number> | (() => Array<number>);
|
|
1056
|
+
readonly validate?: ((val: Array<number>) => boolean) | ((val: Array<number>) => void) | ((val: Array<number>) => string | void) | RegExp;
|
|
1057
|
+
readonly field?: string;
|
|
1058
|
+
readonly watch?: ReadonlyArray<string> | "*";
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
export interface NestedEnumStringSetAttribute {
|
|
1062
|
+
readonly type: "set";
|
|
1063
|
+
readonly items: ReadonlyArray<string>;
|
|
1064
|
+
readonly required?: boolean;
|
|
1065
|
+
readonly hidden?: boolean;
|
|
1066
|
+
readonly readOnly?: boolean;
|
|
1067
|
+
readonly get?: (val: Array<string>, item: any) => Array<string> | undefined | void;
|
|
1068
|
+
readonly set?: (val?: Array<string>, item?: any) => Array<string> | undefined | void;
|
|
1069
|
+
readonly default?: Array<string> | (() => Array<string>);
|
|
1070
|
+
readonly validate?: ((val: Array<string>) => boolean) | ((val: Array<string>) => void) | ((val: Array<string>) => string | void) | RegExp;
|
|
1071
|
+
readonly field?: string;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
export interface EnumStringSetAttribute {
|
|
1075
|
+
readonly type: "set";
|
|
1076
|
+
readonly items: ReadonlyArray<string>;
|
|
1077
|
+
readonly required?: boolean;
|
|
1078
|
+
readonly hidden?: boolean;
|
|
1079
|
+
readonly readOnly?: boolean;
|
|
1080
|
+
readonly get?: (val: Array<string>, item: any) => Array<string> | undefined | void;
|
|
1081
|
+
readonly set?: (val?: Array<string>, item?: any) => Array<string> | undefined | void;
|
|
1082
|
+
readonly default?: Array<string> | (() => Array<string>);
|
|
1083
|
+
readonly validate?: ((val: Array<string>) => boolean) | ((val: Array<string>) => void) | ((val: Array<string>) => string | void) | RegExp;
|
|
1084
|
+
readonly field?: string;
|
|
1085
|
+
readonly watch?: ReadonlyArray<string> | "*";
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1035
1088
|
export interface StringSetAttribute {
|
|
1036
1089
|
readonly type: "set";
|
|
1037
1090
|
readonly items: "string";
|
|
@@ -1073,6 +1126,25 @@ export interface NumberSetAttribute {
|
|
|
1073
1126
|
readonly watch?: ReadonlyArray<string> | "*";
|
|
1074
1127
|
}
|
|
1075
1128
|
|
|
1129
|
+
type StaticAttribute = {
|
|
1130
|
+
readonly type: "static";
|
|
1131
|
+
readonly hidden?: boolean;
|
|
1132
|
+
value: string | number | boolean;
|
|
1133
|
+
readonly field?: string;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
type CustomAttribute<T extends any = any> = {
|
|
1137
|
+
readonly type: "custom";
|
|
1138
|
+
readonly [CustomAttributeSymbol]: T;
|
|
1139
|
+
readonly hidden?: boolean;
|
|
1140
|
+
readonly get?: (val: T, item: any) => T | undefined | void;
|
|
1141
|
+
readonly set?: (val?: T, item?: any) => T | undefined | void;
|
|
1142
|
+
readonly default?: T | (() => T);
|
|
1143
|
+
readonly validate?: ((val: T) => boolean) | ((val: T) => void) | ((val: T) => string | void);
|
|
1144
|
+
readonly field?: string;
|
|
1145
|
+
readonly watch?: ReadonlyArray<string> | "*";
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1076
1148
|
export type Attribute =
|
|
1077
1149
|
BooleanAttribute
|
|
1078
1150
|
| NumberAttribute
|
|
@@ -1084,7 +1156,11 @@ export type Attribute =
|
|
|
1084
1156
|
| NumberSetAttribute
|
|
1085
1157
|
| StringListAttribute
|
|
1086
1158
|
| NumberListAttribute
|
|
1087
|
-
| MapListAttribute
|
|
1159
|
+
| MapListAttribute
|
|
1160
|
+
| StaticAttribute
|
|
1161
|
+
| CustomAttribute
|
|
1162
|
+
| EnumNumberSetAttribute
|
|
1163
|
+
| EnumStringSetAttribute;
|
|
1088
1164
|
|
|
1089
1165
|
export type NestedAttributes =
|
|
1090
1166
|
NestedBooleanAttribute
|
|
@@ -1097,7 +1173,10 @@ export type NestedAttributes =
|
|
|
1097
1173
|
| NestedMapListAttribute
|
|
1098
1174
|
| NestedStringSetAttribute
|
|
1099
1175
|
| NestedNumberSetAttribute
|
|
1100
|
-
| NestedEnumAttribute
|
|
1176
|
+
| NestedEnumAttribute
|
|
1177
|
+
| NestedEnumAttribute
|
|
1178
|
+
| NestedEnumNumberSetAttribute
|
|
1179
|
+
| NestedEnumStringSetAttribute;
|
|
1101
1180
|
|
|
1102
1181
|
export interface IndexWithSortKey {
|
|
1103
1182
|
readonly sk: {
|
|
@@ -1171,7 +1250,9 @@ type PartialDefinedKeys<T> = {
|
|
|
1171
1250
|
}
|
|
1172
1251
|
|
|
1173
1252
|
export type ItemAttribute<A extends Attribute> =
|
|
1174
|
-
A
|
|
1253
|
+
A extends CustomAttribute<infer T>
|
|
1254
|
+
? T
|
|
1255
|
+
: A["type"] extends infer R
|
|
1175
1256
|
? R extends "string" ? string
|
|
1176
1257
|
: R extends "number" ? number
|
|
1177
1258
|
: R extends "boolean" ? boolean
|
|
@@ -1200,7 +1281,8 @@ export type ItemAttribute<A extends Attribute> =
|
|
|
1200
1281
|
? A["items"] extends infer I
|
|
1201
1282
|
? I extends "string" ? string[]
|
|
1202
1283
|
: I extends "number" ? number[]
|
|
1203
|
-
:
|
|
1284
|
+
: I extends ReadonlyArray<infer ENUM> ? ENUM[]
|
|
1285
|
+
: never
|
|
1204
1286
|
: never
|
|
1205
1287
|
: never
|
|
1206
1288
|
: R extends "any" ? any
|
|
@@ -1208,8 +1290,11 @@ export type ItemAttribute<A extends Attribute> =
|
|
|
1208
1290
|
: never
|
|
1209
1291
|
|
|
1210
1292
|
export type ReturnedAttribute<A extends Attribute> =
|
|
1211
|
-
A
|
|
1212
|
-
|
|
1293
|
+
A extends CustomAttribute<infer T>
|
|
1294
|
+
? T
|
|
1295
|
+
: A["type"] extends infer R
|
|
1296
|
+
? R extends "static" ? never
|
|
1297
|
+
: R extends "string" ? string
|
|
1213
1298
|
: R extends "number" ? number
|
|
1214
1299
|
: R extends "boolean" ? boolean
|
|
1215
1300
|
: R extends ReadonlyArray<infer E> ? E
|
|
@@ -1251,7 +1336,8 @@ export type ReturnedAttribute<A extends Attribute> =
|
|
|
1251
1336
|
? A["items"] extends infer I
|
|
1252
1337
|
? I extends "string" ? string[]
|
|
1253
1338
|
: I extends "number" ? number[]
|
|
1254
|
-
:
|
|
1339
|
+
: I extends ReadonlyArray<infer ENUM> ? ENUM[]
|
|
1340
|
+
: never
|
|
1255
1341
|
: never
|
|
1256
1342
|
: never
|
|
1257
1343
|
: R extends "any" ? any
|
|
@@ -1259,8 +1345,11 @@ export type ReturnedAttribute<A extends Attribute> =
|
|
|
1259
1345
|
: never
|
|
1260
1346
|
|
|
1261
1347
|
export type CreatedAttribute<A extends Attribute> =
|
|
1262
|
-
A
|
|
1263
|
-
?
|
|
1348
|
+
A extends CustomAttribute<infer T>
|
|
1349
|
+
? T
|
|
1350
|
+
: A["type"] extends infer R
|
|
1351
|
+
? R extends "static" ? never
|
|
1352
|
+
: R extends "string" ? string
|
|
1264
1353
|
: R extends "number" ? number
|
|
1265
1354
|
: R extends "boolean" ? boolean
|
|
1266
1355
|
: R extends ReadonlyArray<infer E> ? E
|
|
@@ -1302,7 +1391,8 @@ export type CreatedAttribute<A extends Attribute> =
|
|
|
1302
1391
|
? A["items"] extends infer I
|
|
1303
1392
|
? I extends "string" ? string[]
|
|
1304
1393
|
: I extends "number" ? number[]
|
|
1305
|
-
:
|
|
1394
|
+
: I extends ReadonlyArray<infer ENUM> ? ENUM[]
|
|
1395
|
+
: never
|
|
1306
1396
|
: never
|
|
1307
1397
|
: never
|
|
1308
1398
|
: R extends "any" ? any
|
|
@@ -1318,10 +1408,13 @@ export type CreatedItem<A extends string, F extends string, C extends string, S
|
|
|
1318
1408
|
}
|
|
1319
1409
|
|
|
1320
1410
|
export type EditableItemAttribute<A extends Attribute> =
|
|
1321
|
-
A extends
|
|
1411
|
+
A extends CustomAttribute<infer T>
|
|
1412
|
+
? T
|
|
1413
|
+
: A extends ReadOnlyAttribute
|
|
1322
1414
|
? never
|
|
1323
1415
|
: A["type"] extends infer R
|
|
1324
|
-
|
|
1416
|
+
? R extends "static" ? never
|
|
1417
|
+
: R extends "string" ? string
|
|
1325
1418
|
: R extends "number" ? number
|
|
1326
1419
|
: R extends "boolean" ? boolean
|
|
1327
1420
|
: R extends ReadonlyArray<infer E> ? E
|
|
@@ -1353,7 +1446,8 @@ export type EditableItemAttribute<A extends Attribute> =
|
|
|
1353
1446
|
? A["items"] extends infer I
|
|
1354
1447
|
? I extends "string" ? string[]
|
|
1355
1448
|
: I extends "number" ? number[]
|
|
1356
|
-
:
|
|
1449
|
+
: I extends ReadonlyArray<infer ENUM> ? ENUM[]
|
|
1450
|
+
: never
|
|
1357
1451
|
: never
|
|
1358
1452
|
: never
|
|
1359
1453
|
: R extends "any" ? any
|
|
@@ -1361,10 +1455,13 @@ export type EditableItemAttribute<A extends Attribute> =
|
|
|
1361
1455
|
: never
|
|
1362
1456
|
|
|
1363
1457
|
export type UpdatableItemAttribute<A extends Attribute> =
|
|
1364
|
-
A extends
|
|
1458
|
+
A extends CustomAttribute<infer T>
|
|
1459
|
+
? T
|
|
1460
|
+
: A extends ReadOnlyAttribute
|
|
1365
1461
|
? never
|
|
1366
1462
|
: A["type"] extends infer R
|
|
1367
|
-
|
|
1463
|
+
? R extends "static" ? never
|
|
1464
|
+
: R extends "string" ? string
|
|
1368
1465
|
: R extends "number" ? number
|
|
1369
1466
|
: R extends "boolean" ? boolean
|
|
1370
1467
|
: R extends ReadonlyArray<infer E> ? E
|
|
@@ -1411,7 +1508,8 @@ export type UpdatableItemAttribute<A extends Attribute> =
|
|
|
1411
1508
|
? A["items"] extends infer I
|
|
1412
1509
|
? I extends "string" ? string[]
|
|
1413
1510
|
: I extends "number" ? number[]
|
|
1414
|
-
:
|
|
1511
|
+
: I extends ReadonlyArray<infer ENUM> ? ENUM[]
|
|
1512
|
+
: never
|
|
1415
1513
|
: never
|
|
1416
1514
|
: never
|
|
1417
1515
|
: R extends "any" ? any
|
|
@@ -1419,10 +1517,13 @@ export type UpdatableItemAttribute<A extends Attribute> =
|
|
|
1419
1517
|
: never
|
|
1420
1518
|
|
|
1421
1519
|
export type RemovableItemAttribute<A extends Attribute> =
|
|
1422
|
-
A extends
|
|
1520
|
+
A extends CustomAttribute<infer T>
|
|
1521
|
+
? T
|
|
1522
|
+
: A extends ReadOnlyAttribute | RequiredAttribute
|
|
1423
1523
|
? never
|
|
1424
1524
|
: A["type"] extends infer R
|
|
1425
|
-
|
|
1525
|
+
? R extends "static" ? never
|
|
1526
|
+
: R extends "string" ? string
|
|
1426
1527
|
: R extends "number" ? number
|
|
1427
1528
|
: R extends "boolean" ? boolean
|
|
1428
1529
|
: R extends ReadonlyArray<infer E> ? E
|
|
@@ -1454,7 +1555,8 @@ export type RemovableItemAttribute<A extends Attribute> =
|
|
|
1454
1555
|
? A["items"] extends infer I
|
|
1455
1556
|
? I extends "string" ? string[]
|
|
1456
1557
|
: I extends "number" ? number[]
|
|
1457
|
-
:
|
|
1558
|
+
: I extends ReadonlyArray<infer ENUM> ? ENUM[]
|
|
1559
|
+
: never
|
|
1458
1560
|
: never
|
|
1459
1561
|
: never
|
|
1460
1562
|
: R extends "any" ? any
|
|
@@ -1599,7 +1701,7 @@ export type RemoveItem<A extends string, F extends string, C extends string, S e
|
|
|
1599
1701
|
export type AppendItem<A extends string, F extends string, C extends string, S extends Schema<A,F,C>> =
|
|
1600
1702
|
{
|
|
1601
1703
|
[
|
|
1602
|
-
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends 'list' | 'any'
|
|
1704
|
+
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends 'list' | 'any' | 'custom'
|
|
1603
1705
|
? P
|
|
1604
1706
|
: never
|
|
1605
1707
|
]?: P extends keyof SetItem<A,F,C,S>
|
|
@@ -1610,7 +1712,7 @@ export type AppendItem<A extends string, F extends string, C extends string, S e
|
|
|
1610
1712
|
export type AddItem<A extends string, F extends string, C extends string, S extends Schema<A,F,C>> =
|
|
1611
1713
|
{
|
|
1612
1714
|
[
|
|
1613
|
-
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends
|
|
1715
|
+
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends 'number' | 'any' | 'set' | 'custom'
|
|
1614
1716
|
? P
|
|
1615
1717
|
: never
|
|
1616
1718
|
]?: P extends keyof SetItem<A,F,C,S>
|
|
@@ -1621,7 +1723,7 @@ export type AddItem<A extends string, F extends string, C extends string, S exte
|
|
|
1621
1723
|
export type SubtractItem<A extends string, F extends string, C extends string, S extends Schema<A,F,C>> =
|
|
1622
1724
|
{
|
|
1623
1725
|
[
|
|
1624
|
-
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends
|
|
1726
|
+
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends 'number' | 'any' | 'custom'
|
|
1625
1727
|
? P
|
|
1626
1728
|
: never
|
|
1627
1729
|
]?: P extends keyof SetItem<A,F,C,S>
|
|
@@ -1632,7 +1734,7 @@ export type SubtractItem<A extends string, F extends string, C extends string, S
|
|
|
1632
1734
|
export type DeleteItem<A extends string, F extends string, C extends string, S extends Schema<A,F,C>> =
|
|
1633
1735
|
{
|
|
1634
1736
|
[
|
|
1635
|
-
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends
|
|
1737
|
+
P in keyof ItemTypeDescription<A,F,C,S> as ItemTypeDescription<A,F,C,S>[P] extends 'any' | 'set' | 'custom'
|
|
1636
1738
|
? P
|
|
1637
1739
|
: never
|
|
1638
1740
|
]?: P extends keyof SetItem<A,F,C,S>
|
|
@@ -1642,6 +1744,7 @@ export type DeleteItem<A extends string, F extends string, C extends string, S e
|
|
|
1642
1744
|
|
|
1643
1745
|
export declare const WhereSymbol: unique symbol;
|
|
1644
1746
|
export declare const UpdateDataSymbol: unique symbol;
|
|
1747
|
+
export declare const CustomAttributeSymbol: unique symbol;
|
|
1645
1748
|
|
|
1646
1749
|
export type WhereAttributeSymbol<T extends any> =
|
|
1647
1750
|
{ [WhereSymbol]: void }
|
|
@@ -1750,13 +1853,15 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1750
1853
|
|
|
1751
1854
|
get(key: AllTableIndexCompositeAttributes<A,F,C,S>): SingleRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1752
1855
|
get(key: AllTableIndexCompositeAttributes<A,F,C,S>[]): BatchGetRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1856
|
+
|
|
1753
1857
|
delete(key: AllTableIndexCompositeAttributes<A,F,C,S>): DeleteRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1754
|
-
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>>
|
|
1755
1860
|
|
|
1756
1861
|
put(record: PutItem<A,F,C,S>): PutRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>;
|
|
1757
|
-
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>>
|
|
1758
1864
|
|
|
1759
|
-
remove(key: AllTableIndexCompositeAttributes<A,F,C,S>): DeleteRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>
|
|
1760
1865
|
update(key: AllTableIndexCompositeAttributes<A,F,C,S>): {
|
|
1761
1866
|
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1762
1867
|
remove: RemoveRecord<A,F,C,S, RemoveItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
@@ -1766,7 +1871,6 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1766
1871
|
delete: SetRecord<A,F,C,S, DeleteItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1767
1872
|
data: DataUpdateMethodRecord<A,F,C,S, Item<A,F,C,S,S["attributes"]>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1768
1873
|
};
|
|
1769
|
-
|
|
1770
1874
|
patch(key: AllTableIndexCompositeAttributes<A,F,C,S>): {
|
|
1771
1875
|
set: SetRecord<A,F,C,S, SetItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1772
1876
|
remove: RemoveRecord<A,F,C,S, RemoveItem<A,F,C,S>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
@@ -1777,7 +1881,6 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1777
1881
|
data: DataUpdateMethodRecord<A,F,C,S, Item<A,F,C,S,S["attributes"]>, TableIndexCompositeAttributes<A,F,C,S>, ResponseItem<A,F,C,S>>;
|
|
1778
1882
|
};
|
|
1779
1883
|
|
|
1780
|
-
create(record: PutItem<A,F,C,S>): PutRecordOperationOptions<A,F,C,S, ResponseItem<A,F,C,S>>
|
|
1781
1884
|
|
|
1782
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>>;
|
|
1783
1886
|
|
|
@@ -1789,23 +1892,25 @@ export class Entity<A extends string, F extends string, C extends string, S exte
|
|
|
1789
1892
|
parse<Options extends ParseOptions<keyof ResponseItem<A,F,C,S>>>(item: ParseSingleInput, options?: Options):
|
|
1790
1893
|
Options extends ParseOptions<infer Attr>
|
|
1791
1894
|
? {
|
|
1895
|
+
data: {
|
|
1792
1896
|
[
|
|
1793
1897
|
Name in keyof ResponseItem<A,F,C,S> as Name extends Attr
|
|
1794
1898
|
? Name
|
|
1795
1899
|
: never
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1900
|
+
]: ResponseItem<A,F,C,S>[Name]
|
|
1901
|
+
} | null
|
|
1902
|
+
}
|
|
1903
|
+
: { data: ResponseItem<A,F,C,S> | null }
|
|
1799
1904
|
parse<Options extends ParseOptions<keyof ResponseItem<A,F,C,S>>>(item: ParseMultiInput, options?: Options):
|
|
1800
1905
|
Options extends ParseOptions<infer Attr>
|
|
1801
|
-
? Array<{
|
|
1906
|
+
? { data: Array<{
|
|
1802
1907
|
[
|
|
1803
1908
|
Name in keyof ResponseItem<A,F,C,S> as Name extends Attr
|
|
1804
1909
|
? Name
|
|
1805
1910
|
: never
|
|
1806
1911
|
]: ResponseItem<A,F,C,S>[Name]
|
|
1807
|
-
}
|
|
1808
|
-
: Array<ResponseItem<A,F,C,S
|
|
1912
|
+
}>, cursor: string | null }
|
|
1913
|
+
: { data: Array<ResponseItem<A,F,C,S>>, cursor: string | null }
|
|
1809
1914
|
setIdentifier(type: "entity" | "version", value: string): void;
|
|
1810
1915
|
client: any;
|
|
1811
1916
|
}
|
|
@@ -1821,4 +1926,18 @@ export class Service<E extends {[name: string]: Entity<any, any, any, any>}> {
|
|
|
1821
1926
|
entities: E;
|
|
1822
1927
|
collections: CollectionQueries<E, CollectionAssociations<E>>
|
|
1823
1928
|
constructor(entities: E, config?: ServiceConfiguration);
|
|
1824
|
-
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
type CustomAttributeDefinition<T> = {
|
|
1932
|
+
readonly required?: boolean;
|
|
1933
|
+
readonly hidden?: boolean;
|
|
1934
|
+
readonly readOnly?: boolean;
|
|
1935
|
+
readonly get?: (val: T, item: any) => T | undefined | void;
|
|
1936
|
+
readonly set?: (val?: T, item?: any) => T | undefined | void;
|
|
1937
|
+
readonly default?: T | (() => T);
|
|
1938
|
+
readonly validate?: ((val: T) => boolean) | ((val: T) => void) | ((val: T) => string | void);
|
|
1939
|
+
readonly field?: string;
|
|
1940
|
+
readonly watch?: ReadonlyArray<string> | "*";
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
declare function createCustomAttribute<T>(definition?: CustomAttributeDefinition<T>): CustomAttribute<T>;
|