domainkit 0.5.0 → 0.6.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/promise.mjs CHANGED
@@ -1,100 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { B as tokenValidator$1, C as integrationFlow$1, D as tokenConnectionMethod$3, E as restore$3, F as oauthMethod$1, I as restore$2, J as secret_exports, L as subjectResolver$1, N as manifest$2, O as tokenMethod$3, P as oauthFlow$1, Q as decode$3, R as tokenConnectionMethod$2, S as exchangeCode$1, T as manifest$3, U as make$6, W as authorize$2, X as Method$2, Y as provider_context_exports, Z as Schema$1, _ as toAsync$2, a as Result, at as start$1, c as Observation, d as defaultMake$1, et as diagnostic_exports, f as make$8, h as toAsync$4, i as PublicDnsObservation, it as complete$1, j as make$7, l as Policy, n as ProviderObservation, nt as Method$1, o as observe$1, ot as version, q as selection_exports, r as PublicDns$1, rt as StartResult, t as Provider$1, tt as Error, u as Service, w as integrationMethod$1, y as toAsync$3, z as tokenMethod$2 } from "./verify-B2fPyjde.mjs";
3
- import { $ as Txt, A as decodeReceipt$1, Ct as encode, D as Receipt, E as Operation, Et as Schema$3, F as webCryptoLayer, G as Cname, H as A, I as Error$2, J as Observed, K as Mx, L as Service$2, M as encodeReceipt, O as Schema$4, Q as Srv, S as create$3, St as decode$4, T as Authorization, Tt as validate, U as Aaaa, V as toAsync$5, W as Caa, X as RequirementMetadata, Y as Opaque, Z as Schema$2, _t as ProviderConnection, a as Authorization$1, at as parse, b as apply$3, c as PartialError, ct as make$9, d as apply$2, dt as zones_exports, et as Type, f as authorize$3, ft as Error$1, g as CreateResult, gt as DomainAttachment, ht as ConnectionStatus, it as equals, j as encode$1, jt as invalid_input_exports, k as decode$5, kt as parse$1, l as Plan, mt as AuthorizationError, o as Error$3, ot as Candidate, p as create$2, pt as Service$1, q as Ns, s as Operation$1, st as Service$3, t as Error$4, tt as data, u as Receipt$1, vt as ProviderTarget, w as renderManualInstructions$1, x as authorize$4, xt as authorizationError, y as Target, yt as ProviderTargetEvidence, z as layerFromAsync$1 } from "./resolver-tZU6gEVq.mjs";
2
+ import { B as tokenMethod$2, C as integrationFlow$1, D as tokenConnectionMethod$3, E as restore$3, F as oauthMethod$1, G as authorize$2, I as refreshCredential$1, J as selection_exports, L as restore$2, N as manifest$2, O as tokenMethod$3, P as oauthFlow$1, Q as decode$3, R as subjectResolver$1, S as exchangeCode$1, T as manifest$3, V as tokenValidator$1, W as make$6, X as Method$1, Y as secret_exports, Z as Schema$1, _ as toAsync$1, a as Result, c as Observation, d as defaultMake$1, et as diagnostic_exports, f as make$8, h as toAsync$3, i as PublicDnsObservation, j as make$7, l as Policy, n as ProviderObservation, o as observe$1, r as PublicDns$1, t as Provider$1, tt as version, u as Service, w as integrationMethod$1, y as toAsync$2, z as tokenConnectionMethod$2 } from "./verify-DAtUAEeg.mjs";
3
+ import { A as invalid_input_exports, O as parse, S as encode, T as Schema$2, _ as ProviderTargetEvidence, b as authorizationError, d as provider_context_exports, f as AuthorizationError, g as ProviderTarget, h as ProviderConnection, i as webCryptoLayer, m as DomainAttachment, p as ConnectionStatus, w as validate, x as decode$4 } from "./canonical-json-9x7gHIoS.mjs";
4
+ import { a as start$1, i as complete$1, n as Method$2, r as StartResult, t as Error } from "./connect-ks3cpqBD.mjs";
5
+ import { $ as data, A as decodeReceipt$1, B as A, D as Receipt, E as Operation, F as Service$1, G as Ns, H as Caa, J as RequirementMetadata, K as Observed, L as layerFromAsync, M as encodeReceipt, O as Schema$4, P as Error$1, Q as Type, S as create$3, T as Authorization, U as Cname, V as Aaaa, W as Mx, X as Srv, Y as Schema$3, Z as Txt, a as Authorization$1, at as Service$2, b as apply$3, c as PartialError, d as apply$2, f as authorize$3, g as CreateResult, it as Candidate, j as encode$1, k as decode$5, l as Plan, lt as zones_exports, nt as equals, o as Error$2, ot as make$9, p as create$2, q as Opaque, rt as parse$1, s as Operation$1, t as Error$3, u as Receipt$1, w as renderManualInstructions$1, x as authorize$4, y as Target, z as toAsync$4 } from "./resolver-DxJPsq6l.mjs";
6
+ import { n as managed_dns_connections_exports, t as layerFromAsync$1 } from "./managed-dns-connections-CaXts84E.mjs";
4
7
  import { Data, Effect, Layer } from "effect";
