@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,146 +0,0 @@
1
- import { getSteedosSchema, SteedosActionTypeConfig } from '../types'
2
- import { Dictionary } from '@salesforce/ts-types';
3
- import { getObjectConfig } from '../types'
4
- import _ = require('lodash');
5
- var util = require('../util');
6
- var clone = require('clone');
7
-
8
- const _lazyLoadActions: Dictionary<any> = {};
9
-
10
- const _actionScripts: Dictionary<any> = {};
11
-
12
- const addActionScripts = function(json: SteedosActionTypeConfig){
13
- if (!json.listenTo) {
14
- console.log('json', json);
15
- throw new Error('missing attribute listenTo');
16
- }
17
- let object_name = getListenTo(json);
18
- if(!_actionScripts[object_name]){
19
- _actionScripts[object_name] = []
20
- }
21
- _actionScripts[object_name].push(json)
22
- }
23
-
24
- const getActionScripts = function(objectName: string){
25
- return _actionScripts[objectName]
26
- }
27
-
28
- export const loadActionScripts = function(objectName: string){
29
- let scripts = getActionScripts(objectName);
30
- _.each(scripts, function(script){
31
- addObjectActionConfig(clone(script));
32
- })
33
- }
34
-
35
- const addLazyLoadActions = function(objectName: string, json: SteedosActionTypeConfig){
36
- if(!_lazyLoadActions[objectName]){
37
- _lazyLoadActions[objectName] = []
38
- }
39
- _lazyLoadActions[objectName].push(json)
40
- }
41
-
42
- const getLazyLoadActions = function(objectName: string){
43
- return _lazyLoadActions[objectName]
44
- }
45
-
46
- const getListenTo = function(json: SteedosActionTypeConfig){
47
- if (!json.listenTo) {
48
- console.log('json', json);
49
- throw new Error('missing attribute listenTo');
50
- }
51
-
52
- if (!_.isString(json.listenTo) && !_.isFunction(json.listenTo)) {
53
- throw new Error('listenTo must be a function or string')
54
- }
55
-
56
- let listenTo: string = '';
57
-
58
- if (_.isString(json.listenTo)) {
59
- listenTo = json.listenTo
60
- } else if (_.isFunction(json.listenTo)) {
61
- listenTo = json.listenTo()
62
- }
63
- return listenTo;
64
- }
65
-
66
- export const loadObjectLazyActions = function(objectName: string){
67
- let actions = getLazyLoadActions(objectName);
68
- _.each(actions, function(action){
69
- addObjectActionConfig(clone(action));
70
- })
71
- }
72
-
73
- export const addObjectActionConfig = (json: SteedosActionTypeConfig)=>{
74
- let object_name = getListenTo(json);
75
- let object = getObjectConfig(object_name);
76
- if (object) {
77
- if(!object.listeners){
78
- object.listeners = {}
79
- }
80
- _.each(object.actions, function(action, key){
81
- if(!_.has(action, '_id') || action._id === key || !action.todo){
82
- if (json[key]) {
83
- action.todo = json[key];
84
- }
85
- }
86
- if(json[`${key}Visible`]){
87
- action.visible = json[`${key}Visible`]
88
- }
89
- })
90
- } else {
91
- // throw new Error(`Error add action, object not found: ${object_name}`);
92
- addLazyLoadActions(object_name, json)
93
- }
94
- }
95
-
96
- export const loadObjectActions = async function (filePath: string, serviceName: string){
97
- let actions = util.loadActions(filePath)
98
- _.each(actions, (json: SteedosActionTypeConfig) => {
99
- addObjectActionConfig(json);
100
- })
101
- let buttonScripts = util.loadButtonScripts(filePath)
102
- _.each(buttonScripts, (json: SteedosActionTypeConfig) => {
103
- addObjectActionConfig(json);
104
- addActionScripts(json);
105
- })
106
-
107
- for await (const action of actions) {
108
- await addObjectActionConfigMetadata(action, serviceName, true)
109
- }
110
-
111
- for await (const buttonScript of buttonScripts) {
112
- await addObjectActionConfigMetadata(buttonScript, serviceName, true)
113
- }
114
- }
115
-
116
- async function addObjectActionConfigMetadata(config: any, serviceName: string, isScript?: boolean){
117
- const actions = {};
118
- let apiKey = config.name || config._id
119
- let object_name = getListenTo(config);
120
- if(isScript){
121
- const keys = _.keys(config);
122
- _.each(keys, (key)=>{
123
- if(key.endsWith('Visible')){
124
- if(_.isFunction(config[key])){
125
- const _key = key.replace(/(.*)Visible/,'$1');
126
- if(!actions[_key]){
127
- actions[_key] = {};
128
- }
129
- actions[_key]._visible = config[key].toString();
130
- }
131
- }else{
132
- if(_.isFunction(config[key])){
133
- if(!actions[key]){
134
- actions[key] = {};
135
- }
136
- actions[key].todo = config[key].toString();
137
- actions[key]._todo = config[key].toString();
138
- }
139
- }
140
- })
141
- }else{
142
- actions[apiKey] = config
143
- }
144
- if(serviceName)
145
- await getSteedosSchema().metadataRegister.addObjectConfig(serviceName, Object.assign({extend: object_name}, {actions: actions}));
146
- }
@@ -1,73 +0,0 @@
1
- // import { addConfig, getConfig, getConfigs } from '../types';
2
- import { Dictionary } from '@salesforce/ts-types';
3
- const _ = require('underscore');
4
- const clone = require('clone');
5
- var util = require('../util');
6
-
7
- const PERMISSIONS = {
8
- allowEdit: false,
9
- allowDelete: false,
10
- allowRead: true,
11
- };
12
-
13
- const BASERECORD = {
14
- is_system: true,
15
- type: "process_definition",
16
- record_permissions: PERMISSIONS
17
- };
18
-
19
- const BASERECORD_NODE = {
20
- is_system: true,
21
- type: "process_node",
22
- record_permissions: PERMISSIONS
23
- };
24
-
25
- const _ApprovalProcesses: Dictionary<any> = {};
26
- // const APPROVAL_PROCESSES_KEY = 'APPROVAL_PROCESSES';
27
-
28
- const addApprovalProcess = function(json){
29
- if(!json.name){
30
- throw new Error('missing attribute name');
31
- }
32
-
33
- if(json.process_nodes){
34
- for(let i=0; i<json.process_nodes.length; i++ ){
35
- let processNode = json.process_nodes[i];
36
- if(!processNode.name){
37
- throw new Error('missing attribute name in process_node');
38
- }
39
- json.process_nodes[i] = Object.assign({}, processNode, clone(BASERECORD_NODE), {_id: `${json.name}.${processNode.name}`})
40
- }
41
- }
42
- _ApprovalProcesses[json.name] = Object.assign({}, json, clone(BASERECORD), {_id: json.name});
43
- }
44
- export const getSourceApprovalProcessesKeys = function(){
45
- return _.pluck(getSourceApprovalProcesses(), 'name');
46
- }
47
-
48
- export const getSourceApprovalProcess = function(name){
49
- return getSourceApprovalProcesses()[name];
50
- }
51
-
52
- export const getSourceApprovalProcesses = function(){
53
- return clone(_ApprovalProcesses);
54
- }
55
-
56
- export const getSourceProcessNode = function(processDefinitionName, processNodeName){
57
-
58
- let processDefinition = getSourceApprovalProcess(processDefinitionName);
59
- let processNodes = processDefinition.process_nodes;
60
-
61
- for(let item of processNodes){
62
- if(item.name === processNodeName){
63
- return item
64
- }
65
- }
66
- }
67
-
68
- export const loadSourceApprovalProcesses = function (filePath: string){
69
- let approvalProcesses = util.loadApprovalProcesses(filePath);
70
- approvalProcesses.forEach(element => {
71
- addApprovalProcess(element);
72
- });
73
- }
@@ -1,75 +0,0 @@
1
- import { getSteedosSchema, SteedosActionTypeConfig } from '../types'
2
- import { Dictionary } from '@salesforce/ts-types';
3
- import { getObjectConfig } from '../types'
4
- import _ = require('lodash');
5
- import { overrideOriginalObject } from './originalObject';
6
- var util = require('../util');
7
- var clone = require('clone');
8
-
9
- const _lazyLoadButtons: Dictionary<any> = {};
10
-
11
- export const addLazyLoadButtons = function(objectName: string, json: SteedosActionTypeConfig){
12
- if(!_lazyLoadButtons[objectName]){
13
- _lazyLoadButtons[objectName] = []
14
- }
15
- _lazyLoadButtons[objectName].push(json)
16
- }
17
-
18
- export const getLazyLoadButtons = function(objectName: string){
19
- return _lazyLoadButtons[objectName]
20
- }
21
-
22
- export const loadObjectLazyButtons = function(objectName: string){
23
- let buttons = getLazyLoadButtons(objectName);
24
- _.each(buttons, function(button){
25
- addObjectButtonsConfig(objectName, clone(button));
26
- })
27
- }
28
-
29
-
30
- export const addObjectButtonsConfig = (objectName: string, json: SteedosActionTypeConfig) => {
31
- if (!json.name) {
32
- throw new Error('missing attribute name: ' + (json as any)?.__filename)
33
- }
34
-
35
- let object = getObjectConfig(objectName);
36
- if (object) {
37
- if(!object.actions){
38
- object.actions = {}
39
- }
40
- util.extend(object.actions, {[json.name]: json});
41
- overrideOriginalObject(objectName, {actions: {[json.name]: json}});
42
- } else {
43
- addLazyLoadButtons(objectName, json);
44
- }
45
- }
46
-
47
- export const removeObjectButtonsConfig = (objectName: string, json: SteedosActionTypeConfig)=>{
48
- if (!json.name) {
49
- throw new Error('missing attribute name: ' + (json as any)?.__filename)
50
- }
51
- let object = getObjectConfig(objectName);
52
- if(object.actions){
53
- delete object.actions[json.name]
54
-
55
- }
56
- }
57
-
58
- export const loadObjectButtons = async function (filePath: string, serviceName: string){
59
- let buttonJsons = util.loadButtons(filePath);
60
- buttonJsons.forEach(element => {
61
- addObjectButtonsConfig(element.object_name, element);
62
- });
63
- if(serviceName)
64
- for await (const buttonJson of buttonJsons) {
65
- await getSteedosSchema().metadataRegister.addObjectConfig(serviceName, Object.assign({extend: buttonJson.object_name}, {actions: {[buttonJson.name]: buttonJson}}));
66
- }
67
- }
68
-
69
- export const removeLazyLoadButton = function (objectName: string, json: SteedosActionTypeConfig) {
70
- let objectButtons = _lazyLoadButtons[objectName];
71
- if(objectButtons){
72
- let btnIndex = _.findIndex(objectButtons, { name: json.name});
73
- objectButtons.splice(btnIndex, 1);
74
- }
75
- }
@@ -1,22 +0,0 @@
1
- import { LoadChartFile } from '@steedos/metadata-core';
2
- import { registerChart } from '../metadata-register/chart';
3
- import { getSteedosSchema } from '../types'
4
- const loadChartFile = new LoadChartFile();
5
-
6
- export const registerPackageCharts = async (packagePath: string, packageServiceName: string)=>{
7
- const charts = loadChartFile.load(packagePath);
8
- const schema = getSteedosSchema();
9
- const data = [];
10
- for (const apiName in charts) {
11
- const chart = charts[apiName];
12
- data.push(Object.assign(chart, {
13
- is_system: true, record_permissions: {
14
- allowEdit: false,
15
- allowDelete: false,
16
- allowRead: true,
17
- }}))
18
- }
19
- if (data.length > 0) {
20
- await registerChart.mregister(schema.broker, packageServiceName, data)
21
- }
22
- }
@@ -1,65 +0,0 @@
1
- /*
2
- * @Author: baozhoutao@steedos.com
3
- * @Date: 2022-06-14 18:43:07
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2022-06-14 19:08:42
6
- * @Description:
7
- */
8
- import _ = require('lodash')
9
- import path = require('path')
10
- import fs = require('fs')
11
- const globby = require('globby');
12
- const babel = require("@babel/core");
13
-
14
- const { getCacher } = require('@steedos/cachers');
15
-
16
- const CACHER_NAME = 'client-scripts';
17
-
18
- export const getClientScripts = () => {
19
- const cacher = getCacher(CACHER_NAME);
20
- let scripts = "";
21
-
22
- _.each(cacher.values(), (value)=>{
23
- scripts = scripts + value;
24
- });
25
- return scripts;
26
- }
27
-
28
- export const loadPackageClientScripts = (packageName, packageDir)=>{
29
- const cacher = getCacher(CACHER_NAME);
30
- const filePatten = [
31
- path.join(packageDir, "*.client.js"),
32
- "!" + path.join(packageDir, "node_modules"),
33
- ];
34
- let packageClientScripts = "";
35
- let matchedPaths: Array<string> = globby.sync(filePatten);
36
- matchedPaths = _.sortBy(matchedPaths);
37
- _.each(matchedPaths, (matchedPath) => {
38
- let code = fs.readFileSync(matchedPath, 'utf8');
39
- packageClientScripts = packageClientScripts + '\r\n;' + code + '\r\n;'
40
- });
41
-
42
- if(packageClientScripts){
43
- try {
44
- cacher.set(packageName, babel.transformSync(packageClientScripts, {
45
- sourceType: "script", //移除安全模式
46
- presets: [
47
- [
48
- "@babel/preset-env"
49
- ]
50
- ],
51
- targets: {
52
- chrome: "73",
53
- }
54
- }).code)
55
- } catch (error) {
56
- console.error(`loadPackageClientScripts:${packageName}, Error:`, error)
57
- }
58
- }
59
- }
60
-
61
- export const deletePackageClientScripts = (packageName)=>{
62
- const cacher = getCacher(CACHER_NAME);
63
- cacher.delete(packageName);
64
- }
65
-
@@ -1,77 +0,0 @@
1
- import { getSteedosSchema, SteedosFieldTypeConfig } from '../types'
2
- import { Dictionary } from '@salesforce/ts-types';
3
- import { getObjectConfig, getOriginalObjectConfig } from '../types'
4
- import _ = require('lodash');
5
- var util = require('../util');
6
- var clone = require('clone');
7
-
8
- const _lazyLoadFields: Dictionary<any> = {};
9
-
10
- const addLazyLoadFields = function(objectName: string, json: SteedosFieldTypeConfig){
11
- if(!_lazyLoadFields[objectName]){
12
- _lazyLoadFields[objectName] = []
13
- }
14
- _lazyLoadFields[objectName].push(json)
15
- }
16
-
17
- export const getLazyLoadFields = function(objectName: string){
18
- return _lazyLoadFields[objectName]
19
- }
20
-
21
- export const loadObjectLazyFields = function(objectName: string){
22
- let fields = getLazyLoadFields(objectName);
23
- _.each(fields, function(field){
24
- addObjectFieldConfig(objectName, clone(field));
25
- })
26
- }
27
-
28
- export const addObjectFieldConfig = (objectName: string, json: SteedosFieldTypeConfig) => {
29
- if (!json.name) {
30
- throw new Error('missing attribute name: ' + (json as any)?.__filename)
31
- }
32
- let object = getObjectConfig(objectName);
33
- let originalObject = getOriginalObjectConfig(objectName);
34
- if (object) {
35
- if(!object.fields){
36
- object.fields = {}
37
- }
38
- util.extend(object.fields, {[json.name]: json})
39
- util.extend(originalObject.fields, {[json.name]: json})
40
-
41
- let _mf = _.maxBy(_.values(object.fields), function (field) { return field.sort_no; });
42
- if(_mf && object.name){
43
- object.fields_serial_number = _mf.sort_no + 10;
44
- }
45
-
46
- } else {
47
- addLazyLoadFields(objectName, json);
48
- }
49
- }
50
-
51
- export const removeObjectFieldConfig = (objectName: string, json: SteedosFieldTypeConfig)=>{
52
- if (!json.name) {
53
- throw new Error('missing attribute name: ' + (json as any)?.__filename)
54
- }
55
- let object = getObjectConfig(objectName);
56
- let originalObject = getOriginalObjectConfig(objectName);
57
- if (object) {
58
- if(object.fields){
59
- delete object.fields[json.name]
60
- delete originalObject.fields[json.name]
61
- }
62
- }
63
- }
64
-
65
- export const loadObjectFields = async function (filePath: string, serviceName?: string){
66
- let fieldJsons = util.loadFields(filePath);
67
- fieldJsons.forEach(element => {
68
- addObjectFieldConfig(element.object_name, element);
69
- });
70
- if(serviceName)
71
- for await (const fieldJson of fieldJsons) {
72
- await getSteedosSchema().metadataRegister.addObjectConfig(serviceName, Object.assign({extend: fieldJson.object_name}, {fields: {
73
- [fieldJson.name]: fieldJson
74
- }}));
75
- }
76
-
77
- }
@@ -1,46 +0,0 @@
1
- import { addConfig, getConfig, getConfigs } from '../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
- type: "flowRole",
15
- record_permissions: PERMISSIONS
16
- };
17
-
18
- const FLOWROLES_KEY = 'FLOWROLES';
19
-
20
- const addFlowRole = function(json){
21
- if(!json.name){
22
- throw new Error('missing attribute name');
23
- }
24
- if(!json.api_name){
25
- throw new Error('missing attribute api_name');
26
- }
27
- addConfig(FLOWROLES_KEY, Object.assign({}, json, clone(BASERECORD), {_id: json.api_name}));
28
- }
29
- export const getSourceFlowRolesKeys = function(){
30
- return _.pluck(getSourceFlowRoles(), 'api_name');
31
- }
32
-
33
- export const getSourceFlowRole = function(api_name){
34
- return clone(getConfig(FLOWROLES_KEY, api_name));
35
- }
36
-
37
- export const getSourceFlowRoles = function(){
38
- return clone(getConfigs(FLOWROLES_KEY)) || [];
39
- }
40
-
41
- export const loadSourceFlowRoles = function (filePath: string){
42
- let flowRoles = util.loadFlowRoles(filePath);
43
- flowRoles.forEach(element => {
44
- addFlowRole(element);
45
- });
46
- }
@@ -1,21 +0,0 @@
1
- export * from './field'
2
- export * from './listview'
3
- export * from './button'
4
- export * from './method'
5
- export * from './actions'
6
- export * from './trigger'
7
- export * from './layout'
8
- export * from './preload_data'
9
- export * from './permission'
10
- export * from './profile'
11
- export * from './permissionset'
12
- export * from './translations'
13
- export * from './object_translations'
14
- export * from './validation_rule'
15
- export * from './role'
16
- export * from './flow_role'
17
- export * from './approval_process'
18
- export * from './workflow'
19
- export * from "./tabs"
20
- export * from "./package"
21
- export * from './client_script'
@@ -1,53 +0,0 @@
1
- import { Dictionary } from '@salesforce/ts-types';
2
- import { getSteedosSchema } from '..';
3
- const _ = require('underscore');
4
- var util = require('../util');
5
-
6
- const _Layouts: Dictionary<any> = {};
7
-
8
- const addLayouts = function(objectName: string, json: any){
9
- if(!_Layouts[objectName]){
10
- _Layouts[objectName] = []
11
- }
12
- _Layouts[objectName].push(json)
13
- }
14
-
15
- export const getLayouts = function(objectName: string){
16
- return _Layouts[objectName]
17
- }
18
-
19
- export const getLayout = function(objectName: string, layoutName: string){
20
- const objectLayouts = getLayouts(objectName);
21
- if(objectLayouts){
22
- return _.find(objectLayouts, function(layout){
23
- return layout.name === layoutName
24
- })
25
- }
26
- }
27
-
28
- export const addObjectLayoutConfig = (objectName: string, json: any) => {
29
- if (!json.name) {
30
- throw new Error('missing attribute name: ' + (json as any)?.__filename)
31
- }
32
- addLayouts(objectName, json);
33
- }
34
-
35
- export const loadObjectLayouts = async function (filePath: string, serviceName: string){
36
- let layoutJsons = util.loadLayouts(filePath);
37
- layoutJsons.forEach(element => {
38
- addObjectLayoutConfig(element.object_name, element);
39
- });
40
-
41
- if(serviceName){
42
- for await (const layoutJson of layoutJsons) {
43
- await loadObjectLayoutMetadata(layoutJson, serviceName);
44
- }
45
- }
46
- }
47
-
48
- export const loadObjectLayoutMetadata = async function(layoutJson, serviceName?){
49
- if(serviceName){
50
- const schema = getSteedosSchema();
51
- await schema.metadataRegister?.addLayout(serviceName, layoutJson);
52
- }
53
- }
@@ -1,57 +0,0 @@
1
- import { getSteedosSchema, SteedosObjectListViewTypeConfig } from '../types'
2
- import { Dictionary } from '@salesforce/ts-types';
3
- import { getObjectConfig } from '../types';
4
- import { overrideOriginalObject } from './originalObject';
5
- import _ = require('lodash');
6
- var util = require('../util');
7
- var clone = require('clone');
8
-
9
- const _lazyLoadListViews: Dictionary<any> = {};
10
-
11
- const addLazyLoadListViews = function(objectName: string, json: SteedosObjectListViewTypeConfig){
12
- if(!_lazyLoadListViews[objectName]){
13
- _lazyLoadListViews[objectName] = []
14
- }
15
- _lazyLoadListViews[objectName].push(json)
16
- }
17
-
18
- const getLazyLoadListViews = function(objectName: string){
19
- return _lazyLoadListViews[objectName]
20
- }
21
-
22
- export const loadObjectLazyListViews = function(objectName: string){
23
- let listViews = getLazyLoadListViews(objectName);
24
- _.each(listViews, function(listView){
25
- addObjectListViewConfig(objectName, clone(listView));
26
- })
27
- }
28
-
29
- export const addObjectListViewConfig = (objectName: string, json: SteedosObjectListViewTypeConfig) => {
30
- if (!json.name) {
31
- throw new Error('missing attribute name: ' + (json as any)?.__filename)
32
- }
33
-
34
- let object = getObjectConfig(objectName);
35
- if (object) {
36
- if(!object.list_views){
37
- object.list_views = {}
38
- }
39
- util.extend(object.list_views, {[json.name]: json});
40
- overrideOriginalObject(objectName, {list_views: {[json.name]: json}});
41
- } else {
42
- addLazyLoadListViews(objectName, json);
43
- }
44
- }
45
-
46
- export const loadObjectListViews = async function (filePath: string, serviceName: string){
47
- let listViewJsons = util.loadListViews(filePath);
48
- listViewJsons.forEach(element => {
49
- addObjectListViewConfig(element.object_name, element);
50
- });
51
- if(serviceName)
52
- for await (const listViewJson of listViewJsons) {
53
- await getSteedosSchema().metadataRegister.addObjectConfig(serviceName, Object.assign({extend: listViewJson.object_name}, {list_views: {
54
- [listViewJson.name]: listViewJson
55
- }}));
56
- }
57
- }