alchemy 0.17.2 → 0.19.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/lib/ai/document.d.ts +11 -0
- package/lib/ai/document.d.ts.map +1 -1
- package/lib/ai/document.js +1 -1
- package/lib/ai/document.js.map +1 -1
- package/lib/alchemy.d.ts.map +1 -1
- package/lib/alchemy.js +1 -2
- package/lib/alchemy.js.map +1 -1
- package/lib/aws/control/client.d.ts +134 -0
- package/lib/aws/control/client.d.ts.map +1 -0
- package/lib/aws/control/client.js +232 -0
- package/lib/aws/control/client.js.map +1 -0
- package/lib/aws/control/error.d.ts +63 -0
- package/lib/aws/control/error.d.ts.map +1 -0
- package/lib/aws/control/error.js +93 -0
- package/lib/aws/control/error.js.map +1 -0
- package/lib/aws/control/index.d.ts +6 -0
- package/lib/aws/control/index.d.ts.map +1 -0
- package/lib/aws/control/index.js +6 -0
- package/lib/aws/control/index.js.map +1 -0
- package/lib/aws/control/properties.d.ts +1874 -0
- package/lib/aws/control/properties.d.ts.map +1 -0
- package/lib/aws/control/properties.js +6945 -0
- package/lib/aws/control/properties.js.map +1 -0
- package/lib/aws/control/proxy.d.ts +7 -0
- package/lib/aws/control/proxy.d.ts.map +1 -0
- package/lib/aws/control/proxy.js +29 -0
- package/lib/aws/control/proxy.js.map +1 -0
- package/lib/aws/control/resource.d.ts +110 -0
- package/lib/aws/control/resource.d.ts.map +1 -0
- package/lib/aws/control/resource.js +192 -0
- package/lib/aws/control/resource.js.map +1 -0
- package/lib/cloudflare/website.d.ts.map +1 -1
- package/lib/cloudflare/website.js +8 -9
- package/lib/cloudflare/website.js.map +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +2 -2
- package/lib/destroy.js.map +1 -1
- package/lib/resource.d.ts +7 -1
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +20 -0
- package/lib/resource.js.map +1 -1
- package/lib/test/bun.d.ts.map +1 -1
- package/lib/test/bun.js +1 -2
- package/lib/test/bun.js.map +1 -1
- package/package.json +5 -1
- package/src/ai/document.ts +1 -1
- package/src/alchemy.ts +2 -3
- package/src/aws/control/client.ts +450 -0
- package/src/aws/control/error.ts +84 -0
- package/src/aws/control/index.ts +6 -0
- package/src/aws/control/properties.ts +6946 -0
- package/src/aws/control/proxy.ts +40 -0
- package/src/aws/control/resource.ts +346 -0
- package/src/aws/control/types.d.ts +85129 -0
- package/src/cloudflare/website.ts +8 -9
- package/src/destroy.ts +4 -7
- package/src/resource.ts +32 -1
- package/src/test/bun.ts +1 -2
|
@@ -66,6 +66,7 @@ export async function Website<B extends Bindings>(
|
|
|
66
66
|
if (props.bindings?.ASSETS) {
|
|
67
67
|
throw new Error("ASSETS binding is reserved for internal use");
|
|
68
68
|
}
|
|
69
|
+
const wrangler = props.wrangler ?? true;
|
|
69
70
|
|
|
70
71
|
return alchemy.run(id, async () => {
|
|
71
72
|
// building the site requires a wrangler.jsonc file to start
|
|
@@ -73,19 +74,17 @@ export async function Website<B extends Bindings>(
|
|
|
73
74
|
|
|
74
75
|
const cwd = path.resolve(props.cwd || process.cwd());
|
|
75
76
|
const fileName =
|
|
76
|
-
typeof
|
|
77
|
+
typeof wrangler === "boolean"
|
|
77
78
|
? "wrangler.jsonc"
|
|
78
|
-
: typeof
|
|
79
|
-
?
|
|
80
|
-
: (
|
|
79
|
+
: typeof wrangler === "string"
|
|
80
|
+
? wrangler
|
|
81
|
+
: (wrangler?.path ?? "wrangler.jsonc");
|
|
81
82
|
const wranglerPath =
|
|
82
83
|
fileName && path.relative(cwd, path.join(cwd, fileName));
|
|
83
84
|
const wranglerMain =
|
|
84
|
-
typeof
|
|
85
|
-
? (props.wrangler.main ?? props.main)
|
|
86
|
-
: props.main;
|
|
85
|
+
typeof wrangler === "object" ? (wrangler.main ?? props.main) : props.main;
|
|
87
86
|
|
|
88
|
-
if (
|
|
87
|
+
if (wrangler) {
|
|
89
88
|
try {
|
|
90
89
|
await fs.access(wranglerPath!);
|
|
91
90
|
} catch {
|
|
@@ -142,7 +141,7 @@ export default {
|
|
|
142
141
|
},
|
|
143
142
|
});
|
|
144
143
|
|
|
145
|
-
if (
|
|
144
|
+
if (wrangler) {
|
|
146
145
|
await WranglerJson("wrangler.jsonc", {
|
|
147
146
|
path: wranglerPath,
|
|
148
147
|
worker,
|
package/src/destroy.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { alchemy } from "./alchemy.js";
|
|
2
2
|
import { context } from "./context.js";
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
resolveDeletionHandler,
|
|
5
|
+
type Resource,
|
|
5
6
|
ResourceFQN,
|
|
6
7
|
ResourceID,
|
|
7
8
|
ResourceKind,
|
|
8
9
|
ResourceScope,
|
|
9
10
|
ResourceSeq,
|
|
10
|
-
type Provider,
|
|
11
|
-
type Resource,
|
|
12
11
|
} from "./resource.js";
|
|
13
12
|
import { Scope } from "./scope.js";
|
|
14
13
|
|
|
@@ -70,9 +69,7 @@ export async function destroy<Type extends string>(
|
|
|
70
69
|
return await destroy(scope, options);
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
const Provider
|
|
74
|
-
instance[ResourceKind],
|
|
75
|
-
);
|
|
72
|
+
const Provider = resolveDeletionHandler(instance[ResourceKind]);
|
|
76
73
|
if (!Provider) {
|
|
77
74
|
throw new Error(
|
|
78
75
|
`Cannot destroy resource "${instance[ResourceFQN]}" type ${instance[ResourceKind]} - no provider found. You may need to import the provider in your alchemy.config.ts.`,
|
|
@@ -124,7 +121,7 @@ export async function destroy<Type extends string>(
|
|
|
124
121
|
nestedScope = scope;
|
|
125
122
|
return await Provider.handler.bind(ctx)(
|
|
126
123
|
instance[ResourceID],
|
|
127
|
-
state.props
|
|
124
|
+
state.props!,
|
|
128
125
|
);
|
|
129
126
|
},
|
|
130
127
|
);
|
package/src/resource.ts
CHANGED
|
@@ -2,7 +2,38 @@ import { apply } from "./apply.js";
|
|
|
2
2
|
import type { Context } from "./context.js";
|
|
3
3
|
import { Scope as _Scope, type Scope } from "./scope.js";
|
|
4
4
|
|
|
5
|
-
export const PROVIDERS
|
|
5
|
+
export const PROVIDERS: Map<ResourceKind, Provider<string, any>> = new Map<
|
|
6
|
+
ResourceKind,
|
|
7
|
+
Provider<string, any>
|
|
8
|
+
>();
|
|
9
|
+
const DYNAMIC_RESOURCE_RESOLVERS: DynamicResourceResolver[] = [];
|
|
10
|
+
|
|
11
|
+
export type DynamicResourceResolver = (
|
|
12
|
+
typeName: string,
|
|
13
|
+
) => Provider | undefined;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Register a function that will be called if a Resource Type cannot be found during deletion.
|
|
17
|
+
*/
|
|
18
|
+
export function registerDynamicResource(
|
|
19
|
+
handler: DynamicResourceResolver,
|
|
20
|
+
): void {
|
|
21
|
+
DYNAMIC_RESOURCE_RESOLVERS.push(handler);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function resolveDeletionHandler(typeName: string): Provider | undefined {
|
|
25
|
+
const provider: Provider<string, any> | undefined = PROVIDERS.get(typeName);
|
|
26
|
+
if (provider) {
|
|
27
|
+
return provider;
|
|
28
|
+
}
|
|
29
|
+
for (const handler of DYNAMIC_RESOURCE_RESOLVERS) {
|
|
30
|
+
const result = handler(typeName);
|
|
31
|
+
if (result) {
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
6
37
|
|
|
7
38
|
export type ResourceID = string;
|
|
8
39
|
export const ResourceID = Symbol.for("alchemy::ResourceID");
|
package/src/test/bun.ts
CHANGED
|
@@ -191,7 +191,7 @@ export function test(meta: ImportMeta, defaultOptions?: TestOptions): test {
|
|
|
191
191
|
|
|
192
192
|
return it(
|
|
193
193
|
testName,
|
|
194
|
-
|
|
194
|
+
() =>
|
|
195
195
|
alchemy.run(
|
|
196
196
|
testName,
|
|
197
197
|
{
|
|
@@ -199,7 +199,6 @@ export function test(meta: ImportMeta, defaultOptions?: TestOptions): test {
|
|
|
199
199
|
parent: scope,
|
|
200
200
|
},
|
|
201
201
|
async (scope) => {
|
|
202
|
-
// Enter test scope since bun calls from different scope
|
|
203
202
|
await scope.run(() => fn(scope));
|
|
204
203
|
},
|
|
205
204
|
),
|