@openinc/parse-server-opendash 2.4.104 → 3.0.1

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 (127) hide show
  1. package/dist/featuremap.json +5 -4
  2. package/dist/features/config/helper/baseOptions.d.ts +2 -0
  3. package/dist/features/config/helper/baseOptions.js +50 -0
  4. package/dist/features/config/helper/customOptions.d.ts +2 -0
  5. package/dist/{config.js → features/config/helper/customOptions.js} +2 -4
  6. package/dist/features/config/index.d.ts +6 -0
  7. package/dist/features/config/index.js +16 -0
  8. package/dist/features/config/services/ConfigInstance.d.ts +5 -0
  9. package/dist/features/config/services/ConfigInstance.js +13 -0
  10. package/dist/features/config/states/Config.d.ts +20 -0
  11. package/dist/{helper → features/config/states}/Config.js +86 -52
  12. package/dist/features/config/types/configTypes.d.ts +35 -0
  13. package/dist/features/cron/index.d.ts +1 -0
  14. package/dist/features/notifications/index.d.ts +4 -0
  15. package/dist/features/notifications/index.js +13 -0
  16. package/dist/features/notifications/services/registerNotification.d.ts +7 -0
  17. package/dist/features/notifications/services/registerNotification.js +80 -0
  18. package/dist/features/notifications/states/NotificationClass.d.ts +12 -0
  19. package/dist/features/notifications/states/NotificationClass.js +21 -0
  20. package/dist/features/notifications/types/NotificationTypes.d.ts +11 -0
  21. package/dist/features/notifications/types/NotificationTypes.js +2 -0
  22. package/dist/features/openservice/index.d.ts +2 -0
  23. package/dist/features/openservice/index.js +5 -0
  24. package/dist/{helper/TranslationKeys.d.ts → features/openservice/types/OpenserviceTranslationKeys.d.ts} +1 -1
  25. package/dist/{helper/TranslationKeys.js → features/openservice/types/OpenserviceTranslationKeys.js} +5 -5
  26. package/dist/{helper → features/openservice/types}/TicketData.d.ts +1 -1
  27. package/dist/features/openservice/types/TicketData.js +2 -0
  28. package/dist/features/openware/helper/getToken.d.ts +1 -0
  29. package/dist/features/openware/helper/getToken.js +25 -0
  30. package/dist/features/openware/index.d.ts +7 -0
  31. package/dist/features/openware/index.js +7 -0
  32. package/dist/features/openware/services/publishDataItem.d.ts +2 -0
  33. package/dist/{ow.js → features/openware/services/publishDataItem.js} +5 -23
  34. package/dist/features/openware/types/DataItemInterface.d.ts +10 -0
  35. package/dist/features/openware/types/DataItemInterface.js +2 -0
  36. package/dist/features/openware/types/DataItemValueInterface.d.ts +4 -0
  37. package/dist/features/openware/types/DataItemValueInterface.js +2 -0
  38. package/dist/features/openware/types/DataItemValueTypeInterface.d.ts +6 -0
  39. package/dist/features/openware/types/DataItemValueTypeInterface.js +2 -0
  40. package/dist/features/openware/types/DataItemValueTypeTypeField.d.ts +1 -0
  41. package/dist/features/openware/types/DataItemValueTypeTypeField.js +2 -0
  42. package/dist/{app_types → features/openware/types}/OpenWareTicketObject.d.ts +1 -1
  43. package/dist/features/openware/types/OpenWareTicketObject.js +2 -0
  44. package/dist/features/permissions/index.d.ts +4 -0
  45. package/dist/features/permissions/index.js +13 -0
  46. package/dist/features/permissions/services/registerPermissions.d.ts +7 -0
  47. package/dist/features/permissions/services/registerPermissions.js +80 -0
  48. package/dist/{helper/registerPermissions.d.ts → features/permissions/states/PermissionClass.d.ts} +2 -12
  49. package/dist/features/permissions/states/PermissionClass.js +21 -0
  50. package/dist/features/permissions/types/PermissionTypes.d.ts +11 -0
  51. package/dist/features/permissions/types/PermissionTypes.js +2 -0
  52. package/dist/functions/opendash-geo-features.js +5 -5
  53. package/dist/functions/openinc-auth-signup.js +6 -5
  54. package/dist/functions/openinc-auth.common.js +3 -3
  55. package/dist/functions/openinc-config.js +2 -2
  56. package/dist/functions/openinc-geo-google.common.d.ts +1 -1
  57. package/dist/functions/openinc-geo-google.common.js +3 -4
  58. package/dist/functions/openinc-geo-graphhopper.common.d.ts +1 -1
  59. package/dist/functions/openinc-geo-graphhopper.common.js +4 -4
  60. package/dist/functions/openinc-openservice-save-ticket-data.js +45 -7
  61. package/dist/hooks/Alarm.js +3 -3
  62. package/dist/hooks/BDE_Result.js +2 -2
  63. package/dist/hooks/Core_Email.js +10 -10
  64. package/dist/hooks/MES_Order.js +7 -7
  65. package/dist/hooks/ML_DataSelection.d.ts +1 -0
  66. package/dist/hooks/ML_DataSelection.js +17 -0
  67. package/dist/hooks/Maintenance_Downtime.js +5 -5
  68. package/dist/hooks/Maintenance_Duedate.js +5 -5
  69. package/dist/hooks/Maintenance_Frequency.js +5 -5
  70. package/dist/hooks/Maintenance_Message.js +29 -29
  71. package/dist/hooks/Maintenance_Priority.js +5 -5
  72. package/dist/hooks/Maintenance_Restriction.js +5 -5
  73. package/dist/hooks/Maintenance_Schedule_Execution.js +3 -3
  74. package/dist/hooks/Maintenance_Ticket.js +1 -1
  75. package/dist/hooks/Maintenance_Ticket_FormConfig.d.ts +1 -0
  76. package/dist/hooks/Maintenance_Ticket_FormConfig.js +34 -0
  77. package/dist/hooks/Maintenance_Ticket_Issuecategory.js +5 -5
  78. package/dist/hooks/Maintenance_Ticket_Kanban_State.js +5 -5
  79. package/dist/hooks/Maintenance_Ticket_Material.js +5 -5
  80. package/dist/hooks/Maintenance_Ticket_Project.js +5 -5
  81. package/dist/hooks/Maintenance_Ticket_Source.js +5 -5
  82. package/dist/hooks/Maintenance_Ticket_Title.js +5 -5
  83. package/dist/hooks/Notification.js +4 -4
  84. package/dist/hooks/Notification_Setting.js +0 -38
  85. package/dist/hooks/OWPlcDevice.d.ts +1 -0
  86. package/dist/hooks/OWPlcDevice.js +17 -0
  87. package/dist/hooks/OWPlcItem.d.ts +1 -0
  88. package/dist/hooks/OWPlcItem.js +17 -0
  89. package/dist/hooks/_User.js +2 -2
  90. package/dist/hooks/_beforeLogin.js +3 -3
  91. package/dist/index.js +23 -56
  92. package/dist/jobs/open_service_notifyOnSchedule.js +4 -4
  93. package/dist/types/Maintenance_Project.d.ts +3 -0
  94. package/dist/types/Maintenance_Project.js +6 -0
  95. package/dist/types/Maintenance_Schedule_Step.d.ts +3 -17
  96. package/dist/types/Maintenance_Ticket_FormConfig.d.ts +19 -0
  97. package/dist/types/Maintenance_Ticket_FormConfig.js +26 -0
  98. package/dist/types/OWPlcDevice.d.ts +28 -0
  99. package/dist/types/OWPlcDevice.js +47 -0
  100. package/dist/types/OWPlcItem.d.ts +42 -0
  101. package/dist/types/OWPlcItem.js +71 -0
  102. package/dist/types/index.d.ts +6 -0
  103. package/dist/types/index.js +8 -1
  104. package/package.json +49 -11
  105. package/schema/Maintenance_Project.json +5 -0
  106. package/schema/Maintenance_Ticket_FormConfig.json +44 -0
  107. package/schema/OWPlcItem.json +2 -2
  108. package/dist/app_types/index.d.ts +0 -5
  109. package/dist/app_types/index.js +0 -9
  110. package/dist/config.d.ts +0 -2
  111. package/dist/helper/Config.d.ts +0 -33
  112. package/dist/helper/pdf2img.d.ts +0 -15
  113. package/dist/helper/pdf2img.js +0 -157
  114. package/dist/helper/registerNotification.d.ts +0 -25
  115. package/dist/helper/registerNotification.js +0 -61
  116. package/dist/helper/registerPermissions.js +0 -58
  117. package/dist/ow.d.ts +0 -21
  118. package/dist/{app_types → features/config/types}/ConfigKeys.d.ts +0 -0
  119. package/dist/{app_types → features/config/types}/ConfigKeys.js +0 -0
  120. package/dist/{app_types/CRON_Types.js → features/config/types/configTypes.js} +0 -0
  121. package/dist/{app_types/OpenWareTicketObject.js → features/cron/index.js} +0 -0
  122. package/dist/{app_types → features/cron/types}/CRON_Types.d.ts +0 -0
  123. package/dist/{helper/TicketData.js → features/cron/types/CRON_Types.js} +0 -0
  124. package/dist/{app_types → features/notifications/types}/Notifications.d.ts +0 -0
  125. package/dist/{app_types → features/notifications/types}/Notifications.js +2 -2
  126. /package/dist/{app_types → features/permissions/types}/Permissions.d.ts +0 -0
  127. /package/dist/{app_types → features/permissions/types}/Permissions.js +0 -0
