alchemy 0.1.12 → 0.1.13
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/$.d.ts +12 -0
- package/lib/$.d.ts.map +1 -0
- package/lib/$.js +42 -0
- package/lib/$.js.map +1 -0
- package/lib/alchemize.d.ts.map +1 -1
- package/lib/alchemize.js +7 -0
- package/lib/alchemize.js.map +1 -1
- package/lib/apply.d.ts +2 -2
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +1 -1
- package/lib/apply.js.map +1 -1
- package/lib/cloudflare/api.d.ts +4 -0
- package/lib/cloudflare/api.d.ts.map +1 -1
- package/lib/cloudflare/api.js +6 -0
- package/lib/cloudflare/api.js.map +1 -1
- package/lib/cloudflare/bindings.d.ts +14 -4
- package/lib/cloudflare/bindings.d.ts.map +1 -1
- package/lib/cloudflare/bindings.js +0 -5
- package/lib/cloudflare/bindings.js.map +1 -1
- package/lib/cloudflare/durable-object-namespace.d.ts +23 -0
- package/lib/cloudflare/durable-object-namespace.d.ts.map +1 -0
- package/lib/cloudflare/durable-object-namespace.js +26 -0
- package/lib/cloudflare/durable-object-namespace.js.map +1 -0
- package/lib/cloudflare/index.d.ts +1 -0
- package/lib/cloudflare/index.d.ts.map +1 -1
- package/lib/cloudflare/index.js +1 -0
- package/lib/cloudflare/index.js.map +1 -1
- package/lib/cloudflare/kv-namespace.js +1 -1
- package/lib/cloudflare/kv-namespace.js.map +1 -1
- package/lib/cloudflare/static-site-router.d.ts +11 -2
- package/lib/cloudflare/static-site-router.d.ts.map +1 -1
- package/lib/cloudflare/static-site-router.js +98 -76
- package/lib/cloudflare/static-site-router.js.map +1 -1
- package/lib/cloudflare/static-site.d.ts +15 -15
- package/lib/cloudflare/static-site.d.ts.map +1 -1
- package/lib/cloudflare/static-site.js +41 -25
- package/lib/cloudflare/static-site.js.map +1 -1
- package/lib/cloudflare/worker-metadata.d.ts +130 -0
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -0
- package/lib/cloudflare/worker-metadata.js +2 -0
- package/lib/cloudflare/worker-metadata.js.map +1 -0
- package/lib/cloudflare/worker-migration.d.ts +110 -0
- package/lib/cloudflare/worker-migration.d.ts.map +1 -0
- package/lib/cloudflare/worker-migration.js +11 -0
- package/lib/cloudflare/worker-migration.js.map +1 -0
- package/lib/cloudflare/worker.d.ts +29 -11
- package/lib/cloudflare/worker.d.ts.map +1 -1
- package/lib/cloudflare/worker.js +316 -322
- package/lib/cloudflare/worker.js.map +1 -1
- package/lib/destroy.d.ts +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +2 -1
- package/lib/destroy.js.map +1 -1
- package/lib/esbuild.d.ts +1 -1
- package/lib/esbuild.d.ts.map +1 -1
- package/lib/esbuild.js +3 -1
- package/lib/esbuild.js.map +1 -1
- package/lib/global.d.ts +0 -2
- package/lib/global.d.ts.map +1 -1
- package/lib/global.js +0 -2
- package/lib/global.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/output.d.ts +4 -3
- package/lib/output.d.ts.map +1 -1
- package/lib/output.js +10 -3
- package/lib/output.js.map +1 -1
- package/lib/print.d.ts +7 -0
- package/lib/print.d.ts.map +1 -0
- package/lib/print.js +10 -0
- package/lib/print.js.map +1 -0
- package/lib/resource.d.ts +8 -4
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +125 -91
- package/lib/resource.js.map +1 -1
- package/lib/scope.d.ts +3 -0
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +4 -12
- package/lib/scope.js.map +1 -1
- package/package.json +3 -2
- package/src/$.ts +69 -0
- package/src/alchemize.ts +12 -0
- package/src/apply.ts +4 -4
- package/src/cloudflare/api.ts +6 -0
- package/src/cloudflare/bindings.ts +37 -26
- package/src/cloudflare/durable-object-namespace.ts +43 -0
- package/src/cloudflare/index.ts +1 -0
- package/src/cloudflare/kv-namespace.ts +1 -1
- package/src/cloudflare/static-site-router.ts +124 -82
- package/src/cloudflare/static-site.ts +63 -47
- package/src/cloudflare/worker-metadata.ts +154 -0
- package/src/cloudflare/worker-migration.ts +145 -0
- package/src/cloudflare/worker.ts +526 -428
- package/src/destroy.ts +2 -2
- package/src/esbuild.ts +3 -0
- package/src/global.ts +0 -3
- package/src/index.ts +2 -1
- package/src/output.ts +24 -8
- package/src/print.ts +18 -0
- package/src/resource.ts +156 -115
- package/src/scope.ts +7 -12
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export type WorkerMigrations = SingleStepMigration | MultiStepMigration;
|
|
2
|
+
export declare function isSingleStepMigration(migration: WorkerMigrations): migration is SingleStepMigration;
|
|
3
|
+
export interface SingleStepMigration {
|
|
4
|
+
/**
|
|
5
|
+
* A list of classes to delete Durable Object namespaces from
|
|
6
|
+
*/
|
|
7
|
+
deleted_classes?: string[];
|
|
8
|
+
/**
|
|
9
|
+
* A list of classes to create Durable Object namespaces from
|
|
10
|
+
*/
|
|
11
|
+
new_classes?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* A list of classes to create Durable Object namespaces with SQLite from
|
|
14
|
+
*/
|
|
15
|
+
new_sqlite_classes?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Tag to set as the latest migration tag
|
|
18
|
+
*/
|
|
19
|
+
new_tag?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Tag used to verify against the latest migration tag for this Worker.
|
|
22
|
+
* If they don't match, the upload is rejected.
|
|
23
|
+
*/
|
|
24
|
+
old_tag?: string;
|
|
25
|
+
/**
|
|
26
|
+
* A list of classes with Durable Object namespaces that were renamed
|
|
27
|
+
*/
|
|
28
|
+
renamed_classes?: RenamedClass[];
|
|
29
|
+
/**
|
|
30
|
+
* A list of transfers for Durable Object namespaces from a different Worker
|
|
31
|
+
* and class to a class defined in this Worker
|
|
32
|
+
*/
|
|
33
|
+
transferred_classes?: TransferredClass[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents a renamed class in a Durable Object migration
|
|
37
|
+
*/
|
|
38
|
+
export interface RenamedClass {
|
|
39
|
+
/**
|
|
40
|
+
* Original class name
|
|
41
|
+
*/
|
|
42
|
+
from: string;
|
|
43
|
+
/**
|
|
44
|
+
* New class name
|
|
45
|
+
*/
|
|
46
|
+
to: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents a transferred class in a Durable Object migration
|
|
50
|
+
*/
|
|
51
|
+
export interface TransferredClass {
|
|
52
|
+
/**
|
|
53
|
+
* Original class name
|
|
54
|
+
*/
|
|
55
|
+
from: string;
|
|
56
|
+
/**
|
|
57
|
+
* Original script name
|
|
58
|
+
*/
|
|
59
|
+
from_script: string;
|
|
60
|
+
/**
|
|
61
|
+
* New class name in this Worker
|
|
62
|
+
*/
|
|
63
|
+
to: string;
|
|
64
|
+
}
|
|
65
|
+
export declare function isMultiStepMigration(migration: WorkerMigrations): migration is MultiStepMigration;
|
|
66
|
+
/**
|
|
67
|
+
* Represents a multi-step migration for Durable Objects
|
|
68
|
+
*/
|
|
69
|
+
export interface MultiStepMigration {
|
|
70
|
+
/**
|
|
71
|
+
* Tag to set as the latest migration tag
|
|
72
|
+
*/
|
|
73
|
+
new_tag?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Tag used to verify against the latest migration tag for this Worker.
|
|
76
|
+
* If they don't match, the upload is rejected.
|
|
77
|
+
*/
|
|
78
|
+
old_tag?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Migrations to apply in order
|
|
81
|
+
*/
|
|
82
|
+
steps: MigrationStep[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Represents a single step in a Durable Object migration
|
|
86
|
+
*/
|
|
87
|
+
export interface MigrationStep {
|
|
88
|
+
/**
|
|
89
|
+
* A list of classes to delete Durable Object namespaces from
|
|
90
|
+
*/
|
|
91
|
+
deleted_classes?: string[];
|
|
92
|
+
/**
|
|
93
|
+
* A list of classes to create Durable Object namespaces from
|
|
94
|
+
*/
|
|
95
|
+
new_classes?: string[];
|
|
96
|
+
/**
|
|
97
|
+
* A list of classes to create Durable Object namespaces with SQLite from
|
|
98
|
+
*/
|
|
99
|
+
new_sqlite_classes?: string[];
|
|
100
|
+
/**
|
|
101
|
+
* A list of classes with Durable Object namespaces that were renamed
|
|
102
|
+
*/
|
|
103
|
+
renamed_classes?: RenamedClass[];
|
|
104
|
+
/**
|
|
105
|
+
* A list of transfers for Durable Object namespaces from a different Worker
|
|
106
|
+
* and class to a class defined in this Worker
|
|
107
|
+
*/
|
|
108
|
+
transferred_classes?: TransferredClass[];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=worker-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-migration.d.ts","sourceRoot":"","sources":["../../src/cloudflare/worker-migration.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAExE,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,gBAAgB,GAC1B,SAAS,IAAI,mBAAmB,CAQlC;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;IAEjC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,gBAAgB,GAC1B,SAAS,IAAI,kBAAkB,CAEjC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B;;OAEG;IACH,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;IAEjC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC1C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function isSingleStepMigration(migration) {
|
|
2
|
+
return ("deleted_classes" in migration ||
|
|
3
|
+
"new_classes" in migration ||
|
|
4
|
+
"new_sqlite_classes" in migration ||
|
|
5
|
+
"renamed_classes" in migration ||
|
|
6
|
+
"transferred_classes" in migration);
|
|
7
|
+
}
|
|
8
|
+
export function isMultiStepMigration(migration) {
|
|
9
|
+
return "steps" in migration;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=worker-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-migration.js","sourceRoot":"","sources":["../../src/cloudflare/worker-migration.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,qBAAqB,CACnC,SAA2B;IAE3B,OAAO,CACL,iBAAiB,IAAI,SAAS;QAC9B,aAAa,IAAI,SAAS;QAC1B,oBAAoB,IAAI,SAAS;QACjC,iBAAiB,IAAI,SAAS;QAC9B,qBAAqB,IAAI,SAAS,CACnC,CAAC;AACJ,CAAC;AA4ED,MAAM,UAAU,oBAAoB,CAClC,SAA2B;IAE3B,OAAO,OAAO,IAAI,SAAS,CAAC;AAC9B,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type BundleProps } from "../esbuild";
|
|
2
2
|
import type { WorkerBinding } from "./bindings";
|
|
3
|
+
import type { SingleStepMigration } from "./worker-migration";
|
|
3
4
|
/**
|
|
4
5
|
* Properties for creating or updating a Worker
|
|
5
6
|
*/
|
|
@@ -15,16 +16,11 @@ export interface WorkerProps {
|
|
|
15
16
|
* One of script, entryPoint, or bundle must be provided
|
|
16
17
|
*/
|
|
17
18
|
entrypoint?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Reference to a pre-configured Bundle resource
|
|
20
|
-
* One of script, entryPoint, or bundle must be provided
|
|
21
|
-
*/
|
|
22
|
-
bundle?: Bundle;
|
|
23
19
|
/**
|
|
24
20
|
* Bundle options when using entryPoint
|
|
25
21
|
* Ignored if bundle is provided
|
|
26
22
|
*/
|
|
27
|
-
|
|
23
|
+
bundle?: Omit<BundleProps, "entryPoint">;
|
|
28
24
|
/**
|
|
29
25
|
* Module format for the worker script
|
|
30
26
|
* 'esm' - ECMAScript modules (default)
|
|
@@ -47,16 +43,34 @@ export interface WorkerProps {
|
|
|
47
43
|
*/
|
|
48
44
|
bindings?: WorkerBinding[];
|
|
49
45
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
46
|
+
* Environment variables to attach to the worker
|
|
47
|
+
* These will be converted to plain_text bindings
|
|
52
48
|
*/
|
|
53
|
-
|
|
49
|
+
env?: {
|
|
50
|
+
[key: string]: string;
|
|
51
|
+
};
|
|
54
52
|
/**
|
|
55
53
|
* Whether to enable a workers.dev URL for this worker
|
|
56
54
|
* If true, the worker will be available at {name}.{subdomain}.workers.dev
|
|
57
55
|
* @default false
|
|
58
56
|
*/
|
|
59
57
|
url?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Observability configuration for the worker
|
|
60
|
+
* Controls whether worker logs are enabled
|
|
61
|
+
* @default { enabled: true }
|
|
62
|
+
*/
|
|
63
|
+
observability?: {
|
|
64
|
+
/**
|
|
65
|
+
* Whether to enable worker logs
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Migrations to apply to the worker
|
|
72
|
+
*/
|
|
73
|
+
migrations?: SingleStepMigration;
|
|
60
74
|
}
|
|
61
75
|
/**
|
|
62
76
|
* Output returned after Worker creation/update
|
|
@@ -79,8 +93,12 @@ export interface WorkerOutput extends Omit<WorkerProps, "url"> {
|
|
|
79
93
|
* Format: {name}.{subdomain}.workers.dev
|
|
80
94
|
*/
|
|
81
95
|
url?: string;
|
|
96
|
+
/**
|
|
97
|
+
* The bindings that were created
|
|
98
|
+
*/
|
|
99
|
+
bindings: WorkerBinding[];
|
|
82
100
|
}
|
|
83
|
-
declare const Worker_base: import("../resource").Provider<
|
|
101
|
+
declare const Worker_base: import("../resource").Provider<string, [props: WorkerProps], WorkerOutput>;
|
|
84
102
|
export declare class Worker extends Worker_base {
|
|
85
103
|
}
|
|
86
104
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/cloudflare/worker.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/cloudflare/worker.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,KAAK,EAAE,aAAa,E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