@openinc/parse-server-opendash 4.8.0 → 4.8.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.
@@ -11,6 +11,7 @@ const index_js_1 = require("../../config/index.js");
11
11
  const SchemaClass_js_1 = require("../classes/SchemaClass.js");
12
12
  const isClassEnabled_js_1 = require("../helper/isClassEnabled.js");
13
13
  const PREFIX = "OD3_";
14
+ const LOG_PREFIX = "[@openinc/parse-server-opendash]";
14
15
  const schemaHandler = SchemaClass_js_1.SchemaClass.getInstance();
15
16
  async function initSchema() {
16
17
  const config = index_js_1.ConfigInstance.getInstance();
@@ -23,14 +24,45 @@ async function initSchema() {
23
24
  deleteNonEmptyClass: config.getBoolean("FORCE_DELETE_CLASS"),
24
25
  filter: (className) => (0, isClassEnabled_js_1.isClassEnabled)(className),
25
26
  });
27
+ }
28
+ catch (error) {
29
+ console.error(`${LOG_PREFIX} Error while uploading schema`);
30
+ console.error(error);
31
+ process.exit(1);
32
+ }
33
+ // Unlike the upload above, which sends its own master key header, this goes
34
+ // through the Parse SDK and relies on Parse Server having initialized it.
35
+ try {
26
36
  schemaHandler.setSchema(Object.fromEntries((await node_1.default.Schema.all()).map((schema) => [
27
37
  schema.className,
28
38
  schema,
29
39
  ])));
30
40
  }
31
41
  catch (error) {
32
- console.error("Error while updating schema");
42
+ console.error(`${LOG_PREFIX} Error while loading schema via Parse SDK`);
43
+ logParseSdkState();
33
44
  console.error(error);
34
45
  process.exit(1);
35
46
  }
36
47
  }
48
+ /**
49
+ * Logs which Parse SDK this package talks to. If it is not the instance Parse
50
+ * Server initialized (`global.Parse`), it has no master key — typically because
51
+ * the package manager installed a second copy of `parse`.
52
+ */
53
+ function logParseSdkState() {
54
+ const serverParse = globalThis.Parse;
55
+ let sdkPath = "unknown";
56
+ try {
57
+ sdkPath = require.resolve("parse/node");
58
+ }
59
+ catch (error) { }
60
+ console.error(`${LOG_PREFIX} Parse SDK: ${node_1.default.CoreManager.get("VERSION")} (${sdkPath})`);
61
+ console.error(`${LOG_PREFIX} Parse SDK of Parse Server: ` +
62
+ (serverParse
63
+ ? `${serverParse.CoreManager.get("VERSION")}, same instance: ${serverParse === node_1.default}`
64
+ : "global.Parse not set"));
65
+ console.error(`${LOG_PREFIX} applicationId: ${node_1.default.applicationId || "(not set)"}, ` +
66
+ `serverURL: ${node_1.default.serverURL || "(not set)"}, ` +
67
+ `masterKey: ${node_1.default.masterKey ? "set" : "(not set)"}`);
68
+ }
@@ -62,11 +62,17 @@ async function init() {
62
62
  // gates the button in the UI now gates the write as well. Until this,
63
63
  // `can-perform-execution` only hid a button: anyone who could reach the
64
64
  // Parse class could sign a protocol.
65
+ //
66
+ // Takes the session token from `request`, not from `request.user`, and that
67
+ // is not a style choice: `defaultHandler` above does
68
+ // `request.user.fetch({ useMasterKey: true })`, which refetches the *same*
69
+ // `Parse.User` instance in place. `_User` has no `sessionToken` column — it
70
+ // lives in `_Session` — so the fetch leaves the object without one, and
71
+ // every later `user.getSessionToken()` returns undefined. `beforeSaveHook`
72
+ // captures the token at trigger entry, before any of this runs, which is
73
+ // why every other call site passes `request` and works.
65
74
  if (object.isNew()) {
66
- await (0, index_js_2.requirePermission)({
67
- sessionToken: user?.getSessionToken(),
68
- master: request.master,
69
- }, Permissions_js_1.Permissions.SERVICE.execution_perform, "perform a maintenance execution");
75
+ await (0, index_js_2.requirePermission)(request, Permissions_js_1.Permissions.SERVICE.execution_perform, "perform a maintenance execution");
70
76
  }
71
77
  // Who performed it is established by the server from the session, not
72
78
  // accepted from the client. A protocol that names somebody else is worth
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "4.8.0",
3
+ "version": "4.8.2",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@11.25.0",
6
6
  "keywords": [
@@ -75,15 +75,15 @@
75
75
  "cron": "^4.4.0",
76
76
  "dayjs": "^1.11.23",
77
77
  "dotenv": "^17.4.2",
78
- "fast-equals": "^6.0.3",
78
+ "fast-equals": "^6.0.4",
79
79
  "i18next": "^26.4.2",
80
80
  "i18next-fs-backend": "^2.6.8",
81
81
  "jsonwebtoken": "^9.0.3",
82
82
  "jwks-rsa": "^4.1.0",
83
83
  "nodemailer": "^9.1.1",
84
84
  "nunjucks": "^3.2.4",
85
- "parse": "^8.6.0",
86
- "parse-server": "9.10.0",
85
+ "parse": "^8.6.2",
86
+ "parse-server": "9.10.1",
87
87
  "pdf-img-convert": "2.0.0",
88
88
  "rimraf": "^6.1.3",
89
89
  "table": "^6.9.0",
@@ -92,17 +92,17 @@
92
92
  },
93
93
  "devDependencies": {
94
94
  "@types/jsonwebtoken": "^9.0.10",
95
- "@types/node": "^25.9.5",
96
- "@types/nodemailer": "^8.0.1",
95
+ "@types/node": "^25.9.8",
96
+ "@types/nodemailer": "^8.0.2",
97
97
  "@types/nunjucks": "^3.2.6",
98
98
  "@types/safe-timers": "^1.1.2",
99
99
  "@types/web-push": "^3.6.4",
100
100
  "concurrently": "^10.0.5",
101
- "prettier": "^3.8.3",
101
+ "prettier": "^3.9.9",
102
102
  "prettier-plugin-organize-imports": "^4.3.0",
103
103
  "ts-node": "^10.9.2",
104
104
  "typedoc": "^0.28.20",
105
- "typedoc-plugin-markdown": "^4.13.0",
105
+ "typedoc-plugin-markdown": "^4.13.1",
106
106
  "typescript": "^5.9.3"
107
107
  }
108
108
  }