alchemy 2.0.0-beta.20 → 2.0.0-beta.21

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.
Files changed (104) hide show
  1. package/bin/alchemy.js +1 -1
  2. package/bin/alchemy.js.map +1 -1
  3. package/bin/commands/bootstrap.ts +59 -57
  4. package/bin/commands/deploy.ts +8 -2
  5. package/bin/commands/login.ts +56 -49
  6. package/bin/commands/logs.ts +92 -90
  7. package/bin/commands/profile.ts +74 -70
  8. package/bin/commands/state.ts +160 -135
  9. package/bin/commands/tail.ts +94 -92
  10. package/lib/AWS/CloudFront/CachePolicy.d.ts.map +1 -1
  11. package/lib/AWS/CloudFront/CachePolicy.js.map +1 -1
  12. package/lib/AWS/CloudFront/KeyGroup.d.ts.map +1 -1
  13. package/lib/AWS/CloudFront/KeyGroup.js.map +1 -1
  14. package/lib/AWS/CloudFront/OriginRequestPolicy.d.ts.map +1 -1
  15. package/lib/AWS/CloudFront/OriginRequestPolicy.js +3 -1
  16. package/lib/AWS/CloudFront/OriginRequestPolicy.js.map +1 -1
  17. package/lib/AWS/CloudFront/PublicKey.d.ts.map +1 -1
  18. package/lib/AWS/CloudFront/PublicKey.js.map +1 -1
  19. package/lib/AWS/ECS/CapacityProvider.d.ts.map +1 -1
  20. package/lib/AWS/ECS/CapacityProvider.js +5 -4
  21. package/lib/AWS/ECS/CapacityProvider.js.map +1 -1
  22. package/lib/Axiom/Annotation.d.ts +3 -3
  23. package/lib/Axiom/Annotation.d.ts.map +1 -1
  24. package/lib/Axiom/Annotation.js +5 -5
  25. package/lib/Axiom/Annotation.js.map +1 -1
  26. package/lib/Axiom/ApiToken.d.ts +3 -3
  27. package/lib/Axiom/ApiToken.d.ts.map +1 -1
  28. package/lib/Axiom/ApiToken.js +4 -4
  29. package/lib/Axiom/ApiToken.js.map +1 -1
  30. package/lib/Axiom/AuthProvider.js.map +1 -1
  31. package/lib/Axiom/Credentials.d.ts +1 -1
  32. package/lib/Axiom/Credentials.d.ts.map +1 -1
  33. package/lib/Axiom/Credentials.js +2 -3
  34. package/lib/Axiom/Credentials.js.map +1 -1
  35. package/lib/Axiom/Dashboard.d.ts +4 -4
  36. package/lib/Axiom/Dashboard.d.ts.map +1 -1
  37. package/lib/Axiom/Dashboard.js +5 -5
  38. package/lib/Axiom/Dashboard.js.map +1 -1
  39. package/lib/Axiom/Dataset.d.ts.map +1 -1
  40. package/lib/Axiom/Dataset.js +5 -5
  41. package/lib/Axiom/Dataset.js.map +1 -1
  42. package/lib/Axiom/Monitor.d.ts +3 -3
  43. package/lib/Axiom/Monitor.d.ts.map +1 -1
  44. package/lib/Axiom/Monitor.js +6 -6
  45. package/lib/Axiom/Monitor.js.map +1 -1
  46. package/lib/Axiom/Notifier.d.ts +3 -3
  47. package/lib/Axiom/Notifier.d.ts.map +1 -1
  48. package/lib/Axiom/Notifier.js +9 -6
  49. package/lib/Axiom/Notifier.js.map +1 -1
  50. package/lib/Axiom/View.d.ts +3 -3
  51. package/lib/Axiom/View.d.ts.map +1 -1
  52. package/lib/Axiom/View.js +5 -5
  53. package/lib/Axiom/View.js.map +1 -1
  54. package/lib/Axiom/VirtualField.d.ts +3 -3
  55. package/lib/Axiom/VirtualField.d.ts.map +1 -1
  56. package/lib/Axiom/VirtualField.js +5 -5
  57. package/lib/Axiom/VirtualField.js.map +1 -1
  58. package/lib/Bundle/PurePlugin.d.ts.map +1 -1
  59. package/lib/Bundle/PurePlugin.js +4 -4
  60. package/lib/Bundle/PurePlugin.js.map +1 -1
  61. package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts.map +1 -1
  62. package/lib/Cloudflare/ApiToken/AccountApiToken.js.map +1 -1
  63. package/lib/Cloudflare/ApiToken/Common.d.ts.map +1 -1
  64. package/lib/Cloudflare/ApiToken/Common.js.map +1 -1
  65. package/lib/Cloudflare/ApiToken/UserApiToken.d.ts.map +1 -1
  66. package/lib/Cloudflare/ApiToken/UserApiToken.js.map +1 -1
  67. package/lib/Cloudflare/Fetcher.d.ts.map +1 -1
  68. package/lib/Cloudflare/Fetcher.js +3 -1
  69. package/lib/Cloudflare/Fetcher.js.map +1 -1
  70. package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
  71. package/lib/Cloudflare/Workers/Worker.js +12 -3
  72. package/lib/Cloudflare/Workers/Worker.js.map +1 -1
  73. package/lib/Output.d.ts.map +1 -1
  74. package/lib/Output.js +1 -1
  75. package/lib/Output.js.map +1 -1
  76. package/lib/Telemetry/Layer.d.ts.map +1 -1
  77. package/lib/Telemetry/Layer.js.map +1 -1
  78. package/lib/Telemetry/Metrics.d.ts.map +1 -1
  79. package/lib/Telemetry/Metrics.js.map +1 -1
  80. package/package.json +5 -5
  81. package/src/AWS/CloudFront/CachePolicy.ts +5 -2
  82. package/src/AWS/CloudFront/KeyGroup.ts +2 -1
  83. package/src/AWS/CloudFront/OriginRequestPolicy.ts +8 -2
  84. package/src/AWS/CloudFront/PublicKey.ts +2 -1
  85. package/src/AWS/ECS/CapacityProvider.ts +12 -9
  86. package/src/Axiom/Annotation.ts +7 -7
  87. package/src/Axiom/ApiToken.ts +6 -6
  88. package/src/Axiom/AuthProvider.ts +2 -7
  89. package/src/Axiom/Credentials.ts +2 -6
  90. package/src/Axiom/Dashboard.ts +10 -13
  91. package/src/Axiom/Dataset.ts +8 -12
  92. package/src/Axiom/Monitor.ts +8 -8
  93. package/src/Axiom/Notifier.ts +11 -8
  94. package/src/Axiom/View.ts +7 -7
  95. package/src/Axiom/VirtualField.ts +7 -7
  96. package/src/Bundle/PurePlugin.ts +6 -5
  97. package/src/Cloudflare/ApiToken/AccountApiToken.ts +1 -3
  98. package/src/Cloudflare/ApiToken/Common.ts +1 -3
  99. package/src/Cloudflare/ApiToken/UserApiToken.ts +1 -3
  100. package/src/Cloudflare/Fetcher.ts +3 -1
  101. package/src/Cloudflare/Workers/Worker.ts +40 -27
  102. package/src/Output.ts +1 -2
  103. package/src/Telemetry/Layer.ts +9 -10
  104. package/src/Telemetry/Metrics.ts +1 -6
