@antelopejs/dms-antelope-cloud 0.0.0 → 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 +448 -0
- 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 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PassThrough } from "node:stream";
|
|
2
|
+
import { type QueryValue, type RequestContext } from "@antelopejs/interface-api";
|
|
3
|
+
import { type ProjectGate } from "./project-guard";
|
|
4
|
+
/** The routes of the Logs page, relative to it. */
|
|
5
|
+
export declare const LOGS_ROUTES: {
|
|
6
|
+
readonly gate: "/gate";
|
|
7
|
+
readonly sources: "/sources";
|
|
8
|
+
readonly stream: "/stream";
|
|
9
|
+
};
|
|
10
|
+
/** What the log viewer may stream: each environment of the project and its services, in API order. */
|
|
11
|
+
export interface LogSources {
|
|
12
|
+
readonly environments: readonly {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly services: readonly {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
}[];
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
21
|
+
declare const LogsPage_base: {
|
|
22
|
+
new (...args: any[]): {};
|
|
23
|
+
extend: <T extends import("@antelopejs/interface-api").ControllerClass>(this: T, location: string) => T;
|
|
24
|
+
location: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* What each environment's app prints, streamed live from AntelopeJS Cloud,
|
|
28
|
+
* one service at a time. The browser reaches the Cloud through this page's
|
|
29
|
+
* stream route only: it never holds the workspace's token.
|
|
30
|
+
*/
|
|
31
|
+
export declare class LogsPage extends LogsPage_base {
|
|
32
|
+
static logs: import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").GuardOptions>;
|
|
33
|
+
/** The DMS workspace of the request, bound by the page's registration. */
|
|
34
|
+
tenantId: string;
|
|
35
|
+
gate(): Promise<ProjectGate>;
|
|
36
|
+
sources(): Promise<LogSources>;
|
|
37
|
+
/**
|
|
38
|
+
* `GET /stream?environment=<id>&service=<id>&after=<cursor>` as
|
|
39
|
+
* server-sent events, `after` the id of the last line the browser
|
|
40
|
+
* received. The cursor rides in the query: the DMS dashboard server drops
|
|
41
|
+
* a `Last-Event-ID` header on its way here. A service the project does not
|
|
42
|
+
* run answers 404 before any frame and before any Cloud log read.
|
|
43
|
+
*/
|
|
44
|
+
stream(environmentId: QueryValue, serviceId: QueryValue, after: QueryValue, context: RequestContext, out: PassThrough): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LogsPage = exports.LOGS_ROUTES = void 0;
|
|
16
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
|
+
const custom_1 = require("@antelopejs/interface-dms/base/custom");
|
|
18
|
+
const page_1 = require("@antelopejs/interface-dms/page");
|
|
19
|
+
const cloud_1 = require("../connection/cloud");
|
|
20
|
+
const relay_1 = require("../logs/relay");
|
|
21
|
+
const navigation_1 = require("./navigation");
|
|
22
|
+
const query_1 = require("./query");
|
|
23
|
+
const slugs_1 = require("./slugs");
|
|
24
|
+
const project_guard_1 = require("./project-guard");
|
|
25
|
+
/** The routes of the Logs page, relative to it. */
|
|
26
|
+
exports.LOGS_ROUTES = {
|
|
27
|
+
gate: "/gate",
|
|
28
|
+
sources: "/sources",
|
|
29
|
+
stream: "/stream",
|
|
30
|
+
};
|
|
31
|
+
const HTTP_NOT_FOUND = 404;
|
|
32
|
+
const NO_SOURCES = { environments: [] };
|
|
33
|
+
function route(path) {
|
|
34
|
+
return (0, page_1.pageRoutePath)((0, slugs_1.modulePageSlug)("logs"), path);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* What each environment's app prints, streamed live from AntelopeJS Cloud,
|
|
38
|
+
* one service at a time. The browser reaches the Cloud through this page's
|
|
39
|
+
* stream route only: it never holds the workspace's token.
|
|
40
|
+
*/
|
|
41
|
+
let LogsPage = class LogsPage extends (0, page_1.PageController)("logs", (0, navigation_1.navigationEntry)("logs")) {
|
|
42
|
+
static logs = (0, project_guard_1.projectGuard)(route(exports.LOGS_ROUTES.gate)).child("viewer", (0, custom_1.CustomComponent)("AntelopeCloudLogViewer")
|
|
43
|
+
.options({
|
|
44
|
+
sourcesUrl: route(exports.LOGS_ROUTES.sources),
|
|
45
|
+
streamUrl: route(exports.LOGS_ROUTES.stream),
|
|
46
|
+
})
|
|
47
|
+
.meta({
|
|
48
|
+
name: "$dms_antelope_cloud.log_viewer.name",
|
|
49
|
+
description: "$dms_antelope_cloud.log_viewer.description",
|
|
50
|
+
icon: "i-ph-terminal-window",
|
|
51
|
+
}));
|
|
52
|
+
async gate() {
|
|
53
|
+
return (0, project_guard_1.readProjectGate)(this.tenantId);
|
|
54
|
+
}
|
|
55
|
+
async sources() {
|
|
56
|
+
const access = await (0, project_guard_1.projectAccess)(this.tenantId);
|
|
57
|
+
if (!access)
|
|
58
|
+
return NO_SOURCES;
|
|
59
|
+
const project = await (0, cloud_1.readCloud)(access.connection, (api) => api.readProject(access.projectId));
|
|
60
|
+
if (project.kind !== "ok")
|
|
61
|
+
return NO_SOURCES;
|
|
62
|
+
return {
|
|
63
|
+
environments: project.value.environments.map(({ id, name, services }) => ({
|
|
64
|
+
id,
|
|
65
|
+
name,
|
|
66
|
+
services: services.map((service) => ({
|
|
67
|
+
id: service.id,
|
|
68
|
+
name: service.name,
|
|
69
|
+
})),
|
|
70
|
+
})),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* `GET /stream?environment=<id>&service=<id>&after=<cursor>` as
|
|
75
|
+
* server-sent events, `after` the id of the last line the browser
|
|
76
|
+
* received. The cursor rides in the query: the DMS dashboard server drops
|
|
77
|
+
* a `Last-Event-ID` header on its way here. A service the project does not
|
|
78
|
+
* run answers 404 before any frame and before any Cloud log read.
|
|
79
|
+
*/
|
|
80
|
+
async stream(environmentId, serviceId, after, context, out) {
|
|
81
|
+
const closed = new AbortController();
|
|
82
|
+
context.rawResponse.once("close", () => closed.abort());
|
|
83
|
+
if (context.rawResponse.closed)
|
|
84
|
+
closed.abort();
|
|
85
|
+
const access = await (0, project_guard_1.requireProject)(this.tenantId);
|
|
86
|
+
const project = await (0, cloud_1.readCloud)(access.connection, (api) => api.readProject(access.projectId));
|
|
87
|
+
if (project.kind !== "ok")
|
|
88
|
+
throw (0, project_guard_1.refuseRead)(project.kind);
|
|
89
|
+
const environment = project.value.environments.find(({ id }) => id === environmentId);
|
|
90
|
+
const service = environment?.services.find(({ id }) => id === serviceId);
|
|
91
|
+
if (closed.signal.aborted) {
|
|
92
|
+
out.end();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (!environment || !service) {
|
|
96
|
+
throw new interface_api_1.HTTPResult(HTTP_NOT_FOUND, {
|
|
97
|
+
message: "$dms_antelope_cloud.errors.service_not_found",
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
context.response.addHeader("Cache-Control", "no-cache");
|
|
101
|
+
context.response.addHeader("X-Accel-Buffering", "no");
|
|
102
|
+
void (0, relay_1.relayLogs)({
|
|
103
|
+
connection: access.connection,
|
|
104
|
+
projectId: access.projectId,
|
|
105
|
+
environmentId: environment.id,
|
|
106
|
+
serviceId: service.id,
|
|
107
|
+
after: (0, query_1.queryText)(after),
|
|
108
|
+
out,
|
|
109
|
+
closed: closed.signal,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.LogsPage = LogsPage;
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, interface_api_1.Get)(exports.LOGS_ROUTES.gate),
|
|
116
|
+
__metadata("design:type", Function),
|
|
117
|
+
__metadata("design:paramtypes", []),
|
|
118
|
+
__metadata("design:returntype", Promise)
|
|
119
|
+
], LogsPage.prototype, "gate", null);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, interface_api_1.Get)(exports.LOGS_ROUTES.sources),
|
|
122
|
+
__metadata("design:type", Function),
|
|
123
|
+
__metadata("design:paramtypes", []),
|
|
124
|
+
__metadata("design:returntype", Promise)
|
|
125
|
+
], LogsPage.prototype, "sources", null);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, interface_api_1.Get)(exports.LOGS_ROUTES.stream),
|
|
128
|
+
__param(0, (0, interface_api_1.Parameter)("environment", "query")),
|
|
129
|
+
__param(1, (0, interface_api_1.Parameter)("service", "query")),
|
|
130
|
+
__param(2, (0, interface_api_1.Parameter)("after", "query")),
|
|
131
|
+
__param(3, (0, interface_api_1.Context)()),
|
|
132
|
+
__param(4, (0, interface_api_1.WriteStream)("text/event-stream")),
|
|
133
|
+
__metadata("design:type", Function),
|
|
134
|
+
__metadata("design:paramtypes", [Object, Object, Object, Object, Function]),
|
|
135
|
+
__metadata("design:returntype", Promise)
|
|
136
|
+
], LogsPage.prototype, "stream", null);
|
|
137
|
+
exports.LogsPage = LogsPage = __decorate([
|
|
138
|
+
(0, page_1.RegisterPage)()
|
|
139
|
+
], LogsPage);
|
|
140
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type MenuOptions } from "@antelopejs/interface-dms/page";
|
|
2
|
+
declare const NAVIGATION: readonly [{
|
|
3
|
+
readonly id: "release";
|
|
4
|
+
readonly label: "Release";
|
|
5
|
+
readonly pages: readonly [{
|
|
6
|
+
readonly id: "overview";
|
|
7
|
+
readonly label: "Overview";
|
|
8
|
+
readonly icon: "i-ph-squares-four";
|
|
9
|
+
}, {
|
|
10
|
+
readonly id: "changes";
|
|
11
|
+
readonly label: "Unpublished changes";
|
|
12
|
+
readonly icon: "i-ph-file-code";
|
|
13
|
+
}, {
|
|
14
|
+
readonly id: "versions";
|
|
15
|
+
readonly label: "Versions";
|
|
16
|
+
readonly icon: "i-ph-tag";
|
|
17
|
+
}];
|
|
18
|
+
}, {
|
|
19
|
+
readonly id: "environments";
|
|
20
|
+
readonly label: "Environments";
|
|
21
|
+
readonly pages: readonly [{
|
|
22
|
+
readonly id: "environments";
|
|
23
|
+
readonly label: "Environments";
|
|
24
|
+
readonly icon: "i-ph-stack";
|
|
25
|
+
}, {
|
|
26
|
+
readonly id: "deployments";
|
|
27
|
+
readonly label: "Deployments";
|
|
28
|
+
readonly icon: "i-ph-cloud-arrow-up";
|
|
29
|
+
}];
|
|
30
|
+
}, {
|
|
31
|
+
readonly id: "cloud";
|
|
32
|
+
readonly label: "AntelopeJS Cloud";
|
|
33
|
+
readonly pages: readonly [{
|
|
34
|
+
readonly id: "resources";
|
|
35
|
+
readonly label: "Resources";
|
|
36
|
+
readonly icon: "i-ph-cube";
|
|
37
|
+
}, {
|
|
38
|
+
readonly id: "variables";
|
|
39
|
+
readonly label: "Variables";
|
|
40
|
+
readonly icon: "i-ph-key";
|
|
41
|
+
}, {
|
|
42
|
+
readonly id: "logs";
|
|
43
|
+
readonly label: "Logs";
|
|
44
|
+
readonly icon: "i-ph-terminal-window";
|
|
45
|
+
}, {
|
|
46
|
+
readonly id: "connection";
|
|
47
|
+
readonly label: "Connection";
|
|
48
|
+
readonly icon: "i-ph-plugs-connected";
|
|
49
|
+
}];
|
|
50
|
+
}];
|
|
51
|
+
type NavigationEntry = (typeof NAVIGATION)[number]["pages"][number];
|
|
52
|
+
/** A page of the sidebar that its own file registers instead of a stub. */
|
|
53
|
+
export type BuiltPageId = Exclude<NavigationEntry, {
|
|
54
|
+
stub: string;
|
|
55
|
+
}>["id"];
|
|
56
|
+
/**
|
|
57
|
+
* Where a built page sits in the sidebar: its label, icon, group and order,
|
|
58
|
+
* as the navigation table declares them.
|
|
59
|
+
*/
|
|
60
|
+
export declare function navigationEntry(id: BuiltPageId): MenuOptions;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.navigationEntry = navigationEntry;
|
|
4
|
+
const empty_state_1 = require("@antelopejs/interface-dms/base/empty-state");
|
|
5
|
+
const page_1 = require("@antelopejs/interface-dms/page");
|
|
6
|
+
const slugs_1 = require("./slugs");
|
|
7
|
+
const TRANSPARENT_SLUG = "/";
|
|
8
|
+
const STUB_TITLE = "Coming soon";
|
|
9
|
+
const NAVIGATION = [
|
|
10
|
+
{
|
|
11
|
+
id: "release",
|
|
12
|
+
label: "Release",
|
|
13
|
+
pages: [
|
|
14
|
+
{
|
|
15
|
+
id: "overview",
|
|
16
|
+
label: "Overview",
|
|
17
|
+
icon: "i-ph-squares-four",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "changes",
|
|
21
|
+
label: "Unpublished changes",
|
|
22
|
+
icon: "i-ph-file-code",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "versions",
|
|
26
|
+
label: "Versions",
|
|
27
|
+
icon: "i-ph-tag",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "environments",
|
|
33
|
+
label: "Environments",
|
|
34
|
+
pages: [
|
|
35
|
+
{
|
|
36
|
+
id: "environments",
|
|
37
|
+
label: "Environments",
|
|
38
|
+
icon: "i-ph-stack",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "deployments",
|
|
42
|
+
label: "Deployments",
|
|
43
|
+
icon: "i-ph-cloud-arrow-up",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "cloud",
|
|
49
|
+
label: "AntelopeJS Cloud",
|
|
50
|
+
pages: [
|
|
51
|
+
{ id: "resources", label: "Resources", icon: "i-ph-cube" },
|
|
52
|
+
{ id: "variables", label: "Variables", icon: "i-ph-key" },
|
|
53
|
+
{ id: "logs", label: "Logs", icon: "i-ph-terminal-window" },
|
|
54
|
+
{ id: "connection", label: "Connection", icon: "i-ph-plugs-connected" },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
(0, page_1.RegisterModule)({
|
|
59
|
+
id: slugs_1.MODULE_ID,
|
|
60
|
+
title: "AntelopeJS Cloud",
|
|
61
|
+
description: "Connect this project to AntelopeJS Cloud and publish it",
|
|
62
|
+
icon: "i-ph-rocket-launch",
|
|
63
|
+
landingPage: "overview",
|
|
64
|
+
});
|
|
65
|
+
const GROUPS = NAVIGATION;
|
|
66
|
+
const PLACEMENTS = GROUPS.flatMap((group, groupOrder) => {
|
|
67
|
+
const category = (0, page_1.Category)(group.id, {
|
|
68
|
+
displayName: group.label,
|
|
69
|
+
module: slugs_1.MODULE_ID,
|
|
70
|
+
urlSlug: TRANSPARENT_SLUG,
|
|
71
|
+
type: "label",
|
|
72
|
+
order: groupOrder,
|
|
73
|
+
});
|
|
74
|
+
return group.pages.map((page, order) => ({
|
|
75
|
+
page,
|
|
76
|
+
options: {
|
|
77
|
+
displayName: page.label,
|
|
78
|
+
icon: page.icon,
|
|
79
|
+
module: slugs_1.MODULE_ID,
|
|
80
|
+
category,
|
|
81
|
+
urlSlug: page.id,
|
|
82
|
+
order,
|
|
83
|
+
},
|
|
84
|
+
}));
|
|
85
|
+
});
|
|
86
|
+
for (const { page, options } of PLACEMENTS) {
|
|
87
|
+
if (page.stub !== undefined) {
|
|
88
|
+
(0, page_1.RegisterPage)()(class extends (0, page_1.PageController)(page.id, options) {
|
|
89
|
+
static emptyState = (0, empty_state_1.EmptyState)({
|
|
90
|
+
title: STUB_TITLE,
|
|
91
|
+
description: page.stub,
|
|
92
|
+
icon: page.icon,
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Where a built page sits in the sidebar: its label, icon, group and order,
|
|
99
|
+
* as the navigation table declares them.
|
|
100
|
+
*/
|
|
101
|
+
function navigationEntry(id) {
|
|
102
|
+
const placement = PLACEMENTS.find(({ page }) => page.id === id);
|
|
103
|
+
if (!placement)
|
|
104
|
+
throw new Error(`No navigation entry "${id}"`);
|
|
105
|
+
return placement.options;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type BannerContent } from "@antelopejs/interface-dms/base/banner";
|
|
2
|
+
import { type KeyValueListItem } from "@antelopejs/interface-dms/base/key-value-list";
|
|
3
|
+
import { type StatGroupItem } from "@antelopejs/interface-dms/base/stat-group";
|
|
4
|
+
import { type GuardAnswer, type RemoteAnswer } from "../connection/content";
|
|
5
|
+
import { type ReadyAnswer } from "../environments/content";
|
|
6
|
+
interface Items<T> {
|
|
7
|
+
items: T[];
|
|
8
|
+
}
|
|
9
|
+
declare const OverviewPage_base: {
|
|
10
|
+
new (...args: any[]): {};
|
|
11
|
+
extend: <T extends import("@antelopejs/interface-api").ControllerClass>(this: T, location: string) => T;
|
|
12
|
+
location: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* What runs where on AntelopeJS Cloud: the workspace and project this DMS
|
|
16
|
+
* publishes, what each stage of the release pipeline serves, and the GitHub
|
|
17
|
+
* repository the project builds from.
|
|
18
|
+
*/
|
|
19
|
+
export declare class OverviewPage extends OverviewPage_base {
|
|
20
|
+
static banner: import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").BannerProps>;
|
|
21
|
+
static connection: import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").GuardOptions>;
|
|
22
|
+
static repository: import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").GuardOptions>;
|
|
23
|
+
/** The DMS workspace of the request, bound by the page's registration. */
|
|
24
|
+
tenantId: string;
|
|
25
|
+
private stored;
|
|
26
|
+
readState(): Promise<GuardAnswer>;
|
|
27
|
+
readReady(): Promise<ReadyAnswer>;
|
|
28
|
+
readBanner(): Promise<BannerContent | null>;
|
|
29
|
+
readSummary(): Promise<Items<KeyValueListItem>>;
|
|
30
|
+
readPipeline(): Promise<Items<StatGroupItem>>;
|
|
31
|
+
readHint(): Promise<BannerContent | null>;
|
|
32
|
+
readRemote(): Promise<RemoteAnswer>;
|
|
33
|
+
readRepository(): Promise<Items<KeyValueListItem>>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OverviewPage = void 0;
|
|
13
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
14
|
+
const banner_1 = require("@antelopejs/interface-dms/base/banner");
|
|
15
|
+
const guard_1 = require("@antelopejs/interface-dms/base/guard");
|
|
16
|
+
const key_value_list_1 = require("@antelopejs/interface-dms/base/key-value-list");
|
|
17
|
+
const section_1 = require("@antelopejs/interface-dms/base/section");
|
|
18
|
+
const stat_group_1 = require("@antelopejs/interface-dms/base/stat-group");
|
|
19
|
+
const page_1 = require("@antelopejs/interface-dms/page");
|
|
20
|
+
const announce_1 = require("../connection/announce");
|
|
21
|
+
const cloud_1 = require("../connection/cloud");
|
|
22
|
+
const content_1 = require("../connection/content");
|
|
23
|
+
const current_1 = require("../connection/current");
|
|
24
|
+
const repository_1 = require("../connection/repository");
|
|
25
|
+
const view_1 = require("../connection/view");
|
|
26
|
+
const actions_1 = require("../environments/actions");
|
|
27
|
+
const content_2 = require("../environments/content");
|
|
28
|
+
const content_3 = require("../overview/content");
|
|
29
|
+
const store_1 = require("../setup/store");
|
|
30
|
+
const navigation_1 = require("./navigation");
|
|
31
|
+
const slugs_1 = require("./slugs");
|
|
32
|
+
const SUMMARY_ROWS = 4;
|
|
33
|
+
const STAGE_CELLS = 3;
|
|
34
|
+
const REPOSITORY_ROWS = 2;
|
|
35
|
+
/**
|
|
36
|
+
* What runs where on AntelopeJS Cloud: the workspace and project this DMS
|
|
37
|
+
* publishes, what each stage of the release pipeline serves, and the GitHub
|
|
38
|
+
* repository the project builds from.
|
|
39
|
+
*/
|
|
40
|
+
let OverviewPage = class OverviewPage extends (0, page_1.PageController)("overview", (0, navigation_1.navigationEntry)("overview")) {
|
|
41
|
+
static banner = (0, banner_1.Banner)({
|
|
42
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.banner),
|
|
43
|
+
realtimeTopic: announce_1.PROJECT_TOPICS,
|
|
44
|
+
});
|
|
45
|
+
static connection = (0, guard_1.Guard)({
|
|
46
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.state),
|
|
47
|
+
realtimeTopic: announce_1.PROJECT_TOPICS,
|
|
48
|
+
field: "connected",
|
|
49
|
+
fallback: {
|
|
50
|
+
title: "Put this project online with AntelopeJS Cloud",
|
|
51
|
+
description: "Connect this DMS to an AntelopeJS Cloud workspace, then choose or create its project. Nothing is created on AntelopeJS Cloud before you apply the plan.",
|
|
52
|
+
icon: "i-ph-cloud",
|
|
53
|
+
actions: [
|
|
54
|
+
{
|
|
55
|
+
label: "Start the first-run setup",
|
|
56
|
+
to: slugs_1.SETUP_PAGE_SLUG,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
.child("summary", (0, key_value_list_1.KeyValueList)({
|
|
62
|
+
title: "AntelopeJS Cloud",
|
|
63
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.summary),
|
|
64
|
+
realtimeTopic: announce_1.PROJECT_TOPICS,
|
|
65
|
+
skeletonCount: SUMMARY_ROWS,
|
|
66
|
+
}))
|
|
67
|
+
.child("pipeline", (0, guard_1.Guard)({
|
|
68
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.ready),
|
|
69
|
+
realtimeTopic: announce_1.PROJECT_TOPICS,
|
|
70
|
+
field: "ready",
|
|
71
|
+
fallback: { title: "No release pipeline yet", size: "sm" },
|
|
72
|
+
}).child("stages", (0, section_1.Section)({
|
|
73
|
+
title: "Release pipeline",
|
|
74
|
+
description: "Each stage promotes the version it serves to the next, down to Production.",
|
|
75
|
+
card: false,
|
|
76
|
+
})
|
|
77
|
+
.child("stages", (0, stat_group_1.StatGroup)({
|
|
78
|
+
layout: "cards",
|
|
79
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.pipeline),
|
|
80
|
+
realtimeTopic: announce_1.PROJECT_TOPICS,
|
|
81
|
+
skeletonCount: STAGE_CELLS,
|
|
82
|
+
empty: {
|
|
83
|
+
title: "No stage yet",
|
|
84
|
+
description: "Name environments preview, staging or production to order them.",
|
|
85
|
+
},
|
|
86
|
+
}))
|
|
87
|
+
.child("hint", (0, banner_1.Banner)({
|
|
88
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.hint),
|
|
89
|
+
realtimeTopic: announce_1.PROJECT_TOPICS,
|
|
90
|
+
}))));
|
|
91
|
+
static repository = (0, guard_1.Guard)({
|
|
92
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.remote),
|
|
93
|
+
field: "remote",
|
|
94
|
+
fallback: content_1.NO_GITHUB_REMOTE,
|
|
95
|
+
}).child("details", (0, key_value_list_1.KeyValueList)({
|
|
96
|
+
title: "Repository",
|
|
97
|
+
fetchUrl: (0, content_3.overviewRoute)(content_3.OVERVIEW_ROUTES.repository),
|
|
98
|
+
skeletonCount: REPOSITORY_ROWS,
|
|
99
|
+
}));
|
|
100
|
+
stored() {
|
|
101
|
+
return (0, current_1.readConnection)(this.tenantId);
|
|
102
|
+
}
|
|
103
|
+
async readState() {
|
|
104
|
+
const view = (0, view_1.toView)(await this.stored(), new Date());
|
|
105
|
+
return { connected: view.state === "connected" };
|
|
106
|
+
}
|
|
107
|
+
async readReady() {
|
|
108
|
+
return (0, content_2.projectReadiness)((0, view_1.toView)(await this.stored(), new Date()));
|
|
109
|
+
}
|
|
110
|
+
async readBanner() {
|
|
111
|
+
const stored = await this.stored();
|
|
112
|
+
if (stored?.state !== "connected")
|
|
113
|
+
return null;
|
|
114
|
+
const { projectId } = stored;
|
|
115
|
+
const [access, setup] = await Promise.all([
|
|
116
|
+
(0, cloud_1.readCloud)(stored, (api) => projectId === null ? api.listProjects() : api.readProject(projectId)),
|
|
117
|
+
(0, store_1.setups)().read(this.tenantId),
|
|
118
|
+
]);
|
|
119
|
+
return (0, content_3.overviewBanner)((0, view_1.toView)(stored, new Date()), access.kind, setup?.applied?.projectId === projectId);
|
|
120
|
+
}
|
|
121
|
+
async readSummary() {
|
|
122
|
+
const stored = await this.stored();
|
|
123
|
+
const view = (0, view_1.toView)(stored, new Date());
|
|
124
|
+
if (stored?.state !== "connected" || stored.projectId === null) {
|
|
125
|
+
return { items: (0, content_3.summaryItems)(view, undefined, undefined) };
|
|
126
|
+
}
|
|
127
|
+
const { projectId } = stored;
|
|
128
|
+
const [project, repository] = await Promise.all([
|
|
129
|
+
(0, cloud_1.readCloud)(stored, (api) => api.readProject(projectId)),
|
|
130
|
+
(0, cloud_1.readCloud)(stored, (api) => api.projectRepository.read(projectId)),
|
|
131
|
+
]);
|
|
132
|
+
return { items: (0, content_3.summaryItems)(view, project, repository) };
|
|
133
|
+
}
|
|
134
|
+
async readPipeline() {
|
|
135
|
+
return {
|
|
136
|
+
items: (0, content_3.pipelineItems)(await (0, actions_1.readEnvironments)(await this.stored())),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
async readHint() {
|
|
140
|
+
return (0, content_3.oneEnvironmentHint)(await (0, actions_1.readEnvironments)(await this.stored()));
|
|
141
|
+
}
|
|
142
|
+
async readRemote() {
|
|
143
|
+
return (0, content_1.remoteAnswer)(await (0, repository_1.readPublishedRepository)());
|
|
144
|
+
}
|
|
145
|
+
async readRepository() {
|
|
146
|
+
return { items: (0, content_1.repositoryItems)(await (0, repository_1.readPublishedRepository)()) };
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
exports.OverviewPage = OverviewPage;
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.state),
|
|
152
|
+
__metadata("design:type", Function),
|
|
153
|
+
__metadata("design:paramtypes", []),
|
|
154
|
+
__metadata("design:returntype", Promise)
|
|
155
|
+
], OverviewPage.prototype, "readState", null);
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.ready),
|
|
158
|
+
__metadata("design:type", Function),
|
|
159
|
+
__metadata("design:paramtypes", []),
|
|
160
|
+
__metadata("design:returntype", Promise)
|
|
161
|
+
], OverviewPage.prototype, "readReady", null);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.banner),
|
|
164
|
+
__metadata("design:type", Function),
|
|
165
|
+
__metadata("design:paramtypes", []),
|
|
166
|
+
__metadata("design:returntype", Promise)
|
|
167
|
+
], OverviewPage.prototype, "readBanner", null);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.summary),
|
|
170
|
+
__metadata("design:type", Function),
|
|
171
|
+
__metadata("design:paramtypes", []),
|
|
172
|
+
__metadata("design:returntype", Promise)
|
|
173
|
+
], OverviewPage.prototype, "readSummary", null);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.pipeline),
|
|
176
|
+
__metadata("design:type", Function),
|
|
177
|
+
__metadata("design:paramtypes", []),
|
|
178
|
+
__metadata("design:returntype", Promise)
|
|
179
|
+
], OverviewPage.prototype, "readPipeline", null);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.hint),
|
|
182
|
+
__metadata("design:type", Function),
|
|
183
|
+
__metadata("design:paramtypes", []),
|
|
184
|
+
__metadata("design:returntype", Promise)
|
|
185
|
+
], OverviewPage.prototype, "readHint", null);
|
|
186
|
+
__decorate([
|
|
187
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.remote),
|
|
188
|
+
__metadata("design:type", Function),
|
|
189
|
+
__metadata("design:paramtypes", []),
|
|
190
|
+
__metadata("design:returntype", Promise)
|
|
191
|
+
], OverviewPage.prototype, "readRemote", null);
|
|
192
|
+
__decorate([
|
|
193
|
+
(0, interface_api_1.Get)(content_3.OVERVIEW_ROUTES.repository),
|
|
194
|
+
__metadata("design:type", Function),
|
|
195
|
+
__metadata("design:paramtypes", []),
|
|
196
|
+
__metadata("design:returntype", Promise)
|
|
197
|
+
], OverviewPage.prototype, "readRepository", null);
|
|
198
|
+
exports.OverviewPage = OverviewPage = __decorate([
|
|
199
|
+
(0, page_1.RegisterPage)()
|
|
200
|
+
], OverviewPage);
|
|
201
|
+
//# sourceMappingURL=overview.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HTTPResult } from "@antelopejs/interface-api";
|
|
2
|
+
import { type GuardFallback } from "@antelopejs/interface-dms/base/guard";
|
|
3
|
+
import type { CloudRead } from "../connection/cloud";
|
|
4
|
+
import { type ActiveConnection } from "../connection/current";
|
|
5
|
+
/** A signed-in workspace and the project its pages read. */
|
|
6
|
+
export interface ProjectAccess {
|
|
7
|
+
readonly connection: ActiveConnection;
|
|
8
|
+
readonly projectId: string;
|
|
9
|
+
}
|
|
10
|
+
/** What a project page's `Guard` reads: open, or closed with the empty state that says why. */
|
|
11
|
+
export interface ProjectGate {
|
|
12
|
+
readonly ready: boolean;
|
|
13
|
+
readonly emptyState?: GuardFallback;
|
|
14
|
+
}
|
|
15
|
+
/** A refusal the dashboard shows: its `message` is a key of the frontend's catalog. */
|
|
16
|
+
export type RefusalKey = "not_connected" | "project_required" | "sign_in_revoked" | "cloud_forbidden" | "unknown_project" | "cloud_unreachable" | "rollback_not_found" | "rollback_serving" | "rollback_in_progress" | "rollback_missing_revision" | "rollback_partial";
|
|
17
|
+
/** The refusal the dashboard shows for `key`, 409 unless the key says otherwise. */
|
|
18
|
+
export declare function refuse(key: RefusalKey): HTTPResult;
|
|
19
|
+
/** The refusal for a Cloud read that gave no value. */
|
|
20
|
+
export declare function refuseRead(kind: Exclude<CloudRead<unknown>["kind"], "ok">): HTTPResult;
|
|
21
|
+
/** The stored sign-in and its project, or null when either is missing. */
|
|
22
|
+
export declare function projectAccess(tenantId: string): Promise<ProjectAccess | null>;
|
|
23
|
+
/**
|
|
24
|
+
* The stored sign-in and its project, for a route that changes something.
|
|
25
|
+
*
|
|
26
|
+
* @throws The `not_connected` or `project_required` refusal.
|
|
27
|
+
*/
|
|
28
|
+
export declare function requireProject(tenantId: string): Promise<ProjectAccess>;
|
|
29
|
+
/** Open once the workspace is signed in with a project chosen, else why not. */
|
|
30
|
+
export declare function readProjectGate(tenantId: string): Promise<ProjectGate>;
|
|
31
|
+
/** The `Guard` a project page puts first, reading its gate route at `fetchUrl`. */
|
|
32
|
+
export declare function projectGuard(fetchUrl: string): import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").GuardOptions>;
|