@builder6/steedos 0.10.4
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/steedos/index.d.ts +3 -0
- package/dist/steedos/index.js +20 -0
- package/dist/steedos/index.js.map +1 -0
- package/dist/steedos/mongodb.controller.d.ts +15 -0
- package/dist/steedos/mongodb.controller.js +474 -0
- package/dist/steedos/mongodb.controller.js.map +1 -0
- package/dist/steedos/object.service.d.ts +6 -0
- package/dist/steedos/object.service.js +34 -0
- package/dist/steedos/object.service.js.map +1 -0
- package/dist/steedos/object.service.spec.d.ts +1 -0
- package/dist/steedos/object.service.spec.js +17 -0
- package/dist/steedos/object.service.spec.js.map +1 -0
- package/dist/steedos/steedos.module.d.ts +2 -0
- package/dist/steedos/steedos.module.js +25 -0
- package/dist/steedos/steedos.module.js.map +1 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Builder6 Steedos Module
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './steedos';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./steedos"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mongodb.controller"), exports);
|
|
18
|
+
__exportStar(require("./object.service"), exports);
|
|
19
|
+
__exportStar(require("./steedos.module"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/steedos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,mDAAiC;AACjC,mDAAiC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MongodbService } from '@builder6/core';
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
export declare class MongodbController {
|
|
4
|
+
private readonly mongodbService;
|
|
5
|
+
constructor(mongodbService: MongodbService);
|
|
6
|
+
create(objectName: string, record: object, req: Request, res: Response): Promise<void>;
|
|
7
|
+
find(objectName: string, req: Request, res: Response, fields?: any, filters?: any, sort?: any, skip?: number, top?: number): Promise<void>;
|
|
8
|
+
findOne(res: Response, objectName: string, id: string): Promise<Response<any, Record<string, any>>>;
|
|
9
|
+
findOneByField(res: Response, objectName: string, fieldName: string, fieldValue: string): Promise<Response<any, Record<string, any>>>;
|
|
10
|
+
update(objectName: string, id: string, body: any, req: Request, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
11
|
+
updateByField(objectName: string, fieldName: string, fieldValue: string, body: any, req: Request, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
12
|
+
updateMultiple(objectName: string, records: object[], performUpsert: boolean, req: Request, res: Response): Promise<void>;
|
|
13
|
+
remove(objectName: string, id: string, res: Response): Promise<Response<any, Record<string, any>>>;
|
|
14
|
+
deleteMultiple(objectName: string, records: [string], res: Response): Promise<Response<any, Record<string, any>>>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.MongodbController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const core_1 = require("@builder6/core");
|
|
18
|
+
const query_mongodb_1 = require("@builder6/query-mongodb");
|
|
19
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
20
|
+
let MongodbController = class MongodbController {
|
|
21
|
+
constructor(mongodbService) {
|
|
22
|
+
this.mongodbService = mongodbService;
|
|
23
|
+
}
|
|
24
|
+
async create(objectName, record, req, res) {
|
|
25
|
+
const user = req['user'];
|
|
26
|
+
try {
|
|
27
|
+
const result = await this.mongodbService.insertOne(objectName, {
|
|
28
|
+
...record,
|
|
29
|
+
owner: user._id,
|
|
30
|
+
created_by: user._id,
|
|
31
|
+
created: new Date(),
|
|
32
|
+
modified_by: user._id,
|
|
33
|
+
modified: new Date(),
|
|
34
|
+
space: user.space,
|
|
35
|
+
});
|
|
36
|
+
res.status(200).send(result);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.error('Query error', error);
|
|
40
|
+
res.status(500).send({
|
|
41
|
+
error: {
|
|
42
|
+
code: 500,
|
|
43
|
+
message: error.message,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async find(objectName, req, res, fields, filters, sort, skip = 0, top = 20) {
|
|
49
|
+
try {
|
|
50
|
+
const options = (0, query_mongodb_1.getOptions)(req.query, {
|
|
51
|
+
areaKM2: 'int',
|
|
52
|
+
population: 'int',
|
|
53
|
+
});
|
|
54
|
+
const loadOptions = { take: top, skip: skip, ...options.loadOptions };
|
|
55
|
+
if (filters) {
|
|
56
|
+
try {
|
|
57
|
+
loadOptions.filter = JSON.parse(filters);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
throw new Error('filters 参数格式错误,不是有效的json字符串');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (sort) {
|
|
64
|
+
const sortFields = sort.split(',');
|
|
65
|
+
loadOptions.sort = sortFields.map((sortField) => {
|
|
66
|
+
const [field, dir] = sortField.split(' ');
|
|
67
|
+
return { selector: field, desc: dir === 'desc' };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (fields) {
|
|
71
|
+
try {
|
|
72
|
+
loadOptions.select = JSON.parse(fields);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
loadOptions.select = fields.split(',');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const processingOptions = {
|
|
79
|
+
replaceIds: false,
|
|
80
|
+
...options.processingOptions,
|
|
81
|
+
};
|
|
82
|
+
const results = await this.mongodbService.objectqlFind(objectName, loadOptions, processingOptions);
|
|
83
|
+
res.status(200).send(results);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error('Query error', error);
|
|
87
|
+
res.status(500).send({
|
|
88
|
+
error: {
|
|
89
|
+
code: 500,
|
|
90
|
+
message: error.message,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async findOne(res, objectName, id) {
|
|
96
|
+
try {
|
|
97
|
+
const result = await this.mongodbService.findOne(objectName, {
|
|
98
|
+
_id: id,
|
|
99
|
+
});
|
|
100
|
+
if (!result) {
|
|
101
|
+
return res.status(404).send();
|
|
102
|
+
}
|
|
103
|
+
res.status(200).send(result);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.error('Query error', error);
|
|
107
|
+
res.status(500).send({
|
|
108
|
+
error: {
|
|
109
|
+
code: 500,
|
|
110
|
+
message: error.message,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async findOneByField(res, objectName, fieldName, fieldValue) {
|
|
116
|
+
try {
|
|
117
|
+
const result = await this.mongodbService.findOne(objectName, {
|
|
118
|
+
[fieldName]: fieldValue,
|
|
119
|
+
});
|
|
120
|
+
if (!result) {
|
|
121
|
+
return res.status(404).send();
|
|
122
|
+
}
|
|
123
|
+
res.status(200).send(result);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error('Query error', error);
|
|
127
|
+
res.status(500).send({
|
|
128
|
+
error: {
|
|
129
|
+
code: 500,
|
|
130
|
+
message: error.message,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async update(objectName, id, body, req, res) {
|
|
136
|
+
try {
|
|
137
|
+
const result = await this.mongodbService.findOneAndUpdate(objectName, { _id: id }, {
|
|
138
|
+
...body,
|
|
139
|
+
modified_by: req['user']._id,
|
|
140
|
+
modified: new Date(),
|
|
141
|
+
});
|
|
142
|
+
if (!result) {
|
|
143
|
+
return res.status(404).send();
|
|
144
|
+
}
|
|
145
|
+
res.status(200).send(result);
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.error('Query error', error);
|
|
149
|
+
res.status(500).send({
|
|
150
|
+
error: {
|
|
151
|
+
code: 500,
|
|
152
|
+
message: error.message,
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async updateByField(objectName, fieldName, fieldValue, body, req, res) {
|
|
158
|
+
try {
|
|
159
|
+
const result = await this.mongodbService.findOneAndUpdate(objectName, { [fieldName]: fieldValue }, {
|
|
160
|
+
...body,
|
|
161
|
+
modified_by: req['user']._id,
|
|
162
|
+
modified: new Date(),
|
|
163
|
+
});
|
|
164
|
+
if (!result) {
|
|
165
|
+
return res.status(404).send();
|
|
166
|
+
}
|
|
167
|
+
res.status(200).send(result);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
console.error('Query error', error);
|
|
171
|
+
res.status(500).send({
|
|
172
|
+
error: {
|
|
173
|
+
code: 500,
|
|
174
|
+
message: error.message,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async updateMultiple(objectName, records, performUpsert, req, res) {
|
|
180
|
+
try {
|
|
181
|
+
if (performUpsert) {
|
|
182
|
+
const createdRecords = [];
|
|
183
|
+
const updatedRecords = [];
|
|
184
|
+
const resultRecords = [];
|
|
185
|
+
for (const record of records) {
|
|
186
|
+
const { _id, ...rest } = record;
|
|
187
|
+
if (_id) {
|
|
188
|
+
const result = await this.mongodbService.findOneAndUpdate(objectName, { _id }, {
|
|
189
|
+
...rest,
|
|
190
|
+
modified_by: req['user']._id,
|
|
191
|
+
modified: new Date(),
|
|
192
|
+
});
|
|
193
|
+
if (!result) {
|
|
194
|
+
throw new Error(`Record not found ${_id}`);
|
|
195
|
+
}
|
|
196
|
+
updatedRecords.push(result._id);
|
|
197
|
+
resultRecords.push(result);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
const result = await this.mongodbService.insertOne(objectName, {
|
|
201
|
+
...rest,
|
|
202
|
+
created_by: req['user']._id,
|
|
203
|
+
created: new Date(),
|
|
204
|
+
modified_by: req['user']._id,
|
|
205
|
+
modified: new Date(),
|
|
206
|
+
});
|
|
207
|
+
createdRecords.push(result._id);
|
|
208
|
+
resultRecords.push(result);
|
|
209
|
+
}
|
|
210
|
+
res.status(200).send({
|
|
211
|
+
createdRecords,
|
|
212
|
+
updatedRecords,
|
|
213
|
+
records: resultRecords,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
const resultRecords = [];
|
|
219
|
+
for (const record of records) {
|
|
220
|
+
const { _id, ...rest } = record;
|
|
221
|
+
if (!_id) {
|
|
222
|
+
throw new Error(`_id is required`);
|
|
223
|
+
}
|
|
224
|
+
if (_id) {
|
|
225
|
+
const result = await this.mongodbService.findOneAndUpdate(objectName, { _id }, {
|
|
226
|
+
...rest,
|
|
227
|
+
modified_by: req['user']._id,
|
|
228
|
+
modified: new Date(),
|
|
229
|
+
});
|
|
230
|
+
if (!result) {
|
|
231
|
+
throw new Error(`Record not found ${_id}`);
|
|
232
|
+
}
|
|
233
|
+
resultRecords.push(result);
|
|
234
|
+
}
|
|
235
|
+
res.status(200).send({
|
|
236
|
+
records: resultRecords,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
console.error('Update error', error);
|
|
243
|
+
res.status(500).send({
|
|
244
|
+
error: {
|
|
245
|
+
code: 500,
|
|
246
|
+
message: error.message,
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async remove(objectName, id, res) {
|
|
252
|
+
try {
|
|
253
|
+
const result = await this.mongodbService.deleteOne(objectName, {
|
|
254
|
+
_id: id,
|
|
255
|
+
});
|
|
256
|
+
if (result.deletedCount === 0) {
|
|
257
|
+
return res.status(404).send();
|
|
258
|
+
}
|
|
259
|
+
res.status(200).send({ deleted: true, _id: id });
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
console.error('Query error', error);
|
|
263
|
+
res.status(500).send(error);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async deleteMultiple(objectName, records, res) {
|
|
267
|
+
try {
|
|
268
|
+
const result = await this.mongodbService.deleteMany(objectName, {
|
|
269
|
+
_id: { $in: records },
|
|
270
|
+
});
|
|
271
|
+
if (result.deletedCount === 0) {
|
|
272
|
+
return res.status(404).send();
|
|
273
|
+
}
|
|
274
|
+
res
|
|
275
|
+
.status(200)
|
|
276
|
+
.send({ records: records.map((_id) => ({ deleted: true, _id })) });
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
console.error('Query error', error);
|
|
280
|
+
res.status(500).send({
|
|
281
|
+
error: {
|
|
282
|
+
code: 500,
|
|
283
|
+
message: error.message,
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
__decorate([
|
|
290
|
+
(0, common_1.Post)(':objectName'),
|
|
291
|
+
(0, swagger_1.ApiOperation)({ summary: 'Create a record' }),
|
|
292
|
+
(0, swagger_1.ApiBody)({
|
|
293
|
+
schema: {
|
|
294
|
+
type: 'object',
|
|
295
|
+
},
|
|
296
|
+
}),
|
|
297
|
+
__param(0, (0, common_1.Param)('objectName')),
|
|
298
|
+
__param(1, (0, common_1.Body)()),
|
|
299
|
+
__param(2, (0, common_1.Req)()),
|
|
300
|
+
__param(3, (0, common_1.Res)()),
|
|
301
|
+
__metadata("design:type", Function),
|
|
302
|
+
__metadata("design:paramtypes", [String, Object, Object, Object]),
|
|
303
|
+
__metadata("design:returntype", Promise)
|
|
304
|
+
], MongodbController.prototype, "create", null);
|
|
305
|
+
__decorate([
|
|
306
|
+
(0, common_1.Get)(':objectName'),
|
|
307
|
+
(0, swagger_1.ApiOperation)({ summary: 'List records' }),
|
|
308
|
+
(0, swagger_1.ApiQuery)({
|
|
309
|
+
name: 'fields',
|
|
310
|
+
required: false,
|
|
311
|
+
description: '查询的字段,示例:name,created',
|
|
312
|
+
}),
|
|
313
|
+
(0, swagger_1.ApiQuery)({
|
|
314
|
+
name: 'filters',
|
|
315
|
+
required: false,
|
|
316
|
+
description: '过滤条件,示例:["age", ">", 10]',
|
|
317
|
+
}),
|
|
318
|
+
(0, swagger_1.ApiQuery)({
|
|
319
|
+
name: 'sort',
|
|
320
|
+
required: false,
|
|
321
|
+
description: '排序,示例:created desc',
|
|
322
|
+
}),
|
|
323
|
+
(0, swagger_1.ApiQuery)({
|
|
324
|
+
name: 'skip',
|
|
325
|
+
required: false,
|
|
326
|
+
description: '跳过记录数',
|
|
327
|
+
schema: { default: 0 },
|
|
328
|
+
}),
|
|
329
|
+
(0, swagger_1.ApiQuery)({
|
|
330
|
+
name: 'top',
|
|
331
|
+
required: false,
|
|
332
|
+
description: '每页记录数,默认20',
|
|
333
|
+
schema: { default: 20 },
|
|
334
|
+
}),
|
|
335
|
+
__param(0, (0, common_1.Param)('objectName')),
|
|
336
|
+
__param(1, (0, common_1.Req)()),
|
|
337
|
+
__param(2, (0, common_1.Res)()),
|
|
338
|
+
__param(3, (0, common_1.Query)('fields')),
|
|
339
|
+
__param(4, (0, common_1.Query)('filters')),
|
|
340
|
+
__param(5, (0, common_1.Query)('sort')),
|
|
341
|
+
__param(6, (0, common_1.Query)('skip', new common_1.ParseIntPipe())),
|
|
342
|
+
__param(7, (0, common_1.Query)('top', new common_1.ParseIntPipe())),
|
|
343
|
+
__metadata("design:type", Function),
|
|
344
|
+
__metadata("design:paramtypes", [String, Object, Object, Object, Object, Object, Number, Number]),
|
|
345
|
+
__metadata("design:returntype", Promise)
|
|
346
|
+
], MongodbController.prototype, "find", null);
|
|
347
|
+
__decorate([
|
|
348
|
+
(0, common_1.Get)(':objectName/:id'),
|
|
349
|
+
(0, swagger_1.ApiOperation)({ summary: 'Get record' }),
|
|
350
|
+
__param(0, (0, common_1.Res)()),
|
|
351
|
+
__param(1, (0, common_1.Param)('objectName')),
|
|
352
|
+
__param(2, (0, common_1.Param)('id')),
|
|
353
|
+
__metadata("design:type", Function),
|
|
354
|
+
__metadata("design:paramtypes", [Object, String, String]),
|
|
355
|
+
__metadata("design:returntype", Promise)
|
|
356
|
+
], MongodbController.prototype, "findOne", null);
|
|
357
|
+
__decorate([
|
|
358
|
+
(0, common_1.Get)(':objectName/:fieldName/:fieldValue'),
|
|
359
|
+
(0, swagger_1.ApiOperation)({ summary: 'Get a Record Using an External ID' }),
|
|
360
|
+
__param(0, (0, common_1.Res)()),
|
|
361
|
+
__param(1, (0, common_1.Param)('objectName')),
|
|
362
|
+
__param(2, (0, common_1.Param)('fieldName')),
|
|
363
|
+
__param(3, (0, common_1.Param)('fieldValue')),
|
|
364
|
+
__metadata("design:type", Function),
|
|
365
|
+
__metadata("design:paramtypes", [Object, String, String, String]),
|
|
366
|
+
__metadata("design:returntype", Promise)
|
|
367
|
+
], MongodbController.prototype, "findOneByField", null);
|
|
368
|
+
__decorate([
|
|
369
|
+
(0, common_1.Patch)(':objectName/:id'),
|
|
370
|
+
(0, swagger_1.ApiOperation)({ summary: 'Update record' }),
|
|
371
|
+
(0, swagger_1.ApiBody)({
|
|
372
|
+
schema: {
|
|
373
|
+
type: 'object',
|
|
374
|
+
},
|
|
375
|
+
}),
|
|
376
|
+
__param(0, (0, common_1.Param)('objectName')),
|
|
377
|
+
__param(1, (0, common_1.Param)('id')),
|
|
378
|
+
__param(2, (0, common_1.Body)()),
|
|
379
|
+
__param(3, (0, common_1.Req)()),
|
|
380
|
+
__param(4, (0, common_1.Res)()),
|
|
381
|
+
__metadata("design:type", Function),
|
|
382
|
+
__metadata("design:paramtypes", [String, String, Object, Object, Object]),
|
|
383
|
+
__metadata("design:returntype", Promise)
|
|
384
|
+
], MongodbController.prototype, "update", null);
|
|
385
|
+
__decorate([
|
|
386
|
+
(0, common_1.Patch)(':objectName/:fieldName/:fieldValue'),
|
|
387
|
+
(0, swagger_1.ApiOperation)({
|
|
388
|
+
summary: 'Update a Record Using an External ID',
|
|
389
|
+
}),
|
|
390
|
+
(0, swagger_1.ApiBody)({
|
|
391
|
+
schema: {
|
|
392
|
+
type: 'object',
|
|
393
|
+
},
|
|
394
|
+
}),
|
|
395
|
+
__param(0, (0, common_1.Param)('objectName')),
|
|
396
|
+
__param(1, (0, common_1.Param)('fieldName')),
|
|
397
|
+
__param(2, (0, common_1.Param)('fieldValue')),
|
|
398
|
+
__param(3, (0, common_1.Body)()),
|
|
399
|
+
__param(4, (0, common_1.Req)()),
|
|
400
|
+
__param(5, (0, common_1.Res)()),
|
|
401
|
+
__metadata("design:type", Function),
|
|
402
|
+
__metadata("design:paramtypes", [String, String, String, Object, Object, Object]),
|
|
403
|
+
__metadata("design:returntype", Promise)
|
|
404
|
+
], MongodbController.prototype, "updateByField", null);
|
|
405
|
+
__decorate([
|
|
406
|
+
(0, common_1.Patch)(':objectName'),
|
|
407
|
+
(0, swagger_1.ApiOperation)({ summary: 'Update multiple records' }),
|
|
408
|
+
(0, swagger_1.ApiBody)({
|
|
409
|
+
schema: {
|
|
410
|
+
type: 'object',
|
|
411
|
+
properties: {
|
|
412
|
+
records: {
|
|
413
|
+
type: 'array',
|
|
414
|
+
items: {
|
|
415
|
+
type: 'object',
|
|
416
|
+
properties: {
|
|
417
|
+
_id: { type: 'string', example: 'rec560UJdUtocSouk' },
|
|
418
|
+
},
|
|
419
|
+
required: ['_id'],
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
}),
|
|
425
|
+
__param(0, (0, common_1.Param)('objectName')),
|
|
426
|
+
__param(1, (0, common_1.Body)('records')),
|
|
427
|
+
__param(2, (0, common_1.Body)('performUpsert')),
|
|
428
|
+
__param(3, (0, common_1.Req)()),
|
|
429
|
+
__param(4, (0, common_1.Res)()),
|
|
430
|
+
__metadata("design:type", Function),
|
|
431
|
+
__metadata("design:paramtypes", [String, Array, Boolean, Object, Object]),
|
|
432
|
+
__metadata("design:returntype", Promise)
|
|
433
|
+
], MongodbController.prototype, "updateMultiple", null);
|
|
434
|
+
__decorate([
|
|
435
|
+
(0, common_1.Delete)(':objectName/:id'),
|
|
436
|
+
(0, swagger_1.ApiOperation)({ summary: 'Delete record' }),
|
|
437
|
+
__param(0, (0, common_1.Param)('objectName')),
|
|
438
|
+
__param(1, (0, common_1.Param)('id')),
|
|
439
|
+
__param(2, (0, common_1.Res)()),
|
|
440
|
+
__metadata("design:type", Function),
|
|
441
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
442
|
+
__metadata("design:returntype", Promise)
|
|
443
|
+
], MongodbController.prototype, "remove", null);
|
|
444
|
+
__decorate([
|
|
445
|
+
(0, common_1.Delete)(':objectName'),
|
|
446
|
+
(0, swagger_1.ApiOperation)({ summary: 'Delete multiple records' }),
|
|
447
|
+
(0, swagger_1.ApiBody)({
|
|
448
|
+
schema: {
|
|
449
|
+
type: 'object',
|
|
450
|
+
properties: {
|
|
451
|
+
records: {
|
|
452
|
+
type: 'array',
|
|
453
|
+
items: {
|
|
454
|
+
type: 'string',
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
}),
|
|
460
|
+
__param(0, (0, common_1.Param)('objectName')),
|
|
461
|
+
__param(1, (0, common_1.Body)('records')),
|
|
462
|
+
__param(2, (0, common_1.Res)()),
|
|
463
|
+
__metadata("design:type", Function),
|
|
464
|
+
__metadata("design:paramtypes", [String, Array, Object]),
|
|
465
|
+
__metadata("design:returntype", Promise)
|
|
466
|
+
], MongodbController.prototype, "deleteMultiple", null);
|
|
467
|
+
MongodbController = __decorate([
|
|
468
|
+
(0, common_1.Controller)('api/v6/direct'),
|
|
469
|
+
(0, common_1.UseGuards)(core_1.AdminGuard),
|
|
470
|
+
(0, swagger_1.ApiBearerAuth)(),
|
|
471
|
+
__metadata("design:paramtypes", [core_1.MongodbService])
|
|
472
|
+
], MongodbController);
|
|
473
|
+
exports.MongodbController = MongodbController;
|
|
474
|
+
//# sourceMappingURL=mongodb.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongodb.controller.js","sourceRoot":"","sources":["../../src/steedos/mongodb.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAawB;AACxB,yCAA4D;AAE5D,2DAAqD;AACrD,6CAKyB;AAMlB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IASzD,AAAN,KAAK,CAAC,MAAM,CACW,UAAkB,EAC/B,MAAc,EACf,GAAY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;iBACF;aACF;SACF;KACF,CAAC;IAEC,WAAA,IAAA,cAAK,EAAC,YAAY,CAAC,CAAA;IACnB,WAAA,IAAA,aAAI,EAAC,SAAS,CAAC,CAAA;IACf,WAAA,IAAA,YAAG,GAAE,CAAA;;;;uDAqBP;AA/bU,iBAAiB;IAH7B,IAAA,mBAAU,EAAC,eAAe,CAAC;IAC3B,IAAA,kBAAS,EAAC,iBAAU,CAAC;IACrB,IAAA,uBAAa,GAAE;qCAE+B,qBAAc;GADhD,iBAAiB,CAgc7B;AAhcY,8CAAiB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ObjectService = void 0;
|
|
13
|
+
const core_1 = require("@builder6/core");
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
let ObjectService = class ObjectService {
|
|
16
|
+
constructor(mongodbService) {
|
|
17
|
+
this.mongodbService = mongodbService;
|
|
18
|
+
}
|
|
19
|
+
async getObject(objectName) {
|
|
20
|
+
const object = await this.mongodbService.findOne('objects', {
|
|
21
|
+
name: objectName,
|
|
22
|
+
});
|
|
23
|
+
if (object) {
|
|
24
|
+
object.fields = await this.mongodbService.find('object_fields', { filter: ['object', '=', objectName] }, {});
|
|
25
|
+
}
|
|
26
|
+
return object;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
ObjectService = __decorate([
|
|
30
|
+
(0, common_1.Injectable)(),
|
|
31
|
+
__metadata("design:paramtypes", [core_1.MongodbService])
|
|
32
|
+
], ObjectService);
|
|
33
|
+
exports.ObjectService = ObjectService;
|
|
34
|
+
//# sourceMappingURL=object.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.service.js","sourceRoot":"","sources":["../../src/steedos/object.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAgD;AAChD,2CAA4C;AAGrC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAE/D,KAAK,CAAC,SAAS,CAAC,UAAkB;QAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE;YAC1D,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;QACH,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAC5C,eAAe,EACf,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,EACvC,EAAE,CACH,CAAC;SACH;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAhBY,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAEkC,qBAAc;GADhD,aAAa,CAgBzB;AAhBY,sCAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
|
4
|
+
const object_service_1 = require("./object.service");
|
|
5
|
+
describe('ObjectService', () => {
|
|
6
|
+
let service;
|
|
7
|
+
beforeEach(async () => {
|
|
8
|
+
const module = await testing_1.Test.createTestingModule({
|
|
9
|
+
providers: [object_service_1.ObjectService],
|
|
10
|
+
}).compile();
|
|
11
|
+
service = module.get(object_service_1.ObjectService);
|
|
12
|
+
});
|
|
13
|
+
it('should be defined', () => {
|
|
14
|
+
expect(service).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=object.service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.service.spec.js","sourceRoot":"","sources":["../../src/steedos/object.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,qDAAiD;AAEjD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,OAAsB,CAAC;IAE3B,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE,CAAC,8BAAa,CAAC;SAC3B,CAAC,CAAC,OAAO,EAAE,CAAC;QAEb,OAAO,GAAG,MAAM,CAAC,GAAG,CAAgB,8BAAa,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SteedosModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const mongodb_controller_1 = require("./mongodb.controller");
|
|
12
|
+
const core_1 = require("@builder6/core");
|
|
13
|
+
const core_2 = require("@builder6/core");
|
|
14
|
+
const object_service_1 = require("./object.service");
|
|
15
|
+
let SteedosModule = class SteedosModule {
|
|
16
|
+
};
|
|
17
|
+
SteedosModule = __decorate([
|
|
18
|
+
(0, common_1.Module)({
|
|
19
|
+
imports: [core_2.AuthModule, core_1.MongodbModule],
|
|
20
|
+
controllers: [mongodb_controller_1.MongodbController],
|
|
21
|
+
providers: [object_service_1.ObjectService],
|
|
22
|
+
})
|
|
23
|
+
], SteedosModule);
|
|
24
|
+
exports.SteedosModule = SteedosModule;
|
|
25
|
+
//# sourceMappingURL=steedos.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steedos.module.js","sourceRoot":"","sources":["../../src/steedos/steedos.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6DAAyD;AACzD,yCAA+C;AAC/C,yCAA4C;AAC5C,qDAAiD;AAO1C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,aAAa;IALzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,iBAAU,EAAE,oBAAa,CAAC;QACpC,WAAW,EAAE,CAAC,sCAAiB,CAAC;QAChC,SAAS,EAAE,CAAC,8BAAa,CAAC;KAC3B,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa"}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@builder6/steedos",
|
|
3
|
+
"version": "0.10.4",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
11
|
+
"build": "rimraf dist && tsc",
|
|
12
|
+
"build:watch": "rimraf dist && tsc --watch"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@builder6/core": "^0.10.4",
|
|
16
|
+
"nodemailer": "^6.9.16"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"gitHead": "3386dc54fc488034f40ee1005cbcb00180e3737a"
|
|
22
|
+
}
|