@getvitops/utils 8.0.1 → 8.2.0-alpha.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/CHANGELOG.md +289 -8
- package/dist/{adc-BFrzpMHq.d.mts → adc-BoEoogyo.d.mts} +2 -3
- package/dist/adc-BoEoogyo.d.mts.map +1 -0
- package/dist/ads/index.d.mts +50 -17
- package/dist/ads/index.d.mts.map +1 -1
- package/dist/ads/index.mjs +77 -8
- package/dist/ads/index.mjs.map +1 -1
- package/dist/cloudflare-BiK61Oq4.d.mts.map +1 -1
- package/dist/{cloudflare-CgAsXiqe.mjs → cloudflare-CD8vwrgj.mjs} +2 -24
- package/dist/cloudflare-CD8vwrgj.mjs.map +1 -0
- package/dist/color/index.d.mts +34 -35
- package/dist/color/index.d.mts.map +1 -1
- package/dist/color/index.mjs +3 -1
- package/dist/color/index.mjs.map +1 -1
- package/dist/crm/index.d.mts +288 -0
- package/dist/crm/index.d.mts.map +1 -0
- package/dist/crm/index.mjs +731 -0
- package/dist/crm/index.mjs.map +1 -0
- package/dist/email/index.d.mts +216 -0
- package/dist/email/index.d.mts.map +1 -0
- package/dist/email/index.mjs +331 -0
- package/dist/email/index.mjs.map +1 -0
- package/dist/favicon.d.mts +8 -9
- package/dist/favicon.d.mts.map +1 -1
- package/dist/git/index.d.mts +65 -0
- package/dist/git/index.d.mts.map +1 -0
- package/dist/git/index.mjs +107 -0
- package/dist/git/index.mjs.map +1 -0
- package/dist/hosting/index.d.mts +184 -0
- package/dist/hosting/index.d.mts.map +1 -0
- package/dist/hosting/index.mjs +553 -0
- package/dist/hosting/index.mjs.map +1 -0
- package/dist/identity-BoRddTx3.mjs +35 -0
- package/dist/identity-BoRddTx3.mjs.map +1 -0
- package/dist/index.d.mts +24 -25
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/indexing/index.d.mts +23 -24
- package/dist/indexing/index.d.mts.map +1 -1
- package/dist/media/index.d.mts +24 -24
- package/dist/media/index.d.mts.map +1 -1
- package/dist/media/index.mjs +3 -3
- package/dist/media/index.mjs.map +1 -1
- package/dist/notify/index.d.mts +26 -15
- package/dist/notify/index.d.mts.map +1 -1
- package/dist/notify/index.mjs +50 -20
- package/dist/notify/index.mjs.map +1 -1
- package/dist/onboarding/index.d.mts +10 -141
- package/dist/onboarding/index.d.mts.map +1 -1
- package/dist/onboarding/index.mjs +2 -144
- package/dist/onboarding/index.mjs.map +1 -1
- package/dist/plan-BLKikoOG.mjs +150 -0
- package/dist/plan-BLKikoOG.mjs.map +1 -0
- package/dist/plan-Hq8Pb0Uw.d.mts +133 -0
- package/dist/plan-Hq8Pb0Uw.d.mts.map +1 -0
- package/dist/plan-format-A18SvJ7C.mjs +24 -0
- package/dist/plan-format-A18SvJ7C.mjs.map +1 -0
- package/dist/reviews/index.d.mts +12 -13
- package/dist/reviews/index.d.mts.map +1 -1
- package/dist/schema/index.d.mts +7 -7
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/security/index.d.mts +2 -2
- package/dist/security/index.d.mts.map +1 -1
- package/dist/{token-Bz_-igw-.d.mts → token-DmmoQ7um.d.mts} +6 -3
- package/dist/token-DmmoQ7um.d.mts.map +1 -0
- package/dist/tracking/index.d.mts +43 -17
- package/dist/tracking/index.d.mts.map +1 -1
- package/dist/tracking/index.mjs +2 -1
- package/dist/tracking/index.mjs.map +1 -1
- package/dist/{types-CHHjzRrv.d.mts → types-7ELci8RQ.d.mts} +4 -2
- package/dist/types-7ELci8RQ.d.mts.map +1 -0
- package/package.json +18 -4
- package/dist/adc-BFrzpMHq.d.mts.map +0 -1
- package/dist/cloudflare-CgAsXiqe.mjs.map +0 -1
- package/dist/token-Bz_-igw-.d.mts.map +0 -1
- package/dist/types-CHHjzRrv.d.mts.map +0 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
//#region src/hosting/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* `vitops setup`'s own option surface.
|
|
4
|
+
*
|
|
5
|
+
* Structural, not imported from `@getvitops/generator`, for the same reason as
|
|
6
|
+
* `onboarding/types.ts` and `ads/types.ts`: the generator already depends on this
|
|
7
|
+
* package, so importing back would be a cycle. `exactOptionalPropertyTypes` is on,
|
|
8
|
+
* so optional fields are `?: T | undefined` throughout — these describe a *parsed
|
|
9
|
+
* JSON config*, where an absent key and an explicit `undefined` are the same thing.
|
|
10
|
+
*/
|
|
11
|
+
/** What the operator wants provisioned, derived from the config + CLI flags. */
|
|
12
|
+
interface HostingSetup {
|
|
13
|
+
platform: 'cloudflare' | 'node';
|
|
14
|
+
/** Repo name (also the D1/R2 name prefix), derived from `package.json`'s name. */
|
|
15
|
+
projectName: string;
|
|
16
|
+
repoVisibility: 'public' | 'private';
|
|
17
|
+
/** Whether the isolated dev D1 + R2 should be provisioned (cloudflare only). */
|
|
18
|
+
devResources: boolean;
|
|
19
|
+
/** GitHub `owner/repo`, once known — absent before `repo` has run. */
|
|
20
|
+
repoNwo?: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
/** Everything gathered from the live GitHub + Cloudflare state before planning. */
|
|
23
|
+
interface HostingState {
|
|
24
|
+
wranglerAuthed: boolean;
|
|
25
|
+
accountId?: string | undefined;
|
|
26
|
+
d1Present: boolean;
|
|
27
|
+
d1Id?: string | undefined;
|
|
28
|
+
r2Present: boolean;
|
|
29
|
+
ghAuthed: boolean;
|
|
30
|
+
originRemote?: string | undefined;
|
|
31
|
+
repoNwo?: string | undefined;
|
|
32
|
+
branches: string[];
|
|
33
|
+
defaultBranch?: string | undefined;
|
|
34
|
+
mainProtected: boolean;
|
|
35
|
+
/** `production`/`dev` environment names already present on the repo. */
|
|
36
|
+
environments: string[];
|
|
37
|
+
/** Repo secret names already set (values are never readable via the API). */
|
|
38
|
+
secretsPresent: string[];
|
|
39
|
+
}
|
|
40
|
+
/** One domain-consistency observation — read from `wrangler.jsonc` + the config. */
|
|
41
|
+
interface DomainState {
|
|
42
|
+
wranglerDev: boolean;
|
|
43
|
+
customDomain?: string | undefined;
|
|
44
|
+
/** `site.environments.<env>.url`, as configured. */
|
|
45
|
+
configuredUrl?: string | undefined;
|
|
46
|
+
/** `site.domains.canonical`, as configured. */
|
|
47
|
+
canonical?: string | undefined;
|
|
48
|
+
robots?: string | undefined;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/hosting/plan.d.ts
|
|
52
|
+
type StepAction = 'create' | 'update' | 'skip' | 'blocked';
|
|
53
|
+
interface StepPlan {
|
|
54
|
+
action: StepAction;
|
|
55
|
+
detail: string;
|
|
56
|
+
}
|
|
57
|
+
interface HostingPlan {
|
|
58
|
+
repo: StepPlan;
|
|
59
|
+
branches: StepPlan;
|
|
60
|
+
defaultBranch: StepPlan;
|
|
61
|
+
mainProtection: StepPlan;
|
|
62
|
+
prodEnvironment: StepPlan;
|
|
63
|
+
devEnvironment: StepPlan;
|
|
64
|
+
d1: StepPlan;
|
|
65
|
+
r2: StepPlan;
|
|
66
|
+
/** One step per repo secret this command sets. */
|
|
67
|
+
secrets: Record<string, StepPlan>;
|
|
68
|
+
notes: string[];
|
|
69
|
+
}
|
|
70
|
+
/** Plan the whole hosting sequence from setup + observed state. */
|
|
71
|
+
export declare function plan(setup: HostingSetup, state: HostingState): HostingPlan;
|
|
72
|
+
/** Any step that isn't a skip — i.e. the live state has drifted from desired. */
|
|
73
|
+
export declare function hasDrift(p: HostingPlan): boolean;
|
|
74
|
+
/** Every blocked step, with a name — what `--check` reports and the CLI surfaces. */
|
|
75
|
+
export declare function blockedSteps(p: HostingPlan): {
|
|
76
|
+
name: string;
|
|
77
|
+
detail: string;
|
|
78
|
+
}[];
|
|
79
|
+
/** Render a plan as the block `--dry` and `--check` print. */
|
|
80
|
+
export declare function formatPlan(p: HostingPlan): string;
|
|
81
|
+
/** The outcome of one run, for the summary table. */
|
|
82
|
+
interface HostingResult {
|
|
83
|
+
step: string;
|
|
84
|
+
status: 'created' | 'updated' | 'present' | 'blocked' | 'failed';
|
|
85
|
+
detail: string;
|
|
86
|
+
}
|
|
87
|
+
/** Render the end-of-run summary: one row per step, plus blocked reminders. */
|
|
88
|
+
export declare function formatSummary(results: HostingResult[]): string;
|
|
89
|
+
/**
|
|
90
|
+
* Plan the domain-consistency check on its own — it has no executor, only an
|
|
91
|
+
* observation (`wrangler.jsonc` + the config), and it is never applied by this
|
|
92
|
+
* command. See `SETUP.html`'s "Domain strategy" stage: the actual cutover is a
|
|
93
|
+
* human, deliberate action.
|
|
94
|
+
*/
|
|
95
|
+
export declare function planDomainConsistency(state: DomainState): StepPlan;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/hosting/wrangler.d.ts
|
|
98
|
+
interface ExecResult {
|
|
99
|
+
ok: boolean;
|
|
100
|
+
stdout: string;
|
|
101
|
+
message?: string | undefined;
|
|
102
|
+
}
|
|
103
|
+
type ExecImpl = (cmd: string, args: string[]) => Promise<ExecResult>;
|
|
104
|
+
/** The real executor — `execFile` with an argv array, never a shell string. */
|
|
105
|
+
export declare const realExec: ExecImpl;
|
|
106
|
+
/** `wrangler whoami` — auth check + the 32-hex account id, from one call. */
|
|
107
|
+
export declare function wranglerWhoami(execImpl?: ExecImpl): Promise<{
|
|
108
|
+
authed: boolean;
|
|
109
|
+
accountId?: string;
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* Find an existing dev D1 database's id by name.
|
|
113
|
+
*
|
|
114
|
+
* `d1 create`'s own stdout carries the id, but its format has drifted across
|
|
115
|
+
* wrangler versions before — a re-list is the one thing guaranteed to still hold
|
|
116
|
+
* the answer, so both the "does it exist" check and the post-create fallback go
|
|
117
|
+
* through this.
|
|
118
|
+
*/
|
|
119
|
+
export declare function findD1(name: string, execImpl?: ExecImpl): Promise<string | undefined>;
|
|
120
|
+
/** Create a dev D1 database, then resolve its id via `findD1` (see its docblock). */
|
|
121
|
+
export declare function createD1(name: string, execImpl?: ExecImpl): Promise<{
|
|
122
|
+
ok: boolean;
|
|
123
|
+
id?: string | undefined;
|
|
124
|
+
message?: string | undefined;
|
|
125
|
+
}>;
|
|
126
|
+
export declare function findR2Bucket(name: string, execImpl?: ExecImpl): Promise<boolean>;
|
|
127
|
+
export declare function createR2Bucket(name: string, execImpl?: ExecImpl): Promise<{
|
|
128
|
+
ok: boolean;
|
|
129
|
+
message?: string | undefined;
|
|
130
|
+
}>;
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/hosting/github.d.ts
|
|
133
|
+
export declare function ghAuthed(execImpl?: ExecImpl): Promise<boolean>;
|
|
134
|
+
export declare function originRemote(execImpl?: ExecImpl): Promise<string | undefined>;
|
|
135
|
+
export declare function repoNwo(execImpl?: ExecImpl): Promise<string | undefined>;
|
|
136
|
+
export declare function branches(execImpl?: ExecImpl): Promise<string[]>;
|
|
137
|
+
export declare function defaultBranch(nwo: string, execImpl?: ExecImpl): Promise<string | undefined>;
|
|
138
|
+
export declare function mainProtected(nwo: string, execImpl?: ExecImpl): Promise<boolean>;
|
|
139
|
+
export declare function environments(nwo: string, execImpl?: ExecImpl): Promise<string[]>;
|
|
140
|
+
export declare function secretsPresent(nwo: string, execImpl?: ExecImpl): Promise<string[]>;
|
|
141
|
+
export declare function createRepo(name: string, visibility: 'public' | 'private', execImpl?: ExecImpl): Promise<{
|
|
142
|
+
ok: boolean;
|
|
143
|
+
message?: string | undefined;
|
|
144
|
+
}>;
|
|
145
|
+
export declare function pushBranches(execImpl?: ExecImpl): Promise<{
|
|
146
|
+
ok: boolean;
|
|
147
|
+
message?: string | undefined;
|
|
148
|
+
}>;
|
|
149
|
+
export declare function setDefaultBranch(nwo: string, branch: string, execImpl?: ExecImpl): Promise<{
|
|
150
|
+
ok: boolean;
|
|
151
|
+
message?: string | undefined;
|
|
152
|
+
}>;
|
|
153
|
+
/**
|
|
154
|
+
* `PUT .../branches/main/protection`. A 403 on Pro/Team-gated repos is expected.
|
|
155
|
+
*
|
|
156
|
+
* Every field goes through `gh api`'s `-f`/`-F` form flags rather than a JSON body
|
|
157
|
+
* on stdin — `gh api` supports nested keys (`a[b]=c`) and repeated array keys
|
|
158
|
+
* (`a[]=x`) this way, so no request needs a second I/O channel `ExecImpl` would
|
|
159
|
+
* have to carry just for this one call.
|
|
160
|
+
*/
|
|
161
|
+
export declare function protectMain(nwo: string, execImpl?: ExecImpl): Promise<{
|
|
162
|
+
ok: boolean;
|
|
163
|
+
message?: string | undefined;
|
|
164
|
+
}>;
|
|
165
|
+
/** The repo's admin collaborators — numeric user ids, which is what the
|
|
166
|
+
* environment-reviewers API wants (not logins). */
|
|
167
|
+
export declare function adminCollaboratorIds(nwo: string, execImpl?: ExecImpl): Promise<number[]>;
|
|
168
|
+
/** `PUT .../environments/production`, reviewers = current admin collaborators. */
|
|
169
|
+
export declare function createProdEnvironment(nwo: string, reviewerUserIds: number[], execImpl?: ExecImpl): Promise<{
|
|
170
|
+
ok: boolean;
|
|
171
|
+
message?: string | undefined;
|
|
172
|
+
}>;
|
|
173
|
+
/** `PUT .../environments/dev` with no reviewers — deliberately left open. */
|
|
174
|
+
export declare function createDevEnvironment(nwo: string, execImpl?: ExecImpl): Promise<{
|
|
175
|
+
ok: boolean;
|
|
176
|
+
message?: string | undefined;
|
|
177
|
+
}>;
|
|
178
|
+
export declare function setSecret(name: string, value: string, execImpl?: ExecImpl): Promise<{
|
|
179
|
+
ok: boolean;
|
|
180
|
+
message?: string | undefined;
|
|
181
|
+
}>;
|
|
182
|
+
//#endregion
|
|
183
|
+
export type { DomainState, ExecImpl, ExecResult, HostingPlan, HostingResult, HostingSetup, HostingState, StepAction, StepPlan };
|
|
184
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/hosting/types.ts","../../src/hosting/plan.ts","../../src/hosting/wrangler.ts","../../src/hosting/github.ts"],"mappings":";;;;;;;;;;;UAWiB;EACf;;EAEA;EACA;;EAEA;;EAEA;;;UAIe;EACf;E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