5
- //#region src/promise/managed-dns-connections.ts
6
- var managed_dns_connections_exports = /* @__PURE__ */ __exportAll({
7
- Error: () => Error$1,
8
- from: () => from,
9
- layerFromAsync: () => layerFromAsync,
10
- toAsync: () => toAsync$1
11
- });
12
- const failure = (operation, cause) => cause instanceof Error$1 ? cause : new Error$1({
13
- category: "storage",
14
- message: cause instanceof globalThis.Error ? cause.message : String(cause),
15
- operation,
16
- retry: "safe"
17
- });
18
- const layerFromAsync = (repository) => Layer.succeed(Service$1, {
19
- attach: (input) => Effect.tryPromise({
20
- try: () => repository.attach(input),
21
- catch: (cause) => failure("ManagedDnsConnections.attach", cause)
22
- }),
23
- connect: (input) => Effect.tryPromise({
24
- try: () => repository.connect(input),
25
- catch: (cause) => failure("ManagedDnsConnections.connect", cause)
26
- }),
27
- detach: (input) => Effect.tryPromise({
28
- try: () => repository.detach(input),
29
- catch: (cause) => failure("ManagedDnsConnections.detach", cause)
30
- }),
31
- disconnect: ({ connectionId, ownerId, revoke }) => Effect.tryPromise({
32
- try: () => repository.disconnect({
33
- connectionId,
34
- ownerId,
35
- revoke: (authorization) => Effect.runPromise(revoke(authorization))
36
- }),
37
- catch: (cause) => failure("ManagedDnsConnections.disconnect", cause)
38
- }),
39
- findConnection: (ownerId, authorizationId) => Effect.tryPromise({
40
- try: () => repository.findConnection(ownerId, authorizationId),
41
- catch: (cause) => failure("ManagedDnsConnections.findConnection", cause)
42
- }),
43
- get: (authorizationId) => Effect.tryPromise({
44
- try: () => repository.get(authorizationId),
45
- catch: (cause) => failure("ManagedDnsConnections.get", cause)
46
- }),
47
- getAttachment: (attachmentId) => Effect.tryPromise({
48
- try: () => repository.getAttachment(attachmentId),
49
- catch: (cause) => failure("ManagedDnsConnections.getAttachment", cause)
50
- }),
51
- getByConnectionId: (connectionId) => Effect.tryPromise({
52
- try: () => repository.getByConnectionId(connectionId),
53
- catch: (cause) => failure("ManagedDnsConnections.getByConnectionId", cause)
54
- }),
55
- listAttachments: (connectionId, ownerId) => Effect.tryPromise({
56
- try: () => repository.listAttachments(connectionId, ownerId),
57
- catch: (cause) => failure("ManagedDnsConnections.listAttachments", cause)
58
- }),
59
- promoteEvidence: (authorizationId, evidence) => Effect.tryPromise({
60
- try: () => repository.promoteEvidence(authorizationId, evidence),
61
- catch: (cause) => failure("ManagedDnsConnections.promoteEvidence", cause)
62
- }),
63
- recover: ({ authorizationId, revoke }) => Effect.tryPromise({
64
- try: () => repository.recover({
65
- authorizationId,
66
- revoke: (authorization) => Effect.runPromise(revoke(authorization))
67
- }),
68
- catch: (cause) => failure("ManagedDnsConnections.recover", cause)
69
- }),
70
- rotate: (authorizationId, credential, expiresAt) => Effect.tryPromise({
71
- try: () => repository.rotate(authorizationId, credential, expiresAt),
72
- catch: (cause) => failure("ManagedDnsConnections.rotate", cause)
73
- })
74
- });
75
- const toAsync$1 = (service) => ({
76
- attach: (input) => Effect.runPromise(service.attach(input)),
77
- connect: (input) => Effect.runPromise(service.connect(input)),
78
- detach: (input) => Effect.runPromise(service.detach(input)),
79
- disconnect: ({ connectionId, ownerId, revoke }) => Effect.runPromise(service.disconnect({
80
- connectionId,
81
- ownerId,
82
- revoke: (authorization) => Effect.promise(() => revoke(authorization))
83
- })),
84
- findConnection: (ownerId, authorizationId) => Effect.runPromise(service.findConnection(ownerId, authorizationId)),
85
- get: (authorizationId) => Effect.runPromise(service.get(authorizationId)),
86
- getAttachment: (attachmentId) => Effect.runPromise(service.getAttachment(attachmentId)),
87
- getByConnectionId: (connectionId) => Effect.runPromise(service.getByConnectionId(connectionId)),
88
- listAttachments: (connectionId, ownerId) => Effect.runPromise(service.listAttachments(connectionId, ownerId)),
89
- promoteEvidence: (authorizationId, evidence) => Effect.runPromise(service.promoteEvidence(authorizationId, evidence)),
90
- recover: ({ authorizationId, revoke }) => Effect.runPromise(service.recover({
91
- authorizationId,
92
- revoke: (authorization) => Effect.promise(() => revoke(authorization))
93
- })),
94
- rotate: (authorizationId, credential, expiresAt) => Effect.runPromise(service.rotate(authorizationId, credential, expiresAt))
95
- });
96
- const from = (repository) => repository;
97
- //#endregion
98
8
  //#region src/promise/connection.ts
