@viaalink/caddy-api-client 0.0.0-stage → 0.10.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,336 @@
1
+ import * as zod from 'zod';
2
+
3
+ /**
4
+ * Provider implements the libdns interfaces for Route53.
5
+ * By default, the provider loads the AWS configuration from the environment.
6
+ * To override these values, set the fields in the Provider struct.
7
+ */
8
+ interface Provider$3 {
9
+ /**
10
+ * Region is the AWS Region to use. If not set, it will use AWS_REGION
11
+ * environment variable.
12
+ */
13
+ region?: string;
14
+ /**
15
+ * AWSProfile is the AWS Profile to use. If not set, it will use
16
+ * AWS_PROFILE environment variable.
17
+ */
18
+ profile?: string;
19
+ /**
20
+ * AccessKeyId is the AWS Access Key ID to use. If not set, it will use
21
+ * AWS_ACCESS_KEY_ID
22
+ */
23
+ access_key_id?: string;
24
+ /**
25
+ * SecretAccessKey is the AWS Secret Access Key to use. If not set, it will use
26
+ * AWS_SECRET_ACCESS_KEY environment variable.
27
+ */
28
+ secret_access_key?: string;
29
+ /**
30
+ * SessionToken is the AWS Session Token to use. If not set, it will use
31
+ * AWS_SESSION_TOKEN environment variable.
32
+ */
33
+ session_token?: string;
34
+ /**
35
+ * MaxRetries is the maximum number of retries to make when a request
36
+ * fails. If not set, it will use 5 retries.
37
+ */
38
+ max_retries?: number;
39
+ /**
40
+ * Route53MaxWait is the maximum amount of time to wait for a record
41
+ * to be propagated within AWS infrastructure. Default is 1 minute.
42
+ */
43
+ route53_max_wait?: number;
44
+ /**
45
+ * WaitForRoute53Sync if set to true, it will wait for the record to be
46
+ * propagated within AWS infrastructure before returning. This is not related
47
+ * to DNS propagation, that could take much longer.
48
+ */
49
+ wait_for_route53_sync?: boolean;
50
+ /**
51
+ * SkipRoute53SyncOnDelete if set to true, it will skip waiting for Route53
52
+ * synchronization when deleting records, even if WaitForRoute53Sync is true.
53
+ * This can speed up bulk delete operations where waiting is not necessary.
54
+ */
55
+ skip_route53_sync_on_delete?: boolean;
56
+ /**
57
+ * HostedZoneID is the ID of the hosted zone to use. If not set, it will
58
+ * be discovered from the zone name.
59
+ * This option should contain only the ID; the "/hostedzone/" prefix
60
+ * will be added automatically.
61
+ */
62
+ hosted_zone_id?: string;
63
+ }
64
+
65
+ /**
66
+ * Provider facilitates DNS record manipulation with Porkbun.
67
+ */
68
+ interface Provider$2 {
69
+ api_key?: string;
70
+ api_secret_key?: string;
71
+ }
72
+
73
+ /**
74
+ * Provider implements the libdns interfaces for Cloudflare.
75
+ * TODO: Support retries and handle rate limits.
76
+ */
77
+ interface Provider$1 {
78
+ /**
79
+ * API tokens are used for authentication. Make sure to use
80
+ * scoped API **tokens**, NOT a global API **key**.
81
+ */
82
+ api_token?: string;
83
+ zone_token?: string;
84
+ }
85
+
86
+ /**
87
+ * Provider godaddy dns provider
88
+ */
89
+ interface Provider {
90
+ api_token?: string;
91
+ }
92
+
93
+ /**
94
+ * caddy-dns plugin types
95
+ *
96
+ * Typed `providerConfig` shapes for the `caddy-dns/*` ACME-DNS challenge
97
+ * provider modules, layered on top of {@link buildAcmeDnsPolicy} in
98
+ * `src/caddy/acme.ts` (which only builds the wrapper shape and treats
99
+ * `providerConfig` as an opaque passthrough).
100
+ *
101
+ * As of 0.9.0, these types are sourced from real vendored Go source (not
102
+ * READMEs) via the same tygo pipeline `caddy-security` uses — see
103
+ * `DEPENDENCIES.md`'s "DNS Provider Plugins" section for exact
104
+ * versions/commits, and `src/generated/plugins/caddy-dns-*.ts` for the
105
+ * machine-generated base types this module re-exports/composes.
106
+ *
107
+ * @see https://github.com/caddy-dns
108
+ * @see ../../caddy/acme.ts
109
+ */
110
+
111
+ /**
112
+ * `caddy-dns/digitalocean` provider config.
113
+ *
114
+ * Hand-picked rather than re-exported: the generated `Provider` interface
115
+ * (`src/generated/plugins/caddy-dns-digitalocean.ts`) also carries a
116
+ * `Client` field — a tygo artifact from Go's anonymous embedding of an
117
+ * all-unexported `Client` struct, which contributes nothing to the real
118
+ * JSON output (Go's `encoding/json` never emits an anonymous embed with no
119
+ * exported fields as a nested key).
120
+ */
121
+ interface DigitaloceanDnsProviderConfig {
122
+ auth_token: string;
123
+ }
124
+ /**
125
+ * `caddy-dns/route53` provider config.
126
+ *
127
+ * Real fields span two Go modules: `libdns/route53` (the 10 fields below,
128
+ * from the generated `Provider` in `caddy-dns-route53-libdns.ts`) plus
129
+ * `caddy-dns/route53`'s own extra `debug_logging` field (from
130
+ * `caddy-dns-route53-wrapper.ts`). Composed by hand since tygo can't follow
131
+ * the wrapper's cross-module pointer embed (`*route53.Provider`)
132
+ * automatically — see `local/caddy-dns-route53/tygo.yaml`.
133
+ *
134
+ * All fields are optional: `caddy-dns/route53` falls back to the AWS Go
135
+ * SDK v2's own default credential chain (env vars, shared profile, or IAM
136
+ * role) for anything not explicitly set here.
137
+ */
138
+ interface Route53DnsProviderConfig extends Provider$3 {
139
+ /**
140
+ * Forwards structured events from libdns/route53 (zone resolution,
141
+ * change submission, sync waits) to Caddy's logger. Emits at Debug level
142
+ * except for ambiguous-zone warnings — set Caddy's log level to debug to
143
+ * actually see them.
144
+ */
145
+ debug_logging?: boolean;
146
+ }
147
+ /**
148
+ * Known `dnsProvider` names with a typed builder in this module.
149
+ */
150
+ declare const KNOWN_ACME_DNS_PROVIDERS: readonly ["porkbun", "cloudflare", "route53", "digitalocean", "godaddy"];
151
+ type KnownAcmeDnsProvider = (typeof KNOWN_ACME_DNS_PROVIDERS)[number];
152
+ /**
153
+ * Result of building a provider's DNS-01 config: the typed
154
+ * `providerConfig` to pass through to
155
+ * {@link buildAcmeDnsPolicy}`.providerConfig`, plus the env var names the
156
+ * caller should ensure are set (names only — never values).
157
+ */
158
+ interface AcmeDnsProviderConfigResult {
159
+ /**
160
+ * Omitted for providers (e.g. `route53` when called with no explicit
161
+ * `options`) that resolve credentials outside of `providerConfig`
162
+ * entirely.
163
+ */
164
+ providerConfig?: Record<string, unknown>;
165
+ /** Env var names referenced by `providerConfig`'s `{env.VAR}` placeholders (or, for `route53`'s default zero-arg call, consumed directly by the AWS SDK's credential chain). */
166
+ envVars: string[];
167
+ }
168
+
169
+ /** {@link PorkbunDnsProviderConfig} schema. Exact match to the generated schema. */
170
+ declare const PorkbunDnsProviderConfigSchema: zod.ZodObject<{
171
+ api_key: zod.ZodOptional<zod.ZodString>;
172
+ api_secret_key: zod.ZodOptional<zod.ZodString>;
173
+ }, "strip", zod.ZodTypeAny, {
174
+ api_key?: string | undefined;
175
+ api_secret_key?: string | undefined;
176
+ }, {
177
+ api_key?: string | undefined;
178
+ api_secret_key?: string | undefined;
179
+ }>;
180
+ /** {@link CloudflareDnsProviderConfig} schema. Exact match to the generated schema (includes optional `zone_token`). */
181
+ declare const CloudflareDnsProviderConfigSchema: zod.ZodObject<{
182
+ api_token: zod.ZodOptional<zod.ZodString>;
183
+ zone_token: zod.ZodOptional<zod.ZodString>;
184
+ }, "strip", zod.ZodTypeAny, {
185
+ api_token?: string | undefined;
186
+ zone_token?: string | undefined;
187
+ }, {
188
+ api_token?: string | undefined;
189
+ zone_token?: string | undefined;
190
+ }>;
191
+ /** {@link GodaddyDnsProviderConfig} schema. Exact match to the generated schema. */
192
+ declare const GodaddyDnsProviderConfigSchema: zod.ZodObject<{
193
+ api_token: zod.ZodOptional<zod.ZodString>;
194
+ }, "strip", zod.ZodTypeAny, {
195
+ api_token?: string | undefined;
196
+ }, {
197
+ api_token?: string | undefined;
198
+ }>;
199
+ /**
200
+ * {@link DigitaloceanDnsProviderConfig} schema.
201
+ *
202
+ * Omits the generated schema's `Client` field — a tygo artifact from an
203
+ * all-unexported Go embed that contributes nothing to real JSON output. See
204
+ * the equivalent note on {@link DigitaloceanDnsProviderConfig} in `types.ts`.
205
+ */
206
+ declare const DigitaloceanDnsProviderConfigSchema: zod.ZodObject<Omit<{
207
+ Client: zod.ZodObject<{}, "strip", zod.ZodTypeAny, {}, {}>;
208
+ auth_token: zod.ZodString;
209
+ }, "Client">, "strip", zod.ZodTypeAny, {
210
+ auth_token: string;
211
+ }, {
212
+ auth_token: string;
213
+ }>;
214
+
215
+ /**
216
+ * Build the `caddy-dns/porkbun` provider config.
217
+ *
218
+ * @example
219
+ * buildPorkbunDnsConfig()
220
+ * // => { providerConfig: { api_key: "{env.PORKBUN_API_KEY}", api_secret_key: "{env.PORKBUN_API_SECRET_KEY}" }, envVars: ["PORKBUN_API_KEY", "PORKBUN_API_SECRET_KEY"] }
221
+ */
222
+ declare function buildPorkbunDnsConfig(): AcmeDnsProviderConfigResult;
223
+ /**
224
+ * Build the `caddy-dns/cloudflare` provider config.
225
+ *
226
+ * @example
227
+ * buildCloudflareDnsConfig()
228
+ * // => { providerConfig: { api_token: "{env.CLOUDFLARE_API_TOKEN}" }, envVars: ["CLOUDFLARE_API_TOKEN"] }
229
+ */
230
+ declare function buildCloudflareDnsConfig(): AcmeDnsProviderConfigResult;
231
+ /**
232
+ * Build the `caddy-dns/route53` config.
233
+ *
234
+ * Called with no `options` (the default), `caddy-dns/route53` reads
235
+ * credentials via the AWS Go SDK v2's own default credential chain (env
236
+ * vars, shared profile, or IAM role) — `providerConfig` is omitted rather
237
+ * than reimplementing that resolution, exactly as before 0.9.0.
238
+ *
239
+ * The plugin also supports an explicit typed `providerConfig` (real,
240
+ * verified Go source — see {@link Route53DnsProviderConfig}) for callers
241
+ * who want it instead of relying on ambient credentials: pass any subset of
242
+ * fields via `options` and they're returned as `providerConfig`.
243
+ *
244
+ * @example
245
+ * buildRoute53DnsConfig()
246
+ * // => { envVars: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_REGION"] }
247
+ *
248
+ * @example
249
+ * buildRoute53DnsConfig({ hosted_zone_id: "Z1D633PJN98FT9", region: "us-east-1" })
250
+ * // => { providerConfig: { hosted_zone_id: "Z1D633PJN98FT9", region: "us-east-1" }, envVars: [...] }
251
+ */
252
+ declare function buildRoute53DnsConfig(options?: Route53DnsProviderConfig): AcmeDnsProviderConfigResult;
253
+ /**
254
+ * Build the `caddy-dns/digitalocean` provider config.
255
+ *
256
+ * @example
257
+ * buildDigitaloceanDnsConfig()
258
+ * // => { providerConfig: { auth_token: "{env.DIGITALOCEAN_API_TOKEN}" }, envVars: ["DIGITALOCEAN_API_TOKEN"] }
259
+ */
260
+ declare function buildDigitaloceanDnsConfig(): AcmeDnsProviderConfigResult;
261
+ /**
262
+ * Build the `caddy-dns/godaddy` provider config.
263
+ *
264
+ * `GODADDY_API_TOKEN` must hold GoDaddy's own combined
265
+ * `"<API_KEY>:<API_SECRET>"` format — see {@link GodaddyDnsProviderConfig}.
266
+ *
267
+ * @example
268
+ * buildGodaddyDnsConfig()
269
+ * // => { providerConfig: { api_token: "{env.GODADDY_API_TOKEN}" }, envVars: ["GODADDY_API_TOKEN"] }
270
+ */
271
+ declare function buildGodaddyDnsConfig(): AcmeDnsProviderConfigResult;
272
+ /**
273
+ * Resolve a `dnsProvider` name (as passed to
274
+ * {@link buildAcmeDnsPolicy}`.dnsProvider`) to its typed provider config,
275
+ * via the same normalisation `buildAcmeDnsPolicy` itself uses.
276
+ *
277
+ * Unknown provider names return `{ envVars: [] }` — no typed builder
278
+ * exists yet, so the caller must supply `providerConfig` themselves (e.g.
279
+ * via the raw `providerConfig` passthrough on `buildAcmeDnsPolicy`).
280
+ *
281
+ * @example
282
+ * buildAcmeDnsPolicy({
283
+ * subjects: ["example.com", "*.example.com"],
284
+ * dnsProvider: "cloudflare",
285
+ * providerConfig: buildAcmeDnsProviderConfig("cloudflare").providerConfig,
286
+ * });
287
+ */
288
+ declare function buildAcmeDnsProviderConfig(provider: string): AcmeDnsProviderConfigResult;
289
+
290
+ /**
291
+ * caddy-dns plugin integration
292
+ *
293
+ * Typed `providerConfig` builders for the `caddy-dns/*` ACME-DNS challenge
294
+ * provider modules — porkbun, cloudflare, route53, digitalocean, godaddy —
295
+ * layered on top of `buildAcmeDnsPolicy` (`../caddy/acme.js`), which only
296
+ * builds the wrapper shape and treats `providerConfig` as an opaque
297
+ * passthrough.
298
+ *
299
+ * @see https://github.com/caddy-dns
300
+ * @see ../caddy/acme.ts
301
+ *
302
+ * @example
303
+ * ```typescript
304
+ * import { buildAcmeDnsPolicy } from "@viaalink/caddy-api-client/caddy";
305
+ * import { buildAcmeDnsProviderConfig } from "@viaalink/caddy-api-client/plugins/caddy-dns";
306
+ *
307
+ * const { providerConfig } = buildAcmeDnsProviderConfig("cloudflare");
308
+ * const policy = buildAcmeDnsPolicy({
309
+ * subjects: ["example.com", "*.example.com"],
310
+ * dnsProvider: "cloudflare",
311
+ * providerConfig,
312
+ * });
313
+ * ```
314
+ *
315
+ * @packageDocumentation
316
+ */
317
+
318
+ type index_AcmeDnsProviderConfigResult = AcmeDnsProviderConfigResult;
319
+ declare const index_CloudflareDnsProviderConfigSchema: typeof CloudflareDnsProviderConfigSchema;
320
+ type index_DigitaloceanDnsProviderConfig = DigitaloceanDnsProviderConfig;
321
+ declare const index_DigitaloceanDnsProviderConfigSchema: typeof DigitaloceanDnsProviderConfigSchema;
322
+ declare const index_GodaddyDnsProviderConfigSchema: typeof GodaddyDnsProviderConfigSchema;
323
+ declare const index_KNOWN_ACME_DNS_PROVIDERS: typeof KNOWN_ACME_DNS_PROVIDERS;
324
+ type index_KnownAcmeDnsProvider = KnownAcmeDnsProvider;
325
+ declare const index_PorkbunDnsProviderConfigSchema: typeof PorkbunDnsProviderConfigSchema;
326
+ declare const index_buildAcmeDnsProviderConfig: typeof buildAcmeDnsProviderConfig;
327
+ declare const index_buildCloudflareDnsConfig: typeof buildCloudflareDnsConfig;
328
+ declare const index_buildDigitaloceanDnsConfig: typeof buildDigitaloceanDnsConfig;
329
+ declare const index_buildGodaddyDnsConfig: typeof buildGodaddyDnsConfig;
330
+ declare const index_buildPorkbunDnsConfig: typeof buildPorkbunDnsConfig;
331
+ declare const index_buildRoute53DnsConfig: typeof buildRoute53DnsConfig;
332
+ declare namespace index {
333
+ export { type index_AcmeDnsProviderConfigResult as AcmeDnsProviderConfigResult, type Provider$1 as CloudflareDnsProviderConfig, index_CloudflareDnsProviderConfigSchema as CloudflareDnsProviderConfigSchema, type index_DigitaloceanDnsProviderConfig as DigitaloceanDnsProviderConfig, index_DigitaloceanDnsProviderConfigSchema as DigitaloceanDnsProviderConfigSchema, type Provider as GodaddyDnsProviderConfig, index_GodaddyDnsProviderConfigSchema as GodaddyDnsProviderConfigSchema, index_KNOWN_ACME_DNS_PROVIDERS as KNOWN_ACME_DNS_PROVIDERS, type index_KnownAcmeDnsProvider as KnownAcmeDnsProvider, type Provider$2 as PorkbunDnsProviderConfig, index_PorkbunDnsProviderConfigSchema as PorkbunDnsProviderConfigSchema, index_buildAcmeDnsProviderConfig as buildAcmeDnsProviderConfig, index_buildCloudflareDnsConfig as buildCloudflareDnsConfig, index_buildDigitaloceanDnsConfig as buildDigitaloceanDnsConfig, index_buildGodaddyDnsConfig as buildGodaddyDnsConfig, index_buildPorkbunDnsConfig as buildPorkbunDnsConfig, index_buildRoute53DnsConfig as buildRoute53DnsConfig };
334
+ }
335
+
336
+ export { type AcmeDnsProviderConfigResult as A, CloudflareDnsProviderConfigSchema as C, type DigitaloceanDnsProviderConfig as D, GodaddyDnsProviderConfigSchema as G, type KnownAcmeDnsProvider as K, type Provider$2 as P, type Provider$1 as a, type Provider as b, KNOWN_ACME_DNS_PROVIDERS as c, PorkbunDnsProviderConfigSchema as d, DigitaloceanDnsProviderConfigSchema as e, buildPorkbunDnsConfig as f, buildCloudflareDnsConfig as g, buildRoute53DnsConfig as h, index as i, buildDigitaloceanDnsConfig as j, buildGodaddyDnsConfig as k, buildAcmeDnsProviderConfig as l };