@caelo-cms/provisioning 0.11.11 → 0.11.13

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 (64) hide show
  1. package/dist/admin-domain.d.ts +24 -0
  2. package/dist/admin-domain.d.ts.map +1 -1
  3. package/dist/admin-domain.js +43 -0
  4. package/dist/admin-domain.js.map +1 -1
  5. package/dist/agent-db.js +171 -15
  6. package/dist/converge-job-gcp.d.ts +7 -0
  7. package/dist/converge-job-gcp.d.ts.map +1 -1
  8. package/dist/converge-job-gcp.js +33 -1
  9. package/dist/converge-job-gcp.js.map +1 -1
  10. package/dist/converge-job-preflight.d.ts +34 -2
  11. package/dist/converge-job-preflight.d.ts.map +1 -1
  12. package/dist/converge-job-preflight.js +68 -1
  13. package/dist/converge-job-preflight.js.map +1 -1
  14. package/dist/converge-job-setup.d.ts.map +1 -1
  15. package/dist/converge-job-setup.js +4 -1
  16. package/dist/converge-job-setup.js.map +1 -1
  17. package/dist/converge-job.d.ts +27 -3
  18. package/dist/converge-job.d.ts.map +1 -1
  19. package/dist/converge-job.js +93 -11
  20. package/dist/converge-job.js.map +1 -1
  21. package/dist/infra-contract.d.ts +1 -1
  22. package/dist/infra-contract.d.ts.map +1 -1
  23. package/dist/infra-contract.js +5 -1
  24. package/dist/infra-contract.js.map +1 -1
  25. package/dist/install-job.d.ts +6 -0
  26. package/dist/install-job.d.ts.map +1 -1
  27. package/dist/install-job.js +6 -0
  28. package/dist/install-job.js.map +1 -1
  29. package/dist/lifecycle.d.ts.map +1 -1
  30. package/dist/lifecycle.js +14 -4
  31. package/dist/lifecycle.js.map +1 -1
  32. package/dist/mcp-auth-proxy-setup.d.ts +3 -1
  33. package/dist/mcp-auth-proxy-setup.d.ts.map +1 -1
  34. package/dist/mcp-auth-proxy-setup.js +9 -4
  35. package/dist/mcp-auth-proxy-setup.js.map +1 -1
  36. package/dist/scheduler-setup.d.ts +5 -0
  37. package/dist/scheduler-setup.d.ts.map +1 -1
  38. package/dist/scheduler-setup.js +7 -0
  39. package/dist/scheduler-setup.js.map +1 -1
  40. package/dist/upgrader-iam-preflight.d.ts +8 -6
  41. package/dist/upgrader-iam-preflight.d.ts.map +1 -1
  42. package/dist/upgrader-iam-preflight.js +5 -1
  43. package/dist/upgrader-iam-preflight.js.map +1 -1
  44. package/dist/wizards/gcp-cost.js +1 -1
  45. package/dist/wizards/gcp-cost.js.map +1 -1
  46. package/package.json +2 -2
  47. package/src/admin-domain.test.ts +65 -0
  48. package/src/admin-domain.ts +53 -0
  49. package/src/converge-job-gcp.ts +33 -1
  50. package/src/converge-job-preflight.test.ts +101 -0
  51. package/src/converge-job-preflight.ts +89 -3
  52. package/src/converge-job-setup.ts +4 -1
  53. package/src/converge-job.test.ts +143 -0
  54. package/src/converge-job.ts +143 -19
  55. package/src/infra-contract.test.ts +4 -3
  56. package/src/infra-contract.ts +5 -1
  57. package/src/install-job.ts +6 -0
  58. package/src/lifecycle.ts +16 -6
  59. package/src/mcp-auth-proxy-setup.test.ts +33 -1
  60. package/src/mcp-auth-proxy-setup.ts +11 -4
  61. package/src/scheduler-setup.test.ts +6 -0
  62. package/src/scheduler-setup.ts +7 -0
  63. package/src/upgrader-iam-preflight.ts +15 -10
  64. package/src/wizards/gcp-cost.ts +1 -1
@@ -92,9 +92,9 @@ export interface AccessCheck {
92
92
  readonly permissions: readonly string[];
93
93
  }
94
94
 
