@steedos/objectql 2.2.50 → 2.2.51-beta.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.
Files changed (143) hide show
  1. package/lib/services/helpers/graphql/consts.d.ts +17 -0
  2. package/lib/services/helpers/graphql/consts.js +28 -0
  3. package/lib/services/helpers/graphql/consts.js.map +1 -0
  4. package/lib/services/helpers/graphql/getQueryFields.js +17 -2
  5. package/lib/services/helpers/graphql/getQueryFields.js.map +1 -1
  6. package/lib/services/helpers/graphql/index.d.ts +1 -1
  7. package/lib/services/helpers/graphql/index.js +31 -46
  8. package/lib/services/helpers/graphql/index.js.map +1 -1
  9. package/lib/util/index.js +7 -0
  10. package/lib/util/index.js.map +1 -1
  11. package/package.json +11 -12
  12. package/src/actions/field_updates.ts +0 -118
  13. package/src/actions/index.ts +0 -3
  14. package/src/actions/types/field_update_target.ts +0 -7
  15. package/src/actions/types/workflow_notification.ts +0 -9
  16. package/src/actions/types/workflow_rule.ts +0 -11
  17. package/src/actions/workflow_notifications.ts +0 -81
  18. package/src/actions/workflow_rule.ts +0 -136
  19. package/src/driver/driver.ts +0 -102
  20. package/src/driver/field-encrytion/index.ts +0 -8
  21. package/src/driver/field-encrytion/sharedconst.ts +0 -34
  22. package/src/driver/fieldDBType.ts +0 -14
  23. package/src/driver/format.ts +0 -36
  24. package/src/driver/index.ts +0 -20
  25. package/src/driver/metadata.ts +0 -226
  26. package/src/driver/meteorMongo.ts +0 -639
  27. package/src/driver/mongo.ts +0 -416
  28. package/src/driver/mysql.ts +0 -47
  29. package/src/driver/oracle.ts +0 -60
  30. package/src/driver/postgres.ts +0 -46
  31. package/src/driver/sqlite3.ts +0 -40
  32. package/src/driver/sqlserver.ts +0 -52
  33. package/src/dynamic-load/actions.ts +0 -146
  34. package/src/dynamic-load/approval_process.ts +0 -73
  35. package/src/dynamic-load/button.ts +0 -75
  36. package/src/dynamic-load/chart.ts +0 -22
  37. package/src/dynamic-load/client_script.ts +0 -65
  38. package/src/dynamic-load/field.ts +0 -77
  39. package/src/dynamic-load/flow_role.ts +0 -46
  40. package/src/dynamic-load/index.ts +0 -21
  41. package/src/dynamic-load/layout.ts +0 -53
  42. package/src/dynamic-load/listview.ts +0 -57
  43. package/src/dynamic-load/method.ts +0 -63
  44. package/src/dynamic-load/object_translations.ts +0 -61
  45. package/src/dynamic-load/originalObject.ts +0 -8
  46. package/src/dynamic-load/package.ts +0 -312
  47. package/src/dynamic-load/page.ts +0 -23
  48. package/src/dynamic-load/permission.ts +0 -71
  49. package/src/dynamic-load/permissionset.ts +0 -78
  50. package/src/dynamic-load/preload_data.ts +0 -104
  51. package/src/dynamic-load/profile.ts +0 -90
  52. package/src/dynamic-load/query.ts +0 -22
  53. package/src/dynamic-load/restrictionRules.ts +0 -23
  54. package/src/dynamic-load/role.ts +0 -46
  55. package/src/dynamic-load/shareRules.ts +0 -23
  56. package/src/dynamic-load/tab.ts +0 -17
  57. package/src/dynamic-load/tabs.ts +0 -13
  58. package/src/dynamic-load/translations.ts +0 -54
  59. package/src/dynamic-load/trigger.ts +0 -236
  60. package/src/dynamic-load/validation_rule.ts +0 -77
  61. package/src/dynamic-load/workflow.ts +0 -114
  62. package/src/errors/index.ts +0 -111
  63. package/src/formula/core.ts +0 -490
  64. package/src/formula/field_formula.ts +0 -107
  65. package/src/formula/index.ts +0 -81
  66. package/src/formula/params.ts +0 -197
  67. package/src/formula/recompute.ts +0 -65
  68. package/src/formula/simple_params.ts +0 -92
  69. package/src/formula/type.ts +0 -107
  70. package/src/formula/util.ts +0 -207
  71. package/src/index.ts +0 -24
  72. package/src/metadata-register/_base.ts +0 -85
  73. package/src/metadata-register/app.ts +0 -30
  74. package/src/metadata-register/chart.ts +0 -9
  75. package/src/metadata-register/index.ts +0 -123
  76. package/src/metadata-register/layout.ts +0 -38
  77. package/src/metadata-register/object.ts +0 -68
  78. package/src/metadata-register/page.ts +0 -9
  79. package/src/metadata-register/permissionFields.ts +0 -13
  80. package/src/metadata-register/permissionset.ts +0 -25
  81. package/src/metadata-register/process.ts +0 -16
  82. package/src/metadata-register/processTrigger.ts +0 -24
  83. package/src/metadata-register/profile.ts +0 -25
  84. package/src/metadata-register/query.ts +0 -9
  85. package/src/metadata-register/restrictionRules.ts +0 -12
  86. package/src/metadata-register/shareRules.ts +0 -13
  87. package/src/metadata-register/tab.ts +0 -9
  88. package/src/metadata-register/tabs.ts +0 -43
  89. package/src/services/datasourceServiceFactory.ts +0 -55
  90. package/src/services/helpers/graphql/getPrimaryFieldType.ts +0 -48
  91. package/src/services/helpers/graphql/getQueryFields.ts +0 -36
  92. package/src/services/helpers/graphql/index.ts +0 -681
  93. package/src/services/helpers/rest.ts +0 -57
  94. package/src/services/index.ts +0 -13
  95. package/src/services/objectService.ts +0 -846
  96. package/src/services/objectServiceDispatcher.ts +0 -209
  97. package/src/services/objectServiceFactory.ts +0 -29
  98. package/src/summary/core.ts +0 -263
  99. package/src/summary/field_summary.ts +0 -71
  100. package/src/summary/index.ts +0 -96
  101. package/src/summary/recompute.ts +0 -31
  102. package/src/summary/type.ts +0 -60
  103. package/src/ts-types/index.ts +0 -3
  104. package/src/ts-types/permissionset.ts +0 -8
  105. package/src/ts-types/profile.ts +0 -11
  106. package/src/ts-types/triggerActionParams.ts +0 -22
  107. package/src/typeorm/driver.ts +0 -379
  108. package/src/typeorm/index.ts +0 -3
  109. package/src/typeorm/util.ts +0 -147
  110. package/src/types/action.ts +0 -52
  111. package/src/types/app.ts +0 -280
  112. package/src/types/config.ts +0 -152
  113. package/src/types/connection.ts +0 -87
  114. package/src/types/dashboard.ts +0 -91
  115. package/src/types/datasource.ts +0 -570
  116. package/src/types/field.ts +0 -370
  117. package/src/types/field_permission.ts +0 -42
  118. package/src/types/field_types.ts +0 -1
  119. package/src/types/index.ts +0 -21
  120. package/src/types/list_view.ts +0 -56
  121. package/src/types/listeners.ts +0 -18
  122. package/src/types/object.ts +0 -2076
  123. package/src/types/object_dynamic_load.ts +0 -426
  124. package/src/types/object_events.ts +0 -43
  125. package/src/types/object_layouts.ts +0 -20
  126. package/src/types/object_permission.ts +0 -134
  127. package/src/types/query.ts +0 -28
  128. package/src/types/report.ts +0 -128
  129. package/src/types/restrictionRule.ts +0 -57
  130. package/src/types/schema.ts +0 -273
  131. package/src/types/shareRule.ts +0 -57
  132. package/src/types/trigger.ts +0 -88
  133. package/src/types/userSession.ts +0 -45
  134. package/src/types/validation_rules.ts +0 -29
  135. package/src/util/convert.ts +0 -131
  136. package/src/util/field.ts +0 -93
  137. package/src/util/function_expression.ts +0 -63
  138. package/src/util/index.ts +0 -1058
  139. package/src/util/locale.ts +0 -24
  140. package/src/util/permission_shares.ts +0 -25
  141. package/src/util/suffix.ts +0 -78
  142. package/src/util/transform.ts +0 -239
  143. package/src/validators/index.ts +0 -36
