@antelopejs/dms-antelope-cloud 0.0.0-stage → 0.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.
- package/LICENSE +201 -0
- package/README.md +447 -2
- package/dist/cloud-status.d.ts +13 -0
- package/dist/cloud-status.js +77 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +104 -0
- package/dist/configured.d.ts +16 -0
- package/dist/configured.js +26 -0
- package/dist/connection/actions.d.ts +40 -0
- package/dist/connection/actions.js +120 -0
- package/dist/connection/announce.d.ts +8 -0
- package/dist/connection/announce.js +20 -0
- package/dist/connection/cloud.d.ts +60 -0
- package/dist/connection/cloud.js +87 -0
- package/dist/connection/content.d.ts +70 -0
- package/dist/connection/content.js +462 -0
- package/dist/connection/current.d.ts +26 -0
- package/dist/connection/current.js +28 -0
- package/dist/connection/device-flow.d.ts +16 -0
- package/dist/connection/device-flow.js +146 -0
- package/dist/connection/refusals.d.ts +51 -0
- package/dist/connection/refusals.js +85 -0
- package/dist/connection/repository.d.ts +28 -0
- package/dist/connection/repository.js +69 -0
- package/dist/connection/seal.d.ts +22 -0
- package/dist/connection/seal.js +47 -0
- package/dist/connection/store.d.ts +294 -0
- package/dist/connection/store.js +165 -0
- package/dist/connection/view.d.ts +39 -0
- package/dist/connection/view.js +39 -0
- package/dist/dashboard/actions.d.ts +40 -0
- package/dist/dashboard/actions.js +115 -0
- package/dist/dashboard/dockerfile.d.ts +34 -0
- package/dist/dashboard/dockerfile.js +71 -0
- package/dist/dashboard/service.d.ts +61 -0
- package/dist/dashboard/service.js +137 -0
- package/dist/dashboard/variables.d.ts +30 -0
- package/dist/dashboard/variables.js +34 -0
- package/dist/deployments/build-log.d.ts +39 -0
- package/dist/deployments/build-log.js +57 -0
- package/dist/deployments/cloud-steps.d.ts +77 -0
- package/dist/deployments/cloud-steps.js +132 -0
- package/dist/deployments/content.d.ts +61 -0
- package/dist/deployments/content.js +268 -0
- package/dist/deployments/deployment.d.ts +96 -0
- package/dist/deployments/deployment.js +3 -0
- package/dist/deployments/follow.d.ts +18 -0
- package/dist/deployments/follow.js +112 -0
- package/dist/deployments/ledger.d.ts +23 -0
- package/dist/deployments/ledger.js +359 -0
- package/dist/deployments/lifecycle.d.ts +123 -0
- package/dist/deployments/lifecycle.js +146 -0
- package/dist/deployments/live.d.ts +28 -0
- package/dist/deployments/live.js +54 -0
- package/dist/deployments/publish-read.d.ts +20 -0
- package/dist/deployments/publish-read.js +24 -0
- package/dist/deployments/refusals.d.ts +13 -0
- package/dist/deployments/refusals.js +35 -0
- package/dist/environments/actions.d.ts +86 -0
- package/dist/environments/actions.js +210 -0
- package/dist/environments/address.d.ts +60 -0
- package/dist/environments/address.js +149 -0
- package/dist/environments/content.d.ts +97 -0
- package/dist/environments/content.js +275 -0
- package/dist/environments/follower.d.ts +32 -0
- package/dist/environments/follower.js +114 -0
- package/dist/environments/pipeline.d.ts +58 -0
- package/dist/environments/pipeline.js +76 -0
- package/dist/environments/publish-targets.d.ts +18 -0
- package/dist/environments/publish-targets.js +55 -0
- package/dist/environments/roles.d.ts +73 -0
- package/dist/environments/roles.js +97 -0
- package/dist/frontend-module.d.ts +12 -0
- package/dist/frontend-module.js +25 -0
- package/dist/git/changed-files.d.ts +30 -0
- package/dist/git/changed-files.js +107 -0
- package/dist/git/changes.d.ts +89 -0
- package/dist/git/changes.js +162 -0
- package/dist/git/command.d.ts +51 -0
- package/dist/git/command.js +231 -0
- package/dist/git/promotion.d.ts +23 -0
- package/dist/git/promotion.js +46 -0
- package/dist/git/publish-input.d.ts +42 -0
- package/dist/git/publish-input.js +62 -0
- package/dist/git/publish-job.d.ts +82 -0
- package/dist/git/publish-job.js +99 -0
- package/dist/git/publish-steps.d.ts +90 -0
- package/dist/git/publish-steps.js +205 -0
- package/dist/git/publisher.d.ts +23 -0
- package/dist/git/publisher.js +206 -0
- package/dist/git/refs.d.ts +99 -0
- package/dist/git/refs.js +178 -0
- package/dist/git/refusal.d.ts +49 -0
- package/dist/git/refusal.js +70 -0
- package/dist/git/repository.d.ts +101 -0
- package/dist/git/repository.js +273 -0
- package/dist/git/versions.d.ts +99 -0
- package/dist/git/versions.js +174 -0
- package/dist/git/write-lock.d.ts +19 -0
- package/dist/git/write-lock.js +49 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +59 -0
- package/dist/lifecycle.d.ts +8 -0
- package/dist/lifecycle.js +78 -0
- package/dist/logs/relay.d.ts +25 -0
- package/dist/logs/relay.js +138 -0
- package/dist/null-prototype.d.ts +7 -0
- package/dist/null-prototype.js +3 -0
- package/dist/overview/content.d.ts +40 -0
- package/dist/overview/content.js +172 -0
- package/dist/pages/changes.d.ts +32 -0
- package/dist/pages/changes.js +141 -0
- package/dist/pages/connection.d.ts +43 -0
- package/dist/pages/connection.js +295 -0
- package/dist/pages/deployment.d.ts +67 -0
- package/dist/pages/deployment.js +261 -0
- package/dist/pages/deployments.d.ts +46 -0
- package/dist/pages/deployments.js +266 -0
- package/dist/pages/environments.d.ts +34 -0
- package/dist/pages/environments.js +368 -0
- package/dist/pages/logs.d.ts +46 -0
- package/dist/pages/logs.js +140 -0
- package/dist/pages/navigation.d.ts +61 -0
- package/dist/pages/navigation.js +107 -0
- package/dist/pages/overview.d.ts +35 -0
- package/dist/pages/overview.js +201 -0
- package/dist/pages/project-guard.d.ts +32 -0
- package/dist/pages/project-guard.js +99 -0
- package/dist/pages/query.d.ts +6 -0
- package/dist/pages/query.js +14 -0
- package/dist/pages/resources.d.ts +37 -0
- package/dist/pages/resources.js +211 -0
- package/dist/pages/setup.d.ts +40 -0
- package/dist/pages/setup.js +271 -0
- package/dist/pages/slugs.d.ts +15 -0
- package/dist/pages/slugs.js +28 -0
- package/dist/pages/variables.d.ts +43 -0
- package/dist/pages/variables.js +327 -0
- package/dist/pages/version.d.ts +26 -0
- package/dist/pages/version.js +214 -0
- package/dist/pages/versions.d.ts +20 -0
- package/dist/pages/versions.js +115 -0
- package/dist/resources/apply.d.ts +15 -0
- package/dist/resources/apply.js +127 -0
- package/dist/resources/cards.d.ts +41 -0
- package/dist/resources/cards.js +211 -0
- package/dist/resources/connect.d.ts +66 -0
- package/dist/resources/connect.js +78 -0
- package/dist/resources/content.d.ts +26 -0
- package/dist/resources/content.js +158 -0
- package/dist/resources/format.d.ts +10 -0
- package/dist/resources/format.js +30 -0
- package/dist/resources/guard.d.ts +23 -0
- package/dist/resources/guard.js +60 -0
- package/dist/resources/modules.d.ts +23 -0
- package/dist/resources/modules.js +39 -0
- package/dist/resources/plan.d.ts +8 -0
- package/dist/resources/plan.js +93 -0
- package/dist/resources/read.d.ts +54 -0
- package/dist/resources/read.js +69 -0
- package/dist/resources/refusals.d.ts +15 -0
- package/dist/resources/refusals.js +33 -0
- package/dist/resources/routes.d.ts +32 -0
- package/dist/resources/routes.js +53 -0
- package/dist/setup/actions.d.ts +79 -0
- package/dist/setup/actions.js +188 -0
- package/dist/setup/apply.d.ts +37 -0
- package/dist/setup/apply.js +172 -0
- package/dist/setup/content.d.ts +50 -0
- package/dist/setup/content.js +440 -0
- package/dist/setup/rollout.d.ts +119 -0
- package/dist/setup/rollout.js +227 -0
- package/dist/setup/steps.d.ts +93 -0
- package/dist/setup/steps.js +95 -0
- package/dist/setup/storage.d.ts +29 -0
- package/dist/setup/storage.js +78 -0
- package/dist/setup/store.d.ts +214 -0
- package/dist/setup/store.js +174 -0
- package/dist/setup/volume.d.ts +31 -0
- package/dist/setup/volume.js +52 -0
- package/dist/slug.d.ts +7 -0
- package/dist/slug.js +26 -0
- package/dist/variables/actions.d.ts +76 -0
- package/dist/variables/actions.js +185 -0
- package/dist/variables/content.d.ts +69 -0
- package/dist/variables/content.js +310 -0
- package/dist/variables/decide.d.ts +27 -0
- package/dist/variables/decide.js +155 -0
- package/dist/variables/decided-dialog.d.ts +11 -0
- package/dist/variables/decided-dialog.js +129 -0
- package/dist/variables/decided.d.ts +80 -0
- package/dist/variables/decided.js +240 -0
- package/dist/variables/dialogs.d.ts +8 -0
- package/dist/variables/dialogs.js +219 -0
- package/dist/variables/model.d.ts +106 -0
- package/dist/variables/model.js +156 -0
- package/dist/variables/project-config.d.ts +117 -0
- package/dist/variables/project-config.js +248 -0
- package/dist/variables/read.d.ts +33 -0
- package/dist/variables/read.js +118 -0
- package/dist/web-url.d.ts +9 -0
- package/dist/web-url.js +19 -0
- package/frontend-vue/app/components/BuildLog.vue +99 -0
- package/frontend-vue/app/components/ChangedFiles.vue +165 -0
- package/frontend-vue/app/components/DashboardEnvironments.vue +102 -0
- package/frontend-vue/app/components/LogLine.vue +33 -0
- package/frontend-vue/app/components/LogViewer.vue +314 -0
- package/frontend-vue/app/components/PublishChipIcon.vue +39 -0
- package/frontend-vue/app/components/PublishForm.vue +505 -0
- package/frontend-vue/app/components/PublishPopover.vue +90 -0
- package/frontend-vue/app/components/PublishRoute.vue +222 -0
- package/frontend-vue/app/composables/usePublishSummary.ts +80 -0
- package/frontend-vue/app/plugins/publish-chip.client.ts +44 -0
- package/frontend-vue/app/types/publishing.ts +154 -0
- package/frontend-vue/app/utils/build-log.ts +96 -0
- package/frontend-vue/app/utils/changed-files.ts +142 -0
- package/frontend-vue/app/utils/log-line.ts +15 -0
- package/frontend-vue/app/utils/log-stream.ts +361 -0
- package/frontend-vue/app/utils/publish-state.ts +299 -0
- package/frontend-vue/dms.frontend.ts +27 -0
- package/frontend-vue/i18n/locales/antelope-cloud-en-GB.json +110 -0
- package/frontend-vue/package.json +38 -0
- package/frontend-vue/pnpm-lock.yaml +2697 -0
- package/package.json +115 -3
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RESOURCES_TOPIC = exports.ENVIRONMENT_PARAMETER = exports.RESOURCES_ROUTES = void 0;
|
|
4
|
+
exports.resourcesPageUrl = resourcesPageUrl;
|
|
5
|
+
exports.resourcesRoute = resourcesRoute;
|
|
6
|
+
exports.environmentRoute = environmentRoute;
|
|
7
|
+
exports.pageEnvironmentRoute = pageEnvironmentRoute;
|
|
8
|
+
exports.announceResources = announceResources;
|
|
9
|
+
const page_1 = require("@antelopejs/interface-dms/page");
|
|
10
|
+
const realtime_1 = require("@antelopejs/interface-dms/realtime");
|
|
11
|
+
const slugs_1 = require("../pages/slugs");
|
|
12
|
+
/** The routes of the Resources page, relative to it. */
|
|
13
|
+
exports.RESOURCES_ROUTES = {
|
|
14
|
+
state: "/state",
|
|
15
|
+
banner: "/banner",
|
|
16
|
+
environments: "/environments",
|
|
17
|
+
cards: "/cards",
|
|
18
|
+
derived: "/derived",
|
|
19
|
+
limits: "/limits",
|
|
20
|
+
planDialog: "/plan-dialog",
|
|
21
|
+
apply: "/apply",
|
|
22
|
+
publishNote: "/publish-note",
|
|
23
|
+
};
|
|
24
|
+
/** The query parameter that names the environment a route answers for. */
|
|
25
|
+
exports.ENVIRONMENT_PARAMETER = "environment";
|
|
26
|
+
/** The realtime topic the Resources page's blocks read their routes again on. */
|
|
27
|
+
exports.RESOURCES_TOPIC = "antelope-cloud.resources";
|
|
28
|
+
/** The URL of the Resources page itself, showing the environment of the name given. */
|
|
29
|
+
function resourcesPageUrl(environment) {
|
|
30
|
+
return `${(0, slugs_1.modulePageSlug)("resources")}?${exports.ENVIRONMENT_PARAMETER}=${encodeURIComponent(environment)}`;
|
|
31
|
+
}
|
|
32
|
+
const PAGE_ENVIRONMENT = `{{query.${exports.ENVIRONMENT_PARAMETER}}}`;
|
|
33
|
+
/** The URL of a Resources page route that answers for the project's first environment. */
|
|
34
|
+
function resourcesRoute(route) {
|
|
35
|
+
return (0, page_1.pageRoutePath)((0, slugs_1.modulePageSlug)("resources"), route);
|
|
36
|
+
}
|
|
37
|
+
/** The URL of a Resources page route, for the environment of the name given. */
|
|
38
|
+
function environmentRoute(route, environment) {
|
|
39
|
+
return `${resourcesRoute(route)}?${exports.ENVIRONMENT_PARAMETER}=${encodeURIComponent(environment)}`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The URL of a Resources page route, for the environment the page URL names.
|
|
43
|
+
* The dashboard fills the token in from the page's own query and does not
|
|
44
|
+
* read the route while the page names none.
|
|
45
|
+
*/
|
|
46
|
+
function pageEnvironmentRoute(route) {
|
|
47
|
+
return `${resourcesRoute(route)}?${exports.ENVIRONMENT_PARAMETER}=${PAGE_ENVIRONMENT}`;
|
|
48
|
+
}
|
|
49
|
+
/** Tells the tenant's open Resources pages that what Cloud runs changed. */
|
|
50
|
+
function announceResources(tenantId) {
|
|
51
|
+
return (0, realtime_1.PublishMessage)(exports.RESOURCES_TOPIC, "changed", { tenantId });
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type CurrentConnection } from "../connection/current";
|
|
3
|
+
import { type SetupState } from "./steps";
|
|
4
|
+
import { type StoredSetup } from "./store";
|
|
5
|
+
declare const newProjectSchema: z.ZodObject<{
|
|
6
|
+
slug: z.ZodString;
|
|
7
|
+
region: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
slug: string;
|
|
10
|
+
region: string;
|
|
11
|
+
}, {
|
|
12
|
+
slug: string;
|
|
13
|
+
region: string;
|
|
14
|
+
}>;
|
|
15
|
+
declare const existingProjectSchema: z.ZodObject<{
|
|
16
|
+
projectId: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
projectId: string;
|
|
19
|
+
}, {
|
|
20
|
+
projectId: string;
|
|
21
|
+
}>;
|
|
22
|
+
declare const stagesSchema: z.ZodObject<{
|
|
23
|
+
preview: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
24
|
+
staging: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
preview?: boolean | null | undefined;
|
|
27
|
+
staging?: boolean | null | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
preview?: boolean | null | undefined;
|
|
30
|
+
staging?: boolean | null | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
/** What the New project dialog sends. */
|
|
33
|
+
export type NewProjectInput = z.infer<typeof newProjectSchema>;
|
|
34
|
+
/** Reads the body of the New project dialog. */
|
|
35
|
+
export declare function parseNewProject(body: Parameters<typeof newProjectSchema.safeParse>[0]): NewProjectInput | undefined;
|
|
36
|
+
/** What the Link existing project dialog sends. */
|
|
37
|
+
export type ExistingProjectInput = z.infer<typeof existingProjectSchema>;
|
|
38
|
+
/** Reads the body of the Link existing project dialog. */
|
|
39
|
+
export declare function parseExistingProject(body: Parameters<typeof existingProjectSchema.safeParse>[0]): ExistingProjectInput | undefined;
|
|
40
|
+
/** What the Environments dialog sends: whether each stage is ticked. */
|
|
41
|
+
export type StagesInput = z.infer<typeof stagesSchema>;
|
|
42
|
+
/** Reads the body of the Environments dialog. */
|
|
43
|
+
export declare function parseStages(body: Parameters<typeof stagesSchema.safeParse>[0]): StagesInput | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Plans a new project, named by the dialog's `slug` and placed in its
|
|
46
|
+
* `region`. Nothing is created on AntelopeJS Cloud before the plan is applied.
|
|
47
|
+
*
|
|
48
|
+
* @throws The refusal of a name a project of the workspace already has, or of
|
|
49
|
+
* a DMS that publishes a project already.
|
|
50
|
+
*/
|
|
51
|
+
export declare function planNewProject(tenantId: string, input: NewProjectInput | undefined): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Plans to publish a project the workspace has, once AntelopeJS Cloud confirms
|
|
54
|
+
* it. The connection uses it once the plan is applied.
|
|
55
|
+
*
|
|
56
|
+
* @throws The refusal of a DMS that publishes another project already.
|
|
57
|
+
*/
|
|
58
|
+
export declare function planExistingProject(tenantId: string, input: ExistingProjectInput | undefined): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Plans the stages the dialog ticks beside Production.
|
|
61
|
+
*
|
|
62
|
+
* @throws The refusal of a body that is not the dialog's: the stages chosen
|
|
63
|
+
* stay as they were.
|
|
64
|
+
*/
|
|
65
|
+
export declare function planStages(tenantId: string, ticked: StagesInput | undefined): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* The tenant's stored setup. A connection AntelopeJS Cloud manages always
|
|
68
|
+
* plans the project it reaches, whatever was stored, and has the setup of a
|
|
69
|
+
* tenant that chose nothing yet.
|
|
70
|
+
*/
|
|
71
|
+
export declare function readSetup(tenantId: string, connection?: CurrentConnection): Promise<StoredSetup | undefined>;
|
|
72
|
+
/**
|
|
73
|
+
* The tenant's first-run setup: its facts, read from the connection, the
|
|
74
|
+
* stored plan, the repository the module publishes and its work tree, the
|
|
75
|
+
* project's config and AntelopeJS Cloud, the plan the owner chose, and the
|
|
76
|
+
* steps they give.
|
|
77
|
+
*/
|
|
78
|
+
export declare function readSetupState(tenantId: string): Promise<SetupState>;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseNewProject = parseNewProject;
|
|
4
|
+
exports.parseExistingProject = parseExistingProject;
|
|
5
|
+
exports.parseStages = parseStages;
|
|
6
|
+
exports.planNewProject = planNewProject;
|
|
7
|
+
exports.planExistingProject = planExistingProject;
|
|
8
|
+
exports.planStages = planStages;
|
|
9
|
+
exports.readSetup = readSetup;
|
|
10
|
+
exports.readSetupState = readSetupState;
|
|
11
|
+
const zod_1 = require("zod");
|
|
12
|
+
const actions_1 = require("../connection/actions");
|
|
13
|
+
const announce_1 = require("../connection/announce");
|
|
14
|
+
const cloud_1 = require("../connection/cloud");
|
|
15
|
+
const current_1 = require("../connection/current");
|
|
16
|
+
const refusals_1 = require("../connection/refusals");
|
|
17
|
+
const repository_1 = require("../connection/repository");
|
|
18
|
+
const view_1 = require("../connection/view");
|
|
19
|
+
const dockerfile_1 = require("../dashboard/dockerfile");
|
|
20
|
+
const address_1 = require("../environments/address");
|
|
21
|
+
const storage_1 = require("./storage");
|
|
22
|
+
const slug_1 = require("../slug");
|
|
23
|
+
const project_config_1 = require("../variables/project-config");
|
|
24
|
+
const steps_1 = require("./steps");
|
|
25
|
+
const store_1 = require("./store");
|
|
26
|
+
const PROJECT_NAME_REQUIRED = (0, refusals_1.badRequest)("project_name_required");
|
|
27
|
+
const PROJECT_REQUIRED = (0, refusals_1.conflict)("project_required");
|
|
28
|
+
const PROJECT_SLUG_TAKEN = (0, refusals_1.conflict)("project_slug_taken");
|
|
29
|
+
const INVALID_STAGES = (0, refusals_1.badRequest)("invalid_stages");
|
|
30
|
+
const PROJECT_PUBLISHED = (0, refusals_1.conflict)("project_published");
|
|
31
|
+
const newProjectSchema = zod_1.z.object({
|
|
32
|
+
slug: zod_1.z.string(),
|
|
33
|
+
region: zod_1.z.string().min(1),
|
|
34
|
+
});
|
|
35
|
+
const existingProjectSchema = zod_1.z.object({ projectId: zod_1.z.string().min(1) });
|
|
36
|
+
const stagesSchema = zod_1.z.object({
|
|
37
|
+
preview: zod_1.z.boolean().nullish(),
|
|
38
|
+
staging: zod_1.z.boolean().nullish(),
|
|
39
|
+
});
|
|
40
|
+
/** Reads the body of the New project dialog. */
|
|
41
|
+
function parseNewProject(body) {
|
|
42
|
+
return newProjectSchema.safeParse(body).data;
|
|
43
|
+
}
|
|
44
|
+
/** Reads the body of the Link existing project dialog. */
|
|
45
|
+
function parseExistingProject(body) {
|
|
46
|
+
return existingProjectSchema.safeParse(body).data;
|
|
47
|
+
}
|
|
48
|
+
/** Reads the body of the Environments dialog. */
|
|
49
|
+
function parseStages(body) {
|
|
50
|
+
return stagesSchema.safeParse(body).data;
|
|
51
|
+
}
|
|
52
|
+
async function requirePlannable(tenantId, projectId) {
|
|
53
|
+
const stored = await (0, current_1.readConnection)(tenantId);
|
|
54
|
+
if (stored?.state !== "connected")
|
|
55
|
+
throw (0, refusals_1.refuse)(refusals_1.NOT_CONNECTED);
|
|
56
|
+
if ((0, current_1.isManaged)(stored))
|
|
57
|
+
throw (0, refusals_1.refuse)(refusals_1.MANAGED_CONNECTION);
|
|
58
|
+
if (stored.projectId !== null && stored.projectId !== projectId) {
|
|
59
|
+
throw (0, refusals_1.refuse)(PROJECT_PUBLISHED);
|
|
60
|
+
}
|
|
61
|
+
return stored;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Plans a new project, named by the dialog's `slug` and placed in its
|
|
65
|
+
* `region`. Nothing is created on AntelopeJS Cloud before the plan is applied.
|
|
66
|
+
*
|
|
67
|
+
* @throws The refusal of a name a project of the workspace already has, or of
|
|
68
|
+
* a DMS that publishes a project already.
|
|
69
|
+
*/
|
|
70
|
+
async function planNewProject(tenantId, input) {
|
|
71
|
+
const slug = input ? (0, slug_1.slugify)(input.slug) : "";
|
|
72
|
+
if (!input || slug === "")
|
|
73
|
+
throw (0, refusals_1.refuse)(PROJECT_NAME_REQUIRED);
|
|
74
|
+
const { projects } = await (0, refusals_1.callOrRefuse)(await requirePlannable(tenantId), (api) => api.listProjects(), actions_1.PROJECT_REFUSALS);
|
|
75
|
+
if (projects.some((project) => project.slug === slug)) {
|
|
76
|
+
throw (0, refusals_1.refuse)(PROJECT_SLUG_TAKEN);
|
|
77
|
+
}
|
|
78
|
+
await (0, store_1.setups)().chooseProject(tenantId, {
|
|
79
|
+
kind: "new",
|
|
80
|
+
slug,
|
|
81
|
+
region: input.region,
|
|
82
|
+
});
|
|
83
|
+
await (0, announce_1.announceProject)(tenantId);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Plans to publish a project the workspace has, once AntelopeJS Cloud confirms
|
|
87
|
+
* it. The connection uses it once the plan is applied.
|
|
88
|
+
*
|
|
89
|
+
* @throws The refusal of a DMS that publishes another project already.
|
|
90
|
+
*/
|
|
91
|
+
async function planExistingProject(tenantId, input) {
|
|
92
|
+
if (!input)
|
|
93
|
+
throw (0, refusals_1.refuse)((0, refusals_1.badRequest)("project_required"));
|
|
94
|
+
const project = await (0, refusals_1.callOrRefuse)(await requirePlannable(tenantId, input.projectId), (api) => api.readProject(input.projectId), actions_1.PROJECT_REFUSALS);
|
|
95
|
+
await (0, store_1.setups)().chooseProject(tenantId, {
|
|
96
|
+
kind: "existing",
|
|
97
|
+
projectId: project.id,
|
|
98
|
+
});
|
|
99
|
+
await (0, announce_1.announceProject)(tenantId);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Plans the stages the dialog ticks beside Production.
|
|
103
|
+
*
|
|
104
|
+
* @throws The refusal of a body that is not the dialog's: the stages chosen
|
|
105
|
+
* stay as they were.
|
|
106
|
+
*/
|
|
107
|
+
async function planStages(tenantId, ticked) {
|
|
108
|
+
if (!ticked)
|
|
109
|
+
throw (0, refusals_1.refuse)(INVALID_STAGES);
|
|
110
|
+
const stages = store_1.EXTRA_STAGES.filter((stage) => ticked[stage] === true);
|
|
111
|
+
await keepManagedProject(tenantId);
|
|
112
|
+
if (!(await (0, store_1.setups)().chooseEnvironments(tenantId, stages))) {
|
|
113
|
+
throw (0, refusals_1.refuse)(PROJECT_REQUIRED);
|
|
114
|
+
}
|
|
115
|
+
await (0, announce_1.announceProject)(tenantId);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Stores the plan of a connection AntelopeJS Cloud manages when it has none:
|
|
119
|
+
* to publish the one project the connection reaches, which no one chooses.
|
|
120
|
+
*/
|
|
121
|
+
async function keepManagedProject(tenantId) {
|
|
122
|
+
const stored = await (0, current_1.readConnection)(tenantId);
|
|
123
|
+
if (!stored || !(0, current_1.isManaged)(stored) || (await (0, store_1.setups)().read(tenantId)))
|
|
124
|
+
return;
|
|
125
|
+
await (0, store_1.setups)().chooseProject(tenantId, (0, store_1.existingDraft)(stored.projectId));
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* The tenant's stored setup. A connection AntelopeJS Cloud manages always
|
|
129
|
+
* plans the project it reaches, whatever was stored, and has the setup of a
|
|
130
|
+
* tenant that chose nothing yet.
|
|
131
|
+
*/
|
|
132
|
+
async function readSetup(tenantId, connection) {
|
|
133
|
+
const [stored, current] = await Promise.all([
|
|
134
|
+
(0, store_1.setups)().read(tenantId),
|
|
135
|
+
connection ?? (0, current_1.readConnection)(tenantId),
|
|
136
|
+
]);
|
|
137
|
+
if (!current || !(0, current_1.isManaged)(current))
|
|
138
|
+
return stored;
|
|
139
|
+
return {
|
|
140
|
+
environments: [],
|
|
141
|
+
applied: null,
|
|
142
|
+
notOnPlan: [],
|
|
143
|
+
creationKey: null,
|
|
144
|
+
repositoryNotVisible: false,
|
|
145
|
+
...stored,
|
|
146
|
+
_id: tenantId,
|
|
147
|
+
project: (0, store_1.existingDraft)(current.projectId),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
async function resolveProject(stored, setup) {
|
|
151
|
+
const draft = setup?.project;
|
|
152
|
+
const planned = draft?.kind === "new" ? { ...draft, isNew: true } : null;
|
|
153
|
+
if (stored?.state !== "connected")
|
|
154
|
+
return planned;
|
|
155
|
+
const projectId = stored.projectId ?? (draft?.kind === "existing" ? draft.projectId : null);
|
|
156
|
+
if (projectId === null)
|
|
157
|
+
return planned;
|
|
158
|
+
const project = await (0, cloud_1.readCloud)(stored, (api) => api.readProject(projectId));
|
|
159
|
+
return project.kind === "ok"
|
|
160
|
+
? { slug: project.value.slug, region: project.value.region, isNew: false }
|
|
161
|
+
: { slug: projectId, region: null, isNew: false };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The tenant's first-run setup: its facts, read from the connection, the
|
|
165
|
+
* stored plan, the repository the module publishes and its work tree, the
|
|
166
|
+
* project's config and AntelopeJS Cloud, the plan the owner chose, and the
|
|
167
|
+
* steps they give.
|
|
168
|
+
*/
|
|
169
|
+
async function readSetupState(tenantId) {
|
|
170
|
+
const stored = await (0, current_1.readConnection)(tenantId);
|
|
171
|
+
const [setup, repository, config, dashboard] = await Promise.all([
|
|
172
|
+
readSetup(tenantId, stored),
|
|
173
|
+
(0, repository_1.readPublishedRepository)(),
|
|
174
|
+
(0, project_config_1.readProjectConfig)(),
|
|
175
|
+
(0, dockerfile_1.readDashboardBuild)(),
|
|
176
|
+
]);
|
|
177
|
+
const facts = {
|
|
178
|
+
connection: (0, view_1.toView)(stored, new Date()),
|
|
179
|
+
project: await resolveProject(stored, setup),
|
|
180
|
+
repository,
|
|
181
|
+
appliedTo: setup?.applied?.projectId ?? null,
|
|
182
|
+
address: (0, address_1.appAddressOf)(config),
|
|
183
|
+
dashboard,
|
|
184
|
+
storage: (0, storage_1.appStorageOf)(config),
|
|
185
|
+
};
|
|
186
|
+
return { facts, setup, steps: (0, steps_1.setupSteps)(facts) };
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type RolloutItem } from "./rollout";
|
|
2
|
+
/** What applying the plan did to one thing it names. */
|
|
3
|
+
export type ApplyItem = {
|
|
4
|
+
step: "project";
|
|
5
|
+
projectId: string;
|
|
6
|
+
outcome: "created" | "existing";
|
|
7
|
+
} | {
|
|
8
|
+
step: "repository";
|
|
9
|
+
repository: string;
|
|
10
|
+
outcome: "linked";
|
|
11
|
+
} | RolloutItem;
|
|
12
|
+
/**
|
|
13
|
+
* Puts the tenant's project online as the first-run setup planned it: the
|
|
14
|
+
* project, created when new with a Production that builds `env/production` of
|
|
15
|
+
* the GitHub repository the module publishes, the link to that repository,
|
|
16
|
+
* then each chosen stage with the services of Production. A project the plan
|
|
17
|
+
* creates also gets an address: the app of each of its environments listens
|
|
18
|
+
* on the port `antelope.config.ts` gives its API and is opened to the
|
|
19
|
+
* internet, Production first, so the stages copy it open. When its work tree
|
|
20
|
+
* has a `frontend.Dockerfile`, it gets its dashboard too: a second service of
|
|
21
|
+
* Production that this Dockerfile builds, on its own address, created before
|
|
22
|
+
* the stages so that they copy it. A project the plan links keeps the
|
|
23
|
+
* services and the network settings it has. The project a connection
|
|
24
|
+
* AntelopeJS Cloud manages reaches is never created or chosen here, and its
|
|
25
|
+
* Production gets the address and the dashboard of a created one. Each step reads
|
|
26
|
+
* what exists first, so a run after a failed one creates only what is
|
|
27
|
+
* missing. Every run of the plan creates its new project under one stored
|
|
28
|
+
* `Idempotency-Key`, and publishes only the project AntelopeJS Cloud answers
|
|
29
|
+
* for that key. A stage another run created is taken as it is. So a run whose
|
|
30
|
+
* answer was lost and a double-submitted apply both converge on one project,
|
|
31
|
+
* and a project someone else created under the planned name is refused. A
|
|
32
|
+
* stage the plan does not include is reported, and the run goes on.
|
|
33
|
+
*
|
|
34
|
+
* @returns What each step did, in order.
|
|
35
|
+
* @throws The refusal of the first step that failed: the run stops there.
|
|
36
|
+
*/
|
|
37
|
+
export declare function applySetup(tenantId: string): Promise<ApplyItem[]>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applySetup = applySetup;
|
|
4
|
+
const promises_1 = require("node:timers/promises");
|
|
5
|
+
const actions_1 = require("../connection/actions");
|
|
6
|
+
const announce_1 = require("../connection/announce");
|
|
7
|
+
const cloud_1 = require("../connection/cloud");
|
|
8
|
+
const current_1 = require("../connection/current");
|
|
9
|
+
const refusals_1 = require("../connection/refusals");
|
|
10
|
+
const repository_1 = require("../connection/repository");
|
|
11
|
+
const store_1 = require("../connection/store");
|
|
12
|
+
const pipeline_1 = require("../environments/pipeline");
|
|
13
|
+
const rollout_1 = require("./rollout");
|
|
14
|
+
const store_2 = require("./store");
|
|
15
|
+
const PROJECT_REQUIRED = (0, refusals_1.conflict)("project_required");
|
|
16
|
+
const PLAN_CHANGED = (0, refusals_1.conflict)("plan_changed");
|
|
17
|
+
const NO_GITHUB_REMOTE = (0, refusals_1.conflict)("no_github_remote");
|
|
18
|
+
const PROJECT_SLUG_TAKEN = (0, refusals_1.conflict)("project_slug_taken");
|
|
19
|
+
const CREATION_IN_PROGRESS = "cloud.errors.projects.creation_in_progress";
|
|
20
|
+
const IN_PROGRESS_WAITS = 5;
|
|
21
|
+
const IN_PROGRESS_WAIT_MS = 1000;
|
|
22
|
+
const REPOSITORY_NOT_VISIBLE = (0, refusals_1.unprocessable)("repository_not_visible");
|
|
23
|
+
const NOT_GRANTED = "cloud.errors.projects.repository_not_granted";
|
|
24
|
+
const PRODUCTION = "production";
|
|
25
|
+
const PROJECT_CREATION_REFUSALS = {
|
|
26
|
+
missing: (0, refusals_1.unprocessable)("unknown_project"),
|
|
27
|
+
codes: new Map([
|
|
28
|
+
["cloud.errors.projects.slug_taken", PROJECT_SLUG_TAKEN],
|
|
29
|
+
["cloud.errors.projects.idempotency_key_reused", PROJECT_SLUG_TAKEN],
|
|
30
|
+
[CREATION_IN_PROGRESS, (0, refusals_1.conflict)("project_creation_in_progress")],
|
|
31
|
+
["cloud.errors.limits.projects_per_workspace", (0, refusals_1.conflict)("project_limit")],
|
|
32
|
+
["cloud.errors.projects.invalid_slug", (0, refusals_1.badRequest)("invalid_project_slug")],
|
|
33
|
+
["cloud.errors.projects.unknown_region", (0, refusals_1.badRequest)("unknown_region")],
|
|
34
|
+
[NOT_GRANTED, REPOSITORY_NOT_VISIBLE],
|
|
35
|
+
]),
|
|
36
|
+
};
|
|
37
|
+
const REPOSITORY_REFUSALS = {
|
|
38
|
+
missing: (0, refusals_1.unprocessable)("unknown_project"),
|
|
39
|
+
codes: new Map([
|
|
40
|
+
["cloud.errors.projects.invalid_repository", REPOSITORY_NOT_VISIBLE],
|
|
41
|
+
[NOT_GRANTED, REPOSITORY_NOT_VISIBLE],
|
|
42
|
+
]),
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The page's refusal of a failed call of the apply. When the refusal is that
|
|
46
|
+
* AntelopeJS Cloud cannot see the repository, the setup records it first and
|
|
47
|
+
* tells the open pages: they then keep saying what to do after the answer
|
|
48
|
+
* left the screen.
|
|
49
|
+
*/
|
|
50
|
+
async function refusalOf(tenantId, failure, refusals) {
|
|
51
|
+
if ((0, refusals_1.cloudRefusal)(failure, refusals) === REPOSITORY_NOT_VISIBLE) {
|
|
52
|
+
await (0, store_2.setups)().markRepositoryNotVisible(tenantId, true);
|
|
53
|
+
await (0, announce_1.announceProject)(tenantId);
|
|
54
|
+
}
|
|
55
|
+
return (0, refusals_1.refuseCloud)(tenantId, failure, refusals);
|
|
56
|
+
}
|
|
57
|
+
function isInProgress(answer) {
|
|
58
|
+
return answer.kind === "refused" && answer.code === CREATION_IN_PROGRESS;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Asks AntelopeJS Cloud for the plan's new project under the plan's key. A
|
|
62
|
+
* lost answer is asked again once, and a creation that AntelopeJS Cloud is
|
|
63
|
+
* still running is waited for: both resend the same key, so the answer is the
|
|
64
|
+
* project that key created and never a project someone else holds.
|
|
65
|
+
*/
|
|
66
|
+
async function sendCreation(connection, body, idempotencyKey) {
|
|
67
|
+
const send = async () => (0, cloud_1.callCloud)(connection, (api) => api.createProject(body, { idempotencyKey }));
|
|
68
|
+
let answer = await send();
|
|
69
|
+
if (answer.kind === "unreachable")
|
|
70
|
+
answer = await send();
|
|
71
|
+
for (let wait = 0; wait < IN_PROGRESS_WAITS && isInProgress(answer); wait++) {
|
|
72
|
+
await (0, promises_1.setTimeout)(IN_PROGRESS_WAIT_MS);
|
|
73
|
+
answer = await send();
|
|
74
|
+
}
|
|
75
|
+
return answer;
|
|
76
|
+
}
|
|
77
|
+
async function createProject(connection, draft, repository) {
|
|
78
|
+
const tenantId = connection._id;
|
|
79
|
+
const idempotencyKey = await (0, store_2.setups)().creationKey(tenantId, draft);
|
|
80
|
+
if (idempotencyKey === undefined)
|
|
81
|
+
throw (0, refusals_1.refuse)(PLAN_CHANGED);
|
|
82
|
+
const body = {
|
|
83
|
+
slug: draft.slug,
|
|
84
|
+
region: draft.region,
|
|
85
|
+
repository,
|
|
86
|
+
branch: (0, pipeline_1.defaultBranch)(PRODUCTION),
|
|
87
|
+
};
|
|
88
|
+
const created = await sendCreation(connection, body, idempotencyKey);
|
|
89
|
+
if (created.kind === "ok")
|
|
90
|
+
return created.value.projectId;
|
|
91
|
+
throw await refusalOf(tenantId, created, PROJECT_CREATION_REFUSALS);
|
|
92
|
+
}
|
|
93
|
+
async function applyProject(connection, draft, repository) {
|
|
94
|
+
const { _id: tenantId, projectId } = connection;
|
|
95
|
+
if (projectId !== null) {
|
|
96
|
+
return { step: "project", projectId, outcome: "existing" };
|
|
97
|
+
}
|
|
98
|
+
if (draft.kind === "existing") {
|
|
99
|
+
await (0, actions_1.chooseProject)(tenantId, { projectId: draft.projectId });
|
|
100
|
+
return { step: "project", projectId: draft.projectId, outcome: "existing" };
|
|
101
|
+
}
|
|
102
|
+
const createdId = await createProject(connection, draft, repository);
|
|
103
|
+
await (0, store_1.connections)().setProject(tenantId, createdId);
|
|
104
|
+
await (0, announce_1.announce)(tenantId);
|
|
105
|
+
return { step: "project", projectId: createdId, outcome: "created" };
|
|
106
|
+
}
|
|
107
|
+
async function applyRepository(connection, projectId, repository) {
|
|
108
|
+
const linked = await (0, refusals_1.callOrRefuse)(connection, (api) => api.projectRepository.read(projectId), REPOSITORY_REFUSALS);
|
|
109
|
+
if (linked?.toLowerCase() !== repository.toLowerCase()) {
|
|
110
|
+
const link = await (0, cloud_1.callCloud)(connection, (api) => api.projectRepository.link(projectId, repository));
|
|
111
|
+
if (link.kind !== "ok") {
|
|
112
|
+
throw await refusalOf(connection._id, link, REPOSITORY_REFUSALS);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return { step: "repository", repository, outcome: "linked" };
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Puts the tenant's project online as the first-run setup planned it: the
|
|
119
|
+
* project, created when new with a Production that builds `env/production` of
|
|
120
|
+
* the GitHub repository the module publishes, the link to that repository,
|
|
121
|
+
* then each chosen stage with the services of Production. A project the plan
|
|
122
|
+
* creates also gets an address: the app of each of its environments listens
|
|
123
|
+
* on the port `antelope.config.ts` gives its API and is opened to the
|
|
124
|
+
* internet, Production first, so the stages copy it open. When its work tree
|
|
125
|
+
* has a `frontend.Dockerfile`, it gets its dashboard too: a second service of
|
|
126
|
+
* Production that this Dockerfile builds, on its own address, created before
|
|
127
|
+
* the stages so that they copy it. A project the plan links keeps the
|
|
128
|
+
* services and the network settings it has. The project a connection
|
|
129
|
+
* AntelopeJS Cloud manages reaches is never created or chosen here, and its
|
|
130
|
+
* Production gets the address and the dashboard of a created one. Each step reads
|
|
131
|
+
* what exists first, so a run after a failed one creates only what is
|
|
132
|
+
* missing. Every run of the plan creates its new project under one stored
|
|
133
|
+
* `Idempotency-Key`, and publishes only the project AntelopeJS Cloud answers
|
|
134
|
+
* for that key. A stage another run created is taken as it is. So a run whose
|
|
135
|
+
* answer was lost and a double-submitted apply both converge on one project,
|
|
136
|
+
* and a project someone else created under the planned name is refused. A
|
|
137
|
+
* stage the plan does not include is reported, and the run goes on.
|
|
138
|
+
*
|
|
139
|
+
* @returns What each step did, in order.
|
|
140
|
+
* @throws The refusal of the first step that failed: the run stops there.
|
|
141
|
+
*/
|
|
142
|
+
async function applySetup(tenantId) {
|
|
143
|
+
const connection = await (0, current_1.readConnection)(tenantId);
|
|
144
|
+
if (connection?.state !== "connected")
|
|
145
|
+
throw (0, refusals_1.refuse)(refusals_1.NOT_CONNECTED);
|
|
146
|
+
const model = (0, store_2.setups)();
|
|
147
|
+
const stored = await model.read(tenantId);
|
|
148
|
+
const draft = (0, current_1.isManaged)(connection)
|
|
149
|
+
? (0, store_2.existingDraft)(connection.projectId)
|
|
150
|
+
: (stored?.project ??
|
|
151
|
+
(connection.projectId === null
|
|
152
|
+
? undefined
|
|
153
|
+
: (0, store_2.existingDraft)(connection.projectId)));
|
|
154
|
+
if (!draft)
|
|
155
|
+
throw (0, refusals_1.refuse)(PROJECT_REQUIRED);
|
|
156
|
+
if (!stored)
|
|
157
|
+
await model.chooseProject(tenantId, draft);
|
|
158
|
+
const remote = (await (0, repository_1.readPublishedRepository)()).remote;
|
|
159
|
+
if (!remote?.webUrl)
|
|
160
|
+
throw (0, refusals_1.refuse)(NO_GITHUB_REMOTE);
|
|
161
|
+
const project = await applyProject(connection, draft, remote.label);
|
|
162
|
+
const repository = await applyRepository(connection, project.projectId, remote.label);
|
|
163
|
+
if (stored?.repositoryNotVisible) {
|
|
164
|
+
await model.markRepositoryNotVisible(tenantId, false);
|
|
165
|
+
}
|
|
166
|
+
const { projectId } = project;
|
|
167
|
+
const rollout = await (0, rollout_1.applyRollout)(connection, projectId, stored?.environments ?? [], await (0, rollout_1.rolloutPlan)((0, rollout_1.servicesPlanOf)(draft, (0, current_1.isManaged)(connection)), remote.label));
|
|
168
|
+
await model.markApplied(tenantId, { at: new Date(), projectId }, rollout.notOnPlan);
|
|
169
|
+
await (0, announce_1.announceProject)(tenantId);
|
|
170
|
+
return [project, repository, ...rollout.items];
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CloudApi } from "@antelopejs/cloud-sdk";
|
|
2
|
+
import type { BannerContent } from "@antelopejs/interface-dms/base/banner";
|
|
3
|
+
import type { KeyValueListItem } from "@antelopejs/interface-dms/base/key-value-list";
|
|
4
|
+
import type { ConfirmDialogSerialized } from "@antelopejs/interface-dms/base/types/confirm-dialog";
|
|
5
|
+
import type { CloudRead } from "../connection/cloud";
|
|
6
|
+
import type { ApplyItem } from "./apply";
|
|
7
|
+
import { type SetupState, type SetupStep } from "./steps";
|
|
8
|
+
import { type StoredSetup } from "./store";
|
|
9
|
+
/** The routes of the First-run setup page, relative to it. */
|
|
10
|
+
export declare const SETUP_ROUTES: {
|
|
11
|
+
readonly steps: "/steps";
|
|
12
|
+
readonly step: "/step";
|
|
13
|
+
readonly state: "/state";
|
|
14
|
+
readonly plan: "/plan";
|
|
15
|
+
readonly remote: "/remote";
|
|
16
|
+
readonly repository: "/repository";
|
|
17
|
+
readonly newProjectDialog: "/new-project-dialog";
|
|
18
|
+
readonly existingProjectDialog: "/existing-project-dialog";
|
|
19
|
+
readonly stagesDialog: "/stages-dialog";
|
|
20
|
+
readonly planNewProject: "/plan/new-project";
|
|
21
|
+
readonly planExistingProject: "/plan/existing-project";
|
|
22
|
+
readonly planStages: "/plan/stages";
|
|
23
|
+
readonly apply: "/apply";
|
|
24
|
+
};
|
|
25
|
+
/** A route of the First-run setup page. */
|
|
26
|
+
export type SetupRoute = (typeof SETUP_ROUTES)[keyof typeof SETUP_ROUTES];
|
|
27
|
+
/** The URL of a First-run setup page route, as a block or a button names it. */
|
|
28
|
+
export declare function setupRoute(route: SetupRoute): string;
|
|
29
|
+
/** The six steps as the page lists them: where each stands, and what it holds. */
|
|
30
|
+
export declare function stepItems(steps: readonly SetupStep[]): KeyValueListItem[];
|
|
31
|
+
/** What the apply answers: what each step did and, as a `warning` the DMS form shows instead of its success toast, what the plan left out. */
|
|
32
|
+
export interface ApplyAnswer {
|
|
33
|
+
checklist: ApplyItem[];
|
|
34
|
+
warning?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The apply's answer, with a `warning` when the plan leaves out stages,
|
|
38
|
+
* gives the app no address or creates no dashboard.
|
|
39
|
+
*/
|
|
40
|
+
export declare function applyAnswer(checklist: ApplyItem[]): ApplyAnswer;
|
|
41
|
+
/** The call to action of the step to do now, `null` when the page shows it otherwise. */
|
|
42
|
+
export declare function stepBanner({ facts, setup, steps, }: SetupState): BannerContent | null;
|
|
43
|
+
/** What applying the plan creates or links on AntelopeJS Cloud, in order. */
|
|
44
|
+
export declare function planItems({ facts, setup }: SetupState): KeyValueListItem[];
|
|
45
|
+
/** What AntelopeJS Cloud lets a new project be, as it answers it. */
|
|
46
|
+
export type Onboarding = Awaited<ReturnType<CloudApi["onboardingState"]>>;
|
|
47
|
+
/** The dialog that plans a new project: its name, from the folder's, and its region. */
|
|
48
|
+
export declare function newProjectDialog(onboarding: CloudRead<Onboarding> | undefined, suggestedSlug: string): ConfirmDialogSerialized;
|
|
49
|
+
/** The dialog that plans the stages beside Production. */
|
|
50
|
+
export declare function stagesDialog(setup: StoredSetup | undefined): ConfirmDialogSerialized;
|