@numa-tech/numa 1.13.5 → 1.14.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 (83) hide show
  1. package/README.md +132 -24
  2. package/dist/application-onboarding/commands.d.ts +1 -0
  3. package/dist/application-onboarding/commands.js +32 -10
  4. package/dist/application-onboarding/commands.js.map +1 -1
  5. package/dist/application-onboarding/schemas.d.ts +2 -0
  6. package/dist/application-onboarding/schemas.js +3 -2
  7. package/dist/application-onboarding/schemas.js.map +1 -1
  8. package/dist/application-onboarding/scm-credentials.d.ts +5 -2
  9. package/dist/application-onboarding/scm-credentials.js +64 -13
  10. package/dist/application-onboarding/scm-credentials.js.map +1 -1
  11. package/dist/cli.js +4 -2
  12. package/dist/cli.js.map +1 -1
  13. package/dist/command-catalog.js +239 -11
  14. package/dist/command-catalog.js.map +1 -1
  15. package/dist/integration-bootstrap/client.d.ts +23 -0
  16. package/dist/integration-bootstrap/client.js +124 -0
  17. package/dist/integration-bootstrap/client.js.map +1 -0
  18. package/dist/integration-bootstrap/commands.d.ts +20 -0
  19. package/dist/integration-bootstrap/commands.js +129 -0
  20. package/dist/integration-bootstrap/commands.js.map +1 -0
  21. package/dist/integration-bootstrap/schemas.d.ts +422 -0
  22. package/dist/integration-bootstrap/schemas.js +216 -0
  23. package/dist/integration-bootstrap/schemas.js.map +1 -0
  24. package/dist/jenkins/commands.d.ts +10 -0
  25. package/dist/jenkins/commands.js +15 -0
  26. package/dist/jenkins/commands.js.map +1 -0
  27. package/dist/jenkins-jobs/client.d.ts +12 -12
  28. package/dist/jenkins-jobs/schemas.d.ts +96 -8
  29. package/dist/jenkins-jobs/schemas.js +2 -2
  30. package/dist/jenkins-jobs/schemas.js.map +1 -1
  31. package/dist/pipeline/client.d.ts +5 -0
  32. package/dist/pipeline/commands.js +2 -0
  33. package/dist/pipeline/commands.js.map +1 -1
  34. package/dist/pipeline/schemas.d.ts +6 -0
  35. package/dist/pipeline/schemas.js +2 -0
  36. package/dist/pipeline/schemas.js.map +1 -1
  37. package/dist/platform-build-job-replans/client.d.ts +283 -0
  38. package/dist/platform-build-job-replans/client.js +148 -0
  39. package/dist/platform-build-job-replans/client.js.map +1 -0
  40. package/dist/platform-build-job-replans/commands.d.ts +6 -0
  41. package/dist/platform-build-job-replans/commands.js +371 -0
  42. package/dist/platform-build-job-replans/commands.js.map +1 -0
  43. package/dist/platform-build-job-replans/schemas.d.ts +145 -0
  44. package/dist/platform-build-job-replans/schemas.js +150 -0
  45. package/dist/platform-build-job-replans/schemas.js.map +1 -0
  46. package/dist/platform-build-rollouts/client.d.ts +346 -0
  47. package/dist/platform-build-rollouts/client.js +153 -0
  48. package/dist/platform-build-rollouts/client.js.map +1 -0
  49. package/dist/platform-build-rollouts/commands.d.ts +98 -0
  50. package/dist/platform-build-rollouts/commands.js +465 -0
  51. package/dist/platform-build-rollouts/commands.js.map +1 -0
  52. package/dist/platform-build-rollouts/schemas.d.ts +348 -0
  53. package/dist/platform-build-rollouts/schemas.js +257 -0
  54. package/dist/platform-build-rollouts/schemas.js.map +1 -0
  55. package/dist/platform-builds/client.d.ts +147 -0
  56. package/dist/platform-builds/client.js +115 -0
  57. package/dist/platform-builds/client.js.map +1 -0
  58. package/dist/platform-builds/commands.d.ts +7 -0
  59. package/dist/platform-builds/commands.js +226 -0
  60. package/dist/platform-builds/commands.js.map +1 -0
  61. package/dist/platform-builds/schemas.d.ts +127 -0
  62. package/dist/platform-builds/schemas.js +66 -0
  63. package/dist/platform-builds/schemas.js.map +1 -0
  64. package/dist/publications/client.d.ts +30 -0
  65. package/dist/publications/client.js +6 -1
  66. package/dist/publications/client.js.map +1 -1
  67. package/dist/publications/commands.d.ts +2 -0
  68. package/dist/publications/commands.js +84 -5
  69. package/dist/publications/commands.js.map +1 -1
  70. package/dist/repositories/errors.d.ts +2 -1
  71. package/dist/repositories/errors.js +3 -1
  72. package/dist/repositories/errors.js.map +1 -1
  73. package/dist/repositories/schemas.d.ts +4 -0
  74. package/dist/repositories/schemas.js +1 -0
  75. package/dist/repositories/schemas.js.map +1 -1
  76. package/package.json +4 -4
  77. package/skills/numa-create-application/SKILL.md +17 -11
  78. package/skills/numa-create-application/agents/openai.yaml +2 -2
  79. package/skills/numa-create-application/evals/evals.json +56 -10
  80. package/skills/numa-create-application/references/checklist.md +7 -4
  81. package/skills/numa-create-application/references/numa-cli.md +46 -13
  82. package/skills/numa-create-application/references/promote-workflows.md +49 -21
  83. package/skills/numa-create-application/scripts/inspect-project.mjs +1 -0