99
9
  var connection_exports = /* @__PURE__ */ __exportAll({
100
10
  AuthorizationError: () => AuthorizationError,
@@ -128,11 +38,11 @@ const connectionFailure = (operation, cause) => cause instanceof Error ? cause :
128
38
  operation,
129
39
  retry: "unknown"
130
40
  });
131
- const effectMethod = (method) => method._tag === "Interactive" ? Method$1.Interactive({
41
+ const effectMethod = (method) => method._tag === "Interactive" ? Method$2.Interactive({
132
42
  continuations: effectContinuations(method.continuations),
133
43
  flow: effectFlow(method.flow),
134
44
  ...method.ttlMs === void 0 ? {} : { ttlMs: method.ttlMs }
135
- }) : Method$1.Token({
45
+ }) : Method$2.Token({
136
46
  authenticate: (token) => Effect.tryPromise({
137
47
  try: () => method.authenticate(token),
138
48
  catch: (cause) => connectionFailure("Connection.start", cause)
@@ -187,7 +97,7 @@ async function start(input) {
187
97
  ...input.authorizationId === void 0 ? {} : { authorizationId: input.authorizationId },
188
98
  method: effectMethod(input.method),
189
99
  ownerId: input.ownerId
190
- }).pipe(Effect.provide(Layer.merge(layerFromAsync(input.repository), webCryptoLayer))));
100
+ }).pipe(Effect.provide(Layer.merge(layerFromAsync$1(input.repository), webCryptoLayer))));
191
101
  }
