mocody 0.2.15 → 0.2.18

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.
Files changed (64) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +4 -4
  3. package/dist/core/base-schema.d.ts +13 -13
  4. package/dist/core/base-schema.js +11 -11
  5. package/dist/core/base-schema.js.map +1 -1
  6. package/dist/couch/couch-data-operation.d.ts +90 -90
  7. package/dist/couch/couch-data-operation.js +581 -581
  8. package/dist/couch/couch-data-operation.js.map +1 -1
  9. package/dist/couch/couch-filter-query-operation.d.ts +47 -47
  10. package/dist/couch/couch-filter-query-operation.js +438 -438
  11. package/dist/couch/couch-initializer.d.ts +45 -45
  12. package/dist/couch/couch-initializer.js +98 -98
  13. package/dist/couch/couch-initializer.js.map +1 -1
  14. package/dist/couch/couch-manage-table.d.ts +46 -46
  15. package/dist/couch/couch-manage-table.js +113 -113
  16. package/dist/dynamo/dynamo-data-operation.d.ts +97 -97
  17. package/dist/dynamo/dynamo-data-operation.js +788 -793
  18. package/dist/dynamo/dynamo-data-operation.js.map +1 -1
  19. package/dist/dynamo/dynamo-filter-query-operation.d.ts +29 -28
  20. package/dist/dynamo/dynamo-filter-query-operation.js +655 -627
  21. package/dist/dynamo/dynamo-filter-query-operation.js.map +1 -1
  22. package/dist/dynamo/dynamo-helper.d.ts +1 -1
  23. package/dist/dynamo/dynamo-helper.js +8 -8
  24. package/dist/dynamo/dynamo-initializer.d.ts +14 -8
  25. package/dist/dynamo/dynamo-initializer.js +58 -34
  26. package/dist/dynamo/dynamo-initializer.js.map +1 -1
  27. package/dist/dynamo/dynamo-manage-table.d.ts +33 -32
  28. package/dist/dynamo/dynamo-manage-table.js +419 -418
  29. package/dist/dynamo/dynamo-manage-table.js.map +1 -1
  30. package/dist/dynamo/dynamo-query-scan-processor.d.ts +25 -24
  31. package/dist/dynamo/dynamo-query-scan-processor.js +268 -266
  32. package/dist/dynamo/dynamo-query-scan-processor.js.map +1 -1
  33. package/dist/helpers/base-joi-helper.d.ts +2 -2
  34. package/dist/helpers/base-joi-helper.js +12 -12
  35. package/dist/helpers/constants.d.ts +3 -3
  36. package/dist/helpers/constants.js +6 -6
  37. package/dist/helpers/errors.d.ts +13 -13
  38. package/dist/helpers/errors.js +38 -38
  39. package/dist/helpers/logging-service.d.ts +8 -8
  40. package/dist/helpers/logging-service.js +44 -44
  41. package/dist/helpers/mocody-utils.d.ts +13 -15
  42. package/dist/helpers/mocody-utils.js +48 -48
  43. package/dist/helpers/query-validator.d.ts +20 -20
  44. package/dist/helpers/query-validator.js +96 -84
  45. package/dist/helpers/query-validator.js.map +1 -1
  46. package/dist/helpers/util-service.d.ts +29 -29
  47. package/dist/helpers/util-service.js +155 -155
  48. package/dist/index.d.ts +10 -10
  49. package/dist/index.js +19 -19
  50. package/dist/model/index.d.ts +40 -40
  51. package/dist/model/index.js +6 -6
  52. package/dist/mongo/mongo-data-operation.d.ts +88 -88
  53. package/dist/mongo/mongo-data-operation.js +597 -597
  54. package/dist/mongo/mongo-data-operation.js.map +1 -1
  55. package/dist/mongo/mongo-filter-query-operation.d.ts +47 -47
  56. package/dist/mongo/mongo-filter-query-operation.js +433 -433
  57. package/dist/mongo/mongo-initializer.d.ts +16 -16
  58. package/dist/mongo/mongo-initializer.js +47 -47
  59. package/dist/mongo/mongo-initializer.js.map +1 -1
  60. package/dist/mongo/mongo-table-manager.d.ts +31 -31
  61. package/dist/mongo/mongo-table-manager.js +104 -104
  62. package/dist/type/index.d.ts +109 -108
  63. package/dist/type/index.js +2 -2
  64. package/package.json +70 -72
