@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,52 +0,0 @@
1
- import { SteedosObjectType } from "./object";
2
- import _ = require('underscore')
3
-
4
- export type SteedosActionTypeConfig = {
5
- _id?: string,
6
- listenTo?: string | Function,
7
- name?: string
8
- label?: string,
9
- visible?: boolean | Function
10
- on?: 'list' | 'record' | 'record_more'
11
- todo?: string | Function
12
- }
13
-
14
-
15
- export class SteedosActionType {
16
- private properties: string[] = ['name']
17
- private _name: string;
18
-
19
- private _object: SteedosObjectType;
20
-
21
- constructor(name: string, object: SteedosObjectType, config: SteedosActionTypeConfig){
22
- this._object = object
23
-
24
- _.each(config, (value: any, key: string)=>{
25
- if(key != 'object'){
26
- this[key] = value
27
- this.properties.push(key)
28
- }
29
- })
30
-
31
- this.name = name
32
- }
33
-
34
- toConfig(){
35
- let config = {}
36
- this.properties.forEach((property)=>{
37
- config[property] = this[property]
38
- })
39
- return config
40
- }
41
-
42
- public get name(): string {
43
- return this._name;
44
- }
45
- public set name(value: string) {
46
- this._name = value;
47
- }
48
-
49
- public get object(): SteedosObjectType {
50
- return this._object;
51
- }
52
- }
package/src/types/app.ts DELETED
@@ -1,280 +0,0 @@
1
- import { SteedosDataSourceType, getConfigsFormFiles, getSteedosSchema, getObject } from '.';
2
- import { getConfigs } from './config';
3
- import _ = require('underscore');
4
- import * as _l from 'lodash';
5
- export type SteedosAppTypeConfig = {
6
- _id: string,
7
- name: string,
8
- description: string,
9
- icon_slds: string,
10
- objects: string[],
11
- mobile_objects?: string[],
12
- admin_menus?: any
13
- }
14
-
15
- export class SteedosAppType{
16
- private _datasource: SteedosDataSourceType;
17
- public get datasource(): SteedosDataSourceType {
18
- return this._datasource;
19
- }
20
- private __id: string;
21
- public get _id(): string {
22
- return this.__id;
23
- }
24
- public set _id(value: string) {
25
- this.__id = value;
26
- }
27
- private _name: string;
28
- public get name(): string {
29
- return this._name;
30
- }
31
- public set name(value: string) {
32
- this._name = value;
33
- }
34
- private _description: string;
35
- public get description(): string {
36
- return this._description;
37
- }
38
- public set description(value: string) {
39
- this._description = value;
40
- }
41
- private _icon_slds: string;
42
- public get icon_slds(): string {
43
- return this._icon_slds;
44
- }
45
- public set icon_slds(value: string) {
46
- this._icon_slds = value;
47
- }
48
- private _objects: string[];
49
- public get objects(): string[] {
50
- return this._objects;
51
- }
52
- public set objects(value: string[]) {
53
- this._objects = value;
54
- }
55
-
56
- private _is_creator: boolean;
57
- public get is_creator(): boolean {
58
- return this._is_creator;
59
- }
60
-
61
- private _mobile_objects: string[];
62
- public get mobile_objects(): string[] {
63
- return this._mobile_objects;
64
- }
65
- public set mobile_objects(value: string[]) {
66
- this._mobile_objects = value;
67
- }
68
-
69
- private properties: string[] = ['is_creator']
70
-
71
- constructor(config: SteedosAppTypeConfig, datasource: SteedosDataSourceType){
72
- this._datasource = datasource
73
- this._is_creator = true
74
- this._id = config._id
75
- _.each(config, (value: any, key: string)=>{
76
- if(key != 'is_creator'){
77
- this[key] = value
78
- this.properties.push(key)
79
- }
80
- })
81
- // this.name = config.name
82
- // this.description = config.description
83
- // this.icon_slds = config.icon_slds
84
- // this.objects = config.objects
85
- // this.mobile_objects = config.mobile_objects
86
- }
87
-
88
- toConfig(){
89
- let config = {}
90
- this.properties.forEach((property)=>{
91
- config[property] = this[property]
92
- })
93
- return config
94
- }
95
-
96
- private transformReferenceTo(reference_to: string, datasource: SteedosDataSourceType): string{
97
- if(_.isString(reference_to)){
98
- if(reference_to.split('.').length = 1){
99
- if(datasource.getObject(reference_to)){
100
- return `${datasource.name}.${reference_to}`
101
- }
102
- }
103
- }
104
- return reference_to
105
- }
106
-
107
- transformReferenceOfObject(){
108
- let datasource = this._datasource;
109
- if(datasource.name != 'meteor'){
110
- if(_.isArray(this.objects)){
111
- let objects: string[] = []
112
- _.each(this.objects, (object_name)=>{
113
- objects.push(this.transformReferenceTo(object_name, datasource))
114
- })
115
- this.objects = objects;
116
- }
117
- }
118
- }
119
- }
120
-
121
- export async function addAppConfigFiles(filePath: string, serviceName: string){
122
- const configs = getConfigsFormFiles('app', filePath);
123
- for (const config of configs) {
124
- await addAppConfig(config, serviceName);
125
- }
126
- }
127
-
128
- export const addAppConfig = async (appConfig: SteedosAppTypeConfig, serviceName: string = '') => {
129
- const schema = getSteedosSchema();
130
- await schema.metadataRegister?.addApp(serviceName, appConfig);
131
- }
132
-
133
- export const getAppConfigs = async (spaceId?) => {
134
- const schema = getSteedosSchema();
135
-
136
- if(!schema.metadataRegister){
137
- return getConfigs('app')
138
- }
139
-
140
- const apps = await schema.metadataRegister.getApps();
141
- const configs = _.pluck(apps, 'metadata');
142
-
143
- if(spaceId){
144
- let _apps = _.filter(configs, function(config){
145
- if(_.has(config, 'space') && config.space){
146
- return config.space === spaceId;
147
- }
148
- return true;
149
- })
150
- const result = [];
151
- _.each(_apps, function(config){
152
- if(!_.has(config, 'code')){
153
- config.code = config._id;
154
- }
155
- const index = _l.findIndex(result, function(item){return item.code === config.code;})
156
- if( index > -1){
157
- const _config = result[index];
158
- if(_config.code === _config._id){
159
- result[index] = config;
160
- }
161
- }else{
162
- result.push(config)
163
- }
164
- })
165
- return result;
166
- }
167
-
168
- return configs;
169
- }
170
-
171
- export const removeApp = async (appApiName) => {
172
- const schema = getSteedosSchema();
173
- return await schema.metadataRegister.removeApp(appApiName);
174
- }
175
-
176
- export const getAppConfig = async (appApiName: string):Promise<SteedosAppTypeConfig> => {
177
- const schema = getSteedosSchema();
178
- const app = await schema.metadataRegister.getApp(appApiName);
179
- return app?.metadata;
180
- }
181
-
182
- const getUserProfileApiName = async (spaceId, userId)=>{
183
- const spaceUsers = await getObject("space_users").find({filters: [['space', '=', spaceId],['user', '=', userId]], fields: ['profile']})
184
- let userProfile = 'user';
185
- if(spaceUsers && spaceUsers.length > 0){
186
- const spaceUser = spaceUsers[0];
187
- if(spaceUser && spaceUser.profile){
188
- userProfile = spaceUser.profile;
189
- }
190
- }
191
- return userProfile;
192
- }
193
-
194
- const getProfile = async (spaceId, profileApiName)=>{
195
- const profiles = await getObject('permission_set').find({filters: [['space', '=', spaceId],['name', '=', profileApiName]]});
196
- return profiles.length > 0 ? profiles[0] : null;
197
- }
198
-
199
- const getUserPermissionSet = async(spaceId, userId, profileApiName?)=>{
200
- let filters = [['space', '=', spaceId], ['users', '=', userId]];
201
- if(profileApiName){
202
- filters = [['space', '=', spaceId], [['users', '=', userId], 'or', ['name', '=', profileApiName]]];
203
- }
204
-
205
- return await getObject('permission_set').find({filters: filters});
206
- }
207
-
208
- export const getAssignedApps = async(userSession)=>{
209
- let apps = [];
210
- const {spaceId, userId, is_space_admin: isSpaceAdmin } = userSession;
211
- if(isSpaceAdmin){
212
- return []
213
- }else{
214
- let userProfileApiName = await getUserProfileApiName(spaceId, userId);
215
- let userProfile = null;
216
- if(userProfileApiName){
217
- userProfile = await getProfile(spaceId, userProfileApiName);
218
- }
219
- if(userProfile?.assigned_apps?.length){
220
- apps = _.union(apps, userProfile.assigned_apps)
221
- }else{
222
- apps = []
223
- }
224
- const psets = await getUserPermissionSet(spaceId, userId, userProfileApiName);
225
- _.each(psets, (pset)=>{
226
- if(!pset.assigned_apps || pset.assigned_apps?.length === 0){
227
- return ;
228
- }
229
- if(pset.name == "admin" || pset.name == "user" || pset.name == 'supplier' || pset.name == 'customer'){
230
- return;
231
- }
232
- apps = _.union(apps, pset.assigned_apps);
233
- })
234
- return _.without(_.uniq(apps),undefined,null)
235
- }
236
- }
237
-
238
- export const getAssignedMenus = async(userSession)=>{
239
- let result = null;
240
- const {spaceId, userId, is_space_admin: isSpaceAdmin, roles } = userSession;
241
- const adminApp = await getAppConfig('admin');
242
- const apps = await getAppConfigs()
243
- let { admin_menus: adminMenus } = adminApp;
244
- if(!adminMenus){
245
- return [];
246
- }
247
-
248
- const aboutMenu = _.find(adminMenus, (menu)=>{
249
- return menu._id == 'about';
250
- })
251
-
252
- adminMenus = _.filter(adminMenus, (menu)=>{
253
- return menu._id != 'about';
254
- })
255
-
256
- const otherMenuApps = _.sortBy(_.filter(apps, (menu)=>{
257
- return menu.admin_menus && menu._id != 'admin'
258
- }), 'sort');
259
-
260
- const otherMenus = _.flatten(_.pluck(otherMenuApps, "admin_menus"));
261
-
262
- // 菜单有三部分组成,设置APP菜单、其他APP菜单以及about菜单
263
- const allMenus = _.union(adminMenus, otherMenus, [aboutMenu]);
264
-
265
- if(isSpaceAdmin){
266
- result = allMenus
267
- }else{
268
- let userProfile = await getUserProfileApiName(spaceId, userId);
269
- const menus = _.filter(allMenus, (menu)=>{
270
- const psetsMenu = menu.permission_sets;
271
- if(psetsMenu && psetsMenu.indexOf(userProfile) > -1){
272
- return true;
273
- }
274
- return _.intersection(roles, psetsMenu).length;
275
- })
276
- result = menus;
277
- }
278
-
279
- return _.sortBy(result,"sort")
280
- }
@@ -1,152 +0,0 @@
1
- import path = require('path')
2
- import _ = require('lodash')
3
- import {loadJsonFiles} from '../util'
4
- import { addAppConfigFiles } from './app';
5
- import { addObjectConfigFiles, addServerScriptFiles, addObjectDataFiles, addRouterFiles } from '.';
6
- import { loadPackageClientScripts } from '../dynamic-load/client_script';
7
- import { addTranslationsFiles, addObjectTranslationsFiles } from '../dynamic-load'
8
- import { registerPackageCharts } from '../dynamic-load/chart';
9
- import { registerPackageQueries } from '../dynamic-load/query';
10
- import { registerPackagePages } from '../dynamic-load/page';
11
- import { registerPackageTabs } from '../dynamic-load/tab';
12
-
13
- import { registerPackageShareRules } from '../dynamic-load/shareRules';
14
- import { registerPackageRestrictionRules } from '../dynamic-load/restrictionRules';
15
-
16
- export const LOADED_OBJECT_RECORDS = {}
17
-
18
-
19
- export function addConfigDataFiles(filePath: string) {
20
- if (!path.isAbsolute(filePath)) {
21
- throw new Error(`${filePath} must be an absolute path`);
22
- }
23
-
24
- const filePatten = [
25
- path.join(filePath, "*.data.yml"),
26
- path.join(filePath, "*.data.js"),
27
- path.join(filePath, "*.data.json"),
28
- "!" + path.join(filePath, "node_modules"),
29
- ];
30
-
31
- let jsons = loadJsonFiles(filePatten);
32
- _.each(jsons, (json: any) => {
33
- let objectName = path.basename(json.file).split(".data.")[0];
34
- _.each(json.data, (record) => {
35
- addConfig(objectName, record);
36
- });
37
- });
38
- }
39
-
40
- export function getConfigsFormFiles(objectName: string, filePath: string) {
41
- if (!path.isAbsolute(filePath)) {
42
- throw new Error(`${filePath} must be an absolute path`);
43
- }
44
-
45
- const filePatten = [
46
- path.join(filePath, `*.${objectName}.yml`),
47
- path.join(filePath, `*.${objectName}.js`),
48
- path.join(filePath, `*.${objectName}.json`),
49
- "!" + path.join(filePath, "node_modules"),
50
- ];
51
-
52
- let jsons = loadJsonFiles(filePatten);
53
- const configs = [];
54
- _.each(jsons, (json: any) => {
55
- let recordId = path.basename(json.file).split(`.${objectName}.`)[0];
56
- if (typeof json.data._id === "undefined") json.data._id = recordId;
57
- configs.push(json.data);
58
- });
59
- return configs;
60
- }
61
-
62
- export function addConfigFiles(objectName: string, filePath: string){
63
- if(!path.isAbsolute(filePath)){
64
- throw new Error(`${filePath} must be an absolute path`);
65
- }
66
-
67
- const filePatten = [
68
- path.join(filePath, `*.${objectName}.yml`),
69
- path.join(filePath, `*.${objectName}.js`),
70
- path.join(filePath, `*.${objectName}.json`),
71
- "!" + path.join(filePath, "node_modules"),
72
- ]
73
-
74
- let jsons = loadJsonFiles(filePatten);
75
- _.each(jsons, (json: any) => {
76
- let recordId = path.basename(json.file).split(`.${objectName}.`)[0]
77
- if (typeof json.data._id === "undefined")
78
- json.data._id = recordId
79
- addConfig(objectName, json.data);
80
- })
81
- }
82
-
83
- export const addConfig = (objectName: string, record: any) => {
84
- if(!record._id){
85
- throw new Error(`Error adding record to ${objectName}, record._id required`);
86
- }
87
- let records = getConfigs(objectName);
88
- _.remove(records, {_id: record._id});
89
- records.push(record)
90
- }
91
-
92
- export const removeConfig = (objectName: string, record: any) => {
93
- if(!record._id){
94
- throw new Error(`Error removing record of ${objectName}, record._id required`);
95
- }
96
- let records = getConfigs(objectName);
97
- _.remove(records, {_id: record._id});
98
- }
99
-
100
- export const removeManyConfigs = (objectName: string, query?: object) => {
101
- let records = getConfigs(objectName);
102
- if(query ){
103
- if(typeof query !== "object"){
104
- throw new Error(`Error removing config of ${objectName}, query should be an object as {properyName: properyValue} just like {type:'abc'}`);
105
- }
106
- _.remove(records, query);
107
- }
108
- else{
109
- // 移除objectName关联的所有数据
110
- _.remove(records);
111
- }
112
- }
113
-
114
- export const getConfigDatabase = (objectName: string) => {
115
- return LOADED_OBJECT_RECORDS
116
- }
117
-
118
- export const getConfigs = (objectName: string) => {
119
- if (!LOADED_OBJECT_RECORDS.hasOwnProperty(objectName))
120
- LOADED_OBJECT_RECORDS[objectName] = []
121
- return LOADED_OBJECT_RECORDS[objectName]
122
- }
123
-
124
- export const getConfig = (objectName: string, _id: string) => {
125
- let records = getConfigs(objectName);
126
- return _.find(records, {_id: _id})
127
- }
128
-
129
- export const addAllConfigFiles = async (filePath, datasourceApiName, serviceName) => {
130
- addRouterFiles(filePath);
131
- await addObjectConfigFiles(filePath, datasourceApiName, serviceName);
132
- await addAppConfigFiles(filePath, serviceName);
133
- await registerPackageQueries(filePath, serviceName);
134
- await registerPackageCharts(filePath, serviceName);
135
- await registerPackagePages(filePath, serviceName);
136
- await registerPackageTabs(filePath, serviceName);
137
- await registerPackageShareRules(filePath, serviceName);
138
- await registerPackageRestrictionRules(filePath, serviceName);
139
-
140
- loadPackageClientScripts(serviceName, filePath);
141
- addServerScriptFiles(filePath);
142
- // addObjectI18nFiles(filePath);
143
- await addTranslationsFiles(filePath);
144
- await addObjectTranslationsFiles(filePath);
145
- // addConfigDataFiles(filePath);
146
- addConfigFiles('report', filePath);
147
- addConfigFiles('flow', filePath);
148
- addConfigFiles('form', filePath);
149
- addConfigFiles('dashboard', filePath);
150
- addObjectDataFiles(filePath);
151
- }
152
-
@@ -1,87 +0,0 @@
1
- import { SteedosDataSourceTypeConfig, getSteedosSchema, SteedosDataSourceType } from "../";
2
- import { getSteedosConfig } from '../util';
3
- import _ = require('lodash');
4
-
5
- export type Connection = SteedosDataSourceType;
6
- export type ConnectionOptions = SteedosDataSourceTypeConfig;
7
-
8
- export function getConnection(datasourceName: string = "meteor") {
9
- return getSteedosSchema().getDataSource(datasourceName);
10
- }
11
-
12
-
13
- /**
14
- * Creates a new connection and registers it in the manager.
15
- * Only one connection from ormconfig will be created (name "default" or connection without name).
16
- */
17
- export async function createConnection(): Promise<Connection>;
18
-
19
- /**
20
- * Creates a new connection from the ormconfig file with a given name.
21
- */
22
- export async function createConnection(name: string): Promise<Connection>;
23
-
24
- /**
25
- * Creates a new connection and registers it in the manager.
26
- */
27
- export async function createConnection(options: ConnectionOptions): Promise<Connection>;
28
-
29
- /**
30
- * Creates a new connection and registers it in the manager.
31
- *
32
- * If connection options were not specified, then it will try to create connection automatically,
33
- * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.
34
- * Only one connection from ormconfig will be created (name "default" or connection without name).
35
- */
36
- export async function createConnection(optionsOrName?: any): Promise<Connection> {
37
- let connection: Connection;
38
- if (typeof optionsOrName === "string" || typeof optionsOrName === 'undefined')
39
- {
40
- connection = getSteedosSchema().getDataSource(optionsOrName)
41
- if (connection) {
42
- connection.connect();
43
- return connection;
44
- } else
45
- throw new Error (`Connection not found: ${optionsOrName}`)
46
- } else {
47
- let datasourceName: string = optionsOrName.name? optionsOrName.name : "default";
48
- connection = getSteedosSchema().addDataSource(datasourceName, optionsOrName);
49
- connection.connect();
50
- return connection;
51
- }
52
- }
53
-
54
- export async function createConnections(optionsArray: ConnectionOptions[]): Promise<Connection[]> {
55
-
56
- let connections:Array<Connection> = []
57
- if (!optionsArray) {
58
- let _datasources = getSteedosSchema().getDataSources()
59
- _.each(_datasources, (connection, ds_name) => {
60
- connection.connect();
61
- connections.push(connection);
62
- })
63
-
64
- } else {
65
- optionsArray.forEach( async element => {
66
- let connection = await createConnection(element);
67
- connections.push(connection);
68
- });
69
- }
70
- return connections;
71
- }
72
-
73
- export const getConnectionOptions = async (connectionName: string = "meteor"): Promise<ConnectionOptions> => {
74
- let config:any = getSteedosConfig();
75
- if (config && config.datasources && config.datasources[connectionName] )
76
- return config.datasources[connectionName]
77
- }
78
-
79
- export const ConnectionManager = {
80
- async create(options){
81
- return createConnection(options)
82
- }
83
- }
84
-
85
- export const getConnectionManager = () => {
86
- return ConnectionManager;
87
- }
@@ -1,91 +0,0 @@
1
- import { SteedosDataSourceType, addConfigFiles, addConfig } from '.';
2
- import _ = require('underscore');
3
- import { getConfigs, getConfig } from './config';
4
- export type SteedosDashboardTypeConfig = {
5
- _id: string,
6
- name: string,
7
- apps: string[],
8
- widgets: object[],
9
- description: string
10
- }
11
-
12
- export class SteedosDashboardType{
13
- private _datasource: SteedosDataSourceType;
14
- public get datasource(): SteedosDataSourceType {
15
- return this._datasource;
16
- }
17
- private __id: string;
18
- public get _id(): string {
19
- return this.__id;
20
- }
21
- public set _id(value: string) {
22
- this.__id = value;
23
- }
24
- private _name: string;
25
- public get name(): string {
26
- return this._name;
27
- }
28
- public set name(value: string) {
29
- this._name = value;
30
- }
31
- private _description: string;
32
- public get description(): string {
33
- return this._description;
34
- }
35
- public set description(value: string) {
36
- this._description = value;
37
- }
38
-
39
- private _apps: string[];
40
- public get apps(): string[] {
41
- return this._apps;
42
- }
43
- public set apps(value: string[]) {
44
- this._apps = value;
45
- }
46
-
47
- private _widgets: object[];
48
- public get widgets(): object[] {
49
- return this._widgets;
50
- }
51
- public set widgets(value: object[]) {
52
- this._widgets = value;
53
- }
54
-
55
- private properties: string[] = []
56
-
57
- constructor(config: SteedosDashboardTypeConfig, datasource: SteedosDataSourceType){
58
- this._datasource = datasource
59
- this._id = config._id
60
- _.each(config, (value: any, key: string)=>{
61
- if(key != 'is_creator'){
62
- this[key] = value
63
- this.properties.push(key)
64
- }
65
- })
66
- }
67
-
68
- toConfig(){
69
- let config = {}
70
- this.properties.forEach((property)=>{
71
- config[property] = this[property]
72
- })
73
- return config
74
- }
75
- }
76
-
77
- export function addDashboardConfigFiles(filePath: string){
78
- addConfigFiles('dashboard', filePath);
79
- }
80
-
81
- export const addDashboardConfig = (dashboardConfig: SteedosDashboardTypeConfig) => {
82
- addConfig('dashboard', dashboardConfig);
83
- }
84
-
85
- export const getDashboardConfigs = () => {
86
- return getConfigs('dashboard')
87
- }
88
-
89
- export const getDashboardConfig = (_id: string):SteedosDashboardTypeConfig => {
90
- return getConfig('dashboard', _id);
91
- }