mocody 0.4.38 → 0.5.0-alpha
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/dist/core/base-schema.d.ts +13 -13
- package/dist/core/base-schema.js +11 -11
- package/dist/couch/couch-data-operation.d.ts +92 -92
- package/dist/couch/couch-data-operation.js +580 -580
- package/dist/couch/couch-data-operation.js.map +1 -1
- package/dist/couch/couch-filter-query-operation.d.ts +45 -47
- package/dist/couch/couch-filter-query-operation.js +371 -438
- package/dist/couch/couch-filter-query-operation.js.map +1 -1
- package/dist/couch/couch-initializer.d.ts +126 -126
- package/dist/couch/couch-initializer.js +189 -189
- package/dist/couch/couch-initializer.js.map +1 -1
- package/dist/couch/couch-manage-table.d.ts +46 -46
- package/dist/couch/couch-manage-table.js +103 -103
- package/dist/couch/couch-manage-table.js.map +1 -1
- package/dist/dynamo/dynamo-data-operation.d.ts +102 -99
- package/dist/dynamo/dynamo-data-operation.js +932 -797
- package/dist/dynamo/dynamo-data-operation.js.map +1 -1
- package/dist/dynamo/dynamo-filter-query-operation.d.ts +29 -29
- package/dist/dynamo/dynamo-filter-query-operation.js +603 -690
- package/dist/dynamo/dynamo-filter-query-operation.js.map +1 -1
- package/dist/dynamo/dynamo-filter-query-partiql-operation.d.ts +22 -0
- package/dist/dynamo/dynamo-filter-query-partiql-operation.js +457 -0
- package/dist/dynamo/dynamo-filter-query-partiql-operation.js.map +1 -0
- package/dist/dynamo/dynamo-helper.d.ts +1 -1
- package/dist/dynamo/dynamo-helper.js +8 -8
- package/dist/dynamo/dynamo-initializer.d.ts +15 -14
- package/dist/dynamo/dynamo-initializer.js +66 -58
- package/dist/dynamo/dynamo-initializer.js.map +1 -1
- package/dist/dynamo/dynamo-manage-table.d.ts +33 -33
- package/dist/dynamo/dynamo-manage-table.js +419 -419
- package/dist/dynamo/dynamo-manage-table.js.map +1 -1
- package/dist/dynamo/dynamo-query-partiql-processor.d.ts +31 -0
- package/dist/dynamo/dynamo-query-partiql-processor.js +277 -0
- package/dist/dynamo/dynamo-query-partiql-processor.js.map +1 -0
- package/dist/dynamo/dynamo-query-scan-processor.d.ts +25 -25
- package/dist/dynamo/dynamo-query-scan-processor.js +268 -268
- package/dist/dynamo/dynamo-query-scan-processor.js.map +1 -1
- package/dist/helpers/base-joi-helper.d.ts +2 -2
- package/dist/helpers/base-joi-helper.js +12 -12
- package/dist/helpers/constants.d.ts +3 -3
- package/dist/helpers/constants.js +6 -6
- package/dist/helpers/errors.d.ts +13 -13
- package/dist/helpers/errors.js +38 -38
- package/dist/helpers/logging-service.d.ts +9 -9
- package/dist/helpers/logging-service.js +53 -53
- package/dist/helpers/logging-service.js.map +1 -1
- package/dist/helpers/mocody-utils.d.ts +16 -16
- package/dist/helpers/mocody-utils.js +58 -58
- package/dist/helpers/query-validator.d.ts +20 -20
- package/dist/helpers/query-validator.js +96 -96
- package/dist/helpers/util-service.d.ts +29 -29
- package/dist/helpers/util-service.js +155 -155
- package/dist/index.d.ts +12 -12
- package/dist/index.js +23 -23
- package/dist/model/index.d.ts +42 -42
- package/dist/model/index.js +6 -6
- package/dist/mongo/mongo-data-operation.d.ts +90 -90
- package/dist/mongo/mongo-data-operation.js +607 -607
- package/dist/mongo/mongo-data-operation.js.map +1 -1
- package/dist/mongo/mongo-filter-query-operation.d.ts +45 -47
- package/dist/mongo/mongo-filter-query-operation.js +368 -433
- package/dist/mongo/mongo-filter-query-operation.js.map +1 -1
- package/dist/mongo/mongo-initializer.d.ts +16 -16
- package/dist/mongo/mongo-initializer.js +47 -47
- package/dist/mongo/mongo-initializer.js.map +1 -1
- package/dist/mongo/mongo-table-manager.d.ts +31 -31
- package/dist/mongo/mongo-table-manager.js +104 -104
- package/dist/mongo/mongo-table-manager.js.map +1 -1
- package/dist/pouch/pouch-data-operation.d.ts +90 -90
- package/dist/pouch/pouch-data-operation.js +583 -583
- package/dist/pouch/pouch-data-operation.js.map +1 -1
- package/dist/pouch/pouch-filter-query-operation.d.ts +45 -47
- package/dist/pouch/pouch-filter-query-operation.js +371 -438
- package/dist/pouch/pouch-filter-query-operation.js.map +1 -1
- package/dist/pouch/pouch-initializer.d.ts +111 -109
- package/dist/pouch/pouch-initializer.js +357 -357
- package/dist/pouch/pouch-initializer.js.map +1 -1
- package/dist/pouch/pouch-manage-table.d.ts +35 -35
- package/dist/pouch/pouch-manage-table.js +99 -99
- package/dist/pouch/pouch-manage-table.js.map +1 -1
- package/dist/type/index.d.ts +118 -119
- package/dist/type/index.js +2 -2
- package/package.json +17 -16
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
declare class UtilServiceBase {
|
|
2
|
-
convertHexadecimalToNumber(hexString: string): number;
|
|
3
|
-
getRandomDecimal(min: number, max: number): number;
|
|
4
|
-
getRandomInt(min: number, max: number): number;
|
|
5
|
-
getRandomString(count: number): string;
|
|
6
|
-
camelCaseToSentenceCase(text: string): string;
|
|
7
|
-
toTitleCase(text: string): string;
|
|
8
|
-
isValidPhoneNumber(_str: string): boolean;
|
|
9
|
-
convertObjectPlainObject<T = any>(objData: T): T;
|
|
10
|
-
removeDuplicateString(items: string[]): string[];
|
|
11
|
-
objectHasAnyProperty(obj: any): boolean;
|
|
12
|
-
waitUntilMilliseconds(ms: number): Promise<void>;
|
|
13
|
-
waitUntilSeconds(seconds: number): Promise<void>;
|
|
14
|
-
waitUntilMunites(munites: number): Promise<void>;
|
|
15
|
-
generateDynamoTableKey(date?: any): string;
|
|
16
|
-
encodeStringToBase64(str: string): string;
|
|
17
|
-
decodeStringFromBase64(str: string): string;
|
|
18
|
-
isNumeric(n: string | number | null | undefined): boolean;
|
|
19
|
-
isNumericInteger(n: string | number | null | undefined): boolean;
|
|
20
|
-
getEpochTime(date: string | Date): number;
|
|
21
|
-
encodeBase64(str: string): string;
|
|
22
|
-
decodeBase64(str: string): string;
|
|
23
|
-
deleteKeysFromObject<T = Record<string, any>>({ dataObject, delKeys, }: {
|
|
24
|
-
dataObject: T;
|
|
25
|
-
delKeys: (keyof T | string)[];
|
|
26
|
-
}): T;
|
|
27
|
-
}
|
|
28
|
-
export declare const UtilService: UtilServiceBase;
|
|
29
|
-
export {};
|
|
1
|
+
declare class UtilServiceBase {
|
|
2
|
+
convertHexadecimalToNumber(hexString: string): number;
|
|
3
|
+
getRandomDecimal(min: number, max: number): number;
|
|
4
|
+
getRandomInt(min: number, max: number): number;
|
|
5
|
+
getRandomString(count: number): string;
|
|
6
|
+
camelCaseToSentenceCase(text: string): string;
|
|
7
|
+
toTitleCase(text: string): string;
|
|
8
|
+
isValidPhoneNumber(_str: string): boolean;
|
|
9
|
+
convertObjectPlainObject<T = any>(objData: T): T;
|
|
10
|
+
removeDuplicateString(items: string[]): string[];
|
|
11
|
+
objectHasAnyProperty(obj: any): boolean;
|
|
12
|
+
waitUntilMilliseconds(ms: number): Promise<void>;
|
|
13
|
+
waitUntilSeconds(seconds: number): Promise<void>;
|
|
14
|
+
waitUntilMunites(munites: number): Promise<void>;
|
|
15
|
+
generateDynamoTableKey(date?: any): string;
|
|
16
|
+
encodeStringToBase64(str: string): string;
|
|
17
|
+
decodeStringFromBase64(str: string): string;
|
|
18
|
+
isNumeric(n: string | number | null | undefined): boolean;
|
|
19
|
+
isNumericInteger(n: string | number | null | undefined): boolean;
|
|
20
|
+
getEpochTime(date: string | Date): number;
|
|
21
|
+
encodeBase64(str: string): string;
|
|
22
|
+
decodeBase64(str: string): string;
|
|
23
|
+
deleteKeysFromObject<T = Record<string, any>>({ dataObject, delKeys, }: {
|
|
24
|
+
dataObject: T;
|
|
25
|
+
delKeys: (keyof T | string)[];
|
|
26
|
+
}): T;
|
|
27
|
+
}
|
|
28
|
+
export declare const UtilService: UtilServiceBase;
|
|
29
|
+
export {};
|
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UtilService = void 0;
|
|
4
|
-
const node_crypto_1 = require("node:crypto");
|
|
5
|
-
const nanoid_1 = require("nanoid");
|
|
6
|
-
class UtilServiceBase {
|
|
7
|
-
convertHexadecimalToNumber(hexString) {
|
|
8
|
-
return parseInt(hexString, 16);
|
|
9
|
-
}
|
|
10
|
-
getRandomDecimal(min, max) {
|
|
11
|
-
return Math.random() * (max - min) + min;
|
|
12
|
-
}
|
|
13
|
-
getRandomInt(min, max) {
|
|
14
|
-
const minVal = Math.ceil(min);
|
|
15
|
-
const maxVal = Math.floor(max);
|
|
16
|
-
return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
|
|
17
|
-
}
|
|
18
|
-
getRandomString(count) {
|
|
19
|
-
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
20
|
-
const nanoid01 = (0, nanoid_1.customAlphabet)(alphabet, count);
|
|
21
|
-
return nanoid01();
|
|
22
|
-
}
|
|
23
|
-
camelCaseToSentenceCase(text) {
|
|
24
|
-
const result = text.replace(/([A-Z])/g, " $1");
|
|
25
|
-
const rst = result.charAt(0).toUpperCase() + result.slice(1);
|
|
26
|
-
return rst.trim();
|
|
27
|
-
}
|
|
28
|
-
toTitleCase(text) {
|
|
29
|
-
return text.replace(/\w\S*/g, (txt) => {
|
|
30
|
-
return txt[0].toUpperCase() + txt.slice(1).toLowerCase();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
isValidPhoneNumber(_str) {
|
|
34
|
-
if (isNaN(Number(_str))) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const isNum = /^\d+$/.test(_str);
|
|
38
|
-
return isNum;
|
|
39
|
-
}
|
|
40
|
-
convertObjectPlainObject(objData) {
|
|
41
|
-
const objDataPlain = JSON.parse(JSON.stringify(objData));
|
|
42
|
-
return objDataPlain;
|
|
43
|
-
}
|
|
44
|
-
removeDuplicateString(items) {
|
|
45
|
-
if (!Array.isArray(items)) {
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
const unique = {};
|
|
49
|
-
items.forEach((i) => {
|
|
50
|
-
if (!unique[i]) {
|
|
51
|
-
unique[i] = true;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return Object.keys(unique);
|
|
55
|
-
}
|
|
56
|
-
objectHasAnyProperty(obj) {
|
|
57
|
-
if (obj && typeof obj === "object") {
|
|
58
|
-
return Object.keys(obj).length > 0;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
waitUntilMilliseconds(ms) {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
resolve();
|
|
66
|
-
}, ms);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
waitUntilSeconds(seconds) {
|
|
70
|
-
return new Promise((resolve) => {
|
|
71
|
-
setTimeout(() => {
|
|
72
|
-
resolve();
|
|
73
|
-
}, Math.round(seconds * 1000));
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
waitUntilMunites(munites) {
|
|
77
|
-
return new Promise((resolve) => {
|
|
78
|
-
setTimeout(() => {
|
|
79
|
-
resolve();
|
|
80
|
-
}, Math.round(munites * 60 * 1000));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
generateDynamoTableKey(date) {
|
|
84
|
-
const _now = date ? new Date(date) : new Date();
|
|
85
|
-
const key = [
|
|
86
|
-
`${_now.getFullYear()}`,
|
|
87
|
-
`${_now.getMonth() + 1}`.padStart(2, "0"),
|
|
88
|
-
`${_now.getDate()}`.padStart(2, "0"),
|
|
89
|
-
"-",
|
|
90
|
-
`${_now.getHours()}`.padStart(2, "0"),
|
|
91
|
-
`${_now.getMinutes()}`.padStart(2, "0"),
|
|
92
|
-
`${_now.getSeconds()}`.padStart(2, "0"),
|
|
93
|
-
"-",
|
|
94
|
-
(0, node_crypto_1.randomUUID)(),
|
|
95
|
-
];
|
|
96
|
-
return key.join("");
|
|
97
|
-
}
|
|
98
|
-
encodeStringToBase64(str) {
|
|
99
|
-
return Buffer.from(str).toString("base64");
|
|
100
|
-
}
|
|
101
|
-
decodeStringFromBase64(str) {
|
|
102
|
-
return Buffer.from(str, "base64").toString();
|
|
103
|
-
}
|
|
104
|
-
isNumeric(n) {
|
|
105
|
-
if (n === null || typeof n === "undefined" || typeof n === "boolean") {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
const nn = String(n);
|
|
109
|
-
if (nn.trim() && !isNaN(Number(nn)) && isFinite(Number(nn)) && !isNaN(parseFloat(nn))) {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
isNumericInteger(n) {
|
|
115
|
-
const nn = String(n);
|
|
116
|
-
const numberOnly = /^\d+$/.test(nn);
|
|
117
|
-
if (!numberOnly) {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
if (!this.isNumeric(n)) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
const mInt = parseInt(Number(n).toString());
|
|
124
|
-
if (mInt >= 1) {
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
getEpochTime(date) {
|
|
130
|
-
const epoc = Math.floor(new Date(date).getTime() / 1000.0);
|
|
131
|
-
return epoc;
|
|
132
|
-
}
|
|
133
|
-
encodeBase64(str) {
|
|
134
|
-
return Buffer.from(JSON.stringify(str)).toString("base64");
|
|
135
|
-
}
|
|
136
|
-
decodeBase64(str) {
|
|
137
|
-
return Buffer.from(str, "base64").toString();
|
|
138
|
-
}
|
|
139
|
-
deleteKeysFromObject({ dataObject, delKeys, }) {
|
|
140
|
-
if (!(dataObject && typeof dataObject === "object")) {
|
|
141
|
-
return dataObject;
|
|
142
|
-
}
|
|
143
|
-
if (Array.isArray(dataObject)) {
|
|
144
|
-
return dataObject;
|
|
145
|
-
}
|
|
146
|
-
const chosenDataObject = {};
|
|
147
|
-
Object.keys(dataObject).forEach((key) => {
|
|
148
|
-
if (!delKeys.includes(key)) {
|
|
149
|
-
chosenDataObject[key] = dataObject[key];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
return chosenDataObject;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
exports.UtilService = new UtilServiceBase();
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UtilService = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const nanoid_1 = require("nanoid");
|
|
6
|
+
class UtilServiceBase {
|
|
7
|
+
convertHexadecimalToNumber(hexString) {
|
|
8
|
+
return parseInt(hexString, 16);
|
|
9
|
+
}
|
|
10
|
+
getRandomDecimal(min, max) {
|
|
11
|
+
return Math.random() * (max - min) + min;
|
|
12
|
+
}
|
|
13
|
+
getRandomInt(min, max) {
|
|
14
|
+
const minVal = Math.ceil(min);
|
|
15
|
+
const maxVal = Math.floor(max);
|
|
16
|
+
return Math.floor(Math.random() * (maxVal - minVal + 1)) + minVal;
|
|
17
|
+
}
|
|
18
|
+
getRandomString(count) {
|
|
19
|
+
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
20
|
+
const nanoid01 = (0, nanoid_1.customAlphabet)(alphabet, count);
|
|
21
|
+
return nanoid01();
|
|
22
|
+
}
|
|
23
|
+
camelCaseToSentenceCase(text) {
|
|
24
|
+
const result = text.replace(/([A-Z])/g, " $1");
|
|
25
|
+
const rst = result.charAt(0).toUpperCase() + result.slice(1);
|
|
26
|
+
return rst.trim();
|
|
27
|
+
}
|
|
28
|
+
toTitleCase(text) {
|
|
29
|
+
return text.replace(/\w\S*/g, (txt) => {
|
|
30
|
+
return txt[0].toUpperCase() + txt.slice(1).toLowerCase();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
isValidPhoneNumber(_str) {
|
|
34
|
+
if (isNaN(Number(_str))) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const isNum = /^\d+$/.test(_str);
|
|
38
|
+
return isNum;
|
|
39
|
+
}
|
|
40
|
+
convertObjectPlainObject(objData) {
|
|
41
|
+
const objDataPlain = JSON.parse(JSON.stringify(objData));
|
|
42
|
+
return objDataPlain;
|
|
43
|
+
}
|
|
44
|
+
removeDuplicateString(items) {
|
|
45
|
+
if (!Array.isArray(items)) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const unique = {};
|
|
49
|
+
items.forEach((i) => {
|
|
50
|
+
if (!unique[i]) {
|
|
51
|
+
unique[i] = true;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return Object.keys(unique);
|
|
55
|
+
}
|
|
56
|
+
objectHasAnyProperty(obj) {
|
|
57
|
+
if (obj && typeof obj === "object") {
|
|
58
|
+
return Object.keys(obj).length > 0;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
waitUntilMilliseconds(ms) {
|
|
63
|
+
return new Promise((resolve, reject) => {
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
resolve();
|
|
66
|
+
}, ms);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
waitUntilSeconds(seconds) {
|
|
70
|
+
return new Promise((resolve) => {
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
resolve();
|
|
73
|
+
}, Math.round(seconds * 1000));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
waitUntilMunites(munites) {
|
|
77
|
+
return new Promise((resolve) => {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
resolve();
|
|
80
|
+
}, Math.round(munites * 60 * 1000));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
generateDynamoTableKey(date) {
|
|
84
|
+
const _now = date ? new Date(date) : new Date();
|
|
85
|
+
const key = [
|
|
86
|
+
`${_now.getFullYear()}`,
|
|
87
|
+
`${_now.getMonth() + 1}`.padStart(2, "0"),
|
|
88
|
+
`${_now.getDate()}`.padStart(2, "0"),
|
|
89
|
+
"-",
|
|
90
|
+
`${_now.getHours()}`.padStart(2, "0"),
|
|
91
|
+
`${_now.getMinutes()}`.padStart(2, "0"),
|
|
92
|
+
`${_now.getSeconds()}`.padStart(2, "0"),
|
|
93
|
+
"-",
|
|
94
|
+
(0, node_crypto_1.randomUUID)(),
|
|
95
|
+
];
|
|
96
|
+
return key.join("");
|
|
97
|
+
}
|
|
98
|
+
encodeStringToBase64(str) {
|
|
99
|
+
return Buffer.from(str).toString("base64");
|
|
100
|
+
}
|
|
101
|
+
decodeStringFromBase64(str) {
|
|
102
|
+
return Buffer.from(str, "base64").toString();
|
|
103
|
+
}
|
|
104
|
+
isNumeric(n) {
|
|
105
|
+
if (n === null || typeof n === "undefined" || typeof n === "boolean") {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
const nn = String(n);
|
|
109
|
+
if (nn.trim() && !isNaN(Number(nn)) && isFinite(Number(nn)) && !isNaN(parseFloat(nn))) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
isNumericInteger(n) {
|
|
115
|
+
const nn = String(n);
|
|
116
|
+
const numberOnly = /^\d+$/.test(nn);
|
|
117
|
+
if (!numberOnly) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
if (!this.isNumeric(n)) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
const mInt = parseInt(Number(n).toString());
|
|
124
|
+
if (mInt >= 1) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
getEpochTime(date) {
|
|
130
|
+
const epoc = Math.floor(new Date(date).getTime() / 1000.0);
|
|
131
|
+
return epoc;
|
|
132
|
+
}
|
|
133
|
+
encodeBase64(str) {
|
|
134
|
+
return Buffer.from(JSON.stringify(str)).toString("base64");
|
|
135
|
+
}
|
|
136
|
+
decodeBase64(str) {
|
|
137
|
+
return Buffer.from(str, "base64").toString();
|
|
138
|
+
}
|
|
139
|
+
deleteKeysFromObject({ dataObject, delKeys, }) {
|
|
140
|
+
if (!(dataObject && typeof dataObject === "object")) {
|
|
141
|
+
return dataObject;
|
|
142
|
+
}
|
|
143
|
+
if (Array.isArray(dataObject)) {
|
|
144
|
+
return dataObject;
|
|
145
|
+
}
|
|
146
|
+
const chosenDataObject = {};
|
|
147
|
+
Object.keys(dataObject).forEach((key) => {
|
|
148
|
+
if (!delKeys.includes(key)) {
|
|
149
|
+
chosenDataObject[key] = dataObject[key];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return chosenDataObject;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.UtilService = new UtilServiceBase();
|
|
156
156
|
//# sourceMappingURL=util-service.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export type { IMocodyQueryIndexOptions, IMocodyIndexDefinition, IMocodyFieldCondition, IMocodyKeyConditionParams, IMocodyPagingParams, IMocodyQueryConditionParams, IMocodyPagingResult, IMocodyQueryDefinition, IMocodyQueryIndexOptionsNoPaging, } from "./type";
|
|
2
|
-
export { IMocodyCoreEntityModel } from "./core/base-schema";
|
|
3
|
-
export { MocodyGenericError } from "./helpers/errors";
|
|
4
|
-
export { MocodyUtil } from "./helpers/mocody-utils";
|
|
5
|
-
export { MocodyInitializerDynamo } from "./dynamo/dynamo-initializer";
|
|
6
|
-
export { DynamoDataOperation } from "./dynamo/dynamo-data-operation";
|
|
7
|
-
export { MocodyInitializerCouch } from "./couch/couch-initializer";
|
|
8
|
-
export { CouchDataOperation } from "./couch/couch-data-operation";
|
|
9
|
-
export { MocodyInitializerMongo } from "./mongo/mongo-initializer";
|
|
10
|
-
export { MongoDataOperation } from "./mongo/mongo-data-operation";
|
|
11
|
-
export { MocodyInitializerPouch } from "./pouch/pouch-initializer";
|
|
12
|
-
export { PouchDataOperation } from "./pouch/pouch-data-operation";
|
|
1
|
+
export type { IMocodyQueryIndexOptions, IMocodyIndexDefinition, IMocodyFieldCondition, IMocodyKeyConditionParams, IMocodyPagingParams, IMocodyQueryConditionParams, IMocodyPagingResult, IMocodyQueryDefinition, IMocodyQueryIndexOptionsNoPaging, } from "./type";
|
|
2
|
+
export { IMocodyCoreEntityModel } from "./core/base-schema";
|
|
3
|
+
export { MocodyGenericError } from "./helpers/errors";
|
|
4
|
+
export { MocodyUtil } from "./helpers/mocody-utils";
|
|
5
|
+
export { MocodyInitializerDynamo } from "./dynamo/dynamo-initializer";
|
|
6
|
+
export { DynamoDataOperation } from "./dynamo/dynamo-data-operation";
|
|
7
|
+
export { MocodyInitializerCouch } from "./couch/couch-initializer";
|
|
8
|
+
export { CouchDataOperation } from "./couch/couch-data-operation";
|
|
9
|
+
export { MocodyInitializerMongo } from "./mongo/mongo-initializer";
|
|
10
|
+
export { MongoDataOperation } from "./mongo/mongo-data-operation";
|
|
11
|
+
export { MocodyInitializerPouch } from "./pouch/pouch-initializer";
|
|
12
|
+
export { PouchDataOperation } from "./pouch/pouch-data-operation";
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PouchDataOperation = exports.MocodyInitializerPouch = exports.MongoDataOperation = exports.MocodyInitializerMongo = exports.CouchDataOperation = exports.MocodyInitializerCouch = exports.DynamoDataOperation = exports.MocodyInitializerDynamo = exports.MocodyUtil = exports.MocodyGenericError = void 0;
|
|
4
|
-
var errors_1 = require("./helpers/errors");
|
|
5
|
-
Object.defineProperty(exports, "MocodyGenericError", { enumerable: true, get: function () { return errors_1.MocodyGenericError; } });
|
|
6
|
-
var mocody_utils_1 = require("./helpers/mocody-utils");
|
|
7
|
-
Object.defineProperty(exports, "MocodyUtil", { enumerable: true, get: function () { return mocody_utils_1.MocodyUtil; } });
|
|
8
|
-
var dynamo_initializer_1 = require("./dynamo/dynamo-initializer");
|
|
9
|
-
Object.defineProperty(exports, "MocodyInitializerDynamo", { enumerable: true, get: function () { return dynamo_initializer_1.MocodyInitializerDynamo; } });
|
|
10
|
-
var dynamo_data_operation_1 = require("./dynamo/dynamo-data-operation");
|
|
11
|
-
Object.defineProperty(exports, "DynamoDataOperation", { enumerable: true, get: function () { return dynamo_data_operation_1.DynamoDataOperation; } });
|
|
12
|
-
var couch_initializer_1 = require("./couch/couch-initializer");
|
|
13
|
-
Object.defineProperty(exports, "MocodyInitializerCouch", { enumerable: true, get: function () { return couch_initializer_1.MocodyInitializerCouch; } });
|
|
14
|
-
var couch_data_operation_1 = require("./couch/couch-data-operation");
|
|
15
|
-
Object.defineProperty(exports, "CouchDataOperation", { enumerable: true, get: function () { return couch_data_operation_1.CouchDataOperation; } });
|
|
16
|
-
var mongo_initializer_1 = require("./mongo/mongo-initializer");
|
|
17
|
-
Object.defineProperty(exports, "MocodyInitializerMongo", { enumerable: true, get: function () { return mongo_initializer_1.MocodyInitializerMongo; } });
|
|
18
|
-
var mongo_data_operation_1 = require("./mongo/mongo-data-operation");
|
|
19
|
-
Object.defineProperty(exports, "MongoDataOperation", { enumerable: true, get: function () { return mongo_data_operation_1.MongoDataOperation; } });
|
|
20
|
-
var pouch_initializer_1 = require("./pouch/pouch-initializer");
|
|
21
|
-
Object.defineProperty(exports, "MocodyInitializerPouch", { enumerable: true, get: function () { return pouch_initializer_1.MocodyInitializerPouch; } });
|
|
22
|
-
var pouch_data_operation_1 = require("./pouch/pouch-data-operation");
|
|
23
|
-
Object.defineProperty(exports, "PouchDataOperation", { enumerable: true, get: function () { return pouch_data_operation_1.PouchDataOperation; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PouchDataOperation = exports.MocodyInitializerPouch = exports.MongoDataOperation = exports.MocodyInitializerMongo = exports.CouchDataOperation = exports.MocodyInitializerCouch = exports.DynamoDataOperation = exports.MocodyInitializerDynamo = exports.MocodyUtil = exports.MocodyGenericError = void 0;
|
|
4
|
+
var errors_1 = require("./helpers/errors");
|
|
5
|
+
Object.defineProperty(exports, "MocodyGenericError", { enumerable: true, get: function () { return errors_1.MocodyGenericError; } });
|
|
6
|
+
var mocody_utils_1 = require("./helpers/mocody-utils");
|
|
7
|
+
Object.defineProperty(exports, "MocodyUtil", { enumerable: true, get: function () { return mocody_utils_1.MocodyUtil; } });
|
|
8
|
+
var dynamo_initializer_1 = require("./dynamo/dynamo-initializer");
|
|
9
|
+
Object.defineProperty(exports, "MocodyInitializerDynamo", { enumerable: true, get: function () { return dynamo_initializer_1.MocodyInitializerDynamo; } });
|
|
10
|
+
var dynamo_data_operation_1 = require("./dynamo/dynamo-data-operation");
|
|
11
|
+
Object.defineProperty(exports, "DynamoDataOperation", { enumerable: true, get: function () { return dynamo_data_operation_1.DynamoDataOperation; } });
|
|
12
|
+
var couch_initializer_1 = require("./couch/couch-initializer");
|
|
13
|
+
Object.defineProperty(exports, "MocodyInitializerCouch", { enumerable: true, get: function () { return couch_initializer_1.MocodyInitializerCouch; } });
|
|
14
|
+
var couch_data_operation_1 = require("./couch/couch-data-operation");
|
|
15
|
+
Object.defineProperty(exports, "CouchDataOperation", { enumerable: true, get: function () { return couch_data_operation_1.CouchDataOperation; } });
|
|
16
|
+
var mongo_initializer_1 = require("./mongo/mongo-initializer");
|
|
17
|
+
Object.defineProperty(exports, "MocodyInitializerMongo", { enumerable: true, get: function () { return mongo_initializer_1.MocodyInitializerMongo; } });
|
|
18
|
+
var mongo_data_operation_1 = require("./mongo/mongo-data-operation");
|
|
19
|
+
Object.defineProperty(exports, "MongoDataOperation", { enumerable: true, get: function () { return mongo_data_operation_1.MongoDataOperation; } });
|
|
20
|
+
var pouch_initializer_1 = require("./pouch/pouch-initializer");
|
|
21
|
+
Object.defineProperty(exports, "MocodyInitializerPouch", { enumerable: true, get: function () { return pouch_initializer_1.MocodyInitializerPouch; } });
|
|
22
|
+
var pouch_data_operation_1 = require("./pouch/pouch-data-operation");
|
|
23
|
+
Object.defineProperty(exports, "PouchDataOperation", { enumerable: true, get: function () { return pouch_data_operation_1.PouchDataOperation; } });
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/dist/model/index.d.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import type { IMocodyFieldCondition, IMocodyPagingResult, IMocodyQueryIndexOptions, IMocodyPreparedTransaction, IMocodyTransactionPrepare } from "../type";
|
|
2
|
-
export declare abstract class RepoModel<T> {
|
|
3
|
-
abstract mocody_getOneById({ dataId, withCondition, }: {
|
|
4
|
-
dataId: string;
|
|
5
|
-
withCondition?: IMocodyFieldCondition<T> | null;
|
|
6
|
-
}): Promise<T | null>;
|
|
7
|
-
abstract mocody_getManyByIds({ dataIds, fields, withCondition, }: {
|
|
8
|
-
dataIds: string[];
|
|
9
|
-
fields?: (keyof T)[] | undefined | null;
|
|
10
|
-
withCondition?: IMocodyFieldCondition<T> | undefined | null;
|
|
11
|
-
}): Promise<T[]>;
|
|
12
|
-
abstract mocody_createOne({ data, fieldAliases, }: {
|
|
13
|
-
data: T;
|
|
14
|
-
fieldAliases?: [keyof T, keyof T][] | undefined | null;
|
|
15
|
-
}): Promise<T>;
|
|
16
|
-
abstract mocody_prepareTransaction({ transactPrepareInfo, }: {
|
|
17
|
-
transactPrepareInfo: IMocodyTransactionPrepare<T>[];
|
|
18
|
-
}): Promise<IMocodyPreparedTransaction[]>;
|
|
19
|
-
abstract mocody_executeTransaction({ transactInfo }: {
|
|
20
|
-
transactInfo: IMocodyPreparedTransaction[];
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
abstract mocody_formatForDump({ dataList }: {
|
|
23
|
-
dataList: T[];
|
|
24
|
-
}): Promise<string[]>;
|
|
25
|
-
abstract mocody_validateFormatData({ data }: {
|
|
26
|
-
data: T;
|
|
27
|
-
}): Promise<string>;
|
|
28
|
-
abstract mocody_updateOne({ dataId, updateData, withCondition, fieldAliases, }: {
|
|
29
|
-
dataId: string;
|
|
30
|
-
updateData: Partial<T>;
|
|
31
|
-
withCondition?: IMocodyFieldCondition<T> | null;
|
|
32
|
-
fieldAliases?: [keyof T, keyof T][] | undefined | null;
|
|
33
|
-
}): Promise<T>;
|
|
34
|
-
abstract mocody_getManyByIndex<TData = T, TSortKeyField extends string | number = string>(paramOption: Omit<IMocodyQueryIndexOptions<TData, TSortKeyField>, "pagingParams">): Promise<TData[]>;
|
|
35
|
-
abstract mocody_getManyByIndexPaginate<TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TData, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
|
|
36
|
-
abstract mocody_deleteById({ dataId, withCondition, }: {
|
|
37
|
-
dataId: string;
|
|
38
|
-
withCondition?: IMocodyFieldCondition<T> | null;
|
|
39
|
-
}): Promise<T>;
|
|
40
|
-
abstract mocody_getManyWithRelation<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: Omit<IMocodyQueryIndexOptions<TQuery, TSortKeyField>, "pagingParams">): Promise<TData[]>;
|
|
41
|
-
abstract mocody_getManyWithRelationPaginate<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TQuery, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
|
|
42
|
-
}
|
|
1
|
+
import type { IMocodyFieldCondition, IMocodyPagingResult, IMocodyQueryIndexOptions, IMocodyPreparedTransaction, IMocodyTransactionPrepare } from "../type";
|
|
2
|
+
export declare abstract class RepoModel<T> {
|
|
3
|
+
abstract mocody_getOneById({ dataId, withCondition, }: {
|
|
4
|
+
dataId: string;
|
|
5
|
+
withCondition?: IMocodyFieldCondition<T> | null;
|
|
6
|
+
}): Promise<T | null>;
|
|
7
|
+
abstract mocody_getManyByIds({ dataIds, fields, withCondition, }: {
|
|
8
|
+
dataIds: string[];
|
|
9
|
+
fields?: (keyof T)[] | undefined | null;
|
|
10
|
+
withCondition?: IMocodyFieldCondition<T> | undefined | null;
|
|
11
|
+
}): Promise<T[]>;
|
|
12
|
+
abstract mocody_createOne({ data, fieldAliases, }: {
|
|
13
|
+
data: T;
|
|
14
|
+
fieldAliases?: [keyof T, keyof T][] | undefined | null;
|
|
15
|
+
}): Promise<T>;
|
|
16
|
+
abstract mocody_prepareTransaction({ transactPrepareInfo, }: {
|
|
17
|
+
transactPrepareInfo: IMocodyTransactionPrepare<T>[];
|
|
18
|
+
}): Promise<IMocodyPreparedTransaction[]>;
|
|
19
|
+
abstract mocody_executeTransaction({ transactInfo }: {
|
|
20
|
+
transactInfo: IMocodyPreparedTransaction[];
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
abstract mocody_formatForDump({ dataList }: {
|
|
23
|
+
dataList: T[];
|
|
24
|
+
}): Promise<string[]>;
|
|
25
|
+
abstract mocody_validateFormatData({ data }: {
|
|
26
|
+
data: T;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
abstract mocody_updateOne({ dataId, updateData, withCondition, fieldAliases, }: {
|
|
29
|
+
dataId: string;
|
|
30
|
+
updateData: Partial<T>;
|
|
31
|
+
withCondition?: IMocodyFieldCondition<T> | null;
|
|
32
|
+
fieldAliases?: [keyof T, keyof T][] | undefined | null;
|
|
33
|
+
}): Promise<T>;
|
|
34
|
+
abstract mocody_getManyByIndex<TData = T, TSortKeyField extends string | number = string>(paramOption: Omit<IMocodyQueryIndexOptions<TData, TSortKeyField>, "pagingParams">): Promise<TData[]>;
|
|
35
|
+
abstract mocody_getManyByIndexPaginate<TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TData, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
|
|
36
|
+
abstract mocody_deleteById({ dataId, withCondition, }: {
|
|
37
|
+
dataId: string;
|
|
38
|
+
withCondition?: IMocodyFieldCondition<T> | null;
|
|
39
|
+
}): Promise<T>;
|
|
40
|
+
abstract mocody_getManyWithRelation<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: Omit<IMocodyQueryIndexOptions<TQuery, TSortKeyField>, "pagingParams">): Promise<TData[]>;
|
|
41
|
+
abstract mocody_getManyWithRelationPaginate<TQuery = T, TData = T, TSortKeyField extends string | number = string>(paramOption: IMocodyQueryIndexOptions<TQuery, TSortKeyField>): Promise<IMocodyPagingResult<TData[]>>;
|
|
42
|
+
}
|
package/dist/model/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RepoModel = void 0;
|
|
4
|
-
class RepoModel {
|
|
5
|
-
}
|
|
6
|
-
exports.RepoModel = RepoModel;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RepoModel = void 0;
|
|
4
|
+
class RepoModel {
|
|
5
|
+
}
|
|
6
|
+
exports.RepoModel = RepoModel;
|
|
7
7
|
//# sourceMappingURL=index.js.map
|