UNPKG

@grouparoo/core

Version:
180 lines (179 loc) 7.95 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SettingOps = void 0; const UUID = __importStar(require("uuid")); const sequelize_1 = require("sequelize"); const Setting_1 = require("../../models/Setting"); const plugin_1 = require("../../modules/plugin"); var SettingOps; (function (SettingOps) { async function prepare() { const settingKeys = [ ...SettingOps.coreSettings, ...SettingOps.interfaceSettings, ...SettingOps.telemetrySettings, ].map(({ key }) => key); await cleanSettings(settingKeys); await this.registerSettingsArray(SettingOps.coreSettings, "core"); await this.registerSettingsArray(SettingOps.interfaceSettings, "interface"); await this.registerSettingsArray(SettingOps.telemetrySettings, "telemetry"); } SettingOps.prepare = prepare; async function cleanSettings(inUseKeys) { return Setting_1.Setting.destroy({ where: { key: { [sequelize_1.Op.notIn]: inUseKeys }, }, }); } SettingOps.cleanSettings = cleanSettings; async function registerSettingsArray(settingsList, pluginName) { for (const i in settingsList) { const { key, title, defaultValue, description, type, variant } = settingsList[i]; await plugin_1.plugin.registerSetting(pluginName, key, title, defaultValue, description, type, variant); } } SettingOps.registerSettingsArray = registerSettingsArray; SettingOps.coreSettings = [ { key: "cluster-name", title: "Cluster: Name", defaultValue: "My Grouparoo Cluster", description: "A way to identify this Grouparoo cluster. Will be displayed in the web interface and sent with Telemetry.", type: "string", }, { key: "groups-calculation-delay-minutes", title: "Groups: Calculation Delay Minutes", defaultValue: 60 * 24, description: "How many minutes should wait before recalculating a calculated Group's membership?", type: "number", }, { key: "runs-recurring-internal-run-frequency-hours", title: "Runs: Recurring Internal Run Frequency Hours", defaultValue: 0, description: "Should Grouparoo periodically re-import all of your records, and if so, how long between runs (in hours)?", type: "number", }, { key: "imports-retry-delay-seconds", title: "Imports Retry Delay Seconds", defaultValue: 60 * 30, description: "How long before Grouparoo considers a started but not-yet-complete Import to have stalled and try again?", type: "number", }, { key: "runs-previous-can-include-errors", title: "Runs: Previous Runs with Errors Considered", defaultValue: "false", description: "When creating a new Run for a Source/Schedule, we check the most recent complete run to configure it. This includes setting the starting HighWaterMark for the Run. Should we consider those Runs which have an error?", type: "boolean", variant: "warning", }, { key: "exports-retry-delay-seconds", title: "Exports Retry Delay Seconds", defaultValue: 60 * 30, description: "How long before Grouparoo considers a started but not-yet-complete Export to have stalled and try again?", type: "number", }, { key: "exports-max-retries-count", title: "Exports Maximum Retry Count", defaultValue: 5, description: "How many times should we attempt to retry an Export before considering it failed?", type: "number", }, { key: "export-processors-retry-delay-seconds", title: "Export Processors Retry Delay Seconds", defaultValue: 60 * 30, description: "How long before Grouparoo considers a started but not-yet-complete Export Processor to have stalled and try again?", type: "number", }, { key: "export-processors-max-retries-count", title: "Export Processors Maximum Retry Count", defaultValue: 10, description: "How many times should we attempt to check on an Export Processor before considering it failed?", type: "number", }, { key: "records-default-country-code", title: "Record: Default Country Code", defaultValue: "US", description: "The default country code Grouparoo will use to format phone numbers and display data", type: "string", }, { key: "confirm-records-days", title: "Confirm Record Existence Days", defaultValue: 7, description: "How often should Grouparoo check that a Record still exists in your Source, deleting the Record if it has been removed? Setting to `0` will disable this check.", type: "number", }, { key: "sweeper-delete-old-runs-days", title: "Sweeper: Delete Old Runs Days", defaultValue: 31, description: "How many days should we keep Run records for on the server once they are stopped or complete?", type: "number", }, { key: "sweeper-delete-old-imports-days", title: "Sweeper: Delete Old Imports Days", defaultValue: 31, description: "How many days should we keep Import records for on the server?", type: "number", }, { key: "sweeper-delete-old-logs-days", title: "Sweeper: Delete Old Logs Days", defaultValue: 7, description: "How many days should we keep Log records for on the server?", type: "number", }, ]; SettingOps.interfaceSettings = [ { key: "status-calculation-frequency-seconds", title: "Status Calculation Frequency Seconds", defaultValue: 10, description: "How often should Grouparoo calculate updated status and totals for the UI? This includes information on the Dashboard, pending Runs, and Resque information. For larger clusters, calculating this often may have adverse effects.", type: "number", }, ]; SettingOps.telemetrySettings = [ { key: "customer-id", title: "Customer Id", defaultValue: `tcs_${UUID.v4()}`, description: "A unique, anonymous ID for this Grouparoo cluster.", type: "string", }, ]; })(SettingOps = exports.SettingOps || (exports.SettingOps = {}));