@kustodian/schema 1.4.0 → 2.0.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.
@@ -0,0 +1,338 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Git reference - exactly one of branch, tag, or commit must be specified.
4
+ */
5
+ export declare const git_ref_schema: z.ZodEffects<z.ZodObject<{
6
+ branch: z.ZodOptional<z.ZodString>;
7
+ tag: z.ZodOptional<z.ZodString>;
8
+ commit: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ branch?: string | undefined;
11
+ tag?: string | undefined;
12
+ commit?: string | undefined;
13
+ }, {
14
+ branch?: string | undefined;
15
+ tag?: string | undefined;
16
+ commit?: string | undefined;
17
+ }>, {
18
+ branch?: string | undefined;
19
+ tag?: string | undefined;
20
+ commit?: string | undefined;
21
+ }, {
22
+ branch?: string | undefined;
23
+ tag?: string | undefined;
24
+ commit?: string | undefined;
25
+ }>;
26
+ export type GitRefType = z.infer<typeof git_ref_schema>;
27
+ /**
28
+ * Git source configuration for fetching templates from a Git repository.
29
+ */
30
+ export declare const git_source_schema: z.ZodObject<{
31
+ url: z.ZodString;
32
+ ref: z.ZodEffects<z.ZodObject<{
33
+ branch: z.ZodOptional<z.ZodString>;
34
+ tag: z.ZodOptional<z.ZodString>;
35
+ commit: z.ZodOptional<z.ZodString>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ branch?: string | undefined;
38
+ tag?: string | undefined;
39
+ commit?: string | undefined;
40
+ }, {
41
+ branch?: string | undefined;
42
+ tag?: string | undefined;
43
+ commit?: string | undefined;
44
+ }>, {
45
+ branch?: string | undefined;
46
+ tag?: string | undefined;
47
+ commit?: string | undefined;
48
+ }, {
49
+ branch?: string | undefined;
50
+ tag?: string | undefined;
51
+ commit?: string | undefined;
52
+ }>;
53
+ path: z.ZodOptional<z.ZodString>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ ref: {
56
+ branch?: string | undefined;
57
+ tag?: string | undefined;
58
+ commit?: string | undefined;
59
+ };
60
+ url: string;
61
+ path?: string | undefined;
62
+ }, {
63
+ ref: {
64
+ branch?: string | undefined;
65
+ tag?: string | undefined;
66
+ commit?: string | undefined;
67
+ };
68
+ url: string;
69
+ path?: string | undefined;
70
+ }>;
71
+ export type GitSourceType = z.infer<typeof git_source_schema>;
72
+ /**
73
+ * HTTP archive source configuration for fetching templates from URLs.
74
+ * Supports tar.gz and zip archives.
75
+ */
76
+ export declare const http_source_schema: z.ZodObject<{
77
+ url: z.ZodString;
78
+ checksum: z.ZodOptional<z.ZodString>;
79
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
80
+ }, "strip", z.ZodTypeAny, {
81
+ url: string;
82
+ checksum?: string | undefined;
83
+ headers?: Record<string, string> | undefined;
84
+ }, {
85
+ url: string;
86
+ checksum?: string | undefined;
87
+ headers?: Record<string, string> | undefined;
88
+ }>;
89
+ export type HttpSourceType = z.infer<typeof http_source_schema>;
90
+ /**
91
+ * OCI artifact source configuration for pulling templates from OCI registries.
92
+ */
93
+ export declare const oci_source_schema: z.ZodEffects<z.ZodObject<{
94
+ registry: z.ZodString;
95
+ repository: z.ZodString;
96
+ tag: z.ZodOptional<z.ZodString>;
97
+ digest: z.ZodOptional<z.ZodString>;
98
+ }, "strip", z.ZodTypeAny, {
99
+ repository: string;
100
+ registry: string;
101
+ tag?: string | undefined;
102
+ digest?: string | undefined;
103
+ }, {
104
+ repository: string;
105
+ registry: string;
106
+ tag?: string | undefined;
107
+ digest?: string | undefined;
108
+ }>, {
109
+ repository: string;
110
+ registry: string;
111
+ tag?: string | undefined;
112
+ digest?: string | undefined;
113
+ }, {
114
+ repository: string;
115
+ registry: string;
116
+ tag?: string | undefined;
117
+ digest?: string | undefined;
118
+ }>;
119
+ export type OciSourceType = z.infer<typeof oci_source_schema>;
120
+ /**
121
+ * Duration format for TTL values.
122
+ * Examples: 30m, 1h, 24h, 7d
123
+ */
124
+ export declare const duration_schema: z.ZodString;
125
+ /**
126
+ * Template source configuration - union of all source types.
127
+ * Exactly one of git, http, or oci must be specified.
128
+ */
129
+ export declare const template_source_schema: z.ZodEffects<z.ZodObject<{
130
+ name: z.ZodString;
131
+ git: z.ZodOptional<z.ZodObject<{
132
+ url: z.ZodString;
133
+ ref: z.ZodEffects<z.ZodObject<{
134
+ branch: z.ZodOptional<z.ZodString>;
135
+ tag: z.ZodOptional<z.ZodString>;
136
+ commit: z.ZodOptional<z.ZodString>;
137
+ }, "strip", z.ZodTypeAny, {
138
+ branch?: string | undefined;
139
+ tag?: string | undefined;
140
+ commit?: string | undefined;
141
+ }, {
142
+ branch?: string | undefined;
143
+ tag?: string | undefined;
144
+ commit?: string | undefined;
145
+ }>, {
146
+ branch?: string | undefined;
147
+ tag?: string | undefined;
148
+ commit?: string | undefined;
149
+ }, {
150
+ branch?: string | undefined;
151
+ tag?: string | undefined;
152
+ commit?: string | undefined;
153
+ }>;
154
+ path: z.ZodOptional<z.ZodString>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ ref: {
157
+ branch?: string | undefined;
158
+ tag?: string | undefined;
159
+ commit?: string | undefined;
160
+ };
161
+ url: string;
162
+ path?: string | undefined;
163
+ }, {
164
+ ref: {
165
+ branch?: string | undefined;
166
+ tag?: string | undefined;
167
+ commit?: string | undefined;
168
+ };
169
+ url: string;
170
+ path?: string | undefined;
171
+ }>>;
172
+ http: z.ZodOptional<z.ZodObject<{
173
+ url: z.ZodString;
174
+ checksum: z.ZodOptional<z.ZodString>;
175
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ url: string;
178
+ checksum?: string | undefined;
179
+ headers?: Record<string, string> | undefined;
180
+ }, {
181
+ url: string;
182
+ checksum?: string | undefined;
183
+ headers?: Record<string, string> | undefined;
184
+ }>>;
185
+ oci: z.ZodOptional<z.ZodEffects<z.ZodObject<{
186
+ registry: z.ZodString;
187
+ repository: z.ZodString;
188
+ tag: z.ZodOptional<z.ZodString>;
189
+ digest: z.ZodOptional<z.ZodString>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ repository: string;
192
+ registry: string;
193
+ tag?: string | undefined;
194
+ digest?: string | undefined;
195
+ }, {
196
+ repository: string;
197
+ registry: string;
198
+ tag?: string | undefined;
199
+ digest?: string | undefined;
200
+ }>, {
201
+ repository: string;
202
+ registry: string;
203
+ tag?: string | undefined;
204
+ digest?: string | undefined;
205
+ }, {
206
+ repository: string;
207
+ registry: string;
208
+ tag?: string | undefined;
209
+ digest?: string | undefined;
210
+ }>>;
211
+ ttl: z.ZodOptional<z.ZodString>;
212
+ }, "strip", z.ZodTypeAny, {
213
+ name: string;
214
+ oci?: {
215
+ repository: string;
216
+ registry: string;
217
+ tag?: string | undefined;
218
+ digest?: string | undefined;
219
+ } | undefined;
220
+ git?: {
221
+ ref: {
222
+ branch?: string | undefined;
223
+ tag?: string | undefined;
224
+ commit?: string | undefined;
225
+ };
226
+ url: string;
227
+ path?: string | undefined;
228
+ } | undefined;
229
+ http?: {
230
+ url: string;
231
+ checksum?: string | undefined;
232
+ headers?: Record<string, string> | undefined;
233
+ } | undefined;
234
+ ttl?: string | undefined;
235
+ }, {
236
+ name: string;
237
+ oci?: {
238
+ repository: string;
239
+ registry: string;
240
+ tag?: string | undefined;
241
+ digest?: string | undefined;
242
+ } | undefined;
243
+ git?: {
244
+ ref: {
245
+ branch?: string | undefined;
246
+ tag?: string | undefined;
247
+ commit?: string | undefined;
248
+ };
249
+ url: string;
250
+ path?: string | undefined;
251
+ } | undefined;
252
+ http?: {
253
+ url: string;
254
+ checksum?: string | undefined;
255
+ headers?: Record<string, string> | undefined;
256
+ } | undefined;
257
+ ttl?: string | undefined;
258
+ }>, {
259
+ name: string;
260
+ oci?: {
261
+ repository: string;
262
+ registry: string;
263
+ tag?: string | undefined;
264
+ digest?: string | undefined;
265
+ } | undefined;
266
+ git?: {
267
+ ref: {
268
+ branch?: string | undefined;
269
+ tag?: string | undefined;
270
+ commit?: string | undefined;
271
+ };
272
+ url: string;
273
+ path?: string | undefined;
274
+ } | undefined;
275
+ http?: {
276
+ url: string;
277
+ checksum?: string | undefined;
278
+ headers?: Record<string, string> | undefined;
279
+ } | undefined;
280
+ ttl?: string | undefined;
281
+ }, {
282
+ name: string;
283
+ oci?: {
284
+ repository: string;
285
+ registry: string;
286
+ tag?: string | undefined;
287
+ digest?: string | undefined;
288
+ } | undefined;
289
+ git?: {
290
+ ref: {
291
+ branch?: string | undefined;
292
+ tag?: string | undefined;
293
+ commit?: string | undefined;
294
+ };
295
+ url: string;
296
+ path?: string | undefined;
297
+ } | undefined;
298
+ http?: {
299
+ url: string;
300
+ checksum?: string | undefined;
301
+ headers?: Record<string, string> | undefined;
302
+ } | undefined;
303
+ ttl?: string | undefined;
304
+ }>;
305
+ export type TemplateSourceType = z.infer<typeof template_source_schema>;
306
+ /**
307
+ * Type guard for Git sources.
308
+ */
309
+ export declare function is_git_source(source: TemplateSourceType): source is TemplateSourceType & {
310
+ git: GitSourceType;
311
+ };
312
+ /**
313
+ * Type guard for HTTP sources.
314
+ */
315
+ export declare function is_http_source(source: TemplateSourceType): source is TemplateSourceType & {
316
+ http: HttpSourceType;
317
+ };
318
+ /**
319
+ * Type guard for OCI sources.
320
+ */
321
+ export declare function is_oci_source(source: TemplateSourceType): source is TemplateSourceType & {
322
+ oci: OciSourceType;
323
+ };
324
+ /**
325
+ * Determines if a source reference is mutable (requires TTL-based refresh).
326
+ * - Git branches: mutable
327
+ * - Git tags/commits: immutable
328
+ * - HTTP with checksum: immutable
329
+ * - HTTP without checksum: mutable
330
+ * - OCI 'latest' tag: mutable
331
+ * - OCI other tags/digests: immutable
332
+ */
333
+ export declare function is_mutable_source(source: TemplateSourceType): boolean;
334
+ /**
335
+ * Validates a template source object and returns the result.
336
+ */
337
+ export declare function validate_template_source(data: unknown): z.SafeParseReturnType<unknown, TemplateSourceType>;
338
+ //# sourceMappingURL=sources.d.ts.map
@@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