@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,214 @@
|
|
|
1
|
+
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
/** The stages the first-run setup may add beside Production, in pipeline order. */
|
|
4
|
+
export declare const EXTRA_STAGES: readonly ["preview", "staging"];
|
|
5
|
+
/** A stage the first-run setup may add beside Production. */
|
|
6
|
+
export type ExtraStage = (typeof EXTRA_STAGES)[number];
|
|
7
|
+
declare const projectDraftSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
8
|
+
kind: z.ZodLiteral<"new">;
|
|
9
|
+
slug: z.ZodString;
|
|
10
|
+
region: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
kind: "new";
|
|
13
|
+
slug: string;
|
|
14
|
+
region: string;
|
|
15
|
+
}, {
|
|
16
|
+
kind: "new";
|
|
17
|
+
slug: string;
|
|
18
|
+
region: string;
|
|
19
|
+
}>, z.ZodObject<{
|
|
20
|
+
kind: z.ZodLiteral<"existing">;
|
|
21
|
+
projectId: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
kind: "existing";
|
|
24
|
+
projectId: string;
|
|
25
|
+
}, {
|
|
26
|
+
kind: "existing";
|
|
27
|
+
projectId: string;
|
|
28
|
+
}>]>;
|
|
29
|
+
/**
|
|
30
|
+
* The project the first-run setup puts online: one to create with its slug
|
|
31
|
+
* and region, or one the workspace has.
|
|
32
|
+
*/
|
|
33
|
+
export type ProjectDraft = z.infer<typeof projectDraftSchema>;
|
|
34
|
+
/** The plan to publish the project the workspace has, whose id is `projectId`. */
|
|
35
|
+
export declare function existingDraft(projectId: string): ProjectDraft;
|
|
36
|
+
/** A planned project that the first apply creates. */
|
|
37
|
+
export type NewProjectDraft = Extract<ProjectDraft, {
|
|
38
|
+
kind: "new";
|
|
39
|
+
}>;
|
|
40
|
+
declare const appliedSchema: z.ZodObject<{
|
|
41
|
+
at: z.ZodDate;
|
|
42
|
+
projectId: z.ZodString;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
projectId: string;
|
|
45
|
+
at: Date;
|
|
46
|
+
}, {
|
|
47
|
+
projectId: string;
|
|
48
|
+
at: Date;
|
|
49
|
+
}>;
|
|
50
|
+
/** When the plan was last applied, and the project it put online. */
|
|
51
|
+
export type Applied = z.infer<typeof appliedSchema>;
|
|
52
|
+
declare const setupSchema: z.ZodObject<{
|
|
53
|
+
_id: z.ZodString;
|
|
54
|
+
project: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
55
|
+
kind: z.ZodLiteral<"new">;
|
|
56
|
+
slug: z.ZodString;
|
|
57
|
+
region: z.ZodString;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
kind: "new";
|
|
60
|
+
slug: string;
|
|
61
|
+
region: string;
|
|
62
|
+
}, {
|
|
63
|
+
kind: "new";
|
|
64
|
+
slug: string;
|
|
65
|
+
region: string;
|
|
66
|
+
}>, z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"existing">;
|
|
68
|
+
projectId: z.ZodString;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
kind: "existing";
|
|
71
|
+
projectId: string;
|
|
72
|
+
}, {
|
|
73
|
+
kind: "existing";
|
|
74
|
+
projectId: string;
|
|
75
|
+
}>]>;
|
|
76
|
+
environments: z.ZodDefault<z.ZodArray<z.ZodEnum<["preview", "staging"]>, "many">>;
|
|
77
|
+
applied: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
78
|
+
at: z.ZodDate;
|
|
79
|
+
projectId: z.ZodString;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
projectId: string;
|
|
82
|
+
at: Date;
|
|
83
|
+
}, {
|
|
84
|
+
projectId: string;
|
|
85
|
+
at: Date;
|
|
86
|
+
}>>>;
|
|
87
|
+
notOnPlan: z.ZodArray<z.ZodEnum<["preview", "staging"]>, "many">;
|
|
88
|
+
creationKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
89
|
+
repositoryNotVisible: z.ZodDefault<z.ZodBoolean>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
environments: ("preview" | "staging")[];
|
|
92
|
+
applied: {
|
|
93
|
+
projectId: string;
|
|
94
|
+
at: Date;
|
|
95
|
+
} | null;
|
|
96
|
+
_id: string;
|
|
97
|
+
project: {
|
|
98
|
+
kind: "new";
|
|
99
|
+
slug: string;
|
|
100
|
+
region: string;
|
|
101
|
+
} | {
|
|
102
|
+
kind: "existing";
|
|
103
|
+
projectId: string;
|
|
104
|
+
};
|
|
105
|
+
notOnPlan: ("preview" | "staging")[];
|
|
106
|
+
creationKey: string | null;
|
|
107
|
+
repositoryNotVisible: boolean;
|
|
108
|
+
}, {
|
|
109
|
+
_id: string;
|
|
110
|
+
project: {
|
|
111
|
+
kind: "new";
|
|
112
|
+
slug: string;
|
|
113
|
+
region: string;
|
|
114
|
+
} | {
|
|
115
|
+
kind: "existing";
|
|
116
|
+
projectId: string;
|
|
117
|
+
};
|
|
118
|
+
notOnPlan: ("preview" | "staging")[];
|
|
119
|
+
environments?: ("preview" | "staging")[] | undefined;
|
|
120
|
+
applied?: {
|
|
121
|
+
projectId: string;
|
|
122
|
+
at: Date;
|
|
123
|
+
} | null | undefined;
|
|
124
|
+
creationKey?: string | null | undefined;
|
|
125
|
+
repositoryNotVisible?: boolean | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* The first-run setup of one DMS workspace (tenant), whose id is `_id`:
|
|
129
|
+
* what the owner chose, nothing of which exists on AntelopeJS Cloud before the
|
|
130
|
+
* plan is applied. `applied` is `null` until then. `notOnPlan` lists the
|
|
131
|
+
* chosen stages the plan refused at the last apply. `creationKey` is the
|
|
132
|
+
* `Idempotency-Key` every run of apply sends to create the planned new
|
|
133
|
+
* project, `null` until the first run asks for it and again once the plan or
|
|
134
|
+
* the published project changes. `repositoryNotVisible` says the last apply
|
|
135
|
+
* stopped because AntelopeJS Cloud cannot see the repository, until an apply
|
|
136
|
+
* gets past it or the project changes.
|
|
137
|
+
*/
|
|
138
|
+
export type StoredSetup = z.infer<typeof setupSchema>;
|
|
139
|
+
declare class SetupRow extends Table {
|
|
140
|
+
project: {
|
|
141
|
+
kind: ProjectDraft["kind"];
|
|
142
|
+
slug?: string;
|
|
143
|
+
region?: string;
|
|
144
|
+
projectId?: string;
|
|
145
|
+
};
|
|
146
|
+
environments: ExtraStage[];
|
|
147
|
+
applied: Applied | null;
|
|
148
|
+
notOnPlan: ExtraStage[];
|
|
149
|
+
creationKey: string | null;
|
|
150
|
+
repositoryNotVisible: boolean;
|
|
151
|
+
}
|
|
152
|
+
declare const SetupModel_base: {
|
|
153
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
154
|
+
readonly table: import("@antelopejs/interface-database").Table<SetupRow>;
|
|
155
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
156
|
+
get(id: string): Promise<SetupRow | undefined>;
|
|
157
|
+
getBy(index: keyof SetupRow, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): Promise<SetupRow[]>;
|
|
158
|
+
getAll(): Promise<SetupRow[]>;
|
|
159
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<SetupRow> | import("@antelopejs/interface-database-decorators").DeepPartial<SetupRow>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
160
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<SetupRow>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
161
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<SetupRow> & {
|
|
162
|
+
_id: string;
|
|
163
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
164
|
+
delete(id: string): Promise<number>;
|
|
165
|
+
};
|
|
166
|
+
readonly schemaName: string | undefined;
|
|
167
|
+
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<SetupRow>;
|
|
168
|
+
fromPlainData(obj: SetupRow | import("@antelopejs/interface-database-decorators").PlainData<SetupRow>): SetupRow;
|
|
169
|
+
fromDatabase(obj: any): SetupRow | undefined;
|
|
170
|
+
toDatabase(obj: SetupRow | import("@antelopejs/interface-database-decorators").PlainData<SetupRow>): import("@antelopejs/interface-database-decorators").StoredRow<SetupRow>;
|
|
171
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
172
|
+
};
|
|
173
|
+
/** Reads and writes the first-run setup of each tenant. */
|
|
174
|
+
export declare class SetupModel extends SetupModel_base {
|
|
175
|
+
/** The tenant's setup, or `undefined` when it chose nothing yet. */
|
|
176
|
+
read(tenantId: string): Promise<StoredSetup | undefined>;
|
|
177
|
+
/**
|
|
178
|
+
* Stores the project the setup puts online, keeping the stages chosen. The
|
|
179
|
+
* plan changes with it, so it reads as not applied, and no apply has asked
|
|
180
|
+
* for its project yet.
|
|
181
|
+
*/
|
|
182
|
+
chooseProject(tenantId: string, project: ProjectDraft): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* The `Idempotency-Key` that creates the new project the plan names: the
|
|
185
|
+
* first run of apply stores a fresh one, and every later run reads the same,
|
|
186
|
+
* so AntelopeJS Cloud answers them all with the one project it created.
|
|
187
|
+
*
|
|
188
|
+
* @returns The key, or `undefined` once the plan names another project.
|
|
189
|
+
*/
|
|
190
|
+
creationKey(tenantId: string, { slug, region }: NewProjectDraft): Promise<string | undefined>;
|
|
191
|
+
/**
|
|
192
|
+
* Forgets the plan's creation key once the connection publishes a project
|
|
193
|
+
* or stops publishing one: a later run of apply asks for a new project.
|
|
194
|
+
*/
|
|
195
|
+
clearCreation(tenantId: string): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* Stores the stages the setup adds beside Production, in pipeline order.
|
|
198
|
+
* The plan changes with them, so it reads as not applied.
|
|
199
|
+
*
|
|
200
|
+
* @returns Whether they were stored: `false` while no project is chosen.
|
|
201
|
+
*/
|
|
202
|
+
chooseEnvironments(tenantId: string, environments: readonly ExtraStage[]): Promise<boolean>;
|
|
203
|
+
/** Records the plan as applied, to which project, and the stages it refused. */
|
|
204
|
+
markApplied(tenantId: string, applied: Applied, notOnPlan: readonly ExtraStage[]): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Records whether the last apply stopped because AntelopeJS Cloud cannot
|
|
207
|
+
* see the repository, so the page keeps saying what to do once the answer
|
|
208
|
+
* of that apply is gone from the screen.
|
|
209
|
+
*/
|
|
210
|
+
markRepositoryNotVisible(tenantId: string, repositoryNotVisible: boolean): Promise<void>;
|
|
211
|
+
}
|
|
212
|
+
/** The setup model of the module's schema. */
|
|
213
|
+
export declare function setups(): SetupModel;
|
|
214
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
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.SetupModel = exports.EXTRA_STAGES = void 0;
|
|
13
|
+
exports.existingDraft = existingDraft;
|
|
14
|
+
exports.setups = setups;
|
|
15
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
|
+
const zod_1 = require("zod");
|
|
18
|
+
const store_1 = require("../connection/store");
|
|
19
|
+
const SETUPS_TABLE = "setups";
|
|
20
|
+
/** The stages the first-run setup may add beside Production, in pipeline order. */
|
|
21
|
+
exports.EXTRA_STAGES = ["preview", "staging"];
|
|
22
|
+
const extraStageSchema = zod_1.z.enum(exports.EXTRA_STAGES);
|
|
23
|
+
const projectDraftSchema = zod_1.z.discriminatedUnion("kind", [
|
|
24
|
+
zod_1.z.object({ kind: zod_1.z.literal("new"), slug: zod_1.z.string(), region: zod_1.z.string() }),
|
|
25
|
+
zod_1.z.object({ kind: zod_1.z.literal("existing"), projectId: zod_1.z.string() }),
|
|
26
|
+
]);
|
|
27
|
+
/** The plan to publish the project the workspace has, whose id is `projectId`. */
|
|
28
|
+
function existingDraft(projectId) {
|
|
29
|
+
return { kind: "existing", projectId };
|
|
30
|
+
}
|
|
31
|
+
const appliedSchema = zod_1.z.object({ at: zod_1.z.date(), projectId: zod_1.z.string() });
|
|
32
|
+
const setupSchema = zod_1.z.object({
|
|
33
|
+
_id: zod_1.z.string(),
|
|
34
|
+
project: projectDraftSchema,
|
|
35
|
+
environments: zod_1.z.array(extraStageSchema).default([]),
|
|
36
|
+
applied: appliedSchema.nullable().default(null),
|
|
37
|
+
notOnPlan: zod_1.z.array(extraStageSchema),
|
|
38
|
+
creationKey: zod_1.z.string().nullable().default(null),
|
|
39
|
+
repositoryNotVisible: zod_1.z.boolean().default(false),
|
|
40
|
+
});
|
|
41
|
+
let SetupRow = class SetupRow extends interface_database_decorators_1.Table {
|
|
42
|
+
};
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, interface_database_decorators_1.Field)({
|
|
45
|
+
kind: "string",
|
|
46
|
+
slug: "string",
|
|
47
|
+
region: "string",
|
|
48
|
+
projectId: "string",
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], SetupRow.prototype, "project", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, interface_database_decorators_1.Field)(["string"]),
|
|
54
|
+
__metadata("design:type", Array)
|
|
55
|
+
], SetupRow.prototype, "environments", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, interface_database_decorators_1.Field)({ at: "date", projectId: "string" }),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], SetupRow.prototype, "applied", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, interface_database_decorators_1.Field)(["string"]),
|
|
62
|
+
__metadata("design:type", Array)
|
|
63
|
+
], SetupRow.prototype, "notOnPlan", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], SetupRow.prototype, "creationKey", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, interface_database_decorators_1.Field)("boolean"),
|
|
70
|
+
__metadata("design:type", Boolean)
|
|
71
|
+
], SetupRow.prototype, "repositoryNotVisible", void 0);
|
|
72
|
+
SetupRow = __decorate([
|
|
73
|
+
(0, interface_database_decorators_1.RegisterTable)(SETUPS_TABLE, store_1.SCHEMA_NAME)
|
|
74
|
+
], SetupRow);
|
|
75
|
+
/** Reads and writes the first-run setup of each tenant. */
|
|
76
|
+
class SetupModel extends (0, interface_database_decorators_1.BasicDataModel)(SetupRow, SETUPS_TABLE) {
|
|
77
|
+
/** The tenant's setup, or `undefined` when it chose nothing yet. */
|
|
78
|
+
async read(tenantId) {
|
|
79
|
+
const row = await this.table.get(tenantId).run();
|
|
80
|
+
return row ? setupSchema.parse(row) : undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Stores the project the setup puts online, keeping the stages chosen. The
|
|
84
|
+
* plan changes with it, so it reads as not applied, and no apply has asked
|
|
85
|
+
* for its project yet.
|
|
86
|
+
*/
|
|
87
|
+
async chooseProject(tenantId, project) {
|
|
88
|
+
await this.table
|
|
89
|
+
.insert({
|
|
90
|
+
_id: tenantId,
|
|
91
|
+
project,
|
|
92
|
+
applied: null,
|
|
93
|
+
notOnPlan: [],
|
|
94
|
+
creationKey: null,
|
|
95
|
+
repositoryNotVisible: false,
|
|
96
|
+
}, { conflict: "update" })
|
|
97
|
+
.run();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The `Idempotency-Key` that creates the new project the plan names: the
|
|
101
|
+
* first run of apply stores a fresh one, and every later run reads the same,
|
|
102
|
+
* so AntelopeJS Cloud answers them all with the one project it created.
|
|
103
|
+
*
|
|
104
|
+
* @returns The key, or `undefined` once the plan names another project.
|
|
105
|
+
*/
|
|
106
|
+
async creationKey(tenantId, { slug, region }) {
|
|
107
|
+
await this.table
|
|
108
|
+
.filter((row) => row
|
|
109
|
+
.key("_id")
|
|
110
|
+
.eq(tenantId)
|
|
111
|
+
.and(row.key("project").key("kind").eq("new"))
|
|
112
|
+
.and(row.key("project").key("slug").eq(slug))
|
|
113
|
+
.and(row.key("project").key("region").eq(region))
|
|
114
|
+
.and(row.key("creationKey").default(null).eq(null)))
|
|
115
|
+
.update({ creationKey: (0, node_crypto_1.randomUUID)() })
|
|
116
|
+
.run();
|
|
117
|
+
const stored = await this.read(tenantId);
|
|
118
|
+
return stored?.project.kind === "new" &&
|
|
119
|
+
stored.project.slug === slug &&
|
|
120
|
+
stored.project.region === region
|
|
121
|
+
? (stored.creationKey ?? undefined)
|
|
122
|
+
: undefined;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Forgets the plan's creation key once the connection publishes a project
|
|
126
|
+
* or stops publishing one: a later run of apply asks for a new project.
|
|
127
|
+
*/
|
|
128
|
+
async clearCreation(tenantId) {
|
|
129
|
+
await this.table
|
|
130
|
+
.filter((row) => row.key("_id").eq(tenantId).and(row.key("creationKey").ne(null)))
|
|
131
|
+
.update({ creationKey: null })
|
|
132
|
+
.run();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Stores the stages the setup adds beside Production, in pipeline order.
|
|
136
|
+
* The plan changes with them, so it reads as not applied.
|
|
137
|
+
*
|
|
138
|
+
* @returns Whether they were stored: `false` while no project is chosen.
|
|
139
|
+
*/
|
|
140
|
+
async chooseEnvironments(tenantId, environments) {
|
|
141
|
+
if (!(await this.read(tenantId)))
|
|
142
|
+
return false;
|
|
143
|
+
await this.table
|
|
144
|
+
.get(tenantId)
|
|
145
|
+
.update({
|
|
146
|
+
environments: exports.EXTRA_STAGES.filter((stage) => environments.includes(stage)),
|
|
147
|
+
applied: null,
|
|
148
|
+
notOnPlan: [],
|
|
149
|
+
})
|
|
150
|
+
.run();
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
/** Records the plan as applied, to which project, and the stages it refused. */
|
|
154
|
+
async markApplied(tenantId, applied, notOnPlan) {
|
|
155
|
+
await this.table
|
|
156
|
+
.get(tenantId)
|
|
157
|
+
.update({ applied, notOnPlan: [...notOnPlan] })
|
|
158
|
+
.run();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Records whether the last apply stopped because AntelopeJS Cloud cannot
|
|
162
|
+
* see the repository, so the page keeps saying what to do once the answer
|
|
163
|
+
* of that apply is gone from the screen.
|
|
164
|
+
*/
|
|
165
|
+
async markRepositoryNotVisible(tenantId, repositoryNotVisible) {
|
|
166
|
+
await this.table.get(tenantId).update({ repositoryNotVisible }).run();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.SetupModel = SetupModel;
|
|
170
|
+
/** The setup model of the module's schema. */
|
|
171
|
+
function setups() {
|
|
172
|
+
return (0, interface_database_decorators_1.GetModel)(SetupModel);
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CloudApi, type EnvironmentDetail } from "@antelopejs/cloud-sdk";
|
|
2
|
+
import { type CloudRefusals } from "../connection/refusals";
|
|
3
|
+
/** The volume the plan gives the app, for the files it keeps on its disk. */
|
|
4
|
+
export declare const FILES_VOLUME: {
|
|
5
|
+
name: string;
|
|
6
|
+
mountPath: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* What giving an environment's app its volume did: it was attached at
|
|
10
|
+
* `mountPath` (`attached`), the app had one there already (`existing`), the
|
|
11
|
+
* workspace's plan or its tier holds no more volume or none that size
|
|
12
|
+
* (`not_on_plan`),
|
|
13
|
+
* or the environment runs no app service or several (`not_one_app`).
|
|
14
|
+
*/
|
|
15
|
+
export type VolumeOutcome = {
|
|
16
|
+
readonly kind: "attached" | "existing";
|
|
17
|
+
readonly mountPath: string;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "not_on_plan" | "not_one_app";
|
|
20
|
+
};
|
|
21
|
+
/** How a page refuses a failed attach of the app's volume. */
|
|
22
|
+
export declare const VOLUME_REFUSALS: CloudRefusals;
|
|
23
|
+
/**
|
|
24
|
+
* Gives an environment's one app a persistent volume for its files, of the
|
|
25
|
+
* smallest size its settings allow, unless it has one. A run after a lost
|
|
26
|
+
* answer finds the volume and reports it.
|
|
27
|
+
*
|
|
28
|
+
* @throws The `CloudApiError` of a read or a write AntelopeJS Cloud refuses,
|
|
29
|
+
* but for a refusal of the plan's volume limits
|
|
30
|
+
*/
|
|
31
|
+
export declare function giveAppVolume(api: CloudApi, projectId: string, environment: EnvironmentDetail): Promise<VolumeOutcome>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VOLUME_REFUSALS = exports.FILES_VOLUME = void 0;
|
|
4
|
+
exports.giveAppVolume = giveAppVolume;
|
|
5
|
+
const cloud_sdk_1 = require("@antelopejs/cloud-sdk");
|
|
6
|
+
const refusals_1 = require("../connection/refusals");
|
|
7
|
+
const roles_1 = require("../environments/roles");
|
|
8
|
+
/** The volume the plan gives the app, for the files it keeps on its disk. */
|
|
9
|
+
exports.FILES_VOLUME = { name: "files", mountPath: "/data/files" };
|
|
10
|
+
/** The refusals of a volume the workspace's plan holds no room for: its limits, and what its tier lets a service hold. */
|
|
11
|
+
const NOT_ON_PLAN = ["cloud.errors.limits.", "cloud.errors.settings.tier."];
|
|
12
|
+
function isNotOnPlan({ code }) {
|
|
13
|
+
return NOT_ON_PLAN.some((prefix) => code.startsWith(prefix));
|
|
14
|
+
}
|
|
15
|
+
/** How a page refuses a failed attach of the app's volume. */
|
|
16
|
+
exports.VOLUME_REFUSALS = {
|
|
17
|
+
missing: (0, refusals_1.unprocessable)("unknown_environment"),
|
|
18
|
+
codes: new Map([
|
|
19
|
+
["cloud.errors.settings.preview_read_only", (0, refusals_1.conflict)("preview_read_only")],
|
|
20
|
+
]),
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Gives an environment's one app a persistent volume for its files, of the
|
|
24
|
+
* smallest size its settings allow, unless it has one. A run after a lost
|
|
25
|
+
* answer finds the volume and reports it.
|
|
26
|
+
*
|
|
27
|
+
* @throws The `CloudApiError` of a read or a write AntelopeJS Cloud refuses,
|
|
28
|
+
* but for a refusal of the plan's volume limits
|
|
29
|
+
*/
|
|
30
|
+
async function giveAppVolume(api, projectId, environment) {
|
|
31
|
+
const serviceId = (0, roles_1.appOf)(await (0, roles_1.serviceRolesOf)(api, projectId, environment));
|
|
32
|
+
if (serviceId === null)
|
|
33
|
+
return { kind: "not_one_app" };
|
|
34
|
+
const { volumes, volumeLimits } = await api.serviceSettings(serviceId);
|
|
35
|
+
const [held] = volumes;
|
|
36
|
+
if (held)
|
|
37
|
+
return { kind: "existing", mountPath: held.mountPath };
|
|
38
|
+
try {
|
|
39
|
+
await api.attachServiceVolume(serviceId, {
|
|
40
|
+
...exports.FILES_VOLUME,
|
|
41
|
+
sizeGb: volumeLimits.minGb,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof cloud_sdk_1.CloudApiError && isNotOnPlan(error)) {
|
|
46
|
+
return { kind: "not_on_plan" };
|
|
47
|
+
}
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
return { kind: "attached", mountPath: exports.FILES_VOLUME.mountPath };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=volume.js.map
|
package/dist/slug.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A name as AntelopeJS Cloud stores it: accents folded, lowercase letters and
|
|
3
|
+
* digits, runs of anything else turned into one dash, none at either end,
|
|
4
|
+
* and no longer than a DNS label. Empty when the name carries no usable
|
|
5
|
+
* character.
|
|
6
|
+
*/
|
|
7
|
+
export declare function slugify(name: string): string;
|
package/dist/slug.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.slugify = slugify;
|
|
4
|
+
const DIACRITICS = /[̀-ͯ]/g;
|
|
5
|
+
const NON_SLUG_CHARACTERS = /[^a-z0-9-]+/g;
|
|
6
|
+
const DASH_RUNS = /-{2,}/g;
|
|
7
|
+
const EDGE_DASHES = /^-+|-+$/g;
|
|
8
|
+
const MAX_DNS_LABEL_LENGTH = 63;
|
|
9
|
+
/**
|
|
10
|
+
* A name as AntelopeJS Cloud stores it: accents folded, lowercase letters and
|
|
11
|
+
* digits, runs of anything else turned into one dash, none at either end,
|
|
12
|
+
* and no longer than a DNS label. Empty when the name carries no usable
|
|
13
|
+
* character.
|
|
14
|
+
*/
|
|
15
|
+
function slugify(name) {
|
|
16
|
+
return name
|
|
17
|
+
.normalize("NFD")
|
|
18
|
+
.replace(DIACRITICS, "")
|
|
19
|
+
.toLowerCase()
|
|
20
|
+
.replace(NON_SLUG_CHARACTERS, "-")
|
|
21
|
+
.replace(DASH_RUNS, "-")
|
|
22
|
+
.replace(EDGE_DASHES, "")
|
|
23
|
+
.slice(0, MAX_DNS_LABEL_LENGTH)
|
|
24
|
+
.replace(EDGE_DASHES, "");
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=slug.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type CloudApi } from "@antelopejs/cloud-sdk";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
/** Why a route of the Variables page refuses a request. */
|
|
4
|
+
export interface Refusal {
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly error: string;
|
|
7
|
+
}
|
|
8
|
+
declare const newVariableSchema: z.ZodObject<{
|
|
9
|
+
serviceId: z.ZodString;
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
value: z.ZodString;
|
|
12
|
+
secret: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
key: string;
|
|
15
|
+
value: string;
|
|
16
|
+
serviceId: string;
|
|
17
|
+
secret?: boolean | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
key: string;
|
|
20
|
+
value: string;
|
|
21
|
+
serviceId: string;
|
|
22
|
+
secret?: boolean | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
declare const valueBodySchema: z.ZodObject<{
|
|
25
|
+
value: z.ZodString;
|
|
26
|
+
serviceId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
secret: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
value: string;
|
|
30
|
+
secret?: boolean | undefined;
|
|
31
|
+
serviceId?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
value: string;
|
|
34
|
+
secret?: boolean | undefined;
|
|
35
|
+
serviceId?: string | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
/** A variable to create on a service, as a secret unless `secret` is `false`. */
|
|
38
|
+
export type NewVariable = z.infer<typeof newVariableSchema>;
|
|
39
|
+
/**
|
|
40
|
+
* What Set value sends: the new value, and for a missing row the service to
|
|
41
|
+
* create it on and whether it is a secret.
|
|
42
|
+
*/
|
|
43
|
+
export type ValueBody = z.infer<typeof valueBodySchema>;
|
|
44
|
+
/** Reads the body of the Add variable dialog, `undefined` when it is not a variable. */
|
|
45
|
+
export declare function parseNewVariable(body: Parameters<typeof newVariableSchema.safeParse>[0]): NewVariable | undefined;
|
|
46
|
+
/** Reads the body of the Set value dialog, `undefined` when it holds no value. */
|
|
47
|
+
export declare function parseValueBody(body: Parameters<typeof valueBodySchema.safeParse>[0]): ValueBody | undefined;
|
|
48
|
+
/** What a write to the project did: it went through, or why it is refused. */
|
|
49
|
+
export type Outcome = "written" | Refusal;
|
|
50
|
+
/** A write to the project the tenant publishes, with the Cloud API signed in. */
|
|
51
|
+
export type ProjectWrite = (api: CloudApi, projectId: string) => Promise<Outcome>;
|
|
52
|
+
/**
|
|
53
|
+
* Sends one write of a variable: `written`, or the refusal of a write
|
|
54
|
+
* AntelopeJS Cloud refuses.
|
|
55
|
+
*
|
|
56
|
+
* @throws What is not such a refusal: a revoked token, or no answer
|
|
57
|
+
*/
|
|
58
|
+
export declare function send(write: () => Promise<void>): Promise<Outcome>;
|
|
59
|
+
/**
|
|
60
|
+
* Runs a write on the project the tenant publishes, signed in with its
|
|
61
|
+
* stored token.
|
|
62
|
+
*
|
|
63
|
+
* @throws The refusal of a tenant without a project, of a failed call, or
|
|
64
|
+
* the one `act` answers
|
|
65
|
+
*/
|
|
66
|
+
export declare function write(tenantId: string, act: ProjectWrite): Promise<void>;
|
|
67
|
+
/** Creates a variable on a service of the project. A key the service holds already is refused. */
|
|
68
|
+
export declare function addVariable(tenantId: string, variable: NewVariable | undefined): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the value of the row `ref` names. A held variable keeps its kind; a
|
|
71
|
+
* missing row is created on the service the body names, which must run in
|
|
72
|
+
* the row's environment, or on the one service the row is missing on.
|
|
73
|
+
*/
|
|
74
|
+
export declare function setValue(tenantId: string, ref: string, body: ValueBody | undefined): Promise<void>;
|
|
75
|
+
export declare function removeVariable(tenantId: string, ref: string): Promise<void>;
|
|
76
|
+
export {};
|