@openinc/parse-server-opendash 3.5.3 → 3.6.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Sebastian Zilles
3
+ Copyright (c) open.INC GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -2,22 +2,26 @@
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")?.fields
6
- ? { fields: [...ticket.get("meta").fields] }
7
- : { fields: [] };
5
+ const currentMeta = ticket.get("meta") ?? {
6
+ fields: [],
7
+ };
8
8
  if (value) {
9
- const newMetaFields = current.fields;
10
- const newRemainingFields = [];
9
+ const updatedMetaFields = currentMeta.fields ?? [];
10
+ const newMetaFields = [];
11
11
  // overriding existing fields
12
12
  for (const field of value.fields) {
13
- const index = newMetaFields.findIndex((v) => v.name === field.name);
13
+ const index = updatedMetaFields.findIndex((v) => v.name === field.name);
14
14
  if (index === -1)
15
- newRemainingFields.push(field);
15
+ newMetaFields.push(field);
16
16
  else
17
- newMetaFields[index].value = field.value;
17
+ updatedMetaFields[index].value = field.value;
18
18
  }
19
- current.fields = [...newMetaFields, ...newRemainingFields];
20
- ticket.set("meta", current);
19
+ currentMeta.fields = [...updatedMetaFields, ...newMetaFields];
20
+ ticket.set("meta", {
21
+ ...currentMeta, // use all existing values
22
+ ...value, // override with new values
23
+ fields: currentMeta.fields, // use the updated fields
24
+ });
21
25
  }
22
26
  return await ticket.save(null, fetchOptions);
23
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "3.5.3",
3
+ "version": "3.6.1",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@10.11.0",
6
6
  "keywords": [
@@ -52,7 +52,7 @@
52
52
  "schema-up": "parse-server-schema up --prefix OD3_ ./schema",
53
53
  "schema-ts": "parse-server-schema typescript --prefix OD3_ --global-sdk ./src/types",
54
54
  "typedoc": "typedoc --plugin typedoc-plugin-markdown --hideBreadcrumbs --out docs src/index.ts",
55
- "predevstart": "./setup_scripts/installDeps.sh",
55
+ "predevstart": "./setup_scripts/postStartHook.sh && ./setup_scripts/installDeps.sh",
56
56
  "devstart": "parse-server ./config.js",
57
57
  "featuremap": "node ./scripts/create-featuremap.js",
58
58
  "hooks": "node ./scripts/create-hooks.js",