@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.
Files changed (224) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +448 -0
  3. package/dist/cloud-status.d.ts +13 -0
  4. package/dist/cloud-status.js +77 -0
  5. package/dist/config.d.ts +84 -0
  6. package/dist/config.js +104 -0
  7. package/dist/configured.d.ts +16 -0
  8. package/dist/configured.js +26 -0
  9. package/dist/connection/actions.d.ts +40 -0
  10. package/dist/connection/actions.js +120 -0
  11. package/dist/connection/announce.d.ts +8 -0
  12. package/dist/connection/announce.js +20 -0
  13. package/dist/connection/cloud.d.ts +60 -0
  14. package/dist/connection/cloud.js +87 -0
  15. package/dist/connection/content.d.ts +70 -0
  16. package/dist/connection/content.js +462 -0
  17. package/dist/connection/current.d.ts +26 -0
  18. package/dist/connection/current.js +28 -0
  19. package/dist/connection/device-flow.d.ts +16 -0
  20. package/dist/connection/device-flow.js +146 -0
  21. package/dist/connection/refusals.d.ts +51 -0
  22. package/dist/connection/refusals.js +85 -0
  23. package/dist/connection/repository.d.ts +28 -0
  24. package/dist/connection/repository.js +69 -0
  25. package/dist/connection/seal.d.ts +22 -0
  26. package/dist/connection/seal.js +47 -0
  27. package/dist/connection/store.d.ts +294 -0
  28. package/dist/connection/store.js +165 -0
  29. package/dist/connection/view.d.ts +39 -0
  30. package/dist/connection/view.js +39 -0
  31. package/dist/dashboard/actions.d.ts +40 -0
  32. package/dist/dashboard/actions.js +115 -0
  33. package/dist/dashboard/dockerfile.d.ts +34 -0
  34. package/dist/dashboard/dockerfile.js +71 -0
  35. package/dist/dashboard/service.d.ts +61 -0
  36. package/dist/dashboard/service.js +137 -0
  37. package/dist/dashboard/variables.d.ts +30 -0
  38. package/dist/dashboard/variables.js +34 -0
  39. package/dist/deployments/build-log.d.ts +39 -0
  40. package/dist/deployments/build-log.js +57 -0
  41. package/dist/deployments/cloud-steps.d.ts +77 -0
  42. package/dist/deployments/cloud-steps.js +132 -0
  43. package/dist/deployments/content.d.ts +61 -0
  44. package/dist/deployments/content.js +268 -0
  45. package/dist/deployments/deployment.d.ts +96 -0
  46. package/dist/deployments/deployment.js +3 -0
  47. package/dist/deployments/follow.d.ts +18 -0
  48. package/dist/deployments/follow.js +112 -0
  49. package/dist/deployments/ledger.d.ts +23 -0
  50. package/dist/deployments/ledger.js +359 -0
  51. package/dist/deployments/lifecycle.d.ts +123 -0
  52. package/dist/deployments/lifecycle.js +146 -0
  53. package/dist/deployments/live.d.ts +28 -0
  54. package/dist/deployments/live.js +54 -0
  55. package/dist/deployments/publish-read.d.ts +20 -0
  56. package/dist/deployments/publish-read.js +24 -0
  57. package/dist/deployments/refusals.d.ts +13 -0
  58. package/dist/deployments/refusals.js +35 -0
  59. package/dist/environments/actions.d.ts +86 -0
  60. package/dist/environments/actions.js +210 -0
  61. package/dist/environments/address.d.ts +60 -0
  62. package/dist/environments/address.js +149 -0
  63. package/dist/environments/content.d.ts +97 -0
  64. package/dist/environments/content.js +275 -0
  65. package/dist/environments/follower.d.ts +32 -0
  66. package/dist/environments/follower.js +114 -0
  67. package/dist/environments/pipeline.d.ts +58 -0
  68. package/dist/environments/pipeline.js +76 -0
  69. package/dist/environments/publish-targets.d.ts +18 -0
  70. package/dist/environments/publish-targets.js +55 -0
  71. package/dist/environments/roles.d.ts +73 -0
  72. package/dist/environments/roles.js +97 -0
  73. package/dist/frontend-module.d.ts +12 -0
  74. package/dist/frontend-module.js +25 -0
  75. package/dist/git/changed-files.d.ts +30 -0
  76. package/dist/git/changed-files.js +107 -0
  77. package/dist/git/changes.d.ts +89 -0
  78. package/dist/git/changes.js +162 -0
  79. package/dist/git/command.d.ts +51 -0
  80. package/dist/git/command.js +231 -0
  81. package/dist/git/promotion.d.ts +23 -0
  82. package/dist/git/promotion.js +46 -0
  83. package/dist/git/publish-input.d.ts +42 -0
  84. package/dist/git/publish-input.js +62 -0
  85. package/dist/git/publish-job.d.ts +82 -0
  86. package/dist/git/publish-job.js +99 -0
  87. package/dist/git/publish-steps.d.ts +90 -0
  88. package/dist/git/publish-steps.js +205 -0
  89. package/dist/git/publisher.d.ts +23 -0
  90. package/dist/git/publisher.js +206 -0
  91. package/dist/git/refs.d.ts +99 -0
  92. package/dist/git/refs.js +178 -0
  93. package/dist/git/refusal.d.ts +49 -0
  94. package/dist/git/refusal.js +70 -0
  95. package/dist/git/repository.d.ts +101 -0
  96. package/dist/git/repository.js +273 -0
  97. package/dist/git/versions.d.ts +99 -0
  98. package/dist/git/versions.js +174 -0
  99. package/dist/git/write-lock.d.ts +19 -0
  100. package/dist/git/write-lock.js +49 -0
  101. package/dist/index.d.ts +5 -0
  102. package/dist/index.js +59 -0
  103. package/dist/lifecycle.d.ts +8 -0
  104. package/dist/lifecycle.js +78 -0
  105. package/dist/logs/relay.d.ts +25 -0
  106. package/dist/logs/relay.js +138 -0
  107. package/dist/null-prototype.d.ts +7 -0
  108. package/dist/null-prototype.js +3 -0
  109. package/dist/overview/content.d.ts +40 -0
  110. package/dist/overview/content.js +172 -0
  111. package/dist/pages/changes.d.ts +32 -0
  112. package/dist/pages/changes.js +141 -0
  113. package/dist/pages/connection.d.ts +43 -0
  114. package/dist/pages/connection.js +295 -0
  115. package/dist/pages/deployment.d.ts +67 -0
  116. package/dist/pages/deployment.js +261 -0
  117. package/dist/pages/deployments.d.ts +46 -0
  118. package/dist/pages/deployments.js +266 -0
  119. package/dist/pages/environments.d.ts +34 -0
  120. package/dist/pages/environments.js +368 -0
  121. package/dist/pages/logs.d.ts +46 -0
  122. package/dist/pages/logs.js +140 -0
  123. package/dist/pages/navigation.d.ts +61 -0
  124. package/dist/pages/navigation.js +107 -0
  125. package/dist/pages/overview.d.ts +35 -0
  126. package/dist/pages/overview.js +201 -0
  127. package/dist/pages/project-guard.d.ts +32 -0
  128. package/dist/pages/project-guard.js +99 -0
  129. package/dist/pages/query.d.ts +6 -0
  130. package/dist/pages/query.js +14 -0
  131. package/dist/pages/resources.d.ts +37 -0
  132. package/dist/pages/resources.js +211 -0
  133. package/dist/pages/setup.d.ts +40 -0
  134. package/dist/pages/setup.js +271 -0
  135. package/dist/pages/slugs.d.ts +15 -0
  136. package/dist/pages/slugs.js +28 -0
  137. package/dist/pages/variables.d.ts +43 -0
  138. package/dist/pages/variables.js +327 -0
  139. package/dist/pages/version.d.ts +26 -0
  140. package/dist/pages/version.js +214 -0
  141. package/dist/pages/versions.d.ts +20 -0
  142. package/dist/pages/versions.js +115 -0
  143. package/dist/resources/apply.d.ts +15 -0
  144. package/dist/resources/apply.js +127 -0
  145. package/dist/resources/cards.d.ts +41 -0
  146. package/dist/resources/cards.js +211 -0
  147. package/dist/resources/connect.d.ts +66 -0
  148. package/dist/resources/connect.js +78 -0
  149. package/dist/resources/content.d.ts +26 -0
  150. package/dist/resources/content.js +158 -0
  151. package/dist/resources/format.d.ts +10 -0
  152. package/dist/resources/format.js +30 -0
  153. package/dist/resources/guard.d.ts +23 -0
  154. package/dist/resources/guard.js +60 -0
  155. package/dist/resources/modules.d.ts +23 -0
  156. package/dist/resources/modules.js +39 -0
  157. package/dist/resources/plan.d.ts +8 -0
  158. package/dist/resources/plan.js +93 -0
  159. package/dist/resources/read.d.ts +54 -0
  160. package/dist/resources/read.js +69 -0
  161. package/dist/resources/refusals.d.ts +15 -0
  162. package/dist/resources/refusals.js +33 -0
  163. package/dist/resources/routes.d.ts +32 -0
  164. package/dist/resources/routes.js +53 -0
  165. package/dist/setup/actions.d.ts +79 -0
  166. package/dist/setup/actions.js +188 -0
  167. package/dist/setup/apply.d.ts +37 -0
  168. package/dist/setup/apply.js +172 -0
  169. package/dist/setup/content.d.ts +50 -0
  170. package/dist/setup/content.js +440 -0
  171. package/dist/setup/rollout.d.ts +119 -0
  172. package/dist/setup/rollout.js +227 -0
  173. package/dist/setup/steps.d.ts +93 -0
  174. package/dist/setup/steps.js +95 -0
  175. package/dist/setup/storage.d.ts +29 -0
  176. package/dist/setup/storage.js +78 -0
  177. package/dist/setup/store.d.ts +214 -0
  178. package/dist/setup/store.js +174 -0
  179. package/dist/setup/volume.d.ts +31 -0
  180. package/dist/setup/volume.js +52 -0
  181. package/dist/slug.d.ts +7 -0
  182. package/dist/slug.js +26 -0
  183. package/dist/variables/actions.d.ts +76 -0
  184. package/dist/variables/actions.js +185 -0
  185. package/dist/variables/content.d.ts +69 -0
  186. package/dist/variables/content.js +310 -0
  187. package/dist/variables/decide.d.ts +27 -0
  188. package/dist/variables/decide.js +155 -0
  189. package/dist/variables/decided-dialog.d.ts +11 -0
  190. package/dist/variables/decided-dialog.js +129 -0
  191. package/dist/variables/decided.d.ts +80 -0
  192. package/dist/variables/decided.js +240 -0
  193. package/dist/variables/dialogs.d.ts +8 -0
  194. package/dist/variables/dialogs.js +219 -0
  195. package/dist/variables/model.d.ts +106 -0
  196. package/dist/variables/model.js +156 -0
  197. package/dist/variables/project-config.d.ts +117 -0
  198. package/dist/variables/project-config.js +248 -0
  199. package/dist/variables/read.d.ts +33 -0
  200. package/dist/variables/read.js +118 -0
  201. package/dist/web-url.d.ts +9 -0
  202. package/dist/web-url.js +19 -0
  203. package/frontend-vue/app/components/BuildLog.vue +99 -0
  204. package/frontend-vue/app/components/ChangedFiles.vue +165 -0
  205. package/frontend-vue/app/components/DashboardEnvironments.vue +102 -0
  206. package/frontend-vue/app/components/LogLine.vue +33 -0
  207. package/frontend-vue/app/components/LogViewer.vue +314 -0
  208. package/frontend-vue/app/components/PublishChipIcon.vue +39 -0
  209. package/frontend-vue/app/components/PublishForm.vue +505 -0
  210. package/frontend-vue/app/components/PublishPopover.vue +90 -0
  211. package/frontend-vue/app/components/PublishRoute.vue +222 -0
  212. package/frontend-vue/app/composables/usePublishSummary.ts +80 -0
  213. package/frontend-vue/app/plugins/publish-chip.client.ts +44 -0
  214. package/frontend-vue/app/types/publishing.ts +154 -0
  215. package/frontend-vue/app/utils/build-log.ts +96 -0
  216. package/frontend-vue/app/utils/changed-files.ts +142 -0
  217. package/frontend-vue/app/utils/log-line.ts +15 -0
  218. package/frontend-vue/app/utils/log-stream.ts +361 -0
  219. package/frontend-vue/app/utils/publish-state.ts +299 -0
  220. package/frontend-vue/dms.frontend.ts +27 -0
  221. package/frontend-vue/i18n/locales/antelope-cloud-en-GB.json +110 -0
  222. package/frontend-vue/package.json +38 -0
  223. package/frontend-vue/pnpm-lock.yaml +2697 -0
  224. package/package.json +115 -4
