alchemy 2.0.0-beta.17 → 2.0.0-beta.19
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 +428 -80
- package/bin/alchemy.js.map +1 -1
- package/bin/alchemy.ts +2 -0
- package/bin/commands/_shared.ts +34 -0
- package/bin/commands/bootstrap.ts +10 -3
- package/bin/commands/deploy.ts +23 -3
- package/bin/commands/login.ts +18 -3
- package/bin/commands/logs.ts +11 -2
- package/bin/commands/profile.ts +11 -5
- package/bin/commands/state.ts +21 -13
- package/bin/commands/tail.ts +10 -2
- package/lib/AWS/CloudFront/CachePolicy.d.ts +106 -0
- package/lib/AWS/CloudFront/CachePolicy.d.ts.map +1 -0
- package/lib/AWS/CloudFront/CachePolicy.js +147 -0
- package/lib/AWS/CloudFront/CachePolicy.js.map +1 -0
- package/lib/AWS/CloudFront/KeyGroup.d.ts +72 -0
- package/lib/AWS/CloudFront/KeyGroup.d.ts.map +1 -0
- package/lib/AWS/CloudFront/KeyGroup.js +136 -0
- package/lib/AWS/CloudFront/KeyGroup.js.map +1 -0
- package/lib/AWS/CloudFront/OriginRequestPolicy.d.ts +84 -0
- package/lib/AWS/CloudFront/OriginRequestPolicy.d.ts.map +1 -0
- package/lib/AWS/CloudFront/OriginRequestPolicy.js +139 -0
- package/lib/AWS/CloudFront/OriginRequestPolicy.js.map +1 -0
- package/lib/AWS/CloudFront/PublicKey.d.ts +72 -0
- package/lib/AWS/CloudFront/PublicKey.d.ts.map +1 -0
- package/lib/AWS/CloudFront/PublicKey.js +137 -0
- package/lib/AWS/CloudFront/PublicKey.js.map +1 -0
- package/lib/AWS/CloudFront/ResponseHeadersPolicy.d.ts +114 -0
- package/lib/AWS/CloudFront/ResponseHeadersPolicy.d.ts.map +1 -0
- package/lib/AWS/CloudFront/ResponseHeadersPolicy.js +162 -0
- package/lib/AWS/CloudFront/ResponseHeadersPolicy.js.map +1 -0
- package/lib/AWS/CloudFront/index.d.ts +5 -0
- package/lib/AWS/CloudFront/index.d.ts.map +1 -1
- package/lib/AWS/CloudFront/index.js +5 -0
- package/lib/AWS/CloudFront/index.js.map +1 -1
- package/lib/AWS/ECS/CapacityProvider.d.ts +102 -0
- package/lib/AWS/ECS/CapacityProvider.d.ts.map +1 -0
- package/lib/AWS/ECS/CapacityProvider.js +217 -0
- package/lib/AWS/ECS/CapacityProvider.js.map +1 -0
- package/lib/AWS/ECS/index.d.ts +1 -0
- package/lib/AWS/ECS/index.d.ts.map +1 -1
- package/lib/AWS/ECS/index.js +1 -0
- package/lib/AWS/ECS/index.js.map +1 -1
- package/lib/AWS/Providers.d.ts.map +1 -1
- package/lib/AWS/Providers.js +7 -1
- package/lib/AWS/Providers.js.map +1 -1
- package/lib/Agent/lsp/client.d.ts +2 -2
- package/lib/Apply.d.ts.map +1 -1
- package/lib/Apply.js +41 -9
- package/lib/Apply.js.map +1 -1
- package/lib/Axiom/Annotation.d.ts +49 -0
- package/lib/Axiom/Annotation.d.ts.map +1 -0
- package/lib/Axiom/Annotation.js +74 -0
- package/lib/Axiom/Annotation.js.map +1 -0
- package/lib/Axiom/ApiToken.d.ts +62 -0
- package/lib/Axiom/ApiToken.d.ts.map +1 -0
- package/lib/Axiom/ApiToken.js +98 -0
- package/lib/Axiom/ApiToken.js.map +1 -0
- package/lib/Axiom/AuthProvider.d.ts +48 -0
- package/lib/Axiom/AuthProvider.d.ts.map +1 -0
- package/lib/Axiom/AuthProvider.js +177 -0
- package/lib/Axiom/AuthProvider.js.map +1 -0
- package/lib/Axiom/Chart.d.ts +72 -0
- package/lib/Axiom/Chart.d.ts.map +1 -0
- package/lib/Axiom/Chart.js +14 -0
- package/lib/Axiom/Chart.js.map +1 -0
- package/lib/Axiom/Credentials.d.ts +12 -0
- package/lib/Axiom/Credentials.d.ts.map +1 -0
- package/lib/Axiom/Credentials.js +34 -0
- package/lib/Axiom/Credentials.js.map +1 -0
- package/lib/Axiom/Dashboard.d.ts +124 -0
- package/lib/Axiom/Dashboard.d.ts.map +1 -0
- package/lib/Axiom/Dashboard.js +140 -0
- package/lib/Axiom/Dashboard.js.map +1 -0
- package/lib/Axiom/Dataset.d.ts +101 -0
- package/lib/Axiom/Dataset.d.ts.map +1 -0
- package/lib/Axiom/Dataset.js +183 -0
- package/lib/Axiom/Dataset.js.map +1 -0
- package/lib/Axiom/Monitor.d.ts +74 -0
- package/lib/Axiom/Monitor.d.ts.map +1 -0
- package/lib/Axiom/Monitor.js +103 -0
- package/lib/Axiom/Monitor.js.map +1 -0
- package/lib/Axiom/Notifier.d.ts +63 -0
- package/lib/Axiom/Notifier.d.ts.map +1 -0
- package/lib/Axiom/Notifier.js +83 -0
- package/lib/Axiom/Notifier.js.map +1 -0
- package/lib/Axiom/Providers.d.ts +15 -0
- package/lib/Axiom/Providers.d.ts.map +1 -0
- package/lib/Axiom/Providers.js +32 -0
- package/lib/Axiom/Providers.js.map +1 -0
- package/lib/Axiom/View.d.ts +55 -0
- package/lib/Axiom/View.d.ts.map +1 -0
- package/lib/Axiom/View.js +79 -0
- package/lib/Axiom/View.js.map +1 -0
- package/lib/Axiom/VirtualField.d.ts +42 -0
- package/lib/Axiom/VirtualField.d.ts.map +1 -0
- package/lib/Axiom/VirtualField.js +71 -0
- package/lib/Axiom/VirtualField.js.map +1 -0
- package/lib/Axiom/index.d.ts +13 -0
- package/lib/Axiom/index.d.ts.map +1 -0
- package/lib/Axiom/index.js +13 -0
- package/lib/Axiom/index.js.map +1 -0
- package/lib/Bundle/Bundle.d.ts +20 -2
- package/lib/Bundle/Bundle.d.ts.map +1 -1
- package/lib/Bundle/Bundle.js +18 -3
- package/lib/Bundle/Bundle.js.map +1 -1
- package/lib/Bundle/PurePlugin.d.ts +109 -0
- package/lib/Bundle/PurePlugin.d.ts.map +1 -0
- package/lib/Bundle/PurePlugin.js +469 -0
- package/lib/Bundle/PurePlugin.js.map +1 -0
- package/lib/Bundle/index.d.ts +1 -0
- package/lib/Bundle/index.d.ts.map +1 -1
- package/lib/Bundle/index.js +1 -0
- package/lib/Bundle/index.js.map +1 -1
- package/lib/Cloudflare/Workers/Worker.d.ts +12 -0
- package/lib/Cloudflare/Workers/Worker.d.ts.map +1 -1
- package/lib/Cloudflare/Workers/Worker.js +19 -4
- package/lib/Cloudflare/Workers/Worker.js.map +1 -1
- package/lib/GitHub/Secrets.d.ts +45 -0
- package/lib/GitHub/Secrets.d.ts.map +1 -0
- package/lib/GitHub/Secrets.js +30 -0
- package/lib/GitHub/Secrets.js.map +1 -0
- package/lib/GitHub/index.d.ts +1 -0
- package/lib/GitHub/index.d.ts.map +1 -1
- package/lib/GitHub/index.js +1 -0
- package/lib/GitHub/index.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/Plan.d.ts.map +1 -1
- package/lib/Plan.js +10 -4
- package/lib/Plan.js.map +1 -1
- package/lib/Resource.d.ts +2 -2
- package/lib/Resource.d.ts.map +1 -1
- package/lib/Telemetry/Attributes.d.ts +43 -0
- package/lib/Telemetry/Attributes.d.ts.map +1 -0
- package/lib/Telemetry/Attributes.js +144 -0
- package/lib/Telemetry/Attributes.js.map +1 -0
- package/lib/Telemetry/Layer.d.ts +14 -0
- package/lib/Telemetry/Layer.d.ts.map +1 -0
- package/lib/Telemetry/Layer.js +50 -0
- package/lib/Telemetry/Layer.js.map +1 -0
- package/lib/Telemetry/Metrics.d.ts +34 -0
- package/lib/Telemetry/Metrics.d.ts.map +1 -0
- package/lib/Telemetry/Metrics.js +57 -0
- package/lib/Telemetry/Metrics.js.map +1 -0
- package/package.json +12 -1
- package/src/AWS/CloudFront/CachePolicy.ts +271 -0
- package/src/AWS/CloudFront/KeyGroup.ts +233 -0
- package/src/AWS/CloudFront/OriginRequestPolicy.ts +256 -0
- package/src/AWS/CloudFront/PublicKey.ts +245 -0
- package/src/AWS/CloudFront/ResponseHeadersPolicy.ts +308 -0
- package/src/AWS/CloudFront/index.ts +11 -0
- package/src/AWS/ECS/CapacityProvider.ts +336 -0
- package/src/AWS/ECS/index.ts +4 -0
- package/src/AWS/Providers.ts +12 -0
- package/src/Apply.ts +118 -9
- package/src/Axiom/Annotation.ts +95 -0
- package/src/Axiom/ApiToken.ts +125 -0
- package/src/Axiom/AuthProvider.ts +341 -0
- package/src/Axiom/Chart.ts +94 -0
- package/src/Axiom/Credentials.ts +70 -0
- package/src/Axiom/Dashboard.ts +192 -0
- package/src/Axiom/Dataset.ts +291 -0
- package/src/Axiom/Monitor.ts +122 -0
- package/src/Axiom/Notifier.ts +104 -0
- package/src/Axiom/Providers.ts +58 -0
- package/src/Axiom/View.ts +106 -0
- package/src/Axiom/VirtualField.ts +90 -0
- package/src/Axiom/index.ts +12 -0
- package/src/Bundle/Bundle.ts +39 -1
- package/src/Bundle/PurePlugin.ts +556 -0
- package/src/Bundle/index.ts +1 -0
- package/src/Cloudflare/Workers/Worker.ts +37 -6
- package/src/GitHub/Secrets.ts +66 -0
- package/src/GitHub/index.ts +1 -0
- package/src/Output.ts +2 -1
- package/src/Plan.ts +13 -4
- package/src/Resource.ts +2 -2
- package/src/Telemetry/Attributes.ts +216 -0
- package/src/Telemetry/Layer.ts +65 -0
- package/src/Telemetry/Metrics.ts +101 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as Operations from "@distilled.cloud/axiom/Operations";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { isResolved } from "../Diff.ts";
|
|
4
|
+
import * as Provider from "../Provider.ts";
|
|
5
|
+
import { Resource } from "../Resource.ts";
|
|
6
|
+
import type { Providers } from "./Providers.ts";
|
|
7
|
+
|
|
8
|
+
export type VirtualFieldProps = Operations.CreateVirtualFieldInput;
|
|
9
|
+
|
|
10
|
+
export type VirtualField = Resource<
|
|
11
|
+
"Axiom.VirtualField",
|
|
12
|
+
VirtualFieldProps,
|
|
13
|
+
Operations.CreateVirtualFieldOutput,
|
|
14
|
+
never,
|
|
15
|
+
Providers
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* An Axiom virtual field — a saved APL expression that appears as a derived
|
|
20
|
+
* column on a dataset at query time. Use these to standardise common
|
|
21
|
+
* computations (status classes, latency buckets, parsed JSON paths) so
|
|
22
|
+
* dashboards and monitors don't have to redefine them.
|
|
23
|
+
*
|
|
24
|
+
* Bound to a single `dataset`; changing the dataset triggers a replacement.
|
|
25
|
+
*
|
|
26
|
+
* @see https://axiom.co/docs/query-data/virtual-fields
|
|
27
|
+
*
|
|
28
|
+
* @section Creating a Virtual Field
|
|
29
|
+
* @example HTTP status class (e.g. 200 → "2xx")
|
|
30
|
+
* ```typescript
|
|
31
|
+
* yield* Axiom.VirtualField("status-class", {
|
|
32
|
+
* dataset: "my-app-traces",
|
|
33
|
+
* name: "status_class",
|
|
34
|
+
* description: "HTTP response class bucket",
|
|
35
|
+
* expression: 'strcat(tostring(toint(status / 100)), "xx")',
|
|
36
|
+
* type: "string",
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example Latency bucket in seconds
|
|
41
|
+
* ```typescript
|
|
42
|
+
* yield* Axiom.VirtualField("latency-bucket", {
|
|
43
|
+
* dataset: "my-app-traces",
|
|
44
|
+
* name: "latency_bucket_s",
|
|
45
|
+
* expression: "bin(duration_ms / 1000.0, 0.5)",
|
|
46
|
+
* type: "number",
|
|
47
|
+
* unit: "s",
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export const VirtualField = Resource<VirtualField>("Axiom.VirtualField");
|
|
52
|
+
|
|
53
|
+
export const VirtualFieldProvider = () =>
|
|
54
|
+
Provider.effect(
|
|
55
|
+
VirtualField,
|
|
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;
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
stables: ["id"],
|
|
64
|
+
diff: Effect.fn(function* ({ news, output }) {
|
|
65
|
+
if (!isResolved(news)) return undefined;
|
|
66
|
+
if (output && news.dataset !== output.dataset) {
|
|
67
|
+
return { action: "replace" } as const;
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
70
|
+
}),
|
|
71
|
+
create: Effect.fn(function* ({ news }) {
|
|
72
|
+
return yield* create(news);
|
|
73
|
+
}),
|
|
74
|
+
update: Effect.fn(function* ({ news, output }) {
|
|
75
|
+
return yield* update({ ...news, id: output.id });
|
|
76
|
+
}),
|
|
77
|
+
delete: Effect.fn(function* ({ output }) {
|
|
78
|
+
yield* del({ id: output.id }).pipe(
|
|
79
|
+
Effect.catchTag("NotFound", () => Effect.void),
|
|
80
|
+
);
|
|
81
|
+
}),
|
|
82
|
+
read: Effect.fn(function* ({ output }) {
|
|
83
|
+
if (!output?.id) return undefined;
|
|
84
|
+
return yield* get({ id: output.id }).pipe(
|
|
85
|
+
Effect.catchTag("NotFound", () => Effect.succeed(undefined)),
|
|
86
|
+
);
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
89
|
+
}),
|
|
90
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./Annotation.ts";
|
|
2
|
+
export * from "./ApiToken.ts";
|
|
3
|
+
export * from "./AuthProvider.ts";
|
|
4
|
+
export * from "./Chart.ts";
|
|
5
|
+
export * from "./Credentials.ts";
|
|
6
|
+
export * from "./Dashboard.ts";
|
|
7
|
+
export * from "./Dataset.ts";
|
|
8
|
+
export * from "./Monitor.ts";
|
|
9
|
+
export * from "./Notifier.ts";
|
|
10
|
+
export * from "./Providers.ts";
|
|
11
|
+
export * from "./View.ts";
|
|
12
|
+
export * from "./VirtualField.ts";
|
package/src/Bundle/Bundle.ts
CHANGED
|
@@ -7,6 +7,25 @@ import * as Stream from "effect/Stream";
|
|
|
7
7
|
import assert from "node:assert";
|
|
8
8
|
import * as rolldown from "rolldown";
|
|
9
9
|
import { sha256, sha256Object } from "../Util/sha256.ts";
|
|
10
|
+
import { purePlugin, type PurePluginOptions } from "./PurePlugin.ts";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Extra options accepted by {@link build} / {@link watch} on top of the
|
|
14
|
+
* standard rolldown input/output options.
|
|
15
|
+
*/
|
|
16
|
+
export interface BundleExtraOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Configures the {@link purePlugin} which annotates top-level
|
|
19
|
+
* call/new expressions in matching packages with `/*#__PURE__*\/`
|
|
20
|
+
* so rolldown can tree-shake them.
|
|
21
|
+
*
|
|
22
|
+
* - `undefined` (default): plugin is enabled with default packages
|
|
23
|
+
* (`effect`, `@effect/*`).
|
|
24
|
+
* - `PurePluginOptions`: plugin is enabled with the provided options.
|
|
25
|
+
* - `false`: plugin is disabled.
|
|
26
|
+
*/
|
|
27
|
+
readonly pure?: PurePluginOptions | false;
|
|
28
|
+
}
|
|
10
29
|
|
|
11
30
|
export interface BundleOutput {
|
|
12
31
|
/**
|
|
@@ -40,11 +59,13 @@ export class BundleError extends Data.TaggedError("BundleError")<{
|
|
|
40
59
|
export const build = (
|
|
41
60
|
inputOptions: rolldown.InputOptions,
|
|
42
61
|
outputOptions?: rolldown.OutputOptions,
|
|
62
|
+
extra?: BundleExtraOptions,
|
|
43
63
|
): Effect.Effect<BundleOutput, BundleError> =>
|
|
44
64
|
Effect.tryPromise({
|
|
45
65
|
try: async () => {
|
|
46
66
|
const bundle = await rolldown.rolldown({
|
|
47
67
|
...inputOptions,
|
|
68
|
+
plugins: withPurePlugin(inputOptions.plugins, extra?.pure),
|
|
48
69
|
optimization: inputOptions.optimization ?? {
|
|
49
70
|
inlineConst: {
|
|
50
71
|
mode: "smart",
|
|
@@ -71,6 +92,7 @@ export const build = (
|
|
|
71
92
|
export const watch = (
|
|
72
93
|
inputOptions: rolldown.InputOptions,
|
|
73
94
|
outputOptions?: rolldown.OutputOptions,
|
|
95
|
+
extra?: BundleExtraOptions,
|
|
74
96
|
): Stream.Stream<Result.Result<BundleOutput, BundleError>> =>
|
|
75
97
|
Stream.callback<Result.Result<rolldown.OutputBundle, BundleError>>((queue) =>
|
|
76
98
|
Effect.acquireRelease(
|
|
@@ -78,7 +100,7 @@ export const watch = (
|
|
|
78
100
|
const watcher = rolldown.watch({
|
|
79
101
|
...inputOptions,
|
|
80
102
|
plugins: [
|
|
81
|
-
inputOptions.plugins,
|
|
103
|
+
withPurePlugin(inputOptions.plugins, extra?.pure),
|
|
82
104
|
// The watcher event listener does not receive the bundle output, so we grab it using a plugin.
|
|
83
105
|
{
|
|
84
106
|
name: "alchemy:watch-bundle",
|
|
@@ -179,6 +201,22 @@ export function bundleOutputFromRolldownOutputBundle(
|
|
|
179
201
|
).pipe(Effect.flatMap(bundleOutputFromFiles));
|
|
180
202
|
}
|
|
181
203
|
|
|
204
|
+
/**
|
|
205
|
+
* Composes the user-provided plugin chain with the default
|
|
206
|
+
* {@link purePlugin} according to the `pure` option.
|
|
207
|
+
*
|
|
208
|
+
* The pure plugin is appended LAST so it sees module ids that have already
|
|
209
|
+
* been resolved into `node_modules/<pkg>/...` by upstream resolver plugins
|
|
210
|
+
* such as `@distilled.cloud/cloudflare-rolldown-plugin`.
|
|
211
|
+
*/
|
|
212
|
+
function withPurePlugin(
|
|
213
|
+
plugins: rolldown.RolldownPluginOption,
|
|
214
|
+
pure: PurePluginOptions | false | undefined,
|
|
215
|
+
): rolldown.RolldownPluginOption {
|
|
216
|
+
if (pure === false) return plugins;
|
|
217
|
+
return [plugins, purePlugin(pure ?? {})];
|
|
218
|
+
}
|
|
219
|
+
|
|
182
220
|
function bundleErrorFromUnknown(error: unknown): BundleError {
|
|
183
221
|
const message = error instanceof Error ? error.message : String(error);
|
|
184
222
|
return new BundleError({
|