domainkit 0.20.0 → 0.21.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/README.md +32 -1
- package/dist/Cloudflare.mjs +19 -10
- package/dist/Cloudflare.mjs.map +1 -1
- package/dist/Connect.mjs +30 -10
- package/dist/Connect.mjs.map +1 -1
- package/dist/Provider.mjs.map +1 -1
- package/dist/Server.mjs +121 -22
- package/dist/Server.mjs.map +1 -1
- package/dist/Vercel.mjs +20 -10
- package/dist/Vercel.mjs.map +1 -1
- package/dist/Verify.mjs +4 -3
- package/dist/Verify.mjs.map +1 -1
- package/dist/entry/client.mjs +1 -2
- package/dist/entry/server.mjs +1 -2
- package/dist/internal/callback.mjs +13 -0
- package/dist/internal/callback.mjs.map +1 -0
- package/dist/internal/config.mjs +19 -5
- package/dist/internal/config.mjs.map +1 -1
- package/dist/internal/provider-async.mjs +2 -0
- package/dist/internal/provider-async.mjs.map +1 -1
- package/dist/package.mjs +1 -1
- package/dist/types/Connect.d.ts +134 -0
- package/dist/types/Provider.d.ts +9 -0
- package/dist/types/Server.d.ts +45 -0
- package/dist/types/Verify.d.ts +5 -1
- package/dist/types/internal/callback.d.ts +4 -0
- package/dist/types/internal/config.d.ts +8 -1
- package/dist/types/internal/provider-async.d.ts +2 -0
- package/package.json +10 -10
package/dist/types/Connect.d.ts
CHANGED
|
@@ -233,6 +233,113 @@ export declare const Started: {
|
|
|
233
233
|
readonly candidates: ReadonlyArray<Provider.Target>;
|
|
234
234
|
}, "_tag">;
|
|
235
235
|
};
|
|
236
|
+
/** A verified completion result. Errors stay on the server; do not serialize them to a browser. */
|
|
237
|
+
export type Completion = Data.TaggedEnum<{
|
|
238
|
+
Connected: {
|
|
239
|
+
readonly started: Exclude<Started, {
|
|
240
|
+
readonly _tag: "Redirect";
|
|
241
|
+
}>;
|
|
242
|
+
};
|
|
243
|
+
Cancelled: {
|
|
244
|
+
readonly error: Errors.DomainKitError;
|
|
245
|
+
};
|
|
246
|
+
Failed: {
|
|
247
|
+
readonly error: Errors.DomainKitError;
|
|
248
|
+
readonly recovery: "restart" | "inspect";
|
|
249
|
+
};
|
|
250
|
+
}>;
|
|
251
|
+
export declare const Completion: {
|
|
252
|
+
readonly $is: <Tag extends "Cancelled" | "Connected" | "Failed">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
253
|
+
readonly _tag: "Cancelled";
|
|
254
|
+
readonly error: Errors.DomainKitError;
|
|
255
|
+
}, {
|
|
256
|
+
readonly _tag: Tag;
|
|
257
|
+
}> | Extract<{
|
|
258
|
+
readonly _tag: "Connected";
|
|
259
|
+
readonly started: Exclude<Started, {
|
|
260
|
+
readonly _tag: "Redirect";
|
|
261
|
+
}>;
|
|
262
|
+
}, {
|
|
263
|
+
readonly _tag: Tag;
|
|
264
|
+
}> | Extract<{
|
|
265
|
+
readonly _tag: "Failed";
|
|
266
|
+
readonly error: Errors.DomainKitError;
|
|
267
|
+
readonly recovery: "restart" | "inspect";
|
|
268
|
+
}, {
|
|
269
|
+
readonly _tag: Tag;
|
|
270
|
+
}>;
|
|
271
|
+
readonly $match: {
|
|
272
|
+
<Cases extends { readonly [Tag in "Cancelled" | "Connected" | "Failed"]: (args: Extract<{
|
|
273
|
+
readonly _tag: "Cancelled";
|
|
274
|
+
readonly error: Errors.DomainKitError;
|
|
275
|
+
} | {
|
|
276
|
+
readonly _tag: "Connected";
|
|
277
|
+
readonly started: Exclude<Started, {
|
|
278
|
+
readonly _tag: "Redirect";
|
|
279
|
+
}>;
|
|
280
|
+
} | {
|
|
281
|
+
readonly _tag: "Failed";
|
|
282
|
+
readonly error: Errors.DomainKitError;
|
|
283
|
+
readonly recovery: "restart" | "inspect";
|
|
284
|
+
}, {
|
|
285
|
+
readonly _tag: Tag;
|
|
286
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
287
|
+
readonly _tag: "Cancelled";
|
|
288
|
+
readonly error: Errors.DomainKitError;
|
|
289
|
+
} | {
|
|
290
|
+
readonly _tag: "Connected";
|
|
291
|
+
readonly started: Exclude<Started, {
|
|
292
|
+
readonly _tag: "Redirect";
|
|
293
|
+
}>;
|
|
294
|
+
} | {
|
|
295
|
+
readonly _tag: "Failed";
|
|
296
|
+
readonly error: Errors.DomainKitError;
|
|
297
|
+
readonly recovery: "restart" | "inspect";
|
|
298
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["Cancelled" | "Connected" | "Failed"]>>;
|
|
299
|
+
<Cases extends { readonly [Tag in "Cancelled" | "Connected" | "Failed"]: (args: Extract<{
|
|
300
|
+
readonly _tag: "Cancelled";
|
|
301
|
+
readonly error: Errors.DomainKitError;
|
|
302
|
+
} | {
|
|
303
|
+
readonly _tag: "Connected";
|
|
304
|
+
readonly started: Exclude<Started, {
|
|
305
|
+
readonly _tag: "Redirect";
|
|
306
|
+
}>;
|
|
307
|
+
} | {
|
|
308
|
+
readonly _tag: "Failed";
|
|
309
|
+
readonly error: Errors.DomainKitError;
|
|
310
|
+
readonly recovery: "restart" | "inspect";
|
|
311
|
+
}, {
|
|
312
|
+
readonly _tag: Tag;
|
|
313
|
+
}>) => any; }>(value: {
|
|
314
|
+
readonly _tag: "Cancelled";
|
|
315
|
+
readonly error: Errors.DomainKitError;
|
|
316
|
+
} | {
|
|
317
|
+
readonly _tag: "Connected";
|
|
318
|
+
readonly started: Exclude<Started, {
|
|
319
|
+
readonly _tag: "Redirect";
|
|
320
|
+
}>;
|
|
321
|
+
} | {
|
|
322
|
+
readonly _tag: "Failed";
|
|
323
|
+
readonly error: Errors.DomainKitError;
|
|
324
|
+
readonly recovery: "restart" | "inspect";
|
|
325
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Cancelled" | "Connected" | "Failed"]>>;
|
|
326
|
+
};
|
|
327
|
+
readonly Cancelled: Data.TaggedEnum.ConstructorFrom<{
|
|
328
|
+
readonly _tag: "Cancelled";
|
|
329
|
+
readonly error: Errors.DomainKitError;
|
|
330
|
+
}, "_tag">;
|
|
331
|
+
readonly Connected: Data.TaggedEnum.ConstructorFrom<{
|
|
332
|
+
readonly _tag: "Connected";
|
|
333
|
+
readonly started: Exclude<Started, {
|
|
334
|
+
readonly _tag: "Redirect";
|
|
335
|
+
}>;
|
|
336
|
+
}, "_tag">;
|
|
337
|
+
readonly Failed: Data.TaggedEnum.ConstructorFrom<{
|
|
338
|
+
readonly _tag: "Failed";
|
|
339
|
+
readonly error: Errors.DomainKitError;
|
|
340
|
+
readonly recovery: "restart" | "inspect";
|
|
341
|
+
}, "_tag">;
|
|
342
|
+
};
|
|
236
343
|
/** `attach` either attached the domain or needs the caller to pick a zone. */
|
|
237
344
|
export type Selection = Data.TaggedEnum<{
|
|
238
345
|
SelectionRequired: {
|
|
@@ -477,6 +584,16 @@ export interface Interface {
|
|
|
477
584
|
readonly continuationId: string;
|
|
478
585
|
readonly callbackUrl: string;
|
|
479
586
|
}) => Fx<Started>;
|
|
587
|
+
/**
|
|
588
|
+
* Classify only after live owner/actor verification inside the completion lock. Optional
|
|
589
|
+
* `provider` binds the flow to a mounted route. Invalid flows fail without an outcome.
|
|
590
|
+
* Cancellation and failure leave the continuation retryable; persistence is not atomic.
|
|
591
|
+
*/
|
|
592
|
+
readonly completeOutcome: (input: {
|
|
593
|
+
readonly continuationId: string;
|
|
594
|
+
readonly callbackUrl: string;
|
|
595
|
+
readonly provider?: string;
|
|
596
|
+
}) => Fx<Completion>;
|
|
480
597
|
readonly attach: (input: {
|
|
481
598
|
readonly connectionId: string;
|
|
482
599
|
readonly domain: string;
|
|
@@ -586,6 +703,23 @@ export declare const complete: (input: {
|
|
|
586
703
|
readonly connection: Storage.Connection;
|
|
587
704
|
readonly candidates: ReadonlyArray<Provider.Target>;
|
|
588
705
|
}, Errors.DomainKitError, Principal.Service | Service>;
|
|
706
|
+
export declare const completeOutcome: (input: {
|
|
707
|
+
readonly continuationId: string;
|
|
708
|
+
readonly callbackUrl: string;
|
|
709
|
+
readonly provider?: string;
|
|
710
|
+
}) => Effect.Effect<{
|
|
711
|
+
readonly _tag: "Cancelled";
|
|
712
|
+
readonly error: Errors.DomainKitError;
|
|
713
|
+
} | {
|
|
714
|
+
readonly _tag: "Connected";
|
|
715
|
+
readonly started: Exclude<Started, {
|
|
716
|
+
readonly _tag: "Redirect";
|
|
717
|
+
}>;
|
|
718
|
+
} | {
|
|
719
|
+
readonly _tag: "Failed";
|
|
720
|
+
readonly error: Errors.DomainKitError;
|
|
721
|
+
readonly recovery: "restart" | "inspect";
|
|
722
|
+
}, Errors.DomainKitError, Principal.Service | Service>;
|
|
589
723
|
export declare const attach: (input: {
|
|
590
724
|
readonly connectionId: string;
|
|
591
725
|
readonly domain: string;
|
package/dist/types/Provider.d.ts
CHANGED
|
@@ -189,6 +189,11 @@ export interface CallbackInput {
|
|
|
189
189
|
readonly params: Readonly<Record<string, string>>;
|
|
190
190
|
}
|
|
191
191
|
export interface OAuthAuth {
|
|
192
|
+
/** Optional setup requirements; absence makes offline registration settings unsupported. */
|
|
193
|
+
readonly registration?: {
|
|
194
|
+
readonly clientAuth: "none" | "client_secret_basic" | "client_secret_post";
|
|
195
|
+
readonly pkce: "S256";
|
|
196
|
+
};
|
|
192
197
|
readonly label: string;
|
|
193
198
|
readonly scopes: ReadonlyArray<string>;
|
|
194
199
|
readonly start: (input: {
|
|
@@ -206,6 +211,10 @@ export interface OAuthAuth {
|
|
|
206
211
|
}
|
|
207
212
|
/** Marketplace-style installs (Vercel integrations) that redirect but are not OAuth. */
|
|
208
213
|
export interface IntegrationAuth {
|
|
214
|
+
/** Authentication used by the integration code exchange, without credentials. */
|
|
215
|
+
readonly registration?: {
|
|
216
|
+
readonly clientAuth: "client_secret_post";
|
|
217
|
+
};
|
|
209
218
|
readonly label: string;
|
|
210
219
|
readonly start: (input: {
|
|
211
220
|
readonly state: string;
|
package/dist/types/Server.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ import * as DnsRecord from "./DnsRecord.ts";
|
|
|
24
24
|
import * as Errors from "./internal/error.ts";
|
|
25
25
|
import * as Plan from "./Plan.ts";
|
|
26
26
|
import * as Principal from "./Principal.ts";
|
|
27
|
+
import type * as Provider from "./Provider.ts";
|
|
27
28
|
import * as Providers from "./Providers.ts";
|
|
28
29
|
import * as Provision from "./Provision.ts";
|
|
29
30
|
import * as Reason from "./Reason.ts";
|
|
@@ -11393,6 +11394,23 @@ export declare const group: HttpApiGroup.HttpApiGroup<"domainkit", HttpApiEndpoi
|
|
|
11393
11394
|
export type Group = typeof group;
|
|
11394
11395
|
/** Every route in the group, by name; what `Identity.authorize` is asked about. */
|
|
11395
11396
|
export type EndpointName = HttpApiGroup.Endpoints<Group>["identifier"];
|
|
11397
|
+
/** Browser-safe summaries of an authenticated live callback. Connected is not DNS readiness. */
|
|
11398
|
+
export declare const CallbackOutcome: Schema.Union<readonly [Schema.Struct<{
|
|
11399
|
+
readonly _tag: Schema.Literal<"Connected">;
|
|
11400
|
+
readonly provider: Schema.String;
|
|
11401
|
+
readonly connectionId: Schema.String;
|
|
11402
|
+
readonly returnTo: Schema.String;
|
|
11403
|
+
}>, Schema.Struct<{
|
|
11404
|
+
readonly _tag: Schema.Literal<"Cancelled">;
|
|
11405
|
+
readonly provider: Schema.String;
|
|
11406
|
+
readonly returnTo: Schema.String;
|
|
11407
|
+
}>, Schema.Struct<{
|
|
11408
|
+
readonly _tag: Schema.Literal<"Failed">;
|
|
11409
|
+
readonly provider: Schema.String;
|
|
11410
|
+
readonly returnTo: Schema.String;
|
|
11411
|
+
readonly recovery: Schema.Literals<readonly ["restart", "inspect"]>;
|
|
11412
|
+
}>]>;
|
|
11413
|
+
export type CallbackOutcome = typeof CallbackOutcome.Type;
|
|
11396
11414
|
export interface Options {
|
|
11397
11415
|
/**
|
|
11398
11416
|
* Where the callback route is reachable from the provider, without the `/callback/:provider`
|
|
@@ -11401,7 +11419,34 @@ export interface Options {
|
|
|
11401
11419
|
readonly callbackBaseUrl?: string;
|
|
11402
11420
|
/** Where interactive flows return when the callback carries no `returnTo`. */
|
|
11403
11421
|
readonly defaultReturnTo?: string;
|
|
11422
|
+
/**
|
|
11423
|
+
* Opt in to a same-origin destination, or return undefined to keep default behavior. Invoked
|
|
11424
|
+
* only for a verified live flow; no request, state, code, secrets, or storage rows reach this
|
|
11425
|
+
* policy. Close over acquired host services; its Effect requires no environment.
|
|
11426
|
+
* A policy failure after Connected cannot undo persistence: inspect before restarting.
|
|
11427
|
+
*/
|
|
11428
|
+
readonly callback?: (outcome: CallbackOutcome) => Effect.Effect<string | undefined, Errors.DomainKitError>;
|
|
11404
11429
|
}
|
|
11430
|
+
/** Offline registration requirements, not proof of provider console or grant readiness. */
|
|
11431
|
+
export declare const RegistrationSettings: Schema.Union<readonly [Schema.Struct<{
|
|
11432
|
+
readonly _tag: Schema.Literal<"OAuth">;
|
|
11433
|
+
readonly provider: Schema.String;
|
|
11434
|
+
readonly callbackUrl: Schema.String;
|
|
11435
|
+
readonly clientAuth: Schema.Literals<readonly ["none", "client_secret_basic", "client_secret_post"]>;
|
|
11436
|
+
readonly pkce: Schema.Literal<"S256">;
|
|
11437
|
+
readonly scopes: Schema.$Array<Schema.String>;
|
|
11438
|
+
}>, Schema.Struct<{
|
|
11439
|
+
readonly _tag: Schema.Literal<"Integration">;
|
|
11440
|
+
readonly provider: Schema.String;
|
|
11441
|
+
readonly callbackUrl: Schema.String;
|
|
11442
|
+
readonly clientAuth: Schema.Literal<"client_secret_post">;
|
|
11443
|
+
}>]>;
|
|
11444
|
+
export type RegistrationSettings = typeof RegistrationSettings.Type;
|
|
11445
|
+
/** Derive only public setup values; no credentials, identity, storage, or network are needed. */
|
|
11446
|
+
export declare const registrationSettings: (input: {
|
|
11447
|
+
readonly providers: ReadonlyArray<Provider.Definition>;
|
|
11448
|
+
readonly callbackBaseUrl: string;
|
|
11449
|
+
}) => Effect.Effect<ReadonlyArray<RegistrationSettings>, Errors.DomainKitError>;
|
|
11405
11450
|
/** Everything the handlers need: the lifecycle services, Storage, and the host's `Identity`. */
|
|
11406
11451
|
export type Services = Provision.Service | Cleanup.Service | Connect.Service | Verify.Service | Providers.Service | Storage.Service | Identity;
|
|
11407
11452
|
/**
|
package/dist/types/Verify.d.ts
CHANGED
|
@@ -73,7 +73,11 @@ export interface Interface {
|
|
|
73
73
|
readonly domain: string;
|
|
74
74
|
readonly requirements?: ReadonlyArray<DnsRecord.Model>;
|
|
75
75
|
}) => Fx<Readiness>;
|
|
76
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Merge host evidence into stored readiness without re-observing DNS. Before the first `observe`
|
|
78
|
+
* the readiness has no requirements, so it is never `ready`: `failed` when a host signal failed,
|
|
79
|
+
* otherwise `pending` with `nextCheckAt` set for the first observation.
|
|
80
|
+
*/
|
|
77
81
|
readonly attachEvidence: (input: {
|
|
78
82
|
readonly domain: string;
|
|
79
83
|
readonly evidence: ReadonlyArray<HostEvidence>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as Errors from "./error.ts";
|
|
2
|
+
/** A leaked flow id must reveal neither existence nor ownership, including read races. */
|
|
3
|
+
export declare const refuse: import("effect/Effect").Effect<never, Errors.DomainKitError, never>;
|
|
4
|
+
export declare const missing: (error: Errors.DomainKitError) => boolean;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { Config, Effect } from "effect";
|
|
1
|
+
import { Config, Effect, Redacted } from "effect";
|
|
2
2
|
import * as Errors from "./error.ts";
|
|
3
3
|
/** Accept a literal or a `Config`; config failures surface as `InvalidInput` on `field`. */
|
|
4
4
|
export declare const resolve: <A>(value: A | Config.Config<A>, field: string) => Effect.Effect<A, Errors.DomainKitError>;
|
|
5
|
+
/** Configuration diagnostics name the field, never the rejected value. */
|
|
6
|
+
export declare const requireValue: <A>(value: A, valid: (value: A) => boolean, field: string, message: string) => Effect.Effect<A, Errors.DomainKitError>;
|
|
7
|
+
export declare const nonempty: (value: string, field: string) => Effect.Effect<string, Errors.DomainKitError, never>;
|
|
8
|
+
export declare const secret: (value: Redacted.Redacted<string>, field: string) => Effect.Effect<Redacted.Redacted<string>, Errors.DomainKitError, never>;
|
|
9
|
+
/** Paths and split emulator origins are supported; URL suffixes must remain paths. */
|
|
10
|
+
export declare const endpoint: (value: string, field: string) => Effect.Effect<string, Errors.DomainKitError, never>;
|
|
11
|
+
export declare const scopes: (value: ReadonlyArray<string>, field: string) => Effect.Effect<readonly string[], Errors.DomainKitError, never>;
|
|
@@ -33,6 +33,7 @@ export interface AsyncTokenAuth {
|
|
|
33
33
|
readonly authenticate: (values: Readonly<Record<string, string | undefined>>) => Promise<AsyncIssuedCredential>;
|
|
34
34
|
}
|
|
35
35
|
export interface AsyncOAuthAuth {
|
|
36
|
+
readonly registration?: Provider.OAuthAuth["registration"];
|
|
36
37
|
readonly label: string;
|
|
37
38
|
readonly scopes: ReadonlyArray<string>;
|
|
38
39
|
readonly start: (input: {
|
|
@@ -49,6 +50,7 @@ export interface AsyncOAuthAuth {
|
|
|
49
50
|
readonly revoke?: (credential: AsyncCredential) => Promise<void>;
|
|
50
51
|
}
|
|
51
52
|
export interface AsyncIntegrationAuth {
|
|
53
|
+
readonly registration?: Provider.IntegrationAuth["registration"];
|
|
52
54
|
readonly label: string;
|
|
53
55
|
readonly start: (input: {
|
|
54
56
|
readonly state: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domainkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Build reviewable DNS plans for custom domains in TypeScript",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"custom-domains",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"effect",
|
|
12
12
|
"typescript"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://
|
|
14
|
+
"homepage": "https://domain-kit.dev",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/AryaLabsHQ/domainkit/issues"
|
|
17
17
|
},
|
|
@@ -139,18 +139,18 @@
|
|
|
139
139
|
},
|
|
140
140
|
"dependencies": {
|
|
141
141
|
"@leichtgewicht/dns-packet": "6.0.3",
|
|
142
|
-
"oauth4webapi": "^3.8.
|
|
143
|
-
"tldts": "^7.4.
|
|
142
|
+
"oauth4webapi": "^3.8.8",
|
|
143
|
+
"tldts": "^7.4.18"
|
|
144
144
|
},
|
|
145
145
|
"devDependencies": {
|
|
146
|
-
"@effect/vitest": "4.0.
|
|
147
|
-
"@types/bun": "1.4.
|
|
148
|
-
"effect": "4.0.
|
|
146
|
+
"@effect/vitest": "4.0.2",
|
|
147
|
+
"@types/bun": "1.4.2",
|
|
148
|
+
"effect": "4.0.2",
|
|
149
149
|
"miniflare": "3.20250718.3",
|
|
150
|
-
"tsdown": "0.
|
|
150
|
+
"tsdown": "0.23.0",
|
|
151
151
|
"typescript": "7.0.2",
|
|
152
|
-
"vite": "
|
|
153
|
-
"vitest": "5.0.
|
|
152
|
+
"vite": "8.3.4",
|
|
153
|
+
"vitest": "5.0.3"
|
|
154
154
|
},
|
|
155
155
|
"peerDependencies": {
|
|
156
156
|
"effect": ">=4.0.0 <5.0.0"
|