95
- /** A check with the permissions it lacks. */
96
- export interface MissingAccess {
97
- readonly check: AccessCheck;
95
+ /** A check with the permissions it lacks (`C`: the caller's own check type, handed back as given). */
96
+ export interface MissingAccess<C extends AccessCheck = AccessCheck> {
97
+ readonly check: C;
98
98
  readonly missing: readonly string[];
99
99
  /**
100
100
  * Permissions that could not be judged because another one is missing
@@ -114,9 +114,9 @@ export interface IamTester {
114
114
  }
115
115
 
116
116
  /** How the self-check came out. */
117
- export type PreflightOutcome =
117
+ export type PreflightOutcome<C extends AccessCheck = AccessCheck> =
118
118
  | { readonly kind: "ok" }
119
- | { readonly kind: "missing"; readonly missing: readonly MissingAccess[] }
119
+ | { readonly kind: "missing"; readonly missing: readonly MissingAccess<C>[] }
120
120
  /** IAM could not be asked about at least one resource; nothing was judged missing. */
121
121
  | { readonly kind: "error"; readonly errors: readonly string[] };
122
122
 
@@ -250,10 +250,10 @@ export function upgraderAccessChecks(target: {
250
250
  }
251
251
 
252
252
  /** Ask IAM about every check (one call per resource); never throws. */
253
- export async function runIamPreflight(
254
- checks: readonly AccessCheck[],
253
+ export async function runIamPreflight<C extends AccessCheck>(
254
+ checks: readonly C[],
255
255
  tester: IamTester,
256
- ): Promise<PreflightOutcome> {
256
+ ): Promise<PreflightOutcome<C>> {
257
257
  // One question per resource: the project alone carries four checks.
258
258
  const byResource = new Map<string, { resource: IamResource; permissions: Set<string> }>();
259
259
  for (const c of checks) {
@@ -300,7 +300,7 @@ export async function runIamPreflight(
300
300
  }),
301
301
  );
302
302
  if (errors.length > 0) return { kind: "error", errors: errors.sort() };
303
- const missing: MissingAccess[] = [];
303
+ const missing: MissingAccess<C>[] = [];
304
304
  for (const check of checks) {
305
305
  const key = resourceName(check.resource);
306
306
  const held = granted.get(key) ?? new Set<string>();
@@ -343,6 +343,11 @@ export function preflightMissingReason(
343
343
  missing: readonly MissingAccess[],
344
344
  voice: PreflightVoice,
345
345
  ): string {
346
+ return `Nothing was changed: ${voice.subject} checked its access before starting and is missing permissions this update needs — ${missingAccessText(missing)}. ${voice.repair}`;
347
+ }
348
+
349
+ /** Every missing permission with what it is for, as one clause list ("it cannot …; it cannot …"). */
350
+ export function missingAccessText(missing: readonly MissingAccess[]): string {
346
351
  const lines = missing.map((m) => {
347
352
  const where = resourceName(m.check.resource);
348
353
  const parts = [
@@ -355,7 +360,7 @@ export function preflightMissingReason(
355
360
  ];
356
361
  return `it ${m.missing.length > 0 ? "cannot" : "may not be able to"} ${m.check.need} (${parts.join("; ")})`;
357
362
  });
358
- return `Nothing was changed: ${voice.subject} checked its access before starting and is missing permissions this update needs — ${lines.join("; ")}. ${voice.repair}`;
363
+ return lines.join("; ");
359
364
  }
360
365
 
361
366
  /** The request's end reason when IAM could not be asked. */
@@ -192,7 +192,7 @@ export function estimateGcpCost(inputs: CostEstimateInputs): {
192
192
  name: "Quality checks (Cloud Run audit job)",
193
193
  monthlyUsd: 2,
194
194
  notes:
195
- "one container per Lighthouse run, all in parallel (up to 5 pages x 3 runs, ~90 s at 2 vCPU each): ~$0.05 per audited Stage, partly in the free tier; results bucket ~$0",
195
+ "one container per Lighthouse run, all in parallel (up to 5 pages x 3 runs, ~90 s at 2 vCPU each; a page whose runs disagree gets 2 more): ~$0.05 per audited Stage, at most ~$0.08, partly in the free tier; results bucket ~$0",
196
196
  },
197
197
  {
198
198
  name: "Screenshots (Cloud Run capture job)",