alchemy 0.58.0 → 0.59.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/bin/alchemy.js +1 -1
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +10 -2
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/assets.d.ts +1 -1
- package/lib/cloudflare/assets.d.ts.map +1 -1
- package/lib/cloudflare/bucket.d.ts +21 -3
- package/lib/cloudflare/bucket.d.ts.map +1 -1
- package/lib/cloudflare/bucket.js +83 -53
- package/lib/cloudflare/bucket.js.map +1 -1
- package/lib/cloudflare/container.d.ts +8 -0
- package/lib/cloudflare/container.d.ts.map +1 -1
- package/lib/cloudflare/container.js +7 -1
- package/lib/cloudflare/container.js.map +1 -1
- package/lib/cloudflare/custom-domain.d.ts +8 -0
- package/lib/cloudflare/custom-domain.d.ts.map +1 -1
- package/lib/cloudflare/custom-domain.js +11 -0
- package/lib/cloudflare/custom-domain.js.map +1 -1
- package/lib/cloudflare/d1-database.d.ts +15 -1
- package/lib/cloudflare/d1-database.d.ts.map +1 -1
- package/lib/cloudflare/d1-database.js +24 -17
- package/lib/cloudflare/d1-database.js.map +1 -1
- package/lib/cloudflare/hyperdrive.d.ts +37 -9
- package/lib/cloudflare/hyperdrive.d.ts.map +1 -1
- package/lib/cloudflare/hyperdrive.js +91 -5
- package/lib/cloudflare/hyperdrive.js.map +1 -1
- package/lib/cloudflare/kv-namespace.d.ts +23 -4
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -1
- package/lib/cloudflare/kv-namespace.js +70 -58
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/miniflare/build-worker-options.d.ts +2 -0
- package/lib/cloudflare/miniflare/build-worker-options.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/build-worker-options.js +9 -7
- package/lib/cloudflare/miniflare/build-worker-options.js.map +1 -1
- package/lib/cloudflare/miniflare/delete.d.ts +21 -0
- package/lib/cloudflare/miniflare/delete.d.ts.map +1 -0
- package/lib/cloudflare/miniflare/delete.js +91 -0
- package/lib/cloudflare/miniflare/delete.js.map +1 -0
- package/lib/cloudflare/miniflare/miniflare-controller.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/miniflare-controller.js +26 -9
- package/lib/cloudflare/miniflare/miniflare-controller.js.map +1 -1
- package/lib/cloudflare/miniflare/remote-binding-proxy.d.ts +2 -0
- package/lib/cloudflare/miniflare/remote-binding-proxy.d.ts.map +1 -1
- package/lib/cloudflare/miniflare/remote-binding-proxy.js +3 -4
- package/lib/cloudflare/miniflare/remote-binding-proxy.js.map +1 -1
- package/lib/cloudflare/pipeline.d.ts +3 -0
- package/lib/cloudflare/pipeline.d.ts.map +1 -1
- package/lib/cloudflare/pipeline.js +14 -1
- package/lib/cloudflare/pipeline.js.map +1 -1
- package/lib/cloudflare/queue-consumer.d.ts +8 -0
- package/lib/cloudflare/queue-consumer.d.ts.map +1 -1
- package/lib/cloudflare/queue-consumer.js +15 -4
- package/lib/cloudflare/queue-consumer.js.map +1 -1
- package/lib/cloudflare/queue.d.ts +22 -4
- package/lib/cloudflare/queue.d.ts.map +1 -1
- package/lib/cloudflare/queue.js +32 -9
- package/lib/cloudflare/queue.js.map +1 -1
- package/lib/cloudflare/route.d.ts +8 -0
- package/lib/cloudflare/route.d.ts.map +1 -1
- package/lib/cloudflare/route.js +13 -0
- package/lib/cloudflare/route.js.map +1 -1
- package/lib/cloudflare/worker-subdomain.d.ts +8 -0
- package/lib/cloudflare/worker-subdomain.d.ts.map +1 -1
- package/lib/cloudflare/worker-subdomain.js +9 -1
- package/lib/cloudflare/worker-subdomain.js.map +1 -1
- package/lib/cloudflare/worker.d.ts +7 -1
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +405 -375
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/cloudflare/wrangler.json.d.ts +1 -1
- package/lib/cloudflare/wrangler.json.d.ts.map +1 -1
- package/lib/cloudflare/wrangler.json.js +24 -12
- package/lib/cloudflare/wrangler.json.js.map +1 -1
- package/lib/esbuild/bundle.d.ts +1 -1
- package/lib/secret.d.ts +9 -1
- package/lib/secret.d.ts.map +1 -1
- package/lib/secret.js +12 -0
- package/lib/secret.js.map +1 -1
- package/package.json +1 -1
- package/src/cloudflare/api.ts +13 -2
- package/src/cloudflare/bucket.ts +126 -68
- package/src/cloudflare/container.ts +18 -1
- package/src/cloudflare/custom-domain.ts +22 -0
- package/src/cloudflare/d1-database.ts +44 -19
- package/src/cloudflare/hyperdrive.ts +170 -14
- package/src/cloudflare/kv-namespace.ts +117 -73
- package/src/cloudflare/miniflare/build-worker-options.ts +12 -8
- package/src/cloudflare/miniflare/delete.ts +136 -0
- package/src/cloudflare/miniflare/miniflare-controller.ts +26 -9
- package/src/cloudflare/miniflare/remote-binding-proxy.ts +5 -4
- package/src/cloudflare/pipeline.ts +17 -1
- package/src/cloudflare/queue-consumer.ts +27 -5
- package/src/cloudflare/queue.ts +62 -12
- package/src/cloudflare/route.ts +24 -0
- package/src/cloudflare/worker-subdomain.ts +29 -6
- package/src/cloudflare/worker.ts +484 -465
- package/src/cloudflare/wrangler.json.ts +34 -13
- package/src/secret.ts +15 -1
- package/templates/astro/README.md +2 -0
- package/templates/nuxt/README.md +2 -0
- package/templates/react-router/README.md +2 -0
- package/templates/rwsdk/README.md +2 -0
- package/templates/sveltekit/README.md +2 -0
- package/templates/tanstack-start/README.md +2 -0
- package/templates/typescript/README.md +2 -0
- package/templates/vite/README.md +2 -0
|
@@ -178,6 +178,7 @@ export const WranglerJson = Resource(
|
|
|
178
178
|
worker.name,
|
|
179
179
|
cwd,
|
|
180
180
|
props.secrets ?? false,
|
|
181
|
+
this.scope.local && !props.worker.dev?.remote,
|
|
181
182
|
);
|
|
182
183
|
}
|
|
183
184
|
|
|
@@ -450,7 +451,11 @@ export interface WranglerJsonSpec {
|
|
|
450
451
|
/**
|
|
451
452
|
* Hyperdrive bindings
|
|
452
453
|
*/
|
|
453
|
-
hyperdrive?: {
|
|
454
|
+
hyperdrive?: {
|
|
455
|
+
binding: string;
|
|
456
|
+
id: string;
|
|
457
|
+
localConnectionString?: string;
|
|
458
|
+
}[];
|
|
454
459
|
|
|
455
460
|
/**
|
|
456
461
|
* Pipelines
|
|
@@ -500,6 +505,7 @@ function processBindings(
|
|
|
500
505
|
workerName: string,
|
|
501
506
|
workerCwd: string,
|
|
502
507
|
writeSecrets: boolean,
|
|
508
|
+
local: boolean,
|
|
503
509
|
): void {
|
|
504
510
|
// Arrays to collect different binding types
|
|
505
511
|
const kvNamespaces: {
|
|
@@ -563,7 +569,7 @@ function processBindings(
|
|
|
563
569
|
const hyperdrive: {
|
|
564
570
|
binding: string;
|
|
565
571
|
id: string;
|
|
566
|
-
localConnectionString
|
|
572
|
+
localConnectionString?: string;
|
|
567
573
|
}[] = [];
|
|
568
574
|
const pipelines: { binding: string; pipeline: string }[] = [];
|
|
569
575
|
const secretsStoreSecrets: {
|
|
@@ -624,7 +630,12 @@ function processBindings(
|
|
|
624
630
|
});
|
|
625
631
|
} else if (binding.type === "kv_namespace") {
|
|
626
632
|
// KV Namespace binding
|
|
627
|
-
const id =
|
|
633
|
+
const id =
|
|
634
|
+
"dev" in binding && !binding.dev?.remote && local
|
|
635
|
+
? binding.dev.id
|
|
636
|
+
: "namespaceId" in binding
|
|
637
|
+
? binding.namespaceId
|
|
638
|
+
: binding.id;
|
|
628
639
|
kvNamespaces.push({
|
|
629
640
|
binding: bindingName,
|
|
630
641
|
id: id,
|
|
@@ -651,10 +662,14 @@ function processBindings(
|
|
|
651
662
|
new_classes.push(doBinding.className);
|
|
652
663
|
}
|
|
653
664
|
} else if (binding.type === "r2_bucket") {
|
|
665
|
+
const name =
|
|
666
|
+
"dev" in binding && !binding.dev?.remote && local
|
|
667
|
+
? binding.dev.id
|
|
668
|
+
: binding.name;
|
|
654
669
|
r2Buckets.push({
|
|
655
670
|
binding: bindingName,
|
|
656
|
-
bucket_name:
|
|
657
|
-
preview_bucket_name:
|
|
671
|
+
bucket_name: name,
|
|
672
|
+
preview_bucket_name: name,
|
|
658
673
|
...(binding.dev?.remote ? { experimental_remote: true } : {}),
|
|
659
674
|
});
|
|
660
675
|
} else if (binding.type === "secret") {
|
|
@@ -673,18 +688,26 @@ function processBindings(
|
|
|
673
688
|
script_name: binding.scriptName,
|
|
674
689
|
});
|
|
675
690
|
} else if (binding.type === "d1") {
|
|
691
|
+
const id =
|
|
692
|
+
"dev" in binding && !binding.dev?.remote && local
|
|
693
|
+
? binding.dev.id
|
|
694
|
+
: binding.id;
|
|
676
695
|
d1Databases.push({
|
|
677
696
|
binding: bindingName,
|
|
678
|
-
database_id:
|
|
697
|
+
database_id: id,
|
|
679
698
|
database_name: binding.name,
|
|
680
699
|
migrations_dir: binding.migrationsDir,
|
|
681
|
-
preview_database_id:
|
|
700
|
+
preview_database_id: id,
|
|
682
701
|
...(binding.dev?.remote ? { experimental_remote: true } : {}),
|
|
683
702
|
});
|
|
684
703
|
} else if (binding.type === "queue") {
|
|
704
|
+
const id =
|
|
705
|
+
"dev" in binding && !binding.dev?.remote && local
|
|
706
|
+
? binding.dev.id
|
|
707
|
+
: binding.id;
|
|
685
708
|
queues.producers.push({
|
|
686
709
|
binding: bindingName,
|
|
687
|
-
queue:
|
|
710
|
+
queue: id,
|
|
688
711
|
});
|
|
689
712
|
} else if (binding.type === "vectorize") {
|
|
690
713
|
vectorizeIndexes.push({
|
|
@@ -737,14 +760,12 @@ function processBindings(
|
|
|
737
760
|
binding: bindingName,
|
|
738
761
|
};
|
|
739
762
|
} else if (binding.type === "hyperdrive") {
|
|
740
|
-
const password =
|
|
741
|
-
"password" in binding.origin
|
|
742
|
-
? binding.origin.password.unencrypted
|
|
743
|
-
: binding.origin.access_client_secret.unencrypted;
|
|
744
763
|
hyperdrive.push({
|
|
745
764
|
binding: bindingName,
|
|
746
765
|
id: binding.hyperdriveId,
|
|
747
|
-
localConnectionString:
|
|
766
|
+
localConnectionString: writeSecrets
|
|
767
|
+
? binding.dev.origin.unencrypted
|
|
768
|
+
: undefined,
|
|
748
769
|
});
|
|
749
770
|
} else if (binding.type === "pipeline") {
|
|
750
771
|
pipelines.push({
|
package/src/secret.ts
CHANGED
|
@@ -72,6 +72,20 @@ export class Secret<T = string> {
|
|
|
72
72
|
globalSecrets[name] = this;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Ensures that a value is wrapped in a Secret.
|
|
77
|
+
*/
|
|
78
|
+
static wrap<T>(value: T | Secret<T>): Secret<T> {
|
|
79
|
+
return isSecret<T>(value) ? value : new Secret(value);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Unwraps a Secret if it is wrapped, otherwise returns the value.
|
|
84
|
+
*/
|
|
85
|
+
static unwrap<T, U = T>(value: T | Secret<U>): T | U {
|
|
86
|
+
return isSecret<U>(value) ? value.unencrypted : value;
|
|
87
|
+
}
|
|
88
|
+
|
|
75
89
|
/**
|
|
76
90
|
* Override toString to prevent accidental exposure of secret values
|
|
77
91
|
*/
|
|
@@ -90,7 +104,7 @@ export class Secret<T = string> {
|
|
|
90
104
|
/**
|
|
91
105
|
* Type guard to check if a value is a Secret wrapper
|
|
92
106
|
*/
|
|
93
|
-
export function isSecret(binding: any): binding is Secret {
|
|
107
|
+
export function isSecret<T = string>(binding: any): binding is Secret<T> {
|
|
94
108
|
return (
|
|
95
109
|
binding instanceof Secret ||
|
|
96
110
|
(typeof binding === "object" && binding?.type === "secret")
|
package/templates/nuxt/README.md
CHANGED
package/templates/vite/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# React + TypeScript + Vite
|
|
2
2
|
|
|
3
|
+
[](https://alchemy.run)
|
|
4
|
+
|
|
3
5
|
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
6
|
|
|
5
7
|
Currently, two official plugins are available:
|