@@ -1,77 +0,0 @@
1
- /*
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2022-03-28 09:35:34
4
- * @Description:
5
- */
6
- import { Dictionary } from '@salesforce/ts-types';
7
- const _ = require('underscore');
8
- const lodash = require('lodash');
9
- const clone = require('clone');
10
- var util = require('../util');
11
-
12
- const _ValidationRules: Dictionary<any> = {};
13
-
14
- const PERMISSIONS = {
15
- allowEdit: false,
16
- allowDelete: false,
17
- allowRead: true,
18
- };
19
-
20
- const BASERECORD = {
21
- is_system: true,
22
- type: "validation_rule",
23
- record_permissions: PERMISSIONS
24
- };
25
-
26
- const addObjectValidationRule = function(objectName: string, json: any){
27
- if(!_ValidationRules[objectName]){
28
- _ValidationRules[objectName] = []
29
- }
30
- _ValidationRules[objectName].push(Object.assign({}, json, clone(BASERECORD), {_id: `${objectName}.${json.name}`}))
31
- }
32
-
33
- export const getObjectValidationRules = function(objectName: string){
34
-
35
- return clone(_ValidationRules[objectName])
36
- }
37
-
38
- export const getAllObjectValidationRules = function(){
39
-
40
- let result = [];
41
-
42
- for(let objectName in _ValidationRules){
43
- let objectValidationRules = _ValidationRules[objectName]
44
- result = result.concat(clone(objectValidationRules));
45
- }
46
-
47
- return result;
48
- }
49
-
50
- export const getObjectValidationRule = function(objectName: string, validationRuleName: string){
51
- const objectValidationRules = getObjectValidationRules(objectName);
52
- if(objectValidationRules){
53
- return _.find(objectValidationRules, function(validationRule){
54
- return validationRule.name === validationRuleName
55
- })
56
- }
57
- }
58
-
59
- export const addObjectValidationRuleConfig = (objectName: string, json: any) => {
60
- if (!json.name) {
61
- throw new Error('missing attribute name')
62
- }
63
- addObjectValidationRule(objectName, json);
64
- }
65
-
66
- export const removePackageValidationRules = (serviceName: string)=>{
67
- _.each(_ValidationRules, (roles, objectName)=>{
68
- _ValidationRules[objectName] = lodash.filter(roles, function(role) { return role.metadataServiceName != serviceName; });
69
- })
70
- }
71
-
72
- export const loadObjectValidationRules = function (filePath: string, serviceName: string){
73
- let validationRuleJsons = util.loadValidationRules(filePath);
74
- validationRuleJsons.forEach(element => {
75
- addObjectValidationRuleConfig(element.object_name, Object.assign(element, {metadataServiceName: serviceName}));
76
- });
77
- }
@@ -1,114 +0,0 @@
1
- import { Dictionary } from '@salesforce/ts-types';
2
- const _ = require('underscore');
3
- const clone = require('clone');
4
- var util = require('../util');
5
-
6
- const PERMISSIONS = {
7
- allowEdit: false,
8
- allowDelete: false,
9
- allowRead: true,
10
- };
11
-
12
- const BASERECORD = {
13
- is_system: true,
14
- record_permissions: PERMISSIONS
15
- };
16
-
17
- const _WorkflowNotifications: Dictionary<any> = {};
18
- const _WorkflowRules: Dictionary<any> = {};
19
- const _ActionFieldUpdates: Dictionary<any> = {};
20
-
21
- const addWorkflow = function(json){
22
- if(!json.name){
23
- throw new Error('missing attribute name');
24
- }
25
- if(json.notifications){
26
- for(let notification of json.notifications){
27
- if(!notification.name){
28
- throw new Error('missing attribute notification.name');
29
- }
30
- _WorkflowNotifications[notification.name] = Object.assign({}, notification, clone(BASERECORD), {type: "workflow_notifications", _id: notification.name});
31
- }
32
- }
33
- if(json.rules){
34
- for(let rule of json.rules){
35
- if(!rule.name){
36
- throw new Error('missing attribute rule.name');
37
- }
38
- _WorkflowRules[rule.name] = Object.assign({}, rule, clone(BASERECORD), {type: "workflow_rule", _id: rule.name});
39
- }
40
- }
41
- if(json.fieldUpdates){
42
- for(let fieldUpdate of json.fieldUpdates){
43
- if(!fieldUpdate.name){
44
- throw new Error('missing attribute fieldUpdate.name');
45
- }
46
- _ActionFieldUpdates[fieldUpdate.name] = Object.assign({}, fieldUpdate, clone(BASERECORD), {type: "action_field_updates", _id: fieldUpdate.name});
47
- }
48
- }
49
-
50
- }
51
-
52
- export const loadSourceWorkflows = function (filePath: string){
53
- let workflows = util.loadWorkflows(filePath);
54
- workflows.forEach(element => {
55
- addWorkflow(element);
56
- });
57
- }
58
-
59
- export const getWorkflowNotifications = function(){
60
- return clone(_WorkflowNotifications) || [];
61
- }
62
-
63
- export const getWorkflowRules = function(){
64
- return clone(_WorkflowRules) || [];
65
- }
66
-
67
- export const getActionFieldUpdates = function(){
68
- return clone(_ActionFieldUpdates) || [];
69
- }
70
-
71
- export const getAllWorkflowNotifications = function(){
72
- let workflowNotifications = getWorkflowNotifications();
73
- return _.values(workflowNotifications);
74
- }
75
-
76
- export const getAllWorkflowRules = function(){
77
- let workflowRules = getWorkflowRules();
78
- return _.values(workflowRules);
79
- }
80
-
81
- export const getAllActionFieldUpdates = function(){
82
- let actionFieldUpdates = getActionFieldUpdates();
83
- return _.values(actionFieldUpdates);
84
- }
85
-
86
- export const getObjectWorkflowNotifications = function(objName){
87
- return _.where(getAllWorkflowNotifications(), {object_name: objName});
88
- }
89
-
90
- export const getObjectWorkflowRules = function(objName){
91
- return _.where(getAllWorkflowRules(), {object_name: objName});
92
- }
93
-
94
- export const getObjectActionFieldUpdates = function(objName){
95
- return _.where(getAllActionFieldUpdates(), {object_name: objName});
96
- }
97
-
98
- export const getWorkflowNotification = function(name){
99
- return _.find(getAllWorkflowNotifications(), function (item){
100
- return item.name === name
101
- });
102
- }
103
-
104
- export const getWorkflowRule = function(name){
105
- return _.find(getAllWorkflowRules(), function (item){
106
- return item.name === name
107
- });
108
- }
109
-
110
- export const getActionFieldUpdate = function(name){
111
- return _.find(getAllActionFieldUpdates(), function (item){
112
- return item.name === name
113
- });
114
- }
@@ -1,111 +0,0 @@
1
- import { SteedosUserSession } from '../'
2
- declare var TAPi18n;
3
-
4
- const hasOwn = Object.prototype.hasOwnProperty;
5
- const inherits = function (Child, Parent) {
6
- // copy Parent static properties
7
- for (var key in Parent) {
8
- // make sure we only copy hasOwnProperty properties vs. prototype
9
- // properties
10
- if (hasOwn.call(Parent, key)) {
11
- Child[key] = Parent[key];
12
- }
13
- }
14
-
15
- // a middle member of prototype chain: takes the prototype from the Parent
16
- var Middle = function () {
17
- this.constructor = Child;
18
- };
19
- Middle.prototype = Parent.prototype;
20
- Child.prototype = new Middle();
21
- Child.__super__ = Parent.prototype;
22
- return Child;
23
- };
24
-
25
- const getLocale = (userLocale: string)=>{
26
- let locale: string;
27
- if (userLocale === 'zh-cn') {
28
- locale = "zh-CN";
29
- } else if (userLocale == 'en-us') {
30
- locale = "en";
31
- } else {
32
- locale = "zh-CN";
33
- }
34
- return locale;
35
- }
36
-
37
- // declare type SteedosFunctionErrorType = (error: string, reason: string, details: string) => void;
38
- const i18nError = function (key?: string, userSession?: SteedosUserSession, i18nOptions?: any){
39
- if(key){
40
- let lng = 'en';
41
- if(userSession){
42
- lng = getLocale(userSession.locale);
43
- return TAPi18n.__(key, i18nOptions, lng);
44
- }
45
- }
46
- return key;
47
- }
48
- const SteedosFunctionError = function (error: string, reason?: string, details?: string, userSession?: SteedosUserSession, i18nOptions?: any) {
49
-
50
- var self = this;
51
- // Newer versions of DDP use this property to signify that an error
52
- // can be sent back and reconstructed on the calling client.
53
- self.isClientSafe = true;
54
-
55
- // String code uniquely identifying this kind of error.
56
- self.error = i18nError(error, userSession, i18nOptions);
57
-
58
- // Optional: A short human-readable summary of the error. Not
59
- // intended to be shown to end users, just developers. ("Not Found",
60
- // "Internal Server Error")
61
- self.reason = i18nError(reason, userSession, i18nOptions);
62
-
63
- // Optional: Additional information about the error, say for
64
- // debugging. It might be a (textual) stack trace if the server is
65
- // willing to provide one. The corresponding thing in HTTP would be
66
- // the body of a 404 or 500 response. (The difference is that we
67
- // never expect this to be shown to end users, only developers, so
68
- // it doesn't need to be pretty.)
69
- self.details = i18nError(details, userSession, i18nOptions);
70
-
71
- // This is what gets displayed at the top of a stack trace. Current
72
- // format is "[404]" (if no reason is set) or "File not found [404]"
73
- if (self.reason)
74
- self.message = self.reason + ' [' + self.error + ']';
75
- else{
76
- // self.message = '[' + self.error + ']';
77
- self.message = self.error;
78
- }
79
-
80
- }
81
-
82
- const makeErrorType = function (name, constructor) : (error: string, reason?: string, details?: string, userSession?: SteedosUserSession, i18nOptions?: any) => void {
83
- var errorClass = function (/*arguments*/) {
84
- // Ensure we get a proper stack trace in most Javascript environments
85
- if (Error.captureStackTrace) {
86
- // V8 environments (Chrome and Node.js)
87
- Error.captureStackTrace(this, errorClass);
88
- } else {
89
- // Borrow the .stack property of a native Error object.
90
- this.stack = new Error().stack;
91
- }
92
- // Safari magically works.
93
-
94
- constructor.apply(this, arguments);
95
-
96
- this.errorType = name;
97
- };
98
-
99
- inherits(errorClass, Error);
100
-
101
- return errorClass;
102
- }
103
-
104
- export const SteedosError = makeErrorType(
105
- "Steedos.Error",
106
- SteedosFunctionError
107
- );
108
-
109
- export const sendError = function(res: any, error: any, status = 500){
110
- return res.status(status).send({state: 'FAILURE', error: error.message});
111
- }