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.
- package/bin/alchemy.js +1 -1
- package/bin/alchemy.js.map +1 -1
- package/bin/commands/bootstrap.ts +59 -57
- package/bin/commands/deploy.ts +8 -2
- package/bin/commands/login.ts +56 -49
- package/bin/commands/logs.ts +92 -90
- package/bin/commands/profile.ts +74 -70
- package/bin/commands/state.ts +160 -135
- package/bin/commands/tail.ts +94 -92
- package/lib/AWS/CloudFront/CachePolicy.d.ts.map +1 -1
- package/lib/AWS/CloudFront/CachePolicy.js.map +1 -1
- package/lib/AWS/CloudFront/KeyGroup.d.ts.map +1 -1
- package/lib/AWS/CloudFront/KeyGroup.js.map +1 -1
- package/lib/AWS/CloudFront/OriginRequestPolicy.d.ts.map +1 -1
- package/lib/AWS/CloudFront/OriginRequestPolicy.js +3 -1
- package/lib/AWS/CloudFront/OriginRequestPolicy.js.map +1 -1
- package/lib/AWS/CloudFront/PublicKey.d.ts.map +1 -1
- package/lib/AWS/CloudFront/PublicKey.js.map +1 -1
- package/lib/AWS/ECS/CapacityProvider.d.ts.map +1 -1
- package/lib/AWS/ECS/CapacityProvider.js +5 -4
- package/lib/AWS/ECS/CapacityProvider.js.map +1 -1
- package/lib/Axiom/Annotation.d.ts +3 -3
- package/lib/Axiom/Annotation.d.ts.map +1 -1
- package/lib/Axiom/Annotation.js +5 -5
- package/lib/Axiom/Annotation.js.map +1 -1
- package/lib/Axiom/ApiToken.d.ts +3 -3
- package/lib/Axiom/ApiToken.d.ts.map +1 -1
- package/lib/Axiom/ApiToken.js +4 -4
- package/lib/Axiom/ApiToken.js.map +1 -1
- package/lib/Axiom/AuthProvider.js.map +1 -1
- package/lib/Axiom/Credentials.d.ts +1 -1
- package/lib/Axiom/Credentials.d.ts.map +1 -1
- package/lib/Axiom/Credentials.js +2 -3
- package/lib/Axiom/Credentials.js.map +1 -1
- package/lib/Axiom/Dashboard.d.ts +4 -4
- package/lib/Axiom/Dashboard.d.ts.map +1 -1
- package/lib/Axiom/Dashboard.js +5 -5
- package/lib/Axiom/Dashboard.js.map +1 -1
- package/lib/Axiom/Dataset.d.ts.map +1 -1
- package/lib/Axiom/Dataset.js +5 -5
- package/lib/Axiom/Dataset.js.map +1 -1
- package/lib/Axiom/Monitor.d.ts +3 -3
- package/lib/Axiom/Monitor.d.ts.map +1 -1
- package/lib/Axiom/Monitor.js +6 -6
- package/lib/Axiom/Monitor.js.map +1 -1
- package/lib/Axiom/Notifier.d.ts +3 -3
- package/lib/Axiom/Notifier.d.ts.map +1 -1
- package/lib/Axiom/Notifier.js +9 -6
- package/lib/Axiom/Notifier.js.map +1 -1
- package/lib/Axiom/View.d.ts +3 -3
- package/lib/Axiom/View.d.ts.map +1 -1
- package/lib/Axiom/View.js +5 -5
- package/lib/Axiom/View.js.map +1 -1
- package/lib/Axiom/VirtualField.d.ts +3 -3
- package/lib/Axiom/VirtualField.d.ts.map +1 -1
- package/lib/Axiom/VirtualField.js +5 -5
- package/lib/Axiom/VirtualField.js.map +1 -1
- package/lib/Bundle/PurePlugin.d.ts.map +1 -1
- package/lib/Bundle/PurePlugin.js +4 -4
- package/lib/Bundle/PurePlugin.js.map +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/AccountApiToken.js.map +1 -1
- package/lib/Cloudflare/ApiToken/Common.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/Common.js.map +1 -1
- package/lib/Cloudflare/ApiToken/UserApiToken.d.ts.map +1 -1
- package/lib/Cloudflare/ApiToken/UserApiToken.js.map +1 -1
- package/lib/Cloudflare/Fetcher.d.ts.map +1 -1
- package/lib/Cloudflare/Fetcher.js +3 -1
- package/lib/Cloudflare/Fetcher.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +12 -3
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/Output.d.ts.map +1 -1
- package/lib/Output.js +1 -1
- package/lib/Output.js.map +1 -1
- package/lib/Telemetry/Layer.d.ts.map +1 -1
- package/lib/Telemetry/Layer.js.map +1 -1
- package/lib/Telemetry/Metrics.d.ts.map +1 -1
- package/lib/Telemetry/Metrics.js.map +1 -1
- package/package.json +5 -5
- package/src/AWS/CloudFront/CachePolicy.ts +5 -2
- package/src/AWS/CloudFront/KeyGroup.ts +2 -1
- package/src/AWS/CloudFront/OriginRequestPolicy.ts +8 -2
- package/src/AWS/CloudFront/PublicKey.ts +2 -1
- package/src/AWS/ECS/CapacityProvider.ts +12 -9
- package/src/Axiom/Annotation.ts +7 -7
- package/src/Axiom/ApiToken.ts +6 -6
- package/src/Axiom/AuthProvider.ts +2 -7
- package/src/Axiom/Credentials.ts +2 -6
- package/src/Axiom/Dashboard.ts +10 -13
- package/src/Axiom/Dataset.ts +8 -12
- package/src/Axiom/Monitor.ts +8 -8
- package/src/Axiom/Notifier.ts +11 -8
- package/src/Axiom/View.ts +7 -7
- package/src/Axiom/VirtualField.ts +7 -7
- package/src/Bundle/PurePlugin.ts +6 -5
- package/src/Cloudflare/ApiToken/AccountApiToken.ts +1 -3
- package/src/Cloudflare/ApiToken/Common.ts +1 -3
- package/src/Cloudflare/ApiToken/UserApiToken.ts +1 -3
- package/src/Cloudflare/Fetcher.ts +3 -1
- package/src/Cloudflare/Workers/Worker.ts +40 -27
- package/src/Output.ts +1 -2
- package/src/Telemetry/Layer.ts +9 -10
- 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 {
|
package/src/Axiom/Credentials.ts
CHANGED
|
@@ -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 {
|
package/src/Axiom/Dashboard.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
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 =
|
|
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:
|
|
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*
|
|
142
|
-
const update = yield*
|
|
143
|
-
const get = yield*
|
|
144
|
-
const del = yield*
|
|
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:
|
|
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:
|
|
152
|
+
const toAttrsFromGet = (current: Axiom.GetDashboardOutput) => ({
|
|
156
153
|
uid: current.uid,
|
|
157
154
|
id: current.id,
|
|
158
155
|
createdAt: current.createdAt,
|
package/src/Axiom/Dataset.ts
CHANGED
|
@@ -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*
|
|
173
|
-
const update = yield*
|
|
174
|
-
const get = yield*
|
|
175
|
-
const del = yield*
|
|
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
|
-
|
|
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* () {
|
package/src/Axiom/Monitor.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as
|
|
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 =
|
|
8
|
+
export type MonitorProps = Axiom.CreateMonitorInput;
|
|
9
9
|
|
|
10
10
|
export type Monitor = Resource<
|
|
11
11
|
"Axiom.Monitor",
|
|
12
12
|
MonitorProps,
|
|
13
|
-
|
|
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*
|
|
90
|
-
const update = yield*
|
|
91
|
-
const get = yield*
|
|
92
|
-
const del = yield*
|
|
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"],
|
package/src/Axiom/Notifier.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as
|
|
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 =
|
|
7
|
+
export type NotifierProps = Axiom.CreateNotifierInput;
|
|
8
8
|
|
|
9
9
|
export type Notifier = Resource<
|
|
10
10
|
"Axiom.Notifier",
|
|
11
11
|
NotifierProps,
|
|
12
|
-
|
|
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*
|
|
76
|
-
const update = yield*
|
|
77
|
-
const get = yield*
|
|
78
|
-
const del = yield*
|
|
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) => ({
|
|
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
|
|
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 =
|
|
8
|
+
export type ViewProps = Axiom.CreateViewInput;
|
|
9
9
|
|
|
10
10
|
export type View = Resource<
|
|
11
11
|
"Axiom.View",
|
|
12
12
|
ViewProps,
|
|
13
|
-
|
|
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*
|
|
71
|
-
const update = yield*
|
|
72
|
-
const get = yield*
|
|
73
|
-
const del = yield*
|
|
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
|
|
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 =
|
|
8
|
+
export type VirtualFieldProps = Axiom.CreateVirtualFieldInput;
|
|
9
9
|
|
|
10
10
|
export type VirtualField = Resource<
|
|
11
11
|
"Axiom.VirtualField",
|
|
12
12
|
VirtualFieldProps,
|
|
13
|
-
|
|
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*
|
|
58
|
-
const update = yield*
|
|
59
|
-
const get = yield*
|
|
60
|
-
const del = yield*
|
|
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"],
|
package/src/Bundle/PurePlugin.ts
CHANGED
|
@@ -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 &&
|
|
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 =
|
|
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"
|
|
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: "
|
|
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.
|
|
698
|
+
: binding.Type === "Cloudflare.D1Database"
|
|
705
699
|
? {
|
|
706
|
-
type: "
|
|
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.
|
|
704
|
+
: binding.Type === "Cloudflare.R2Bucket"
|
|
716
705
|
? {
|
|
717
|
-
type: "
|
|
706
|
+
type: "r2_bucket",
|
|
718
707
|
name: bindingName,
|
|
719
|
-
|
|
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.
|
|
715
|
+
: binding.Type === "Cloudflare.KVNamespace"
|
|
722
716
|
? {
|
|
723
|
-
type: "
|
|
717
|
+
type: "kv_namespace",
|
|
724
718
|
name: bindingName,
|
|
725
|
-
|
|
719
|
+
namespaceId: binding.namespaceId,
|
|
726
720
|
}
|
|
727
|
-
:
|
|
728
|
-
|
|
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.
|
|
1027
|
-
|
|
1028
|
-
|
|
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
|
package/src/Telemetry/Layer.ts
CHANGED
|
@@ -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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
);
|
package/src/Telemetry/Metrics.ts
CHANGED
|
@@ -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);
|