@@ -63,6 +63,7 @@
63
63
  "OD3_Maintenance_Source_File": "MAINTENANCE",
64
64
  "OD3_Maintenance_Ticket": "MAINTENANCE",
65
65
  "OD3_Maintenance_Ticket_Assignment": "MAINTENANCE",
66
+ "OD3_Maintenance_Ticket_FormConfig": "MAINTENANCE",
66
67
  "OD3_Maintenance_Ticket_Issuecategory": "MAINTENANCE",
67
68
  "OD3_Maintenance_Ticket_Kanban_State": "MAINTENANCE",
68
69
  "OD3_Maintenance_Ticket_Kanban_State_Current": "MAINTENANCE",
@@ -74,7 +75,7 @@
74
75
  "OD3_MES_Order": "MONITORING",
75
76
  "OD3_MES_OrderPlan": "MONITORING",
76
77
  "OD3_MIAAS_MDSEndpoint": "MIAAS",
77
- "OD3_ML_DataSelection": "unknown",
78
+ "OD3_ML_DataSelection": "MASCHINELEARNING",
78
79
  "OD3_Monitoring_DataHierachies": "MONITORING",
79
80
  "OD3_Monitoring_Jobs": "MONITORING",
80
81
  "OD3_Monitoring_ParseTableSensor": "MONITORING",
