@openinc/parse-server-opendash 5.0.0 → 5.1.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.
@@ -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
  {
@@ -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 kill switch
127
- // and for changed credentials.
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openinc/parse-server-opendash",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Parse Server Cloud Code for open.INC Stack.",
5
5
  "packageManager": "pnpm@12.21.0",
6
6
  "keywords": [