@steedos/objectql 2.1.76 → 2.1.84
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/lib/actions/field_updates.js +15 -15
- package/lib/actions/field_updates.js.map +1 -1
- package/lib/actions/index.js +3 -3
- package/lib/actions/index.js.map +1 -1
- package/lib/actions/workflow_notifications.js +10 -10
- package/lib/actions/workflow_notifications.js.map +1 -1
- package/lib/actions/workflow_rule.js +19 -19
- package/lib/actions/workflow_rule.js.map +1 -1
- package/lib/driver/index.js +1 -0
- package/lib/driver/index.js.map +1 -1
- package/lib/driver/metadata.js +3 -3
- package/lib/driver/metadata.js.map +1 -1
- package/lib/driver/meteorMongo.js +36 -36
- package/lib/driver/meteorMongo.js.map +1 -1
- package/lib/driver/mongo.js +43 -43
- package/lib/driver/mongo.js.map +1 -1
- package/lib/driver/mysql.js +2 -2
- package/lib/driver/mysql.js.map +1 -1
- package/lib/driver/oracle.js +5 -5
- package/lib/driver/oracle.js.map +1 -1
- package/lib/driver/postgres.js +2 -2
- package/lib/driver/postgres.js.map +1 -1
- package/lib/driver/sqlite3.js +2 -2
- package/lib/driver/sqlite3.js.map +1 -1
- package/lib/driver/sqlserver.js +4 -4
- package/lib/driver/sqlserver.js.map +1 -1
- package/lib/dynamic-load/actions.js +22 -18
- package/lib/dynamic-load/actions.js.map +1 -1
- package/lib/dynamic-load/approval_process.js +15 -10
- package/lib/dynamic-load/approval_process.js.map +1 -1
- package/lib/dynamic-load/button.js +25 -18
- package/lib/dynamic-load/button.js.map +1 -1
- package/lib/dynamic-load/chart.js +20 -23
- package/lib/dynamic-load/chart.js.map +1 -1
- package/lib/dynamic-load/field.js +21 -16
- package/lib/dynamic-load/field.js.map +1 -1
- package/lib/dynamic-load/flow_role.js +12 -8
- package/lib/dynamic-load/flow_role.js.map +1 -1
- package/lib/dynamic-load/index.d.ts +1 -0
- package/lib/dynamic-load/index.js +20 -19
- package/lib/dynamic-load/index.js.map +1 -1
- package/lib/dynamic-load/layout.js +19 -14
- package/lib/dynamic-load/layout.js.map +1 -1
- package/lib/dynamic-load/listview.js +14 -11
- package/lib/dynamic-load/listview.js.map +1 -1
- package/lib/dynamic-load/method.js +9 -6
- package/lib/dynamic-load/method.js.map +1 -1
- package/lib/dynamic-load/object_translations.js +29 -51
- package/lib/dynamic-load/object_translations.js.map +1 -1
- package/lib/dynamic-load/originalObject.js +1 -1
- package/lib/dynamic-load/originalObject.js.map +1 -1
- package/lib/dynamic-load/package.d.ts +9 -0
- package/lib/dynamic-load/package.js +507 -0
- package/lib/dynamic-load/package.js.map +1 -0
- package/lib/dynamic-load/page.js +20 -23
- package/lib/dynamic-load/page.js.map +1 -1
- package/lib/dynamic-load/permission.js +61 -65
- package/lib/dynamic-load/permission.js.map +1 -1
- package/lib/dynamic-load/permissionset.js +30 -25
- package/lib/dynamic-load/permissionset.js.map +1 -1
- package/lib/dynamic-load/preload_data.js +55 -74
- package/lib/dynamic-load/preload_data.js.map +1 -1
- package/lib/dynamic-load/profile.js +33 -28
- package/lib/dynamic-load/profile.js.map +1 -1
- package/lib/dynamic-load/query.js +20 -23
- package/lib/dynamic-load/query.js.map +1 -1
- package/lib/dynamic-load/restrictionRules.js +18 -23
- package/lib/dynamic-load/restrictionRules.js.map +1 -1
- package/lib/dynamic-load/role.js +12 -8
- package/lib/dynamic-load/role.js.map +1 -1
- package/lib/dynamic-load/shareRules.js +18 -23
- package/lib/dynamic-load/shareRules.js.map +1 -1
- package/lib/dynamic-load/tab.js +4 -3
- package/lib/dynamic-load/tab.js.map +1 -1
- package/lib/dynamic-load/tabs.js +9 -7
- package/lib/dynamic-load/tabs.js.map +1 -1
- package/lib/dynamic-load/translations.js +23 -17
- package/lib/dynamic-load/translations.js.map +1 -1
- package/lib/dynamic-load/trigger.js +14 -10
- package/lib/dynamic-load/trigger.js.map +1 -1
- package/lib/dynamic-load/validation_rule.js +13 -8
- package/lib/dynamic-load/validation_rule.js.map +1 -1
- package/lib/dynamic-load/workflow.js +38 -25
- package/lib/dynamic-load/workflow.js.map +1 -1
- package/lib/errors/index.js +2 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/formula/core.js +105 -91
- package/lib/formula/core.js.map +1 -1
- package/lib/formula/field_formula.js +26 -20
- package/lib/formula/field_formula.js.map +1 -1
- package/lib/formula/index.js +26 -26
- package/lib/formula/index.js.map +1 -1
- package/lib/formula/params.js +1 -1
- package/lib/formula/params.js.map +1 -1
- package/lib/formula/recompute.js +27 -25
- package/lib/formula/recompute.js.map +1 -1
- package/lib/formula/simple_params.js +2 -2
- package/lib/formula/simple_params.js.map +1 -1
- package/lib/formula/util.js +33 -23
- package/lib/formula/util.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +15 -16
- package/lib/index.js.map +1 -1
- package/lib/metadata-register/_base.d.ts +1 -0
- package/lib/metadata-register/_base.js +45 -15
- package/lib/metadata-register/_base.js.map +1 -1
- package/lib/metadata-register/app.js +8 -8
- package/lib/metadata-register/chart.js +1 -1
- package/lib/metadata-register/chart.js.map +1 -1
- package/lib/metadata-register/index.js +72 -72
- package/lib/metadata-register/index.js.map +1 -1
- package/lib/metadata-register/layout.js +18 -16
- package/lib/metadata-register/layout.js.map +1 -1
- package/lib/metadata-register/object.d.ts +0 -1
- package/lib/metadata-register/object.js +17 -35
- package/lib/metadata-register/object.js.map +1 -1
- package/lib/metadata-register/page.js +1 -1
- package/lib/metadata-register/page.js.map +1 -1
- package/lib/metadata-register/permissionFields.js +2 -2
- package/lib/metadata-register/permissionFields.js.map +1 -1
- package/lib/metadata-register/permissionset.js +6 -6
- package/lib/metadata-register/profile.js +6 -6
- package/lib/metadata-register/query.js +1 -1
- package/lib/metadata-register/query.js.map +1 -1
- package/lib/metadata-register/restrictionRules.js +2 -2
- package/lib/metadata-register/restrictionRules.js.map +1 -1
- package/lib/metadata-register/shareRules.js +2 -2
- package/lib/metadata-register/shareRules.js.map +1 -1
- package/lib/metadata-register/tab.js +1 -1
- package/lib/metadata-register/tab.js.map +1 -1
- package/lib/metadata-register/tabs.js +18 -16
- package/lib/metadata-register/tabs.js.map +1 -1
- package/lib/services/datasourceServiceFactory.d.ts +1 -0
- package/lib/services/datasourceServiceFactory.js +51 -0
- package/lib/services/datasourceServiceFactory.js.map +1 -0
- package/lib/services/helpers/graphql.js +86 -87
- package/lib/services/helpers/graphql.js.map +1 -1
- package/lib/services/helpers/index.js +2 -2
- package/lib/services/helpers/index.js.map +1 -1
- package/lib/services/helpers/rest.js +1 -1
- package/lib/services/helpers/rest.js.map +1 -1
- package/lib/services/index.d.ts +3 -0
- package/lib/services/index.js +10 -4
- package/lib/services/index.js.map +1 -1
- package/lib/services/objectService.d.ts +1 -1
- package/lib/services/objectService.js +148 -147
- package/lib/services/objectService.js.map +1 -1
- package/lib/services/objectServiceDispatcher.js +102 -92
- package/lib/services/objectServiceDispatcher.js.map +1 -1
- package/lib/{metadata-register/objectServiceManager.d.ts → services/objectServiceFactory.d.ts} +0 -0
- package/lib/{metadata-register/objectServiceManager.js → services/objectServiceFactory.js} +5 -5
- package/lib/services/objectServiceFactory.js.map +1 -0
- package/lib/summary/core.js +51 -44
- package/lib/summary/core.js.map +1 -1
- package/lib/summary/field_summary.js +21 -16
- package/lib/summary/field_summary.js.map +1 -1
- package/lib/summary/index.js +25 -22
- package/lib/summary/index.js.map +1 -1
- package/lib/summary/recompute.js +13 -11
- package/lib/summary/recompute.js.map +1 -1
- package/lib/ts-types/index.js +3 -3
- package/lib/ts-types/index.js.map +1 -1
- package/lib/typeorm/driver.js +58 -58
- package/lib/typeorm/driver.js.map +1 -1
- package/lib/typeorm/index.js +2 -1
- package/lib/typeorm/index.js.map +1 -1
- package/lib/typeorm/util.js +2 -2
- package/lib/typeorm/util.js.map +1 -1
- package/lib/types/app.js +41 -35
- package/lib/types/app.js.map +1 -1
- package/lib/types/config.js +52 -45
- package/lib/types/config.js.map +1 -1
- package/lib/types/connection.js +20 -18
- package/lib/types/connection.js.map +1 -1
- package/lib/types/dashboard.js +10 -7
- package/lib/types/dashboard.js.map +1 -1
- package/lib/types/datasource.d.ts +14 -3
- package/lib/types/datasource.js +205 -198
- package/lib/types/datasource.js.map +1 -1
- package/lib/types/field.d.ts +2 -2
- package/lib/types/field.js +6 -6
- package/lib/types/field.js.map +1 -1
- package/lib/types/field_permission.d.ts +1 -0
- package/lib/types/field_permission.js +30 -6
- package/lib/types/field_permission.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +11 -9
- package/lib/types/index.js.map +1 -1
- package/lib/types/list_view.d.ts +1 -1
- package/lib/types/list_view.js +1 -1
- package/lib/types/list_view.js.map +1 -1
- package/lib/types/object.d.ts +17 -13
- package/lib/types/object.js +275 -234
- package/lib/types/object.js.map +1 -1
- package/lib/types/object_dynamic_load.d.ts +1 -0
- package/lib/types/object_dynamic_load.js +129 -164
- package/lib/types/object_dynamic_load.js.map +1 -1
- package/lib/types/object_events.js +5 -5
- package/lib/types/object_events.js.map +1 -1
- package/lib/types/object_layouts.js +7 -7
- package/lib/types/object_layouts.js.map +1 -1
- package/lib/types/object_permission.d.ts +1 -1
- package/lib/types/object_permission.js +1 -1
- package/lib/types/object_permission.js.map +1 -1
- package/lib/types/report.js +10 -7
- package/lib/types/report.js.map +1 -1
- package/lib/types/restrictionRule.js +11 -11
- package/lib/types/restrictionRule.js.map +1 -1
- package/lib/types/schema.d.ts +1 -4
- package/lib/types/schema.js +41 -30
- package/lib/types/schema.js.map +1 -1
- package/lib/types/shareRule.js +11 -11
- package/lib/types/shareRule.js.map +1 -1
- package/lib/types/trigger.js +2 -2
- package/lib/types/trigger.js.map +1 -1
- package/lib/types/validation_rules.js +5 -5
- package/lib/types/validation_rules.js.map +1 -1
- package/lib/util/convert.d.ts +2 -0
- package/lib/util/convert.js +130 -0
- package/lib/util/convert.js.map +1 -0
- package/lib/util/field.js +5 -3
- package/lib/util/field.js.map +1 -1
- package/lib/util/function_expression.js +5 -3
- package/lib/util/function_expression.js.map +1 -1
- package/lib/util/index.d.ts +2 -7
- package/lib/util/index.js +86 -166
- package/lib/util/index.js.map +1 -1
- package/lib/util/locale.js +5 -3
- package/lib/util/locale.js.map +1 -1
- package/lib/util/permission_shares.js +2 -2
- package/lib/util/permission_shares.js.map +1 -1
- package/lib/util/suffix.js +22 -16
- package/lib/util/suffix.js.map +1 -1
- package/lib/util/transform.js +11 -11
- package/lib/util/transform.js.map +1 -1
- package/lib/validators/index.js +3 -2
- package/lib/validators/index.js.map +1 -1
- package/package.json +13 -13
- package/server.js +0 -7
- package/src/dynamic-load/chart.ts +6 -1
- package/src/dynamic-load/index.ts +1 -0
- package/src/dynamic-load/object_translations.ts +19 -10
- package/src/dynamic-load/package.ts +303 -0
- package/src/dynamic-load/page.ts +7 -1
- package/src/dynamic-load/permission.ts +1 -5
- package/src/dynamic-load/preload_data.ts +2 -3
- package/src/dynamic-load/query.ts +6 -1
- package/src/dynamic-load/restrictionRules.ts +6 -2
- package/src/dynamic-load/shareRules.ts +5 -1
- package/src/dynamic-load/translations.ts +3 -1
- package/src/index.ts +0 -1
- package/src/metadata-register/_base.ts +23 -0
- package/src/metadata-register/object.ts +1 -20
- package/src/services/datasourceServiceFactory.ts +37 -0
- package/src/services/helpers/graphql.ts +5 -3
- package/src/services/index.ts +7 -0
- package/src/services/objectService.ts +9 -7
- package/src/services/objectServiceDispatcher.ts +6 -2
- package/src/{metadata-register/objectServiceManager.ts → services/objectServiceFactory.ts} +4 -4
- package/src/types/datasource.ts +81 -80
- package/src/types/field.ts +2 -2
- package/src/types/field_permission.ts +16 -0
- package/src/types/index.ts +1 -0
- package/src/types/list_view.ts +1 -1
- package/src/types/object.ts +71 -37
- package/src/types/object_dynamic_load.ts +14 -48
- package/src/types/object_permission.ts +1 -1
- package/src/types/schema.ts +11 -14
- package/src/util/convert.ts +130 -0
- package/src/util/index.ts +6 -120
- package/lib/graphql/index.d.ts +0 -3
- package/lib/graphql/index.js +0 -374
- package/lib/graphql/index.js.map +0 -1
- package/lib/graphql/utils.d.ts +0 -7
- package/lib/graphql/utils.js +0 -67
- package/lib/graphql/utils.js.map +0 -1
- package/lib/metadata-register/objectServiceManager.js.map +0 -1
- package/src/graphql/index.ts +0 -361
- package/src/graphql/utils.ts +0 -61
package/lib/types/object.js
CHANGED
|
@@ -37,11 +37,11 @@ exports.MAX_MASTER_DETAIL_LEAVE = 3;
|
|
|
37
37
|
[ 'b', 'c', 'd' ]
|
|
38
38
|
* ]
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
var getRepeatObjectNameFromPaths = function (paths) {
|
|
41
41
|
var e_1, _a;
|
|
42
42
|
var repeatItem;
|
|
43
43
|
try {
|
|
44
|
-
for (var paths_1 = tslib_1.__values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
|
|
44
|
+
for (var paths_1 = (0, tslib_1.__values)(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {
|
|
45
45
|
var p = paths_1_1.value;
|
|
46
46
|
if (repeatItem) {
|
|
47
47
|
break;
|
|
@@ -64,6 +64,7 @@ exports.getRepeatObjectNameFromPaths = function (paths) {
|
|
|
64
64
|
}
|
|
65
65
|
return repeatItem;
|
|
66
66
|
};
|
|
67
|
+
exports.getRepeatObjectNameFromPaths = getRepeatObjectNameFromPaths;
|
|
67
68
|
var SteedosObjectProperties = /** @class */ (function () {
|
|
68
69
|
function SteedosObjectProperties() {
|
|
69
70
|
}
|
|
@@ -72,7 +73,7 @@ var SteedosObjectProperties = /** @class */ (function () {
|
|
|
72
73
|
var _TRIGGERKEYS = ['beforeFind', 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterFind', 'afterCount', 'afterFindOne', 'afterInsert', 'afterUpdate', 'afterDelete', 'beforeAggregate', 'afterAggregate'];
|
|
73
74
|
var properties = ['label', 'icon', 'enable_search', 'sidebar', 'is_enable', 'enable_files', 'enable_tasks', 'enable_notes', 'enable_events', 'enable_api', 'enable_share', 'enable_instances', 'enable_chatter', 'enable_audit', 'enable_web_forms', 'enable_inline_edit', 'enable_approvals', 'enable_trash', 'enable_space_global', 'enable_tree', 'parent_field', 'children_field', 'enable_enhanced_lookup', 'enable_workflow', 'is_view', 'hidden', 'description', 'custom', 'owner', 'methods', '_id', 'relatedList', 'fields_serial_number', "is_enable", "in_development", "version"];
|
|
74
75
|
var SteedosObjectType = /** @class */ (function (_super) {
|
|
75
|
-
tslib_1.__extends(SteedosObjectType, _super);
|
|
76
|
+
(0, tslib_1.__extends)(SteedosObjectType, _super);
|
|
76
77
|
function SteedosObjectType(object_name, datasource, config) {
|
|
77
78
|
var _this = _super.call(this) || this;
|
|
78
79
|
_this._fields = {};
|
|
@@ -144,7 +145,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
144
145
|
},
|
|
145
146
|
set: function (value) {
|
|
146
147
|
if (value && !this._datasource.enable_space) {
|
|
147
|
-
throw new Error("not support, please set "
|
|
148
|
+
throw new Error("not support, please set ".concat(this._name, ".enable_audit to false or remove the enable_audit attribute"));
|
|
148
149
|
}
|
|
149
150
|
this._enable_audit = value;
|
|
150
151
|
},
|
|
@@ -157,7 +158,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
157
158
|
},
|
|
158
159
|
set: function (value) {
|
|
159
160
|
if (value && !this._datasource.enable_space) {
|
|
160
|
-
throw new Error("not support, please set "
|
|
161
|
+
throw new Error("not support, please set ".concat(this._name, ".enable_instances to false or remove the enable_instances attribute"));
|
|
161
162
|
}
|
|
162
163
|
this._enable_instances = value;
|
|
163
164
|
},
|
|
@@ -170,7 +171,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
170
171
|
},
|
|
171
172
|
set: function (value) {
|
|
172
173
|
if (value && !this._datasource.enable_space) {
|
|
173
|
-
throw new Error("not support, please set "
|
|
174
|
+
throw new Error("not support, please set ".concat(this._name, ".enable_trash to false or remove the enable_trash attribute"));
|
|
174
175
|
}
|
|
175
176
|
this._enable_trash = value;
|
|
176
177
|
},
|
|
@@ -183,7 +184,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
183
184
|
},
|
|
184
185
|
set: function (value) {
|
|
185
186
|
if (value && !this._datasource.enable_space) {
|
|
186
|
-
throw new Error("not support, please set "
|
|
187
|
+
throw new Error("not support, please set ".concat(this._name, ".enable_share to false or remove the enable_share attribute"));
|
|
187
188
|
}
|
|
188
189
|
this._enable_share = value;
|
|
189
190
|
},
|
|
@@ -229,12 +230,12 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
229
230
|
configurable: true
|
|
230
231
|
});
|
|
231
232
|
SteedosObjectType.prototype.callMetadataObjectServiceAction = function (action, params) {
|
|
232
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
233
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
233
234
|
var actionFullName, result;
|
|
234
|
-
return tslib_1.__generator(this, function (_a) {
|
|
235
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
235
236
|
switch (_a.label) {
|
|
236
237
|
case 0:
|
|
237
|
-
actionFullName = "objects."
|
|
238
|
+
actionFullName = "objects.".concat(action);
|
|
238
239
|
return [4 /*yield*/, this.schema.metadataBroker.call(actionFullName, params)];
|
|
239
240
|
case 1:
|
|
240
241
|
result = _a.sent();
|
|
@@ -248,7 +249,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
248
249
|
var driverSupportedColumnTypes = this._datasource.adapter.getSupportedColumnTypes();
|
|
249
250
|
_.each(this.fields, function (field, key) {
|
|
250
251
|
if (fieldDBType_1.SteedosFieldDBType[field.fieldDBType] && !driverSupportedColumnTypes.includes(field.fieldDBType)) {
|
|
251
|
-
throw new Error("driver "
|
|
252
|
+
throw new Error("driver ".concat(_this._datasource.driver, " can not support field ").concat(key, " config"));
|
|
252
253
|
}
|
|
253
254
|
});
|
|
254
255
|
};
|
|
@@ -264,7 +265,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
264
265
|
_TRIGGERKEYS.forEach(function (key) {
|
|
265
266
|
var event = config[key];
|
|
266
267
|
if (_.isFunction(event)) {
|
|
267
|
-
_this.setTrigger(listener_name
|
|
268
|
+
_this.setTrigger("".concat(listener_name, "_").concat(event.name), key, event);
|
|
268
269
|
}
|
|
269
270
|
});
|
|
270
271
|
};
|
|
@@ -296,10 +297,10 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
296
297
|
delete this._triggersQueue[trigger.when][trigger.name];
|
|
297
298
|
};
|
|
298
299
|
SteedosObjectType.prototype.runTirgger = function (trigger, context) {
|
|
299
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
300
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
300
301
|
var object_name, event, todoWrapper, thisArg;
|
|
301
302
|
var _this = this;
|
|
302
|
-
return tslib_1.__generator(this, function (_a) {
|
|
303
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
303
304
|
switch (_a.label) {
|
|
304
305
|
case 0:
|
|
305
306
|
object_name = this.name;
|
|
@@ -309,8 +310,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
309
310
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
310
311
|
args[_i] = arguments[_i];
|
|
311
312
|
}
|
|
312
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
313
|
-
return tslib_1.__generator(this, function (_a) {
|
|
313
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
314
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
314
315
|
switch (_a.label) {
|
|
315
316
|
case 0: return [4 /*yield*/, event.apply(thisArg, args)];
|
|
316
317
|
case 1:
|
|
@@ -320,7 +321,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
320
321
|
});
|
|
321
322
|
});
|
|
322
323
|
};
|
|
323
|
-
thisArg = tslib_1.__assign(tslib_1.__assign({}, context), { object_name: object_name, datasource_name: this._datasource.name, getObject: function (object_name) {
|
|
324
|
+
thisArg = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, context), { object_name: object_name, datasource_name: this._datasource.name, getObject: function (object_name) {
|
|
324
325
|
return _this._schema.getObject(object_name);
|
|
325
326
|
} });
|
|
326
327
|
return [4 /*yield*/, todoWrapper.call(thisArg)];
|
|
@@ -330,9 +331,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
330
331
|
});
|
|
331
332
|
};
|
|
332
333
|
SteedosObjectType.prototype.runTriggers = function (when, context) {
|
|
333
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
334
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
334
335
|
var triggers, triggerKeys, index, trigger;
|
|
335
|
-
return tslib_1.__generator(this, function (_a) {
|
|
336
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
336
337
|
switch (_a.label) {
|
|
337
338
|
case 0:
|
|
338
339
|
triggers = this._triggersQueue[when];
|
|
@@ -358,10 +359,10 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
358
359
|
});
|
|
359
360
|
};
|
|
360
361
|
SteedosObjectType.prototype.runTriggerActions = function (when, context) {
|
|
361
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
362
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
362
363
|
var triggers, triggers_1, triggers_1_1, trigger, params, e_2_1;
|
|
363
364
|
var e_2, _a;
|
|
364
|
-
return tslib_1.__generator(this, function (_b) {
|
|
365
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
365
366
|
switch (_b.label) {
|
|
366
367
|
case 0: return [4 /*yield*/, this._schema.metadataBroker.call('triggers.filter', { objectApiName: this.name, when: when })];
|
|
367
368
|
case 1:
|
|
@@ -372,13 +373,13 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
372
373
|
_b.label = 2;
|
|
373
374
|
case 2:
|
|
374
375
|
_b.trys.push([2, 7, 8, 9]);
|
|
375
|
-
triggers_1 = tslib_1.__values(triggers), triggers_1_1 = triggers_1.next();
|
|
376
|
+
triggers_1 = (0, tslib_1.__values)(triggers), triggers_1_1 = triggers_1.next();
|
|
376
377
|
_b.label = 3;
|
|
377
378
|
case 3:
|
|
378
379
|
if (!!triggers_1_1.done) return [3 /*break*/, 6];
|
|
379
380
|
trigger = triggers_1_1.value;
|
|
380
|
-
params = util_1.generateActionParams(when, context);
|
|
381
|
-
return [4 /*yield*/, this._schema.metadataBroker.call(trigger.service.name
|
|
381
|
+
params = (0, util_1.generateActionParams)(when, context);
|
|
382
|
+
return [4 /*yield*/, this._schema.metadataBroker.call("".concat(trigger.service.name, ".").concat(trigger.metadata.action), params).catch(function (error) {
|
|
382
383
|
//如果action trigger 下线,则只打印error
|
|
383
384
|
if (error && _.isObject(error) && error.type === 'SERVICE_NOT_AVAILABLE') {
|
|
384
385
|
console.error("runTriggerActions error", error);
|
|
@@ -480,8 +481,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
480
481
|
return this.NAME_FIELD_KEY;
|
|
481
482
|
};
|
|
482
483
|
SteedosObjectType.prototype.getDetailPaths = function () {
|
|
483
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
484
|
-
return tslib_1.__generator(this, function (_a) {
|
|
484
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
485
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
485
486
|
switch (_a.label) {
|
|
486
487
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getDetailPaths", { objectApiName: this.name })];
|
|
487
488
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -490,8 +491,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
490
491
|
});
|
|
491
492
|
};
|
|
492
493
|
SteedosObjectType.prototype.getMasterPaths = function () {
|
|
493
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
494
|
-
return tslib_1.__generator(this, function (_a) {
|
|
494
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
495
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
495
496
|
switch (_a.label) {
|
|
496
497
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getMasterPaths", { objectApiName: this.name })];
|
|
497
498
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -500,8 +501,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
500
501
|
});
|
|
501
502
|
};
|
|
502
503
|
SteedosObjectType.prototype.getMaxDetailsLeave = function (paths) {
|
|
503
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
504
|
-
return tslib_1.__generator(this, function (_a) {
|
|
504
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
505
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
505
506
|
switch (_a.label) {
|
|
506
507
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getMaxDetailsLeave", { objectApiName: this.name, paths: paths })];
|
|
507
508
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -510,8 +511,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
510
511
|
});
|
|
511
512
|
};
|
|
512
513
|
SteedosObjectType.prototype.getMaxMastersLeave = function (paths) {
|
|
513
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
514
|
-
return tslib_1.__generator(this, function (_a) {
|
|
514
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
515
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
515
516
|
switch (_a.label) {
|
|
516
517
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getMaxMastersLeave", { objectApiName: this.name, paths: paths })];
|
|
517
518
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -558,9 +559,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
558
559
|
};
|
|
559
560
|
SteedosObjectType.prototype.refreshIndexes = function () {
|
|
560
561
|
var e_3, _a, e_4, _b;
|
|
561
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
562
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
562
563
|
var adapter, collection, indexesInfo, dropIndexNames, key, field, info, indexesInfo_1, indexesInfo_1_1, indexInfo, key, error_1, e_3_1, error_2, dropIndexNames_1, dropIndexNames_1_1, indexName, error_3, e_4_1, error_4;
|
|
563
|
-
return tslib_1.__generator(this, function (_c) {
|
|
564
|
+
return (0, tslib_1.__generator)(this, function (_c) {
|
|
564
565
|
switch (_c.label) {
|
|
565
566
|
case 0:
|
|
566
567
|
if (!(this.datasource.driver === datasource_1.SteedosDatabaseDriverType.Mongo)) return [3 /*break*/, 37];
|
|
@@ -588,7 +589,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
588
589
|
_c.label = 3;
|
|
589
590
|
case 3:
|
|
590
591
|
_c.trys.push([3, 11, 12, 17]);
|
|
591
|
-
indexesInfo_1 = tslib_1.__asyncValues(indexesInfo);
|
|
592
|
+
indexesInfo_1 = (0, tslib_1.__asyncValues)(indexesInfo);
|
|
592
593
|
_c.label = 4;
|
|
593
594
|
case 4: return [4 /*yield*/, indexesInfo_1.next()];
|
|
594
595
|
case 5:
|
|
@@ -638,7 +639,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
638
639
|
_c.label = 21;
|
|
639
640
|
case 21:
|
|
640
641
|
_c.trys.push([21, 29, 30, 35]);
|
|
641
|
-
dropIndexNames_1 = tslib_1.__asyncValues(dropIndexNames);
|
|
642
|
+
dropIndexNames_1 = (0, tslib_1.__asyncValues)(dropIndexNames);
|
|
642
643
|
_c.label = 22;
|
|
643
644
|
case 22: return [4 /*yield*/, dropIndexNames_1.next()];
|
|
644
645
|
case 23:
|
|
@@ -714,10 +715,10 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
714
715
|
}
|
|
715
716
|
return globalPermission;
|
|
716
717
|
};
|
|
717
|
-
SteedosObjectType.prototype.getUserObjectPermission = function (userSession) {
|
|
718
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
719
|
-
var roles, objectRolesPermission, userObjectPermission,
|
|
720
|
-
return tslib_1.__generator(this, function (_a) {
|
|
718
|
+
SteedosObjectType.prototype.getUserObjectPermission = function (userSession, rolesFieldsPermission) {
|
|
719
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
720
|
+
var roles, objectRolesPermission, userObjectPermission, field_permissions, spaceId;
|
|
721
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
721
722
|
switch (_a.label) {
|
|
722
723
|
case 0:
|
|
723
724
|
if (!userSession) {
|
|
@@ -748,13 +749,18 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
748
749
|
field_permissions: null,
|
|
749
750
|
viewAssignCompanysRecords: [],
|
|
750
751
|
modifyAssignCompanysRecords: [],
|
|
752
|
+
// read_filters: [],
|
|
753
|
+
// edit_filters: []
|
|
751
754
|
};
|
|
752
755
|
if (_.isEmpty(roles)) {
|
|
753
756
|
throw new Error('not find user permission');
|
|
754
757
|
}
|
|
758
|
+
if (!!rolesFieldsPermission) return [3 /*break*/, 2];
|
|
755
759
|
return [4 /*yield*/, field_permission_1.FieldPermission.getObjectFieldsPermissionGroupRole(this.name)];
|
|
756
760
|
case 1:
|
|
757
761
|
rolesFieldsPermission = _a.sent();
|
|
762
|
+
_a.label = 2;
|
|
763
|
+
case 2:
|
|
758
764
|
roles.forEach(function (role) {
|
|
759
765
|
var rolePermission = objectRolesPermission[role];
|
|
760
766
|
if (rolePermission) {
|
|
@@ -788,11 +794,11 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
788
794
|
else if (['viewAssignCompanysRecords', 'modifyAssignCompanysRecords'].indexOf(k) > -1) {
|
|
789
795
|
if ('modifyAssignCompanysRecords' === k) {
|
|
790
796
|
if (!_.isEmpty(_v) && _.isArray(_v)) {
|
|
791
|
-
(_a = userObjectPermission['viewAssignCompanysRecords']).push.apply(_a, tslib_1.
|
|
797
|
+
(_a = userObjectPermission['viewAssignCompanysRecords']).push.apply(_a, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(_v), false));
|
|
792
798
|
}
|
|
793
799
|
}
|
|
794
800
|
if (!_.isEmpty(_v) && _.isArray(_v)) {
|
|
795
|
-
(_b = userObjectPermission[k]).push.apply(_b, tslib_1.
|
|
801
|
+
(_b = userObjectPermission[k]).push.apply(_b, (0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(_v), false));
|
|
796
802
|
}
|
|
797
803
|
}
|
|
798
804
|
else if ((_.isArray(v) || _.isNull(v))) {
|
|
@@ -843,7 +849,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
843
849
|
userObjectPermission.uneditable_fields = userObjectPermission.uneditable_fields || [];
|
|
844
850
|
userObjectPermission.unrelated_objects = userObjectPermission.unrelated_objects || [];
|
|
845
851
|
spaceId = userSession.spaceId;
|
|
846
|
-
if (util_1.isTemplateSpace(spaceId)) {
|
|
852
|
+
if ((0, util_1.isTemplateSpace)(spaceId)) {
|
|
847
853
|
return [2 /*return*/, Object.assign({}, userObjectPermission, { allowRead: true, viewAllRecords: true, viewCompanyRecords: true })];
|
|
848
854
|
}
|
|
849
855
|
return [2 /*return*/, userObjectPermission];
|
|
@@ -852,9 +858,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
852
858
|
});
|
|
853
859
|
};
|
|
854
860
|
SteedosObjectType.prototype.allowFind = function (userSession) {
|
|
855
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
861
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
856
862
|
var userObjectPermission;
|
|
857
|
-
return tslib_1.__generator(this, function (_a) {
|
|
863
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
858
864
|
switch (_a.label) {
|
|
859
865
|
case 0:
|
|
860
866
|
if (!userSession)
|
|
@@ -874,9 +880,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
874
880
|
});
|
|
875
881
|
};
|
|
876
882
|
SteedosObjectType.prototype.allowInsert = function (userSession) {
|
|
877
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
883
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
878
884
|
var userObjectPermission;
|
|
879
|
-
return tslib_1.__generator(this, function (_a) {
|
|
885
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
880
886
|
switch (_a.label) {
|
|
881
887
|
case 0:
|
|
882
888
|
if (!userSession)
|
|
@@ -896,9 +902,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
896
902
|
});
|
|
897
903
|
};
|
|
898
904
|
SteedosObjectType.prototype.allowUpdate = function (userSession) {
|
|
899
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
905
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
900
906
|
var userObjectPermission;
|
|
901
|
-
return tslib_1.__generator(this, function (_a) {
|
|
907
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
902
908
|
switch (_a.label) {
|
|
903
909
|
case 0:
|
|
904
910
|
if (!userSession)
|
|
@@ -918,9 +924,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
918
924
|
});
|
|
919
925
|
};
|
|
920
926
|
SteedosObjectType.prototype.allowDelete = function (userSession) {
|
|
921
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
927
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
922
928
|
var userObjectPermission;
|
|
923
|
-
return tslib_1.__generator(this, function (_a) {
|
|
929
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
924
930
|
switch (_a.label) {
|
|
925
931
|
case 0:
|
|
926
932
|
if (!userSession)
|
|
@@ -940,9 +946,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
940
946
|
});
|
|
941
947
|
};
|
|
942
948
|
SteedosObjectType.prototype.find = function (query, userSession) {
|
|
943
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
949
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
944
950
|
var clonedQuery;
|
|
945
|
-
return tslib_1.__generator(this, function (_a) {
|
|
951
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
946
952
|
switch (_a.label) {
|
|
947
953
|
case 0:
|
|
948
954
|
clonedQuery = Object.assign({}, query);
|
|
@@ -957,9 +963,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
957
963
|
};
|
|
958
964
|
// 此函数支持driver: MeteorMongo
|
|
959
965
|
SteedosObjectType.prototype.aggregate = function (query, externalPipeline, userSession) {
|
|
960
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
966
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
961
967
|
var clonedQuery;
|
|
962
|
-
return tslib_1.__generator(this, function (_a) {
|
|
968
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
963
969
|
switch (_a.label) {
|
|
964
970
|
case 0:
|
|
965
971
|
clonedQuery = Object.assign({}, query);
|
|
@@ -974,9 +980,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
974
980
|
};
|
|
975
981
|
// 此函数支持driver: MeteorMongo
|
|
976
982
|
SteedosObjectType.prototype.directAggregate = function (query, externalPipeline, userSession) {
|
|
977
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
983
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
978
984
|
var clonedQuery;
|
|
979
|
-
return tslib_1.__generator(this, function (_a) {
|
|
985
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
980
986
|
switch (_a.label) {
|
|
981
987
|
case 0:
|
|
982
988
|
clonedQuery = Object.assign({}, query);
|
|
@@ -991,9 +997,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
991
997
|
};
|
|
992
998
|
// 此函数支持driver: MeteorMongo,类似于aggregate,其参数externalPipeline放在最前面而已
|
|
993
999
|
SteedosObjectType.prototype.directAggregatePrefixalPipeline = function (query, prefixalPipeline, userSession) {
|
|
994
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1000
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
995
1001
|
var clonedQuery;
|
|
996
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1002
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
997
1003
|
switch (_a.label) {
|
|
998
1004
|
case 0:
|
|
999
1005
|
clonedQuery = Object.assign({}, query);
|
|
@@ -1007,9 +1013,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1007
1013
|
});
|
|
1008
1014
|
};
|
|
1009
1015
|
SteedosObjectType.prototype.findOne = function (id, query, userSession) {
|
|
1010
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1016
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1011
1017
|
var clonedQuery;
|
|
1012
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1018
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1013
1019
|
switch (_a.label) {
|
|
1014
1020
|
case 0:
|
|
1015
1021
|
clonedQuery = Object.assign({}, query);
|
|
@@ -1023,8 +1029,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1023
1029
|
});
|
|
1024
1030
|
};
|
|
1025
1031
|
SteedosObjectType.prototype.insert = function (doc, userSession) {
|
|
1026
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1027
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1032
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1033
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1028
1034
|
switch (_a.label) {
|
|
1029
1035
|
case 0: return [4 /*yield*/, this.callAdapter('insert', this.table_name, doc, userSession)];
|
|
1030
1036
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1033,9 +1039,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1033
1039
|
});
|
|
1034
1040
|
};
|
|
1035
1041
|
SteedosObjectType.prototype.update = function (id, doc, userSession) {
|
|
1036
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1042
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1037
1043
|
var clonedId;
|
|
1038
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1044
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1039
1045
|
switch (_a.label) {
|
|
1040
1046
|
case 0: return [4 /*yield*/, this.processUneditableFields(userSession, doc)];
|
|
1041
1047
|
case 1:
|
|
@@ -1048,9 +1054,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1048
1054
|
});
|
|
1049
1055
|
};
|
|
1050
1056
|
SteedosObjectType.prototype.updateOne = function (id, doc, userSession) {
|
|
1051
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1057
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1052
1058
|
var clonedId;
|
|
1053
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1059
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1054
1060
|
switch (_a.label) {
|
|
1055
1061
|
case 0: return [4 /*yield*/, this.processUneditableFields(userSession, doc)];
|
|
1056
1062
|
case 1:
|
|
@@ -1064,9 +1070,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1064
1070
|
};
|
|
1065
1071
|
// 此函数支持driver: MeteorMongo、Mongo
|
|
1066
1072
|
SteedosObjectType.prototype.updateMany = function (queryFilters, doc, userSession) {
|
|
1067
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1073
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1068
1074
|
var clonedQueryFilters;
|
|
1069
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1075
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1070
1076
|
switch (_a.label) {
|
|
1071
1077
|
case 0: return [4 /*yield*/, this.processUneditableFields(userSession, doc)];
|
|
1072
1078
|
case 1:
|
|
@@ -1079,9 +1085,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1079
1085
|
});
|
|
1080
1086
|
};
|
|
1081
1087
|
SteedosObjectType.prototype.delete = function (id, userSession) {
|
|
1082
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1088
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1083
1089
|
var clonedId;
|
|
1084
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1090
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1085
1091
|
switch (_a.label) {
|
|
1086
1092
|
case 0:
|
|
1087
1093
|
clonedId = id;
|
|
@@ -1092,9 +1098,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1092
1098
|
});
|
|
1093
1099
|
};
|
|
1094
1100
|
SteedosObjectType.prototype.directFind = function (query, userSession) {
|
|
1095
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1101
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1096
1102
|
var clonedQuery;
|
|
1097
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1103
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1098
1104
|
switch (_a.label) {
|
|
1099
1105
|
case 0:
|
|
1100
1106
|
clonedQuery = Object.assign({}, query);
|
|
@@ -1108,8 +1114,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1108
1114
|
});
|
|
1109
1115
|
};
|
|
1110
1116
|
SteedosObjectType.prototype.directInsert = function (doc, userSession) {
|
|
1111
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1112
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1117
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1118
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1113
1119
|
switch (_a.label) {
|
|
1114
1120
|
case 0: return [4 /*yield*/, this.callAdapter('directInsert', this.table_name, doc, userSession)];
|
|
1115
1121
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1118,9 +1124,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1118
1124
|
});
|
|
1119
1125
|
};
|
|
1120
1126
|
SteedosObjectType.prototype.directUpdate = function (id, doc, userSession) {
|
|
1121
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1127
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1122
1128
|
var clonedId;
|
|
1123
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1129
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1124
1130
|
switch (_a.label) {
|
|
1125
1131
|
case 0: return [4 /*yield*/, this.processUneditableFields(userSession, doc)];
|
|
1126
1132
|
case 1:
|
|
@@ -1133,9 +1139,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1133
1139
|
});
|
|
1134
1140
|
};
|
|
1135
1141
|
SteedosObjectType.prototype.directDelete = function (id, userSession) {
|
|
1136
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1142
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1137
1143
|
var clonedId;
|
|
1138
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1144
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1139
1145
|
switch (_a.label) {
|
|
1140
1146
|
case 0:
|
|
1141
1147
|
clonedId = id;
|
|
@@ -1146,8 +1152,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1146
1152
|
});
|
|
1147
1153
|
};
|
|
1148
1154
|
SteedosObjectType.prototype._makeNewID = function () {
|
|
1149
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1150
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1155
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1156
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1151
1157
|
switch (_a.label) {
|
|
1152
1158
|
case 0: return [4 /*yield*/, this._datasource._makeNewID(this.table_name)];
|
|
1153
1159
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1156,16 +1162,16 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1156
1162
|
});
|
|
1157
1163
|
};
|
|
1158
1164
|
SteedosObjectType.prototype.getFirstListView = function () {
|
|
1159
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1160
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1165
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1166
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1161
1167
|
return [2 /*return*/, this.list_views[0]];
|
|
1162
1168
|
});
|
|
1163
1169
|
});
|
|
1164
1170
|
};
|
|
1165
1171
|
SteedosObjectType.prototype.getAbsoluteUrl = function (app_id, record_id) {
|
|
1166
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1172
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1167
1173
|
var object_name, list_view, list_view_id;
|
|
1168
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1174
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1169
1175
|
switch (_a.label) {
|
|
1170
1176
|
case 0:
|
|
1171
1177
|
object_name = this.name;
|
|
@@ -1174,13 +1180,13 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1174
1180
|
list_view = _a.sent();
|
|
1175
1181
|
list_view_id = list_view ? list_view._id || list_view.name : 'all';
|
|
1176
1182
|
if (record_id)
|
|
1177
|
-
return [2 /*return*/, util_1.absoluteUrl("/app/" + app_id + "/" + object_name + "/view/" + record_id)];
|
|
1183
|
+
return [2 /*return*/, (0, util_1.absoluteUrl)("/app/" + app_id + "/" + object_name + "/view/" + record_id)];
|
|
1178
1184
|
else {
|
|
1179
1185
|
if (object_name === 'meeting') {
|
|
1180
|
-
return [2 /*return*/, util_1.absoluteUrl("/app/" + app_id + "/" + object_name + "/calendar/")];
|
|
1186
|
+
return [2 /*return*/, (0, util_1.absoluteUrl)("/app/" + app_id + "/" + object_name + "/calendar/")];
|
|
1181
1187
|
}
|
|
1182
1188
|
else {
|
|
1183
|
-
return [2 /*return*/, util_1.absoluteUrl("/app/" + app_id + "/" + object_name + "/grid/" + list_view_id)];
|
|
1189
|
+
return [2 /*return*/, (0, util_1.absoluteUrl)("/app/" + app_id + "/" + object_name + "/grid/" + list_view_id)];
|
|
1184
1190
|
}
|
|
1185
1191
|
}
|
|
1186
1192
|
return [2 /*return*/];
|
|
@@ -1189,8 +1195,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1189
1195
|
});
|
|
1190
1196
|
};
|
|
1191
1197
|
SteedosObjectType.prototype.getRecordAbsoluteUrl = function (app_id, record_id) {
|
|
1192
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1193
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1198
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1199
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1194
1200
|
switch (_a.label) {
|
|
1195
1201
|
case 0: return [4 /*yield*/, this.getAbsoluteUrl(app_id, record_id)];
|
|
1196
1202
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1199,8 +1205,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1199
1205
|
});
|
|
1200
1206
|
};
|
|
1201
1207
|
SteedosObjectType.prototype.getGridAbsoluteUrl = function (app_id) {
|
|
1202
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1203
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1208
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1209
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1204
1210
|
switch (_a.label) {
|
|
1205
1211
|
case 0: return [4 /*yield*/, this.getAbsoluteUrl(app_id)];
|
|
1206
1212
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1209,15 +1215,15 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1209
1215
|
});
|
|
1210
1216
|
};
|
|
1211
1217
|
SteedosObjectType.prototype.isEnableAudit = function () {
|
|
1212
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1213
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1218
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1219
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1214
1220
|
return [2 /*return*/, this.enable_audit];
|
|
1215
1221
|
});
|
|
1216
1222
|
});
|
|
1217
1223
|
};
|
|
1218
1224
|
SteedosObjectType.prototype.getDetails = function () {
|
|
1219
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1220
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1225
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1226
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1221
1227
|
switch (_a.label) {
|
|
1222
1228
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getDetails", { objectApiName: this.name })];
|
|
1223
1229
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1226,8 +1232,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1226
1232
|
});
|
|
1227
1233
|
};
|
|
1228
1234
|
SteedosObjectType.prototype.getMasters = function () {
|
|
1229
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1230
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1235
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1236
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1231
1237
|
switch (_a.label) {
|
|
1232
1238
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getMasters", { objectApiName: this.name })];
|
|
1233
1239
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1236,8 +1242,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1236
1242
|
});
|
|
1237
1243
|
};
|
|
1238
1244
|
SteedosObjectType.prototype.getLookupDetails = function () {
|
|
1239
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1240
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1245
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1246
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1241
1247
|
switch (_a.label) {
|
|
1242
1248
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getLookupDetails", { objectApiName: this.name })];
|
|
1243
1249
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1246,8 +1252,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1246
1252
|
});
|
|
1247
1253
|
};
|
|
1248
1254
|
SteedosObjectType.prototype.getDetailsInfo = function () {
|
|
1249
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1250
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1255
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1256
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1251
1257
|
switch (_a.label) {
|
|
1252
1258
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getDetailsInfo", { objectApiName: this.name })];
|
|
1253
1259
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1256,8 +1262,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1256
1262
|
});
|
|
1257
1263
|
};
|
|
1258
1264
|
SteedosObjectType.prototype.getMastersInfo = function () {
|
|
1259
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1260
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1265
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1266
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1261
1267
|
switch (_a.label) {
|
|
1262
1268
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getMastersInfo", { objectApiName: this.name })];
|
|
1263
1269
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1266,8 +1272,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1266
1272
|
});
|
|
1267
1273
|
};
|
|
1268
1274
|
SteedosObjectType.prototype.getLookupDetailsInfo = function () {
|
|
1269
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1270
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1275
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1276
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1271
1277
|
switch (_a.label) {
|
|
1272
1278
|
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getLookupDetailsInfo", { objectApiName: this.name })];
|
|
1273
1279
|
case 1: return [2 /*return*/, _a.sent()];
|
|
@@ -1275,10 +1281,23 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1275
1281
|
});
|
|
1276
1282
|
});
|
|
1277
1283
|
};
|
|
1284
|
+
/**
|
|
1285
|
+
* 此函数返回getDetailsInfo、getMastersInfo、getLookupDetailsInfo 3个请求的结果,用于优化访问速度
|
|
1286
|
+
*/
|
|
1287
|
+
SteedosObjectType.prototype.getRelationsInfo = function () {
|
|
1288
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1289
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1290
|
+
switch (_a.label) {
|
|
1291
|
+
case 0: return [4 /*yield*/, this.callMetadataObjectServiceAction("getRelationsInfo", { objectApiName: this.name })];
|
|
1292
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
});
|
|
1296
|
+
};
|
|
1278
1297
|
SteedosObjectType.prototype.getRecordPermissions = function (record, userSession) {
|
|
1279
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1298
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1280
1299
|
var permissions, userId, user_company_ids, recordOwnerId, isOwner, record_company_id, record_company_ids;
|
|
1281
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1300
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1282
1301
|
switch (_a.label) {
|
|
1283
1302
|
case 0: return [4 /*yield*/, this.getUserObjectPermission(userSession)];
|
|
1284
1303
|
case 1:
|
|
@@ -1346,40 +1365,47 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1346
1365
|
});
|
|
1347
1366
|
});
|
|
1348
1367
|
};
|
|
1349
|
-
SteedosObjectType.prototype.getRecordView = function (userSession) {
|
|
1350
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1351
|
-
var
|
|
1352
|
-
return tslib_1.__generator(this, function (
|
|
1353
|
-
switch (
|
|
1368
|
+
SteedosObjectType.prototype.getRecordView = function (userSession, context) {
|
|
1369
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1370
|
+
var objectConfig, layouts, spaceProcessDefinition, dbListViews, rolesFieldsPermission, lng, objectMetadataConfig, _a, relationsInfo, layout, _fields_1, sort_no_1, layoutFieldKeys, objectFieldKeys, difference, layoutButtonsName_1, userObjectFields;
|
|
1371
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1372
|
+
switch (_b.label) {
|
|
1354
1373
|
case 0:
|
|
1374
|
+
if (context) {
|
|
1375
|
+
objectConfig = context.objectConfig;
|
|
1376
|
+
layouts = context.layouts;
|
|
1377
|
+
spaceProcessDefinition = context.spaceProcessDefinition;
|
|
1378
|
+
dbListViews = context.dbListViews;
|
|
1379
|
+
rolesFieldsPermission = context.rolesFieldsPermission;
|
|
1380
|
+
}
|
|
1355
1381
|
lng = userSession.language;
|
|
1382
|
+
if (!!objectConfig) return [3 /*break*/, 2];
|
|
1356
1383
|
return [4 /*yield*/, this.callMetadataObjectServiceAction('get', { objectApiName: this.name })];
|
|
1357
1384
|
case 1:
|
|
1358
|
-
objectMetadataConfig =
|
|
1385
|
+
objectMetadataConfig = _b.sent();
|
|
1359
1386
|
objectConfig = objectMetadataConfig.metadata;
|
|
1387
|
+
_b.label = 2;
|
|
1388
|
+
case 2:
|
|
1360
1389
|
objectConfig.name = this.name;
|
|
1361
1390
|
objectConfig.datasource = this.datasource.name;
|
|
1362
1391
|
_a = objectConfig;
|
|
1363
|
-
return [4 /*yield*/, this.getUserObjectPermission(userSession)];
|
|
1364
|
-
case 2:
|
|
1365
|
-
_a.permissions = _e.sent();
|
|
1366
|
-
_b = objectConfig;
|
|
1367
|
-
return [4 /*yield*/, this.getDetailsInfo()];
|
|
1392
|
+
return [4 /*yield*/, this.getUserObjectPermission(userSession, rolesFieldsPermission)];
|
|
1368
1393
|
case 3:
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
return [4 /*yield*/, this.getMastersInfo()];
|
|
1394
|
+
_a.permissions = _b.sent();
|
|
1395
|
+
return [4 /*yield*/, this.getRelationsInfo()];
|
|
1372
1396
|
case 4:
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
_d.lookup_details = _e.sent();
|
|
1397
|
+
relationsInfo = _b.sent();
|
|
1398
|
+
objectConfig.details = relationsInfo.details;
|
|
1399
|
+
objectConfig.masters = relationsInfo.masters;
|
|
1400
|
+
objectConfig.lookup_details = relationsInfo.lookup_details;
|
|
1378
1401
|
delete objectConfig.db;
|
|
1379
|
-
i18n_1.translationObject(lng, objectConfig.name, objectConfig, true);
|
|
1380
|
-
return [
|
|
1402
|
+
(0, i18n_1.translationObject)(lng, objectConfig.name, objectConfig, true);
|
|
1403
|
+
if (!!layouts) return [3 /*break*/, 6];
|
|
1404
|
+
return [4 /*yield*/, (0, object_layouts_1.getObjectLayouts)(userSession.profile, userSession.spaceId, this.name)];
|
|
1405
|
+
case 5:
|
|
1406
|
+
layouts = _b.sent();
|
|
1407
|
+
_b.label = 6;
|
|
1381
1408
|
case 6:
|
|
1382
|
-
layouts = _e.sent();
|
|
1383
1409
|
if (layouts && layouts.length > 0) {
|
|
1384
1410
|
layout = layouts[0];
|
|
1385
1411
|
_fields_1 = {};
|
|
@@ -1451,23 +1477,31 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1451
1477
|
userObjectFields = objectConfig.fields;
|
|
1452
1478
|
_.each(objectConfig.permissions.field_permissions, function (field_permission, field) {
|
|
1453
1479
|
var read = field_permission.read, edit = field_permission.edit;
|
|
1454
|
-
if (
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1480
|
+
if (userObjectFields[field]) {
|
|
1481
|
+
if (read) {
|
|
1482
|
+
userObjectFields[field].hidden = false;
|
|
1483
|
+
userObjectFields[field].omit = true;
|
|
1484
|
+
userObjectFields[field].readonly = true;
|
|
1485
|
+
userObjectFields[field].disabled = true;
|
|
1486
|
+
}
|
|
1487
|
+
if (edit) {
|
|
1488
|
+
userObjectFields[field].omit = false;
|
|
1489
|
+
userObjectFields[field].hidden = false;
|
|
1490
|
+
userObjectFields[field].readonly = false;
|
|
1491
|
+
userObjectFields[field].disabled = false;
|
|
1492
|
+
}
|
|
1493
|
+
if (!read && !edit) {
|
|
1494
|
+
delete userObjectFields[field];
|
|
1495
|
+
}
|
|
1465
1496
|
}
|
|
1466
1497
|
});
|
|
1467
1498
|
objectConfig.fields = userObjectFields;
|
|
1499
|
+
if (!!spaceProcessDefinition) return [3 /*break*/, 8];
|
|
1468
1500
|
return [4 /*yield*/, getObject("process_definition").directFind({ filters: [['space', '=', userSession.spaceId], ['object_name', '=', this.name], ['active', '=', true]] })];
|
|
1469
1501
|
case 7:
|
|
1470
|
-
spaceProcessDefinition =
|
|
1502
|
+
spaceProcessDefinition = _b.sent();
|
|
1503
|
+
_b.label = 8;
|
|
1504
|
+
case 8:
|
|
1471
1505
|
if (spaceProcessDefinition.length > 0) {
|
|
1472
1506
|
objectConfig.enable_process = true;
|
|
1473
1507
|
}
|
|
@@ -1477,9 +1511,12 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1477
1511
|
delete objectConfig.triggers[key];
|
|
1478
1512
|
}
|
|
1479
1513
|
});
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1514
|
+
if (!!dbListViews) return [3 /*break*/, 10];
|
|
1515
|
+
return [4 /*yield*/, getObject("object_listviews").directFind({ filters: [['space', '=', userSession.spaceId], ['object_name', '=', this.name], [['owner', '=', userSession.userId], 'or', ['shared', '=', true]]] })];
|
|
1516
|
+
case 9:
|
|
1517
|
+
dbListViews = _b.sent();
|
|
1518
|
+
_b.label = 10;
|
|
1519
|
+
case 10:
|
|
1483
1520
|
objectConfig.list_views = Object.assign({}, objectConfig.list_views);
|
|
1484
1521
|
_.each(dbListViews, function (dbListView) {
|
|
1485
1522
|
delete dbListView.created;
|
|
@@ -1498,9 +1535,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1498
1535
|
};
|
|
1499
1536
|
SteedosObjectType.prototype.getDefaulRecordView = function (userSession) {
|
|
1500
1537
|
var e_5, _a;
|
|
1501
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1538
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1502
1539
|
var object_name, type, buttons, fields, related_lists, objectConfig, sortedFields, relatedLists, details, lookup_details, relatedLists_1, relatedLists_1_1, related, relatedItem, foo, rObjectName, relatedObject, relatedObjectAllListView, fieldNames_1, e_5_1;
|
|
1503
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1540
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1504
1541
|
switch (_b.label) {
|
|
1505
1542
|
case 0:
|
|
1506
1543
|
object_name = this.name;
|
|
@@ -1512,10 +1549,10 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1512
1549
|
case 1:
|
|
1513
1550
|
objectConfig = _b.sent();
|
|
1514
1551
|
sortedFields = [];
|
|
1515
|
-
lodash_1.forEach(objectConfig.fields, function (fieldItem, key) {
|
|
1552
|
+
(0, lodash_1.forEach)(objectConfig.fields, function (fieldItem, key) {
|
|
1516
1553
|
sortedFields.push(Object.assign({}, { name: key }, fieldItem));
|
|
1517
1554
|
});
|
|
1518
|
-
sortedFields = lodash_1.sortBy(sortedFields, function (o) { return o.sort_no; });
|
|
1555
|
+
sortedFields = (0, lodash_1.sortBy)(sortedFields, function (o) { return o.sort_no; });
|
|
1519
1556
|
_.each(sortedFields, function (field, key) {
|
|
1520
1557
|
var layoutField = {};
|
|
1521
1558
|
layoutField.field_name = field.name;
|
|
@@ -1557,7 +1594,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1557
1594
|
_b.label = 4;
|
|
1558
1595
|
case 4:
|
|
1559
1596
|
_b.trys.push([4, 10, 11, 16]);
|
|
1560
|
-
relatedLists_1 = tslib_1.__asyncValues(relatedLists);
|
|
1597
|
+
relatedLists_1 = (0, tslib_1.__asyncValues)(relatedLists);
|
|
1561
1598
|
_b.label = 5;
|
|
1562
1599
|
case 5: return [4 /*yield*/, relatedLists_1.next()];
|
|
1563
1600
|
case 6:
|
|
@@ -1624,7 +1661,11 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1624
1661
|
}
|
|
1625
1662
|
});
|
|
1626
1663
|
return [2 /*return*/, {
|
|
1627
|
-
object_name: object_name,
|
|
1664
|
+
object_name: object_name,
|
|
1665
|
+
type: type,
|
|
1666
|
+
buttons: buttons,
|
|
1667
|
+
fields: fields,
|
|
1668
|
+
related_lists: related_lists,
|
|
1628
1669
|
space: userSession.spaceId
|
|
1629
1670
|
}];
|
|
1630
1671
|
}
|
|
@@ -1632,9 +1673,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1632
1673
|
});
|
|
1633
1674
|
};
|
|
1634
1675
|
SteedosObjectType.prototype.createDefaulRecordView = function (userSession) {
|
|
1635
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1676
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1636
1677
|
var name, label, profiles, defaultRecordView, error_5;
|
|
1637
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1678
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1638
1679
|
switch (_a.label) {
|
|
1639
1680
|
case 0:
|
|
1640
1681
|
name = 'default';
|
|
@@ -1657,10 +1698,10 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1657
1698
|
});
|
|
1658
1699
|
};
|
|
1659
1700
|
SteedosObjectType.prototype.getRelateds = function () {
|
|
1660
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1701
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1661
1702
|
var related_objects, detailsInfo, lookupsInfo, relatedInfos, relatedInfos_1, relatedInfos_1_1, info, infos, detailObjectApiName, detailFieldName, related_field, e_6_1;
|
|
1662
1703
|
var e_6, _a;
|
|
1663
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1704
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1664
1705
|
switch (_b.label) {
|
|
1665
1706
|
case 0:
|
|
1666
1707
|
related_objects = [];
|
|
@@ -1677,7 +1718,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1677
1718
|
_b.label = 3;
|
|
1678
1719
|
case 3:
|
|
1679
1720
|
_b.trys.push([3, 8, 9, 10]);
|
|
1680
|
-
relatedInfos_1 = tslib_1.__values(relatedInfos), relatedInfos_1_1 = relatedInfos_1.next();
|
|
1721
|
+
relatedInfos_1 = (0, tslib_1.__values)(relatedInfos), relatedInfos_1_1 = relatedInfos_1.next();
|
|
1681
1722
|
_b.label = 4;
|
|
1682
1723
|
case 4:
|
|
1683
1724
|
if (!!relatedInfos_1_1.done) return [3 /*break*/, 7];
|
|
@@ -1742,9 +1783,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1742
1783
|
return methodName.startsWith("direct");
|
|
1743
1784
|
};
|
|
1744
1785
|
SteedosObjectType.prototype.count = function (query, userSession) {
|
|
1745
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1786
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1746
1787
|
var clonedQuery;
|
|
1747
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1788
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1748
1789
|
switch (_a.label) {
|
|
1749
1790
|
case 0:
|
|
1750
1791
|
clonedQuery = Object.assign({}, query);
|
|
@@ -1755,8 +1796,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1755
1796
|
});
|
|
1756
1797
|
};
|
|
1757
1798
|
SteedosObjectType.prototype.allow = function (method, userSession) {
|
|
1758
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1759
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1799
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1800
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1760
1801
|
switch (_a.label) {
|
|
1761
1802
|
case 0:
|
|
1762
1803
|
if (_.isNull(userSession) || _.isUndefined(userSession)) {
|
|
@@ -1783,16 +1824,16 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1783
1824
|
});
|
|
1784
1825
|
};
|
|
1785
1826
|
SteedosObjectType.prototype.runBeforeTriggers = function (method, context) {
|
|
1786
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1827
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1787
1828
|
var meteorWhen, when;
|
|
1788
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1829
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1789
1830
|
switch (_a.label) {
|
|
1790
1831
|
case 0:
|
|
1791
1832
|
if (method === 'count' || method === "findOne") {
|
|
1792
1833
|
method = 'find';
|
|
1793
1834
|
}
|
|
1794
|
-
meteorWhen = "before"
|
|
1795
|
-
when = "before."
|
|
1835
|
+
meteorWhen = "before".concat(method.charAt(0).toLocaleUpperCase()).concat(_.rest((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(method), false)).join(''));
|
|
1836
|
+
when = "before.".concat(method);
|
|
1796
1837
|
return [4 /*yield*/, this.runTriggers(meteorWhen, context)];
|
|
1797
1838
|
case 1:
|
|
1798
1839
|
_a.sent();
|
|
@@ -1803,13 +1844,13 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1803
1844
|
});
|
|
1804
1845
|
};
|
|
1805
1846
|
SteedosObjectType.prototype.runAfterTriggers = function (method, context) {
|
|
1806
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1847
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1807
1848
|
var meteorWhen, when;
|
|
1808
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1849
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1809
1850
|
switch (_a.label) {
|
|
1810
1851
|
case 0:
|
|
1811
|
-
meteorWhen = "after"
|
|
1812
|
-
when = "after."
|
|
1852
|
+
meteorWhen = "after".concat(method.charAt(0).toLocaleUpperCase()).concat(_.rest((0, tslib_1.__spreadArray)([], (0, tslib_1.__read)(method), false)).join(''));
|
|
1853
|
+
when = "after.".concat(method);
|
|
1813
1854
|
return [4 /*yield*/, this.runTriggers(meteorWhen, context)];
|
|
1814
1855
|
case 1:
|
|
1815
1856
|
_a.sent();
|
|
@@ -1820,9 +1861,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1820
1861
|
});
|
|
1821
1862
|
};
|
|
1822
1863
|
SteedosObjectType.prototype.appendRecordPermission = function (records, userSession) {
|
|
1823
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1864
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1824
1865
|
var _ids, objPm, permissionFilters, filters, results, allowEditIds;
|
|
1825
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1866
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1826
1867
|
switch (_a.label) {
|
|
1827
1868
|
case 0:
|
|
1828
1869
|
_ids = _.pluck(records, '_id');
|
|
@@ -1833,10 +1874,10 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1833
1874
|
if (_.isEmpty(permissionFilters)) {
|
|
1834
1875
|
return [2 /*return*/];
|
|
1835
1876
|
}
|
|
1836
|
-
filters = filters_1.formatFiltersToODataQuery(['_id', 'in', _ids]);
|
|
1877
|
+
filters = (0, filters_1.formatFiltersToODataQuery)(['_id', 'in', _ids]);
|
|
1837
1878
|
return [4 /*yield*/, this.directFind({
|
|
1838
1879
|
fields: ['_id'],
|
|
1839
|
-
filters: "("
|
|
1880
|
+
filters: "(".concat(filters, ") and (").concat(permissionFilters.join(' or '), ")")
|
|
1840
1881
|
})];
|
|
1841
1882
|
case 2:
|
|
1842
1883
|
results = _a.sent();
|
|
@@ -1856,9 +1897,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1856
1897
|
});
|
|
1857
1898
|
};
|
|
1858
1899
|
SteedosObjectType.prototype.getTriggerContext = function (when, method, args, recordId) {
|
|
1859
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1900
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1860
1901
|
var userSession, context, _a;
|
|
1861
|
-
return tslib_1.__generator(this, function (_b) {
|
|
1902
|
+
return (0, tslib_1.__generator)(this, function (_b) {
|
|
1862
1903
|
switch (_b.label) {
|
|
1863
1904
|
case 0:
|
|
1864
1905
|
userSession = args[args.length - 1];
|
|
@@ -1887,9 +1928,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1887
1928
|
});
|
|
1888
1929
|
};
|
|
1889
1930
|
SteedosObjectType.prototype.processUnreadableField = function (userSession, query) {
|
|
1890
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1931
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1891
1932
|
var userObjectPermission, userObjectUnreadableFields, queryFields_1;
|
|
1892
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1933
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1893
1934
|
switch (_a.label) {
|
|
1894
1935
|
case 0:
|
|
1895
1936
|
if (!userSession) {
|
|
@@ -1932,8 +1973,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1932
1973
|
});
|
|
1933
1974
|
};
|
|
1934
1975
|
SteedosObjectType.prototype.processUneditableFields = function (userSession, doc) {
|
|
1935
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1936
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1976
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1977
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1937
1978
|
return [2 /*return*/];
|
|
1938
1979
|
});
|
|
1939
1980
|
});
|
|
@@ -1943,9 +1984,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1943
1984
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1944
1985
|
args[_i - 1] = arguments[_i];
|
|
1945
1986
|
}
|
|
1946
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1987
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
1947
1988
|
var adapterMethod, allow, objectName, recordId, doc, paramRecordId, returnValue, userSession, beforeTriggerContext, afterTriggerContext, previousDoc, values, _records;
|
|
1948
|
-
return tslib_1.__generator(this, function (_a) {
|
|
1989
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
1949
1990
|
switch (_a.label) {
|
|
1950
1991
|
case 0:
|
|
1951
1992
|
adapterMethod = this._datasource[method];
|
|
@@ -1999,7 +2040,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
1999
2040
|
return [4 /*yield*/, this.runBeforeTriggers(method, beforeTriggerContext)];
|
|
2000
2041
|
case 7:
|
|
2001
2042
|
_a.sent();
|
|
2002
|
-
return [4 /*yield*/, validation_rules_1.runValidationRules(method, beforeTriggerContext, args[0], userSession)];
|
|
2043
|
+
return [4 /*yield*/, (0, validation_rules_1.runValidationRules)(method, beforeTriggerContext, args[0], userSession)];
|
|
2003
2044
|
case 8:
|
|
2004
2045
|
_a.sent();
|
|
2005
2046
|
return [4 /*yield*/, this.getTriggerContext('after', method, args, paramRecordId)];
|
|
@@ -2082,7 +2123,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2082
2123
|
case 22:
|
|
2083
2124
|
_a.sent();
|
|
2084
2125
|
_a.label = 23;
|
|
2085
|
-
case 23: return [4 /*yield*/, object_events_1.brokeEmitEvents(objectName, method, afterTriggerContext)];
|
|
2126
|
+
case 23: return [4 /*yield*/, (0, object_events_1.brokeEmitEvents)(objectName, method, afterTriggerContext)];
|
|
2086
2127
|
case 24:
|
|
2087
2128
|
_a.sent();
|
|
2088
2129
|
_a.label = 25;
|
|
@@ -2093,9 +2134,9 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2093
2134
|
};
|
|
2094
2135
|
;
|
|
2095
2136
|
SteedosObjectType.prototype.runRecordFormula = function (method, objectName, recordId, doc, userSession) {
|
|
2096
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2137
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2097
2138
|
var currentUserId;
|
|
2098
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2139
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2099
2140
|
switch (_a.label) {
|
|
2100
2141
|
case 0:
|
|
2101
2142
|
if (!(["insert", "update", "updateMany"].indexOf(method) > -1)) return [3 /*break*/, 4];
|
|
@@ -2103,12 +2144,12 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2103
2144
|
return [3 /*break*/, 4];
|
|
2104
2145
|
case 1:
|
|
2105
2146
|
currentUserId = userSession ? userSession.userId : undefined;
|
|
2106
|
-
return [4 /*yield*/, formula_1.runCurrentObjectFieldFormulas(objectName, recordId, doc, currentUserId, true)];
|
|
2147
|
+
return [4 /*yield*/, (0, formula_1.runCurrentObjectFieldFormulas)(objectName, recordId, doc, currentUserId, true)];
|
|
2107
2148
|
case 2:
|
|
2108
2149
|
_a.sent();
|
|
2109
2150
|
if (!(method === "update")) return [3 /*break*/, 4];
|
|
2110
2151
|
// 新建记录时肯定不会有字段被引用,不需要重算被引用的公式字段值
|
|
2111
|
-
return [4 /*yield*/, formula_1.runQuotedByObjectFieldFormulas(objectName, recordId, userSession)];
|
|
2152
|
+
return [4 /*yield*/, (0, formula_1.runQuotedByObjectFieldFormulas)(objectName, recordId, userSession)];
|
|
2112
2153
|
case 3:
|
|
2113
2154
|
// 新建记录时肯定不会有字段被引用,不需要重算被引用的公式字段值
|
|
2114
2155
|
_a.sent();
|
|
@@ -2119,8 +2160,8 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2119
2160
|
});
|
|
2120
2161
|
};
|
|
2121
2162
|
SteedosObjectType.prototype.runRecordSummaries = function (method, objectName, recordId, doc, previousDoc, userSession) {
|
|
2122
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2123
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2163
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2164
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2124
2165
|
switch (_a.label) {
|
|
2125
2166
|
case 0:
|
|
2126
2167
|
if (!(["insert", "update", "updateMany", "delete"].indexOf(method) > -1)) return [3 /*break*/, 5];
|
|
@@ -2128,11 +2169,11 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2128
2169
|
return [3 /*break*/, 5];
|
|
2129
2170
|
case 1:
|
|
2130
2171
|
if (!(method === "insert")) return [3 /*break*/, 3];
|
|
2131
|
-
return [4 /*yield*/, summary_1.runCurrentObjectFieldSummaries(objectName, recordId)];
|
|
2172
|
+
return [4 /*yield*/, (0, summary_1.runCurrentObjectFieldSummaries)(objectName, recordId)];
|
|
2132
2173
|
case 2:
|
|
2133
2174
|
_a.sent();
|
|
2134
2175
|
_a.label = 3;
|
|
2135
|
-
case 3: return [4 /*yield*/, summary_1.runQuotedByObjectFieldSummaries(objectName, recordId, previousDoc, userSession)];
|
|
2176
|
+
case 3: return [4 /*yield*/, (0, summary_1.runQuotedByObjectFieldSummaries)(objectName, recordId, previousDoc, userSession)];
|
|
2136
2177
|
case 4:
|
|
2137
2178
|
_a.sent();
|
|
2138
2179
|
_a.label = 5;
|
|
@@ -2144,7 +2185,7 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2144
2185
|
SteedosObjectType.prototype.getObjectEditPermissionFilters = function (objectPermission, userSession) {
|
|
2145
2186
|
var objectPermissionFilters = [];
|
|
2146
2187
|
if (!_.isEmpty(objectPermission.modifyAssignCompanysRecords)) {
|
|
2147
|
-
objectPermissionFilters.push("("
|
|
2188
|
+
objectPermissionFilters.push("(".concat((0, filters_1.formatFiltersToODataQuery)([['company_id', 'in', objectPermission.modifyAssignCompanysRecords], 'or', ['company_ids', 'in', objectPermission.modifyAssignCompanysRecords]], userSession), ")"));
|
|
2148
2189
|
}
|
|
2149
2190
|
return objectPermissionFilters;
|
|
2150
2191
|
};
|
|
@@ -2161,15 +2202,15 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2161
2202
|
query = args[args.length - 3];
|
|
2162
2203
|
}
|
|
2163
2204
|
if (query.filters && !_.isString(query.filters)) {
|
|
2164
|
-
query.filters = filters_1.formatFiltersToODataQuery(query.filters, userSession);
|
|
2205
|
+
query.filters = (0, filters_1.formatFiltersToODataQuery)(query.filters, userSession);
|
|
2165
2206
|
}
|
|
2166
2207
|
}
|
|
2167
2208
|
}
|
|
2168
2209
|
};
|
|
2169
2210
|
SteedosObjectType.prototype.dealWithMethodPermission = function (method, args) {
|
|
2170
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2211
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
|
|
2171
2212
|
var userSession, spaceId, userId, objPm, query, spaceFilter, companyFilter, ownerFilter, sharesFilter, shareRuleFilters, restrictionRuleFilters, clientFilter, filters, permissionFilters, userFilters, viewAssignCompanysRecordsFilter_1, permissionFilters, objectPermissionEditFilters, id, companyFilters, queryFilters, companyFilters, permissionFilters, objectPermissionEditFilters, id, companyFilters;
|
|
2172
|
-
return tslib_1.__generator(this, function (_a) {
|
|
2213
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
|
2173
2214
|
switch (_a.label) {
|
|
2174
2215
|
case 0:
|
|
2175
2216
|
userSession = args[args.length - 1];
|
|
@@ -2185,18 +2226,18 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2185
2226
|
query = args[args.length - 3];
|
|
2186
2227
|
}
|
|
2187
2228
|
if (query.filters && !_.isString(query.filters)) {
|
|
2188
|
-
query.filters = filters_1.formatFiltersToODataQuery(query.filters);
|
|
2229
|
+
query.filters = (0, filters_1.formatFiltersToODataQuery)(query.filters);
|
|
2189
2230
|
}
|
|
2190
2231
|
if (this.table_name == 'cfs.files.filerecord' || this.table_name == 'cfs.instances.filerecord') {
|
|
2191
2232
|
return [2 /*return*/];
|
|
2192
2233
|
}
|
|
2193
|
-
if (util_1.isCloudAdminSpace(spaceId)) {
|
|
2234
|
+
if ((0, util_1.isCloudAdminSpace)(spaceId)) {
|
|
2194
2235
|
return [2 /*return*/];
|
|
2195
2236
|
}
|
|
2196
2237
|
spaceFilter = void 0, companyFilter = void 0, ownerFilter = void 0, sharesFilter = void 0, shareRuleFilters = void 0, restrictionRuleFilters = void 0, clientFilter = query.filters, filters = void 0, permissionFilters = [], userFilters = [];
|
|
2197
2238
|
//space 权限
|
|
2198
2239
|
if (spaceId) {
|
|
2199
|
-
spaceFilter = "(space eq '"
|
|
2240
|
+
spaceFilter = "(space eq '".concat(spaceId, "')");
|
|
2200
2241
|
}
|
|
2201
2242
|
// 本公司权限
|
|
2202
2243
|
if (spaceId && !objPm.viewAllRecords && objPm.viewCompanyRecords) {
|
|
@@ -2205,49 +2246,49 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2205
2246
|
throw new Error("user not belong any company!");
|
|
2206
2247
|
}
|
|
2207
2248
|
companyFilter = _.map(userSession.companies, function (comp) {
|
|
2208
|
-
return "(company_id eq '"
|
|
2249
|
+
return "(company_id eq '".concat(comp._id, "') or (company_ids eq '").concat(comp._id, "')");
|
|
2209
2250
|
});
|
|
2210
2251
|
}
|
|
2211
2252
|
if (!objPm.viewAllRecords && !objPm.viewCompanyRecords && objPm.allowRead) { // owner
|
|
2212
|
-
ownerFilter = "(owner eq '"
|
|
2253
|
+
ownerFilter = "(owner eq '".concat(userId, "')");
|
|
2213
2254
|
}
|
|
2214
2255
|
viewAssignCompanysRecordsFilter_1 = [];
|
|
2215
2256
|
if (objPm.viewAssignCompanysRecords) {
|
|
2216
2257
|
_.each(objPm.viewAssignCompanysRecords, function (assignCompanyId) {
|
|
2217
|
-
viewAssignCompanysRecordsFilter_1.push("((company_id eq '"
|
|
2258
|
+
viewAssignCompanysRecordsFilter_1.push("((company_id eq '".concat(assignCompanyId, "') or (company_ids eq '").concat(assignCompanyId, "'))"));
|
|
2218
2259
|
});
|
|
2219
2260
|
}
|
|
2220
2261
|
if (!_.isEmpty(viewAssignCompanysRecordsFilter_1)) {
|
|
2221
|
-
permissionFilters.push("("
|
|
2262
|
+
permissionFilters.push("(".concat(viewAssignCompanysRecordsFilter_1.join(' or '), ")"));
|
|
2222
2263
|
}
|
|
2223
2264
|
return [4 /*yield*/, shareRule_1.ShareRules.getUserObjectFilters(this.name, userSession)];
|
|
2224
2265
|
case 2:
|
|
2225
2266
|
//共享规则
|
|
2226
2267
|
shareRuleFilters = _a.sent();
|
|
2227
2268
|
if (!_.isEmpty(shareRuleFilters)) {
|
|
2228
|
-
permissionFilters.push("("
|
|
2269
|
+
permissionFilters.push("(".concat(shareRuleFilters.join(' or '), ")"));
|
|
2229
2270
|
}
|
|
2230
2271
|
return [4 /*yield*/, restrictionRule_1.RestrictionRule.getUserObjectFilters(this.name, userSession)];
|
|
2231
2272
|
case 3:
|
|
2232
2273
|
// 限制规则
|
|
2233
2274
|
restrictionRuleFilters = _a.sent();
|
|
2234
2275
|
if (!_.isEmpty(restrictionRuleFilters)) {
|
|
2235
|
-
userFilters.push("("
|
|
2276
|
+
userFilters.push("(".concat(restrictionRuleFilters.join(' or '), ")"));
|
|
2236
2277
|
}
|
|
2237
2278
|
// objectPermissionFilters = this.getObjectPermissionFilters(objPm, userSession, false);
|
|
2238
2279
|
// if (!_.isEmpty(objectPermissionFilters)) {
|
|
2239
2280
|
// permissionFilters.push(`(${objectPermissionFilters.join(' or ')})`);
|
|
2240
2281
|
// }
|
|
2241
2282
|
//共享规则(旧)
|
|
2242
|
-
sharesFilter = util_1.getUserObjectSharesFilters(this.name, userSession);
|
|
2283
|
+
sharesFilter = (0, util_1.getUserObjectSharesFilters)(this.name, userSession);
|
|
2243
2284
|
if (!_.isEmpty(companyFilter)) {
|
|
2244
|
-
permissionFilters.push("("
|
|
2285
|
+
permissionFilters.push("(".concat(companyFilter.join(' and '), ")"));
|
|
2245
2286
|
}
|
|
2246
2287
|
if (ownerFilter) {
|
|
2247
2288
|
permissionFilters.push(ownerFilter);
|
|
2248
2289
|
}
|
|
2249
2290
|
if (!_.isEmpty(sharesFilter)) {
|
|
2250
|
-
permissionFilters.push("("
|
|
2291
|
+
permissionFilters.push("(".concat(sharesFilter.join(' or '), ")"));
|
|
2251
2292
|
}
|
|
2252
2293
|
if (clientFilter) {
|
|
2253
2294
|
userFilters.push(clientFilter);
|
|
@@ -2259,80 +2300,80 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2259
2300
|
filters = permissionFilters.join(' or ');
|
|
2260
2301
|
}
|
|
2261
2302
|
if (!_.isEmpty(userFilters)) {
|
|
2262
|
-
filters = filters ? "("
|
|
2303
|
+
filters = filters ? "(".concat(filters, ") and (").concat(userFilters.join(' and '), ")") : userFilters.join(' and ');
|
|
2263
2304
|
}
|
|
2264
2305
|
query.filters = filters;
|
|
2265
2306
|
return [3 /*break*/, 5];
|
|
2266
2307
|
case 4:
|
|
2267
2308
|
if (method === 'insert') {
|
|
2268
2309
|
if (!objPm.allowCreate) {
|
|
2269
|
-
throw new Error("no "
|
|
2310
|
+
throw new Error("no ".concat(method, " permission!"));
|
|
2270
2311
|
}
|
|
2271
2312
|
}
|
|
2272
2313
|
else if (method === 'update' || method === 'updateOne') {
|
|
2273
2314
|
permissionFilters = this.getObjectEditPermissionFilters(objPm, userSession);
|
|
2274
2315
|
if (!objPm.allowEdit && _.isEmpty(permissionFilters)) {
|
|
2275
|
-
throw new Error("no "
|
|
2316
|
+
throw new Error("no ".concat(method, " permission!"));
|
|
2276
2317
|
}
|
|
2277
2318
|
objectPermissionEditFilters = '';
|
|
2278
2319
|
if (!_.isEmpty(permissionFilters)) {
|
|
2279
|
-
objectPermissionEditFilters = " or ("
|
|
2320
|
+
objectPermissionEditFilters = " or (".concat(permissionFilters.join(' or '), ")");
|
|
2280
2321
|
}
|
|
2281
2322
|
id = args[args.length - 3];
|
|
2282
2323
|
if (!objPm.modifyAllRecords && objPm.modifyCompanyRecords) {
|
|
2283
2324
|
companyFilters = _.map(userSession.companies, function (comp) {
|
|
2284
|
-
return "(company_id eq '"
|
|
2325
|
+
return "(company_id eq '".concat(comp._id, "') or (company_ids eq '").concat(comp._id, "')");
|
|
2285
2326
|
}).join(' or ');
|
|
2286
2327
|
if (companyFilters) {
|
|
2287
2328
|
if (_.isString(id)) {
|
|
2288
|
-
id = { filters: "(_id eq '"
|
|
2329
|
+
id = { filters: "(_id eq '".concat(id, "') and (").concat(companyFilters).concat(objectPermissionEditFilters, ")") };
|
|
2289
2330
|
}
|
|
2290
2331
|
else if (_.isObject(id)) {
|
|
2291
2332
|
if (id.filters && !_.isString(id.filters)) {
|
|
2292
|
-
id.filters = filters_1.formatFiltersToODataQuery(id.filters);
|
|
2333
|
+
id.filters = (0, filters_1.formatFiltersToODataQuery)(id.filters);
|
|
2293
2334
|
}
|
|
2294
|
-
id.filters = id.filters ? "("
|
|
2335
|
+
id.filters = id.filters ? "(".concat(id.filters, ") and (").concat(companyFilters).concat(objectPermissionEditFilters, ")") : "(".concat(companyFilters).concat(objectPermissionEditFilters, ")");
|
|
2295
2336
|
}
|
|
2296
2337
|
}
|
|
2297
2338
|
}
|
|
2298
2339
|
else if (!objPm.modifyAllRecords && !objPm.modifyCompanyRecords && objPm.allowEdit) {
|
|
2299
2340
|
if (_.isString(id)) {
|
|
2300
|
-
id = { filters: "(_id eq '"
|
|
2341
|
+
id = { filters: "(_id eq '".concat(id, "') and (owner eq '").concat(userId, "' ").concat(objectPermissionEditFilters, ")") };
|
|
2301
2342
|
}
|
|
2302
2343
|
else if (_.isObject(id)) {
|
|
2303
2344
|
if (id.filters && !_.isString(id.filters)) {
|
|
2304
|
-
id.filters = filters_1.formatFiltersToODataQuery(id.filters);
|
|
2345
|
+
id.filters = (0, filters_1.formatFiltersToODataQuery)(id.filters);
|
|
2305
2346
|
}
|
|
2306
|
-
id.filters = id.filters ? "("
|
|
2347
|
+
id.filters = id.filters ? "(".concat(id.filters, ") and (owner eq '").concat(userId, "' ").concat(objectPermissionEditFilters, ")") : "(owner eq '".concat(userId, "' ").concat(objectPermissionEditFilters, ")");
|
|
2307
2348
|
}
|
|
2308
2349
|
}
|
|
2309
2350
|
else if (objectPermissionEditFilters) {
|
|
2310
2351
|
if (_.isString(id)) {
|
|
2311
|
-
id = { filters: "(_id eq '"
|
|
2352
|
+
id = { filters: "(_id eq '".concat(id, "') and (").concat(objectPermissionEditFilters, ")") };
|
|
2312
2353
|
}
|
|
2313
2354
|
else if (_.isObject(id)) {
|
|
2314
2355
|
if (id.filters && !_.isString(id.filters)) {
|
|
2315
|
-
id.filters = filters_1.formatFiltersToODataQuery(id.filters);
|
|
2356
|
+
id.filters = (0, filters_1.formatFiltersToODataQuery)(id.filters);
|
|
2316
2357
|
}
|
|
2317
|
-
id.filters = id.filters ? "("
|
|
2358
|
+
id.filters = id.filters ? "(".concat(id.filters, ") and (").concat(objectPermissionEditFilters, ")") : "(".concat(objectPermissionEditFilters, ")");
|
|
2318
2359
|
}
|
|
2319
2360
|
}
|
|
2320
2361
|
args[args.length - 3] = id;
|
|
2321
2362
|
}
|
|
2322
2363
|
else if (method === 'updateMany') {
|
|
2323
2364
|
if (!objPm.modifyAllRecords && !objPm.modifyCompanyRecords) {
|
|
2324
|
-
throw new Error("no "
|
|
2365
|
+
throw new Error("no ".concat(method, " permission!"));
|
|
2325
2366
|
}
|
|
2326
2367
|
if (!objPm.modifyAllRecords && objPm.modifyCompanyRecords) {
|
|
2327
2368
|
queryFilters = args[args.length - 3];
|
|
2328
2369
|
companyFilters = _.map(userSession.companies, function (comp) {
|
|
2329
|
-
return "(company_id eq '"
|
|
2370
|
+
return "(company_id eq '".concat(comp._id, "') or (company_ids eq '").concat(comp._id, "')");
|
|
2330
2371
|
}).join(' or ');
|
|
2331
2372
|
if (companyFilters) {
|
|
2332
2373
|
if (queryFilters && !_.isString(queryFilters)) {
|
|
2333
|
-
queryFilters = filters_1.formatFiltersToODataQuery(queryFilters);
|
|
2374
|
+
queryFilters = (0, filters_1.formatFiltersToODataQuery)(queryFilters);
|
|
2334
2375
|
}
|
|
2335
|
-
queryFilters = queryFilters ? "("
|
|
2376
|
+
queryFilters = queryFilters ? "(".concat(queryFilters, ") and (").concat(companyFilters, ")") : "(".concat(companyFilters, ")");
|
|
2336
2377
|
args[args.length - 3] = queryFilters;
|
|
2337
2378
|
}
|
|
2338
2379
|
}
|
|
@@ -2340,33 +2381,33 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2340
2381
|
else if (method === 'delete') {
|
|
2341
2382
|
permissionFilters = this.getObjectEditPermissionFilters(objPm, userSession);
|
|
2342
2383
|
if (!objPm.allowDelete && _.isEmpty(permissionFilters)) {
|
|
2343
|
-
throw new Error("no "
|
|
2384
|
+
throw new Error("no ".concat(method, " permission!"));
|
|
2344
2385
|
}
|
|
2345
2386
|
objectPermissionEditFilters = '';
|
|
2346
2387
|
if (!_.isEmpty(permissionFilters)) {
|
|
2347
|
-
objectPermissionEditFilters = " or ("
|
|
2388
|
+
objectPermissionEditFilters = " or (".concat(permissionFilters.join(' or '), ")");
|
|
2348
2389
|
}
|
|
2349
2390
|
id = args[args.length - 2];
|
|
2350
2391
|
if (!objPm.modifyAllRecords && objPm.modifyCompanyRecords) {
|
|
2351
2392
|
companyFilters = _.map(userSession.companies, function (comp) {
|
|
2352
|
-
return "(company_id eq '"
|
|
2393
|
+
return "(company_id eq '".concat(comp._id, "') or (company_ids eq '").concat(comp._id, "')");
|
|
2353
2394
|
}).join(' or ');
|
|
2354
2395
|
if (companyFilters) {
|
|
2355
|
-
id = { filters: "(_id eq '"
|
|
2396
|
+
id = { filters: "(_id eq '".concat(id, "') and (").concat(companyFilters).concat(objectPermissionEditFilters, ")") };
|
|
2356
2397
|
}
|
|
2357
2398
|
}
|
|
2358
2399
|
else if (!objPm.modifyAllRecords && !objPm.modifyCompanyRecords) {
|
|
2359
|
-
id = { filters: "(_id eq '"
|
|
2400
|
+
id = { filters: "(_id eq '".concat(id, "') and (owner eq '").concat(userId, "'").concat(objectPermissionEditFilters, ")") };
|
|
2360
2401
|
}
|
|
2361
2402
|
else if (objectPermissionEditFilters) {
|
|
2362
2403
|
if (_.isString(id)) {
|
|
2363
|
-
id = { filters: "(_id eq '"
|
|
2404
|
+
id = { filters: "(_id eq '".concat(id, "') and (").concat(objectPermissionEditFilters, ")") };
|
|
2364
2405
|
}
|
|
2365
2406
|
else if (_.isObject(id)) {
|
|
2366
2407
|
if (id.filters && !_.isString(id.filters)) {
|
|
2367
|
-
id.filters = filters_1.formatFiltersToODataQuery(id.filters);
|
|
2408
|
+
id.filters = (0, filters_1.formatFiltersToODataQuery)(id.filters);
|
|
2368
2409
|
}
|
|
2369
|
-
id.filters = id.filters ? "("
|
|
2410
|
+
id.filters = id.filters ? "(".concat(id.filters, ") and (").concat(objectPermissionEditFilters, ")") : "(".concat(objectPermissionEditFilters, ")");
|
|
2370
2411
|
}
|
|
2371
2412
|
}
|
|
2372
2413
|
args[args.length - 2] = id;
|
|
@@ -2458,11 +2499,11 @@ var SteedosObjectType = /** @class */ (function (_super) {
|
|
|
2458
2499
|
}(SteedosObjectProperties));
|
|
2459
2500
|
exports.SteedosObjectType = SteedosObjectType;
|
|
2460
2501
|
function getObject(objectName, schema) {
|
|
2461
|
-
return (schema ? schema : _1.getSteedosSchema()).getObject(objectName);
|
|
2502
|
+
return (schema ? schema : (0, _1.getSteedosSchema)()).getObject(objectName);
|
|
2462
2503
|
}
|
|
2463
2504
|
exports.getObject = getObject;
|
|
2464
2505
|
function getLocalObject(objectName, schema) {
|
|
2465
|
-
return (schema ? schema : _1.getSteedosSchema()).getLocalObject(objectName);
|
|
2506
|
+
return (schema ? schema : (0, _1.getSteedosSchema)()).getLocalObject(objectName);
|
|
2466
2507
|
}
|
|
2467
2508
|
exports.getLocalObject = getLocalObject;
|
|
2468
2509
|
//# sourceMappingURL=object.js.map
|