@openinc/parse-server-opendash 1.13.6 → 1.14.0

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.
@@ -0,0 +1,2 @@
1
+ import { Config } from "./helper/Config";
2
+ export declare const config: Config<"FEATURES_ENABLED" | "FEATURE_CORE" | "FEATURE_MONITORING" | "FEATURE_BDE" | "FEATURE_GTFS" | "FEATURE_KNOWLEDGE" | "FEATURE_MAINTENANCE" | "FEATURE_MIAAS" | "AUTOLOAD_DIR" | "OPENWARE" | "OPENWARE_BASEURL" | "OPENWARE_JWT_SECRET" | "OPENWARE_JWT_ISS" | "OPENWARE_JWT_ADMIN_EMAIL" | "OPENWARE_JWT_TOKEN" | "GEO_VECTOR_STYLE" | "GEO_GOOGLE_API_KEY" | "GEO_GRAPHHOPPER_HOST" | "GEO_GRAPHHOPPER_API_KEY">;
package/dist/config.js ADDED
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ const Config_1 = require("./helper/Config");
5
+ const options = {
6
+ FEATURES_ENABLED: {
7
+ env: "OPENINC_PARSE_FEATURES_ENABLED",
8
+ type: "boolean",
9
+ required: false,
10
+ secret: false,
11
+ description: "If this option is true, only classes for the features matching OPENINC_PARSE_FEATURE_* are created and used for Cloud Code.",
12
+ },
13
+ FEATURE_CORE: {
14
+ env: "OPENINC_PARSE_FEATURE_CORE",
15
+ type: "boolean",
16
+ required: false,
17
+ secret: false,
18
+ description: "Enable Parse Classes and Cloud Code for core features.",
19
+ },
20
+ FEATURE_MONITORING: {
21
+ env: "OPENINC_PARSE_FEATURE_MONITORING",
22
+ type: "boolean",
23
+ required: false,
24
+ secret: false,
25
+ description: "Enable Parse Classes and Cloud Code for the Monitoring plugin.",
26
+ },
27
+ FEATURE_BDE: {
28
+ env: "OPENINC_PARSE_FEATURE_BDE",
29
+ type: "boolean",
30
+ required: false,
31
+ secret: false,
32
+ description: "Enable Parse Classes and Cloud Code for the BDE plugin.",
33
+ },
34
+ FEATURE_GTFS: {
35
+ env: "OPENINC_PARSE_FEATURE_GTFS",
36
+ type: "boolean",
37
+ required: false,
38
+ secret: false,
39
+ description: "Enable Parse Classes and Cloud Code for the GTFS plugin.",
40
+ },
41
+ FEATURE_KNOWLEDGE: {
42
+ env: "OPENINC_PARSE_FEATURE_KNOWLEDGE",
43
+ type: "boolean",
44
+ required: false,
45
+ secret: false,
46
+ description: "Enable Parse Classes and Cloud Code for the open.KNOWLEDGE plugin.",
47
+ },
48
+ FEATURE_MAINTENANCE: {
49
+ env: "OPENINC_PARSE_FEATURE_MAINTENANCE",
50
+ type: "boolean",
51
+ required: false,
52
+ secret: false,
53
+ description: "Enable Parse Classes and Cloud Code for the open.SERVICE plugin.",
54
+ },
55
+ FEATURE_MIAAS: {
56
+ env: "OPENINC_PARSE_FEATURE_MIAAS",
57
+ type: "boolean",
58
+ required: false,
59
+ secret: false,
60
+ description: "Enable Parse Classes and Cloud Code for the MIAAS plugin.",
61
+ },
62
+ AUTOLOAD_DIR: {
63
+ env: "OPENINC_PARSE_CLOUDCODE_AUTOLOAD_DIR",
64
+ type: "string",
65
+ required: false,
66
+ secret: false,
67
+ description: "Autoload every .js file in the given directory as Parse Server Cloud Code. Just export a async init() function in every file and it will be called.",
68
+ },
69
+ OPENWARE: {
70
+ env: "PARSE_SERVER_OPENWARE",
71
+ type: "boolean",
72
+ required: false,
73
+ secret: false,
74
+ description: "Enable open.WARE Cloud Code features.",
75
+ },
76
+ OPENWARE_BASEURL: {
77
+ env: "PARSE_SERVER_OPENWARE_BASEURL",
78
+ type: "string",
79
+ required: false,
80
+ secret: false,
81
+ description: "Enter a description here...",
82
+ },
83
+ OPENWARE_JWT_SECRET: {
84
+ env: "PARSE_SERVER_OPENWARE_JWT_SECRET",
85
+ type: "string",
86
+ required: false,
87
+ secret: false,
88
+ description: "Enter a description here...",
89
+ },
90
+ OPENWARE_JWT_ISS: {
91
+ env: "PARSE_SERVER_OPENWARE_JWT_ISS",
92
+ type: "string",
93
+ required: false,
94
+ secret: false,
95
+ description: "Enter a description here...",
96
+ },
97
+ OPENWARE_JWT_ADMIN_EMAIL: {
98
+ env: "PARSE_SERVER_OPENWARE_JWT_ADMIN_EMAIL",
99
+ type: "string",
100
+ required: false,
101
+ secret: false,
102
+ description: "Enter a description here...",
103
+ },
104
+ OPENWARE_JWT_TOKEN: {
105
+ env: "PARSE_SERVER_OPENWARE_JWT_TOKEN",
106
+ type: "string",
107
+ required: false,
108
+ secret: false,
109
+ description: "Enter a description here...",
110
+ },
111
+ GEO_VECTOR_STYLE: {
112
+ env: "PARSE_SERVER_GEO_VECTOR_STYLE",
113
+ type: "string",
114
+ required: false,
115
+ secret: false,
116
+ description: "Enter a description here...",
117
+ },
118
+ GEO_GOOGLE_API_KEY: {
119
+ env: "PARSE_SERVER_GEO_GOOGLE_API_KEY",
120
+ type: "string",
121
+ required: false,
122
+ secret: false,
123
+ description: "Enter a description here...",
124
+ },
125
+ GEO_GRAPHHOPPER_HOST: {
126
+ env: "PARSE_SERVER_GEO_GRAPHHOPPER_HOST",
127
+ type: "string",
128
+ required: false,
129
+ secret: false,
130
+ description: "Enter a description here...",
131
+ },
132
+ GEO_GRAPHHOPPER_API_KEY: {
133
+ env: "PARSE_SERVER_GEO_GRAPHHOPPER_API_KEY",
134
+ type: "string",
135
+ required: false,
136
+ secret: false,
137
+ description: "Enter a description here...",
138
+ },
139
+ };
140
+ exports.config = new Config_1.Config(
141
+ // @ts-ignore
142
+ options);
@@ -0,0 +1,69 @@
1
+ {
2
+ "OD3_Alarm": "MONITORING",
3
+ "OD3_AlarmAction": "MONITORING",
4
+ "OD3_AlarmWebhook": "MONITORING",
5
+ "OD3_Attachment": "CORE",
6
+ "OD3_BDE_Form": "BDE",
7
+ "OD3_BDE_List": "BDE",
8
+ "OD3_BDE_ListEntry": "BDE",
9
+ "OD3_BDE_Page": "BDE",
10
+ "OD3_BDE_Result": "BDE",
11
+ "OD3_BDE_Unit": "BDE",
12
+ "OD3_Config": "CORE",
13
+ "OD3_Dashboard": "MONITORING",
14
+ "OD3_Group": "CORE",
15
+ "OD3_GTFS_Agency": "GTFS",
16
+ "OD3_GTFS_Calendar": "GTFS",
17
+ "OD3_GTFS_Level": "GTFS",
18
+ "OD3_GTFS_Location_Type": "GTFS",
19
+ "OD3_GTFS_Route": "GTFS",
20
+ "OD3_GTFS_Route_Type": "GTFS",
21
+ "OD3_GTFS_Stop": "GTFS",
22
+ "OD3_GTFS_Stop_Times": "GTFS",
23
+ "OD3_GTFS_Trip": "GTFS",
24
+ "OD3_GTFS_Wheelchair_Boarding": "GTFS",
25
+ "OD3_Knowledge_Article": "KNOWLEDGE",
26
+ "OD3_Knowledge_Category": "KNOWLEDGE",
27
+ "OD3_Knowledge_Document": "KNOWLEDGE",
28
+ "OD3_Knowledge_DocumentPage": "KNOWLEDGE",
29
+ "OD3_Knowledge_Video": "KNOWLEDGE",
30
+ "OD3_Language": "CORE",
31
+ "OD3_Log": "CORE",
32
+ "OD3_Maintenance_Article": "MAINTENANCE",
33
+ "OD3_Maintenance_Downtime": "MAINTENANCE",
34
+ "OD3_Maintenance_Duedate": "MAINTENANCE",
35
+ "OD3_Maintenance_Frequency": "MAINTENANCE",
36
+ "OD3_Maintenance_Issuecategory": "MAINTENANCE",
37
+ "OD3_Maintenance_Kanban_State": "MAINTENANCE",
38
+ "OD3_Maintenance_Media": "MAINTENANCE",
39
+ "OD3_Maintenance_Order": "MAINTENANCE",
40
+ "OD3_Maintenance_Priority": "MAINTENANCE",
41
+ "OD3_Maintenance_Restriction": "MAINTENANCE",
42
+ "OD3_Maintenance_Schedule": "MAINTENANCE",
43
+ "OD3_Maintenance_Schedule_Execution": "MAINTENANCE",
44
+ "OD3_Maintenance_Schedule_Execution_Step": "MAINTENANCE",
45
+ "OD3_Maintenance_Schedule_Step": "MAINTENANCE",
46
+ "OD3_Maintenance_Ticket": "MAINTENANCE",
47
+ "OD3_Maintenance_Ticket_Issuecategory": "MAINTENANCE",
48
+ "OD3_Maintenance_Ticket_Kanban_State": "MAINTENANCE",
49
+ "OD3_Maintenance_Ticket_Source": "MAINTENANCE",
50
+ "OD3_MIAAS_MDSEndpoint": "MIAAS",
51
+ "OD3_NavigationGroup": "CORE",
52
+ "OD3_NavigationItem": "CORE",
53
+ "OD3_Notification": "CORE",
54
+ "OD3_Permission": "CORE",
55
+ "OD3_Push": "CORE",
56
+ "OD3_Report": "CORE",
57
+ "OD3_Share": "CORE",
58
+ "OD3_Slideshow": "MONITORING",
59
+ "OD3_Source": "CORE",
60
+ "OD3_SourceMeta": "CORE",
61
+ "OD3_Tenant": "CORE",
62
+ "OD3_TenantMeta": "CORE",
63
+ "OD3_TenantTrustedDomain": "CORE",
64
+ "OD3_UserData": "CORE",
65
+ "OD3_VirtualKPI": "MONITORING",
66
+ "OD3_WebPush": "CORE",
67
+ "OD3_Widget": "MONITORING",
68
+ "OD3_WidgetPreset": "MONITORING"
69
+ }
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.init = void 0;
4
- const __1 = require("..");
4
+ const config_1 = require("../config");
5
5
  async function init(name) {
6
6
  Parse.Cloud.define(name, async (request) => {
7
- const style = (0, __1.getEnv)("PARSE_SERVER_GEO_VECTOR_STYLE");
8
- const GoK = (0, __1.getEnv)("PARSE_SERVER_GEO_GOOGLE_API_KEY");
9
- const GHH = (0, __1.getEnv)("PARSE_SERVER_GEO_GRAPHHOPPER_HOST");
10
- const GHK = (0, __1.getEnv)("PARSE_SERVER_GEO_GRAPHHOPPER_API_KEY");
7
+ const style = config_1.config.get("GEO_VECTOR_STYLE");
8
+ const GoK = config_1.config.get("GEO_GOOGLE_API_KEY");
9
+ const GHH = config_1.config.get("GEO_GRAPHHOPPER_HOST");
10
+ const GHK = config_1.config.get("GEO_GRAPHHOPPER_API_KEY");
11
11
  return {
12
12
  "vector-style": style,
13
13
  "opendash-geo-google-autocomplete": !!GoK,
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.init = void 0;
4
- const __1 = require("..");
4
+ const config_1 = require("../config");
5
5
  async function init(name) {
6
6
  Parse.Cloud.define(name, async (request) => {
7
- const API_KEY = (0, __1.getEnv)("PARSE_SERVER_GEO_GOOGLE_API_KEY");
7
+ const API_KEY = config_1.config.get("GEO_GOOGLE_API_KEY");
8
8
  if (!API_KEY) {
9
9
  throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, `Feature not enabled [${name}-1]`);
10
10
  }
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.init = void 0;
4
- const __1 = require("..");
4
+ const config_1 = require("../config");
5
5
  const opendash_geo_graphhopper_geocode_1 = require("./opendash-geo-graphhopper-geocode");
6
6
  async function init(name) {
7
7
  Parse.Cloud.define(name, async function (request) {
8
- const GRAPHHOPPER_HOST = (0, __1.getEnv)("PARSE_SERVER_GEO_GRAPHHOPPER_HOST");
8
+ const GRAPHHOPPER_HOST = config_1.config.get("GEO_GRAPHHOPPER_HOST");
9
9
  if (!GRAPHHOPPER_HOST) {
10
10
  throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, `Feature not enabled [${name}-1]`);
11
11
  }
12
- const GRAPHHOPPER_API_KEY = (0, __1.getEnv)("PARSE_SERVER_GEO_GRAPHHOPPER_API_KEY");
12
+ const GRAPHHOPPER_API_KEY = config_1.config.get("GEO_GRAPHHOPPER_API_KEY");
13
13
  if (!GRAPHHOPPER_API_KEY) {
14
14
  throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, `Feature not enabled [${name}-2]`);
15
15
  }
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGeoCodingResult = exports.init = void 0;
4
- const __1 = require("..");
4
+ const config_1 = require("../config");
5
5
  async function init(name) {
6
6
  Parse.Cloud.define(name, async function (request) {
7
- const GRAPHHOPPER_HOST = (0, __1.getEnv)("PARSE_SERVER_GEO_GRAPHHOPPER_HOST");
7
+ const GRAPHHOPPER_HOST = config_1.config.get("GEO_GRAPHHOPPER_HOST");
8
8
  if (!GRAPHHOPPER_HOST) {
9
9
  throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, `Feature not enabled [${name}-1]`);
10
10
  }
11
- const GRAPHHOPPER_API_KEY = (0, __1.getEnv)("PARSE_SERVER_GEO_GRAPHHOPPER_API_KEY");
11
+ const GRAPHHOPPER_API_KEY = config_1.config.get("GEO_GRAPHHOPPER_API_KEY");
12
12
  if (!GRAPHHOPPER_API_KEY) {
13
13
  throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, `Feature not enabled [${name}-2]`);
14
14
  }
@@ -0,0 +1,22 @@
1
+ interface ConfigValue {
2
+ env: string;
3
+ type: "string" | "int" | "float" | "boolean";
4
+ }
5
+ interface ConfigMap {
6
+ [key: string]: ConfigValue;
7
+ }
8
+ export declare class Config<T extends string> {
9
+ private configs;
10
+ private values;
11
+ constructor(configs: ConfigMap);
12
+ init(): Promise<void>;
13
+ get(key: T): string;
14
+ getBoolean(key: T): boolean;
15
+ getNumber(key: T): number;
16
+ log(): void;
17
+ }
18
+ export declare function getEnv(key: string): string | undefined;
19
+ export declare function getEnvInt(key: string): number;
20
+ export declare function getEnvFloat(key: string): number;
21
+ export declare function getEnvBoolean(key: string): boolean;
22
+ export {};
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEnvBoolean = exports.getEnvFloat = exports.getEnvInt = exports.getEnv = exports.Config = void 0;
4
+ class Config {
5
+ constructor(configs) {
6
+ this.values = {};
7
+ this.configs = configs;
8
+ this.init();
9
+ }
10
+ async init() {
11
+ for (const [key, c] of Object.entries(this.configs)) {
12
+ if (c.type === "string") {
13
+ this.values[key] = getEnv(c.env);
14
+ }
15
+ if (c.type === "int") {
16
+ this.values[key] = getEnvInt(c.env);
17
+ }
18
+ if (c.type === "float") {
19
+ this.values[key] = getEnvFloat(c.env);
20
+ }
21
+ if (c.type === "boolean") {
22
+ this.values[key] = getEnvBoolean(c.env);
23
+ }
24
+ }
25
+ }
26
+ get(key) {
27
+ return this.values[key];
28
+ }
29
+ getBoolean(key) {
30
+ return this.values[key];
31
+ }
32
+ getNumber(key) {
33
+ return this.values[key];
34
+ }
35
+ log() {
36
+ const table = [];
37
+ const colWidth = {};
38
+ for (const [key, c] of Object.entries(this.configs)) {
39
+ table.push({
40
+ key,
41
+ env: c.env,
42
+ type: c.type,
43
+ value: this.values[key]?.toString() || "undefined",
44
+ });
45
+ }
46
+ for (const x of table) {
47
+ for (const [key, value] of Object.entries(x)) {
48
+ const length = value.length;
49
+ if ((colWidth[key] && colWidth[key] < length) || !colWidth[key]) {
50
+ colWidth[key] = length;
51
+ }
52
+ }
53
+ }
54
+ for (const x of table) {
55
+ for (const [key, value] of Object.entries(x)) {
56
+ x[key] = value.padEnd(colWidth[key], " ");
57
+ }
58
+ }
59
+ let result = "";
60
+ result += "┌─";
61
+ result += Object.keys(colWidth)
62
+ .map((key) => "─".repeat(colWidth[key]))
63
+ .join("─┬─");
64
+ result += "─┐\n";
65
+ result += "│ ";
66
+ result += Object.keys(colWidth)
67
+ .map((key) => key.padEnd(colWidth[key], " "))
68
+ .join(" │ ");
69
+ result += " │\n";
70
+ result += "├─";
71
+ result += Object.keys(colWidth)
72
+ .map((key) => "─".repeat(colWidth[key]))
73
+ .join("─┼─");
74
+ result += "─┤\n";
75
+ for (const row of table) {
76
+ result += "│ ";
77
+ result += Object.values(row).join(" │ ");
78
+ result += " │\n";
79
+ }
80
+ result += "└─";
81
+ result += Object.keys(colWidth)
82
+ .map((key) => "─".repeat(colWidth[key]))
83
+ .join("─┴─");
84
+ result += "─┘\n";
85
+ console.log(result);
86
+ }
87
+ }
88
+ exports.Config = Config;
89
+ function getEnv(key) {
90
+ return process.env[key];
91
+ }
92
+ exports.getEnv = getEnv;
93
+ function getEnvInt(key) {
94
+ return parseInt(getEnv(key) || "");
95
+ }
96
+ exports.getEnvInt = getEnvInt;
97
+ function getEnvFloat(key) {
98
+ return parseFloat(getEnv(key) || "");
99
+ }
100
+ exports.getEnvFloat = getEnvFloat;
101
+ function getEnvBoolean(key) {
102
+ const value = getEnv(key);
103
+ if (!value || value.toLowerCase() === "false" || value === "0") {
104
+ return false;
105
+ }
106
+ return true;
107
+ }
108
+ exports.getEnvBoolean = getEnvBoolean;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.init = void 0;
7
7
  const node_fetch_1 = __importDefault(require("node-fetch"));
8
8
  const __1 = require("..");
9
+ const config_1 = require("../config");
9
10
  const types_1 = require("../types");
10
11
  async function init() {
11
12
  (0, __1.beforeSaveHook)(types_1.Alarm, async (request) => {
@@ -14,9 +15,9 @@ async function init() {
14
15
  // TODO
15
16
  });
16
17
  (0, __1.afterSaveHook)(types_1.Alarm, async ({ object, original, user }) => {
17
- if ((0, __1.getEnvBoolean)("PARSE_SERVER_OPENWARE")) {
18
+ if ((0, __1.getEnvBoolean)("OPENWARE")) {
18
19
  const username = user?.get("username");
19
- const baseurl = (0, __1.getEnv)("PARSE_SERVER_OPENWARE_BASEURL");
20
+ const baseurl = config_1.config.get("OPENWARE_BASEURL");
20
21
  const headers = {
21
22
  "content-type": "application/json",
22
23
  "od-session": user?.getSessionToken() || "",
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Cloud as ParseCloud } from "parse";
2
+ export { Config, getEnv, getEnvBoolean } from "./helper/Config";
2
3
  export declare let PREFIX: string;
3
4
  export interface ConfigInterface {
4
5
  configPath?: string;
@@ -11,8 +12,6 @@ export declare function requirePermission(request: {
11
12
  }, key: string | null, message: string): Promise<void>;
12
13
  export declare function getConfig(key: string): Promise<string | undefined>;
13
14
  export declare function getConfigBoolean(key: string): Promise<boolean>;
14
- export declare function getEnv(key: string): string | undefined;
15
- export declare function getEnvBoolean(key: string): boolean;
16
15
  export declare function ensureRole(name: string, options?: {
17
16
  label?: string;
18
17
  acl?: Parse.ACL;
@@ -61,4 +60,5 @@ type afterDeleteHookType<T extends Parse.Object<Parse.Attributes>> = (request: P
61
60
  export declare function afterDeleteHook<T extends Parse.Object<Parse.Attributes>>(target: string | {
62
61
  new (): T;
63
62
  }, callback: afterDeleteHookType<T>): void;
64
- export {};
63
+ export declare function autoloadCloudCode(path: string): Promise<void>;
64
+ export declare function initAutoload(): Promise<void>;
package/dist/index.js CHANGED
@@ -3,13 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.afterDeleteHook = exports.beforeDeleteHook = exports.afterSaveHook = exports.beforeSaveHook = exports.defaultAclHandler = exports.defaultHandler = exports.immutableField = exports.ensureUserRole = exports.ensureRole = exports.getEnvBoolean = exports.getEnv = exports.getConfigBoolean = exports.getConfig = exports.requirePermission = exports.hasPermission = exports.init = exports.PREFIX = void 0;
7
- const web_push_1 = __importDefault(require("web-push"));
6
+ exports.initAutoload = exports.autoloadCloudCode = exports.afterDeleteHook = exports.beforeDeleteHook = exports.afterSaveHook = exports.beforeSaveHook = exports.defaultAclHandler = exports.defaultHandler = exports.immutableField = exports.ensureUserRole = exports.ensureRole = exports.getConfigBoolean = exports.getConfig = exports.requirePermission = exports.hasPermission = exports.init = exports.PREFIX = exports.getEnvBoolean = exports.getEnv = exports.Config = void 0;
8
7
  const path_1 = require("path");
8
+ const web_push_1 = __importDefault(require("web-push"));
9
9
  const parse_server_schema_1 = require("@openinc/parse-server-schema");
10
- const _init_1 = require("./hooks/_init");
11
- const _init_2 = require("./functions/_init");
12
- const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
10
+ const fast_equals_1 = require("fast-equals");
11
+ const _init_1 = require("./functions/_init");
12
+ const _init_2 = require("./hooks/_init");
13
+ const types_1 = require("./types");
14
+ const fs_1 = __importDefault(require("fs"));
15
+ const path_2 = require("path");
16
+ const config_1 = require("./config");
17
+ const featuremap_json_1 = __importDefault(require("./featuremap.json"));
18
+ var Config_1 = require("./helper/Config");
19
+ Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return Config_1.Config; } });
20
+ Object.defineProperty(exports, "getEnv", { enumerable: true, get: function () { return Config_1.getEnv; } });
21
+ Object.defineProperty(exports, "getEnvBoolean", { enumerable: true, get: function () { return Config_1.getEnvBoolean; } });
13
22
  exports.PREFIX = "OD3_";
14
23
  let schema = {};
15
24
  async function init(cfg = {}) {
@@ -18,12 +27,21 @@ async function init(cfg = {}) {
18
27
  console.log(`[${pkg.name}] init (v${pkg.version})`);
19
28
  }
20
29
  catch (error) { }
30
+ await config_1.config.init();
31
+ config_1.config.log();
21
32
  const schemaConfig = await (0, parse_server_schema_1.loadConfig)(cfg.configPath);
22
33
  try {
23
34
  await (0, parse_server_schema_1.up)(schemaConfig, (0, path_1.resolve)(__dirname, "../schema"), {
24
35
  prefix: exports.PREFIX,
25
36
  deleteClasses: false,
26
37
  deleteFields: false,
38
+ filter: (className) => {
39
+ if (!config_1.config.getBoolean("FEATURES_ENABLED"))
40
+ return true;
41
+ const feature = getFeatureForClassName(className);
42
+ const enabled = isFeatureEnabled(feature);
43
+ return enabled;
44
+ },
27
45
  });
28
46
  }
29
47
  catch (error) {
@@ -33,8 +51,9 @@ async function init(cfg = {}) {
33
51
  schema = Object.fromEntries((await Parse.Schema.all()).map((schema) => [schema.className, schema]));
34
52
  await initDefaultRoles();
35
53
  await initWebPush();
36
- await (0, _init_1.init)();
37
54
  await (0, _init_2.init)();
55
+ await (0, _init_1.init)();
56
+ await initAutoload();
38
57
  }
39
58
  exports.init = init;
40
59
  async function initDefaultRoles() {
@@ -54,7 +73,7 @@ async function initDefaultRoles() {
54
73
  }
55
74
  async function initWebPush() {
56
75
  try {
57
- if (!(await getConfigBoolean("WEB_PUSH_ENABLED"))) {
76
+ if (!(await getConfigBoolean(""))) {
58
77
  return;
59
78
  }
60
79
  web_push_1.default.setVapidDetails((await getConfig("WEB_PUSH_HOST")), (await getConfig("WEB_PUSH_VAPID_PUBLIC_KEY")), (await getConfig("WEB_PUSH_VAPID_PRIVATE_KEY")));
@@ -65,7 +84,7 @@ async function initWebPush() {
65
84
  }
66
85
  }
67
86
  async function hasPermission(sessionToken, key) {
68
- const result = await new Parse.Query(`${exports.PREFIX}Permission`)
87
+ const result = await new Parse.Query(types_1.Permission)
69
88
  .equalTo("key", key)
70
89
  .first({ sessionToken });
71
90
  return !!result;
@@ -88,9 +107,7 @@ async function requirePermission(request, key, message) {
88
107
  }
89
108
  exports.requirePermission = requirePermission;
90
109
  async function getConfig(key) {
91
- const result = await new Parse.Query(`${exports.PREFIX}Config`)
92
- .equalTo("key", key)
93
- .first({
110
+ const result = await new Parse.Query(types_1.Config).equalTo("key", key).first({
94
111
  useMasterKey: true,
95
112
  });
96
113
  const value = result?.get("value");
@@ -106,18 +123,6 @@ async function getConfigBoolean(key) {
106
123
  return true;
107
124
  }
108
125
  exports.getConfigBoolean = getConfigBoolean;
109
- function getEnv(key) {
110
- return process.env[key];
111
- }
112
- exports.getEnv = getEnv;
113
- function getEnvBoolean(key) {
114
- const value = getEnv(key);
115
- if (!value || value.toLowerCase() === "false" || value === "0") {
116
- return false;
117
- }
118
- return true;
119
- }
120
- exports.getEnvBoolean = getEnvBoolean;
121
126
  async function ensureRole(name, options) {
122
127
  const label = options?.label || undefined;
123
128
  const acl = options?.acl || new Parse.ACL();
@@ -138,7 +143,7 @@ async function ensureRole(name, options) {
138
143
  role.set("label", label);
139
144
  changed = true;
140
145
  }
141
- if (!(0, fast_deep_equal_1.default)(acl.toJSON(), role.getACL()?.toJSON())) {
146
+ if (!(0, fast_equals_1.deepEqual)(acl.toJSON(), role.getACL()?.toJSON())) {
142
147
  role.setACL(acl);
143
148
  changed = true;
144
149
  }
@@ -187,7 +192,7 @@ async function immutableField(request, fieldName, permissionName = "parse:edit-i
187
192
  }
188
193
  const previousValue = JSON.stringify(request.original.get(fieldName));
189
194
  const nextValue = JSON.stringify(request.object.get(fieldName));
190
- if ((0, fast_deep_equal_1.default)(previousValue, nextValue)) {
195
+ if ((0, fast_equals_1.deepEqual)(previousValue, nextValue)) {
191
196
  return;
192
197
  }
193
198
  await requirePermission(request, permissionName, `You are not allowed to edit the '${fieldName}' field.`);
@@ -333,3 +338,46 @@ function afterDeleteHook(target, callback) {
333
338
  afterDeleteHooks[className].push(callback);
334
339
  }
335
340
  exports.afterDeleteHook = afterDeleteHook;
341
+ async function autoloadCloudCode(path) {
342
+ const fns = fs_1.default
343
+ .readdirSync(path)
344
+ .filter((filename) => !filename.startsWith("_"))
345
+ .filter((filename) => filename.endsWith(".js"))
346
+ .map((filename) => filename.replace(".js", ""));
347
+ for (const name of fns) {
348
+ const { init } = require((0, path_2.join)(path, name));
349
+ await init(name).catch((e) => console.error(e));
350
+ }
351
+ }
352
+ exports.autoloadCloudCode = autoloadCloudCode;
353
+ async function initAutoload() {
354
+ const path = config_1.config.get("AUTOLOAD_DIR");
355
+ if (path) {
356
+ await autoloadCloudCode((0, path_1.resolve)(process.cwd(), path));
357
+ }
358
+ }
359
+ exports.initAutoload = initAutoload;
360
+ function getFeatureForClassName(className) {
361
+ const map = featuremap_json_1.default;
362
+ return map[className] || "unknown";
363
+ }
364
+ function isFeatureEnabled(feature) {
365
+ switch (feature) {
366
+ case "CORE":
367
+ return config_1.config.getBoolean("FEATURE_CORE");
368
+ case "MONITORING":
369
+ return config_1.config.getBoolean("FEATURE_MONITORING");
370
+ case "BDE":
371
+ return config_1.config.getBoolean("FEATURE_BDE");
372
+ case "GTFS":
373
+ return config_1.config.getBoolean("FEATURE_GTFS");
374
+ case "KNOWLEDGE":
375
+ return config_1.config.getBoolean("FEATURE_KNOWLEDGE");
376
+ case "MAINTENANCE":
377
+ return config_1.config.getBoolean("FEATURE_MAINTENANCE");
378
+ case "MIAAS":
379
+ return config_1.config.getBoolean("FEATURE_MIAAS");
380
+ default:
381
+ return false;
382
+ }
383
+ }
package/dist/ow.js CHANGED
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.publishDataItem = exports.getToken = void 0;
7
7
  const node_fetch_1 = __importDefault(require("node-fetch"));
8
8
  const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
9
- const _1 = require(".");
9
+ const config_1 = require("./config");
10
10
  const LOG_PREFIX = "[@openinc/parse-server-opendash][open.WARE] ";
11
11
  async function getToken(usermail) {
12
- const JWT_EMAIL = usermail || (0, _1.getEnv)("PARSE_SERVER_OPENWARE_JWT_ADMIN_EMAIL");
13
- const JWT_SECRET = (0, _1.getEnv)("PARSE_SERVER_OPENWARE_JWT_SECRET");
14
- const JWT_ISS = (0, _1.getEnv)("PARSE_SERVER_OPENWARE_JWT_ISS");
15
- const JWT_TOKEN = (0, _1.getEnv)("PARSE_SERVER_OPENWARE_JWT_TOKEN");
12
+ const JWT_EMAIL = usermail || config_1.config.get("OPENWARE_JWT_ADMIN_EMAIL");
13
+ const JWT_SECRET = config_1.config.get("OPENWARE_JWT_SECRET");
14
+ const JWT_ISS = config_1.config.get("OPENWARE_JWT_ISS");
15
+ const JWT_TOKEN = config_1.config.get("OPENWARE_JWT_TOKEN");
16
16
  if (JWT_EMAIL && JWT_SECRET && JWT_ISS) {
17
17
  return jsonwebtoken_1.default.sign({ usermail: JWT_EMAIL }, JWT_SECRET, {
18
18
  algorithm: "HS256",
@@ -27,20 +27,20 @@ async function getToken(usermail) {
27
27
  }
28
28
  exports.getToken = getToken;
29
29
  async function publishDataItem(dataItem, usermail) {
30
- const active = (0, _1.getEnvBoolean)("PARSE_SERVER_OPENWARE");
30
+ const active = config_1.config.getBoolean("OPENWARE");
31
31
  if (!active) {
32
32
  return console.log(LOG_PREFIX +
33
- "PARSE_SERVER_OPENWARE = false => Sending Data to open.WARE is not available.");
33
+ "OPENWARE = false => Sending Data to open.WARE is not available.");
34
34
  }
35
35
  const token = await getToken(usermail);
36
36
  if (!token) {
37
37
  return console.log(LOG_PREFIX +
38
- "PARSE_SERVER_OPENWARE_JWT_TOKEN OR _JWT_SECERT/_ADMIN_EMAIL/_ISS = undefined => Sending Data to open.WARE is not available.");
38
+ "OPENWARE_JWT_TOKEN OR _JWT_SECERT/_ADMIN_EMAIL/_ISS = undefined => Sending Data to open.WARE is not available.");
39
39
  }
40
- const baseurl = (0, _1.getEnv)("PARSE_SERVER_OPENWARE_BASEURL");
40
+ const baseurl = config_1.config.get("OPENWARE_BASEURL");
41
41
  if (!baseurl) {
42
42
  return console.log(LOG_PREFIX +
43
- "PARSE_SERVER_OPENWARE_BASEURL = undefined => Sending Data to open.WARE is not available.");
43
+ "OPENWARE_BASEURL = undefined => Sending Data to open.WARE is not available.");
44
44
  }
45
45
  const url = baseurl + "/api/data/push";
46
46
  const headers = {
@@ -0,0 +1,26 @@
1
+ /// <reference types="parse" />
2
+ export interface MIAAS_MDSEndpointAttributes {
3
+ id: string;
4
+ objectId: string;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ endpoint: string;
8
+ endpointSuffix?: string;
9
+ header: any;
10
+ name?: string;
11
+ source: string;
12
+ }
13
+ export declare class MIAAS_MDSEndpoint extends Parse.Object<MIAAS_MDSEndpointAttributes> {
14
+ static className: string;
15
+ constructor(data?: Partial<MIAAS_MDSEndpointAttributes>);
16
+ get endpoint(): string;
17
+ set endpoint(value: string);
18
+ get endpointSuffix(): string | undefined;
19
+ set endpointSuffix(value: string | undefined);
20
+ get header(): any;
21
+ set header(value: any);
22
+ get name(): string | undefined;
23
+ set name(value: string | undefined);
24
+ get source(): string;
25
+ set source(value: string);
26
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MIAAS_MDSEndpoint = void 0;
4
+ class MIAAS_MDSEndpoint extends Parse.Object {
5
+ constructor(data) {
6
+ super("OD3_MIAAS_MDSEndpoint", data);
7
+ }
8
+ get endpoint() {
9
+ return super.get("endpoint");
10
+ }
11
+ set endpoint(value) {
12
+ super.set("endpoint", value);
13
+ }
14
+ get endpointSuffix() {
15
+ return super.get("endpointSuffix");
16
+ }
17
+ set endpointSuffix(value) {
18
+ super.set("endpointSuffix", value);
19
+ }
20
+ get header() {
21
+ return super.get("header");
22
+ }
23
+ set header(value) {
24
+ super.set("header", value);
25
+ }
26
+ get name() {
27
+ return super.get("name");
28
+ }
29
+ set name(value) {
30
+ super.set("name", value);
31
+ }
32
+ get source() {
33
+ return super.get("source");
34
+ }
35
+ set source(value) {
36
+ super.set("source", value);
37
+ }
38
+ }
39
+ exports.MIAAS_MDSEndpoint = MIAAS_MDSEndpoint;
40
+ MIAAS_MDSEndpoint.className = "OD3_MIAAS_MDSEndpoint";
41
+ Parse.Object.registerSubclass("OD3_MIAAS_MDSEndpoint", MIAAS_MDSEndpoint);
@@ -0,0 +1,26 @@
1
+ /// <reference types="parse" />
2
+ export interface MiaasMDSEndpointAttributes {
3
+ id: string;
4
+ objectId: string;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ endpoint: string;
8
+ endpointSuffix?: string;
9
+ header: any;
10
+ name?: string;
11
+ source: string;
12
+ }
13
+ export declare class MiaasMDSEndpoint extends Parse.Object<MiaasMDSEndpointAttributes> {
14
+ static className: string;
15
+ constructor(data?: Partial<MiaasMDSEndpointAttributes>);
16
+ get endpoint(): string;
17
+ set endpoint(value: string);
18
+ get endpointSuffix(): string | undefined;
19
+ set endpointSuffix(value: string | undefined);
20
+ get header(): any;
21
+ set header(value: any);
22
+ get name(): string | undefined;
23
+ set name(value: string | undefined);
24
+ get source(): string;
25
+ set source(value: string);
26
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MiaasMDSEndpoint = void 0;
4
+ class MiaasMDSEndpoint extends Parse.Object {
5
+ constructor(data) {
6
+ super("OD3_MiaasMDSEndpoint", data);
7
+ }
8
+ get endpoint() {
9
+ return super.get("endpoint");
10
+ }
11
+ set endpoint(value) {
12
+ super.set("endpoint", value);
13
+ }
14
+ get endpointSuffix() {
15
+ return super.get("endpointSuffix");
16
+ }
17
+ set endpointSuffix(value) {
18
+ super.set("endpointSuffix", value);
19
+ }
20
+ get header() {
21
+ return super.get("header");
22
+ }
23
+ set header(value) {
24
+ super.set("header", value);
25
+ }
26
+ get name() {
27
+ return super.get("name");
28
+ }
29
+ set name(value) {
30
+ super.set("name", value);
31
+ }
32
+ get source() {
33
+ return super.get("source");
34
+ }
35
+ set source(value) {
36
+ super.set("source", value);
37
+ }
38
+ }
39
+ exports.MiaasMDSEndpoint = MiaasMDSEndpoint;
40
+ MiaasMDSEndpoint.className = "OD3_MiaasMDSEndpoint";
41
+ Parse.Object.registerSubclass("OD3_MiaasMDSEndpoint", MiaasMDSEndpoint);
@@ -4,6 +4,7 @@ export interface SourceMetaAttributes {
4
4
  objectId: string;
5
5
  createdAt: Date;
6
6
  updatedAt: Date;
7
+ description?: string;
7
8
  kpiData: any[];
8
9
  location?: Parse.GeoPoint;
9
10
  name?: string;
@@ -11,6 +12,8 @@ export interface SourceMetaAttributes {
11
12
  export declare class SourceMeta extends Parse.Object<SourceMetaAttributes> {
12
13
  static className: string;
13
14
  constructor(data?: Partial<SourceMetaAttributes>);
15
+ get description(): string | undefined;
16
+ set description(value: string | undefined);
14
17
  get kpiData(): any[];
15
18
  set kpiData(value: any[]);
16
19
  get location(): Parse.GeoPoint | undefined;
@@ -5,6 +5,12 @@ class SourceMeta extends Parse.Object {
5
5
  constructor(data) {
6
6
  super("OD3_SourceMeta", data);
7
7
  }
8
+ get description() {
9
+ return super.get("description");
10
+ }
11
+ set description(value) {
12
+ super.set("description", value);
13
+ }
8
14
  get kpiData() {
9
15
  return super.get("kpiData");
10
16
  }
@@ -94,6 +94,8 @@ export { Maintenance_Ticket_Kanban_State } from "./Maintenance_Ticket_Kanban_Sta
94
94
  export type { Maintenance_Ticket_Kanban_StateAttributes } from "./Maintenance_Ticket_Kanban_State";
95
95
  export { Maintenance_Ticket_Source } from "./Maintenance_Ticket_Source";
96
96
  export type { Maintenance_Ticket_SourceAttributes } from "./Maintenance_Ticket_Source";
97
+ export { MIAAS_MDSEndpoint } from "./MIAAS_MDSEndpoint";
98
+ export type { MIAAS_MDSEndpointAttributes } from "./MIAAS_MDSEndpoint";
97
99
  export { NavigationGroup } from "./NavigationGroup";
98
100
  export type { NavigationGroupAttributes } from "./NavigationGroup";
99
101
  export { NavigationItem } from "./NavigationItem";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NavigationItem = exports.NavigationGroup = exports.Maintenance_Ticket_Source = exports.Maintenance_Ticket_Kanban_State = exports.Maintenance_Ticket_Issuecategory = exports.Maintenance_Ticket = exports.Maintenance_Schedule_Step = exports.Maintenance_Schedule_Execution_Step = exports.Maintenance_Schedule_Execution = exports.Maintenance_Schedule = exports.Maintenance_Restriction = exports.Maintenance_Priority = exports.Maintenance_Order = exports.Maintenance_Media = exports.Maintenance_Kanban_State = exports.Maintenance_Issuecategory = exports.Maintenance_Frequency = exports.Maintenance_Duedate = exports.Maintenance_Downtime = exports.Maintenance_Article = exports.Log = exports.Language = exports.Knowledge_Video = exports.Knowledge_DocumentPage = exports.Knowledge_Document = exports.Knowledge_Category = exports.Knowledge_Article = exports.Group = exports.GTFS_Wheelchair_Boarding = exports.GTFS_Trip = exports.GTFS_Stop_Times = exports.GTFS_Stop = exports.GTFS_Route_Type = exports.GTFS_Route = exports.GTFS_Location_Type = exports.GTFS_Level = exports.GTFS_Calendar = exports.GTFS_Agency = exports.Dashboard = exports.Config = exports.BDE_Unit = exports.BDE_Result = exports.BDE_Page = exports.BDE_ListEntry = exports.BDE_List = exports.BDE_Form = exports.Attachment = exports.AlarmWebhook = exports.AlarmAction = exports.Alarm = void 0;
4
- exports.WidgetPreset = exports.Widget = exports.WebPush = exports.VirtualKPI = exports.UserData = exports.TenantTrustedDomain = exports.TenantMeta = exports.Tenant = exports.SourceMeta = exports.Source = exports.Slideshow = exports.Share = exports.Report = exports.Push = exports.Permission = exports.Notification = void 0;
3
+ exports.NavigationGroup = exports.MIAAS_MDSEndpoint = exports.Maintenance_Ticket_Source = exports.Maintenance_Ticket_Kanban_State = exports.Maintenance_Ticket_Issuecategory = exports.Maintenance_Ticket = exports.Maintenance_Schedule_Step = exports.Maintenance_Schedule_Execution_Step = exports.Maintenance_Schedule_Execution = exports.Maintenance_Schedule = exports.Maintenance_Restriction = exports.Maintenance_Priority = exports.Maintenance_Order = exports.Maintenance_Media = exports.Maintenance_Kanban_State = exports.Maintenance_Issuecategory = exports.Maintenance_Frequency = exports.Maintenance_Duedate = exports.Maintenance_Downtime = exports.Maintenance_Article = exports.Log = exports.Language = exports.Knowledge_Video = exports.Knowledge_DocumentPage = exports.Knowledge_Document = exports.Knowledge_Category = exports.Knowledge_Article = exports.Group = exports.GTFS_Wheelchair_Boarding = exports.GTFS_Trip = exports.GTFS_Stop_Times = exports.GTFS_Stop = exports.GTFS_Route_Type = exports.GTFS_Route = exports.GTFS_Location_Type = exports.GTFS_Level = exports.GTFS_Calendar = exports.GTFS_Agency = exports.Dashboard = exports.Config = exports.BDE_Unit = exports.BDE_Result = exports.BDE_Page = exports.BDE_ListEntry = exports.BDE_List = exports.BDE_Form = exports.Attachment = exports.AlarmWebhook = exports.AlarmAction = exports.Alarm = void 0;
4
+ exports.WidgetPreset = exports.Widget = exports.WebPush = exports.VirtualKPI = exports.UserData = exports.TenantTrustedDomain = exports.TenantMeta = exports.Tenant = exports.SourceMeta = exports.Source = exports.Slideshow = exports.Share = exports.Report = exports.Push = exports.Permission = exports.Notification = exports.NavigationItem = void 0;
5
5
  var Alarm_1 = require("./Alarm");
6
6
  Object.defineProperty(exports, "Alarm", { enumerable: true, get: function () { return Alarm_1.Alarm; } });
7
7
  var AlarmAction_1 = require("./AlarmAction");
@@ -98,6 +98,8 @@ var Maintenance_Ticket_Kanban_State_1 = require("./Maintenance_Ticket_Kanban_Sta
98
98
  Object.defineProperty(exports, "Maintenance_Ticket_Kanban_State", { enumerable: true, get: function () { return Maintenance_Ticket_Kanban_State_1.Maintenance_Ticket_Kanban_State; } });
99
99
  var Maintenance_Ticket_Source_1 = require("./Maintenance_Ticket_Source");
100
100
  Object.defineProperty(exports, "Maintenance_Ticket_Source", { enumerable: true, get: function () { return Maintenance_Ticket_Source_1.Maintenance_Ticket_Source; } });
101
+ var MIAAS_MDSEndpoint_1 = require("./MIAAS_MDSEndpoint");
102
+ Object.defineProperty(exports, "MIAAS_MDSEndpoint", { enumerable: true, get: function () { return MIAAS_MDSEndpoint_1.MIAAS_MDSEndpoint; } });
101
103
  var NavigationGroup_1 = require("./NavigationGroup");
102
104
  Object.defineProperty(exports, "NavigationGroup", { enumerable: true, get: function () { return NavigationGroup_1.NavigationGroup; } });
103
105
  var NavigationItem_1 = require("./NavigationItem");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "1.13.6",
3
+ "version": "1.14.0",
4
4
  "description": "Parse Server Cloud Code for open.DASH",
5
5
  "keywords": [
6
6
  "parse",
@@ -20,17 +20,17 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@openinc/parse-server-schema": "^1.0.0",
23
- "fast-deep-equal": "^3.0.0",
24
- "jsonwebtoken": "^8.0.0",
23
+ "fast-equals": "^4.0.0",
24
+ "jsonwebtoken": "^9.0.0",
25
25
  "node-fetch": "^2.0.0",
26
26
  "pdf-img-convert": "1.0.6",
27
27
  "web-push": "^3.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/jsonwebtoken": "^8.0.0",
31
- "@types/node": "^16.0.0",
30
+ "@types/jsonwebtoken": "^9.0.0",
31
+ "@types/node": "^18.0.0",
32
32
  "@types/node-fetch": "^2.0.0",
33
- "@types/parse": "^2.0.0",
33
+ "@types/parse": "^3.0.0",
34
34
  "@types/web-push": "^3.0.0",
35
35
  "typescript": "^4.0.0"
36
36
  }
@@ -0,0 +1,51 @@
1
+ {
2
+ "fields": {
3
+ "endpoint": {
4
+ "type": "String",
5
+ "required": true
6
+ },
7
+ "endpointSuffix": {
8
+ "type": "String",
9
+ "required": false
10
+ },
11
+ "header": {
12
+ "type": "Object",
13
+ "required": false,
14
+ "defaultValue": {}
15
+ },
16
+ "name": {
17
+ "type": "String",
18
+ "required": false
19
+ },
20
+ "source": {
21
+ "type": "String",
22
+ "required": true
23
+ }
24
+ },
25
+ "classLevelPermissions": {
26
+ "find": {
27
+ "*": true
28
+ },
29
+ "count": {
30
+ "*": true
31
+ },
32
+ "get": {
33
+ "*": true
34
+ },
35
+ "create": {
36
+ "*": true
37
+ },
38
+ "update": {
39
+ "*": true
40
+ },
41
+ "delete": {
42
+ "*": true
43
+ },
44
+ "addField": {
45
+ "*": true
46
+ },
47
+ "protectedFields": {
48
+ "*": []
49
+ }
50
+ }
51
+ }
@@ -1,5 +1,9 @@
1
1
  {
2
2
  "fields": {
3
+ "description": {
4
+ "type": "String",
5
+ "required": false
6
+ },
3
7
  "kpiData": {
4
8
  "type": "Array",
5
9
  "required": false,