@@ -83,11 +83,7 @@ export const AxiomAuth = AuthProviderLayer<
83
83
  const resolveCredentials = (
84
84
  profileName: string,
85
85
  config: AxiomAuthConfig,
86
- ): Effect.Effect<
87
- AxiomResolvedCredentials,
88
- AuthError,
89
- FileSystem.FileSystem
90
- > =>
86
+ ): Effect.Effect<AxiomResolvedCredentials, AuthError, FileSystem.FileSystem> =>
91
87
  Match.value(config).pipe(
92
88
  Match.when(
93
89
  { method: "env" },
@@ -101,8 +97,7 @@ const resolveCredentials = (
101
97
  "Axiom env credentials not found. Set AXIOM_TOKEN (or AXIOM_API_KEY).",
102
98
  });
103
99
  }
104
- const apiBaseUrl =
105
- (yield* getEnv("AXIOM_URL")) ?? DEFAULT_API_BASE_URL;
100
+ const apiBaseUrl = (yield* getEnv("AXIOM_URL")) ?? DEFAULT_API_BASE_URL;
106
101
  const orgId = yield* getEnv("AXIOM_ORG_ID");
107
102
  if (orgId) {
108
103
  return {
@@ -1,13 +1,9 @@
1
- import {
2
- Credentials,
3
- DEFAULT_API_BASE_URL,
4
- } from "@distilled.cloud/axiom/Credentials";
1
+ import { Credentials } from "@distilled.cloud/axiom/Credentials";
5
2
  import { ConfigError } from "@distilled.cloud/core/errors";
3
+ import * as Config from "effect/Config";
6
4
  import * as Effect from "effect/Effect";
7
5
  import * as Layer from "effect/Layer";
8
6
  import * as Match from "effect/Match";
9
- import * as Redacted from "effect/Redacted";
10
- import * as Config from "effect/Config";
11
7
  import { getAuthProvider } from "../Auth/AuthProvider.ts";
12
8
  import { ALCHEMY_PROFILE, loadOrConfigure } from "../Auth/Profile.ts";
13
9
  import {
@@ -1,11 +1,11 @@
1
- import * as Operations from "@distilled.cloud/axiom";
1
+ import * as Axiom from "@distilled.cloud/axiom";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Provider from "../Provider.ts";
4
4
  import { Resource } from "../Resource.ts";
5
5
  import type { Chart, LayoutCell } from "./Chart.ts";
6
6
  import type { Providers } from "./Providers.ts";
7
7
 
8
- type DashboardDoc = Operations.CreateDashboardInput["dashboard"];
8
+ type DashboardDoc = Axiom.CreateDashboardInput["dashboard"];
9
9
 
10
10
  /**
11
11
  * Dashboard input. Mirrors `Operations.CreateDashboardInput` but
@@ -14,10 +14,7 @@ type DashboardDoc = Operations.CreateDashboardInput["dashboard"];
14
14
  * as `Schema.Array(Schema.Unknown)`, so this is a compile-time-only
15
15
  * refinement; runtime validation is unchanged).
16
16
  */
17
- export type DashboardProps = Omit<
18
- Operations.CreateDashboardInput,
19
- "dashboard"
20
- > & {
17
+ export type DashboardProps = Omit<Axiom.CreateDashboardInput, "dashboard"> & {
21
18
  readonly dashboard: Omit<DashboardDoc, "charts" | "layout"> & {
22
19
  readonly charts: readonly Chart[];
23
20
  readonly layout: readonly LayoutCell[];
@@ -36,7 +33,7 @@ export type Dashboard = Resource<
36
33
  updatedAt: string;
37
34
  updatedBy: string;
38
35
  /** The full dashboard document as returned by Axiom. */
39
- dashboard: Operations.CreateDashboardOutput["dashboard"]["dashboard"];
36
+ dashboard: Axiom.CreateDashboardOutput["dashboard"]["dashboard"];
40
37
  },
41
38
  never,
42
39
  Providers
@@ -138,12 +135,12 @@ export const DashboardProvider = () =>
138
135
  Provider.effect(
139
136
  Dashboard,
140
137
  Effect.gen(function* () {
141
- const create = yield* Operations.createDashboard;
142
- const update = yield* Operations.updateDashboard;
143
- const get = yield* Operations.getDashboard;
144
- const del = yield* Operations.deleteDashboard;
138
+ const create = yield* Axiom.createDashboard;
139
+ const update = yield* Axiom.updateDashboard;
140
+ const get = yield* Axiom.getDashboard;
141
+ const del = yield* Axiom.deleteDashboard;
145
142
 
146
- const toAttrsFromCreate = (envelope: Operations.CreateDashboardOutput) => ({
143
+ const toAttrsFromCreate = (envelope: Axiom.CreateDashboardOutput) => ({
147
144
  uid: envelope.dashboard.uid,
148
145
  id: envelope.dashboard.id,
149
146
  createdAt: envelope.dashboard.createdAt,
@@ -152,7 +149,7 @@ export const DashboardProvider = () =>
152
149
  updatedBy: envelope.dashboard.updatedBy,
153
150
  dashboard: envelope.dashboard.dashboard,
154
151
  });
155
- const toAttrsFromGet = (current: Operations.GetDashboardOutput) => ({
152
+ const toAttrsFromGet = (current: Axiom.GetDashboardOutput) => ({
156
153
  uid: current.uid,
157
154
  id: current.id,
158
155
  createdAt: current.createdAt,
@@ -1,5 +1,5 @@
1
+ import * as Axiom from "@distilled.cloud/axiom";
1
2
  import { Credentials } from "@distilled.cloud/axiom/Credentials";
2
- import * as Operations from "@distilled.cloud/axiom";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Option from "effect/Option";
5
5
  import { AdoptPolicy } from "../AdoptPolicy.ts";
@@ -169,14 +169,12 @@ export const DatasetProvider = () =>
169
169
  Dataset,
170
170
  Effect.gen(function* () {
171
171
  const { apiBaseUrl } = yield* Credentials;
172
- const create = yield* Operations.createDataset;
173
- const update = yield* Operations.updateDataset;
174
- const get = yield* Operations.getDataset;
175
- const del = yield* Operations.deleteDataset;
172
+ const create = yield* Axiom.createDataset;
173
+ const update = yield* Axiom.updateDataset;
174
+ const get = yield* Axiom.getDataset;
175
+ const del = yield* Axiom.deleteDataset;
176
176
 
177
- const toAttrs = (
178
- dataset: Operations.CreateDatasetOutput,
179
- ) => ({
177
+ const toAttrs = (dataset: Axiom.CreateDatasetOutput) => ({
180
178
  id: dataset.id,
181
179
  name: dataset.name,
182
180
  kind: dataset.kind,
@@ -219,15 +217,13 @@ export const DatasetProvider = () =>
219
217
  retentionDays: news.retentionDays,
220
218
  useRetentionPeriod: news.useRetentionPeriod,
221
219
  }) as Effect.Effect<
222
- Operations.CreateDatasetOutput,
220
+ Axiom.CreateDatasetOutput,
223
221
  { readonly _tag: string },
224
222
  never
225
223
  >
226
224
  ).pipe(
227
225
  Effect.catchIf(
228
- (
229
- e,
230
- ): e is { readonly _tag: "Conflict" | "UnprocessableEntity" } =>
226
+ (e): e is { readonly _tag: "Conflict" | "UnprocessableEntity" } =>
231
227
  e._tag === "Conflict" || e._tag === "UnprocessableEntity",
232
228
  () =>
233
229
  Effect.gen(function* () {
@@ -1,16 +1,16 @@
1
- import * as Operations from "@distilled.cloud/axiom";
1
+ import * as Axiom from "@distilled.cloud/axiom";
2
2
  import * as Effect from "effect/Effect";
3
+ import { isResolved } from "../Diff.ts";
3
4
  import * as Provider from "../Provider.ts";
4
5
  import { Resource } from "../Resource.ts";
5
- import { isResolved } from "../Diff.ts";
6
6
  import type { Providers } from "./Providers.ts";
7
7
 
8
- export type MonitorProps = Operations.CreateMonitorInput;
8
+ export type MonitorProps = Axiom.CreateMonitorInput;
9
9
 
10
10
  export type Monitor = Resource<
11
11
  "Axiom.Monitor",
12
12
  MonitorProps,
13
- Operations.CreateMonitorOutput,
13
+ Axiom.CreateMonitorOutput,
14
14
  never,
15
15
  Providers
16
16
  >;
@@ -86,10 +86,10 @@ export const MonitorProvider = () =>
86
86
  Provider.effect(
87
87
  Monitor,
88
88
  Effect.gen(function* () {
89
- const create = yield* Operations.createMonitor;
90
- const update = yield* Operations.updateMonitor;
91
- const get = yield* Operations.getMonitor;
92
- const del = yield* Operations.deleteMonitor;
89
+ const create = yield* Axiom.createMonitor;
90
+ const update = yield* Axiom.updateMonitor;
91
+ const get = yield* Axiom.getMonitor;
92
+ const del = yield* Axiom.deleteMonitor;
93
93
 
94
94
  return {
95
95
  stables: ["id"],
@@ -1,15 +1,15 @@
1
- import * as Operations from "@distilled.cloud/axiom";
1
+ import * as Axiom from "@distilled.cloud/axiom";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Provider from "../Provider.ts";
4
4
  import { Resource } from "../Resource.ts";
5
5
  import type { Providers } from "./Providers.ts";
6
6
 
7
- export type NotifierProps = Operations.CreateNotifierInput;
7
+ export type NotifierProps = Axiom.CreateNotifierInput;
8
8
 
9
9
  export type Notifier = Resource<
10
10
  "Axiom.Notifier",
11
11
  NotifierProps,
12
- Operations.CreateNotifierOutput & { id: string },
12
+ Axiom.CreateNotifierOutput & { id: string },
13
13
  never,
14
14
  Providers
15
15
  >;
@@ -72,10 +72,10 @@ export const NotifierProvider = () =>
72
72
  Provider.effect(
73
73
  Notifier,
74
74
  Effect.gen(function* () {
75
- const create = yield* Operations.createNotifier;
76
- const update = yield* Operations.updateNotifier;
77
- const get = yield* Operations.getNotifier;
78
- const del = yield* Operations.deleteNotifier;
75
+ const create = yield* Axiom.createNotifier;
76
+ const update = yield* Axiom.updateNotifier;
77
+ const get = yield* Axiom.getNotifier;
78
+ const del = yield* Axiom.deleteNotifier;
79
79
 
80
80
  return {
81
81
  stables: ["id"],
@@ -95,7 +95,10 @@ export const NotifierProvider = () =>
95
95
  read: Effect.fn(function* ({ output }) {
96
96
  if (!output?.id) return undefined;
97
97
  return yield* get({ id: output.id }).pipe(
98
- Effect.map((current) => ({ ...current, id: current.id ?? output.id })),
98
+ Effect.map((current) => ({
99
+ ...current,
100
+ id: current.id ?? output.id,
101
+ })),
99
102
  Effect.catchTag("NotFound", () => Effect.succeed(undefined)),
100
103
  );
101
104
  }),
package/src/Axiom/View.ts CHANGED
@@ -1,16 +1,16 @@
1
- import * as Operations from "@distilled.cloud/axiom";
1
+ import * as Axiom from "@distilled.cloud/axiom";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { isResolved } from "../Diff.ts";
4
4
  import * as Provider from "../Provider.ts";
5
5
  import { Resource } from "../Resource.ts";
6
6
  import type { Providers } from "./Providers.ts";
7
7
 
8
- export type ViewProps = Operations.CreateViewInput;
8
+ export type ViewProps = Axiom.CreateViewInput;
9
9
 
10
10
  export type View = Resource<
11
11
  "Axiom.View",
12
12
  ViewProps,
13
- Operations.CreateViewOutput & {
13
+ Axiom.CreateViewOutput & {
14
14
  /**
15
15
  * Path identifier used by `updateView` / `getView` / `deleteView`.
16
16
  * Currently derived from `name` because Axiom's view list/get responses
@@ -67,10 +67,10 @@ export const ViewProvider = () =>
67
67
  Provider.effect(
68
68
  View,
69
69
  Effect.gen(function* () {
70
- const create = yield* Operations.createView;
71
- const update = yield* Operations.updateView;
72
- const get = yield* Operations.getView;
73
- const del = yield* Operations.deleteView;
70
+ const create = yield* Axiom.createView;
71
+ const update = yield* Axiom.updateView;
72
+ const get = yield* Axiom.getView;
73
+ const del = yield* Axiom.deleteView;
74
74
 
75
75
  return {
76
76
  stables: ["id"],
@@ -1,16 +1,16 @@
1
- import * as Operations from "@distilled.cloud/axiom";
1
+ import * as Axiom from "@distilled.cloud/axiom";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { isResolved } from "../Diff.ts";
4
4
  import * as Provider from "../Provider.ts";
5
5
  import { Resource } from "../Resource.ts";
6
6
  import type { Providers } from "./Providers.ts";
7
7
 
8
- export type VirtualFieldProps = Operations.CreateVirtualFieldInput;
8
+ export type VirtualFieldProps = Axiom.CreateVirtualFieldInput;
9
9
 
10
10
  export type VirtualField = Resource<
11
11
  "Axiom.VirtualField",
12
12
  VirtualFieldProps,
13
- Operations.CreateVirtualFieldOutput,
13
+ Axiom.CreateVirtualFieldOutput,
14
14
  never,
15
15
  Providers
16
16
  >;
@@ -54,10 +54,10 @@ export const VirtualFieldProvider = () =>
54
54
  Provider.effect(
55
55
  VirtualField,
56
56
  Effect.gen(function* () {
57
- const create = yield* Operations.createVirtualField;
58
- const update = yield* Operations.updateVirtualField;
59
- const get = yield* Operations.getVirtualField;
60
- const del = yield* Operations.deleteVirtualField;
57
+ const create = yield* Axiom.createVirtualField;
58
+ const update = yield* Axiom.updateVirtualField;
59
+ const get = yield* Axiom.getVirtualField;
60
+ const del = yield* Axiom.deleteVirtualField;
61
61
 
62
62
  return {
63
63
  stables: ["id"],
@@ -131,12 +131,12 @@ export const purePlugin = (
131
131
  // intentional registrations / mutations the author made at the
132
132
  // top level of files in packages that did not declare so.
133
133
  const markSideEffectFree =
134
- markSideEffectFreeOpt && !isEntry && isSideEffectFree(info.sideEffects);
134
+ markSideEffectFreeOpt &&
135
+ !isEntry &&
136
+ isSideEffectFree(info.sideEffects);
135
137
  const annotated = annotateModule(code, id);
136
138
  if (annotated === null) {
137
- return markSideEffectFree
138
- ? { code, moduleSideEffects: false }
139
- : null;
139
+ return markSideEffectFree ? { code, moduleSideEffects: false } : null;
140
140
  }
141
141
  return {
142
142
  code: annotated.code,
@@ -446,7 +446,8 @@ export function annotateModule(
446
446
  if (isIIFE(call)) return;
447
447
  // For `new X()`, anchor BEFORE the `new` keyword so we get
448
448
  // `/*#__PURE__*/ new X()` (matches babel-plugin-annotate-pure-calls).
449
- const anchor = call.type === "NewExpression" ? call.start : call.callee.start;
449
+ const anchor =
450
+ call.type === "NewExpression" ? call.start : call.callee.start;
450
451
  if (alreadyAnnotated(code, anchor)) return;
451
452
  s.appendLeft(anchor, PURE_COMMENT);
452
453
  mutated = true;
@@ -123,9 +123,7 @@ export const AccountApiTokenProvider = () =>
123
123
  const oldPolicyFp = policyFingerprint(
124
124
  resolvePolicies(olds?.policies ?? []),
125
125
  );
126
- const newPolicyFp = policyFingerprint(
127
- resolvePolicies(news.policies),
128
- );
126
+ const newPolicyFp = policyFingerprint(resolvePolicies(news.policies));
129
127
  const oldCondFp = conditionFingerprint(olds?.condition);
130
128
  const newCondFp = conditionFingerprint(news.condition);
131
129
  if (
@@ -96,9 +96,7 @@ const resolveResources = (
96
96
  return out;
97
97
  };
98
98
 
99
- export const resolvePolicies = (
100
- policies: ApiTokenPolicy[],
101
- ): ResolvedPolicy[] =>
99
+ export const resolvePolicies = (policies: ApiTokenPolicy[]): ResolvedPolicy[] =>
102
100
  policies.map((policy) => ({
103
101
  effect: policy.effect,
104
102
  permissionGroups: policy.permissionGroups.map(resolvePermissionGroup),
@@ -102,9 +102,7 @@ export const UserApiTokenProvider = () =>
102
102
  const oldPolicyFp = policyFingerprint(
103
103
  resolvePolicies(olds?.policies ?? []),
104
104
  );
105
- const newPolicyFp = policyFingerprint(
106
- resolvePolicies(news.policies),
107
- );
105
+ const newPolicyFp = policyFingerprint(resolvePolicies(news.policies));
108
106
  const oldCondFp = conditionFingerprint(olds?.condition);
109
107
  const newCondFp = conditionFingerprint(news.condition);
110
108
  if (
@@ -240,7 +240,9 @@ export const fromCloudflareSocket = (cfSocket: cf.Socket): Socket.Socket => {
240
240
  ): Effect.Effect<void, Socket.SocketError | E, R> =>
241
241
  runRaw(
242
242
  (data) =>
243
- typeof data === "string" ? handler(data) : handler(decoder.decode(data)),
243
+ typeof data === "string"
244
+ ? handler(data)
245
+ : handler(decoder.decode(data)),
244
246
  opts,
245
247
  );
246
248
 
@@ -690,42 +690,42 @@ export const Worker: Platform<
690
690
  namespace: binding.namespace,
691
691
  } as any)
692
692
  : isDurableObjectNamespaceLike(binding)
693
- ? {
694
- type: "durable_object_namespace",
695
- name: bindingName,
696
- className: binding.className ?? binding.name,
697
- }
698
- : binding.Type === "Cloudflare.D1Database"
699
693
  ? {
700
- type: "d1",
701
- id: binding.databaseId,
694
+ type: "durable_object_namespace",
702
695
  name: bindingName,
696
+ className: binding.className ?? binding.name,
703
697
  }
704
- : binding.Type === "Cloudflare.R2Bucket"
698
+ : binding.Type === "Cloudflare.D1Database"
705
699
  ? {
706
- type: "r2_bucket",
700
+ type: "d1",
701
+ id: binding.databaseId,
707
702
  name: bindingName,
708
- bucketName: binding.bucketName,
709
- jurisdiction: binding.jurisdiction.pipe(
710
- Output.map((jurisdiction) =>
711
- jurisdiction === "default" ? undefined : jurisdiction,
712
- ),
713
- ),
714
703
  }
715
- : binding.Type === "Cloudflare.KVNamespace"
704
+ : binding.Type === "Cloudflare.R2Bucket"
716
705
  ? {
717
- type: "kv_namespace",
706
+ type: "r2_bucket",
718
707
  name: bindingName,
719
- namespaceId: binding.namespaceId,
708
+ bucketName: binding.bucketName,
709
+ jurisdiction: binding.jurisdiction.pipe(
710
+ Output.map((jurisdiction) =>
711
+ jurisdiction === "default" ? undefined : jurisdiction,
712
+ ),
713
+ ),
720
714
  }
721
- : binding.Type === "Cloudflare.Queue"
715
+ : binding.Type === "Cloudflare.KVNamespace"
722
716
  ? {
723
- type: "queue",
717
+ type: "kv_namespace",
724
718
  name: bindingName,
725
- queueName: binding.queueName,
719
+ namespaceId: binding.namespaceId,
726
720
  }
727
- : // TODO(sam): handle others
728
- undefined;
721
+ : binding.Type === "Cloudflare.Queue"
722
+ ? {
723
+ type: "queue",
724
+ name: bindingName,
725
+ queueName: binding.queueName,
726
+ }
727
+ : // TODO(sam): handle others
728
+ undefined;
729
729
 
730
730
  if (bindingMeta) {
731
731
  yield* resource.bind`${bindingName}`({
@@ -1018,14 +1018,27 @@ export const WorkerProvider = () =>
1018
1018
  maxLength: 54,
1019
1019
  }).pipe(Effect.map((name) => name.toLowerCase()));
1020
1020
 
1021
+ // Convert non-ASCII hostnames (emoji, IDN, etc.) to punycode so the
1022
+ // Cloudflare API receives the form it stores domains in. `new URL(...)`
1023
+ // does IDNA via WHATWG URL parsing — `📦.alchemy.run` → `xn--5z8h.alchemy.run`.
1024
+ const toPunycode = (hostname: string): string => {
1025
+ try {
1026
+ return new URL(`https://${hostname}`).hostname;
1027
+ } catch {
1028
+ return hostname;
1029
+ }
1030
+ };
1031
+
1021
1032
  const normalizeDomains = (
1022
1033
  domain: string | string[] | undefined,
1023
1034
  ): string[] =>
1024
1035
  domain === undefined
1025
1036
  ? []
1026
- : Array.isArray(domain)
1027
- ? Array.from(new Set(domain))
1028
- : [domain];
1037
+ : Array.from(
1038
+ new Set(
1039
+ (Array.isArray(domain) ? domain : [domain]).map(toPunycode),
1040
+ ),
1041
+ );
1029
1042
 
1030
1043
  /**
1031
1044
  * Infer the Cloudflare Zone ID for a given hostname by listing the
package/src/Output.ts CHANGED
@@ -353,8 +353,7 @@ function proxy(self: any): any {
353
353
  prop === ExprSymbol || prop === inspect ? true : prop in self,
354
354
  get: (target, prop) =>
355
355
  prop === Symbol.toPrimitive
356
- ? (hint: string) =>
357
- hint === "number" ? Number.NaN : self.toString()
356
+ ? (hint: string) => (hint === "number" ? Number.NaN : self.toString())
358
357
  : prop === ExprSymbol
359
358
  ? self
360
359
  : prop === inspect
@@ -53,13 +53,12 @@ const buildOtlpLayer = (
53
53
  * resolves to {@link Layer.empty}. Effect's default `Tracer` is a no-op,
54
54
  * so all `withSpan`/`Effect.fn` instrumentation in core stays free.
55
55
  */
56
- export const TelemetryLive: Layer.Layer<never, never, never> =
57
- Layer.unwrap(
58
- Effect.gen(function* () {
59
- if (yield* isTelemetryDisabled) {
60
- return Layer.empty;
61
- }
62
- const attrs = yield* collectAttributes;
63
- return buildOtlpLayer(attrs as unknown as Record<string, unknown>);
64
- }),
65
- );
56
+ export const TelemetryLive: Layer.Layer<never, never, never> = Layer.unwrap(
57
+ Effect.gen(function* () {
58
+ if (yield* isTelemetryDisabled) {
59
+ return Layer.empty;
60
+ }
61
+ const attrs = yield* collectAttributes;
62
+ return buildOtlpLayer(attrs as unknown as Record<string, unknown>);
63
+ }),
64
+ );
@@ -75,12 +75,7 @@ export const recordCli =
75
75
  ),
76
76
  );
77
77
 
78
- export type ResourceOp =
79
- | "precreate"
80
- | "create"
81
- | "update"
82
- | "delete"
83
- | "read";
78
+ export type ResourceOp = "precreate" | "create" | "update" | "delete" | "read";
84
79
 
85
80
  const elapsed = (startNs: bigint): Duration.Duration =>
86
81
  Duration.nanos(process.hrtime.bigint() - startNs);