electrodb 3.4.1 → 3.4.3

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/index.d.ts CHANGED
@@ -1236,10 +1236,10 @@ export interface RecordsActionOptions<
1236
1236
  F extends string,
1237
1237
  C extends string,
1238
1238
  S extends Schema<A, F, C>,
1239
- Items,
1239
+ ResponseItem,
1240
1240
  IndexCompositeAttributes,
1241
1241
  > {
1242
- go: QueryRecordsGo<Items>;
1242
+ go: QueryRecordsGo<ResponseItem>;
1243
1243
  params: ParamRecord;
1244
1244
  where: WhereClause<
1245
1245
  A,
@@ -1247,7 +1247,7 @@ export interface RecordsActionOptions<
1247
1247
  C,
1248
1248
  S,
1249
1249
  Item<A, F, C, S, S["attributes"]>,
1250
- RecordsActionOptions<A, F, C, S, Items, IndexCompositeAttributes>
1250
+ RecordsActionOptions<A, F, C, S, ResponseItem, IndexCompositeAttributes>
1251
1251
  >;
1252
1252
  }
1253
1253
 
@@ -2537,7 +2537,6 @@ export interface QueryOptions {
2537
2537
  logger?: ElectroEventListener;
2538
2538
  data?: "raw" | "includeKeys" | "attributes";
2539
2539
  order?: "asc" | "desc";
2540
-
2541
2540
  consistent?: boolean;
2542
2541
  }
2543
2542
 
@@ -2855,11 +2854,16 @@ export type ServiceQueryRecordsGo<
2855
2854
  options?: Options,
2856
2855
  ) => Promise<{ data: T; cursor: string | null }>;
2857
2856
 
2858
- export type QueryRecordsGo<ResponseType, Options = QueryOptions> = <
2859
- T = ResponseType,
2860
- >(
2857
+ export type QueryRecordsGo<Item> = <Options extends GoQueryTerminalOptions<keyof Item>>(
2861
2858
  options?: Options,
2862
- ) => Promise<{ data: T; cursor: string | null }>;
2859
+ ) => Options extends GoQueryTerminalOptions<infer Attr>
2860
+ ? Promise<{
2861
+ data: Array<{
2862
+ [Name in keyof Item as Name extends Attr ? Name : never]: Item[Name];
2863
+ }>;
2864
+ cursor: string | null;
2865
+ }>
2866
+ : Promise<{ data: Array<Item>; cursor: string | null }>;
2863
2867
 
2864
2868
  export type UpdateRecordGo<ResponseType, Keys> = <
2865
2869
  T = ResponseType,
@@ -5255,7 +5259,7 @@ export class Entity<
5255
5259
  F,
5256
5260
  C,
5257
5261
  S,
5258
- ResponseItem<A, F, C, S>[],
5262
+ ResponseItem<A, F, C, S>,
5259
5263
  AllTableIndexCompositeAttributes<A, F, C, S>
5260
5264
  >;
5261
5265
 
@@ -5266,7 +5270,7 @@ export class Entity<
5266
5270
  F,
5267
5271
  C,
5268
5272
  S,
5269
- ResponseItem<A, F, C, S>[],
5273
+ ResponseItem<A, F, C, S>,
5270
5274
  AllTableIndexCompositeAttributes<A, F, C, S>
5271
5275
  >;
5272
5276
 
@@ -5275,7 +5279,7 @@ export class Entity<
5275
5279
  F,
5276
5280
  C,
5277
5281
  S,
5278
- ResponseItem<A, F, C, S>[],
5282
+ ResponseItem<A, F, C, S>,
5279
5283
  TableIndexCompositeAttributes<A, F, C, S>
5280
5284
  >;
5281
5285
  query: Queries<A, F, C, S>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electrodb",
3
- "version": "3.4.1",
3
+ "version": "3.4.3",
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": {
package/src/entity.js CHANGED
@@ -943,9 +943,6 @@ class Entity {
943
943
  response.Item,
944
944
  config,
945
945
  );
946
- if (Object.keys(results).length === 0 && !config._objectOnEmpty) {
947
- results = null;
948
- }
949
946
  } else if (!config._objectOnEmpty) {
950
947
  results = null;
951
948
  }
@@ -965,9 +962,7 @@ class Entity {
965
962
  item,
966
963
  config,
967
964
  );
968
- if (Object.keys(record).length > 0 || config._objectOnEmpty) {
969
- results.push(record);
970
- }
965
+ results.push(record);
971
966
  }
972
967
  }
973
968
  } else if (response.Attributes) {
@@ -1732,9 +1727,6 @@ class Entity {
1732
1727
 
1733
1728
  if (Array.isArray(option.attributes)) {
1734
1729
  config.attributes = config.attributes.concat(option.attributes);
1735
- if (config.attributes.length > 0) {
1736
- config._objectOnEmpty = true;
1737
- }
1738
1730
  }
1739
1731
 
1740
1732
  if (option.preserveBatchOrder === true) {