dyna-record 0.0.17 → 0.0.19
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
|
@@ -42,7 +42,7 @@ yarn add dyna-record
|
|
|
42
42
|
|
|
43
43
|
## Defining Entities
|
|
44
44
|
|
|
45
|
-
Entities in Dyna-Record represent your DynamoDB table
|
|
45
|
+
Entities in Dyna-Record represent your DynamoDB table structure and relationships. Think of each entity as a table in a relational database, even though they will be represented on a single table.
|
|
46
46
|
|
|
47
47
|
### Table
|
|
48
48
|
|
|
@@ -128,9 +128,8 @@ class Student extends MyTable {
|
|
|
128
128
|
|
|
129
129
|
@Entity
|
|
130
130
|
class Course extends MyTable {
|
|
131
|
-
...
|
|
131
|
+
/// ...
|
|
132
132
|
}
|
|
133
|
-
|
|
134
133
|
```
|
|
135
134
|
|
|
136
135
|
### Attributes
|
package/dist/src/DynaRecord.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type QueryOptions as QueryBuilderOptions } from "./query-utils";
|
|
2
|
-
import { type FindByIdOptions, type FindByIdIncludesRes, type QueryOptions, type EntityKeyConditions, type QueryResults, type CreateOptions, type UpdateOptions } from "./operations";
|
|
2
|
+
import { type FindByIdOptions, type FindByIdIncludesRes, type QueryOptions, type EntityKeyConditions, type QueryResults, Create, type CreateOptions, type UpdateOptions } from "./operations";
|
|
3
3
|
import type { EntityClass, Optional } from "./types";
|
|
4
4
|
interface DynaRecordBase {
|
|
5
5
|
id: string;
|
|
@@ -166,7 +166,7 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
166
166
|
* const newUser = await User.create({ name: "Alice", email: "alice@example.com", profileId: "123" });
|
|
167
167
|
* ```
|
|
168
168
|
*/
|
|
169
|
-
static create<T extends DynaRecord>(this: EntityClass<T>, attributes: CreateOptions<T>): Promise<T
|
|
169
|
+
static create<T extends DynaRecord>(this: EntityClass<T>, attributes: CreateOptions<T>): Promise<ReturnType<Create<T>["run"]>>;
|
|
170
170
|
/**
|
|
171
171
|
* Update an entity. If foreign keys are included in the attribute then:
|
|
172
172
|
* - BelongsToLinks will be created accordingly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynaRecord.d.ts","sourceRoot":"","sources":["../../src/DynaRecord.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAExB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"DynaRecord.d.ts","sourceRoot":"","sources":["../../src/DynaRecord.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,IAAI,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAExB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,MAAM,EACN,KAAK,aAAa,EAElB,KAAK,aAAa,EAEnB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAErD,UAAU,cAAc;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,uBAAe,UAAW,YAAW,cAAc;IACjD;;OAEG;IACH,SACgB,EAAE,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,SACgB,IAAI,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,SACgB,SAAS,EAAE,IAAI,CAAC;IAEhC;;OAEG;IACH,SACgB,SAAS,EAAE,IAAI,CAAC;IAEhC;;;;;;;;;;;;;;;OAeG;WAC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B,OAAO,CAAC,IAAI,CAAC;IAKhB;;;;;;;;;;OAUG;WACiB,MAAM,CAAC,CAAC,SAAS,UAAU,EAC7C,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC;IAKhB;;;;;;;;;OASG;WACW,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;CAIpD;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type DynaRecord from "../../DynaRecord";
|
|
|
2
2
|
import type { EntityClass } from "../../types";
|
|
3
3
|
import OperationBase from "../OperationBase";
|
|
4
4
|
import type { CreateOptions } from "./types";
|
|
5
|
+
import { type EntityAttributes } from "../types";
|
|
5
6
|
/**
|
|
6
7
|
* Represents the operation for creating a new entity in the database, including handling its attributes and any related entities' associations. It will handle de-normalizing data to support relationships
|
|
7
8
|
*
|
|
@@ -17,7 +18,7 @@ declare class Create<T extends DynaRecord> extends OperationBase<T> {
|
|
|
17
18
|
* @param attributes
|
|
18
19
|
* @returns
|
|
19
20
|
*/
|
|
20
|
-
run(attributes: CreateOptions<T>): Promise<T
|
|
21
|
+
run(attributes: CreateOptions<T>): Promise<EntityAttributes<T>>;
|
|
21
22
|
/**
|
|
22
23
|
* Builds the entity attributes
|
|
23
24
|
* @param attributes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Create.d.ts","sourceRoot":"","sources":["../../../../src/operations/Create/Create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Create.d.ts","sourceRoot":"","sources":["../../../../src/operations/Create/Create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;;GAMG;AACH,cAAM,MAAM,CAAC,CAAC,SAAS,UAAU,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;;gBAG7C,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAKlC;;;;OAIG;IACU,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAa5E;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;;OAGG;YACW,6BAA6B;CAU5C;AAED,eAAe,MAAM,CAAC"}
|