@itzworking/single-table 0.0.151 → 0.0.157
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 +3 -3
- package/{src → dist}/decorators/editable/editable.d.ts +1 -0
- package/dist/decorators/editable/editable.d.ts.map +1 -0
- package/dist/decorators/editable/editable.js +4 -0
- package/dist/decorators/editable/index.d.ts +3 -0
- package/dist/decorators/editable/index.d.ts.map +1 -0
- package/{src → dist}/decorators/editable/is-editable.d.ts +1 -0
- package/dist/decorators/editable/is-editable.d.ts.map +1 -0
- package/dist/decorators/editable/is-editable.js +4 -0
- package/{src → dist}/decorators/editable/symbol.d.ts +1 -0
- package/dist/decorators/editable/symbol.d.ts.map +1 -0
- package/dist/decorators/editable/symbol.js +1 -0
- package/{src → dist}/decorators/entity/entity.d.ts +1 -0
- package/dist/decorators/entity/entity.d.ts.map +1 -0
- package/dist/decorators/entity/entity.js +6 -0
- package/{src → dist}/decorators/entity/get-entity-name.d.ts +1 -0
- package/dist/decorators/entity/get-entity-name.d.ts.map +1 -0
- package/dist/decorators/entity/get-entity-name.js +4 -0
- package/dist/decorators/entity/index.d.ts +3 -0
- package/dist/decorators/entity/index.d.ts.map +1 -0
- package/{src → dist}/decorators/entity/symbol.d.ts +1 -0
- package/dist/decorators/entity/symbol.d.ts.map +1 -0
- package/dist/decorators/entity/symbol.js +1 -0
- package/{src → dist}/decorators/gsis/get-pk-composition.d.ts +1 -0
- package/dist/decorators/gsis/get-pk-composition.d.ts.map +1 -0
- package/dist/decorators/gsis/get-pk-composition.js +4 -0
- package/{src → dist}/decorators/gsis/get-sk-composition.d.ts +1 -0
- package/dist/decorators/gsis/get-sk-composition.d.ts.map +1 -0
- package/dist/decorators/gsis/get-sk-composition.js +4 -0
- package/{src → dist}/decorators/gsis/gsis.d.ts +1 -0
- package/dist/decorators/gsis/gsis.d.ts.map +1 -0
- package/dist/decorators/gsis/gsis.js +15 -0
- package/dist/decorators/gsis/index.d.ts +4 -0
- package/dist/decorators/gsis/index.d.ts.map +1 -0
- package/{src → dist}/decorators/gsis/symbols.d.ts +1 -0
- package/dist/decorators/gsis/symbols.d.ts.map +1 -0
- package/{src → dist}/decorators/gsis/symbols.js +1 -5
- package/{src → dist}/decorators/gsis/types.d.ts +1 -0
- package/dist/decorators/gsis/types.d.ts.map +1 -0
- package/dist/decorators/gsis/types.js +1 -0
- package/dist/decorators/index.d.ts +5 -0
- package/dist/decorators/index.d.ts.map +1 -0
- package/{src → dist}/dynamodb/delete-dynamodb-item.d.ts +1 -0
- package/dist/dynamodb/delete-dynamodb-item.d.ts.map +1 -0
- package/dist/dynamodb/delete-dynamodb-item.js +24 -0
- package/{src → dist}/dynamodb/dynamodb.d.ts +1 -0
- package/dist/dynamodb/dynamodb.d.ts.map +1 -0
- package/{src → dist}/dynamodb/dynamodb.js +3 -7
- package/{src → dist}/dynamodb/get-dynamodb-item.d.ts +1 -0
- package/dist/dynamodb/get-dynamodb-item.d.ts.map +1 -0
- package/dist/dynamodb/get-dynamodb-item.js +24 -0
- package/dist/dynamodb/index.d.ts +8 -0
- package/dist/dynamodb/index.d.ts.map +1 -0
- package/{src → dist}/dynamodb/put-dynamodb-item.d.ts +1 -0
- package/dist/dynamodb/put-dynamodb-item.d.ts.map +1 -0
- package/dist/dynamodb/put-dynamodb-item.js +28 -0
- package/{src → dist}/dynamodb/query-all-dynamodb.d.ts +1 -0
- package/dist/dynamodb/query-all-dynamodb.d.ts.map +1 -0
- package/dist/dynamodb/query-all-dynamodb.js +19 -0
- package/{src → dist}/dynamodb/query-dynamodb.d.ts +1 -0
- package/dist/dynamodb/query-dynamodb.d.ts.map +1 -0
- package/dist/dynamodb/query-dynamodb.js +28 -0
- package/{src → dist}/dynamodb/update-dynamodb-item.d.ts +1 -0
- package/dist/dynamodb/update-dynamodb-item.d.ts.map +1 -0
- package/dist/dynamodb/update-dynamodb-item.js +24 -0
- package/{src → dist}/errors/decorators-error.d.ts +1 -0
- package/dist/errors/decorators-error.d.ts.map +1 -0
- package/dist/errors/decorators-error.js +10 -0
- package/{src → dist}/errors/generate-update-expression-error.d.ts +1 -0
- package/dist/errors/generate-update-expression-error.d.ts.map +1 -0
- package/dist/errors/generate-update-expression-error.js +10 -0
- package/{src → dist}/errors/index-decorator-error.d.ts +1 -0
- package/dist/errors/index-decorator-error.d.ts.map +1 -0
- package/dist/errors/index-decorator-error.js +10 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/{src → dist}/errors/key-composition-error.d.ts +1 -0
- package/dist/errors/key-composition-error.d.ts.map +1 -0
- package/dist/errors/key-composition-error.js +10 -0
- package/{src → dist}/errors/single-table-error.d.ts +1 -0
- package/dist/errors/single-table-error.d.ts.map +1 -0
- package/{src → dist}/errors/single-table-error.js +2 -6
- package/{src → dist}/errors/single-table-item-format-error.d.ts +1 -0
- package/dist/errors/single-table-item-format-error.d.ts.map +1 -0
- package/dist/errors/single-table-item-format-error.js +10 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/single-table-item/index.d.ts +2 -0
- package/dist/single-table-item/index.d.ts.map +1 -0
- package/{src → dist}/single-table-item/single-table-item.d.ts +1 -0
- package/dist/single-table-item/single-table-item.d.ts.map +1 -0
- package/dist/single-table-item/single-table-item.js +278 -0
- package/{src → dist}/single-table-item/utils/capitalize-first-letter.d.ts +1 -0
- package/dist/single-table-item/utils/capitalize-first-letter.d.ts.map +1 -0
- package/dist/single-table-item/utils/capitalize-first-letter.js +3 -0
- package/{src → dist}/single-table-item/utils/handle-composite-primary-key.d.ts +1 -0
- package/dist/single-table-item/utils/handle-composite-primary-key.d.ts.map +1 -0
- package/dist/single-table-item/utils/handle-composite-primary-key.js +33 -0
- package/dist/single-table-item/utils/index.d.ts +4 -0
- package/dist/single-table-item/utils/index.d.ts.map +1 -0
- package/{src → dist}/single-table-item/utils/validate-entity-annotations.d.ts +1 -0
- package/dist/single-table-item/utils/validate-entity-annotations.d.ts.map +1 -0
- package/{src → dist}/single-table-item/utils/validate-entity-annotations.js +3 -8
- package/dist/single-table-repository/index.d.ts +3 -0
- package/dist/single-table-repository/index.d.ts.map +1 -0
- package/{src → dist}/single-table-repository/single-table-repository.d.ts +1 -0
- package/dist/single-table-repository/single-table-repository.d.ts.map +1 -0
- package/dist/single-table-repository/single-table-repository.js +211 -0
- package/{src → dist}/single-table-repository/types.d.ts +1 -0
- package/dist/single-table-repository/types.d.ts.map +1 -0
- package/dist/single-table-repository/types.js +1 -0
- package/{src → dist}/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +38 -10
- package/src/decorators/editable/editable.js +0 -9
- package/src/decorators/editable/editable.js.map +0 -1
- package/src/decorators/editable/index.js +0 -6
- package/src/decorators/editable/index.js.map +0 -1
- package/src/decorators/editable/is-editable.js +0 -9
- package/src/decorators/editable/is-editable.js.map +0 -1
- package/src/decorators/editable/symbol.js +0 -5
- package/src/decorators/editable/symbol.js.map +0 -1
- package/src/decorators/entity/entity.js +0 -11
- package/src/decorators/entity/entity.js.map +0 -1
- package/src/decorators/entity/get-entity-name.js +0 -9
- package/src/decorators/entity/get-entity-name.js.map +0 -1
- package/src/decorators/entity/index.js +0 -6
- package/src/decorators/entity/index.js.map +0 -1
- package/src/decorators/entity/symbol.js +0 -5
- package/src/decorators/entity/symbol.js.map +0 -1
- package/src/decorators/gsis/get-pk-composition.js +0 -9
- package/src/decorators/gsis/get-pk-composition.js.map +0 -1
- package/src/decorators/gsis/get-sk-composition.js +0 -9
- package/src/decorators/gsis/get-sk-composition.js.map +0 -1
- package/src/decorators/gsis/gsis.js +0 -19
- package/src/decorators/gsis/gsis.js.map +0 -1
- package/src/decorators/gsis/index.js +0 -7
- package/src/decorators/gsis/index.js.map +0 -1
- package/src/decorators/gsis/symbols.js.map +0 -1
- package/src/decorators/gsis/types.js +0 -3
- package/src/decorators/gsis/types.js.map +0 -1
- package/src/decorators/index.js +0 -8
- package/src/decorators/index.js.map +0 -1
- package/src/dynamodb/delete-dynamodb-item.js +0 -30
- package/src/dynamodb/delete-dynamodb-item.js.map +0 -1
- package/src/dynamodb/dynamodb.js.map +0 -1
- package/src/dynamodb/get-dynamodb-item.js +0 -30
- package/src/dynamodb/get-dynamodb-item.js.map +0 -1
- package/src/dynamodb/index.js +0 -11
- package/src/dynamodb/index.js.map +0 -1
- package/src/dynamodb/put-dynamodb-item.js +0 -31
- package/src/dynamodb/put-dynamodb-item.js.map +0 -1
- package/src/dynamodb/query-all-dynamodb.js +0 -22
- package/src/dynamodb/query-all-dynamodb.js.map +0 -1
- package/src/dynamodb/query-dynamodb.js +0 -31
- package/src/dynamodb/query-dynamodb.js.map +0 -1
- package/src/dynamodb/update-dynamodb-item.js +0 -30
- package/src/dynamodb/update-dynamodb-item.js.map +0 -1
- package/src/errors/decorators-error.js +0 -15
- package/src/errors/decorators-error.js.map +0 -1
- package/src/errors/generate-update-expression-error.js +0 -15
- package/src/errors/generate-update-expression-error.js.map +0 -1
- package/src/errors/index-decorator-error.js +0 -15
- package/src/errors/index-decorator-error.js.map +0 -1
- package/src/errors/index.js +0 -9
- package/src/errors/index.js.map +0 -1
- package/src/errors/key-composition-error.js +0 -15
- package/src/errors/key-composition-error.js.map +0 -1
- package/src/errors/single-table-error.js.map +0 -1
- package/src/errors/single-table-item-format-error.js +0 -15
- package/src/errors/single-table-item-format-error.js.map +0 -1
- package/src/index.js +0 -10
- package/src/index.js.map +0 -1
- package/src/single-table-item/index.js +0 -5
- package/src/single-table-item/index.js.map +0 -1
- package/src/single-table-item/single-table-item.js +0 -259
- package/src/single-table-item/single-table-item.js.map +0 -1
- package/src/single-table-item/utils/capitalize-first-letter.js +0 -8
- package/src/single-table-item/utils/capitalize-first-letter.js.map +0 -1
- package/src/single-table-item/utils/handle-composite-primary-key.js +0 -38
- package/src/single-table-item/utils/handle-composite-primary-key.js.map +0 -1
- package/src/single-table-item/utils/index.js +0 -7
- package/src/single-table-item/utils/index.js.map +0 -1
- package/src/single-table-item/utils/validate-entity-annotations.js.map +0 -1
- package/src/single-table-repository/index.js +0 -6
- package/src/single-table-repository/index.js.map +0 -1
- package/src/single-table-repository/single-table-repository.js +0 -197
- package/src/single-table-repository/single-table-repository.js.map +0 -1
- package/src/single-table-repository/types.js +0 -3
- package/src/single-table-repository/types.js.map +0 -1
- package/src/types.js +0 -3
- package/src/types.js.map +0 -1
- /package/{src/decorators/editable/index.d.ts → dist/decorators/editable/index.js} +0 -0
- /package/{src/decorators/entity/index.d.ts → dist/decorators/entity/index.js} +0 -0
- /package/{src/decorators/gsis/index.d.ts → dist/decorators/gsis/index.js} +0 -0
- /package/{src/decorators/index.d.ts → dist/decorators/index.js} +0 -0
- /package/{src/dynamodb/index.d.ts → dist/dynamodb/index.js} +0 -0
- /package/{src/errors/index.d.ts → dist/errors/index.js} +0 -0
- /package/{src/index.d.ts → dist/index.js} +0 -0
- /package/{src/single-table-item/index.d.ts → dist/single-table-item/index.js} +0 -0
- /package/{src/single-table-item/utils/index.d.ts → dist/single-table-item/utils/index.js} +0 -0
- /package/{src/single-table-repository/index.d.ts → dist/single-table-repository/index.js} +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.queryAllDynamodb = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const powertools_1 = require("@itzworking/powertools");
|
|
6
|
-
const query_dynamodb_1 = require("./query-dynamodb");
|
|
7
|
-
const queryAllDynamodb = (input) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
8
|
-
powertools_1.logger.debug({
|
|
9
|
-
message: "send multiple dynamodb QueryCommand",
|
|
10
|
-
input,
|
|
11
|
-
});
|
|
12
|
-
const items = [];
|
|
13
|
-
let lastEvaluatedKey;
|
|
14
|
-
do {
|
|
15
|
-
const dynamodbResponse = yield (0, query_dynamodb_1.queryDynamodb)(Object.assign(Object.assign({}, input), { ExclusiveStartKey: lastEvaluatedKey }));
|
|
16
|
-
lastEvaluatedKey = dynamodbResponse.LastEvaluatedKey;
|
|
17
|
-
items.push(...(dynamodbResponse.Items || []));
|
|
18
|
-
} while (lastEvaluatedKey);
|
|
19
|
-
return items;
|
|
20
|
-
});
|
|
21
|
-
exports.queryAllDynamodb = queryAllDynamodb;
|
|
22
|
-
//# sourceMappingURL=query-all-dynamodb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-all-dynamodb.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/dynamodb/query-all-dynamodb.ts"],"names":[],"mappings":";;;;AACA,uDAAgD;AAChD,qDAAiD;AAE1C,MAAM,gBAAgB,GAAG,CAAO,KAAwB,EAAE,EAAE;IACjE,mBAAM,CAAC,KAAK,CAAC;QACX,OAAO,EAAE,qCAAqC;QAC9C,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,IAAI,gBAAgB,CAAC;IAErB,GAAG,CAAC;QACF,MAAM,gBAAgB,GAAuB,MAAM,IAAA,8BAAa,kCAC3D,KAAK,KACR,iBAAiB,EAAE,gBAAgB,IACnC,CAAC;QACH,gBAAgB,GAAG,gBAAgB,CAAC,gBAAgB,CAAC;QACrD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAChD,CAAC,QAAQ,gBAAgB,EAAE;IAE3B,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC;AAnBW,QAAA,gBAAgB,oBAmB3B"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.queryDynamodb = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
6
|
-
const powertools_1 = require("@itzworking/powertools");
|
|
7
|
-
const dynamodb_1 = require("./dynamodb");
|
|
8
|
-
const queryDynamodb = (input) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
-
const updatedParams = Object.assign({ ScanIndexForward: false }, input);
|
|
10
|
-
powertools_1.logger.debug({
|
|
11
|
-
message: "send dynamodb QueryCommand",
|
|
12
|
-
awsService: "dynamodb",
|
|
13
|
-
action: "QueryCommand",
|
|
14
|
-
input: updatedParams,
|
|
15
|
-
});
|
|
16
|
-
try {
|
|
17
|
-
return dynamodb_1.dynamodb.send(new lib_dynamodb_1.QueryCommand(updatedParams));
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
powertools_1.logger.error({
|
|
21
|
-
message: "send dynamodb QueryCommand",
|
|
22
|
-
awsService: "dynamodb",
|
|
23
|
-
action: "QueryCommand",
|
|
24
|
-
input: updatedParams,
|
|
25
|
-
error,
|
|
26
|
-
});
|
|
27
|
-
throw error;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
exports.queryDynamodb = queryDynamodb;
|
|
31
|
-
//# sourceMappingURL=query-dynamodb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-dynamodb.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/dynamodb/query-dynamodb.ts"],"names":[],"mappings":";;;;AAAA,wDAAwE;AACxE,uDAAgD;AAChD,yCAAsC;AAE/B,MAAM,aAAa,GAAG,CAAO,KAAwB,EAAE,EAAE;IAC9D,MAAM,aAAa,mBACjB,gBAAgB,EAAE,KAAK,IACpB,KAAK,CACT,CAAC;IACF,mBAAM,CAAC,KAAK,CAAC;QACX,OAAO,EAAE,4BAA4B;QACrC,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,cAAc;QACtB,KAAK,EAAE,aAAa;KACrB,CAAC,CAAC;IACH,IAAI,CAAC;QACH,OAAO,mBAAQ,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,aAAa,CAAC,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mBAAM,CAAC,KAAK,CAAC;YACX,OAAO,EAAE,4BAA4B;YACrC,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,cAAc;YACtB,KAAK,EAAE,aAAa;YACpB,KAAK;SACN,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC;AAvBW,QAAA,aAAa,iBAuBxB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateDynamodbItem = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const lib_dynamodb_1 = require("@aws-sdk/lib-dynamodb");
|
|
6
|
-
const powertools_1 = require("@itzworking/powertools");
|
|
7
|
-
const dynamodb_1 = require("./dynamodb");
|
|
8
|
-
const updateDynamodbItem = (input) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
-
powertools_1.logger.debug({
|
|
10
|
-
message: "send dynamodb UpdateCommand",
|
|
11
|
-
awsService: "dynamodb",
|
|
12
|
-
action: "UpdateCommand",
|
|
13
|
-
input,
|
|
14
|
-
});
|
|
15
|
-
try {
|
|
16
|
-
return dynamodb_1.dynamodb.send(new lib_dynamodb_1.UpdateCommand(input));
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
powertools_1.logger.error({
|
|
20
|
-
message: "send dynamodb UpdateCommand",
|
|
21
|
-
awsService: "dynamodb",
|
|
22
|
-
action: "UpdateCommand",
|
|
23
|
-
input,
|
|
24
|
-
error,
|
|
25
|
-
});
|
|
26
|
-
throw error;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
exports.updateDynamodbItem = updateDynamodbItem;
|
|
30
|
-
//# sourceMappingURL=update-dynamodb-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-dynamodb-item.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/dynamodb/update-dynamodb-item.ts"],"names":[],"mappings":";;;;AAAA,wDAA0E;AAC1E,uDAAgD;AAChD,yCAAsC;AAE/B,MAAM,kBAAkB,GAAG,CAAO,KAAyB,EAAE,EAAE;IACpE,mBAAM,CAAC,KAAK,CAAC;QACX,OAAO,EAAE,6BAA6B;QACtC,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,eAAe;QACvB,KAAK;KACN,CAAC,CAAC;IACH,IAAI,CAAC;QACH,OAAO,mBAAQ,CAAC,IAAI,CAAC,IAAI,4BAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mBAAM,CAAC,KAAK,CAAC;YACX,OAAO,EAAE,6BAA6B;YACtC,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,eAAe;YACvB,KAAK;YACL,KAAK;SACN,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC;AAnBW,QAAA,kBAAkB,sBAmB7B"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DecoratorsError = void 0;
|
|
4
|
-
const single_table_error_1 = require("./single-table-error");
|
|
5
|
-
class DecoratorsError extends single_table_error_1.SingleTableError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super({
|
|
8
|
-
message,
|
|
9
|
-
});
|
|
10
|
-
this.name = "DecoratorsError";
|
|
11
|
-
Object.setPrototypeOf(this, new.target.prototype); // maintain prototype chain
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.DecoratorsError = DecoratorsError;
|
|
15
|
-
//# sourceMappingURL=decorators-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators-error.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/errors/decorators-error.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAExD,MAAa,eAAgB,SAAQ,qCAAgB;IACnD,YAAY,OAAe;QACzB,KAAK,CAAC;YACJ,OAAO;SACR,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAE9B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B;IAChF,CAAC;CACF;AATD,0CASC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GenerateUpdateExpressionError = void 0;
|
|
4
|
-
const single_table_error_1 = require("./single-table-error");
|
|
5
|
-
class GenerateUpdateExpressionError extends single_table_error_1.SingleTableError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super({
|
|
8
|
-
message,
|
|
9
|
-
});
|
|
10
|
-
this.name = "GenerateUpdateExpressionError";
|
|
11
|
-
Object.setPrototypeOf(this, new.target.prototype); // maintain prototype chain
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.GenerateUpdateExpressionError = GenerateUpdateExpressionError;
|
|
15
|
-
//# sourceMappingURL=generate-update-expression-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-update-expression-error.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/errors/generate-update-expression-error.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAExD,MAAa,6BAA8B,SAAQ,qCAAgB;IACjE,YAAY,OAAe;QACzB,KAAK,CAAC;YACJ,OAAO;SACR,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B;IAChF,CAAC;CACF;AARD,sEAQC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IndexDecoratorError = void 0;
|
|
4
|
-
const single_table_error_1 = require("./single-table-error");
|
|
5
|
-
class IndexDecoratorError extends single_table_error_1.SingleTableError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super({
|
|
8
|
-
message,
|
|
9
|
-
});
|
|
10
|
-
this.name = "IndexDecoratorError";
|
|
11
|
-
Object.setPrototypeOf(this, new.target.prototype); // maintain prototype chain
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.IndexDecoratorError = IndexDecoratorError;
|
|
15
|
-
//# sourceMappingURL=index-decorator-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-decorator-error.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/errors/index-decorator-error.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAExD,MAAa,mBAAoB,SAAQ,qCAAgB;IACvD,YAAY,OAAe;QACzB,KAAK,CAAC;YACJ,OAAO;SACR,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B;IAChF,CAAC;CACF;AARD,kDAQC"}
|
package/src/errors/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./decorators-error"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./generate-update-expression-error"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./index-decorator-error"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./single-table-error"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./single-table-item-format-error"), exports);
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
package/src/errors/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/errors/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,6EAAmD;AACnD,kEAAwC;AACxC,+DAAqC;AACrC,2EAAiD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KeyCompositionError = void 0;
|
|
4
|
-
const single_table_error_1 = require("./single-table-error");
|
|
5
|
-
class KeyCompositionError extends single_table_error_1.SingleTableError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super({
|
|
8
|
-
message,
|
|
9
|
-
});
|
|
10
|
-
this.name = "KeyCompositionError";
|
|
11
|
-
Object.setPrototypeOf(this, new.target.prototype); // maintain prototype chain
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.KeyCompositionError = KeyCompositionError;
|
|
15
|
-
//# sourceMappingURL=key-composition-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"key-composition-error.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/errors/key-composition-error.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAExD,MAAa,mBAAoB,SAAQ,qCAAgB;IACvD,YAAY,OAAe;QACzB,KAAK,CAAC;YACJ,OAAO;SACR,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B;IAChF,CAAC;CACF;AARD,kDAQC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"single-table-error.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/errors/single-table-error.ts"],"names":[],"mappings":";;;AAOA,MAAa,gBAAiB,SAAQ,KAAK;IAGzC,YAAY,KAA4B;QACtC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACjC,MAAM,EAAE,UAAU,GAAG,GAAG,EAAE,GAAG,KAAK,CAAC;QAEnC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B;IAChF,CAAC;CACF;AAXD,4CAWC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SingleTableItemFormatError = void 0;
|
|
4
|
-
const single_table_error_1 = require("./single-table-error");
|
|
5
|
-
class SingleTableItemFormatError extends single_table_error_1.SingleTableError {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super({
|
|
8
|
-
message,
|
|
9
|
-
});
|
|
10
|
-
this.name = "SingleTableItemFormatError";
|
|
11
|
-
Object.setPrototypeOf(this, new.target.prototype); // maintain prototype chain
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.SingleTableItemFormatError = SingleTableItemFormatError;
|
|
15
|
-
//# sourceMappingURL=single-table-item-format-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"single-table-item-format-error.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/errors/single-table-item-format-error.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAExD,MAAa,0BAA2B,SAAQ,qCAAgB;IAC9D,YAAY,OAAe;QACzB,KAAK,CAAC;YACJ,OAAO;SACR,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,2BAA2B;IAChF,CAAC;CACF;AARD,gEAQC"}
|
package/src/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./decorators"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./dynamodb"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./errors"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./single-table-item"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./single-table-repository"), exports);
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/single-table/src/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AAExB,uDAA6B;AAC7B,qDAA2B;AAC3B,mDAAyB;AACzB,8DAAoC;AACpC,oEAA0C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/single-table-item/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC"}
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SingleTableItem = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const uuid_1 = require("uuid");
|
|
6
|
-
const decorators_1 = require("../decorators");
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
|
-
const errors_1 = require("../errors");
|
|
9
|
-
const decorated_class_1 = require("@itzworking/decorated-class");
|
|
10
|
-
class SingleTableItem extends decorated_class_1.DecoratedClass {
|
|
11
|
-
constructor(props = {}) {
|
|
12
|
-
super(props);
|
|
13
|
-
(0, utils_1.validateEntityAnnotations)(this);
|
|
14
|
-
if (!(props === null || props === void 0 ? void 0 : props.id)) {
|
|
15
|
-
this.generateId();
|
|
16
|
-
}
|
|
17
|
-
if (!(props === null || props === void 0 ? void 0 : props.createdAt)) {
|
|
18
|
-
this.createdAt = new Date();
|
|
19
|
-
}
|
|
20
|
-
if (!(props === null || props === void 0 ? void 0 : props.updatedAt)) {
|
|
21
|
-
this.updatedAt = new Date();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
generateId() {
|
|
25
|
-
this.id = (0, uuid_1.v4)();
|
|
26
|
-
return this.id;
|
|
27
|
-
}
|
|
28
|
-
type() {
|
|
29
|
-
return (0, decorators_1.getEntityName)(this);
|
|
30
|
-
}
|
|
31
|
-
pk() {
|
|
32
|
-
const keys = (0, decorators_1.getPKComposition)(this);
|
|
33
|
-
if (!(keys === null || keys === void 0 ? void 0 : keys.length)) {
|
|
34
|
-
throw new errors_1.IndexDecoratorError(`@Entity("${this.type()}") @Index: PK is not defined`);
|
|
35
|
-
}
|
|
36
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, keys);
|
|
37
|
-
}
|
|
38
|
-
sk() {
|
|
39
|
-
const keys = (0, decorators_1.getSKComposition)(this);
|
|
40
|
-
if (!(keys === null || keys === void 0 ? void 0 : keys.length)) {
|
|
41
|
-
throw new errors_1.IndexDecoratorError(`@Entity("${this.type()}") @Index: SK is not defined`);
|
|
42
|
-
}
|
|
43
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, keys);
|
|
44
|
-
}
|
|
45
|
-
key() {
|
|
46
|
-
return {
|
|
47
|
-
PK: this.pk(),
|
|
48
|
-
SK: this.sk(),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
gsi1pk() {
|
|
52
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getPKComposition)(this, "GSI1"));
|
|
53
|
-
}
|
|
54
|
-
gsi1sk() {
|
|
55
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getSKComposition)(this, "GSI1"));
|
|
56
|
-
}
|
|
57
|
-
gsi2pk() {
|
|
58
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getPKComposition)(this, "GSI2"));
|
|
59
|
-
}
|
|
60
|
-
gsi2sk() {
|
|
61
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getSKComposition)(this, "GSI2"));
|
|
62
|
-
}
|
|
63
|
-
gsi3pk() {
|
|
64
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getPKComposition)(this, "GSI3"));
|
|
65
|
-
}
|
|
66
|
-
gsi3sk() {
|
|
67
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getSKComposition)(this, "GSI3"));
|
|
68
|
-
}
|
|
69
|
-
gsi4pk() {
|
|
70
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getPKComposition)(this, "GSI4"));
|
|
71
|
-
}
|
|
72
|
-
gsi4sk() {
|
|
73
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getSKComposition)(this, "GSI4"));
|
|
74
|
-
}
|
|
75
|
-
gsi5pk() {
|
|
76
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getPKComposition)(this, "GSI5"));
|
|
77
|
-
}
|
|
78
|
-
gsi5sk() {
|
|
79
|
-
return (0, utils_1.handleCompositePrimaryKey)(this, (0, decorators_1.getSKComposition)(this, "GSI5"));
|
|
80
|
-
}
|
|
81
|
-
generateUpdateExpression(attributes = []) {
|
|
82
|
-
const attributesToUpdate = [];
|
|
83
|
-
const entityAttributes = (0, decorated_class_1.listAttributes)(this);
|
|
84
|
-
if (attributes === null || attributes === void 0 ? void 0 : attributes.length) {
|
|
85
|
-
for (const attribute of attributes) {
|
|
86
|
-
if (entityAttributes.find((ef) => ef.attributeName === attribute)) {
|
|
87
|
-
attributesToUpdate.push(attribute);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
throw new errors_1.GenerateUpdateExpressionError(`@Entity("${this.type()}"): ${attribute} is not an @Attribute`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
for (const attribute of entityAttributes) {
|
|
96
|
-
if (!(0, decorators_1.isEditable)(this, attribute.attributeName)) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
attributesToUpdate.push(attribute.attributeName);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (attributesToUpdate.length === 0) {
|
|
103
|
-
throw new errors_1.GenerateUpdateExpressionError(`@Entity("${this.type()}"): attributesToUpdate is empty; attributes = ${attributes}`);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
const indexComposition = {
|
|
107
|
-
PK: (0, decorators_1.getPKComposition)(this),
|
|
108
|
-
SK: (0, decorators_1.getSKComposition)(this),
|
|
109
|
-
};
|
|
110
|
-
const indexPkSkAttributes = [
|
|
111
|
-
...(indexComposition.PK || []),
|
|
112
|
-
...(indexComposition.SK || []),
|
|
113
|
-
];
|
|
114
|
-
const notAllowedAttributes = indexPkSkAttributes.filter((attribute) => attributesToUpdate.includes(attribute));
|
|
115
|
-
if (notAllowedAttributes.length > 0) {
|
|
116
|
-
throw new errors_1.GenerateUpdateExpressionError(`@Entity("${this.type()}"): cannot update @Index notAllowedAttributes = ${notAllowedAttributes}`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const attributeValues = {};
|
|
120
|
-
const attributeNames = {};
|
|
121
|
-
const namesAndValues = [];
|
|
122
|
-
const attributesToRemove = [];
|
|
123
|
-
const gsis = {
|
|
124
|
-
GSI1: {
|
|
125
|
-
PK: (0, decorators_1.getPKComposition)(this, "GSI1"),
|
|
126
|
-
SK: (0, decorators_1.getSKComposition)(this, "GSI1"),
|
|
127
|
-
},
|
|
128
|
-
GSI2: {
|
|
129
|
-
PK: (0, decorators_1.getPKComposition)(this, "GSI2"),
|
|
130
|
-
SK: (0, decorators_1.getSKComposition)(this, "GSI2"),
|
|
131
|
-
},
|
|
132
|
-
GSI3: {
|
|
133
|
-
PK: (0, decorators_1.getPKComposition)(this, "GSI3"),
|
|
134
|
-
SK: (0, decorators_1.getSKComposition)(this, "GSI3"),
|
|
135
|
-
},
|
|
136
|
-
GSI4: {
|
|
137
|
-
PK: (0, decorators_1.getPKComposition)(this, "GSI4"),
|
|
138
|
-
SK: (0, decorators_1.getSKComposition)(this, "GSI4"),
|
|
139
|
-
},
|
|
140
|
-
GSI5: {
|
|
141
|
-
PK: (0, decorators_1.getPKComposition)(this, "GSI5"),
|
|
142
|
-
SK: (0, decorators_1.getSKComposition)(this, "GSI5"),
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
for (const [gsiKey, gsiComposition] of Object.entries(gsis)) {
|
|
146
|
-
for (const [gsiAttributeKey, gsiAttributeComposition] of Object.entries(gsiComposition)) {
|
|
147
|
-
if (gsiAttributeComposition === null || gsiAttributeComposition === void 0 ? void 0 : gsiAttributeComposition.some((key) => attributesToUpdate.includes(key))) {
|
|
148
|
-
attributeNames[`#key${gsiKey}${gsiAttributeKey}`] = `${gsiKey}${gsiAttributeKey}`;
|
|
149
|
-
attributeValues[`:value${gsiKey}${gsiAttributeKey}`] = this[`${gsiKey}${gsiAttributeKey}`.toLowerCase()]();
|
|
150
|
-
namesAndValues.push(`#key${gsiKey}${gsiAttributeKey} = :value${gsiKey}${gsiAttributeKey}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
for (const key of attributesToUpdate) {
|
|
155
|
-
const keyToUse = (0, utils_1.capitalizeFirstLetter)(key);
|
|
156
|
-
const value = this[key];
|
|
157
|
-
attributeNames[`#key${keyToUse}`] = key;
|
|
158
|
-
if (value === undefined) {
|
|
159
|
-
attributesToRemove.push(`#key${keyToUse}`);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
attributeValues[`:value${keyToUse}`] =
|
|
163
|
-
value instanceof Date ? value.toISOString() : value;
|
|
164
|
-
namesAndValues.push(`#key${keyToUse} = :value${keyToUse}`);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return {
|
|
168
|
-
UpdateExpression: ((namesAndValues.length ? `SET ${namesAndValues.join(", ")} ` : "") +
|
|
169
|
-
(attributesToRemove.length
|
|
170
|
-
? `REMOVE ${attributesToRemove.join(", ")}`
|
|
171
|
-
: "")).trim(),
|
|
172
|
-
ExpressionAttributeNames: attributeNames,
|
|
173
|
-
ExpressionAttributeValues: attributeValues,
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
toSingleTableItem() {
|
|
177
|
-
const result = Object.assign({ type: this.type() }, this.key());
|
|
178
|
-
if (this.gsi1pk() && this.gsi1sk()) {
|
|
179
|
-
result.GSI1PK = this.gsi1pk();
|
|
180
|
-
result.GSI1SK = this.gsi1sk();
|
|
181
|
-
}
|
|
182
|
-
if (this.gsi2pk() && this.gsi2sk()) {
|
|
183
|
-
result.GSI2PK = this.gsi2pk();
|
|
184
|
-
result.GSI2SK = this.gsi2sk();
|
|
185
|
-
}
|
|
186
|
-
if (this.gsi3pk() && this.gsi3sk()) {
|
|
187
|
-
result.GSI3PK = this.gsi3pk();
|
|
188
|
-
result.GSI3SK = this.gsi3sk();
|
|
189
|
-
}
|
|
190
|
-
if (this.gsi4pk() && this.gsi4sk()) {
|
|
191
|
-
result.GSI4PK = this.gsi4pk();
|
|
192
|
-
result.GSI4SK = this.gsi4sk();
|
|
193
|
-
}
|
|
194
|
-
if (this.gsi5pk() && this.gsi5sk()) {
|
|
195
|
-
result.GSI5PK = this.gsi5pk();
|
|
196
|
-
result.GSI5SK = this.gsi5sk();
|
|
197
|
-
}
|
|
198
|
-
const attributes = (0, decorated_class_1.listAttributes)(this);
|
|
199
|
-
const reservedKeys = [
|
|
200
|
-
"type",
|
|
201
|
-
"PK",
|
|
202
|
-
"SK",
|
|
203
|
-
"GSI1PK",
|
|
204
|
-
"GSI1SK",
|
|
205
|
-
"GSI2PK",
|
|
206
|
-
"GSI2SK",
|
|
207
|
-
"GSI3PK",
|
|
208
|
-
"GSI3SK",
|
|
209
|
-
"GSI4PK",
|
|
210
|
-
"GSI4SK",
|
|
211
|
-
"GSI5PK",
|
|
212
|
-
"GSI5SK",
|
|
213
|
-
];
|
|
214
|
-
const reservedKeysInUse = reservedKeys.filter((reservedKey) => attributes.find((f) => f.attributeName === reservedKey));
|
|
215
|
-
if (reservedKeysInUse.length > 0) {
|
|
216
|
-
throw new errors_1.SingleTableItemFormatError(`@Entity("${this.type()}"): cannot use reserved keys in attributes = ${reservedKeysInUse}`);
|
|
217
|
-
}
|
|
218
|
-
for (const attribute of attributes) {
|
|
219
|
-
const value = this[attribute.attributeName];
|
|
220
|
-
if (value !== undefined) {
|
|
221
|
-
result[attribute.attributeName] =
|
|
222
|
-
value instanceof Date ? value.toISOString() : value;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return result;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
exports.SingleTableItem = SingleTableItem;
|
|
229
|
-
tslib_1.__decorate([
|
|
230
|
-
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.String),
|
|
231
|
-
tslib_1.__metadata("design:type", String)
|
|
232
|
-
], SingleTableItem.prototype, "id", void 0);
|
|
233
|
-
tslib_1.__decorate([
|
|
234
|
-
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.Date),
|
|
235
|
-
tslib_1.__metadata("design:type", Date)
|
|
236
|
-
], SingleTableItem.prototype, "createdAt", void 0);
|
|
237
|
-
tslib_1.__decorate([
|
|
238
|
-
decorators_1.Editable,
|
|
239
|
-
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.Date),
|
|
240
|
-
tslib_1.__metadata("design:type", Date)
|
|
241
|
-
], SingleTableItem.prototype, "updatedAt", void 0);
|
|
242
|
-
tslib_1.__decorate([
|
|
243
|
-
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.String),
|
|
244
|
-
tslib_1.__metadata("design:type", String)
|
|
245
|
-
], SingleTableItem.prototype, "createdBy", void 0);
|
|
246
|
-
tslib_1.__decorate([
|
|
247
|
-
decorators_1.Editable,
|
|
248
|
-
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.String),
|
|
249
|
-
tslib_1.__metadata("design:type", String)
|
|
250
|
-
], SingleTableItem.prototype, "updatedBy", void 0);
|
|
251
|
-
tslib_1.__decorate([
|
|
252
|
-
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.String),
|
|
253
|
-
tslib_1.__metadata("design:type", String)
|
|
254
|
-
], SingleTableItem.prototype, "deletedBy", void 0);
|
|
255
|
-
tslib_1.__decorate([
|
|
256
|
-
(0, decorated_class_1.Attribute)(decorated_class_1.AttributeType.Date),
|
|
257
|
-
tslib_1.__metadata("design:type", Date)
|
|
258
|
-
], SingleTableItem.prototype, "deletedAt", void 0);
|
|
259
|
-
//# sourceMappingURL=single-table-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"single-table-item.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/single-table-item/single-table-item.ts"],"names":[],"mappings":";;;;AAAA,+BAAkC;AAClC,8CAMuB;AACvB,mCAIiB;AACjB,sCAImB;AACnB,iEAOqC;AAErC,MAAsB,eAAgB,SAAQ,gCAAc;IAwB1D,YAAsB,QAAwC,EAAE;QAC9D,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAA,iCAAyB,EAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,EAAE,CAAA,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAA,EAAE,CAAC;YACtB,IAAI,CAAC,SAAS,GA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xB,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC;oBAC7B,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YACxD,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA1SD,0CA0SC;AAxSC;IADC,IAAA,2BAAS,EAAC,+BAAa,CAAC,MAAM,CAAC;;2CACrB;AAGX;IADC,IAAA,2BAAS,EAAC,+BAAa,CAAC,IAAI,CAAC;sCACnB,IAAI;kDAAC;AAIhB;IAFC,qBAAQ;IACR,IAAA,2BAAS,EAAC,+BAAa,CAAC,IAAI,CAAC;sCACnB,IAAI;kDAAC;AAGhB;IADC,IAAA,2BAAS,EAAC,+BAAa,CAAC,MAAM,CAAC;;kDACb;AAInB;IAFC,qBAAQ;IACR,IAAA,2BAAS,EAAC,+BAAa,CAAC,MAAM,CAAC;;kDACb;AAGnB;IADC,IAAA,2BAAS,EAAC,+BAAa,CAAC,MAAM,CAAC;;kDACb;AAGnB;IADC,IAAA,2BAAS,EAAC,+BAAa,CAAC,IAAI,CAAC;sCAClB,IAAI;kDAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.capitalizeFirstLetter = void 0;
|
|
4
|
-
const capitalizeFirstLetter = (s) => {
|
|
5
|
-
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
6
|
-
};
|
|
7
|
-
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
8
|
-
//# sourceMappingURL=capitalize-first-letter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capitalize-first-letter.js","sourceRoot":"","sources":["../../../../../../libs/single-table/src/single-table-item/utils/capitalize-first-letter.ts"],"names":[],"mappings":";;;AAAO,MAAM,qBAAqB,GAAG,CAAC,CAAS,EAAE,EAAE;IACjD,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleCompositePrimaryKey = void 0;
|
|
4
|
-
const decorated_class_1 = require("@itzworking/decorated-class");
|
|
5
|
-
const key_composition_error_1 = require("../../errors/key-composition-error");
|
|
6
|
-
const isPrimitiveType = (type) => {
|
|
7
|
-
return Object.values(decorated_class_1.PrimitiveType).includes(type);
|
|
8
|
-
};
|
|
9
|
-
const handleCompositePrimaryKey = (target, keys) => {
|
|
10
|
-
if (!(keys === null || keys === void 0 ? void 0 : keys.length)) {
|
|
11
|
-
return "";
|
|
12
|
-
}
|
|
13
|
-
const entityAttributes = (0, decorated_class_1.listAttributes)(target);
|
|
14
|
-
const result = [];
|
|
15
|
-
for (const key of keys) {
|
|
16
|
-
const entityAttribute = entityAttributes.find((attDef) => attDef.attributeName === key);
|
|
17
|
-
if (entityAttribute) {
|
|
18
|
-
if (!isPrimitiveType(entityAttribute === null || entityAttribute === void 0 ? void 0 : entityAttribute.attributeType)) {
|
|
19
|
-
throw new key_composition_error_1.KeyCompositionError(`Composite primary key must all be primitive type - @Entity("${target.type()}"): ${key}`);
|
|
20
|
-
}
|
|
21
|
-
if (target[key] === undefined) {
|
|
22
|
-
result.push("null");
|
|
23
|
-
}
|
|
24
|
-
else if (entityAttribute.attributeType === decorated_class_1.AttributeType.Date) {
|
|
25
|
-
result.push(target[key].toISOString());
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
result.push(target[key]);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
result.push(key);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return result.join("#");
|
|
36
|
-
};
|
|
37
|
-
exports.handleCompositePrimaryKey = handleCompositePrimaryKey;
|
|
38
|
-
//# sourceMappingURL=handle-composite-primary-key.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handle-composite-primary-key.js","sourceRoot":"","sources":["../../../../../../libs/single-table/src/single-table-item/utils/handle-composite-primary-key.ts"],"names":[],"mappings":";;;AAAA,iEAIqC;AACrC,8EAAyE;AAEzE,MAAM,eAAe,GAAG,CAAC,IAAS,EAAE,EAAE;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,+BAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC,CAAC;AAEK,MAAM,yBAAyB,GAAG,CACvC,MAAW,EACX,IAAe,EACP,EAAE;IACV,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,gBAAgB,GAAG,IAAA,gCAAc,EAAC,MAAM,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,eAAe,GAAG,gBAAgB,CAAC,IAAI,CAC3C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,KAAK,GAAG,CACzC,CAAC;QACF,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,CAAC,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,aAAa,CAAC,EAAE,CAAC;gBACrD,MAAM,IAAI,2CAAmB,CAC3B,+DAA+D,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,EAAE,CACzF,CAAC;YACJ,CAAC;YACD,IAAK,MAAc,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;gBACvC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACtB,CAAC;iBAAM,IAAI,eAAe,CAAC,aAAa,KAAK,+BAAa,CAAC,IAAI,EAAE,CAAC;gBAChE,MAAM,CAAC,IAAI,CAAE,MAAc,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YAClD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAE,MAAc,CAAC,GAAG,CAAC,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC,CAAC;AA/BW,QAAA,yBAAyB,6BA+BpC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./capitalize-first-letter"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./handle-composite-primary-key"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./validate-entity-annotations"), exports);
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/single-table/src/single-table-item/utils/index.ts"],"names":[],"mappings":";;;AAAA,oEAA0C;AAC1C,yEAA+C;AAC/C,wEAA8C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-entity-annotations.js","sourceRoot":"","sources":["../../../../../../libs/single-table/src/single-table-item/utils/validate-entity-annotations.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAGxC,MAAM,yBAAyB,GAAG,CACvC,MAAS,EACT,EAAE;IACF,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IACpE,CAAC;IAED,iBAAiB;IACjB,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,oCAAoC;IACpC,KAAK;IACL,8DAA8D;IAC9D,oDAAoD;IACpD,gBAAgB;IAChB,MAAM;IACN,sCAAsC;IACtC,yFAAyF;IACzF,MAAM;IACN,sCAAsC;IACtC,yFAAyF;IACzF,MAAM;IACN,IAAI;IACJ,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,IAAI,wBAAe,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC;AAlCW,QAAA,yBAAyB,6BAkCpC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./single-table-repository"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/single-table/src/single-table-repository/index.ts"],"names":[],"mappings":";;;AAAA,oEAA0C;AAC1C,kDAAwB"}
|