dyna-record 0.1.5 → 0.2.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 +11 -13
- package/dist/src/DynaRecord.d.ts +36 -28
- package/dist/src/DynaRecord.d.ts.map +1 -1
- package/dist/src/DynaRecord.js +39 -36
- package/dist/src/decorators/Table.d.ts.map +1 -1
- package/dist/src/decorators/attributes/BooleanAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/DateAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/EnumAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/ForeignKeyAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/NumberAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/PartitionKeyAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/SortKeyAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/StringAttribute.d.ts.map +1 -1
- package/dist/src/decorators/attributes/serializers.d.ts +1 -1
- package/dist/src/decorators/relationships/BelongsTo.d.ts.map +1 -1
- package/dist/src/decorators/relationships/HasAndBelongsToMany.d.ts.map +1 -1
- package/dist/src/decorators/relationships/HasMany.d.ts +7 -0
- package/dist/src/decorators/relationships/HasMany.d.ts.map +1 -1
- package/dist/src/decorators/relationships/HasMany.js +12 -2
- package/dist/src/decorators/relationships/HasOne.d.ts.map +1 -1
- package/dist/src/decorators/types.d.ts +2 -2
- package/dist/src/decorators/types.d.ts.map +1 -1
- package/dist/src/dynamo-utils/TransactGetBuilder.d.ts +4 -0
- package/dist/src/dynamo-utils/TransactGetBuilder.d.ts.map +1 -1
- package/dist/src/dynamo-utils/TransactGetBuilder.js +6 -0
- package/dist/src/metadata/EntityMetadata.d.ts +21 -1
- package/dist/src/metadata/EntityMetadata.d.ts.map +1 -1
- package/dist/src/metadata/EntityMetadata.js +33 -0
- package/dist/src/metadata/TableMetadata.d.ts.map +1 -1
- package/dist/src/metadata/TableMetadata.js +1 -3
- package/dist/src/metadata/relationship-metadata/BelongsToRelationship.d.ts +1 -1
- package/dist/src/metadata/relationship-metadata/BelongsToRelationship.js +1 -1
- package/dist/src/metadata/relationship-metadata/HasManyRelationship.d.ts +2 -1
- package/dist/src/metadata/relationship-metadata/HasManyRelationship.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/HasManyRelationship.js +2 -1
- package/dist/src/metadata/relationship-metadata/OwnedByRelationship.d.ts +18 -0
- package/dist/src/metadata/relationship-metadata/OwnedByRelationship.d.ts.map +1 -0
- package/dist/src/metadata/relationship-metadata/OwnedByRelationship.js +26 -0
- package/dist/src/metadata/relationship-metadata/RelationshipMetadata.d.ts +1 -1
- package/dist/src/metadata/relationship-metadata/RelationshipMetadata.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/index.d.ts +2 -1
- package/dist/src/metadata/relationship-metadata/index.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/index.js +3 -1
- package/dist/src/metadata/relationship-metadata/types.d.ts +7 -2
- package/dist/src/metadata/relationship-metadata/types.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/utils.d.ts.map +1 -1
- package/dist/src/metadata/relationship-metadata/utils.js +3 -0
- package/dist/src/metadata/types.d.ts +7 -4
- package/dist/src/metadata/types.d.ts.map +1 -1
- package/dist/src/metadata/utils.d.ts +8 -4
- package/dist/src/metadata/utils.d.ts.map +1 -1
- package/dist/src/metadata/utils.js +8 -1
- package/dist/src/operations/Create/Create.d.ts +95 -16
- package/dist/src/operations/Create/Create.d.ts.map +1 -1
- package/dist/src/operations/Create/Create.js +171 -22
- package/dist/src/operations/Delete/Delete.d.ts +32 -23
- package/dist/src/operations/Delete/Delete.d.ts.map +1 -1
- package/dist/src/operations/Delete/Delete.js +117 -100
- package/dist/src/operations/Delete/types.d.ts +0 -3
- package/dist/src/operations/Delete/types.d.ts.map +1 -1
- package/dist/src/operations/FindById/FindById.d.ts +7 -28
- package/dist/src/operations/FindById/FindById.d.ts.map +1 -1
- package/dist/src/operations/FindById/FindById.js +36 -125
- package/dist/src/operations/FindById/types.d.ts +8 -9
- package/dist/src/operations/FindById/types.d.ts.map +1 -1
- package/dist/src/operations/Query/Query.d.ts +2 -1
- package/dist/src/operations/Query/Query.d.ts.map +1 -1
- package/dist/src/operations/Query/Query.js +17 -4
- package/dist/src/operations/Query/types.d.ts +39 -5
- package/dist/src/operations/Query/types.d.ts.map +1 -1
- package/dist/src/operations/Update/Update.d.ts +185 -24
- package/dist/src/operations/Update/Update.d.ts.map +1 -1
- package/dist/src/operations/Update/Update.js +409 -72
- package/dist/src/operations/Update/UpdateDryRun.d.ts +10 -0
- package/dist/src/operations/Update/UpdateDryRun.d.ts.map +1 -0
- package/dist/src/operations/Update/UpdateDryRun.js +15 -0
- package/dist/src/operations/Update/index.d.ts +1 -0
- package/dist/src/operations/Update/index.d.ts.map +1 -1
- package/dist/src/operations/Update/index.js +3 -1
- package/dist/src/operations/types.d.ts +6 -1
- package/dist/src/operations/types.d.ts.map +1 -1
- package/dist/src/operations/utils/expressionBuilder.d.ts.map +1 -1
- package/dist/src/operations/utils/expressionBuilder.js +1 -4
- package/dist/src/operations/utils/index.d.ts +0 -1
- package/dist/src/operations/utils/index.d.ts.map +1 -1
- package/dist/src/operations/utils/index.js +0 -6
- package/dist/src/operations/utils/utils.d.ts +13 -3
- package/dist/src/operations/utils/utils.d.ts.map +1 -1
- package/dist/src/operations/utils/utils.js +33 -3
- package/dist/src/query-utils/Filters.d.ts +1 -1
- package/dist/src/query-utils/Filters.d.ts.map +1 -1
- package/dist/src/query-utils/Filters.js +7 -15
- package/dist/src/query-utils/QueryBuilder.d.ts.map +1 -1
- package/dist/src/query-utils/QueryBuilder.js +9 -1
- package/dist/src/relationships/JoinTable.d.ts +17 -7
- package/dist/src/relationships/JoinTable.d.ts.map +1 -1
- package/dist/src/relationships/JoinTable.js +77 -20
- package/dist/src/relationships/index.d.ts +0 -1
- package/dist/src/relationships/index.d.ts.map +1 -1
- package/dist/src/relationships/index.js +1 -3
- package/dist/src/types.d.ts +6 -8
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +10 -32
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +13 -59
- package/package.json +5 -5
- package/dist/src/operations/utils/RelationshipTransactions.d.ts +0 -64
- package/dist/src/operations/utils/RelationshipTransactions.d.ts.map +0 -1
- package/dist/src/operations/utils/RelationshipTransactions.js +0 -125
- package/dist/src/relationships/BelongsToLink.d.ts +0 -51
- package/dist/src/relationships/BelongsToLink.d.ts.map +0 -1
- package/dist/src/relationships/BelongsToLink.js +0 -57
package/README.md
CHANGED
|
@@ -89,9 +89,7 @@ import DynaRecord, {
|
|
|
89
89
|
id: { alias: "Id" },
|
|
90
90
|
type: { alias: "Type" },
|
|
91
91
|
createdAt: { alias: "CreatedAt" },
|
|
92
|
-
updatedAt: { alias: "UpdatedAt" }
|
|
93
|
-
foreignKey: { alias: "ForeignKey" },
|
|
94
|
-
foreignEntityType: { alias: "ForeignEntityType" }
|
|
92
|
+
updatedAt: { alias: "UpdatedAt" }
|
|
95
93
|
}
|
|
96
94
|
})
|
|
97
95
|
abstract class MyTable extends DynaRecord {
|
|
@@ -203,7 +201,7 @@ class Course extends MyTable {
|
|
|
203
201
|
|
|
204
202
|
### Relationships
|
|
205
203
|
|
|
206
|
-
Dyna-Record supports defining relationships between entities such as [@HasOne](https://dyna-record.com/functions/HasOne.html), [@HasMany](https://dyna-record.com/functions/HasMany.html), [@BelongsTo](https://dyna-record.com/functions/BelongsTo.html) and [@HasAndBelongsToMany](https://dyna-record.com/functions/HasAndBelongsToMany.html). It does this by de-normalizing
|
|
204
|
+
Dyna-Record supports defining relationships between entities such as [@HasOne](https://dyna-record.com/functions/HasOne.html), [@HasMany](https://dyna-record.com/functions/HasMany.html), [@BelongsTo](https://dyna-record.com/functions/BelongsTo.html) and [@HasAndBelongsToMany](https://dyna-record.com/functions/HasAndBelongsToMany.html). It does this by de-normalizing records to each of its related entities partitions.
|
|
207
205
|
|
|
208
206
|
A relationship can be defined as nullable or non-nullable. Non-nullable relationships will be enforced via transactions and violations will result in [NullConstraintViolationError](https://dyna-record.com/classes/NullConstraintViolationError.html)
|
|
209
207
|
|
|
@@ -393,7 +391,7 @@ There are two main patterns; query by id and query by primary key
|
|
|
393
391
|
|
|
394
392
|
To query items using the id, simply pass the partition key value as the first parameter. This fetches all items that share the same partition key value.
|
|
395
393
|
|
|
396
|
-
The result will be an array of the entity
|
|
394
|
+
The result will be an array of the entity or related entities that match the filters
|
|
397
395
|
|
|
398
396
|
##### Query by id
|
|
399
397
|
|
|
@@ -416,7 +414,7 @@ const result = await Customer.query("123", {
|
|
|
416
414
|
To be more precise to the underlying data, you can specify the partition key and sort key directly. The keys here will be the partition and sort keys defined on the [table](#table) class.
|
|
417
415
|
|
|
418
416
|
```typescript
|
|
419
|
-
const
|
|
417
|
+
const orders = await Customer.query({
|
|
420
418
|
pk: "Customer#123",
|
|
421
419
|
sk: { $beginsWith: "Order" }
|
|
422
420
|
});
|
|
@@ -433,17 +431,17 @@ const result = await Course.query(
|
|
|
433
431
|
},
|
|
434
432
|
{
|
|
435
433
|
filter: {
|
|
436
|
-
type: ["
|
|
434
|
+
type: ["Assignment", "Teacher"],
|
|
437
435
|
createdAt: { $beginsWith: "202" },
|
|
438
436
|
$or: [
|
|
439
437
|
{
|
|
440
|
-
|
|
438
|
+
name: "Potions",
|
|
441
439
|
updatedAt: { $beginsWith: "2023-02-15" }
|
|
442
440
|
},
|
|
443
441
|
{
|
|
444
|
-
|
|
442
|
+
type: ["science", "math"],
|
|
445
443
|
createdAt: { $beginsWith: "2021-09-15T" },
|
|
446
|
-
|
|
444
|
+
type: "Assignment"
|
|
447
445
|
},
|
|
448
446
|
{
|
|
449
447
|
id: "123"
|
|
@@ -540,14 +538,14 @@ await User.delete("user-id");
|
|
|
540
538
|
|
|
541
539
|
When deleting entities involved in HasMany or HasOne relationships:
|
|
542
540
|
|
|
543
|
-
If a Pet belongs to an Owner (HasMany relationship), deleting the Pet will remove its
|
|
544
|
-
If a Home belongs to a Person (HasOne relationship), deleting the Home will remove its
|
|
541
|
+
If a Pet belongs to an Owner (HasMany relationship), deleting the Pet will remove its denormalized records from the Owner's partition.
|
|
542
|
+
If a Home belongs to a Person (HasOne relationship), deleting the Home will remove its denormalized records from the Person's partition.
|
|
545
543
|
|
|
546
544
|
```typescript
|
|
547
545
|
await Home.delete("123");
|
|
548
546
|
```
|
|
549
547
|
|
|
550
|
-
This deletes the Home entity and its
|
|
548
|
+
This deletes the Home entity and its denormalized record with a Person.
|
|
551
549
|
|
|
552
550
|
#### Deleting Entities from HasAndBelongsToMany Relationships
|
|
553
551
|
|
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, Create, type CreateOptions, type UpdateOptions } from "./operations";
|
|
2
|
+
import { type FindByIdOptions, type FindByIdIncludesRes, type QueryOptions, type EntityKeyConditions, type QueryResults, Create, type CreateOptions, type UpdateOptions, type EntityAttributesInstance } from "./operations";
|
|
3
3
|
import type { EntityClass, Optional } from "./types";
|
|
4
4
|
interface DynaRecordBase {
|
|
5
5
|
id: string;
|
|
@@ -48,22 +48,30 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
48
48
|
*/
|
|
49
49
|
readonly updatedAt: Date;
|
|
50
50
|
/**
|
|
51
|
-
* Find an entity by Id and optionally include associations
|
|
52
|
-
*
|
|
53
|
-
* @param {
|
|
54
|
-
* @returns
|
|
51
|
+
* Find an entity by Id and optionally include associations.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} id - Entity Id.
|
|
54
|
+
* @param {undefined} [options] - No options provided, returns the entity without included associations.
|
|
55
|
+
* @returns {Optional<T>} An entity without included associations serialized.
|
|
55
56
|
*
|
|
56
57
|
* @example Without included relationships
|
|
57
58
|
* ```typescript
|
|
58
59
|
* const user = await User.findById("userId");
|
|
59
60
|
* ```
|
|
60
61
|
*
|
|
62
|
+
* ---
|
|
63
|
+
*
|
|
64
|
+
* @param {string} id - Entity Id.
|
|
65
|
+
* @param {FindByIdOptions<T>} options - FindByIdOptions specifying associations to include.
|
|
66
|
+
* @returns {FindByIdIncludesRes<T, FindByIdOptions<T>>} An entity with included associations serialized.
|
|
67
|
+
*
|
|
61
68
|
* @example With included relationships
|
|
62
69
|
* ```typescript
|
|
63
70
|
* const user = await User.findById("userId", { include: [{ association: "profile" }] });
|
|
64
71
|
* ```
|
|
65
72
|
*/
|
|
66
|
-
static findById<T extends DynaRecord
|
|
73
|
+
static findById<T extends DynaRecord>(this: EntityClass<T>, id: string, options?: undefined): Promise<Optional<EntityAttributesInstance<T>>>;
|
|
74
|
+
static findById<T extends DynaRecord, Opts extends FindByIdOptions<T>>(this: EntityClass<T>, id: string, options?: Opts): Promise<Optional<FindByIdIncludesRes<T, Opts>>>;
|
|
67
75
|
/**
|
|
68
76
|
* Query by PartitionKey and optional SortKey/Filter/Index conditions
|
|
69
77
|
* @param {Object} key - PartitionKey value and optional SortKey condition. Keys must be attributes defined on the model
|
|
@@ -92,23 +100,22 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
92
100
|
* },
|
|
93
101
|
* {
|
|
94
102
|
* filter: {
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* }
|
|
103
|
+
* type: ["Profile", "Preferences"],
|
|
104
|
+
* createdAt: { $beginsWith: "2023" },
|
|
105
|
+
* $or: [
|
|
106
|
+
* {
|
|
107
|
+
* name: "John",
|
|
108
|
+
* email: { $beginsWith: "testing }
|
|
109
|
+
* },
|
|
110
|
+
* {
|
|
111
|
+
* name: "Jane",
|
|
112
|
+
* updatedAt: { $beginsWith: "2024" },
|
|
113
|
+
* },
|
|
114
|
+
* {
|
|
115
|
+
* id: "123"
|
|
116
|
+
* }
|
|
117
|
+
* ]
|
|
118
|
+
* }
|
|
112
119
|
* }
|
|
113
120
|
*);
|
|
114
121
|
* ```
|
|
@@ -150,7 +157,7 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
150
157
|
* ```typescript
|
|
151
158
|
* const user = await User.query("123", {
|
|
152
159
|
* filter: {
|
|
153
|
-
* type: "
|
|
160
|
+
* type: "Profile",
|
|
154
161
|
* createdAt: "2023-11-21T12:31:21.148Z"
|
|
155
162
|
* }
|
|
156
163
|
* });
|
|
@@ -158,7 +165,7 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
158
165
|
*/
|
|
159
166
|
static query<T extends DynaRecord>(this: EntityClass<T>, id: string, options?: Omit<QueryOptions, "indexName">): Promise<QueryResults<T>>;
|
|
160
167
|
/**
|
|
161
|
-
* Create an entity. If foreign keys are included in the attributes then
|
|
168
|
+
* Create an entity. If foreign keys are included in the attributes then links will be demoralized accordingly
|
|
162
169
|
* @param attributes - Attributes of the model to create
|
|
163
170
|
* @returns The new Entity
|
|
164
171
|
*
|
|
@@ -169,8 +176,8 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
169
176
|
static create<T extends DynaRecord>(this: EntityClass<T>, attributes: CreateOptions<T>): Promise<ReturnType<Create<T>["run"]>>;
|
|
170
177
|
/**
|
|
171
178
|
* Update an entity. If foreign keys are included in the attribute then:
|
|
172
|
-
* -
|
|
173
|
-
* - If the entity already had a foreign key relationship, then
|
|
179
|
+
* - Manages associated relationship links as needed
|
|
180
|
+
* - If the entity already had a foreign key relationship, then denormalized records will be deleted from each partition
|
|
174
181
|
* - If the foreign key is not nullable then a {@link NullConstraintViolationError} is thrown.
|
|
175
182
|
* - Validation errors will be thrown if the attribute being removed is not nullable
|
|
176
183
|
* @param id - The id of the entity to update
|
|
@@ -205,7 +212,7 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
205
212
|
update<T extends this>(attributes: UpdateOptions<T>): Promise<T>;
|
|
206
213
|
/**
|
|
207
214
|
* Delete an entity by ID
|
|
208
|
-
* - Delete all
|
|
215
|
+
* - Delete all denormalized records
|
|
209
216
|
* - Disassociate all foreign keys of linked models
|
|
210
217
|
* @param id - The id of the entity to update
|
|
211
218
|
*
|
|
@@ -226,6 +233,7 @@ declare abstract class DynaRecord implements DynaRecordBase {
|
|
|
226
233
|
* ```
|
|
227
234
|
*/
|
|
228
235
|
static partitionKeyValue(id: string): string;
|
|
236
|
+
partitionKeyValue(): string;
|
|
229
237
|
}
|
|
230
238
|
export default DynaRecord;
|
|
231
239
|
//# sourceMappingURL=DynaRecord.d.ts.map
|
|
@@ -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,EACjB,MAAM,EACN,KAAK,aAAa,EAElB,KAAK,aAAa,
|
|
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,EAGlB,KAAK,wBAAw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 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
49
49
|
}
|
|
50
50
|
return useValue ? value : void 0;
|
|
51
51
|
};
|
|
52
|
-
var __importStar = (this && this.__importStar) || function (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
52
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
53
|
+
var ownKeys = function(o) {
|
|
54
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
55
|
+
var ar = [];
|
|
56
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
57
|
+
return ar;
|
|
58
|
+
};
|
|
59
|
+
return ownKeys(o);
|
|
60
|
+
};
|
|
61
|
+
return function (mod) {
|
|
62
|
+
if (mod && mod.__esModule) return mod;
|
|
63
|
+
var result = {};
|
|
64
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
65
|
+
__setModuleDefault(result, mod);
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
})();
|
|
59
69
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
70
|
const metadata_1 = __importStar(require("./metadata"));
|
|
61
71
|
const decorators_1 = require("./decorators");
|
|
@@ -85,15 +95,18 @@ const utils_1 = require("./utils");
|
|
|
85
95
|
* ```
|
|
86
96
|
*/
|
|
87
97
|
let DynaRecord = (() => {
|
|
88
|
-
let _instanceExtraInitializers = [];
|
|
89
98
|
let _id_decorators;
|
|
90
99
|
let _id_initializers = [];
|
|
100
|
+
let _id_extraInitializers = [];
|
|
91
101
|
let _type_decorators;
|
|
92
102
|
let _type_initializers = [];
|
|
103
|
+
let _type_extraInitializers = [];
|
|
93
104
|
let _createdAt_decorators;
|
|
94
105
|
let _createdAt_initializers = [];
|
|
106
|
+
let _createdAt_extraInitializers = [];
|
|
95
107
|
let _updatedAt_decorators;
|
|
96
108
|
let _updatedAt_initializers = [];
|
|
109
|
+
let _updatedAt_extraInitializers = [];
|
|
97
110
|
return class DynaRecord {
|
|
98
111
|
static {
|
|
99
112
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
@@ -101,44 +114,28 @@ let DynaRecord = (() => {
|
|
|
101
114
|
_type_decorators = [(0, decorators_1.StringAttribute)({ alias: metadata_1.tableDefaultFields.type.alias })];
|
|
102
115
|
_createdAt_decorators = [(0, decorators_1.DateAttribute)({ alias: metadata_1.tableDefaultFields.createdAt.alias })];
|
|
103
116
|
_updatedAt_decorators = [(0, decorators_1.DateAttribute)({ alias: metadata_1.tableDefaultFields.updatedAt.alias })];
|
|
104
|
-
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers,
|
|
105
|
-
__esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: obj => "type" in obj, get: obj => obj.type, set: (obj, value) => { obj.type = value; } }, metadata: _metadata }, _type_initializers,
|
|
106
|
-
__esDecorate(null, null, _createdAt_decorators, { kind: "field", name: "createdAt", static: false, private: false, access: { has: obj => "createdAt" in obj, get: obj => obj.createdAt, set: (obj, value) => { obj.createdAt = value; } }, metadata: _metadata }, _createdAt_initializers,
|
|
107
|
-
__esDecorate(null, null, _updatedAt_decorators, { kind: "field", name: "updatedAt", static: false, private: false, access: { has: obj => "updatedAt" in obj, get: obj => obj.updatedAt, set: (obj, value) => { obj.updatedAt = value; } }, metadata: _metadata }, _updatedAt_initializers,
|
|
117
|
+
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
|
|
118
|
+
__esDecorate(null, null, _type_decorators, { kind: "field", name: "type", static: false, private: false, access: { has: obj => "type" in obj, get: obj => obj.type, set: (obj, value) => { obj.type = value; } }, metadata: _metadata }, _type_initializers, _type_extraInitializers);
|
|
119
|
+
__esDecorate(null, null, _createdAt_decorators, { kind: "field", name: "createdAt", static: false, private: false, access: { has: obj => "createdAt" in obj, get: obj => obj.createdAt, set: (obj, value) => { obj.createdAt = value; } }, metadata: _metadata }, _createdAt_initializers, _createdAt_extraInitializers);
|
|
120
|
+
__esDecorate(null, null, _updatedAt_decorators, { kind: "field", name: "updatedAt", static: false, private: false, access: { has: obj => "updatedAt" in obj, get: obj => obj.updatedAt, set: (obj, value) => { obj.updatedAt = value; } }, metadata: _metadata }, _updatedAt_initializers, _updatedAt_extraInitializers);
|
|
108
121
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
109
122
|
}
|
|
110
123
|
/**
|
|
111
124
|
* A unique identifier for the entity itself, automatically generated upon creation.
|
|
112
125
|
*/
|
|
113
|
-
id =
|
|
126
|
+
id = __runInitializers(this, _id_initializers, void 0);
|
|
114
127
|
/**
|
|
115
128
|
* The type of the Entity
|
|
116
129
|
*/
|
|
117
|
-
type = __runInitializers(this, _type_initializers, void 0);
|
|
130
|
+
type = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _type_initializers, void 0));
|
|
118
131
|
/**
|
|
119
132
|
* The timestamp marking when the entity was created
|
|
120
133
|
*/
|
|
121
|
-
createdAt = __runInitializers(this, _createdAt_initializers, void 0);
|
|
134
|
+
createdAt = (__runInitializers(this, _type_extraInitializers), __runInitializers(this, _createdAt_initializers, void 0));
|
|
122
135
|
/**
|
|
123
136
|
* The timestamp marking the last update to the entity. Initially set to the same value as `createdAt`.
|
|
124
137
|
*/
|
|
125
|
-
updatedAt = __runInitializers(this, _updatedAt_initializers, void 0);
|
|
126
|
-
/**
|
|
127
|
-
* Find an entity by Id and optionally include associations
|
|
128
|
-
* @param {string} id - Entity Id
|
|
129
|
-
* @param {Object} options - FindByIdOptions
|
|
130
|
-
* @returns An entity with included associations serialized
|
|
131
|
-
*
|
|
132
|
-
* @example Without included relationships
|
|
133
|
-
* ```typescript
|
|
134
|
-
* const user = await User.findById("userId");
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* @example With included relationships
|
|
138
|
-
* ```typescript
|
|
139
|
-
* const user = await User.findById("userId", { include: [{ association: "profile" }] });
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
138
|
+
updatedAt = (__runInitializers(this, _createdAt_extraInitializers), __runInitializers(this, _updatedAt_initializers, void 0));
|
|
142
139
|
static async findById(id, options) {
|
|
143
140
|
const op = new operations_1.FindById(this);
|
|
144
141
|
return await op.run(id, options);
|
|
@@ -148,7 +145,7 @@ let DynaRecord = (() => {
|
|
|
148
145
|
return await op.run(key, options);
|
|
149
146
|
}
|
|
150
147
|
/**
|
|
151
|
-
* Create an entity. If foreign keys are included in the attributes then
|
|
148
|
+
* Create an entity. If foreign keys are included in the attributes then links will be demoralized accordingly
|
|
152
149
|
* @param attributes - Attributes of the model to create
|
|
153
150
|
* @returns The new Entity
|
|
154
151
|
*
|
|
@@ -162,8 +159,8 @@ let DynaRecord = (() => {
|
|
|
162
159
|
}
|
|
163
160
|
/**
|
|
164
161
|
* Update an entity. If foreign keys are included in the attribute then:
|
|
165
|
-
* -
|
|
166
|
-
* - If the entity already had a foreign key relationship, then
|
|
162
|
+
* - Manages associated relationship links as needed
|
|
163
|
+
* - If the entity already had a foreign key relationship, then denormalized records will be deleted from each partition
|
|
167
164
|
* - If the foreign key is not nullable then a {@link NullConstraintViolationError} is thrown.
|
|
168
165
|
* - Validation errors will be thrown if the attribute being removed is not nullable
|
|
169
166
|
* @param id - The id of the entity to update
|
|
@@ -211,7 +208,7 @@ let DynaRecord = (() => {
|
|
|
211
208
|
}
|
|
212
209
|
/**
|
|
213
210
|
* Delete an entity by ID
|
|
214
|
-
* - Delete all
|
|
211
|
+
* - Delete all denormalized records
|
|
215
212
|
* - Disassociate all foreign keys of linked models
|
|
216
213
|
* @param id - The id of the entity to update
|
|
217
214
|
*
|
|
@@ -238,6 +235,12 @@ let DynaRecord = (() => {
|
|
|
238
235
|
const { delimiter } = metadata_1.default.getEntityTable(this.name);
|
|
239
236
|
return `${this.name}${delimiter}${id}`;
|
|
240
237
|
}
|
|
238
|
+
partitionKeyValue() {
|
|
239
|
+
return this.constructor.partitionKeyValue(this.id);
|
|
240
|
+
}
|
|
241
|
+
constructor() {
|
|
242
|
+
__runInitializers(this, _updatedAt_extraInitializers);
|
|
243
|
+
}
|
|
241
244
|
};
|
|
242
245
|
})();
|
|
243
246
|
exports.default = DynaRecord;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/decorators/Table.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,oBAAoB,YACf,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/decorators/Table.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,oBAAoB,YACf,OAAO,UAAU,WAAW,qBAAqB,UAK3E;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/BooleanAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,gBAAgB,CACvB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"BooleanAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/BooleanAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,gBAAgB,CACvB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,UAa9C;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/DateAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iBAAS,aAAa,CACpB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,IAAI,EACd,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"DateAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/DateAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iBAAS,aAAa,CACpB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,IAAI,EACd,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,UAc9C;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/EnumAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAG5D,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iBAAS,aAAa,CACpB,CAAC,SAAS,UAAU,EACpB,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EACnC,KAAK,CAAC,CAAC,SAAS,oBAAoB,EACpC,KAAK,EAAE,CAAC,YAEE,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"EnumAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/EnumAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAG5D,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iBAAS,aAAa,CACpB,CAAC,SAAS,UAAU,EACpB,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EACnC,KAAK,CAAC,CAAC,SAAS,oBAAoB,EACpC,KAAK,EAAE,CAAC,YAEE,SAAS,WACR,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,UAa9C;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForeignKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/ForeignKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,gBAAgB,EAC3E,KAAK,CAAC,EAAE,CAAC,YAGC,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"ForeignKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/ForeignKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,gBAAgB,EAC3E,KAAK,CAAC,EAAE,CAAC,YAGC,SAAS,WACR,yBAAyB,CAChC,CAAC,EACD,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GAAG,kBAAkB,GAAG,UAAU,EAC5D,CAAC,CACF,UAaJ;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/NumberAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"NumberAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/NumberAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,UAa9C;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PartitionKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/PartitionKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,qBAAqB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,YAAY,EACzE,KAAK,CAAC,EAAE,uBAAuB,YAGrB,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"PartitionKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/PartitionKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,qBAAqB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,YAAY,EACzE,KAAK,CAAC,EAAE,uBAAuB,YAGrB,SAAS,WACR,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,UAY5C;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/SortKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO,EAC/D,KAAK,CAAC,EAAE,uBAAuB,YAGrB,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"SortKeyAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/SortKeyAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAExD;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO,EAC/D,KAAK,CAAC,EAAE,uBAAuB,YAGrB,SAAS,WACR,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,UAY5C;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/StringAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EACV,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"StringAttribute.d.ts","sourceRoot":"","sources":["../../../../src/decorators/attributes/StringAttribute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EACV,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,iBAAS,eAAe,CACtB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,gBAAgB,EAC1B,KAAK,CAAC,EAAE,CAAC,YAEC,SAAS,WACR,yBAAyB,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAa7D;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -7,7 +7,7 @@ import type { NativeScalarAttributeValue } from "@aws-sdk/util-dynamodb";
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
export declare const dateSerializer: {
|
|
10
|
-
toEntityAttribute: (val: NativeScalarAttributeValue) => number | bigint | boolean | import("@aws-sdk/util-dynamodb").NumberValue | ArrayBuffer | Blob | DataView | Date | null | undefined;
|
|
10
|
+
toEntityAttribute: (val: NativeScalarAttributeValue) => number | bigint | boolean | import("@aws-sdk/util-dynamodb").NumberValue | ArrayBuffer | Blob | DataView<ArrayBufferLike> | Date | null | undefined;
|
|
11
11
|
toTableAttribute: (val?: Date) => string | undefined;
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=serializers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BelongsTo.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/BelongsTo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,iBAAS,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAC3D,SAAS,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,YAGd,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"BelongsTo.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/BelongsTo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,iBAAS,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EAC3D,SAAS,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,YAGd,SAAS,WACR,0BAA0B,CACjC,CAAC,EACD,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,KAAK,CAAC,UAAU,CAAC,CAC9C,UAaJ;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HasAndBelongsToMany.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/HasAndBelongsToMany.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,KAAK,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK;CAC7C,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX;;;GAGG;AACH,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,MAAM;IACxE;;;;OAIG;IACH,SAAS,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,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CAC7C,CAAC,MAAM,CAAC,CAAC,CAAC;AAEX;;;GAGG;AACH,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,MAAM;IACxE;;;;OAIG;IACH,SAAS,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC,CAAC;CACrB,CAAC;AAEF,UAAU,wBAAwB,CAChC,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,CAAC,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IAEzB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,iBAAS,mBAAmB,CAC1B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACzB,CAAC,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAEzB,SAAS,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,YAE3B,SAAS,WAAW,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAoBvE;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -3,6 +3,13 @@ import type { EntityClass } from "../../types";
|
|
|
3
3
|
import { type ForeignEntityAttribute } from "../types";
|
|
4
4
|
interface HasManyProps<T extends DynaRecord> {
|
|
5
5
|
foreignKey: ForeignEntityAttribute<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Specifies whether the relationship is unidirectional. When set to `true`, the relationship supports access patterns in only one direction, reducing denormalized data.
|
|
8
|
+
* This is useful when bidirectional access patterns are unnecessary.
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
uniDirectional?: boolean;
|
|
6
13
|
}
|
|
7
14
|
/**
|
|
8
15
|
* A decorator for establishing a one-to-many relationship between entities in a single-table design ORM system. This relationship indicates that a single instance of the entity where this decorator is applied can be associated with multiple instances of another entity. The decorator facilitates the definition and management of such relationships by automatically handling the necessary metadata registration, thereby simplifying the implementation of relational data models.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HasMany.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/HasMany.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,UAAU,YAAY,CAAC,CAAC,SAAS,UAAU;IACzC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"HasMany.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/HasMany.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,UAAU,YAAY,CAAC,CAAC,SAAS,UAAU;IACzC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAEtC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,iBAAS,OAAO,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EACzD,SAAS,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,YAEN,SAAS,WAAW,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAwBvE;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -34,11 +34,21 @@ function HasMany(getTarget, props) {
|
|
|
34
34
|
return (_value, context) => {
|
|
35
35
|
if (context.kind === "field") {
|
|
36
36
|
context.addInitializer(function () {
|
|
37
|
+
const target = getTarget();
|
|
38
|
+
if (props.uniDirectional === true) {
|
|
39
|
+
metadata_1.default.addEntityRelationship(target.name, {
|
|
40
|
+
type: "OwnedBy",
|
|
41
|
+
propertyName: props.foreignKey,
|
|
42
|
+
foreignKey: props.foreignKey,
|
|
43
|
+
target: this.constructor
|
|
44
|
+
});
|
|
45
|
+
}
|
|
37
46
|
metadata_1.default.addEntityRelationship(this.constructor.name, {
|
|
38
47
|
type: "HasMany",
|
|
39
48
|
propertyName: context.name,
|
|
40
|
-
target
|
|
41
|
-
foreignKey: props.foreignKey
|
|
49
|
+
target,
|
|
50
|
+
foreignKey: props.foreignKey,
|
|
51
|
+
uniDirectional: props.uniDirectional
|
|
42
52
|
});
|
|
43
53
|
});
|
|
44
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HasOne.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/HasOne.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAsB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,UAAU,WAAW,CAAC,CAAC,SAAS,UAAU;IACxC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,iBAAS,MAAM,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EACxD,SAAS,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,YAGX,SAAS,WACR,
|
|
1
|
+
{"version":3,"file":"HasOne.d.ts","sourceRoot":"","sources":["../../../../src/decorators/relationships/HasOne.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAsB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,UAAU,WAAW,CAAC,CAAC,SAAS,UAAU;IACxC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;CACjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,iBAAS,MAAM,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,UAAU,EACxD,SAAS,EAAE,MAAM,WAAW,CAAC,CAAC,CAAC,EAC/B,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,YAGX,SAAS,WACR,0BAA0B,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,UAatD;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type DynaRecord from "../DynaRecord";
|
|
2
|
-
import { type
|
|
2
|
+
import { type EntityAttributesOnly } from "../operations/types";
|
|
3
3
|
import type { NullableForeignKey, ForeignKey, Optional } from "../types";
|
|
4
4
|
/**
|
|
5
5
|
* Returns attributes on the provided model which are EntityAttributes of type ForeignKey
|
|
6
6
|
*/
|
|
7
7
|
export type ForeignEntityAttribute<T extends DynaRecord> = {
|
|
8
8
|
[K in keyof T]: T[K] extends ForeignKey ? K : T[K] extends NullableForeignKey ? Optional<K> : never;
|
|
9
|
-
}[keyof
|
|
9
|
+
}[keyof EntityAttributesOnly<T>];
|
|
10
10
|
/**
|
|
11
11
|
* Represents the properties of an attribute that are configurable via the {@link Attribute} decorator.
|
|
12
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/decorators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/decorators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,UAAU,IAAI;KACxD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,UAAU,GACnC,CAAC,GACD,CAAC,CAAC,CAAC,CAAC,SAAS,kBAAkB,GAC7B,QAAQ,CAAC,CAAC,CAAC,GACX,KAAK;CACZ,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,GAAG,kBAAkB,GACpE,KAAK,GACL,CAAC,CAAC;AAEN,MAAM,MAAM,yBAAyB,CACnC,CAAC,SAAS,UAAU,EACpB,CAAC,EACD,CAAC,SAAS,gBAAgB,IACxB,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC"}
|
|
@@ -13,6 +13,10 @@ declare class TransactGetBuilder {
|
|
|
13
13
|
* @param item
|
|
14
14
|
*/
|
|
15
15
|
addGet(item: Get): void;
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if there are transactions to execute
|
|
18
|
+
*/
|
|
19
|
+
hasTransactions(): boolean;
|
|
16
20
|
}
|
|
17
21
|
export default TransactGetBuilder;
|
|
18
22
|
//# sourceMappingURL=TransactGetBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactGetBuilder.d.ts","sourceRoot":"","sources":["../../../src/dynamo-utils/TransactGetBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB,EAAoB,MAAM,SAAS,CAAC;AAK/E;;GAEG;AACH,cAAM,kBAAkB;;IAGtB;;OAEG;
|
|
1
|
+
{"version":3,"file":"TransactGetBuilder.d.ts","sourceRoot":"","sources":["../../../src/dynamo-utils/TransactGetBuilder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB,EAAoB,MAAM,SAAS,CAAC;AAK/E;;GAEG;AACH,cAAM,kBAAkB;;IAGtB;;OAEG;IACU,kBAAkB,IAAI,OAAO,CAAC,wBAAwB,CAAC;IAiBpE;;;OAGG;IACI,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAI9B;;OAEG;IACI,eAAe,IAAI,OAAO;CAGlC;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -28,5 +28,11 @@ class TransactGetBuilder {
|
|
|
28
28
|
addGet(item) {
|
|
29
29
|
this.#transactionItems.push({ Get: item });
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns true if there are transactions to execute
|
|
33
|
+
*/
|
|
34
|
+
hasTransactions() {
|
|
35
|
+
return this.#transactionItems.length > 0;
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
exports.default = TransactGetBuilder;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BelongsToRelationship, HasRelationships, AttributeMetadata, AttributeMetadataStorage, RelationshipMetadataStorage, RelationshipMetadata, OwnedByRelationship, BelongsToOrOwnedByRelationship } from ".";
|
|
2
2
|
import type DynaRecord from "../DynaRecord";
|
|
3
3
|
import { type EntityDefinedAttributes } from "../operations";
|
|
4
4
|
type EntityClass = new (...args: any) => DynaRecord;
|
|
@@ -63,6 +63,26 @@ declare class EntityMetadata {
|
|
|
63
63
|
* @param error
|
|
64
64
|
*/
|
|
65
65
|
private buildValidationError;
|
|
66
|
+
/**
|
|
67
|
+
* Returns all relationship metadata for the entity
|
|
68
|
+
*/
|
|
69
|
+
get allRelationships(): RelationshipMetadata[];
|
|
70
|
+
/**
|
|
71
|
+
* Returns the BelongsToRelationship (bidirectional to parent) metadata for the entity
|
|
72
|
+
*/
|
|
73
|
+
get belongsToRelationships(): BelongsToRelationship[];
|
|
74
|
+
/**
|
|
75
|
+
* Returns the OwnedByRelationship (unidirectional to parent) relationship metadata for an entity
|
|
76
|
+
*/
|
|
77
|
+
get ownedByRelationships(): OwnedByRelationship[];
|
|
78
|
+
/**
|
|
79
|
+
* Returns the BelongsToRelationship and OwnedByRelationship metadata objects for an entity
|
|
80
|
+
*/
|
|
81
|
+
get belongsToOrOwnedByRelationships(): BelongsToOrOwnedByRelationship[];
|
|
82
|
+
/**
|
|
83
|
+
* Returns the "Has" relationship metadata for the entity (EX: "HasMany")
|
|
84
|
+
*/
|
|
85
|
+
get hasRelationships(): HasRelationships;
|
|
66
86
|
}
|
|
67
87
|
export default EntityMetadata;
|
|
68
88
|
//# sourceMappingURL=EntityMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityMetadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/EntityMetadata.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"EntityMetadata.d.ts","sourceRoot":"","sources":["../../../src/metadata/EntityMetadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACxB,2BAA2B,EAC3B,oBAAoB,EACpB,mBAAmB,EACnB,8BAA8B,EAC/B,MAAM,GAAG,CAAC;AACX,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAU7D,KAAK,WAAW,GAAG,KAAK,GAAG,IAAI,EAAE,GAAG,KAAK,UAAU,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,cAAM,cAAc;;IAClB;;OAEG;IACH,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC;;OAEG;IACH,SAAgB,UAAU,EAAE,wBAAwB,CAAC;IACrD;;OAEG;IACH,SAAgB,eAAe,EAAE,wBAAwB,CAAC;IAE1D;;OAEG;IACH,SAAgB,aAAa,EAAE,2BAA2B,CAAC;IAE3D,SAAgB,WAAW,EAAE,WAAW,CAAC;IAEzC;;OAEG;IACI,OAAO,EAAE,MAAM,CAAC;gBAiBX,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM;IAS5D;;;OAGG;IACI,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAOtD;;;;;OAKG;IACI,+BAA+B,CACpC,UAAU,EAAE,uBAAuB,CAAC,UAAU,CAAC,GAC9C,uBAAuB,CAAC,UAAU,CAAC;IAatC;;;;;;OAMG;IACI,sCAAsC,CAC3C,UAAU,E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