@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,299 @@
1
+ import type {
2
+ ChangesSummary,
3
+ ChipState,
4
+ CloudStepId,
5
+ EnvironmentLive,
6
+ PublishEnvironment,
7
+ PublishJob,
8
+ PublishStep,
9
+ PublishSteps,
10
+ Refusal,
11
+ StepId,
12
+ StepState,
13
+ } from '../types/publishing'
14
+
15
+ export const SUMMARY_ROUTE = '/dms/pages/modules/antelope-cloud/changes/summary'
16
+ export const CHANGES_PAGE_PATH = '/modules/antelope-cloud/changes'
17
+
18
+ export const IDLE_POLL_MS = 15_000
19
+ export const RUNNING_POLL_MS = 750
20
+ export const CLOUD_POLL_MS = 2_000
21
+ export const CLOUD_FOLLOW_MS = 20 * 60_000
22
+
23
+ /** Icons of a step that has not run yet. */
24
+ export const STEP_ICONS: Record<StepId, string> = {
25
+ commit: 'i-ph-git-commit-light',
26
+ tag: 'i-ph-tag-light',
27
+ move: 'i-ph-git-branch-light',
28
+ push: 'i-ph-cloud-arrow-up-light',
29
+ }
30
+
31
+ export const STATE_ICONS: Record<
32
+ Exclude<StepState, 'todo' | 'running'>,
33
+ string
34
+ > = {
35
+ done: 'i-ph-check-light',
36
+ failed: 'i-ph-x-light',
37
+ skipped: 'i-ph-minus-light',
38
+ }
39
+
40
+ /** The steps that happen on AntelopeJS Cloud after the push, in order. */
41
+ const CLOUD_STEPS: readonly {
42
+ id: CloudStepId
43
+ title: string
44
+ icon: string
45
+ }[] = [
46
+ { id: 'provision', title: 'Provision resources', icon: 'i-ph-cube-light' },
47
+ { id: 'build', title: 'Build image', icon: 'i-ph-package-light' },
48
+ { id: 'health', title: 'Health check', icon: 'i-ph-heartbeat-light' },
49
+ {
50
+ id: 'switch',
51
+ title: 'Switch traffic',
52
+ icon: 'i-ph-arrows-left-right-light',
53
+ },
54
+ ]
55
+
56
+ /** What a Cloud step says under its title while it is followed. */
57
+ const CLOUD_DETAILS: Record<StepState, string> = {
58
+ todo: 'Waiting',
59
+ running: 'In progress',
60
+ done: 'Done',
61
+ skipped: 'Skipped',
62
+ failed: 'Failed',
63
+ }
64
+
65
+ /** A Cloud step of the publish dialog: what it draws, whatever the Cloud said. */
66
+ export interface CloudStepView {
67
+ id: CloudStepId
68
+ title: string
69
+ icon: string
70
+ state: StepState
71
+ detail: string
72
+ }
73
+
74
+ /** Whether the git steps pushed the version, so that the Cloud can build it. */
75
+ function isPushed(job: PublishJob): boolean {
76
+ return job.steps.some((step) => step.id === 'push' && step.state === 'done')
77
+ }
78
+
79
+ function waitingDetail(job: PublishJob, cloud: PublishSteps | null): string {
80
+ if (cloud?.state === 'unavailable') return 'Not followed here'
81
+ return isPushed(job) ? 'Waiting for AntelopeJS Cloud' : 'After the push'
82
+ }
83
+
84
+ /**
85
+ * The four Cloud steps of a publish: each as the Cloud reports it while its
86
+ * deployment is followed, else still to do, waiting for the push or for the
87
+ * Cloud.
88
+ */
89
+ export function cloudStepViews(
90
+ job: PublishJob,
91
+ cloud: PublishSteps | null,
92
+ ): CloudStepView[] {
93
+ const reported = new Map(
94
+ cloud?.state === 'following'
95
+ ? cloud.steps.map((step) => [step.id, step.status])
96
+ : [],
97
+ )
98
+ return CLOUD_STEPS.map((step) => {
99
+ const state = reported.get(step.id)
100
+ return state === undefined
101
+ ? { ...step, state: 'todo', detail: waitingDetail(job, cloud) }
102
+ : { ...step, state, detail: CLOUD_DETAILS[state] }
103
+ })
104
+ }
105
+
106
+ /** The publish dialog's title and description. */
107
+ export interface PublishHeading {
108
+ title: string
109
+ description: string
110
+ }
111
+
112
+ /**
113
+ * The publish dialog's heading: the git steps' while they run or after they
114
+ * failed; once pushed, `Publishing` while the Cloud deployment is followed,
115
+ * then whether it went live or failed; `published` when it is not followed.
116
+ */
117
+ export function publishHeading(
118
+ job: PublishJob,
119
+ cloud: PublishSteps | null,
120
+ isFollowing: boolean,
121
+ ): PublishHeading {
122
+ const target = environmentLabel(job.environment)
123
+ const version = `v${job.version.number}`
124
+ if (job.status === 'running')
125
+ return {
126
+ title: 'Publishing',
127
+ description: `${job.version.name} → ${target}`,
128
+ }
129
+ if (job.status === 'failed') {
130
+ const failed = job.steps.find(({ id }) => id === job.failure?.step)
131
+ return {
132
+ title: 'Publish failed',
133
+ description: failed ? `${failed.title} failed` : '',
134
+ }
135
+ }
136
+ const tagged = `Tagged ${job.version.tag}`
137
+ if (cloud?.state === 'following' && cloud.outcome === 'live')
138
+ return { title: `${version} is live on ${target}`, description: tagged }
139
+ if (cloud?.state === 'following' && cloud.outcome === 'failed')
140
+ return { title: `${version} failed on ${target}`, description: tagged }
141
+ if (isFollowing)
142
+ return { title: 'Publishing', description: `${version} → ${target}` }
143
+ return { title: `${version} is published to ${target}`, description: tagged }
144
+ }
145
+
146
+ /** Whether the answer says only that AntelopeJS Cloud did not answer the DMS: a failed read, not news about the deployment. */
147
+ export function isCloudUnread(cloud: PublishSteps): boolean {
148
+ return cloud.state === 'unavailable' && cloud.reason === 'unreachable'
149
+ }
150
+
151
+ /** Whether nothing more comes of a publish's Cloud steps: it went live, failed, or cannot be followed. */
152
+ export function isCloudSettled(cloud: PublishSteps): boolean {
153
+ if (cloud.state === 'unavailable') return !isCloudUnread(cloud)
154
+ return cloud.state === 'following' && cloud.outcome !== 'running'
155
+ }
156
+
157
+ /** Refusals of the summary route that leave the chip without anything to say. */
158
+ const UNUSABLE_REPOSITORY_CODES: ReadonlySet<string> = new Set([
159
+ 'not_a_repository',
160
+ 'no_origin',
161
+ 'detached_head',
162
+ 'on_environment_branch',
163
+ ])
164
+
165
+ /** Answers that mean the signed-in user may not see Publishing. */
166
+ export const HIDING_STATUSES: ReadonlySet<number> = new Set([401, 403, 404])
167
+
168
+ /** `preview` → `Preview`. */
169
+ export function environmentLabel(name: string): string {
170
+ return name.charAt(0).toUpperCase() + name.slice(1)
171
+ }
172
+
173
+ /** The version label of an environment's row: `v15 → v16`, or `new branch`. */
174
+ export function environmentRoute(
175
+ env: PublishEnvironment,
176
+ nextNumber: number,
177
+ ): string {
178
+ if (env.commit === null) return `new branch → v${nextNumber}`
179
+ const current = env.version === null ? 'unversioned' : `v${env.version}`
180
+ return `${current} → v${nextNumber}`
181
+ }
182
+
183
+ /** What the navbar chip draws for the latest summary. */
184
+ export function chipState(summary: ChangesSummary): ChipState {
185
+ if (summary.job?.status === 'running') return 'publishing'
186
+ if (summary.job?.status === 'failed') return 'failed'
187
+ return summary.files.length > 0 ? 'pending' : 'published'
188
+ }
189
+
190
+ /** Whether the chip has nothing to show: the repository cannot be published from, and no job exists. */
191
+ export function isRepositoryUnusable(summary: ChangesSummary): boolean {
192
+ if (summary.job !== null) return false
193
+ return (
194
+ !summary.ready &&
195
+ summary.refusal !== null &&
196
+ UNUSABLE_REPOSITORY_CODES.has(summary.refusal.code)
197
+ )
198
+ }
199
+
200
+ /** The step whose log the log box shows: the running one, else the last that ran. */
201
+ export function logStep(job: PublishJob): PublishStep | undefined {
202
+ const running = job.steps.find((step) => step.state === 'running')
203
+ if (running) return running
204
+ return job.steps.filter((step) => step.state !== 'todo').at(-1)
205
+ }
206
+
207
+ /** Whether the version exists in the local repository, whatever happened to origin. */
208
+ export function isSavedLocally(job: PublishJob): boolean {
209
+ return job.steps.some(
210
+ (step) =>
211
+ (step.id === 'commit' || step.id === 'tag') && step.state === 'done',
212
+ )
213
+ }
214
+
215
+ /** The refs origin holds after a failed push. */
216
+ export function reachedRefs(job: PublishJob): string[] {
217
+ return (job.failure?.origin ?? [])
218
+ .filter((ref) => ref.reached)
219
+ .map((ref) => ref.ref)
220
+ }
221
+
222
+ /** What the Changes page and the publish panel say about a version origin lacks. */
223
+ export interface PendingNotice {
224
+ title: string
225
+ description: string
226
+ }
227
+
228
+ /** Whether the next publish pushes the version origin lacks again, as it was made. */
229
+ export function isRetry(summary: ChangesSummary): boolean {
230
+ return summary.pending?.number === summary.nextVersion.number
231
+ }
232
+
233
+ /**
234
+ * The notice of a version saved locally that origin lacks, such as the one a
235
+ * refused push leaves, or `null` when there is none or a publish runs.
236
+ */
237
+ export function pendingNotice(summary: ChangesSummary): PendingNotice | null {
238
+ const { pending, nextVersion, job } = summary
239
+ if (pending === null || job?.status === 'running') return null
240
+ return {
241
+ title: `${pending.tag} is saved locally and has not reached origin`,
242
+ description: isRetry(summary)
243
+ ? 'Publish again to push it.'
244
+ : `Your branch moved on since, so the next publish makes ${nextVersion.tag} and leaves ${pending.tag} local.`,
245
+ }
246
+ }
247
+
248
+ /** The alert title of a failed publish. */
249
+ export function failureTitle(job: PublishJob): string {
250
+ return reachedRefs(job).length === 0
251
+ ? 'Nothing reached origin'
252
+ : 'Part of the version reached origin'
253
+ }
254
+
255
+ /** The HTTP status a failed request carries, as ofetch and fetch report it. */
256
+ export function errorStatus(error: unknown): number | undefined {
257
+ if (typeof error !== 'object' || error === null) return undefined
258
+ for (const key of ['statusCode', 'status']) {
259
+ const value = Reflect.get(error, key)
260
+ if (typeof value === 'number') return value
261
+ }
262
+ return undefined
263
+ }
264
+
265
+ function isRefusal(value: unknown): value is Refusal {
266
+ return (
267
+ typeof value === 'object' &&
268
+ value !== null &&
269
+ 'code' in value &&
270
+ 'message' in value &&
271
+ typeof value.code === 'string' &&
272
+ typeof value.message === 'string'
273
+ )
274
+ }
275
+
276
+ /** The refusal a 400 or 409 answer carries in its body, if it has one. */
277
+ export function refusalOf(error: unknown): Refusal | undefined {
278
+ if (typeof error !== 'object' || error === null) return undefined
279
+ const body: unknown = Reflect.get(error, 'data')
280
+ if (typeof body !== 'object' || body === null || !('refusal' in body))
281
+ return undefined
282
+ return isRefusal(body.refusal) ? body.refusal : undefined
283
+ }
284
+
285
+ /** How the "What's live" widget reads the routes it polls. */
286
+ export const LIVE_POLL_MS = 15_000
287
+
288
+ /** The badge of an environment's state in the "What's live" widget. */
289
+ export const LIVE_BADGES: Record<
290
+ EnvironmentLive['state'],
291
+ { label: string; color: 'success' | 'info' | 'neutral' | 'error' | 'warning' }
292
+ > = {
293
+ live: { label: 'Live', color: 'success' },
294
+ building: { label: 'Building', color: 'info' },
295
+ sleeping: { label: 'Sleeping', color: 'neutral' },
296
+ failed: { label: 'Failed', color: 'error' },
297
+ waiting: { label: 'Waiting', color: 'warning' },
298
+ unknown: { label: 'Unknown', color: 'neutral' },
299
+ }
@@ -0,0 +1,27 @@
1
+ import { type Component, defineAsyncComponent } from 'vue'
2
+ import type { DmsFrontendModule } from '#dms/frontend-module'
3
+ import publishChip from './app/plugins/publish-chip.client'
4
+
5
+ interface VueModule {
6
+ default: Component
7
+ }
8
+
9
+ const components = import.meta.glob<VueModule>('./app/components/**/*.vue')
10
+
11
+ export default {
12
+ componentPrefix: 'AntelopeCloud',
13
+ setup(sdk) {
14
+ for (const [path, load] of Object.entries(components).sort()) {
15
+ const name = path
16
+ .split('/')
17
+ .at(-1)
18
+ ?.replace(/\.vue$/, '')
19
+ if (name === undefined) continue
20
+ sdk.registerComponent(
21
+ name,
22
+ defineAsyncComponent(async () => (await load()).default),
23
+ )
24
+ }
25
+ sdk.registerPlugin(publishChip, { clientOnly: true })
26
+ },
27
+ } satisfies DmsFrontendModule
@@ -0,0 +1,110 @@
1
+ {
2
+ "dms_antelope_cloud": {
3
+ "errors": {
4
+ "already_connected": "This workspace is already signed in to AntelopeJS Cloud.",
5
+ "already_serving": "The next environment already serves this version, so there is nothing to promote.",
6
+ "app_address_taken": "Another service already holds the address this app would get. Rename one of them in AntelopeJS Cloud, then try again.",
7
+ "app_needs_port": "AntelopeJS Cloud has no port for this app yet, so it cannot give it an address. Try again in a moment.",
8
+ "app_not_single": "This environment runs no app service, or several, so this DMS cannot tell which one the internet should reach. Open the right one in AntelopeJS Cloud.",
9
+ "app_port_out_of_range": "AntelopeJS Cloud runs apps on ports 1024 to 65535. Change the API's port in antelope.config.ts, then try again.",
10
+ "app_port_refused": "AntelopeJS Cloud refused the app's port: it runs apps on ports 1024 to 65535. Change the API's port in antelope.config.ts.",
11
+ "app_port_unknown": "antelope.config.ts gives the API module no http server with a port, so this DMS cannot tell which port the app answers on. Add one, then try again.",
12
+ "branch_of_another_environment": "The next environment tracks the env/ branch of another environment, and a promotion pushes only the branch named after the environment it goes to. Point it at its own env/ branch to promote to it.",
13
+ "cloud_forbidden": "Your AntelopeJS Cloud access does not allow this.",
14
+ "cloud_refused": "AntelopeJS Cloud refused this change.",
15
+ "cloud_unreachable": "AntelopeJS Cloud did not answer. Try again in a moment.",
16
+ "commit_not_found": "The repository no longer has this commit, so AntelopeJS Cloud cannot build it.",
17
+ "commit_not_local": "The repository this DMS publishes does not have the commit to promote. Fetch origin, then promote again.",
18
+ "dashboard_address_taken": "Another service already holds the address this dashboard would get. Rename one of them in AntelopeJS Cloud, then try again.",
19
+ "dashboard_dockerfile_missing": "The repository has no frontend.Dockerfile at its root, so there is no dashboard to build. Add the one of the DMS starter, then try again.",
20
+ "dashboard_name_taken": "This environment already has a service named dashboard that AntelopeJS Cloud does not build with frontend.Dockerfile. Rename it, or name its Dockerfile in AntelopeJS Cloud, then try again.",
21
+ "dashboard_needs_port": "AntelopeJS Cloud has no port for this dashboard yet, so it cannot give it an address. Try again in a moment.",
22
+ "dashboard_port_out_of_range": "frontend.Dockerfile exposes a port AntelopeJS Cloud runs no service on: it runs services on ports 1024 to 65535. Change its EXPOSE, then try again.",
23
+ "dashboard_port_refused": "AntelopeJS Cloud refused the dashboard's port: it runs services on ports 1024 to 65535. Change the EXPOSE of frontend.Dockerfile.",
24
+ "dashboard_repository_not_visible": "AntelopeJS Cloud can't see this repository yet, so it cannot build the dashboard from it: install the AntelopeJS Cloud GitHub App on it, then try again.",
25
+ "dashboard_service_limit": "The plan of the workspace includes no more services in this environment, so the dashboard was not created.",
26
+ "deployment_not_found": "This project ran no such deployment.",
27
+ "environment_limit": "Your plan includes no more environments. Free runs Production only; Hobby adds Staging.",
28
+ "environment_name_required": "Name the environment.",
29
+ "environment_name_taken": "This project already has an environment with that name.",
30
+ "environment_protected": "This environment is protected: AntelopeJS Cloud refuses to delete it.",
31
+ "environment_required": "Choose an environment.",
32
+ "invalid_branch": "That is not a branch name git accepts.",
33
+ "invalid_environment_name": "Name the environment with letters, digits and dashes.",
34
+ "invalid_project_slug": "Name the project with lowercase letters, digits and dashes.",
35
+ "invalid_promotion": "AntelopeJS Cloud could not read this promotion.",
36
+ "invalid_stages": "Tick the environments to add beside Production.",
37
+ "invalid_variable": "Give the variable a name of letters, digits and underscores, a service and a value.",
38
+ "managed_connection": "AntelopeJS Cloud manages this connection: it is set by the development environment, so it cannot be changed here.",
39
+ "no_github_remote": "This project has no GitHub remote. Add one as origin, then apply the plan again.",
40
+ "no_next_stage": "This environment is the last stage of the pipeline: nothing comes after it.",
41
+ "no_origin": "The repository this DMS publishes has no origin that answers, so the promotion cannot move the next environment's branch.",
42
+ "no_project": "This DMS has no AntelopeJS Cloud project yet. Choose one, or create one in the first-run setup.",
43
+ "no_repository": "This project builds from no repository, so AntelopeJS Cloud has nothing to build the commit from. Apply the first-run setup to link it.",
44
+ "no_target_services": "No service of the next environment builds from the project's repository, so the promotion has nothing to deploy.",
45
+ "not_a_repository": "The folder this DMS publishes is not the root of a git repository, so the promotion cannot move the next environment's branch.",
46
+ "not_an_environment_branch": "The next environment tracks a branch that is not an env/ branch, and publishing moves only env/ branches. Point it at its env/ branch to promote to it.",
47
+ "not_connected": "This workspace is not signed in to AntelopeJS Cloud.",
48
+ "nothing_to_decide": "AntelopeJS Cloud has nothing left to set on this environment: every value it can decide is set.",
49
+ "nothing_to_promote": "This environment serves no version built from a commit, so there is nothing to promote.",
50
+ "plan_changed": "The plan changed while it was applied. Apply it again.",
51
+ "preview_read_only": "A pull-request preview mirrors its environment: AntelopeJS Cloud does not change it on its own.",
52
+ "project_creation_in_progress": "AntelopeJS Cloud is still creating this project. Apply the plan again in a moment.",
53
+ "project_limit": "Your plan includes no more projects.",
54
+ "project_name_required": "Name the project.",
55
+ "project_published": "This DMS already publishes a project: disconnect it on the Connection page first.",
56
+ "project_required": "Choose a project.",
57
+ "project_slug_taken": "This workspace already has a project with that name: link it instead, or choose another name.",
58
+ "publish_parameters_missing": "Name the environment and the commit of the publish.",
59
+ "publish_running": "A publish is running. Wait for it to finish, then promote again.",
60
+ "push_refused": "Origin refused to move the next environment's branch: it moved since this server read it, or this server cannot push there. Promote again.",
61
+ "repository_not_visible": "AntelopeJS Cloud can't see this repository yet: install the AntelopeJS Cloud GitHub App on it, then apply the plan again.",
62
+ "resources": {
63
+ "apply_in_progress": "AntelopeJS Cloud is already applying resources to this environment. Try again in a moment.",
64
+ "connect_failed": "The databases run, but AntelopeJS Cloud refused a variable that connects the app to one of them. Connect it again from the Resources page.",
65
+ "over_database_limit": "This environment would pass the database limit of its plan. Remove a database or upgrade the plan.",
66
+ "over_service_limit": "This environment would pass the service limit of its plan. Remove a service or upgrade the plan.",
67
+ "preview_environment": "A preview environment cannot run databases on the Free plan. Upgrade the plan or apply to another environment.",
68
+ "unknown_environment": "AntelopeJS Cloud has no such environment in this project."
69
+ },
70
+ "rollback_in_progress": "A newer deployment is still rolling out on this environment. Wait until it ends.",
71
+ "rollback_missing_revision": "A service of this environment has no revision of this deployment to go back to.",
72
+ "rollback_not_found": "This project ran no such deployment.",
73
+ "rollback_partial": "Some services went back and others did not. Roll back again to finish.",
74
+ "rollback_serving": "This environment already runs this deployment.",
75
+ "service_not_found": "This project runs no such service.",
76
+ "shared_environment_branch": "Another environment of this project tracks the next environment's branch too, so the push would deploy it as well. Point each environment at its own env/ branch to promote to it.",
77
+ "sign_in_revoked": "AntelopeJS Cloud refused the stored sign-in. Sign in again.",
78
+ "unknown_environment": "AntelopeJS Cloud has no such environment in this project.",
79
+ "unknown_project": "AntelopeJS Cloud has no such project in this workspace.",
80
+ "unknown_region": "AntelopeJS Cloud does not run projects in that region.",
81
+ "unknown_variable": "AntelopeJS Cloud has no such variable on this project any more.",
82
+ "variable_exists": "This service already holds a variable with this name.",
83
+ "variable_refused": "AntelopeJS Cloud refused this change to the variable.",
84
+ "version_not_found": "This repository has published no such version."
85
+ },
86
+ "changed_files": {
87
+ "name": "Changed files",
88
+ "description": "The files of the working copy that the last published version does not have, grouped as added, modified and deleted, with their line counts."
89
+ },
90
+ "publish_form": {
91
+ "name": "Publish form",
92
+ "description": "Publishes the working copy as a version: a commit message, an optional version name and release notes, and the environment to deploy to. It shows each step of the publish live."
93
+ },
94
+ "log_viewer": {
95
+ "name": "Log viewer",
96
+ "description": "The lines an environment's app prints, streamed live from AntelopeJS Cloud, with a search and a level filter."
97
+ },
98
+ "build_log": {
99
+ "name": "Build log",
100
+ "description": "The end of the log of a deployment's failed build, read from AntelopeJS Cloud when the page's address asks for it."
101
+ },
102
+ "environments": {
103
+ "deployed": "Deployed {when}"
104
+ },
105
+ "dashboard_environments": {
106
+ "name": "What's live",
107
+ "description": "Each environment of the AntelopeJS Cloud project with the version it serves, its state and its address, read again every 15 seconds."
108
+ }
109
+ }
110
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@antelopejs/dms-antelope-cloud-frontend-vue",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "type": "module",
6
+ "main": "./dms.frontend.ts",
7
+ "packageManager": "pnpm@10.34.9",
8
+ "engines": {
9
+ "@antelopejs/dms-frontend": ">=0.11.11 <0.12.0"
10
+ },
11
+ "scripts": {
12
+ "dev": "pnpm --dir .. frontend:dev",
13
+ "build": "pnpm --dir .. frontend:build",
14
+ "format": "prettier --write .",
15
+ "lint": "eslint . && prettier --check .",
16
+ "test": "vitest run"
17
+ },
18
+ "dependencies": {
19
+ "vue": "^3.5.18"
20
+ },
21
+ "devDependencies": {
22
+ "@vitejs/plugin-vue": "^6.0.0",
23
+ "@vue/test-utils": "^2.5.1",
24
+ "eslint": "^9.0.0",
25
+ "eslint-plugin-vue": "^10.0.0",
26
+ "jsdom": "^26",
27
+ "prettier": "^3.5.3",
28
+ "prettier-plugin-tailwindcss": "^0.8.0",
29
+ "typescript": "^5.9.3",
30
+ "typescript-eslint": "^8.0.0",
31
+ "vitest": "^3.2.4"
32
+ },
33
+ "pnpm": {
34
+ "overrides": {
35
+ "vite@>=8": ">=8.3.4 <8.4.0"
36
+ }
37
+ }
38
+ }