@@ -1,16 +1,16 @@
1
- import { MongoClientOptions, Collection } from "mongodb";
2
- interface IDbOptions {
3
- uri: string;
4
- databaseName: string;
5
- options?: MongoClientOptions;
6
- }
7
- export declare class MocodyInitializerMongo {
8
- private _mongoClient;
9
- private readonly _inits;
10
- constructor(inits: IDbOptions);
11
- private getInstance;
12
- getNewSession(): Promise<import("mongodb").ClientSession>;
13
- getCustomCollectionInstance<T = any>(collectionName: string): Promise<Collection<T>>;
14
- close(): Promise<void>;
15
- }
16
- export {};
1
+ import { MongoClientOptions, Collection } from "mongodb";
2
+ interface IDbOptions {
3
+ uri: string;
4
+ databaseName: string;
5
+ options?: MongoClientOptions;
6
+ }
7
+ export declare class MocodyInitializerMongo {
8
+ private _mongoClient;
9
+ private readonly _inits;
10
+ constructor(inits: IDbOptions);
11
+ private getInstance;
12
+ getNewSession(): Promise<import("mongodb").ClientSession>;
13
+ getCustomCollectionInstance<T = any>(collectionName: string): Promise<Collection<T>>;
14
+ close(): Promise<void>;
15
+ }
16
+ export {};
@@ -1,48 +1,48 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MocodyInitializerMongo = void 0;
4
- const tslib_1 = require("tslib");
5
- const mongodb_1 = require("mongodb");
6
- const throat_1 = (0, tslib_1.__importDefault)(require("throat"));
7
- const concurrency = (0, throat_1.default)(1);
8
- class MocodyInitializerMongo {
9
- constructor(inits) {
10
- Object.defineProperty(this, "_mongoClient", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: void 0
15
- });
16
- Object.defineProperty(this, "_inits", {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value: void 0
21
- });
22
- this._inits = inits;
23
- }
24
- async getInstance() {
25
- if (!this._mongoClient) {
26
- this._mongoClient = new mongodb_1.MongoClient(this._inits.uri, this._inits.options);
27
- await this._mongoClient.connect();
28
- }
29
- return this._mongoClient;
30
- }
31
- async getNewSession() {
32
- const client = await concurrency(() => this.getInstance());
33
- return client.startSession();
34
- }
35
- async getCustomCollectionInstance(collectionName) {
36
- const client = await concurrency(() => this.getInstance());
37
- const col = client.db(this._inits.databaseName).collection(collectionName);
38
- return col;
39
- }
40
- async close() {
41
- if (this._mongoClient) {
42
- await this._mongoClient.close();
43
- this._mongoClient = null;
44
- }
45
- }
46
- }
47
- exports.MocodyInitializerMongo = MocodyInitializerMongo;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MocodyInitializerMongo = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const mongodb_1 = require("mongodb");
6
+ const throat_1 = tslib_1.__importDefault(require("throat"));
7
+ const concurrency = (0, throat_1.default)(1);
8
+ class MocodyInitializerMongo {
9
+ constructor(inits) {
10
+ Object.defineProperty(this, "_mongoClient", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ Object.defineProperty(this, "_inits", {
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true,
20
+ value: void 0
21
+ });
22
+ this._inits = inits;
23
+ }
24
+ async getInstance() {
25
+ if (!this._mongoClient) {
26
+ this._mongoClient = new mongodb_1.MongoClient(this._inits.uri, this._inits.options);
27
+ await this._mongoClient.connect();
28
+ }
29
+ return this._mongoClient;
30
+ }
31
+ async getNewSession() {
32
+ const client = await concurrency(() => this.getInstance());
33
+ return client.startSession();
34
+ }
35
+ async getCustomCollectionInstance(collectionName) {
36
+ const client = await concurrency(() => this.getInstance());
37
+ const col = client.db(this._inits.databaseName).collection(collectionName);
38
+ return col;
39
+ }
40
+ async close() {
41
+ if (this._mongoClient) {
42
+ await this._mongoClient.close();
43
+ this._mongoClient = null;
44
+ }
45
+ }
46
+ }
47
+ exports.MocodyInitializerMongo = MocodyInitializerMongo;
48
48
  //# sourceMappingURL=mongo-initializer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mongo-initializer.js","sourceRoot":"","sources":["../../src/mongo/mongo-initializer.ts"],"names":[],"mappings":";;;;AAAA,qCAAsE;AACtE,iEAA4B;AAC5B,MAAM,WAAW,GAAG,IAAA,gBAAM,EAAC,CAAC,CAAC,CAAC;AAQ9B,MAAa,sBAAsB;IAIjC,YAAY,KAAiB;QAH7B;;;;;WAAqD;QACrD;;;;;WAAoC;QAGlC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,YAAY,GAAG,IAAI,qBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC1E,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SACnC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,YAAY,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAU,cAAsB;QAC/D,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAkB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,UAAU,CAAI,cAAc,CAAC,CAAC;QAC7F,OAAO,GAAG,CAAC;IACb,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;IACH,CAAC;CACF;AAjCD,wDAiCC"}
1
+ {"version":3,"file":"mongo-initializer.js","sourceRoot":"","sources":["../../src/mongo/mongo-initializer.ts"],"names":[],"mappings":";;;;AAAA,qCAAsE;AACtE,4DAA4B;AAC5B,MAAM,WAAW,GAAG,IAAA,gBAAM,EAAC,CAAC,CAAC,CAAC;AAQ9B,MAAa,sBAAsB;IAIjC,YAAY,KAAiB;QAH7B;;;;;WAAqD;QACrD;;;;;WAAoC;QAGlC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,YAAY,GAAG,IAAI,qBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC1E,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;SACnC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,YAAY,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAU,cAAsB;QAC/D,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAkB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,UAAU,CAAI,cAAc,CAAC,CAAC;QAC7F,OAAO,GAAG,CAAC;IACb,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;IACH,CAAC;CACF;AAjCD,wDAiCC"}
@@ -1,31 +1,31 @@
1
- import type { IMocodyIndexDefinition } from "../type";
2
- import type { MocodyInitializerMongo } from "./mongo-initializer";
3
- interface ITableOptions<T> {
4
- mongoDb: () => MocodyInitializerMongo;
5
- secondaryIndexOptions: IMocodyIndexDefinition<T>[];
6
- tableFullName: string;
7
- partitionKeyFieldName: string;
8
- sortKeyFieldName: string;
9
- }
10
- export declare class MongoManageTable<T> {
11
- private readonly partitionKeyFieldName;
12
- private readonly sortKeyFieldName;
13
- private readonly mongoDb;
14
- private readonly tableFullName;
15
- private readonly secondaryIndexOptions;
16
- constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName, }: ITableOptions<T>);
17
- private _trickLinter;
18
- private _mocody_getInstance;
19
- mocody_createIndex({ indexName, fields }: {
20
- indexName: string;
21
- fields: string[];
22
- }): Promise<string>;
23
- mocody_clearAllIndexes(): Promise<{
24
- indexes: import("bson").Document[];
25
- dropedIndexes: Record<string, any>;
26
- }>;
27
- mocody_getIndexes(): Promise<import("bson").Document[]>;
28
- mocody_createTTL(): Promise<string>;
29
- mocody_createDefinedIndexes(): Promise<string[]>;
30
- }
31
- export {};
1
+ import type { IMocodyIndexDefinition } from "../type";
2
+ import type { MocodyInitializerMongo } from "./mongo-initializer";
3
+ interface ITableOptions<T> {
4
+ mongoDb: () => MocodyInitializerMongo;
5
+ secondaryIndexOptions: IMocodyIndexDefinition<T>[];
6
+ tableFullName: string;
7
+ partitionKeyFieldName: string;
8
+ sortKeyFieldName: string;
9
+ }
10
+ export declare class MongoManageTable<T> {
11
+ private readonly partitionKeyFieldName;
12
+ private readonly sortKeyFieldName;
13
+ private readonly mongoDb;
14
+ private readonly tableFullName;
15
+ private readonly secondaryIndexOptions;
16
+ constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName, }: ITableOptions<T>);
17
+ private _trickLinter;
18
+ private _mocody_getInstance;
19
+ mocody_createIndex({ indexName, fields }: {
20
+ indexName: string;
21
+ fields: string[];
22
+ }): Promise<string>;
23
+ mocody_clearAllIndexes(): Promise<{
24
+ indexes: import("bson").Document[];
25
+ dropedIndexes: Record<string, any>;
26
+ }>;
27
+ mocody_getIndexes(): Promise<import("bson").Document[]>;
28
+ mocody_createTTL(): Promise<string>;
29
+ mocody_createDefinedIndexes(): Promise<string[]>;
30
+ }
31
+ export {};
@@ -1,105 +1,105 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MongoManageTable = void 0;
4
- const logging_service_1 = require("./../helpers/logging-service");
5
- class MongoManageTable {
6
- constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName, }) {
7
- Object.defineProperty(this, "partitionKeyFieldName", {
8
- enumerable: true,
9
- configurable: true,
10
- writable: true,
11
- value: void 0
12
- });
13
- Object.defineProperty(this, "sortKeyFieldName", {
14
- enumerable: true,
15
- configurable: true,
16
- writable: true,
17
- value: void 0
18
- });
19
- Object.defineProperty(this, "mongoDb", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: void 0
24
- });
25
- Object.defineProperty(this, "tableFullName", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: void 0
30
- });
31
- Object.defineProperty(this, "secondaryIndexOptions", {
32
- enumerable: true,
33
- configurable: true,
34
- writable: true,
35
- value: void 0
36
- });
37
- this.mongoDb = mongoDb;
38
- this.tableFullName = tableFullName;
39
- this.partitionKeyFieldName = partitionKeyFieldName;
40
- this.sortKeyFieldName = sortKeyFieldName;
41
- this.secondaryIndexOptions = secondaryIndexOptions;
42
- this._trickLinter();
43
- }
44
- _trickLinter() {
45
- if (this.partitionKeyFieldName && this.sortKeyFieldName && this.tableFullName) {
46
- }
47
- }
48
- _mocody_getInstance() {
49
- return this.mongoDb().getCustomCollectionInstance(this.tableFullName);
50
- }
51
- async mocody_createIndex({ indexName, fields }) {
52
- const db = await this._mocody_getInstance();
53
- const indexObject = {};
54
- fields.forEach((key) => {
55
- indexObject[key] = 1;
56
- });
57
- const result = await db.createIndex(indexObject, { name: indexName });
58
- logging_service_1.LoggingService.log(result);
59
- return result;
60
- }
61
- async mocody_clearAllIndexes() {
62
- const db = await this._mocody_getInstance();
63
- const indexes = await this.mocody_getIndexes();
64
- const dropedIndexes = {};
65
- if (indexes) {
66
- for (const [name, value] of Object.entries(indexes)) {
67
- if (name !== "_id_") {
68
- await db.dropIndex(name);
69
- dropedIndexes[name] = value;
70
- }
71
- }
72
- }
73
- return {
74
- indexes,
75
- dropedIndexes,
76
- };
77
- }
78
- async mocody_getIndexes() {
79
- const db = await this._mocody_getInstance();
80
- return await db.indexes();
81
- }
82
- async mocody_createTTL() {
83
- const db = await this._mocody_getInstance();
84
- const fieldName = "dangerouslyExpireAtTTL";
85
- return await db.createIndex({ [fieldName]: 1 }, { expireAfterSeconds: 1 });
86
- }
87
- async mocody_createDefinedIndexes() {
88
- const results = [];
89
- if (this.secondaryIndexOptions?.length) {
90
- for (const indexOption of this.secondaryIndexOptions) {
91
- if (indexOption.indexName) {
92
- const resultData = await this.mocody_createIndex({
93
- fields: [indexOption.partitionKeyFieldName, indexOption.sortKeyFieldName],
94
- indexName: indexOption.indexName,
95
- });
96
- logging_service_1.LoggingService.log(resultData);
97
- results.push(resultData);
98
- }
99
- }
100
- }
101
- return results;
102
- }
103
- }
104
- exports.MongoManageTable = MongoManageTable;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MongoManageTable = void 0;
4
+ const logging_service_1 = require("./../helpers/logging-service");
5
+ class MongoManageTable {
6
+ constructor({ mongoDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName, }) {
7
+ Object.defineProperty(this, "partitionKeyFieldName", {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: void 0
12
+ });
13
+ Object.defineProperty(this, "sortKeyFieldName", {
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true,
17
+ value: void 0
18
+ });
19
+ Object.defineProperty(this, "mongoDb", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: void 0
24
+ });
25
+ Object.defineProperty(this, "tableFullName", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ Object.defineProperty(this, "secondaryIndexOptions", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ this.mongoDb = mongoDb;
38
+ this.tableFullName = tableFullName;
39
+ this.partitionKeyFieldName = partitionKeyFieldName;
40
+ this.sortKeyFieldName = sortKeyFieldName;
41
+ this.secondaryIndexOptions = secondaryIndexOptions;
42
+ this._trickLinter();
43
+ }
44
+ _trickLinter() {
45
+ if (this.partitionKeyFieldName && this.sortKeyFieldName && this.tableFullName) {
46
+ }
47
+ }
48
+ _mocody_getInstance() {
49
+ return this.mongoDb().getCustomCollectionInstance(this.tableFullName);
50
+ }
51
+ async mocody_createIndex({ indexName, fields }) {
52
+ const db = await this._mocody_getInstance();
53
+ const indexObject = {};
54
+ fields.forEach((key) => {
55
+ indexObject[key] = 1;
56
+ });
57
+ const result = await db.createIndex(indexObject, { name: indexName });
58
+ logging_service_1.LoggingService.log(result);
59
+ return result;
60
+ }
61
+ async mocody_clearAllIndexes() {
62
+ const db = await this._mocody_getInstance();
63
+ const indexes = await this.mocody_getIndexes();
64
+ const dropedIndexes = {};
65
+ if (indexes) {
66
+ for (const [name, value] of Object.entries(indexes)) {
67
+ if (name !== "_id_") {
68
+ await db.dropIndex(name);
69
+ dropedIndexes[name] = value;
70
+ }
71
+ }
72
+ }
73
+ return {
74
+ indexes,
75
+ dropedIndexes,
76
+ };
77
+ }
78
+ async mocody_getIndexes() {
79
+ const db = await this._mocody_getInstance();
80
+ return await db.indexes();
81
+ }
82
+ async mocody_createTTL() {
83
+ const db = await this._mocody_getInstance();
84
+ const fieldName = "dangerouslyExpireAtTTL";
85
+ return await db.createIndex({ [fieldName]: 1 }, { expireAfterSeconds: 1 });
86
+ }
87
+ async mocody_createDefinedIndexes() {
88
+ const results = [];
89
+ if (this.secondaryIndexOptions?.length) {
90
+ for (const indexOption of this.secondaryIndexOptions) {
91
+ if (indexOption.indexName) {
92
+ const resultData = await this.mocody_createIndex({
93
+ fields: [indexOption.partitionKeyFieldName, indexOption.sortKeyFieldName],
94
+ indexName: indexOption.indexName,
95
+ });
96
+ logging_service_1.LoggingService.log(resultData);
97
+ results.push(resultData);
98
+ }
99
+ }
100
+ }
101
+ return results;
102
+ }
103
+ }
104
+ exports.MongoManageTable = MongoManageTable;
105
105
  //# sourceMappingURL=mongo-table-manager.js.map
@@ -1,108 +1,109 @@
1
- declare type RequireAtLeastOneBase<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
2
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
3
- }[Keys];
4
- declare type RequireAtLeastOne<T> = RequireAtLeastOneBase<T, keyof T>;
5
- declare type TypeFallBackStringOnly<T> = Extract<T, string>;
6
- declare type TypeFallBack<T> = undefined extends T ? Exclude<T, undefined> : T;
7
- declare type TypeFallBackArray<T> = number extends T ? number[] : string extends T ? string[] : T;
8
- export declare type IMocodyKeyConditionParams<T = string> = {
9
- $eq?: TypeFallBack<T> | null;
10
- $gt?: TypeFallBack<T>;
11
- $gte?: TypeFallBack<T>;
12
- $lt?: TypeFallBack<T>;
13
- $lte?: TypeFallBack<T>;
14
- $between?: [TypeFallBack<T>, TypeFallBack<T>];
15
- $beginsWith?: TypeFallBackStringOnly<T>;
16
- };
17
- export declare type IMocodyQueryConditionParams<T = any> = IMocodyKeyConditionParams<T> & {
18
- $ne?: TypeFallBack<T> | null;
19
- $in?: TypeFallBackArray<T>;
20
- $nin?: TypeFallBackArray<T>;
21
- $exists?: boolean;
22
- $not?: IMocodyKeyConditionParams<T>;
23
- $elemMatch?: {
24
- $in: TypeFallBackArray<T>;
25
- };
26
- $contains?: TypeFallBackStringOnly<T>;
27
- $notContains?: TypeFallBackStringOnly<T>;
28
- $nestedMatch?: QueryKeyConditionBasic<RequireAtLeastOne<T>>;
29
- };
30
- declare type QueryPartialAll<T> = {
31
- [P in keyof T]: T[P] | IMocodyQueryConditionParams<T[P]>;
32
- };
33
- declare type QueryKeyConditionBasic<T> = {
34
- [P in keyof T]: T[P] | IMocodyKeyConditionParams<T[P]>;
35
- };
36
- export interface IMocodyPagingResult<T> {
37
- nextPageHash: string | undefined;
38
- paginationResults: T;
39
- }
40
- export declare type IMocodyPagingParams = {
41
- evaluationLimit?: number;
42
- nextPageHash?: string;
43
- };
44
- declare type IQueryDefOr<T> = {
45
- $or?: QueryPartialAll<RequireAtLeastOne<T>>[];
46
- };
47
- declare type IQueryDefAnd<T> = {
48
- $and?: QueryPartialAll<RequireAtLeastOne<T>>[];
49
- };
50
- export declare type IMocodyQueryDefinition<T> = QueryPartialAll<RequireAtLeastOne<T & IQueryDefOr<T> & IQueryDefAnd<T>>>;
51
- export interface IMocodyQueryIndexOptions<T, TSortKeyField = string> {
52
- indexName: string;
53
- partitionKeyValue: string | number;
54
- sortKeyQuery?: IMocodyKeyConditionParams<TSortKeyField>;
55
- query?: IMocodyQueryDefinition<T>;
56
- fields?: (keyof T)[];
57
- excludeFields?: (keyof T)[];
58
- pagingParams?: IMocodyPagingParams;
59
- limit?: number | null;
60
- sort?: "asc" | "desc" | null;
61
- }
62
- export declare type IMocodyQueryIndexOptionsNoPaging<T, TSortKeyField = string> = Omit<IMocodyQueryIndexOptions<T, TSortKeyField>, "pagingParams">;
63
- export interface IMocodyIndexDefinition<T> {
64
- indexName: string;
65
- partitionKeyFieldName: keyof T;
66
- sortKeyFieldName: keyof T;
67
- dataType: "N" | "S";
68
- projectionFieldsInclude?: (keyof T)[];
69
- }
70
- export declare type IMocodyFieldCondition<T> = {
71
- field: keyof T;
72
- equals: string | number;
73
- }[];
74
- interface IMocodyCreateTransactionPrepare<T> {
75
- kind: "create";
76
- data: T;
77
- }
78
- interface IMocodyUpdateTransactionPrepare<T> {
79
- kind: "update";
80
- data: T;
81
- dataId: string;
82
- }
83
- interface IMocodyDeleteTransactionPrepare<T> {
84
- kind: "delete";
85
- dataId: string;
86
- }
87
- export declare type IMocodyTransactionPrepare<T> = IMocodyCreateTransactionPrepare<T> | IMocodyUpdateTransactionPrepare<T> | IMocodyDeleteTransactionPrepare<T>;
88
- interface IMocodyPreparedCreateTransaction {
89
- kind: "create";
90
- tableName: string;
91
- data: Record<string, any>;
92
- partitionKeyFieldName: "id";
93
- }
94
- interface IMocodyPreparedUpdateTransaction {
95
- kind: "update";
96
- tableName: string;
97
- data: Record<string, any>;
98
- keyQuery: Record<string, any>;
99
- partitionKeyFieldName: "id";
100
- }
101
- interface IMocodyPreparedDeleteTransaction {
102
- kind: "delete";
103
- tableName: string;
104
- keyQuery: Record<string, any>;
105
- partitionKeyFieldName: "id";
106
- }
107
- export declare type IMocodyPreparedTransaction = IMocodyPreparedCreateTransaction | IMocodyPreparedUpdateTransaction | IMocodyPreparedDeleteTransaction;
108
- export {};
1
+ declare type RequireAtLeastOneBase<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
2
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
3
+ }[Keys];
4
+ declare type RequireAtLeastOne<T> = RequireAtLeastOneBase<T, keyof T>;
5
+ declare type TypeFallBackStringOnly<T> = Extract<T, string>;
6
+ declare type TypeFallBack<T> = undefined extends T ? Exclude<T, undefined> : T;
7
+ declare type TypeFallBackArray<T> = number extends T ? number[] : string extends T ? string[] : T;
8
+ declare type TypeFallBackArrayAdvanced<T> = number extends T ? number[] : string extends T ? string[] : Extract<T, string>[] | Extract<T, number>[];
9
+ export declare type IMocodyKeyConditionParams<T = string> = {
10
+ $eq?: TypeFallBack<T> | null;
11
+ $gt?: TypeFallBack<T>;
12
+ $gte?: TypeFallBack<T>;
13
+ $lt?: TypeFallBack<T>;
14
+ $lte?: TypeFallBack<T>;
15
+ $between?: [TypeFallBack<T>, TypeFallBack<T>];
16
+ $beginsWith?: TypeFallBackStringOnly<T>;
17
+ };
18
+ export declare type IMocodyQueryConditionParams<T = any> = IMocodyKeyConditionParams<T> & {
19
+ $ne?: TypeFallBack<T> | null;
20
+ $in?: TypeFallBackArrayAdvanced<T>;
21
+ $nin?: TypeFallBackArrayAdvanced<T>;
22
+ $exists?: boolean;
23
+ $not?: IMocodyKeyConditionParams<T>;
24
+ $elemMatch?: {
25
+ $in: TypeFallBackArray<T>;
26
+ };
27
+ $contains?: TypeFallBackStringOnly<T>;
28
+ $notContains?: TypeFallBackStringOnly<T>;
29
+ $nestedMatch?: QueryKeyConditionBasic<RequireAtLeastOne<T>>;
30
+ };
31
+ declare type QueryPartialAll<T> = {
32
+ [P in keyof T]: T[P] | IMocodyQueryConditionParams<T[P]>;
33
+ };
34
+ declare type QueryKeyConditionBasic<T> = {
35
+ [P in keyof T]: T[P] | IMocodyKeyConditionParams<T[P]>;
36
+ };
37
+ export interface IMocodyPagingResult<T> {
38
+ nextPageHash: string | undefined;
39
+ paginationResults: T;
40
+ }
41
+ export declare type IMocodyPagingParams = {
42
+ evaluationLimit?: number;
43
+ nextPageHash?: string;
44
+ };
45
+ declare type IQueryDefOr<T> = {
46
+ $or?: QueryPartialAll<RequireAtLeastOne<T>>[];
47
+ };
48
+ declare type IQueryDefAnd<T> = {
49
+ $and?: QueryPartialAll<RequireAtLeastOne<T>>[];
50
+ };
51
+ export declare type IMocodyQueryDefinition<T> = QueryPartialAll<RequireAtLeastOne<T & IQueryDefOr<T> & IQueryDefAnd<T>>>;
52
+ export interface IMocodyQueryIndexOptions<T, TSortKeyField = string> {
53
+ indexName: string;
54
+ partitionKeyValue: string | number;
55
+ sortKeyQuery?: IMocodyKeyConditionParams<TSortKeyField>;
56
+ query?: IMocodyQueryDefinition<T>;
57
+ fields?: (keyof T)[];
58
+ excludeFields?: (keyof T)[];
59
+ pagingParams?: IMocodyPagingParams;
60
+ limit?: number | null;
61
+ sort?: "asc" | "desc" | null;
62
+ }
63
+ export declare type IMocodyQueryIndexOptionsNoPaging<T, TSortKeyField = string> = Omit<IMocodyQueryIndexOptions<T, TSortKeyField>, "pagingParams">;
64
+ export interface IMocodyIndexDefinition<T> {
65
+ indexName: string;
66
+ partitionKeyFieldName: keyof T;
67
+ sortKeyFieldName: keyof T;
68
+ dataType: "N" | "S";
69
+ projectionFieldsInclude?: (keyof T)[];
70
+ }
71
+ export declare type IMocodyFieldCondition<T> = {
72
+ field: keyof T;
73
+ equals: string | number;
74
+ }[];
75
+ interface IMocodyCreateTransactionPrepare<T> {
76
+ kind: "create";
77
+ data: T;
78
+ }
79
+ interface IMocodyUpdateTransactionPrepare<T> {
80
+ kind: "update";
81
+ data: T;
82
+ dataId: string;
83
+ }
84
+ interface IMocodyDeleteTransactionPrepare<T> {
85
+ kind: "delete";
86
+ dataId: string;
87
+ }
88
+ export declare type IMocodyTransactionPrepare<T> = IMocodyCreateTransactionPrepare<T> | IMocodyUpdateTransactionPrepare<T> | IMocodyDeleteTransactionPrepare<T>;
89
+ interface IMocodyPreparedCreateTransaction {
90
+ kind: "create";
91
+ tableName: string;
92
+ data: Record<string, any>;
93
+ partitionKeyFieldName: "id";
94
+ }
95
+ interface IMocodyPreparedUpdateTransaction {
96
+ kind: "update";
97
+ tableName: string;
98
+ data: Record<string, any>;
99
+ keyQuery: Record<string, any>;
100
+ partitionKeyFieldName: "id";
101
+ }
102
+ interface IMocodyPreparedDeleteTransaction {
103
+ kind: "delete";
104
+ tableName: string;
105
+ keyQuery: Record<string, any>;
106
+ partitionKeyFieldName: "id";
107
+ }
108
+ export declare type IMocodyPreparedTransaction = IMocodyPreparedCreateTransaction | IMocodyPreparedUpdateTransaction | IMocodyPreparedDeleteTransaction;
109
+ export {};
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=index.js.map