@@ -0,0 +1,150 @@
1
+ import { z } from "zod";
2
+ const NonEmpty = z.string().trim().min(1);
3
+ const OptionalString = NonEmpty.nullable();
4
+ const Sha256 = z.string().regex(/^[0-9a-f]{64}$/u);
5
+ const ApplicationCode = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/u);
6
+ const InstanceCode = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/u);
7
+ const SafeKey = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:/+-]{0,199}$/u);
8
+ export const PLATFORM_BUILD_JOB_POLICY = "jenkins-job-plan/v2";
9
+ export const PlatformBuildJobTierSchema = z.enum([
10
+ "DEVELOP", "STAGING", "PRODUCTION", "UNKNOWN"
11
+ ]);
12
+ export const PlatformBuildJobPlanRequestSchema = z.object({
13
+ applicationCode: ApplicationCode,
14
+ instanceCode: InstanceCode,
15
+ tier: PlatformBuildJobTierSchema,
16
+ clientRequestId: SafeKey,
17
+ idempotencyKey: SafeKey
18
+ }).strict();
19
+ export const PlatformBuildJobApplyRequestSchema = z.object({
20
+ planNo: NonEmpty,
21
+ planHash: Sha256,
22
+ clientRequestId: SafeKey,
23
+ idempotencyKey: SafeKey
24
+ }).strict();
25
+ export const PlatformBuildJobActionRequestSchema = z.object({
26
+ idempotencyKey: SafeKey
27
+ }).strict();
28
+ const PlatformBuildJobPlanObjectSchema = z.object({
29
+ planNo: NonEmpty,
30
+ operation: z.literal("USE_EXISTING"),
31
+ state: z.enum(["READY", "BLOCKED", "CONSUMED", "EXPIRED"]),
32
+ planHash: Sha256,
33
+ policyVersion: z.literal(PLATFORM_BUILD_JOB_POLICY),
34
+ clientRequestId: SafeKey,
35
+ requestDigest: Sha256,
36
+ applicationCode: ApplicationCode,
37
+ instanceCode: InstanceCode,
38
+ canonicalJobId: z.number().int().positive(),
39
+ canonicalJobFullName: NonEmpty,
40
+ repositoryKey: NonEmpty,
41
+ tier: PlatformBuildJobTierSchema,
42
+ observedConfigDigest: Sha256,
43
+ sideEffects: z.array(NonEmpty).default([]),
44
+ warnings: z.array(NonEmpty).default([]),
45
+ blockers: z.array(NonEmpty).default([]),
46
+ expiresAt: NonEmpty
47
+ }).strict();
48
+ export const PlatformBuildJobPlanSchema = PlatformBuildJobPlanObjectSchema.superRefine((plan, context) => {
49
+ const blockerShape = plan.state === "BLOCKED"
50
+ ? plan.blockers.length > 0
51
+ : plan.blockers.length === 0;
52
+ if (!blockerShape) {
53
+ context.addIssue({
54
+ code: "custom",
55
+ path: ["blockers"],
56
+ message: "Plan blockers do not match the immutable plan state"
57
+ });
58
+ }
59
+ });
60
+ export const PlatformBuildJobRunSchema = z.object({
61
+ runNo: NonEmpty,
62
+ planNo: NonEmpty,
63
+ clientRequestId: SafeKey,
64
+ requestDigest: Sha256,
65
+ state: z.enum(["ACCEPTED", "RUNNING", "SUCCEEDED", "UNKNOWN", "FAILED"]),
66
+ stepCode: NonEmpty,
67
+ canonicalJobId: z.number().int().positive(),
68
+ canonicalJobFullName: NonEmpty,
69
+ bindingId: z.number().int().positive(),
70
+ observedConfigDigest: Sha256.nullable(),
71
+ retryable: z.boolean(),
72
+ errorCode: OptionalString,
73
+ errorMessage: OptionalString,
74
+ acceptedAt: NonEmpty,
75
+ startedAt: OptionalString,
76
+ completedAt: OptionalString
77
+ }).strict();
78
+ const PlatformBuildJobReplanObjectSchema = z.object({
79
+ policyVersion: z.literal(PLATFORM_BUILD_JOB_POLICY),
80
+ plan: PlatformBuildJobPlanSchema,
81
+ run: PlatformBuildJobRunSchema
82
+ }).strict();
83
+ export const PlatformBuildJobReplanSchema = PlatformBuildJobReplanObjectSchema.superRefine((view, context) => {
84
+ const exactIdentity = view.plan.state === "CONSUMED"
85
+ && view.plan.blockers.length === 0
86
+ && view.run.planNo === view.plan.planNo
87
+ && view.run.canonicalJobId === view.plan.canonicalJobId
88
+ && view.run.canonicalJobFullName === view.plan.canonicalJobFullName
89
+ && (view.run.observedConfigDigest == null
90
+ || view.run.observedConfigDigest === view.plan.observedConfigDigest);
91
+ if (!exactIdentity) {
92
+ context.addIssue({
93
+ code: "custom",
94
+ path: ["run"],
95
+ message: "Replan run does not match its immutable plan"
96
+ });
97
+ }
98
+ if (view.run.state === "SUCCEEDED"
99
+ && (view.run.observedConfigDigest !== view.plan.observedConfigDigest
100
+ || view.run.startedAt == null || view.run.completedAt == null
101
+ || view.run.errorCode != null || view.run.errorMessage != null
102
+ || view.run.retryable)) {
103
+ context.addIssue({
104
+ code: "custom",
105
+ path: ["run"],
106
+ message: "Succeeded replan requires exact terminal configuration evidence"
107
+ });
108
+ }
109
+ if (view.run.state === "UNKNOWN"
110
+ && (view.run.startedAt == null || view.run.errorCode == null
111
+ || view.run.observedConfigDigest != null || !view.run.retryable
112
+ || view.run.completedAt != null)) {
113
+ context.addIssue({
114
+ code: "custom",
115
+ path: ["run"],
116
+ message: "Unknown replan requires retryable non-terminal evidence"
117
+ });
118
+ }
119
+ if (view.run.state === "FAILED"
120
+ && (view.run.startedAt == null || view.run.errorCode == null
121
+ || view.run.completedAt == null || view.run.observedConfigDigest != null
122
+ || view.run.retryable)) {
123
+ context.addIssue({
124
+ code: "custom",
125
+ path: ["run"],
126
+ message: "Failed replan requires terminal error evidence"
127
+ });
128
+ }
129
+ if (view.run.state === "ACCEPTED"
130
+ && (view.run.startedAt != null || view.run.completedAt != null
131
+ || view.run.observedConfigDigest != null || view.run.errorCode != null
132
+ || view.run.errorMessage != null || view.run.retryable)) {
133
+ context.addIssue({
134
+ code: "custom",
135
+ path: ["run"],
136
+ message: "Accepted replan cannot carry execution or terminal evidence"
137
+ });
138
+ }
139
+ if (view.run.state === "RUNNING"
140
+ && (view.run.startedAt == null || view.run.completedAt != null
141
+ || view.run.observedConfigDigest != null || view.run.errorCode != null
142
+ || view.run.errorMessage != null || view.run.retryable)) {
143
+ context.addIssue({
144
+ code: "custom",
145
+ path: ["run"],
146
+ message: "Running replan requires exact non-terminal execution evidence"
147
+ });
148
+ }
149
+ });
150
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/platform-build-job-replans/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1C,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC3C,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACnD,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC/E,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC5E,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,yBAAyB,GAAG,qBAA8B,CAAC;AAExE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/C,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS;CAC9C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC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import { type KeycloakTokenProvider } from "../oauth.js";
3
+ import { type PlatformBuildRolloutApplyRequest, type PlatformBuildRolloutConfigureRequest, type PlatformBuildRolloutPlanRequest } from "./schemas.js";
4
+ export declare const PLATFORM_BUILD_ROLLOUT_API_ROOT = "/api/v1/admin/jenkins";
5
+ export interface PlatformBuildRolloutClientDependencies {
6
+ fetch?: typeof fetch;
7
+ tokenProvider?: KeycloakTokenProvider;
8
+ }
9
+ export declare class PlatformBuildRolloutClient {
10
+ private readonly config;
11
+ private readonly fetchImpl;
12
+ private readonly tokenProvider;
13
+ constructor(config: AuthConfig, dependencies?: PlatformBuildRolloutClientDependencies);
14
+ private authenticatedFetch;
15
+ private json;
16
+ createPlan(input: PlatformBuildRolloutPlanRequest, key: string): Promise<{
17
+ planNo: string;
18
+ operation: "DISABLE_PLATFORM" | "ENABLE_PLATFORM";
19
+ state: "BLOCKED" | "CONSUMED" | "EXPIRED" | "READY";
20
+ planHash: string;
21
+ applicationCode: string;
22
+ instanceCode: string;
23
+ contractVersion: "gitops-image-delivery/v2" | null;
24
+ sharedLibraryRevision: string | null;
25
+ readiness: {
26
+ verificationMode?: "JENKINS_API_VERIFIED" | undefined;
27
+ publicConfiguration?: {
28
+ contractVersion?: "gitops-image-delivery/v2" | null | undefined;
29
+ sharedLibraryRevision?: string | null | undefined;
30
+ platformUrl?: string | null | undefined;
31
+ oidcEndpoint?: string | null | undefined;
32
+ jenkinsInstanceCode?: string | null | undefined;
33
+ audience?: string | null | undefined;
34
+ rolloutMode?: "platform" | null | undefined;
35
+ legacyFallback?: false | null | undefined;
36
+ rolloutEntry?: string | null | undefined;
37
+ snapshotFolderFullName?: "mci-platform-snapshots" | null | undefined;
38
+ } | undefined;
39
+ credentialReferences?: {
40
+ writerCredentialReference?: string | null | undefined;
41
+ } | undefined;
42
+ sourcePolicy?: {
43
+ entrypoint: "platformBuildEntry()";
44
+ jenkinsfileDigest: string;
45
+ buildProfileDigest: string;
46
+ buildProfile: {
47
+ contract: "platform-build/v1";
48
+ agentLabel: string;
49
+ appHome: string;
50
+ buildFlow: "DOCKER";
51
+ nodeVersion: string | null;
52
+ sonarScan: false;
53
+ sendNotify: false;
54
+ };
55
+ } | undefined;
56
+ };
57
+ sideEffects: string[];
58
+ blockers: string[];
59
+ expiresAt: string | null;
60
+ }>;
61
+ getPlan(planNo: string): Promise<{
62
+ planNo: string;
63
+ operation: "DISABLE_PLATFORM" | "ENABLE_PLATFORM";
64
+ state: "BLOCKED" | "CONSUMED" | "EXPIRED" | "READY";
65
+ planHash: string;
66
+ applicationCode: string;
67
+ instanceCode: string;
68
+ contractVersion: "gitops-image-delivery/v2" | null;
69
+ sharedLibraryRevision: string | null;
70
+ readiness: {
71
+ verificationMode?: "JENKINS_API_VERIFIED" | undefined;
72
+ publicConfiguration?: {
73
+ contractVersion?: "gitops-image-delivery/v2" | null | undefined;
74
+ sharedLibraryRevision?: string | null | undefined;
75
+ platformUrl?: string | null | undefined;
76
+ oidcEndpoint?: string | null | undefined;
77
+ jenkinsInstanceCode?: string | null | undefined;
78
+ audience?: string | null | undefined;
79
+ rolloutMode?: "platform" | null | undefined;
80
+ legacyFallback?: false | null | undefined;
81
+ rolloutEntry?: string | null | undefined;
82
+ snapshotFolderFullName?: "mci-platform-snapshots" | null | undefined;
83
+ } | undefined;
84
+ credentialReferences?: {
85
+ writerCredentialReference?: string | null | undefined;
86
+ } | undefined;
87
+ sourcePolicy?: {
88
+ entrypoint: "platformBuildEntry()";
89
+ jenkinsfileDigest: string;
90
+ buildProfileDigest: string;
91
+ buildProfile: {
92
+ contract: "platform-build/v1";
93
+ agentLabel: string;
94
+ appHome: string;
95
+ buildFlow: "DOCKER";
96
+ nodeVersion: string | null;
97
+ sonarScan: false;
98
+ sendNotify: false;
99
+ };
100
+ } | undefined;
101
+ };
102
+ sideEffects: string[];
103
+ blockers: string[];
104
+ expiresAt: string | null;
105
+ }>;
106
+ apply(input: PlatformBuildRolloutApplyRequest, key: string): Promise<{
107
+ rolloutNo: string;
108
+ applicationCode: string;
109
+ instanceCode: string;
110
+ desiredMode: "DISABLED" | "PLATFORM";
111
+ status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
112
+ contractVersion: "gitops-image-delivery/v2" | null;
113
+ sharedLibraryRevision: string | null;
114
+ verificationSource: "JENKINS_API_VERIFIED" | null;
115
+ verificationReference: string | null;
116
+ verifiedAt: string | null;
117
+ version: number;
118
+ expectedPublicConfiguration: Record<string, never> | {
119
+ contractVersion: "gitops-image-delivery/v2";
120
+ sharedLibraryRevision: string;
121
+ platformUrl: string;
122
+ oidcEndpoint: string;
123
+ jenkinsInstanceCode: string;
124
+ audience: string;
125
+ rolloutMode: "platform";
126
+ legacyFallback: false;
127
+ rolloutEntry: string;
128
+ snapshotFolderFullName: "mci-platform-snapshots";
129
+ };
130
+ expectedCredentialReferences: Record<string, never> | {
131
+ writerCredentialReference: string;
132
+ };
133
+ requiredActions: string[];
134
+ verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
135
+ configurationDigest: string | null;
136
+ observedSharedLibraryRevision: string | null;
137
+ writerCredentialConfigured: boolean;
138
+ verifiedSourceRevision: string | null;
139
+ jenkinsfileDigest: string | null;
140
+ }>;
141
+ list(options?: {
142
+ applicationCode?: string;
143
+ instanceCode?: string;
144
+ }): Promise<{
145
+ rolloutNo: string;
146
+ applicationCode: string;
147
+ instanceCode: string;
148
+ desiredMode: "DISABLED" | "PLATFORM";
149
+ status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
150
+ contractVersion: "gitops-image-delivery/v2" | null;
151
+ sharedLibraryRevision: string | null;
152
+ verificationSource: "JENKINS_API_VERIFIED" | null;
153
+ verificationReference: string | null;
154
+ verifiedAt: string | null;
155
+ version: number;
156
+ expectedPublicConfiguration: Record<string, never> | {
157
+ contractVersion: "gitops-image-delivery/v2";
158
+ sharedLibraryRevision: string;
159
+ platformUrl: string;
160
+ oidcEndpoint: string;
161
+ jenkinsInstanceCode: string;
162
+ audience: string;
163
+ rolloutMode: "platform";
164
+ legacyFallback: false;
165
+ rolloutEntry: string;
166
+ snapshotFolderFullName: "mci-platform-snapshots";
167
+ };
168
+ expectedCredentialReferences: Record<string, never> | {
169
+ writerCredentialReference: string;
170
+ };
171
+ requiredActions: string[];
172
+ verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
173
+ configurationDigest: string | null;
174
+ observedSharedLibraryRevision: string | null;
175
+ writerCredentialConfigured: boolean;
176
+ verifiedSourceRevision: string | null;
177
+ jenkinsfileDigest: string | null;
178
+ }[]>;
179
+ get(rolloutNo: string): Promise<{
180
+ rolloutNo: string;
181
+ applicationCode: string;
182
+ instanceCode: string;
183
+ desiredMode: "DISABLED" | "PLATFORM";
184
+ status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
185
+ contractVersion: "gitops-image-delivery/v2" | null;
186
+ sharedLibraryRevision: string | null;
187
+ verificationSource: "JENKINS_API_VERIFIED" | null;
188
+ verificationReference: string | null;
189
+ verifiedAt: string | null;
190
+ version: number;
191
+ expectedPublicConfiguration: Record<string, never> | {
192
+ contractVersion: "gitops-image-delivery/v2";
193
+ sharedLibraryRevision: string;
194
+ platformUrl: string;
195
+ oidcEndpoint: string;
196
+ jenkinsInstanceCode: string;
197
+ audience: string;
198
+ rolloutMode: "platform";
199
+ legacyFallback: false;
200
+ rolloutEntry: string;
201
+ snapshotFolderFullName: "mci-platform-snapshots";
202
+ };
203
+ expectedCredentialReferences: Record<string, never> | {
204
+ writerCredentialReference: string;
205
+ };
206
+ requiredActions: string[];
207
+ verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
208
+ configurationDigest: string | null;
209
+ observedSharedLibraryRevision: string | null;
210
+ writerCredentialConfigured: boolean;
211
+ verifiedSourceRevision: string | null;
212
+ jenkinsfileDigest: string | null;
213
+ }>;
214
+ configure(rolloutNo: string, input: PlatformBuildRolloutConfigureRequest, key: string): Promise<{
215
+ rolloutNo: string;
216
+ applicationCode: string;
217
+ instanceCode: string;
218
+ desiredMode: "DISABLED" | "PLATFORM";
219
+ status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
220
+ contractVersion: "gitops-image-delivery/v2" | null;
221
+ sharedLibraryRevision: string | null;
222
+ verificationSource: "JENKINS_API_VERIFIED" | null;
223
+ verificationReference: string | null;
224
+ verifiedAt: string | null;
225
+ version: number;
226
+ expectedPublicConfiguration: Record<string, never> | {
227
+ contractVersion: "gitops-image-delivery/v2";
228
+ sharedLibraryRevision: string;
229
+ platformUrl: string;
230
+ oidcEndpoint: string;
231
+ jenkinsInstanceCode: string;
232
+ audience: string;
233
+ rolloutMode: "platform";
234
+ legacyFallback: false;
235
+ rolloutEntry: string;
236
+ snapshotFolderFullName: "mci-platform-snapshots";
237
+ };
238
+ expectedCredentialReferences: Record<string, never> | {
239
+ writerCredentialReference: string;
240
+ };
241
+ requiredActions: string[];
242
+ verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
243
+ configurationDigest: string | null;
244
+ observedSharedLibraryRevision: string | null;
245
+ writerCredentialConfigured: boolean;
246
+ verifiedSourceRevision: string | null;
247
+ jenkinsfileDigest: string | null;
248
+ }>;
249
+ private configureRecovery;
250
+ reconcileConfigure(rolloutNo: string, input: PlatformBuildRolloutConfigureRequest, key: string): Promise<{
251
+ rolloutNo: string;
252
+ idempotencyKey: string;
253
+ requestDigest: string;
254
+ expectedVersion: number;
255
+ state: "FAILED" | "PENDING" | "RECOVERING" | "SUCCEEDED" | "UNKNOWN";
256
+ disposition: "CONFLICT" | "FAILED" | "PENDING" | "READBACK_UNKNOWN" | "RECOVERING" | "UNTOUCHED" | "VERIFIED" | "WRITE_UNKNOWN";
257
+ resultVersion: number | null;
258
+ errorCode: string | null;
259
+ retryable: boolean;
260
+ reapplyAllowed: boolean;
261
+ recoveryStartedAt: string | null;
262
+ rollout: {
263
+ rolloutNo: string;
264
+ applicationCode: string;
265
+ instanceCode: string;
266
+ desiredMode: "DISABLED" | "PLATFORM";
267
+ status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
268
+ contractVersion: "gitops-image-delivery/v2" | null;
269
+ sharedLibraryRevision: string | null;
270
+ verificationSource: "JENKINS_API_VERIFIED" | null;
271
+ verificationReference: string | null;
272
+ verifiedAt: string | null;
273
+ version: number;
274
+ expectedPublicConfiguration: Record<string, never> | {
275
+ contractVersion: "gitops-image-delivery/v2";
276
+ sharedLibraryRevision: string;
277
+ platformUrl: string;
278
+ oidcEndpoint: string;
279
+ jenkinsInstanceCode: string;
280
+ audience: string;
281
+ rolloutMode: "platform";
282
+ legacyFallback: false;
283
+ rolloutEntry: string;
284
+ snapshotFolderFullName: "mci-platform-snapshots";
285
+ };
286
+ expectedCredentialReferences: Record<string, never> | {
287
+ writerCredentialReference: string;
288
+ };
289
+ requiredActions: string[];
290
+ verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
291
+ configurationDigest: string | null;
292
+ observedSharedLibraryRevision: string | null;
293
+ writerCredentialConfigured: boolean;
294
+ verifiedSourceRevision: string | null;
295
+ jenkinsfileDigest: string | null;
296
+ };
297
+ }>;
298
+ reapplyConfigure(rolloutNo: string, input: PlatformBuildRolloutConfigureRequest, key: string): Promise<{
299
+ rolloutNo: string;
300
+ idempotencyKey: string;
301
+ requestDigest: string;
302
+ expectedVersion: number;
303
+ state: "FAILED" | "PENDING" | "RECOVERING" | "SUCCEEDED" | "UNKNOWN";
304
+ disposition: "CONFLICT" | "FAILED" | "PENDING" | "READBACK_UNKNOWN" | "RECOVERING" | "UNTOUCHED" | "VERIFIED" | "WRITE_UNKNOWN";
305
+ resultVersion: number | null;
306
+ errorCode: string | null;
307
+ retryable: boolean;
308
+ reapplyAllowed: boolean;
309
+ recoveryStartedAt: string | null;
310
+ rollout: {
311
+ rolloutNo: string;
312
+ applicationCode: string;
313
+ instanceCode: string;
314
+ desiredMode: "DISABLED" | "PLATFORM";
315
+ status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
316
+ contractVersion: "gitops-image-delivery/v2" | null;
317
+ sharedLibraryRevision: string | null;
318
+ verificationSource: "JENKINS_API_VERIFIED" | null;
319
+ verificationReference: string | null;
320
+ verifiedAt: string | null;
321
+ version: number;
322
+ expectedPublicConfiguration: Record<string, never> | {
323
+ contractVersion: "gitops-image-delivery/v2";
324
+ sharedLibraryRevision: string;
325
+ platformUrl: string;
326
+ oidcEndpoint: string;
327
+ jenkinsInstanceCode: string;
328
+ audience: string;
329
+ rolloutMode: "platform";
330
+ legacyFallback: false;
331
+ rolloutEntry: string;
332
+ snapshotFolderFullName: "mci-platform-snapshots";
333
+ };
334
+ expectedCredentialReferences: Record<string, never> | {
335
+ writerCredentialReference: string;
336
+ };
337
+ requiredActions: string[];
338
+ verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
339
+ configurationDigest: string | null;
340
+ observedSharedLibraryRevision: string | null;
341
+ writerCredentialConfigured: boolean;
342
+ verifiedSourceRevision: string | null;
343
+ jenkinsfileDigest: string | null;
344
+ };
345
+ }>;
346
+ }
@@ -0,0 +1,153 @@
1
+ import { resolveBackendUrl } from "../backend.js";
2
+ import { ensureAccessToken, fetchWithKeycloakIdentity } from "../oauth.js";
3
+ import { PipelineError, redactPipelineText } from "../pipeline/errors.js";
4
+ import { ApiErrorSchema } from "../pipeline/schemas.js";
5
+ import { PlatformBuildRolloutApplyRequestSchema, PlatformBuildRolloutConfigureRequestSchema, PlatformBuildRolloutConfigureActionSchema, PlatformBuildRolloutListSchema, PlatformBuildRolloutPlanRequestSchema, PlatformBuildRolloutPlanSchema, PlatformBuildRolloutSchema } from "./schemas.js";
6
+ export const PLATFORM_BUILD_ROLLOUT_API_ROOT = "/api/v1/admin/jenkins";
7
+ function stableIdentifier(value, label, maximum = 160) {
8
+ const trimmed = value.trim();
9
+ if (!trimmed || trimmed.length > maximum
10
+ || !/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(trimmed)) {
11
+ throw new PipelineError(`${label} is invalid.`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
12
+ }
13
+ return trimmed;
14
+ }
15
+ function idempotencyKey(value) {
16
+ const trimmed = value.trim();
17
+ if (!trimmed || trimmed.length > 200
18
+ || !/^[A-Za-z0-9][A-Za-z0-9._:/+-]*$/u.test(trimmed)) {
19
+ throw new PipelineError("idempotency-key must be 1-200 safe opaque characters.", "JENKINS_PLATFORM_BUILD_ROLLOUT_IDEMPOTENCY_INVALID");
20
+ }
21
+ return trimmed;
22
+ }
23
+ function queryPath(path, values) {
24
+ const query = new URLSearchParams();
25
+ for (const [key, value] of Object.entries(values)) {
26
+ if (value != null && value !== "")
27
+ query.set(key, value);
28
+ }
29
+ return query.size ? `${path}?${query.toString()}` : path;
30
+ }
31
+ async function responseBody(response) {
32
+ const text = await response.text();
33
+ if (!text)
34
+ return {};
35
+ try {
36
+ return JSON.parse(text);
37
+ }
38
+ catch {
39
+ return text;
40
+ }
41
+ }
42
+ function requestIdFrom(response, body) {
43
+ if (body && typeof body === "object" && "requestId" in body
44
+ && typeof body.requestId === "string")
45
+ return body.requestId;
46
+ return response.headers.get("x-request-id") ?? undefined;
47
+ }
48
+ function apiFailure(response, body) {
49
+ const parsed = ApiErrorSchema.safeParse(body);
50
+ const message = parsed.success
51
+ ? parsed.data.message ?? response.statusText ?? "Platform-build rollout API request failed."
52
+ : typeof body === "string" ? body
53
+ : response.statusText || "Platform-build rollout API request failed.";
54
+ return new PipelineError(`Platform-build rollout API HTTP ${response.status}: ${redactPipelineText(message)}`, parsed.success
55
+ ? parsed.data.code ?? "JENKINS_PLATFORM_BUILD_ROLLOUT_API_ERROR"
56
+ : "JENKINS_PLATFORM_BUILD_ROLLOUT_API_ERROR", response.status, requestIdFrom(response, body));
57
+ }
58
+ export class PlatformBuildRolloutClient {
59
+ config;
60
+ fetchImpl;
61
+ tokenProvider;
62
+ constructor(config, dependencies = {}) {
63
+ this.config = config;
64
+ this.fetchImpl = dependencies.fetch ?? fetch;
65
+ this.tokenProvider = dependencies.tokenProvider ?? ensureAccessToken;
66
+ }
67
+ async authenticatedFetch(path, init = {}) {
68
+ const method = String(init.method ?? "GET").toUpperCase();
69
+ const url = resolveBackendUrl(this.config, { method, path });
70
+ const headers = new Headers(init.headers);
71
+ headers.set("Accept", "application/json");
72
+ if (init.body != null)
73
+ headers.set("Content-Type", "application/json");
74
+ return fetchWithKeycloakIdentity(this.config, url, () => ({ ...init, headers }), {
75
+ fetch: this.fetchImpl,
76
+ tokenProvider: this.tokenProvider
77
+ });
78
+ }
79
+ async json(path, schema, init = {}, expectedStatuses) {
80
+ const response = await this.authenticatedFetch(path, init);
81
+ const body = await responseBody(response);
82
+ if (!response.ok)
83
+ throw apiFailure(response, body);
84
+ if (expectedStatuses && !expectedStatuses.includes(response.status)) {
85
+ throw new PipelineError(`Platform-build rollout API returned HTTP ${response.status}; expected ${expectedStatuses.join(" or ")}.`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INVALID_RESPONSE", response.status, requestIdFrom(response, body));
86
+ }
87
+ const parsed = schema.safeParse(body);
88
+ if (!parsed.success) {
89
+ throw new PipelineError(`Platform-build rollout API returned an invalid response: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INVALID_RESPONSE", response.status, requestIdFrom(response, body));
90
+ }
91
+ return parsed.data;
92
+ }
93
+ createPlan(input, key) {
94
+ const parsed = PlatformBuildRolloutPlanRequestSchema.safeParse(input);
95
+ if (!parsed.success) {
96
+ throw new PipelineError(`Platform-build rollout plan input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
97
+ }
98
+ return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollout-plans`, PlatformBuildRolloutPlanSchema, {
99
+ method: "POST",
100
+ headers: { "Idempotency-Key": idempotencyKey(key) },
101
+ body: JSON.stringify(parsed.data)
102
+ }, [200]);
103
+ }
104
+ getPlan(planNo) {
105
+ return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollout-plans/${encodeURIComponent(stableIdentifier(planNo, "plan-no", 120))}`, PlatformBuildRolloutPlanSchema);
106
+ }
107
+ apply(input, key) {
108
+ const parsed = PlatformBuildRolloutApplyRequestSchema.safeParse(input);
109
+ if (!parsed.success) {
110
+ throw new PipelineError(`Platform-build rollout apply input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
111
+ }
112
+ return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts`, PlatformBuildRolloutSchema, {
113
+ method: "POST",
114
+ headers: { "Idempotency-Key": idempotencyKey(key) },
115
+ body: JSON.stringify(parsed.data)
116
+ }, [202]);
117
+ }
118
+ list(options = {}) {
119
+ return this.json(queryPath(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts`, options), PlatformBuildRolloutListSchema);
120
+ }
121
+ get(rolloutNo) {
122
+ return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts/${encodeURIComponent(stableIdentifier(rolloutNo, "rollout-no", 120))}`, PlatformBuildRolloutSchema);
123
+ }
124
+ configure(rolloutNo, input, key) {
125
+ const parsed = PlatformBuildRolloutConfigureRequestSchema.safeParse(input);
126
+ if (!parsed.success) {
127
+ throw new PipelineError(`Platform-build rollout configure input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
128
+ }
129
+ return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts/${encodeURIComponent(stableIdentifier(rolloutNo, "rollout-no", 120))}/configure`, PlatformBuildRolloutSchema, {
130
+ method: "POST",
131
+ headers: { "Idempotency-Key": idempotencyKey(key) },
132
+ body: JSON.stringify(parsed.data)
133
+ }, [200]);
134
+ }
135
+ configureRecovery(operation, rolloutNo, input, key) {
136
+ const parsed = PlatformBuildRolloutConfigureRequestSchema.safeParse(input);
137
+ if (!parsed.success) {
138
+ throw new PipelineError(`Platform-build rollout configure recovery input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
139
+ }
140
+ return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts/${encodeURIComponent(stableIdentifier(rolloutNo, "rollout-no", 120))}/configure/${operation}`, PlatformBuildRolloutConfigureActionSchema, {
141
+ method: "POST",
142
+ headers: { "Idempotency-Key": idempotencyKey(key) },
143
+ body: JSON.stringify(parsed.data)
144
+ }, [200]);
145
+ }
146
+ reconcileConfigure(rolloutNo, input, key) {
147
+ return this.configureRecovery("reconcile", rolloutNo, input, key);
148
+ }
149
+ reapplyConfigure(rolloutNo, input, key) {
150
+ return this.configureRecovery("reapply", rolloutNo, input, key);
151
+ }
152
+ }
153
+ //# sourceMappingURL=client.js.map