192
102
  async function complete(input) {
193
103
  return Effect.runPromise(complete$1({
@@ -195,7 +105,7 @@ async function complete(input) {
195
105
  continuationId: input.continuationId,
196
106
  continuations: effectContinuations(input.continuations),
197
107
  flow: effectFlow(input.flow)
198
- }).pipe(Effect.provide(Layer.merge(layerFromAsync(input.repository), webCryptoLayer))));
108
+ }).pipe(Effect.provide(Layer.merge(layerFromAsync$1(input.repository), webCryptoLayer))));
199
109
  }
200
110
  function attach(input) {
201
111
  return input.repository.attach({
@@ -224,12 +134,12 @@ const fromEffect = (session) => ({
224
134
  providerId: session.providerId,
225
135
  listTargets: (input) => Effect.runPromise(session.listTargets(input)),
226
136
  resolveTarget: (domain) => Effect.runPromise(session.resolveTarget(domain)),
227
- forTarget: (target) => Effect.runPromise(session.forTarget(target)).then(toAsync$5)
137
+ forTarget: (target) => Effect.runPromise(session.forTarget(target)).then(toAsync$4)
228
138
  });
229
139
  //#endregion
230
140
  //#region src/promise/provider-auth.ts
231
141
  var provider_auth_exports = /* @__PURE__ */ __exportAll({
232
- Method: () => Method$2,
142
+ Method: () => Method$1,
233
143
  Schema: () => Schema$1,
234
144
  decode: () => decode$1
235
145
  });
@@ -250,7 +160,7 @@ function toEffectSource(source) {
250
160
  return {
251
161
  listZones: (name) => Effect.tryPromise({
252
162
  try: () => source.listZones(name),
253
- catch: (cause) => new Error$2({
163
+ catch: (cause) => new Error$1({
254
164
  cause,
255
165
  message: cause instanceof globalThis.Error ? cause.message : String(cause),
256
166
  operation: "ZoneDiscovery.listZones",
@@ -258,7 +168,7 @@ function toEffectSource(source) {
258
168
  reason: "transport"
259
169
  })
260
170
  }),
261
- provider: Service$2.of({
171
+ provider: Service$1.of({
262
172
  id: source.provider.id,
263
173
  createRecord: (zone, record) => Effect.tryPromise({
264
174
  try: () => source.provider.createRecord(zone, record),
@@ -290,7 +200,7 @@ function projectOutcome(outcome) {
290
200
  }
291
201
  }
292
202
  function providerFailure(providerId, operation, cause) {
293
- return cause instanceof Error$2 ? cause : new Error$2({
203
+ return cause instanceof Error$1 ? cause : new Error$1({
294
204
  cause,
295
205
  message: cause instanceof globalThis.Error ? cause.message : String(cause),
296
206
  operation,
@@ -309,19 +219,19 @@ var dns_record_exports = /* @__PURE__ */ __exportAll({
309
219
  Observed: () => Observed,
310
220
  Opaque: () => Opaque,
311
221
  RequirementMetadata: () => RequirementMetadata,
312
- Schema: () => Schema$2,
222
+ Schema: () => Schema$3,
313
223
  Srv: () => Srv,
314
224
  Txt: () => Txt,
315
225
  Type: () => Type,
316
226
  data: () => data,
317
227
  equals: () => equals,
318
- parse: () => parse
228
+ parse: () => parse$1
319
229
  });
320
230
  //#endregion
321
231
  //#region src/promise/domain-name.ts
322
232
  var domain_name_exports = /* @__PURE__ */ __exportAll({
323
- Schema: () => Schema$3,
324
- parse: () => parse$1
233
+ Schema: () => Schema$2,
234
+ parse: () => parse
325
235
  });
326
236
  //#endregion
327
237
  //#region src/promise/dns-plan.ts
@@ -345,7 +255,7 @@ function decodeReceipt(input) {
345
255
  //#region src/promise/deletion.ts
346
256
  var deletion_exports = /* @__PURE__ */ __exportAll({
347
257
  Authorization: () => Authorization$1,
348
- Error: () => Error$3,
258
+ Error: () => Error$2,
349
259
  Operation: () => Operation$1,
350
260
  PartialError: () => PartialError,
351
261
  Plan: () => Plan,
@@ -359,7 +269,7 @@ function create$1(input) {
359
269
  plan: input.plan,
360
270
  receipt: input.receipt,
361
271
  ...input.ttlMs === void 0 ? {} : { ttlMs: input.ttlMs }
362
- }).pipe(Effect.provide(Layer.merge(layerFromAsync$1(input.provider), webCryptoLayer))));
272
+ }).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
363
273
  }
364
274
  function authorize$1(plan, operationIds) {
365
275
  return Effect.runPromise(authorize$3(plan, operationIds).pipe(Effect.provide(webCryptoLayer)));
@@ -369,7 +279,7 @@ function apply$1(input) {
369
279
  authorization: input.authorization,
370
280
  plan: input.plan,
371
281
  ...input.priorReceipt === void 0 ? {} : { priorReceipt: input.priorReceipt }
372
- }).pipe(Effect.provide(Layer.merge(layerFromAsync$1(input.provider), webCryptoLayer))));
282
+ }).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
373
283
  }
374
284
  //#endregion
375
285
  //#region src/promise/cloudflare-auth.ts
@@ -377,6 +287,7 @@ var cloudflare_auth_exports = /* @__PURE__ */ __exportAll({
377
287
  manifest: () => manifest$1,
378
288
  oauthFlow: () => oauthFlow,
379
289
  oauthMethod: () => oauthMethod,
290
+ refreshCredential: () => refreshCredential,
380
291
  restore: () => restore$1,
381
292
  subjectResolver: () => subjectResolver,
382
293
  tokenConnectionMethod: () => tokenConnectionMethod$1,
@@ -385,6 +296,9 @@ var cloudflare_auth_exports = /* @__PURE__ */ __exportAll({
385
296
  });
386
297
  const manifest$1 = manifest$2;
387
298
  const oauthMethod = oauthMethod$1;
299
+ function refreshCredential(options) {
300
+ return Effect.runPromise(refreshCredential$1(options));
301
+ }
388
302
  function restore$1(options) {
389
303
  return Effect.runPromise(restore$2(options));
390
304
  }
@@ -528,10 +442,10 @@ var provisioning_exports = /* @__PURE__ */ __exportAll({
528
442
  function create(input) {
529
443
  if ("sources" in input) {
530
444
  const { sources, ...programInput } = input;
531
- return Effect.runPromise(create$3(programInput).pipe(Effect.provide(Layer.merge(Layer.succeed(Service$3, make$9(sources.map(toEffectSource))), webCryptoLayer))));
445
+ return Effect.runPromise(create$3(programInput).pipe(Effect.provide(Layer.merge(Layer.succeed(Service$2, make$9(sources.map(toEffectSource))), webCryptoLayer))));
532
446
  }
533
447
  const { provider, ...programInput } = input;
534
- return Effect.runPromise(create$3(programInput).pipe(Effect.provide(Layer.merge(layerFromAsync$1(provider), webCryptoLayer))));
448
+ return Effect.runPromise(create$3(programInput).pipe(Effect.provide(Layer.merge(layerFromAsync(provider), webCryptoLayer))));
535
449
  }
536
450
  function authorize(plan, operationIds, options = {}) {
537
451
  return Effect.runPromise(authorize$4(plan, operationIds, options).pipe(Effect.provide(webCryptoLayer)));
@@ -540,7 +454,7 @@ function apply(input) {
540
454
  return Effect.runPromise(apply$3({
541
455
  authorization: input.authorization,
542
456
  plan: input.plan
543
- }).pipe(Effect.provide(Layer.merge(layerFromAsync$1(input.provider), webCryptoLayer))));
457
+ }).pipe(Effect.provide(Layer.merge(layerFromAsync(input.provider), webCryptoLayer))));
544
458
  }
545
459
  function authorizeForConnection(input) {
546
460
  return Effect.runPromise(authorize$2({
@@ -551,7 +465,7 @@ function authorizeForConnection(input) {
551
465
  ...input.allowPartial === void 0 ? {} : { allowPartial: input.allowPartial },
552
466
  ...input.operationIds === void 0 ? {} : { operationIds: input.operationIds },
553
467
  plan: input.plan
554
- }).pipe(Effect.provide(Layer.merge(layerFromAsync(input.repository), webCryptoLayer))));
468
+ }).pipe(Effect.provide(Layer.merge(layerFromAsync$1(input.repository), webCryptoLayer))));
555
469
  }
556
470
  const renderManualInstructions = renderManualInstructions$1;
557
471
  //#endregion
@@ -572,7 +486,7 @@ function observe(input) {
572
486
  record: input.record,
573
487
  ...input.publicDns === void 0 ? {} : { publicDns: input.publicDns },
574
488
  provider: Provider$1.Enabled({ zone: provider.zone })
575
- }).pipe(Effect.provide(layerFromAsync$1(provider.provider))) : observe$1({
489
+ }).pipe(Effect.provide(layerFromAsync(provider.provider))) : observe$1({
576
490
  record: input.record,
577
491
  ...input.publicDns === void 0 ? {} : { publicDns: input.publicDns },
578
492
  provider: Provider$1.Disabled()
@@ -587,7 +501,7 @@ function observe(input) {
587
501
  function fromAsyncResolver(resolver) {
588
502
  return { resolve: (query) => Effect.tryPromise({
589
503
  try: () => resolver.resolve(query),
590
- catch: (cause) => new Error$4({
504
+ catch: (cause) => new Error$3({
591
505
  cause,
592
506
  message: cause instanceof globalThis.Error ? cause.message : String(cause),
593
507
  reason: "transport"
@@ -596,11 +510,11 @@ function fromAsyncResolver(resolver) {
596
510
  switch (resolution._tag) {
597
511
  case "answer":
598
512
  case "nodata": return Effect.succeed(resolution);
599
- case "timeout": return Effect.fail(new Error$4({
513
+ case "timeout": return Effect.fail(new Error$3({
600
514
  message: "DNS query timed out",
601
515
  reason: "timeout"
602
516
  }));
603
- case "failure": return Effect.fail(new Error$4({
517
+ case "failure": return Effect.fail(new Error$3({
604
518
  message: resolution.message,
605
519
  reason: "transport"
606
520
  }));
@@ -611,19 +525,19 @@ function fromAsyncResolver(resolver) {
611
525
  //#region src/promise/cloudflare-doh.ts
612
526
  var cloudflare_doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$3 });
613
527
  function make$3(options = {}) {
614
- return toAsync$2(options);
528
+ return toAsync$1(options);
615
529
  }
616
530
  //#endregion
617
531
  //#region src/promise/doh.ts
618
532
  var doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$2 });
619
533
  function make$2(options) {
620
- return toAsync$3(options);
534
+ return toAsync$2(options);
621
535
  }
622
536
  //#endregion
623
537
  //#region src/promise/google-doh.ts
624
538
  var google_doh_exports = /* @__PURE__ */ __exportAll({ make: () => make$1 });
625
539
  function make$1(options = {}) {
626
- return toAsync$4(options);
540
+ return toAsync$3(options);
627
541
  }
628
542
  //#endregion
629
543
  //#region src/promise/resolver-pool.ts
@@ -649,7 +563,7 @@ function toAsync(pool) {
649
563
  function asyncResolver(resolver) {
650
564
  return { resolve: (query) => Effect.tryPromise({
651
565
  try: () => resolver.resolve(query),
652
- catch: (cause) => new Error$4({
566
+ catch: (cause) => new Error$3({
653
567
  cause,
654
568
  message: cause instanceof globalThis.Error ? cause.message : String(cause),
655
569
  reason: "transport"
@@ -658,11 +572,11 @@ function asyncResolver(resolver) {
658
572
  switch (resolution._tag) {
659
573
  case "answer":
660
574
  case "nodata": return Effect.succeed(resolution);
661
- case "timeout": return Effect.fail(new Error$4({
575
+ case "timeout": return Effect.fail(new Error$3({
662
576
  message: "DNS query timed out",
663
577
  reason: "timeout"
664
578
  }));
665
- case "failure": return Effect.fail(new Error$4({
579
+ case "failure": return Effect.fail(new Error$3({
666
580
  message: resolution.message,
667
581
  reason: "transport"
668
582
  }));