@@ -84,6 +85,8 @@
84
85
  "OD3_NavigationItem": "CORE",
85
86
  "OD3_Notification": "CORE",
86
87
  "OD3_Notification_Setting": "CORE",
88
+ "OD3_OWPlcDevice": "MONITORING",
89
+ "OD3_OWPlcItem": "MONITORING",
87
90
  "OD3_Permission": "CORE",
88
91
  "OD3_Push": "CORE",
89
92
  "OD3_Report": "CORE",
@@ -98,7 +101,5 @@
98
101
  "OD3_VirtualKPI": "MONITORING",
99
102
  "OD3_WebPush": "CORE",
100
103
  "OD3_Widget": "MONITORING",
101
- "OD3_WidgetPreset": "MONITORING",
102
- "OD3_OWPlcDevice": "MONITORING",
103
- "OD3_OWPlcItem": "MONITORING"
104
+ "OD3_WidgetPreset": "MONITORING"
104
105
  }
@@ -0,0 +1,2 @@
1
+ import { ConfigMap } from "..";
2
+ export declare const baseoptions: ConfigMap;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.baseoptions = void 0;
4
+ exports.baseoptions = {
5
+ PARSE_SERVER_ENABLE_INSECURE_AUTH_ADAPTERS: {
6
+ env: "PARSE_SERVER_ENABLE_INSECURE_AUTH_ADAPTERS",
7
+ type: "boolean",
8
+ required: false,
9
+ secret: false,
10
+ public: false,
11
+ default: "true",
12
+ description: "Enable (or disable) insecure auth adapters, defaults to true. Insecure auth adapters are deprecated and it is recommended to disable them.",
13
+ },
14
+ PARSE_SERVER_ENCODE_PARSE_OBJECT_IN_CLOUD_FUNCTION: {
15
+ env: "PARSE_SERVER_ENCODE_PARSE_OBJECT_IN_CLOUD_FUNCTION",
16
+ type: "boolean",
17
+ required: false,
18
+ secret: false,
19
+ public: false,
20
+ default: "false",
21
+ description: "If set to `true`, a `Parse.Object` that is in the payload when calling a Cloud Function will be converted to an instance of `Parse.Object`. If `false`, the object will not be converted and instead be a plain JavaScript object, which contains the raw data of a `Parse.Object` but is not an actual instance of `Parse.Object`. Default is `false`. <br><br>ℹ️ The expected behavior would be that the object is converted to an instance of `Parse.Object`, so you would normally set this option to `true`. The default is `false` because this is a temporary option that has been introduced to avoid a breaking change when fixing a bug where JavaScript objects are not converted to actual instances of `Parse.Object`.",
22
+ },
23
+ PARSE_SERVER_ALLOW_EXPIRED_AUTH_DATA_TOKEN: {
24
+ env: "PARSE_SERVER_ALLOW_EXPIRED_AUTH_DATA_TOKEN",
25
+ type: "boolean",
26
+ required: false,
27
+ secret: false,
28
+ public: false,
29
+ default: "false",
30
+ description: "Allow a user to log in even if the 3rd party authentication token that was used to sign in to their account has expired. If this is set to `false`, then the token will be validated every time the user signs in to their account. This refers to the token that is stored in the `_User.authData` field. Defaults to `false`.",
31
+ },
32
+ PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION: {
33
+ env: "PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION",
34
+ type: "boolean",
35
+ required: false,
36
+ secret: false,
37
+ public: false,
38
+ default: "false",
39
+ description: "Enable (or disable) client class creation, defaults to false",
40
+ },
41
+ PARSE_SERVER_ENABLE_ANON_USERS: {
42
+ env: "PARSE_SERVER_ENABLE_ANON_USERS",
43
+ type: "boolean",
44
+ required: false,
45
+ secret: false,
46
+ public: false,
47
+ default: "true",
48
+ description: "Enable (or disable) anonymous users, defaults to true",
49
+ },
50
+ };
@@ -0,0 +1,2 @@
1
+ import { ConfigMap } from "..";
2
+ export declare const customoptions: ConfigMap;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.config = void 0;
4
- const Config_1 = require("./helper/Config");
5
- const options = {
3
+ exports.customoptions = void 0;
4
+ exports.customoptions = {
6
5
  ADDITIONAL_PACKAGES: {
7
6
  env: "OPENINC_PARSE_ADDITIONAL_PACKAGES",
8
7
  type: "string",
@@ -502,4 +501,3 @@ const options = {
502
501
  description: "Use the given JWT token instead of creating a new one.",
503
502
  },
504
503
  };
505
- exports.config = new Config_1.Config(options);
@@ -0,0 +1,6 @@
1
+ export { CommonConfigValue, ConfigBooleanValue, ConfigMap, ConfigValue, } from "./types/configTypes";
2
+ export { ConfigState } from "./states/Config";
3
+ export { default as ConfigInstance } from "./services/ConfigInstance";
4
+ export { ConfigKeys } from "./types/ConfigKeys";
5
+ export { customoptions } from "./helper/customOptions";
6
+ export { baseoptions } from "./helper/baseOptions";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.baseoptions = exports.customoptions = exports.ConfigKeys = exports.ConfigInstance = exports.ConfigState = void 0;
7
+ var Config_1 = require("./states/Config");
8
+ Object.defineProperty(exports, "ConfigState", { enumerable: true, get: function () { return Config_1.ConfigState; } });
9
+ var ConfigInstance_1 = require("./services/ConfigInstance");
10
+ Object.defineProperty(exports, "ConfigInstance", { enumerable: true, get: function () { return __importDefault(ConfigInstance_1).default; } });
11
+ var ConfigKeys_1 = require("./types/ConfigKeys");
12
+ Object.defineProperty(exports, "ConfigKeys", { enumerable: true, get: function () { return ConfigKeys_1.ConfigKeys; } });
13
+ var customOptions_1 = require("./helper/customOptions");
14
+ Object.defineProperty(exports, "customoptions", { enumerable: true, get: function () { return customOptions_1.customoptions; } });
15
+ var baseOptions_1 = require("./helper/baseOptions");
16
+ Object.defineProperty(exports, "baseoptions", { enumerable: true, get: function () { return baseOptions_1.baseoptions; } });
@@ -0,0 +1,5 @@
1
+ import { ConfigState, customoptions } from "..";
2
+ export default class ConfigInstance {
3
+ private static instance;
4
+ static getInstance(): ConfigState<Extract<keyof typeof customoptions, string>>;
5
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __1 = require("..");
4
+ class ConfigInstance {
5
+ static getInstance() {
6
+ if (!ConfigInstance.instance) {
7
+ ConfigInstance.instance = new __1.ConfigState(__1.customoptions);
8
+ }
9
+ return ConfigInstance.instance;
10
+ }
11
+ }
12
+ ConfigInstance.instance = null;
13
+ exports.default = ConfigInstance;
@@ -0,0 +1,20 @@
1
+ import { ConfigMap } from "..";
2
+ /**
3
+ * Config class to handle configuration values from environment variables.
4
+ * It supports different types of values (string, int, float, boolean) and provides methods to get the values.
5
+ *
6
+ */
7
+ export declare class ConfigState<T extends string> {
8
+ private configs;
9
+ private baseConfigs;
10
+ private values;
11
+ constructor(configs: ConfigMap);
12
+ init(log: boolean): Promise<void>;
13
+ get(key: T): string;
14
+ getBoolean(key: T): boolean;
15
+ getNumber(key: T): number;
16
+ export(): Record<string, any>;
17
+ private validateKey;
18
+ private validateKeyType;
19
+ log(): void;
20
+ }
@@ -1,12 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Config = void 0;
4
- class Config {
3
+ exports.ConfigState = void 0;
4
+ const table_1 = require("table");
5
+ const __1 = require("..");
6
+ /**
7
+ * Config class to handle configuration values from environment variables.
8
+ * It supports different types of values (string, int, float, boolean) and provides methods to get the values.
9
+ *
10
+ */
11
+ class ConfigState {
5
12
  constructor(configs) {
13
+ this.configs = {};
14
+ this.baseConfigs = {};
6
15
  this.values = {};
7
16
  this.configs = configs;
17
+ this.baseConfigs = __1.baseoptions;
8
18
  }
9
19
  async init(log) {
20
+ for (const [key, c] of Object.entries(this.baseConfigs)) {
21
+ if (c.type === "string") {
22
+ this.values[key] = getEnv(c.env, c.default);
23
+ }
24
+ if (c.type === "int") {
25
+ this.values[key] = getEnvInt(c.env, c.default);
26
+ }
27
+ if (c.type === "float") {
28
+ this.values[key] = getEnvFloat(c.env, c.default);
29
+ }
30
+ if (c.type === "boolean") {
31
+ this.values[key] = getEnvBoolean(c.env, c.default);
32
+ }
33
+ }
34
+ //Load values from custom config
10
35
  for (const [key, c] of Object.entries(this.configs)) {
11
36
  if (c.type === "string") {
12
37
  this.values[key] = getEnv(c.env, c.default);
@@ -84,60 +109,69 @@ class Config {
84
109
  }
85
110
  }
86
111
  log() {
87
- const table = [];
88
- const colWidth = {};
89
- for (const [key, c] of Object.entries(this.configs)) {
112
+ const tableBaseConfig = {
113
+ header: {
114
+ alignment: "center",
115
+ content: "PARSE BASE CONFIGURATION\nStart Parse Server with the following base configuration.",
116
+ },
117
+ columnDefault: {
118
+ paddingLeft: 0,
119
+ paddingRight: 0,
120
+ width: 25,
121
+ wrapWord: true,
122
+ },
123
+ // singleLine: true,
124
+ columns: [
125
+ { width: 50 },
126
+ { width: 54 },
127
+ { width: 15 },
128
+ { width: 40, truncate: 40 },
129
+ ],
130
+ };
131
+ const tableDataBaseConfig = Object.entries(this.baseConfigs).map(([key, c]) => {
90
132
  const value = this.values[key]?.toString() || "undefined";
91
- table.push({
133
+ return [
92
134
  key,
93
- env: c.env,
94
- type: c.type,
95
- value: this.configs[key]?.secret && value !== "undefined" ? "****" : value,
96
- });
97
- }
98
- for (const x of table) {
99
- for (const [key, value] of Object.entries(x)) {
100
- const length = value.length;
101
- if ((colWidth[key] && colWidth[key] < length) || !colWidth[key]) {
102
- colWidth[key] = length;
103
- }
104
- }
105
- }
106
- for (const x of table) {
107
- for (const [key, value] of Object.entries(x)) {
108
- x[key] = value.padEnd(colWidth[key], " ");
109
- }
110
- }
111
- let result = "";
112
- result += "┌─";
113
- result += Object.keys(colWidth)
114
- .map((key) => "─".repeat(colWidth[key]))
115
- .join("─┬─");
116
- result += "─┐\n";
117
- result += "│ ";
118
- result += Object.keys(colWidth)
119
- .map((key) => key.padEnd(colWidth[key], " "))
120
- .join(" ");
121
- result += " │\n";
122
- result += "├─";
123
- result += Object.keys(colWidth)
124
- .map((key) => "─".repeat(colWidth[key]))
125
- .join("─┼─");
126
- result += "─┤\n";
127
- for (const row of table) {
128
- result += "│ ";
129
- result += Object.values(row).join(" │ ");
130
- result += " │\n";
131
- }
132
- result += "└─";
133
- result += Object.keys(colWidth)
134
- .map((key) => "─".repeat(colWidth[key]))
135
- .join("─┴─");
136
- result += "─┘\n";
137
- console.log(result);
135
+ c.env,
136
+ c.type,
137
+ this.baseConfigs[key]?.secret && value !== "undefined"
138
+ ? "****"
139
+ : value,
140
+ ];
141
+ });
142
+ console.log((0, table_1.table)(tableDataBaseConfig, tableBaseConfig));
143
+ const tableConfig = {
144
+ header: {
145
+ alignment: "center",
146
+ content: "PARSE CUSTOM CONFIGURATION\nStart Parse Server with the following custom configuration.",
147
+ },
148
+ columnDefault: {
149
+ paddingLeft: 0,
150
+ paddingRight: 0,
151
+ width: 25,
152
+ wrapWord: true,
153
+ },
154
+ // singleLine: true,
155
+ columns: [
156
+ { width: 50 },
157
+ { width: 54 },
158
+ { width: 15 },
159
+ { width: 40, truncate: 40 },
160
+ ],
161
+ };
162
+ const tableData = Object.entries(this.configs).map(([key, c]) => {
163
+ const value = this.values[key]?.toString() || "undefined";
164
+ return [
165
+ key,
166
+ c.env,
167
+ c.type,
168
+ this.configs[key]?.secret && value !== "undefined" ? "****" : value,
169
+ ];
170
+ });
171
+ console.log((0, table_1.table)(tableData, tableConfig));
138
172
  }
139
173
  }
140
- exports.Config = Config;
174
+ exports.ConfigState = ConfigState;
141
175
  function getEnv(key, fallback) {
142
176
  return process.env[key] || fallback;
143
177
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Config class to handle configuration values from environment variables.
3
+ * It supports different types of values (string, int, float, boolean) and provides methods to get the values.
4
+ */
5
+ export interface CommonConfigValue {
6
+ env: string;
7
+ type: "string" | "int" | "float" | "boolean";
8
+ secret: boolean;
9
+ public: boolean;
10
+ required: boolean;
11
+ default?: string;
12
+ description: string;
13
+ }
14
+ /**
15
+ * ConfigValue interface to define the structure of configuration values.
16
+ * It extends the CommonConfigValue interface and adds a type property that can be "string", "int", or "float".
17
+ */
18
+ export interface ConfigValue extends CommonConfigValue {
19
+ type: "string" | "int" | "float";
20
+ }
21
+ /**
22
+ * ConfigBooleanValue interface to define the structure of boolean configuration values.
23
+ * It extends the CommonConfigValue interface and adds a type property with the value "boolean".
24
+ */
25
+ export interface ConfigBooleanValue extends CommonConfigValue {
26
+ type: "boolean";
27
+ dependencies?: string[];
28
+ }
29
+ /**
30
+ * ConfigMap interface to define the structure of the configuration map.
31
+ * It contains key-value pairs where the key is a string and the value is a ConfigValue or ConfigBooleanValue.
32
+ */
33
+ export interface ConfigMap {
34
+ [key: string]: ConfigValue | ConfigBooleanValue;
35
+ }
@@ -0,0 +1 @@
1
+ export { ScheduleCronObjectType, ScheduleType } from "./types/CRON_Types";
@@ -0,0 +1,4 @@
1
+ export { FunctionKeys, NotificationInterface, NotificationMap, } from "./types/NotificationTypes";
2
+ export { Notifications } from "./types/Notifications";
3
+ export { RegisteredNotification } from "./states/NotificationClass";
4
+ export { getAllNotifications, default as initNotifications, } from "./services/registerNotification";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.initNotifications = exports.getAllNotifications = exports.RegisteredNotification = exports.Notifications = void 0;
7
+ var Notifications_1 = require("./types/Notifications");
8
+ Object.defineProperty(exports, "Notifications", { enumerable: true, get: function () { return Notifications_1.Notifications; } });
9
+ var NotificationClass_1 = require("./states/NotificationClass");
10
+ Object.defineProperty(exports, "RegisteredNotification", { enumerable: true, get: function () { return NotificationClass_1.RegisteredNotification; } });
11
+ var registerNotification_1 = require("./services/registerNotification");
12
+ Object.defineProperty(exports, "getAllNotifications", { enumerable: true, get: function () { return registerNotification_1.getAllNotifications; } });
13
+ Object.defineProperty(exports, "initNotifications", { enumerable: true, get: function () { return __importDefault(registerNotification_1).default; } });
@@ -0,0 +1,7 @@
1
+ import { RegisteredNotification } from "..";
2
+ /**
3
+ * Returns all notifications from the OpenService plugin defined in types/config.ts as an array of Notification objects.
4
+ * @returns all notifications from the OpenService plugin
5
+ */
6
+ export declare function getAllNotifications(): RegisteredNotification[];
7
+ export default function initNotifications(): Promise<void>;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllNotifications = getAllNotifications;
4
+ exports.default = initNotifications;
5
+ const __1 = require("..");
6
+ const types_1 = require("../../../types");
7
+ /**
8
+ * Returns all notifications from the OpenService plugin defined in types/config.ts as an array of Notification objects.
9
+ * @returns all notifications from the OpenService plugin
10
+ */
11
+ function getAllNotifications() {
12
+ const notifications = []; // stores all notifications
13
+ for (const key in __1.Notifications) {
14
+ // iterate over the objects / enums of the Notifications namespace
15
+ if (Object.prototype.hasOwnProperty.call(__1.Notifications, key)) {
16
+ const element = __1.Notifications[key]; // get the object / enum
17
+ const createdNotification = createNotification(element); // create Notification objects recursively
18
+ notifications.push(...createdNotification);
19
+ }
20
+ }
21
+ return notifications;
22
+ }
23
+ /**
24
+ * Recursively creates Notification objects from the input object.
25
+ * @param input a string from an enum or an enum itself
26
+ * @returns an array of Notification objects
27
+ */
28
+ function createNotification(input) {
29
+ const notifications = []; // all notification objects created from the input
30
+ if (typeof input === "string") {
31
+ // if the input is a string, create a Notification object from it
32
+ notifications.push(new __1.RegisteredNotification(input, input + ".label", input + ".description"));
33
+ }
34
+ else {
35
+ // if the input is an object, iterate over its keys and create Notification objects from the values
36
+ for (const key in input) {
37
+ if (Object.prototype.hasOwnProperty.call(input, key)) {
38
+ const element = input[key];
39
+ notifications.push(...createNotification(element));
40
+ }
41
+ }
42
+ }
43
+ return notifications;
44
+ }
45
+ /**
46
+ * Register all notifications in the database, if not already registered.
47
+ */
48
+ async function registerNotifications(tenant) {
49
+ console.log("[@openinc/parse-server-opendash] Register all notifications");
50
+ getAllNotifications().forEach((notification) => {
51
+ new Parse.Query(types_1.Notification_Setting)
52
+ .equalTo("key", notification.key)
53
+ .equalTo("tenant", tenant)
54
+ .first({ useMasterKey: true })
55
+ .then((result) => {
56
+ if (!result) {
57
+ console.log("[@openinc/parse-server-opendash] Create notification", notification.key);
58
+ const newPermission = new types_1.Notification_Setting();
59
+ newPermission.set("key", notification.key);
60
+ newPermission.set("label", notification.label);
61
+ newPermission.set("tenant", tenant);
62
+ newPermission.set("description", notification.description);
63
+ newPermission.save({}, { useMasterKey: true });
64
+ }
65
+ else {
66
+ console.log("[@openinc/parse-server-opendash] Notification already exists", notification.key);
67
+ }
68
+ });
69
+ });
70
+ }
71
+ async function initNotifications() {
72
+ const tenants = await new Parse.Query(types_1.Tenant)
73
+ .descending("createdAt")
74
+ .find({ useMasterKey: true });
75
+ if (tenants) {
76
+ for await (const tenant of tenants) {
77
+ await registerNotifications(tenant);
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,12 @@
1
+ import { FunctionKeys, NotificationInterface } from "..";
2
+ /**
3
+ *
4
+ */
5
+ export declare class RegisteredNotification implements NotificationInterface {
6
+ key: string;
7
+ label: string;
8
+ description: string;
9
+ constructor(key: string, label: string, description: string);
10
+ get<T extends Exclude<keyof RegisteredNotification, FunctionKeys<RegisteredNotification>>>(attribute: T): (typeof this)[T];
11
+ set<T extends Exclude<keyof RegisteredNotification, FunctionKeys<RegisteredNotification>>>(attribute: T, value: (typeof this)[T]): this;
12
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegisteredNotification = void 0;
4
+ /**
5
+ *
6
+ */
7
+ class RegisteredNotification {
8
+ constructor(key, label, description) {
9
+ this.key = key;
10
+ this.label = label;
11
+ this.description = description;
12
+ }
13
+ get(attribute) {
14
+ return this[attribute];
15
+ }
16
+ set(attribute, value) {
17
+ this[attribute] = value;
18
+ return this;
19
+ }
20
+ }
21
+ exports.RegisteredNotification = RegisteredNotification;
@@ -0,0 +1,11 @@
1
+ export interface NotificationInterface {
2
+ label: string;
3
+ description: string;
4
+ key: string;
5
+ }
6
+ export type FunctionKeys<T> = {
7
+ [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
8
+ }[keyof T];
9
+ export interface NotificationMap {
10
+ [key: string]: any;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { OpenserviceMessageTranslationKeys } from "./types/OpenserviceTranslationKeys";
2
+ export { TicketData } from "./types/TicketData";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OpenserviceMessageTranslationKeys = void 0;
4
+ var OpenserviceTranslationKeys_1 = require("./types/OpenserviceTranslationKeys");
5
+ Object.defineProperty(exports, "OpenserviceMessageTranslationKeys", { enumerable: true, get: function () { return OpenserviceTranslationKeys_1.OpenserviceMessageTranslationKeys; } });
@@ -1,4 +1,4 @@
1
- export declare class MessageTranslationKeys {
1
+ export declare class OpenserviceMessageTranslationKeys {
2
2
  static TICKETLOG: {
3
3
  TITLE: {
4
4
  TITLE: string;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageTranslationKeys = void 0;
4
- class MessageTranslationKeys {
3
+ exports.OpenserviceMessageTranslationKeys = void 0;
4
+ class OpenserviceMessageTranslationKeys {
5
5
  }
6
- exports.MessageTranslationKeys = MessageTranslationKeys;
7
- MessageTranslationKeys.TICKETLOG = {
6
+ exports.OpenserviceMessageTranslationKeys = OpenserviceMessageTranslationKeys;
7
+ OpenserviceMessageTranslationKeys.TICKETLOG = {
8
8
  TITLE: {
9
9
  TITLE: "maintenance:ticket.message.title.changed.title",
10
10
  CONTENT: "maintenance:ticket.message.title.changed.content",
@@ -50,7 +50,7 @@ MessageTranslationKeys.TICKETLOG = {
50
50
  CONTENT: "maintenance:ticket.message.project.changed.content",
51
51
  },
52
52
  };
53
- MessageTranslationKeys.MACHINELOG = {
53
+ OpenserviceMessageTranslationKeys.MACHINELOG = {
54
54
  TITLE: {
55
55
  TITLE: "maintenance:machinelog.message.title.changed.title",
56
56
  CONTENT: "maintenance:machinelog.message.title.changed.content",
@@ -1,4 +1,4 @@
1
- import { Maintenance_Ticket, Maintenance_DailySchedule, Maintenance_Downtime, Maintenance_Duedate, Maintenance_Frequency, Maintenance_Issuecategory, Maintenance_Kanban_State, Maintenance_Message, Maintenance_Priority, Maintenance_Restriction, Source, Maintenance_Ticket_Material, Maintenance_Project } from "../types";
1
+ import { Maintenance_DailySchedule, Maintenance_Downtime, Maintenance_Duedate, Maintenance_Frequency, Maintenance_Issuecategory, Maintenance_Kanban_State, Maintenance_Message, Maintenance_Priority, Maintenance_Project, Maintenance_Restriction, Maintenance_Ticket, Maintenance_Ticket_Material, Source } from "../../../types";
2
2
  export type TicketData = {
3
3
  ticket: Maintenance_Ticket;
4
4
  dailySchedule?: Maintenance_DailySchedule;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export declare function getToken(usermail?: string): Promise<string | null>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getToken = getToken;
7
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
+ const config_1 = require("../../config");
9
+ async function getToken(usermail) {
10
+ const JWT_EMAIL = usermail || config_1.ConfigInstance.getInstance().get("OPENWARE_JWT_ADMIN_EMAIL");
11
+ const JWT_SECRET = config_1.ConfigInstance.getInstance().get("OPENWARE_JWT_SECRET");
12
+ const JWT_ISS = config_1.ConfigInstance.getInstance().get("OPENWARE_JWT_ISS");
13
+ const JWT_TOKEN = config_1.ConfigInstance.getInstance().get("OPENWARE_JWT_TOKEN");
14
+ if (JWT_EMAIL && JWT_SECRET && JWT_ISS) {
15
+ return jsonwebtoken_1.default.sign({ usermail: JWT_EMAIL }, JWT_SECRET, {
16
+ algorithm: "HS256",
17
+ issuer: JWT_ISS,
18
+ noTimestamp: true,
19
+ });
20
+ }
21
+ if (JWT_TOKEN) {
22
+ return JWT_TOKEN;
23
+ }
24
+ return null;
25
+ }
@@ -0,0 +1,7 @@
1
+ export { DataItemInterface } from "./types/DataItemInterface";
2
+ export { DataItemValueInterface } from "./types/DataItemValueInterface";
3
+ export { DataItemValueTypeInterface } from "./types/DataItemValueTypeInterface";
4
+ export { DataItemValueTypeTypeField } from "./types/DataItemValueTypeTypeField";
5
+ export { OpenWareTicketObject } from "./types/OpenWareTicketObject";
6
+ export { getToken } from "./helper/getToken";
7
+ export { publishDataItem } from "./services/publishDataItem";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.publishDataItem = exports.getToken = void 0;
4
+ var getToken_1 = require("./helper/getToken");
5
+ Object.defineProperty(exports, "getToken", { enumerable: true, get: function () { return getToken_1.getToken; } });
6
+ var publishDataItem_1 = require("./services/publishDataItem");
7
+ Object.defineProperty(exports, "publishDataItem", { enumerable: true, get: function () { return publishDataItem_1.publishDataItem; } });