@grouparoo/core
Version:
The Grouparoo Core
109 lines (108 loc) • 4.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSetupStepDescriptions = void 0;
const plugin_1 = require("../plugin");
const GrouparooModel_1 = require("../../models/GrouparooModel");
const App_1 = require("../../models/App");
const Source_1 = require("../../models/Source");
const Destination_1 = require("../../models/Destination");
const Export_1 = require("../../models/Export");
const runMode_1 = require("../runMode");
const configURL = "https://www.grouparoo.com/docs/config";
const getSetupStepDescriptions = (modelId) => {
const allSetupStepDescriptions = [
{
key: "install_grouparoo",
title: "Install Grouparoo",
description: "Install the Grouparoo package.",
href: undefined,
cta: undefined,
showCtaOnCommunity: false,
helpLink: `https://www.grouparoo.com/docs/installation`,
check: async () => true,
disabled: async () => false,
runModes: ["cli:config"],
},
{
key: "name_your_grouparoo_instance",
title: "Name your Grouparoo Instance",
description: "Give your Grouparoo cluster a name.",
href: "/settings/core",
cta: "Change your Grouparoo Cluster Name",
showCtaOnCommunity: true,
helpLink: `${configURL}/settings`,
check: async () => {
const setting = await plugin_1.plugin.readSetting("core", "cluster-name");
return setting.value !== setting.defaultValue;
},
disabled: async () => false,
runModes: ["cli:start", "cli:run"],
},
{
key: "add_an_app",
title: "Add an App",
description: "Add your first App to Grouparoo. Apps are used to connect to your Databases and APIs.",
href: "/apps",
cta: "Add an App",
helpLink: `${configURL}/apps`,
check: async () => {
const count = await App_1.App.count();
return count > 0;
},
disabled: async () => false,
runModes: ["cli:start", "cli:run", "cli:config"],
},
{
key: "add_a_model",
title: "Add a Model",
description: "Models define the shape of your Records. You can add new Models and customize them when you begin adding Sources and Properties.",
href: "/model/new",
cta: "Add a Model",
helpLink: `${configURL}/models`,
check: async () => {
const count = await GrouparooModel_1.GrouparooModel.count();
return count > 0;
},
disabled: async () => false,
runModes: ["cli:start", "cli:run", "cli:config"],
},
{
key: "configure_a_model",
title: "Define your Model Data",
description: "Create Sources and Properties to define the data in your Grouparoo Model.",
href: modelId ? `/model/${modelId}/overview` : "/model/new",
cta: "Configure the Model",
helpLink: `${configURL}/sources`,
check: async () => {
const count = await Source_1.Source.count();
return count > 0;
},
disabled: async () => (await App_1.App.count()) === 0 || (await GrouparooModel_1.GrouparooModel.count()) === 0,
runModes: ["cli:start", "cli:run", "cli:config"],
},
{
key: "create_a_destination",
title: "Create a Destination",
description: "Create a Destination to sync your Records and Group Memberships. Grouparoo will automatically send all new information to the Destinations relevant to each Record.",
href: modelId ? `/model/${modelId}/overview#destinations` : "/model/new",
cta: "Add a Destination",
helpLink: `${configURL}/destinations`,
check: async () => {
const count = await Destination_1.Destination.count();
return count > 0;
},
outcome: async () => {
const count = await Export_1.Export.count();
return `${count} Records exported to a Destination`;
},
disabled: async () => (await Source_1.Source.count()) === 0,
runModes: ["cli:start", "cli:run", "cli:config"],
},
];
return allSetupStepDescriptions
.filter((ssd) => { var _a; return ssd.runModes.includes((_a = (0, runMode_1.getGrouparooRunMode)()) !== null && _a !== void 0 ? _a : "cli:start"); })
.map((ssd, idx) => {
return { ...ssd, position: idx + 1 };
});
};
exports.getSetupStepDescriptions = getSetupStepDescriptions;