@openinc/parse-server-opendash 5.0.0 → 5.1.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/dist/features/config/helper/customOptions.js +1 -1
- package/dist/features/config/types/ConfigKeys.js +1 -1
- package/dist/features/notifications/types/Notifications.d.ts +6 -5
- package/dist/features/notifications/types/Notifications.js +5 -8
- package/dist/features/openservice/serviceSchedules/calendarSync/ServiceCalendarSyncPoller.js +3 -3
- package/dist/features/openservice/serviceSchedules/calendarSync/ServiceSyncTypes.d.ts +8 -0
- package/dist/features/openservice/serviceSchedules/calendarSync/syncPlanToCalendar.js +3 -0
- package/dist/features/openservice/serviceSchedules/initServiceSchedulesFeature.d.ts +2 -1
- package/dist/features/openservice/serviceSchedules/initServiceSchedulesFeature.js +2 -1
- package/dist/features/schema/services/initSchema.js +18 -0
- package/package.json +1 -1
|
@@ -222,7 +222,7 @@ exports.customoptions = {
|
|
|
222
222
|
secret: false,
|
|
223
223
|
public: true,
|
|
224
224
|
default: "false",
|
|
225
|
-
description: "Create the classes of open.SERVICE v1 (OD3_Maintenance_*). No runtime any more — only for installations that still have to run the v1 → v2 migration.",
|
|
225
|
+
description: "Create the classes of open.SERVICE v1 (OD3_Maintenance_*). No runtime any more — only for installations that still have to run the v1 → v2 migration. Off leaves existing v1 classes and their data untouched, even with FORCE_SCHEMA and FORCE_DELETE_CLASS.",
|
|
226
226
|
},
|
|
227
227
|
FEATURE_MIAAS: {
|
|
228
228
|
env: "OPENINC_PARSE_FEATURE_MIAAS",
|
|
@@ -40,7 +40,7 @@ exports.OPENSERVICE_CONFIG_KEYS = [
|
|
|
40
40
|
secret: true,
|
|
41
41
|
// No default: without the customer's client secret there is nothing to
|
|
42
42
|
// write. Not `required` either — the sync is optional. Optional fields
|
|
43
|
-
// (default_equipment_id, import_category, inbound_disabled): see
|
|
43
|
+
// (default_equipment_id, import_category, inbound_disabled, disabled): see
|
|
44
44
|
// serviceSchedules/calendarSync/README.md.
|
|
45
45
|
},
|
|
46
46
|
{
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { NotificationMap } from "./NotificationTypes.js";
|
|
1
2
|
/**
|
|
2
3
|
* Notifications that should be registered in the database by default when the server starts.
|
|
3
4
|
* The ACLs are set to od-admin only.
|
|
4
5
|
* Adding new Notification here requires the server to restart for registering those.
|
|
6
|
+
*
|
|
7
|
+
* One enum of keys per feature, e.g. `{ Feature: { key: "<ns>:notification.<key>" } }`.
|
|
8
|
+
* Empty since open.SERVICE v1 and its `schedule_due` were removed; the
|
|
9
|
+
* `OD3_Notification_Setting` rows registered for it stay in the database.
|
|
5
10
|
*/
|
|
6
|
-
export declare
|
|
7
|
-
enum OpenService {
|
|
8
|
-
schedule_due = "maintenance:notification.schedule_due"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
+
export declare const Notifications: NotificationMap;
|
|
@@ -5,12 +5,9 @@ exports.Notifications = void 0;
|
|
|
5
5
|
* Notifications that should be registered in the database by default when the server starts.
|
|
6
6
|
* The ACLs are set to od-admin only.
|
|
7
7
|
* Adding new Notification here requires the server to restart for registering those.
|
|
8
|
+
*
|
|
9
|
+
* One enum of keys per feature, e.g. `{ Feature: { key: "<ns>:notification.<key>" } }`.
|
|
10
|
+
* Empty since open.SERVICE v1 and its `schedule_due` were removed; the
|
|
11
|
+
* `OD3_Notification_Setting` rows registered for it stay in the database.
|
|
8
12
|
*/
|
|
9
|
-
|
|
10
|
-
(function (Notifications) {
|
|
11
|
-
// needs to be exported for getAllNotifications() to work
|
|
12
|
-
let OpenService;
|
|
13
|
-
(function (OpenService) {
|
|
14
|
-
OpenService["schedule_due"] = "maintenance:notification.schedule_due";
|
|
15
|
-
})(OpenService = Notifications.OpenService || (Notifications.OpenService = {}));
|
|
16
|
-
})(Notifications || (exports.Notifications = Notifications = {}));
|
|
13
|
+
exports.Notifications = {};
|
package/dist/features/openservice/serviceSchedules/calendarSync/ServiceCalendarSyncPoller.js
CHANGED
|
@@ -123,11 +123,11 @@ class ServiceCalendarSyncPoller {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
async runPoll() {
|
|
126
|
-
// The row is also the admin form's storage: re-read for the
|
|
127
|
-
//
|
|
126
|
+
// The row is also the admin form's storage: re-read for the switches and
|
|
127
|
+
// for changed credentials.
|
|
128
128
|
this.config = await this.config.fetch({ useMasterKey: true });
|
|
129
129
|
const values = this.values;
|
|
130
|
-
if (values.inbound_disabled)
|
|
130
|
+
if (values.disabled || values.inbound_disabled)
|
|
131
131
|
return;
|
|
132
132
|
const manager = this.manager;
|
|
133
133
|
if (manager.isValid !== true)
|
|
@@ -26,6 +26,14 @@ export type ServiceSyncConfigValues = {
|
|
|
26
26
|
* takes effect without a restart.
|
|
27
27
|
*/
|
|
28
28
|
inbound_disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Switches the whole connection off, both directions, while keeping the
|
|
31
|
+
* credentials. Nothing is written to the calendar and nothing is read back.
|
|
32
|
+
* Re-read on every pass and every plan save, so it takes effect without a
|
|
33
|
+
* restart. Plans changed in the meantime reach the calendar on their next
|
|
34
|
+
* save (or through `openinc-openservice-schedule-calendar-sync`).
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
29
37
|
};
|
|
30
38
|
/**
|
|
31
39
|
* The recurrence of a v2 maintenance plan, as stored in
|
|
@@ -172,6 +172,9 @@ async function connectionForTenant(tenant) {
|
|
|
172
172
|
console.error(`[ServiceCalendarSync] Config ${config.id} does not contain valid JSON`);
|
|
173
173
|
return null;
|
|
174
174
|
}
|
|
175
|
+
// Switched off in the admin form — the credentials stay, nothing is written.
|
|
176
|
+
if (values.disabled)
|
|
177
|
+
return null;
|
|
175
178
|
const manager = new CalendarManager_js_1.CalendarManager({
|
|
176
179
|
tenantId: values.tenant_id,
|
|
177
180
|
clientID: values.client_id,
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* The connections are read once at boot: a tenant that switches the sync on
|
|
7
7
|
* gets the inbound side after the next server start. Switching it off again
|
|
8
|
-
* (`inbound_disabled` in the row) takes effect on the next pass
|
|
8
|
+
* (`disabled` or `inbound_disabled` in the row) takes effect on the next pass,
|
|
9
|
+
* and so does switching it back on: a disabled row still gets its poller.
|
|
9
10
|
*/
|
|
10
11
|
export declare function initServiceSchedulesFeature(): Promise<void>;
|
|
11
12
|
/** Stop every poller — for tests and for a graceful shutdown. */
|
|
@@ -24,7 +24,8 @@ const pollers = [];
|
|
|
24
24
|
*
|
|
25
25
|
* The connections are read once at boot: a tenant that switches the sync on
|
|
26
26
|
* gets the inbound side after the next server start. Switching it off again
|
|
27
|
-
* (`inbound_disabled` in the row) takes effect on the next pass
|
|
27
|
+
* (`disabled` or `inbound_disabled` in the row) takes effect on the next pass,
|
|
28
|
+
* and so does switching it back on: a disabled row still gets its poller.
|
|
28
29
|
*/
|
|
29
30
|
async function initServiceSchedulesFeature() {
|
|
30
31
|
stopServiceSchedulesFeature();
|
|
@@ -14,6 +14,23 @@ const ensureIndexes_js_1 = require("./ensureIndexes.js");
|
|
|
14
14
|
const PREFIX = "OD3_";
|
|
15
15
|
const LOG_PREFIX = "[@openinc/parse-server-opendash]";
|
|
16
16
|
const schemaHandler = SchemaClass_js_1.SchemaClass.getInstance();
|
|
17
|
+
/**
|
|
18
|
+
* Remote classes the upload must leave alone.
|
|
19
|
+
*
|
|
20
|
+
* `OD3_Maintenance_*` is open.SERVICE v1: no runtime any more, but its data
|
|
21
|
+
* stays in the database for the v1 → v2 migration (`src/scripts/migration/`).
|
|
22
|
+
* With `FEATURE_MAINTENANCE` off, `filter` drops these classes from the
|
|
23
|
+
* *local* schema only — the remote side is filtered by `ignore` alone — so
|
|
24
|
+
* `FORCE_SCHEMA` + `FORCE_DELETE_CLASS` would delete every v1 class, data and
|
|
25
|
+
* all, as "not in the local schema".
|
|
26
|
+
*
|
|
27
|
+
* With the flag on they must not be ignored: they are in the local schema
|
|
28
|
+
* then, and a remote class the upload cannot see would be created a second
|
|
29
|
+
* time, which fails the start.
|
|
30
|
+
*/
|
|
31
|
+
function ignoredRemoteClasses() {
|
|
32
|
+
return (0, index_js_1.isFeatureEnabled)("MAINTENANCE") ? [] : ["OD3_Maintenance_*"];
|
|
33
|
+
}
|
|
17
34
|
async function initSchema() {
|
|
18
35
|
const config = index_js_1.ConfigInstance.getInstance();
|
|
19
36
|
await (0, parse_server_schema_1.loadConfig)();
|
|
@@ -24,6 +41,7 @@ async function initSchema() {
|
|
|
24
41
|
deleteFields: config.getBoolean("FORCE_SCHEMA"),
|
|
25
42
|
deleteNonEmptyClass: config.getBoolean("FORCE_DELETE_CLASS"),
|
|
26
43
|
filter: (className) => (0, isClassEnabled_js_1.isClassEnabled)(className),
|
|
44
|
+
ignore: ignoredRemoteClasses(),
|
|
27
45
|
});
|
|
28
46
|
}
|
|
29
47
|
catch (error) {
|