domainkit 0.10.0 → 0.12.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/dist/Cloudflare.mjs +35 -12
- package/dist/Cloudflare.mjs.map +1 -1
- package/dist/Connect.mjs +159 -35
- package/dist/Connect.mjs.map +1 -1
- package/dist/Provider.mjs +12 -13
- package/dist/Provider.mjs.map +1 -1
- package/dist/Server.mjs +139 -22
- package/dist/Server.mjs.map +1 -1
- package/dist/Storage.mjs +2 -0
- package/dist/Storage.mjs.map +1 -1
- package/dist/Testing.mjs +8 -7
- package/dist/Testing.mjs.map +1 -1
- package/dist/Transport.mjs +25 -2
- package/dist/Transport.mjs.map +1 -1
- package/dist/internal/conformance/storage.mjs +16 -0
- package/dist/internal/conformance/storage.mjs.map +1 -1
- package/dist/internal/oauth.mjs +35 -7
- package/dist/internal/oauth.mjs.map +1 -1
- package/dist/internal/storage-memory.mjs +1 -0
- package/dist/internal/storage-memory.mjs.map +1 -1
- package/dist/package.mjs +1 -1
- package/dist/types/Cloudflare.d.ts +21 -0
- package/dist/types/Connect.d.ts +65 -0
- package/dist/types/Provider.d.ts +5 -0
- package/dist/types/Server.d.ts +954 -26
- package/dist/types/Storage.d.ts +4 -0
- package/dist/types/Testing.d.ts +12 -3
- package/dist/types/Transport.d.ts +16 -1
- package/dist/types/internal/oauth.d.ts +4 -0
- package/package.json +1 -1
package/dist/types/Connect.d.ts
CHANGED
|
@@ -113,6 +113,8 @@ export interface Snapshot {
|
|
|
113
113
|
readonly connection: Storage.Connection | null;
|
|
114
114
|
readonly authorization: Pick<Storage.Authorization, "id" | "provider" | "method" | "capabilities" | "revocation"> | null;
|
|
115
115
|
readonly lastReceiptId: string | null;
|
|
116
|
+
/** How many domains this domain's connection serves, including this one; `0` without one. */
|
|
117
|
+
readonly connectionDomains: number;
|
|
116
118
|
/** Other connections of this owner that could serve this domain. */
|
|
117
119
|
readonly reusable: ReadonlyArray<{
|
|
118
120
|
readonly connection: Storage.Connection;
|
|
@@ -410,8 +412,39 @@ export declare const Discovery: {
|
|
|
410
412
|
}>;
|
|
411
413
|
}, "_tag">;
|
|
412
414
|
};
|
|
415
|
+
/** One zone a connection reaches, with the connection that reaches it. */
|
|
416
|
+
export interface Zone {
|
|
417
|
+
readonly connectionId: string;
|
|
418
|
+
readonly provider: string;
|
|
419
|
+
readonly target: Provider.Target;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* A connection's standing in a zone listing. `reconnect` is a credential the provider turned down:
|
|
423
|
+
* the connection is still the owner's, and the other connections' zones came back regardless.
|
|
424
|
+
*/
|
|
425
|
+
export interface ZoneConnection {
|
|
426
|
+
readonly connectionId: string;
|
|
427
|
+
readonly provider: string;
|
|
428
|
+
readonly status: "connected" | "reconnect";
|
|
429
|
+
}
|
|
430
|
+
/** Every zone the principal's connections reach, and how each connection is standing. */
|
|
431
|
+
export interface Zones {
|
|
432
|
+
/** Ordered by zone, then by connection, so two listings of the same state read the same. */
|
|
433
|
+
readonly zones: ReadonlyArray<Zone>;
|
|
434
|
+
readonly connections: ReadonlyArray<ZoneConnection>;
|
|
435
|
+
/** Every provider a customer could connect from here, so an offer needs no second call. */
|
|
436
|
+
readonly providers: Snapshot["providers"];
|
|
437
|
+
}
|
|
413
438
|
export interface Interface {
|
|
414
439
|
readonly inspect: (domain: string) => Fx<Snapshot>;
|
|
440
|
+
/**
|
|
441
|
+
* Every zone the principal's connections can serve, from `Provider.Session.listTargets`. A
|
|
442
|
+
* connection whose credential the provider turned down is marked `reconnect` in `connections`
|
|
443
|
+
* and contributes no zones; the rest still list.
|
|
444
|
+
*/
|
|
445
|
+
readonly zones: (options?: {
|
|
446
|
+
readonly provider?: string;
|
|
447
|
+
}) => Fx<Zones>;
|
|
415
448
|
/**
|
|
416
449
|
* Resolve the domain's authoritative nameservers, then match them against the zones each of
|
|
417
450
|
* the principal's connections can reach: the closest zone wins, a decisive nameserver match
|
|
@@ -425,6 +458,18 @@ export interface Interface {
|
|
|
425
458
|
readonly domain?: string;
|
|
426
459
|
readonly callbackUrl?: string;
|
|
427
460
|
}) => Fx<Started>;
|
|
461
|
+
/**
|
|
462
|
+
* Replace the credential behind a connection the owner already holds, keeping the connection and
|
|
463
|
+
* every domain attached to it. This is what a customer means by reconnecting: starting again
|
|
464
|
+
* would mint a second account and leave the domains on the one the provider turned down. The
|
|
465
|
+
* provider is the connection's own; a credential for a different account is the customer's
|
|
466
|
+
* choice, and the zone check on every session catches a zone it can no longer reach.
|
|
467
|
+
*/
|
|
468
|
+
readonly reconnect: (input: {
|
|
469
|
+
readonly connectionId: string;
|
|
470
|
+
readonly method: Method;
|
|
471
|
+
readonly callbackUrl?: string;
|
|
472
|
+
}) => Fx<Started>;
|
|
428
473
|
/** Finish an interactive connection from the provider callback (the full callback URL). */
|
|
429
474
|
readonly complete: (input: {
|
|
430
475
|
readonly continuationId: string;
|
|
@@ -468,6 +513,9 @@ export declare class Policy extends Policy_base {
|
|
|
468
513
|
export declare const make: Effect.Effect<Interface, never, Storage.Service | Custody.Service | Providers.Service | Resolver.Service>;
|
|
469
514
|
export declare const layer: Layer.Layer<Service, never, Storage.Service | Custody.Service | Providers.Service | Resolver.Service>;
|
|
470
515
|
export declare const inspect: (domain: string) => Effect.Effect<Snapshot, Errors.DomainKitError, Principal.Service | Service>;
|
|
516
|
+
export declare const zones: (options?: {
|
|
517
|
+
readonly provider?: string;
|
|
518
|
+
} | undefined) => Effect.Effect<Zones, Errors.DomainKitError, Principal.Service | Service>;
|
|
471
519
|
export declare const discover: (domain: string) => Effect.Effect<{
|
|
472
520
|
readonly _tag: "NotFound";
|
|
473
521
|
readonly nameservers: ReadonlyArray<string>;
|
|
@@ -503,6 +551,23 @@ export declare const start: (input: {
|
|
|
503
551
|
readonly connection: Storage.Connection;
|
|
504
552
|
readonly candidates: ReadonlyArray<Provider.Target>;
|
|
505
553
|
}, Errors.DomainKitError, Principal.Service | Service>;
|
|
554
|
+
export declare const reconnect: (input: {
|
|
555
|
+
readonly connectionId: string;
|
|
556
|
+
readonly method: Method;
|
|
557
|
+
readonly callbackUrl?: string;
|
|
558
|
+
}) => Effect.Effect<{
|
|
559
|
+
readonly _tag: "Connected";
|
|
560
|
+
readonly connection: Storage.Connection;
|
|
561
|
+
readonly attachment: Storage.Attachment | null;
|
|
562
|
+
} | {
|
|
563
|
+
readonly _tag: "Redirect";
|
|
564
|
+
readonly authorizationUrl: string;
|
|
565
|
+
readonly continuationId: string;
|
|
566
|
+
} | {
|
|
567
|
+
readonly _tag: "SelectionRequired";
|
|
568
|
+
readonly connection: Storage.Connection;
|
|
569
|
+
readonly candidates: ReadonlyArray<Provider.Target>;
|
|
570
|
+
}, Errors.DomainKitError, Principal.Service | Service>;
|
|
506
571
|
export declare const complete: (input: {
|
|
507
572
|
readonly continuationId: string;
|
|
508
573
|
readonly callbackUrl: string;
|
package/dist/types/Provider.d.ts
CHANGED
|
@@ -170,6 +170,10 @@ export interface MethodDescriptor {
|
|
|
170
170
|
}
|
|
171
171
|
/** Field descriptors derived from `TokenAuth.fields`: optional keys are not required, `Redacted` values are secret. */
|
|
172
172
|
export declare const tokenFields: (auth: TokenAuth) => ReadonlyArray<FieldDescriptor>;
|
|
173
|
+
/**
|
|
174
|
+
* Every method a provider offers, in the order a UI should present them: the interactive ones a
|
|
175
|
+
* customer clicks through first, then the token they have to go and fetch themselves.
|
|
176
|
+
*/
|
|
173
177
|
export declare const describeMethods: (definition: Definition) => ReadonlyArray<MethodDescriptor>;
|
|
174
178
|
export interface CallbackInput {
|
|
175
179
|
readonly code: string;
|
|
@@ -240,6 +244,7 @@ export declare const encodeContext: <Context>(definition: Definition<Context>, v
|
|
|
240
244
|
export type AuthMethod = "token" | "oauth" | "integration";
|
|
241
245
|
/** Validates a definition: an id and at least one auth method. Throws `DomainKit.Error` otherwise. */
|
|
242
246
|
export declare const make: <Context>(definition: Definition<Context>) => Definition<Context>;
|
|
247
|
+
/** The kinds alone, in the same order `describeMethods` puts them: interactive first, token last. */
|
|
243
248
|
export declare const methods: (definition: Definition) => ReadonlyArray<AuthMethod>;
|
|
244
249
|
/**
|
|
245
250
|
* Pick the most specific zone among `targets` for `domain`: exactly one match resolves, several
|