@@ -0,0 +1,40 @@
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 { CloudRead } from "../connection/cloud";
5
+ import { type CloudProject } from "../connection/content";
6
+ import type { ConnectionView } from "../connection/view";
7
+ import { type EnvironmentsRead } from "../environments/content";
8
+ /** The routes of the Overview page, relative to it. */
9
+ export declare const OVERVIEW_ROUTES: {
10
+ readonly state: "/state";
11
+ readonly ready: "/ready";
12
+ readonly banner: "/banner";
13
+ readonly summary: "/summary";
14
+ readonly pipeline: "/pipeline";
15
+ readonly hint: "/hint";
16
+ readonly remote: "/remote";
17
+ readonly repository: "/repository";
18
+ };
19
+ /** A route of the Overview page. */
20
+ export type OverviewRoute = (typeof OVERVIEW_ROUTES)[keyof typeof OVERVIEW_ROUTES];
21
+ /** The URL of an Overview page route, as a block names it. */
22
+ export declare function overviewRoute(route: OverviewRoute): string;
23
+ /**
24
+ * The call to action at the top of the Overview: why AntelopeJS Cloud cannot
25
+ * be read, or to put the project online, which a managed connection does
26
+ * until its plan is `applied`. `null` when there is none.
27
+ */
28
+ export declare function overviewBanner(view: ConnectionView, access: CloudRead<unknown>["kind"], applied: boolean): BannerContent | null;
29
+ /**
30
+ * Where this DMS publishes: the workspace, the project and its region, and
31
+ * the GitHub repository the project builds from.
32
+ */
33
+ export declare function summaryItems(view: ConnectionView, project: CloudRead<CloudProject> | undefined, repository: CloudRead<string | null> | undefined): KeyValueListItem[];
34
+ /** Each stage of the release pipeline: what it serves, its state, a failed build. */
35
+ export declare function pipelineItems(environments: EnvironmentsRead): StatGroupItem[];
36
+ /**
37
+ * The hint of a project with one environment: versions reach it directly.
38
+ * `null` for any other project.
39
+ */
40
+ export declare function oneEnvironmentHint(environments: EnvironmentsRead): BannerContent | null;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OVERVIEW_ROUTES = void 0;
4
+ exports.overviewRoute = overviewRoute;
5
+ exports.overviewBanner = overviewBanner;
6
+ exports.summaryItems = summaryItems;
7
+ exports.pipelineItems = pipelineItems;
8
+ exports.oneEnvironmentHint = oneEnvironmentHint;
9
+ const page_1 = require("@antelopejs/interface-dms/page");
10
+ const content_1 = require("../connection/content");
11
+ const content_2 = require("../environments/content");
12
+ const pipeline_1 = require("../environments/pipeline");
13
+ const slugs_1 = require("../pages/slugs");
14
+ /** The routes of the Overview page, relative to it. */
15
+ exports.OVERVIEW_ROUTES = {
16
+ state: "/state",
17
+ ready: "/ready",
18
+ banner: "/banner",
19
+ summary: "/summary",
20
+ pipeline: "/pipeline",
21
+ hint: "/hint",
22
+ remote: "/remote",
23
+ repository: "/repository",
24
+ };
25
+ /** The URL of an Overview page route, as a block names it. */
26
+ function overviewRoute(route) {
27
+ return (0, page_1.pageRoutePath)((0, slugs_1.modulePageSlug)("overview"), route);
28
+ }
29
+ const OPEN_CONNECTION = {
30
+ label: "Open Connection",
31
+ to: (0, slugs_1.modulePageSlug)("connection"),
32
+ };
33
+ const UNAVAILABLE = {
34
+ revoked: {
35
+ title: "Your AntelopeJS Cloud sign-in was revoked",
36
+ description: "Sign in again to see what runs where.",
37
+ },
38
+ missing: {
39
+ title: "AntelopeJS Cloud has no such project any more",
40
+ description: "Choose the project this DMS publishes again.",
41
+ },
42
+ forbidden: {
43
+ title: "AntelopeJS Cloud does not allow this token here",
44
+ description: "Its access does not cover what runs where in this project.",
45
+ },
46
+ unreachable: {
47
+ title: "AntelopeJS Cloud did not answer",
48
+ description: "What runs where shows again once it answers.",
49
+ },
50
+ };
51
+ const PUT_ONLINE = {
52
+ tone: "primary",
53
+ icon: "i-ph-cloud",
54
+ title: "Put this project online with AntelopeJS Cloud",
55
+ description: "Choose or create the project this DMS publishes, link its repository and its environments. Nothing is created on AntelopeJS Cloud before you apply the plan.",
56
+ actions: [{ label: "Open first-run setup", to: slugs_1.SETUP_PAGE_SLUG }],
57
+ };
58
+ const APPLY_MANAGED_PLAN = {
59
+ tone: "primary",
60
+ icon: "i-ph-cloud",
61
+ title: "Put this project online with AntelopeJS Cloud",
62
+ description: "AntelopeJS Cloud connected this development environment to its project. Review the plan and apply it to give Production its services and create the environments you choose.",
63
+ actions: [{ label: "Open first-run setup", to: slugs_1.SETUP_PAGE_SLUG }],
64
+ };
65
+ /**
66
+ * The call to action at the top of the Overview: why AntelopeJS Cloud cannot
67
+ * be read, or to put the project online, which a managed connection does
68
+ * until its plan is `applied`. `null` when there is none.
69
+ */
70
+ function overviewBanner(view, access, applied) {
71
+ if (view.state !== "connected")
72
+ return null;
73
+ if (access !== "ok") {
74
+ return {
75
+ tone: "warning",
76
+ ...UNAVAILABLE[access],
77
+ actions: [OPEN_CONNECTION],
78
+ };
79
+ }
80
+ if (view.managed)
81
+ return applied ? null : APPLY_MANAGED_PLAN;
82
+ return view.projectId === null ? PUT_ONLINE : null;
83
+ }
84
+ function repositoryItem(repository) {
85
+ if (repository === undefined)
86
+ return [];
87
+ if (repository.kind !== "ok") {
88
+ return [
89
+ {
90
+ id: "repository",
91
+ label: "Repository",
92
+ value: "Unavailable",
93
+ type: "status",
94
+ tone: "warning",
95
+ },
96
+ ];
97
+ }
98
+ if (repository.value === null) {
99
+ return [
100
+ {
101
+ id: "repository",
102
+ label: "Repository",
103
+ value: "Not linked",
104
+ type: "status",
105
+ tone: "warning",
106
+ detail: "AntelopeJS Cloud builds each environment from it.",
107
+ },
108
+ ];
109
+ }
110
+ return [
111
+ {
112
+ id: "repository",
113
+ label: "Repository",
114
+ value: repository.value,
115
+ type: "mono",
116
+ to: `https://github.com/${repository.value}`,
117
+ },
118
+ ];
119
+ }
120
+ /**
121
+ * Where this DMS publishes: the workspace, the project and its region, and
122
+ * the GitHub repository the project builds from.
123
+ */
124
+ function summaryItems(view, project, repository) {
125
+ return [...(0, content_1.workspaceItems)(view, project), ...repositoryItem(repository)];
126
+ }
127
+ /** Each stage of the release pipeline: what it serves, its state, a failed build. */
128
+ function pipelineItems(environments) {
129
+ if (environments?.kind !== "ok")
130
+ return [];
131
+ return (0, pipeline_1.pipelineOf)(environments.value).stages.map((environment, index) => {
132
+ const { serving } = environment;
133
+ const state = (0, content_2.environmentState)(environment);
134
+ const failure = (0, content_2.failureLine)(environment);
135
+ const item = {
136
+ id: environment.id,
137
+ icon: "i-ph-stack",
138
+ tone: state.tone,
139
+ eyebrow: `${(0, content_2.stageOrder)(index)} · ${(0, pipeline_1.environmentLabel)(environment.name)}`,
140
+ value: serving ? (0, content_2.deploymentName)(serving) : "Nothing yet",
141
+ detail: serving ? (0, content_2.deployedSince)(serving) : state.label,
142
+ to: (0, slugs_1.modulePageSlug)("environments"),
143
+ };
144
+ if (failure) {
145
+ item.detail = failure.text;
146
+ item.detailTone = "error";
147
+ }
148
+ return item;
149
+ });
150
+ }
151
+ /**
152
+ * The hint of a project with one environment: versions reach it directly.
153
+ * `null` for any other project.
154
+ */
155
+ function oneEnvironmentHint(environments) {
156
+ if (environments?.kind !== "ok")
157
+ return null;
158
+ const { stages, others } = (0, pipeline_1.pipelineOf)(environments.value);
159
+ const durable = [...stages, ...others];
160
+ if (durable.length !== 1)
161
+ return null;
162
+ return {
163
+ tone: "info",
164
+ icon: "i-ph-stack-plus",
165
+ title: "Test before going live",
166
+ description: `${(0, pipeline_1.environmentLabel)(durable[0].name)} receives publishes directly. Add a Staging environment to check a version before it goes live.`,
167
+ actions: [
168
+ { label: "Manage environments", to: (0, slugs_1.modulePageSlug)("environments") },
169
+ ],
170
+ };
171
+ }
172
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1,32 @@
1
+ import { HTTPResult } from "@antelopejs/interface-api";
2
+ import type { User } from "@antelopejs/interface-dms/auth/db";
3
+ import { type BannerContent } from "@antelopejs/interface-dms/base/banner";
4
+ import { type ChangesSummary } from "../git/changes";
5
+ declare const ChangesPage_base: {
6
+ new (...args: any[]): {};
7
+ extend: <T extends import("@antelopejs/interface-api").ControllerClass>(this: T, location: string) => T;
8
+ location: string;
9
+ };
10
+ /**
11
+ * The edits made since the last version, and the form that publishes them
12
+ * as the next one.
13
+ */
14
+ export declare class ChangesPage extends ChangesPage_base {
15
+ user: User;
16
+ static refusal: import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").BannerProps>;
17
+ static content: import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").GridOptions>;
18
+ /** The DMS workspace of the request, bound by the page's registration. */
19
+ tenantId: string;
20
+ /**
21
+ * The environments of the project this workspace publishes, or `undefined`
22
+ * when it publishes none or AntelopeJS Cloud did not answer for it.
23
+ */
24
+ private projectEnvironments;
25
+ summary(): Promise<ChangesSummary>;
26
+ refusal(): Promise<BannerContent | null>;
27
+ publish(body: unknown): Promise<HTTPResult>;
28
+ status(): {
29
+ job: import("../git/publish-job").PublishJob | null;
30
+ };
31
+ }
32
+ export {};
@@ -0,0 +1,141 @@
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.ChangesPage = void 0;
16
+ const interface_api_1 = require("@antelopejs/interface-api");
17
+ const banner_1 = require("@antelopejs/interface-dms/base/banner");
18
+ const custom_1 = require("@antelopejs/interface-dms/base/custom");
19
+ const grid_1 = require("@antelopejs/interface-dms/base/grid");
20
+ const page_1 = require("@antelopejs/interface-dms/page");
21
+ const config_1 = require("../config");
22
+ const current_1 = require("../connection/current");
23
+ const actions_1 = require("../environments/actions");
24
+ const publish_targets_1 = require("../environments/publish-targets");
25
+ const changes_1 = require("../git/changes");
26
+ const publish_input_1 = require("../git/publish-input");
27
+ const publisher_1 = require("../git/publisher");
28
+ const routes_1 = require("../resources/routes");
29
+ const deployments_1 = require("./deployments");
30
+ const navigation_1 = require("./navigation");
31
+ const slugs_1 = require("./slugs");
32
+ const SUMMARY_ROUTE = "/summary";
33
+ const PUBLISH_ROUTE = "/publish";
34
+ const REFUSAL_ROUTE = "/refusal";
35
+ const SLUG = (0, slugs_1.modulePageSlug)("changes");
36
+ const SUMMARY_URL = (0, page_1.pageRoutePath)(SLUG, SUMMARY_ROUTE);
37
+ const PUBLISH_URL = (0, page_1.pageRoutePath)(SLUG, PUBLISH_ROUTE);
38
+ const DEPLOYMENTS_SLUG = (0, slugs_1.modulePageSlug)("deployments");
39
+ const FILES_SPAN = 2;
40
+ /** The banner title of each refusal that comes from the repository itself. */
41
+ const REPOSITORY_REFUSALS = new Map([
42
+ ["not_a_repository", "This project is not a git repository"],
43
+ ["no_origin", "Origin is not available"],
44
+ ["detached_head", "HEAD is detached"],
45
+ ["on_environment_branch", "HEAD is on an environment branch"],
46
+ ]);
47
+ /**
48
+ * The edits made since the last version, and the form that publishes them
49
+ * as the next one.
50
+ */
51
+ let ChangesPage = class ChangesPage extends (0, page_1.PageController)("changes", (0, navigation_1.navigationEntry)("changes")) {
52
+ static refusal = (0, banner_1.Banner)({
53
+ fetchUrl: (0, page_1.pageRoutePath)(SLUG, REFUSAL_ROUTE),
54
+ tone: "warning",
55
+ icon: "i-ph-git-branch",
56
+ });
57
+ static content = (0, grid_1.Grid)().child("row", (0, grid_1.GridRow)()
58
+ .child("files", (0, custom_1.CustomComponent)("AntelopeCloudChangedFiles")
59
+ .options({ fetchUrl: SUMMARY_URL, field: "files" })
60
+ .meta({
61
+ name: "$dms_antelope_cloud.changed_files.name",
62
+ description: "$dms_antelope_cloud.changed_files.description",
63
+ icon: "i-ph-file-code",
64
+ }), { colSpan: FILES_SPAN })
65
+ .child("publish", (0, custom_1.CustomComponent)("AntelopeCloudPublishForm")
66
+ .options({
67
+ summaryUrl: SUMMARY_URL,
68
+ publishUrl: PUBLISH_URL,
69
+ statusUrl: PUBLISH_URL,
70
+ publishNoteUrl: (0, routes_1.resourcesRoute)(routes_1.RESOURCES_ROUTES.publishNote),
71
+ cloudStepsUrl: (0, page_1.pageRoutePath)(DEPLOYMENTS_SLUG, deployments_1.DEPLOYMENTS_ROUTES.publishSteps),
72
+ deploymentsUrl: DEPLOYMENTS_SLUG,
73
+ })
74
+ .meta({
75
+ name: "$dms_antelope_cloud.publish_form.name",
76
+ description: "$dms_antelope_cloud.publish_form.description",
77
+ icon: "i-ph-rocket-launch",
78
+ })));
79
+ /**
80
+ * The environments of the project this workspace publishes, or `undefined`
81
+ * when it publishes none or AntelopeJS Cloud did not answer for it.
82
+ */
83
+ async projectEnvironments() {
84
+ const read = await (0, actions_1.readEnvironments)(await (0, current_1.readConnection)(this.tenantId));
85
+ return read?.kind === "ok" ? read.value : undefined;
86
+ }
87
+ summary() {
88
+ return (0, changes_1.readChanges)((0, config_1.cloudSettings)().repositoryPath, (0, publisher_1.currentJob)(), this.projectEnvironments().then((environments) => environments && (0, publish_targets_1.publishTargetNames)(environments)));
89
+ }
90
+ async refusal() {
91
+ const refusal = await (0, changes_1.readRepositoryRefusal)((0, config_1.cloudSettings)().repositoryPath);
92
+ const title = refusal && REPOSITORY_REFUSALS.get(refusal.code);
93
+ return refusal && title ? { title, description: refusal.message } : null;
94
+ }
95
+ async publish(body) {
96
+ const parsed = publish_input_1.publishInputSchema.safeParse(body);
97
+ if (!parsed.success) {
98
+ return new interface_api_1.HTTPResult(400, { refusal: (0, publish_input_1.inputRefusal)(parsed.error) });
99
+ }
100
+ const refusal = (0, publish_targets_1.publishTargetRefusal)(await this.projectEnvironments(), parsed.data.environment);
101
+ if (refusal)
102
+ return new interface_api_1.HTTPResult(400, { refusal });
103
+ const answer = await (0, publisher_1.startPublish)((0, config_1.cloudSettings)().repositoryPath, parsed.data, (0, publish_input_1.gitIdentity)(this.user));
104
+ return answer.status === 202
105
+ ? new interface_api_1.HTTPResult(202, { job: answer.job })
106
+ : new interface_api_1.HTTPResult(answer.status, { refusal: answer.refusal });
107
+ }
108
+ status() {
109
+ return { job: (0, publisher_1.currentJob)() };
110
+ }
111
+ };
112
+ exports.ChangesPage = ChangesPage;
113
+ __decorate([
114
+ (0, interface_api_1.Get)(SUMMARY_ROUTE),
115
+ __metadata("design:type", Function),
116
+ __metadata("design:paramtypes", []),
117
+ __metadata("design:returntype", Promise)
118
+ ], ChangesPage.prototype, "summary", null);
119
+ __decorate([
120
+ (0, interface_api_1.Get)(REFUSAL_ROUTE),
121
+ __metadata("design:type", Function),
122
+ __metadata("design:paramtypes", []),
123
+ __metadata("design:returntype", Promise)
124
+ ], ChangesPage.prototype, "refusal", null);
125
+ __decorate([
126
+ (0, interface_api_1.Post)(PUBLISH_ROUTE),
127
+ __param(0, (0, interface_api_1.JSONBody)()),
128
+ __metadata("design:type", Function),
129
+ __metadata("design:paramtypes", [Object]),
130
+ __metadata("design:returntype", Promise)
131
+ ], ChangesPage.prototype, "publish", null);
132
+ __decorate([
133
+ (0, interface_api_1.Get)(PUBLISH_ROUTE),
134
+ __metadata("design:type", Function),
135
+ __metadata("design:paramtypes", []),
136
+ __metadata("design:returntype", void 0)
137
+ ], ChangesPage.prototype, "status", null);
138
+ exports.ChangesPage = ChangesPage = __decorate([
139
+ (0, page_1.RegisterPage)()
140
+ ], ChangesPage);
141
+ //# sourceMappingURL=changes.js.map
@@ -0,0 +1,43 @@
1
+ import type { User } from "@antelopejs/interface-dms/auth/db";
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 GuardAnswer } from "../connection/content";
6
+ interface Items {
7
+ items: KeyValueListItem[];
8
+ }
9
+ declare const ConnectionPage_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
+ * How this project reaches AntelopeJS Cloud: the device sign-in, the workspace
16
+ * and project it publishes to, the repository it builds from, and the API it
17
+ * talks to. The workspace's token stays on the server.
18
+ */
19
+ export declare class ConnectionPage extends ConnectionPage_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 status: import("@antelopejs/interface-dms").ComponentBuilder<import("@antelopejs/interface-dms/base").KeyValueListProps>;
23
+ /** The DMS workspace of the request, bound by the page's registration. */
24
+ tenantId: string;
25
+ user: User;
26
+ private stored;
27
+ private view;
28
+ readBanner(): Promise<BannerContent | null>;
29
+ readState(): Promise<GuardAnswer>;
30
+ readAccount(): Promise<Items>;
31
+ readWorkspace(): Promise<Items>;
32
+ readRepository(): Promise<Items>;
33
+ readDisconnectBanner(): Promise<BannerContent | null>;
34
+ readSignOutBanner(): Promise<BannerContent | null>;
35
+ readProjectDialog(): Promise<ConfirmDialogSerialized>;
36
+ connect(): Promise<object>;
37
+ cancel(): Promise<object>;
38
+ chooseProject(body: unknown): Promise<object>;
39
+ disconnect(): Promise<object>;
40
+ signOut(): Promise<object>;
41
+ readApiStatus(): Promise<Items>;
42
+ }
43
+ export {};