@openinc/parse-server-opendash 3.5.1 → 3.5.2
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.
- package/dist/features/openservice/functions/saveTicketMeta.js +14 -2
- package/dist/features/openservice/types/SaveValues.d.ts +2 -3
- package/dist/features/openservice/types/TicketMeta.d.ts +82 -0
- package/dist/features/openservice/types/TicketMeta.js +11 -0
- package/dist/features/openware/services/publishDataItem.js +1 -5
- package/dist/functions/openinc-geo-google.common.js +1 -5
- package/dist/functions/openinc-geo-graphhopper.common.js +1 -5
- package/dist/functions/openinc-openservice-ticket-data.js +0 -2
- package/dist/hooks/Alarm.js +1 -5
- package/package.json +1 -3
|
@@ -2,9 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.saveTicketMeta = saveTicketMeta;
|
|
4
4
|
async function saveTicketMeta(ticket, value, fetchOptions) {
|
|
5
|
-
const current = ticket.get("meta")
|
|
5
|
+
const current = ticket.get("meta")?.fields
|
|
6
|
+
? { fields: [...ticket.get("meta").fields] }
|
|
7
|
+
: { fields: [] };
|
|
6
8
|
if (value) {
|
|
7
|
-
|
|
9
|
+
const newMetaFields = current.fields;
|
|
10
|
+
const newRemainingFields = [];
|
|
11
|
+
// overriding existing fields
|
|
12
|
+
for (const field of value.fields) {
|
|
13
|
+
const index = newMetaFields.findIndex((v) => v.name === field.name);
|
|
14
|
+
if (index === -1)
|
|
15
|
+
newRemainingFields.push(field);
|
|
16
|
+
else
|
|
17
|
+
newMetaFields[index].value = field.value;
|
|
18
|
+
}
|
|
19
|
+
current.fields = [...newMetaFields, ...newRemainingFields];
|
|
8
20
|
ticket.set("meta", current);
|
|
9
21
|
}
|
|
10
22
|
return await ticket.save(null, fetchOptions);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Material } from "./Material";
|
|
2
2
|
import { MessageField } from "./MessageData";
|
|
3
|
+
import { TicketMeta } from "./TicketMeta";
|
|
3
4
|
export type SaveValues = {
|
|
4
5
|
existingTicketId?: string;
|
|
5
6
|
duedate?: {
|
|
@@ -23,7 +24,5 @@ export type SaveValues = {
|
|
|
23
24
|
state?: string;
|
|
24
25
|
material?: Material[];
|
|
25
26
|
project?: string;
|
|
26
|
-
meta?:
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
};
|
|
27
|
+
meta?: TicketMeta;
|
|
29
28
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export type TicketMeta = {
|
|
2
|
+
fields: TicketTypedMetaField[];
|
|
3
|
+
};
|
|
4
|
+
export type TicketMetaFormField = {
|
|
5
|
+
[key: string]: MetaFieldData["value"];
|
|
6
|
+
};
|
|
7
|
+
export type TicketTypedMetaField = {
|
|
8
|
+
[T in MetaFieldData["type"]]: Extract<TicketMetaField, {
|
|
9
|
+
type: T;
|
|
10
|
+
}> & Extract<MetaFieldData, {
|
|
11
|
+
type: T;
|
|
12
|
+
}>;
|
|
13
|
+
}[MetaFieldData["type"]];
|
|
14
|
+
export type TicketMetaFieldType = (typeof TicketMetaFieldTypes)[number];
|
|
15
|
+
export declare const TicketMetaFieldTypes: readonly ["string", "number", "boolean", "date", "select", "select_parse"];
|
|
16
|
+
type MetaFieldValueString = {
|
|
17
|
+
type: "string";
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
type MetaFieldValueNumber = {
|
|
21
|
+
type: "number";
|
|
22
|
+
value: number;
|
|
23
|
+
};
|
|
24
|
+
type MetaFieldValueBoolean = {
|
|
25
|
+
type: "boolean";
|
|
26
|
+
value: boolean;
|
|
27
|
+
};
|
|
28
|
+
type MetaFieldValueDate = {
|
|
29
|
+
type: "date";
|
|
30
|
+
value: Date;
|
|
31
|
+
};
|
|
32
|
+
type MetaFieldValueSelect = {
|
|
33
|
+
type: "select";
|
|
34
|
+
value: string;
|
|
35
|
+
multiple: false;
|
|
36
|
+
};
|
|
37
|
+
type MetaFieldValueSelectMultiple = {
|
|
38
|
+
type: "select";
|
|
39
|
+
value: string[];
|
|
40
|
+
multiple: true;
|
|
41
|
+
};
|
|
42
|
+
type MetaFieldValueParseSelect = {
|
|
43
|
+
type: "select_parse";
|
|
44
|
+
value: string;
|
|
45
|
+
multiple: false;
|
|
46
|
+
};
|
|
47
|
+
type MetaFieldValueParseSelectMultiple = {
|
|
48
|
+
type: "select_parse";
|
|
49
|
+
value: string[];
|
|
50
|
+
multiple: true;
|
|
51
|
+
};
|
|
52
|
+
type MetaFieldData = MetaFieldValueString | MetaFieldValueNumber | MetaFieldValueBoolean | MetaFieldValueDate | MetaFieldValueSelect | MetaFieldValueSelectMultiple | MetaFieldValueParseSelect | MetaFieldValueParseSelectMultiple;
|
|
53
|
+
export type TicketMetaFieldConfig = {
|
|
54
|
+
fields?: TicketMetaField[];
|
|
55
|
+
};
|
|
56
|
+
export type TicketMetaField = WithDefaults<{
|
|
57
|
+
type: "string";
|
|
58
|
+
}> | WithDefaults<{
|
|
59
|
+
type: "number";
|
|
60
|
+
min?: number;
|
|
61
|
+
max?: number;
|
|
62
|
+
}> | WithDefaults<{
|
|
63
|
+
type: "boolean";
|
|
64
|
+
}> | WithDefaults<{
|
|
65
|
+
type: "date";
|
|
66
|
+
}> | WithDefaults<{
|
|
67
|
+
type: "select";
|
|
68
|
+
options?: string[];
|
|
69
|
+
multiple?: boolean;
|
|
70
|
+
}> | WithDefaults<{
|
|
71
|
+
type: "select_parse";
|
|
72
|
+
className?: string;
|
|
73
|
+
multiple?: boolean;
|
|
74
|
+
display?: string;
|
|
75
|
+
}>;
|
|
76
|
+
type MetaFieldDefault = {
|
|
77
|
+
label?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
name?: string;
|
|
80
|
+
};
|
|
81
|
+
type WithDefaults<T> = T & MetaFieldDefault;
|
|
82
|
+
export {};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.publishDataItem = publishDataItem;
|
|
7
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
4
|
const __1 = require("..");
|
|
9
5
|
const config_1 = require("../../config");
|
|
10
6
|
const LOG_PREFIX = "[@openinc/parse-server-opendash][open.WARE] ";
|
|
@@ -28,7 +24,7 @@ async function publishDataItem(dataItem, usermail, update) {
|
|
|
28
24
|
const headers = {
|
|
29
25
|
Authorization: "Bearer " + token,
|
|
30
26
|
};
|
|
31
|
-
const response = await (
|
|
27
|
+
const response = await fetch(url, {
|
|
32
28
|
method: "POST",
|
|
33
29
|
headers,
|
|
34
30
|
body: JSON.stringify(dataItem),
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getGoogleApiKey = getGoogleApiKey;
|
|
7
4
|
exports.get = get;
|
|
8
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
5
|
const url_1 = require("url");
|
|
10
6
|
const config_1 = require("../features/config");
|
|
11
7
|
function getGoogleApiKey() {
|
|
@@ -24,7 +20,7 @@ async function get(path, params) {
|
|
|
24
20
|
qs.set(key, value);
|
|
25
21
|
}
|
|
26
22
|
const url = "https://maps.googleapis.com" + path + "?" + qs.toString();
|
|
27
|
-
const response = await (
|
|
23
|
+
const response = await fetch(url);
|
|
28
24
|
if (!response.ok) {
|
|
29
25
|
throw new Error("Bad Statuscode");
|
|
30
26
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.get = get;
|
|
7
4
|
exports.getGeoCodingResult = getGeoCodingResult;
|
|
8
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
5
|
const config_1 = require("../features/config");
|
|
10
6
|
async function get(path, params, qs2 = "") {
|
|
11
7
|
const GRAPHHOPPER_HOST = config_1.ConfigInstance.getInstance().get("GEO_GRAPHHOPPER_HOST");
|
|
@@ -24,7 +20,7 @@ async function get(path, params, qs2 = "") {
|
|
|
24
20
|
}
|
|
25
21
|
const url = GRAPHHOPPER_HOST + path + "?" + qs.toString() + qs2;
|
|
26
22
|
console.log(url);
|
|
27
|
-
const response = await (
|
|
23
|
+
const response = await fetch(url);
|
|
28
24
|
if (!response.ok) {
|
|
29
25
|
throw new Error("Bad Statuscode");
|
|
30
26
|
}
|
|
@@ -45,11 +45,9 @@ async function handleRequest(request) {
|
|
|
45
45
|
if (request.params.config[0].sortBy && request.params.config[0].order) {
|
|
46
46
|
ticketQuery = ticketQuery.includeAll();
|
|
47
47
|
if (request.params.config[0].order === "asc") {
|
|
48
|
-
// @ts-ignore
|
|
49
48
|
ticketQuery = ticketQuery.ascending(request.params.config[0].sortBy);
|
|
50
49
|
}
|
|
51
50
|
else {
|
|
52
|
-
// @ts-ignore
|
|
53
51
|
ticketQuery = ticketQuery.descending(request.params.config[0].sortBy);
|
|
54
52
|
}
|
|
55
53
|
}
|
package/dist/hooks/Alarm.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.init = init;
|
|
7
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
4
|
const __1 = require("..");
|
|
9
5
|
const config_1 = require("../features/config");
|
|
10
6
|
const types_1 = require("../types");
|
|
@@ -29,7 +25,7 @@ async function init() {
|
|
|
29
25
|
updatedAt: undefined,
|
|
30
26
|
ACL: undefined,
|
|
31
27
|
});
|
|
32
|
-
await (
|
|
28
|
+
await fetch(`${baseurl}/api/alarmsV2/${username}`, {
|
|
33
29
|
method: "POST",
|
|
34
30
|
headers,
|
|
35
31
|
body,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openinc/parse-server-opendash",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.2",
|
|
4
4
|
"description": "Parse Server Cloud Code for open.INC Stack.",
|
|
5
5
|
"packageManager": "pnpm@10.11.0",
|
|
6
6
|
"keywords": [
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"dayjs": "^1.11.13",
|
|
69
69
|
"fast-equals": "^5.2.2",
|
|
70
70
|
"jsonwebtoken": "^9.0.2",
|
|
71
|
-
"node-fetch": "^3.3.2",
|
|
72
71
|
"nodemailer": "^6.10.1",
|
|
73
72
|
"nunjucks": "^3.2.4",
|
|
74
73
|
"parse-server": "^8.2.0",
|
|
@@ -87,7 +86,6 @@
|
|
|
87
86
|
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
88
87
|
"@types/jsonwebtoken": "^9.0.9",
|
|
89
88
|
"@types/node": "^22.15.21",
|
|
90
|
-
"@types/node-fetch": "^2.6.12",
|
|
91
89
|
"@types/nodemailer": "^6.4.17",
|
|
92
90
|
"@types/nunjucks": "^3.2.6",
|
|
93
91
|
"@types/parse": "^3.0.9",
|