mocody 0.4.8 → 0.4.10
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/couch/couch-manage-table.js +1 -0
- package/dist/couch/couch-manage-table.js.map +1 -1
- package/dist/dynamo/dynamo-data-operation.d.ts +3 -3
- package/dist/helpers/util-service.js +2 -2
- package/dist/helpers/util-service.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/model/index.d.ts +2 -2
- package/dist/pouch/pouch-data-operation.d.ts +97 -0
- package/dist/pouch/pouch-data-operation.js +617 -0
- package/dist/pouch/pouch-data-operation.js.map +1 -0
- package/dist/pouch/pouch-filter-query-operation.d.ts +47 -0
- package/dist/pouch/pouch-filter-query-operation.js +439 -0
- package/dist/pouch/pouch-filter-query-operation.js.map +1 -0
- package/dist/pouch/pouch-initializer.d.ts +103 -0
- package/dist/pouch/pouch-initializer.js +265 -0
- package/dist/pouch/pouch-initializer.js.map +1 -0
- package/dist/pouch/pouch-manage-table.d.ts +47 -0
- package/dist/pouch/pouch-manage-table.js +117 -0
- package/dist/pouch/pouch-manage-table.js.map +1 -0
- package/package.json +21 -21
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MocodyInitializerPouch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const nano_1 = tslib_1.__importDefault(require("nano"));
|
|
6
|
+
const throat_1 = tslib_1.__importDefault(require("throat"));
|
|
7
|
+
const pouchdb_1 = tslib_1.__importDefault(require("pouchdb"));
|
|
8
|
+
const pouchdb_adapter_node_websql_1 = tslib_1.__importDefault(require("pouchdb-adapter-node-websql"));
|
|
9
|
+
const logging_service_1 = require("../helpers/logging-service");
|
|
10
|
+
const errors_1 = require("../helpers/errors");
|
|
11
|
+
const util_service_1 = require("../helpers/util-service");
|
|
12
|
+
const concurrency = (0, throat_1.default)(1);
|
|
13
|
+
class MocodyInitializerPouch {
|
|
14
|
+
constructor({ pouchConfig }) {
|
|
15
|
+
Object.defineProperty(this, "_databaseInstance", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(this, "_pouchInstance", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: void 0
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(this, "_documentScope", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(this, "pouchConfig", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: void 0
|
|
38
|
+
});
|
|
39
|
+
this.pouchConfig = pouchConfig;
|
|
40
|
+
}
|
|
41
|
+
async deleteIndex({ databaseName, ddoc, name }) {
|
|
42
|
+
const path = ["_index", ddoc, "json", name].join("/");
|
|
43
|
+
const instance = await this.getInstance();
|
|
44
|
+
const result = await instance.relax({
|
|
45
|
+
db: databaseName,
|
|
46
|
+
method: "DELETE",
|
|
47
|
+
path,
|
|
48
|
+
content_type: "application/json",
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
async getIndexes(databaseName) {
|
|
53
|
+
const instance = await this.getInstance();
|
|
54
|
+
const result = await instance.request({
|
|
55
|
+
db: databaseName,
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: "_index",
|
|
58
|
+
content_type: "application/json",
|
|
59
|
+
});
|
|
60
|
+
logging_service_1.LoggingService.log({ indexes: result });
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
async getDocInstance(databaseName) {
|
|
64
|
+
if (!this._documentScope) {
|
|
65
|
+
const n = await this.getInstance();
|
|
66
|
+
const db = n.db.use(databaseName);
|
|
67
|
+
this._documentScope = db;
|
|
68
|
+
}
|
|
69
|
+
return this._documentScope;
|
|
70
|
+
}
|
|
71
|
+
async checkDatabaseExists(databaseName) {
|
|
72
|
+
const instance = await this.getInstance();
|
|
73
|
+
const checkDbExistResult = await instance.relax({
|
|
74
|
+
db: databaseName,
|
|
75
|
+
method: "HEAD",
|
|
76
|
+
content_type: "application/json",
|
|
77
|
+
});
|
|
78
|
+
logging_service_1.LoggingService.log(JSON.stringify({ checkDbExistResult }, null, 2));
|
|
79
|
+
return checkDbExistResult;
|
|
80
|
+
}
|
|
81
|
+
async createDatabase(databaseName) {
|
|
82
|
+
const instance = await this.getInstance();
|
|
83
|
+
return await instance.db.create(databaseName, { partitioned: true });
|
|
84
|
+
}
|
|
85
|
+
async getById({ databaseName, nativeId }) {
|
|
86
|
+
if (this.isLocalFirst()) {
|
|
87
|
+
return await this.pouch_getById({ nativeId });
|
|
88
|
+
}
|
|
89
|
+
const db01 = await this.getDocInstance(databaseName);
|
|
90
|
+
return await db01.get(nativeId);
|
|
91
|
+
}
|
|
92
|
+
async pouch_getById({ nativeId }) {
|
|
93
|
+
const db01 = await this.pouch_getDbInstance();
|
|
94
|
+
return await db01.get(nativeId);
|
|
95
|
+
}
|
|
96
|
+
async getManyByIds({ databaseName, nativeIds }) {
|
|
97
|
+
if (this.isLocalFirst()) {
|
|
98
|
+
return await this.pouch_getManyByIds({ nativeIds });
|
|
99
|
+
}
|
|
100
|
+
const db01 = await this.getDocInstance(databaseName);
|
|
101
|
+
const dataList = await db01.list({
|
|
102
|
+
keys: nativeIds,
|
|
103
|
+
include_docs: true,
|
|
104
|
+
});
|
|
105
|
+
return dataList;
|
|
106
|
+
}
|
|
107
|
+
async pouch_getManyByIds({ nativeIds }) {
|
|
108
|
+
const db01 = await this.pouch_getDbInstance();
|
|
109
|
+
const dataList = await db01.allDocs({
|
|
110
|
+
keys: nativeIds,
|
|
111
|
+
include_docs: true,
|
|
112
|
+
});
|
|
113
|
+
return dataList;
|
|
114
|
+
}
|
|
115
|
+
async createDoc({ databaseName, validatedData }) {
|
|
116
|
+
if (this.isLocalFirst()) {
|
|
117
|
+
return await this.pouch_createDoc({ validatedData });
|
|
118
|
+
}
|
|
119
|
+
const db01 = await this.getDocInstance(databaseName);
|
|
120
|
+
return await db01.insert(validatedData);
|
|
121
|
+
}
|
|
122
|
+
async pouch_createDoc({ validatedData }) {
|
|
123
|
+
const db01 = await this.pouch_getDbInstance();
|
|
124
|
+
return await db01.put(validatedData);
|
|
125
|
+
}
|
|
126
|
+
async updateDoc({ databaseName, docRev, validatedData, }) {
|
|
127
|
+
if (this.isLocalFirst()) {
|
|
128
|
+
return await this.pouch_updateDoc({ validatedData, docRev });
|
|
129
|
+
}
|
|
130
|
+
const db01 = await this.getDocInstance(databaseName);
|
|
131
|
+
return await db01.insert({ ...validatedData, _rev: docRev });
|
|
132
|
+
}
|
|
133
|
+
async pouch_updateDoc({ docRev, validatedData }) {
|
|
134
|
+
const db01 = await this.pouch_getDbInstance();
|
|
135
|
+
return await db01.put({ ...validatedData, _rev: docRev });
|
|
136
|
+
}
|
|
137
|
+
async getList({ databaseName, featureEntity, size, skip, }) {
|
|
138
|
+
if (this.isLocalFirst()) {
|
|
139
|
+
return await this.pouch_getList({
|
|
140
|
+
featureEntity,
|
|
141
|
+
size,
|
|
142
|
+
skip,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const db01 = await this.getDocInstance(databaseName);
|
|
146
|
+
const data = await db01.list({
|
|
147
|
+
include_docs: true,
|
|
148
|
+
startkey: featureEntity,
|
|
149
|
+
endkey: `${featureEntity}\ufff0`,
|
|
150
|
+
inclusive_end: true,
|
|
151
|
+
limit: size ?? undefined,
|
|
152
|
+
skip: skip ?? undefined,
|
|
153
|
+
});
|
|
154
|
+
return data;
|
|
155
|
+
}
|
|
156
|
+
async pouch_getList({ featureEntity, size, skip, }) {
|
|
157
|
+
const db01 = await this.pouch_getDbInstance();
|
|
158
|
+
const data = await db01.allDocs({
|
|
159
|
+
include_docs: true,
|
|
160
|
+
startkey: featureEntity,
|
|
161
|
+
endkey: `${featureEntity}\ufff0`,
|
|
162
|
+
inclusive_end: true,
|
|
163
|
+
limit: size ?? undefined,
|
|
164
|
+
skip: skip ?? undefined,
|
|
165
|
+
});
|
|
166
|
+
return data;
|
|
167
|
+
}
|
|
168
|
+
async findPartitionedDocs({ featureEntity, databaseName, selector, fields, use_index, sort, limit, skip, }) {
|
|
169
|
+
if (this.isLocalFirst()) {
|
|
170
|
+
return await this.pouch_findPartitionedDocs({
|
|
171
|
+
featureEntity,
|
|
172
|
+
databaseName,
|
|
173
|
+
selector,
|
|
174
|
+
fields,
|
|
175
|
+
use_index,
|
|
176
|
+
sort,
|
|
177
|
+
limit,
|
|
178
|
+
skip,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const db01 = await this.getDocInstance(databaseName);
|
|
182
|
+
return await db01.partitionedFind(featureEntity, {
|
|
183
|
+
selector: { ...selector },
|
|
184
|
+
fields,
|
|
185
|
+
use_index,
|
|
186
|
+
sort: sort?.length ? sort : undefined,
|
|
187
|
+
limit,
|
|
188
|
+
skip,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async pouch_findPartitionedDocs({ databaseName, featureEntity, selector, fields, use_index, sort, limit, skip, }) {
|
|
192
|
+
const db01 = await this.pouch_getDbInstance();
|
|
193
|
+
return await db01.find({
|
|
194
|
+
selector: { ...selector },
|
|
195
|
+
fields,
|
|
196
|
+
use_index,
|
|
197
|
+
sort: sort?.length ? sort : undefined,
|
|
198
|
+
limit,
|
|
199
|
+
skip,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
async deleteById({ databaseName, docRev, nativeId }) {
|
|
203
|
+
const db01 = await this.getDocInstance(databaseName);
|
|
204
|
+
return await db01.destroy(nativeId, docRev);
|
|
205
|
+
}
|
|
206
|
+
async getInstance() {
|
|
207
|
+
return await concurrency(() => this.getInstanceBase());
|
|
208
|
+
}
|
|
209
|
+
async getInstanceBase() {
|
|
210
|
+
if (this.pouchConfig?.configType !== "REMOTE_FIRST") {
|
|
211
|
+
throw new errors_1.MocodyGenericError("Remote database uri not defined");
|
|
212
|
+
}
|
|
213
|
+
const { couchDbUri } = this.pouchConfig;
|
|
214
|
+
if (!couchDbUri) {
|
|
215
|
+
throw new errors_1.MocodyGenericError("Remote database uri not defined");
|
|
216
|
+
}
|
|
217
|
+
if (!this._databaseInstance) {
|
|
218
|
+
this._databaseInstance = (0, nano_1.default)(couchDbUri);
|
|
219
|
+
}
|
|
220
|
+
return await Promise.resolve(this._databaseInstance);
|
|
221
|
+
}
|
|
222
|
+
async pouch_getDbInstance() {
|
|
223
|
+
return await concurrency(() => this.pouch_getDbInstanceBase());
|
|
224
|
+
}
|
|
225
|
+
isLocalFirst() {
|
|
226
|
+
return this.pouchConfig?.configType === "LOCAL_FIRST";
|
|
227
|
+
}
|
|
228
|
+
async pouch_getDbInstanceBase() {
|
|
229
|
+
if (this.pouchConfig?.configType !== "LOCAL_FIRST") {
|
|
230
|
+
throw new errors_1.MocodyGenericError("LOCAL_FIRST not configured");
|
|
231
|
+
}
|
|
232
|
+
if (!this._pouchInstance) {
|
|
233
|
+
const { sqliteDbFilePath, couchDbSyncUri, liveSync } = this.pouchConfig;
|
|
234
|
+
if (!sqliteDbFilePath) {
|
|
235
|
+
throw new errors_1.MocodyGenericError("sqliteDbFilePath not defined");
|
|
236
|
+
}
|
|
237
|
+
pouchdb_1.default.plugin(pouchdb_adapter_node_websql_1.default);
|
|
238
|
+
this._pouchInstance = new pouchdb_1.default(sqliteDbFilePath, { adapter: "websql" });
|
|
239
|
+
if (couchDbSyncUri) {
|
|
240
|
+
if (liveSync) {
|
|
241
|
+
this._pouchInstance
|
|
242
|
+
.sync(couchDbSyncUri, {
|
|
243
|
+
live: true,
|
|
244
|
+
retry: true,
|
|
245
|
+
})
|
|
246
|
+
.on("change", (change) => {
|
|
247
|
+
logging_service_1.LoggingService.log({ replication_change: change });
|
|
248
|
+
})
|
|
249
|
+
.on("paused", (info) => {
|
|
250
|
+
logging_service_1.LoggingService.log({ replication_info: info });
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
this._pouchInstance.sync(couchDbSyncUri).on("error", (err) => {
|
|
255
|
+
logging_service_1.LoggingService.log({ replication_error: err });
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
await util_service_1.UtilService.waitUntilMilliseconds(800);
|
|
260
|
+
}
|
|
261
|
+
return await Promise.resolve(this._pouchInstance);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.MocodyInitializerPouch = MocodyInitializerPouch;
|
|
265
|
+
//# sourceMappingURL=pouch-initializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pouch-initializer.js","sourceRoot":"","sources":["../../src/pouch/pouch-initializer.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AACxB,4DAA4B;AAC5B,8DAA8B;AAC9B,sGAAqD;AAErD,gEAA4D;AAE5D,8CAAuD;AACvD,0DAAsD;AAEtD,MAAM,WAAW,GAAG,IAAA,gBAAM,EAAC,CAAC,CAAC,CAAC;AAkC9B,MAAa,sBAAsB;IAOjC,YAAY,EAAE,WAAW,EAAY;QANrC;;;;;WAAoD;QACpD;;;;;WAAgE;QAChE;;;;;WAAwD;QAExD;;;;;WAAsD;QAGpD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAwD;QAElG,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WA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,8BAA8B,CAAC,CAAC;aAC9D;YAED,iBAAO,CAAC,MAAM,CAAC,qCAAU,CAAC,CAAC;YAE3B,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAO,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;YAE3E,IAAI,cAAc,EAAE;gBAClB,IAAI,QAAQ,EAAE;oBACZ,IAAI,CAAC,cAAc;yBAChB,IAAI,CAAC,cAAc,EAAE;wBACpB,IAAI,EAAE,IAAI;wBACV,KAAK,EAAE,IAAI;qBACZ,CAAC;yBACD,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;wBAEvB,gCAAc,CAAC,GAAG,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;oBACrD,CAAC,CAAC;yBACD,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;wBAErB,gCAAc,CAAC,GAAG,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;oBACjD,CAAC,CAAC,CAAC;iBACN;qBAAM;oBACL,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;wBAE3D,gCAAc,CAAC,GAAG,CAAC,EAAE,iBAAiB,EAAE,GAAG,EAAE,CAAC,CAAC;oBACjD,CAAC,CAAC,CAAC;iBACJ;aACF;YACD,MAAM,0BAAW,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;SAC9C;QACD,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,cAA+C,CAAC,CAAC;IACrF,CAAC;CACF;AApUD,wDAoUC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IMocodyIndexDefinition } from "../type";
|
|
2
|
+
import type { MocodyInitializerPouch } from "./pouch-initializer";
|
|
3
|
+
interface ITableOptions<T> {
|
|
4
|
+
pouchDb: () => MocodyInitializerPouch;
|
|
5
|
+
secondaryIndexOptions: IMocodyIndexDefinition<T>[];
|
|
6
|
+
tableFullName: string;
|
|
7
|
+
partitionKeyFieldName: string;
|
|
8
|
+
sortKeyFieldName: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class PouchManageTable<T> {
|
|
11
|
+
private readonly partitionKeyFieldName;
|
|
12
|
+
private readonly sortKeyFieldName;
|
|
13
|
+
private readonly pouchDb;
|
|
14
|
+
private readonly tableFullName;
|
|
15
|
+
private readonly secondaryIndexOptions;
|
|
16
|
+
constructor({ pouchDb, secondaryIndexOptions, tableFullName, partitionKeyFieldName, sortKeyFieldName, }: ITableOptions<T>);
|
|
17
|
+
private _trickLinter;
|
|
18
|
+
private _mocody_getInstance;
|
|
19
|
+
mocody_createIndex({ databaseName, indexName, fields, }: {
|
|
20
|
+
databaseName: string;
|
|
21
|
+
indexName: string;
|
|
22
|
+
fields: string[];
|
|
23
|
+
}): Promise<{
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
result: string;
|
|
27
|
+
}>;
|
|
28
|
+
mocody_clearAllIndexes(databaseName: string): Promise<{
|
|
29
|
+
deletedIndexes: any[];
|
|
30
|
+
}>;
|
|
31
|
+
mocody_getIndexes(databaseName: string): Promise<{
|
|
32
|
+
indexes: {
|
|
33
|
+
ddoc: string;
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
def: {
|
|
37
|
+
fields: {
|
|
38
|
+
[field: string]: "asc" | "desc";
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
41
|
+
}[];
|
|
42
|
+
total_rows: number;
|
|
43
|
+
}>;
|
|
44
|
+
mocody_createDatabase(databaseName: string): Promise<import("nano").DatabaseCreateResponse>;
|
|
45
|
+
mocody_createDefinedIndexes(databaseName: string): Promise<string[]>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PouchManageTable = void 0;
|
|
4
|
+
const logging_service_1 = require("../helpers/logging-service");
|
|
5
|
+
class PouchManageTable {
|
|
6
|
+
constructor({ pouchDb, 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, "pouchDb", {
|
|
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.pouchDb = pouchDb;
|
|
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.pouchDb();
|
|
50
|
+
}
|
|
51
|
+
async mocody_createIndex({ databaseName, indexName, fields, }) {
|
|
52
|
+
const instance = await this._mocody_getInstance().getDocInstance(databaseName);
|
|
53
|
+
const result = await instance.createIndex({
|
|
54
|
+
index: {
|
|
55
|
+
fields: fields,
|
|
56
|
+
},
|
|
57
|
+
name: indexName,
|
|
58
|
+
ddoc: indexName,
|
|
59
|
+
type: "json",
|
|
60
|
+
partitioned: true,
|
|
61
|
+
});
|
|
62
|
+
logging_service_1.LoggingService.log(result);
|
|
63
|
+
return {
|
|
64
|
+
id: result.id,
|
|
65
|
+
name: result.name,
|
|
66
|
+
result: result.result,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async mocody_clearAllIndexes(databaseName) {
|
|
70
|
+
const indexes = await this._mocody_getInstance().getIndexes(databaseName);
|
|
71
|
+
logging_service_1.LoggingService.log({ indexes });
|
|
72
|
+
if (indexes?.indexes?.length) {
|
|
73
|
+
const deletedIndexes = [];
|
|
74
|
+
for (const index of indexes.indexes) {
|
|
75
|
+
if (index?.type !== "special") {
|
|
76
|
+
deletedIndexes.push(index);
|
|
77
|
+
await this._mocody_getInstance().deleteIndex({
|
|
78
|
+
databaseName,
|
|
79
|
+
ddoc: index.ddoc,
|
|
80
|
+
name: index.name,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
deletedIndexes,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
deletedIndexes: [],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async mocody_getIndexes(databaseName) {
|
|
93
|
+
return await this._mocody_getInstance().getIndexes(databaseName);
|
|
94
|
+
}
|
|
95
|
+
async mocody_createDatabase(databaseName) {
|
|
96
|
+
return await this._mocody_getInstance().createDatabase(databaseName);
|
|
97
|
+
}
|
|
98
|
+
async mocody_createDefinedIndexes(databaseName) {
|
|
99
|
+
const results = [];
|
|
100
|
+
if (this.secondaryIndexOptions?.length) {
|
|
101
|
+
for (const indexOption of this.secondaryIndexOptions) {
|
|
102
|
+
if (indexOption?.indexName) {
|
|
103
|
+
const resultData = await this.mocody_createIndex({
|
|
104
|
+
databaseName,
|
|
105
|
+
fields: [indexOption.partitionKeyFieldName, indexOption.sortKeyFieldName],
|
|
106
|
+
indexName: indexOption.indexName,
|
|
107
|
+
});
|
|
108
|
+
logging_service_1.LoggingService.log(resultData);
|
|
109
|
+
results.push(resultData.result);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return results;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.PouchManageTable = PouchManageTable;
|
|
117
|
+
//# sourceMappingURL=pouch-manage-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pouch-manage-table.js","sourceRoot":"","sources":["../../src/pouch/pouch-manage-table.ts"],"names":[],"mappings":";;;AAAA,gEAA4D;AAY5D,MAAa,gBAAgB;IAO3B,YAAY,EACV,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,gBAAgB,GACC;QAZnB;;;;;WAA+C;QAC/C;;;;;WAA0C;QAC1C;;;;;WAAuD;QACvD;;;;;WAAuC;QACvC;;;;;WAAoE;QASlE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAEO,YAAY;QAClB,IAAI,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,aAAa,EAAE;SAE9E;IACH,CAAC;IAEO,mBAAmB;QACzB,OAAO,IAAI,CAAC,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AAc;aACf,CAAC;SACH;QACD,OAAO;YACL,cAAc,EAAE,EAAE;SACnB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,YAAoB;QAC1C,OAAO,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,YAAoB;QAC9C,OAAO,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,YAAoB;QACpD,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,qBAAqB,EAAE,MAAM,EAAE;YACtC,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,qBAAqB,EAAE;gBACpD,IAAI,WAAW,EAAE,SAAS,EAAE;oBAC1B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC;wBAC/C,YAAY;wBACZ,MAAM,EAAE,CAAC,WAAW,CAAC,qBAAqB,EAAE,WAAW,CAAC,gBAAgB,CAAU;wBAClF,SAAS,EAAE,WAAW,CAAC,SAAS;qBACjC,CAAC,CAAC;oBACH,gCAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;oBAC/B,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;iBACjC;aACF;SACF;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA5GD,4CA4GC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mocody",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "Implementation of single table design, and unified query access for MongoDB, CouchDB, and dynamoDB",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"prepare": "npm run build",
|
|
10
10
|
"version": "npm run build",
|
|
11
11
|
"pub": "npm publish",
|
|
12
|
-
"pub01": "npx np",
|
|
13
12
|
"build-dev": "rimraf ./dist && npx tsc -b",
|
|
14
13
|
"eslint": "eslint 'src/**/*.ts'",
|
|
15
14
|
"eslint:fix": "eslint --fix 'src/**/*.ts'",
|
|
@@ -38,33 +37,34 @@
|
|
|
38
37
|
"dist"
|
|
39
38
|
],
|
|
40
39
|
"dependencies": {
|
|
41
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
42
|
-
"@aws-sdk/util-dynamodb": "^3.
|
|
43
|
-
"joi": "^17.7.
|
|
40
|
+
"@aws-sdk/client-dynamodb": "^3.272.0",
|
|
41
|
+
"@aws-sdk/util-dynamodb": "^3.272.0",
|
|
42
|
+
"joi": "^17.7.1",
|
|
44
43
|
"lodash": "^4.17.21",
|
|
45
44
|
"mongodb": "4.12.0",
|
|
46
|
-
"nano": "^10.1.
|
|
45
|
+
"nano": "^10.1.2",
|
|
47
46
|
"nanoid": "^3.3.4",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
47
|
+
"pouchdb": "^8.0.1",
|
|
48
|
+
"pouchdb-adapter-node-websql": "^7.0.0",
|
|
49
|
+
"pouchdb-find": "^8.0.1",
|
|
50
|
+
"throat": "^6.0.2",
|
|
51
|
+
"tslib": "^2.5.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"@types/
|
|
55
|
-
"@types/
|
|
56
|
-
"@
|
|
57
|
-
"@typescript-eslint/
|
|
58
|
-
"eslint": "^
|
|
59
|
-
"eslint
|
|
60
|
-
"eslint-
|
|
54
|
+
"@faker-js/faker": "^7.6.0",
|
|
55
|
+
"@types/lodash": "^4.14.191",
|
|
56
|
+
"@types/node": "^18.13.0",
|
|
57
|
+
"@types/pouchdb": "^6.4.0",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
|
59
|
+
"@typescript-eslint/parser": "^5.52.0",
|
|
60
|
+
"eslint": "^8.34.0",
|
|
61
|
+
"eslint-config-prettier": "^8.6.0",
|
|
62
|
+
"eslint-plugin-import": "^2.27.5",
|
|
61
63
|
"eslint-plugin-node": "^11.1.0",
|
|
62
64
|
"eslint-plugin-prettier": "^4.2.1",
|
|
63
65
|
"eslint-plugin-promise": "^6.1.1",
|
|
64
|
-
"
|
|
65
|
-
"np": "^7.6.2",
|
|
66
|
-
"prettier": "^2.7.1",
|
|
66
|
+
"prettier": "^2.8.4",
|
|
67
67
|
"ts-node": "^10.9.1",
|
|
68
|
-
"typescript": "^4.9.
|
|
68
|
+
"typescript": "^4.9.5"
|
|
69
69
|
}
|
|
70
70
|
}
|