@gaganref/confect-alchemy 10.6.0-fork.3 → 10.6.0-fork.30

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.
Files changed (99) hide show
  1. package/dist/Backend.d.ts +64 -5
  2. package/dist/Backend.d.ts.map +1 -1
  3. package/dist/Backend.js +187 -3
  4. package/dist/Backend.js.map +1 -1
  5. package/dist/Code.d.ts +14 -2
  6. package/dist/Code.d.ts.map +1 -1
  7. package/dist/Code.js +2 -2
  8. package/dist/Code.js.map +1 -1
  9. package/dist/Confect.d.ts +1 -1
  10. package/dist/Confect.d.ts.map +1 -1
  11. package/dist/Confect.js +8 -3
  12. package/dist/Confect.js.map +1 -1
  13. package/dist/Convex.d.ts +4 -1
  14. package/dist/Convex.d.ts.map +1 -1
  15. package/dist/Convex.js +10 -1
  16. package/dist/Convex.js.map +1 -1
  17. package/dist/ConvexClient.d.ts +92 -3
  18. package/dist/ConvexClient.d.ts.map +1 -1
  19. package/dist/ConvexClient.js +149 -27
  20. package/dist/ConvexClient.js.map +1 -1
  21. package/dist/CustomDomain.d.ts +156 -0
  22. package/dist/CustomDomain.d.ts.map +1 -0
  23. package/dist/CustomDomain.js +255 -0
  24. package/dist/CustomDomain.js.map +1 -0
  25. package/dist/DeployKey.js +3 -3
  26. package/dist/Deployment.d.ts +29 -3
  27. package/dist/Deployment.d.ts.map +1 -1
  28. package/dist/Deployment.js +39 -15
  29. package/dist/Deployment.js.map +1 -1
  30. package/dist/EnvironmentVariables.d.ts +76 -21
  31. package/dist/EnvironmentVariables.d.ts.map +1 -1
  32. package/dist/EnvironmentVariables.js +203 -19
  33. package/dist/EnvironmentVariables.js.map +1 -1
  34. package/dist/LogStream.d.ts +134 -0
  35. package/dist/LogStream.d.ts.map +1 -0
  36. package/dist/LogStream.js +324 -0
  37. package/dist/LogStream.js.map +1 -0
  38. package/dist/Project.js +2 -2
  39. package/dist/Providers.d.ts.map +1 -1
  40. package/dist/Providers.js +30 -15
  41. package/dist/Providers.js.map +1 -1
  42. package/dist/UsageLimit.d.ts +140 -0
  43. package/dist/UsageLimit.d.ts.map +1 -0
  44. package/dist/UsageLimit.js +145 -0
  45. package/dist/UsageLimit.js.map +1 -0
  46. package/dist/internal/CodeDeployment.d.ts +28 -1
  47. package/dist/internal/CodeDeployment.d.ts.map +1 -1
  48. package/dist/internal/CodeDeployment.js +85 -2
  49. package/dist/internal/CodeDeployment.js.map +1 -1
  50. package/dist/internal/CommandRunner.d.ts +4 -0
  51. package/dist/internal/CommandRunner.d.ts.map +1 -1
  52. package/dist/internal/CommandRunner.js +92 -6
  53. package/dist/internal/CommandRunner.js.map +1 -1
  54. package/dist/internal/FileLock.js +1 -1
  55. package/dist/internal/FunctionsDirectory.d.ts +12 -0
  56. package/dist/internal/FunctionsDirectory.d.ts.map +1 -0
  57. package/dist/internal/FunctionsDirectory.js +22 -0
  58. package/dist/internal/FunctionsDirectory.js.map +1 -0
  59. package/dist/internal/Lifecycle.d.ts +1 -0
  60. package/dist/internal/Lifecycle.d.ts.map +1 -1
  61. package/dist/internal/Lifecycle.js +24 -2
  62. package/dist/internal/Lifecycle.js.map +1 -1
  63. package/dist/internal/LocalBackend.d.ts +9 -0
  64. package/dist/internal/LocalBackend.d.ts.map +1 -1
  65. package/dist/internal/LocalBackend.js +14 -5
  66. package/dist/internal/LocalBackend.js.map +1 -1
  67. package/dist/internal/LogStream.d.ts +115 -0
  68. package/dist/internal/LogStream.d.ts.map +1 -0
  69. package/dist/internal/LogStream.js +123 -0
  70. package/dist/internal/LogStream.js.map +1 -0
  71. package/dist/internal/MountInit.d.ts.map +1 -1
  72. package/dist/internal/MountInit.js +4 -6
  73. package/dist/internal/MountInit.js.map +1 -1
  74. package/dist/internal/PushLock.d.ts +1 -0
  75. package/dist/internal/PushLock.d.ts.map +1 -1
  76. package/dist/internal/PushLock.js +4 -3
  77. package/dist/internal/PushLock.js.map +1 -1
  78. package/dist/internal/ResourceIdentity.js +1 -1
  79. package/dist/internal/Zip.js +1 -1
  80. package/package.json +4 -4
  81. package/src/Backend.ts +422 -12
  82. package/src/Code.ts +13 -0
  83. package/src/Confect.ts +7 -1
  84. package/src/Convex.ts +24 -1
  85. package/src/ConvexClient.ts +364 -31
  86. package/src/CustomDomain.ts +453 -0
  87. package/src/Deployment.ts +74 -12
  88. package/src/EnvironmentVariables.ts +505 -19
  89. package/src/LogStream.ts +662 -0
  90. package/src/Providers.ts +18 -0
  91. package/src/UsageLimit.ts +253 -0
  92. package/src/internal/CodeDeployment.ts +115 -0
  93. package/src/internal/CommandRunner.ts +182 -1
  94. package/src/internal/FunctionsDirectory.ts +27 -0
  95. package/src/internal/Lifecycle.ts +21 -1
  96. package/src/internal/LocalBackend.ts +9 -0
  97. package/src/internal/LogStream.ts +154 -0
  98. package/src/internal/MountInit.ts +3 -13
  99. package/src/internal/PushLock.ts +4 -1
package/dist/Backend.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import type * as Manifest from "@confect/core/Manifest";
1
+ import * as Env from "@confect/core/Env";
2
+ import * as Manifest from "@confect/core/Manifest";
2
3
  import type { Input } from "alchemy/Input";
3
4
  import * as Output from "alchemy/Output";
4
5
  import * as Effect from "effect/Effect";
5
- import type * as Redacted from "effect/Redacted";
6
+ import * as Redacted from "effect/Redacted";
7
+ import * as Schema from "effect/Schema";
6
8
  import { Code } from "./Code.js";
7
9
  import { EnvironmentVariables } from "./EnvironmentVariables.js";
8
10
  interface CommonProps {
@@ -16,25 +18,82 @@ interface CommonProps {
16
18
  type Environment<M extends Manifest.Manifest> = {
17
19
  readonly [K in keyof Manifest.Values<M>]: Input<Exclude<Manifest.Values<M>[K], undefined>>;
18
20
  };
21
+ type MountSettings<M extends Manifest.Manifest> = {
22
+ readonly [K in keyof Manifest.Mounts<M>]: {
23
+ readonly [S in keyof NonNullable<Manifest.Mounts<M>[K]>]: Input<Exclude<NonNullable<Manifest.Mounts<M>[K]>[S], undefined>>;
24
+ };
25
+ };
26
+ type AutomaticValues<M extends Manifest.Manifest> = {
27
+ readonly [K in keyof Manifest.Automatic<M>]: Input<Manifest.Automatic<M>[K]>;
28
+ };
29
+ /**
30
+ * Inputs for a backend deployment. An input Effect or Config may be evaluated
31
+ * several times in plan and again in apply, more often for a provider selector
32
+ * and its settings. It must be free of side effects and return the same value
33
+ * every time. Otherwise, a choice can be written without a setting it
34
+ * requires.
35
+ */
19
36
  export type BackendProps<M extends Manifest.Manifest | undefined = undefined> = CommonProps & (M extends Manifest.Manifest ? {
20
37
  readonly manifest: M;
21
38
  } & ({} extends Manifest.Values<M> ? {
22
39
  readonly env?: Environment<NoInfer<M>>;
23
40
  } : {
24
41
  readonly env: Environment<NoInfer<M>>;
42
+ }) & ({} extends Manifest.Mounts<M> ? {
43
+ readonly mounts?: MountSettings<NoInfer<M>>;
44
+ } : {
45
+ readonly mounts: MountSettings<NoInfer<M>>;
46
+ }) & ({} extends Manifest.Automatic<M> ? {
47
+ readonly automatic?: AutomaticValues<NoInfer<M>>;
48
+ } : {
49
+ readonly automatic: AutomaticValues<NoInfer<M>>;
25
50
  }) : {
26
51
  readonly manifest?: never;
52
+ readonly mounts?: never;
53
+ readonly automatic?: never;
27
54
  readonly env?: Readonly<Record<string, Input<string | Redacted.Redacted<string>>>>;
28
55
  });
29
56
  /**
30
57
  * Deploy a declared backend with env typed by its generated manifest.
31
58
  */
32
- export declare function Backend<const M extends Manifest.Manifest, const E extends Environment<NoInfer<M>> = Environment<NoInfer<M>>>(id: string, props: BackendProps<M> & {
33
- readonly env?: E & Readonly<Record<Exclude<keyof E, keyof M["env"]>, never>>;
59
+ export declare function Backend<const M extends Manifest.Manifest, const E extends Environment<NoInfer<M>> = Environment<NoInfer<M>>, const S extends MountSettings<NoInfer<M>> = MountSettings<NoInfer<M>>>(id: string, props: BackendProps<M> & {
60
+ readonly env?: E & Readonly<Record<Exclude<keyof E, keyof Environment<M>>, never>>;
61
+ readonly mounts?: S & Readonly<Record<Exclude<keyof S, keyof M["mounts"]>, never>>;
34
62
  }): ReturnType<typeof backend>;
35
63
  export declare function Backend(id: string, props: BackendProps): ReturnType<typeof backend>;
64
+ type Settings = Readonly<Record<string, Input<string | Redacted.Redacted<string> | Env.ProviderChoice>>>;
65
+ type Variables = Readonly<Record<string, Input<string | Redacted.Redacted<string>>>>;
66
+ declare const InvalidAutomaticSetting_base: Schema.Class<InvalidAutomaticSetting, Schema.TaggedStruct<"InvalidAutomaticSetting", {
67
+ readonly slot: Schema.String;
68
+ readonly reason: Schema.Literals<readonly ["NotAutomatic", "Missing", "InvalidValue", "PlainSecret"]>;
69
+ }>, import("effect/Cause").YieldableError & {
70
+ readonly brand: unique symbol;
71
+ }>;
72
+ export declare class InvalidAutomaticSetting extends InvalidAutomaticSetting_base {
73
+ get message(): string;
74
+ }
75
+ declare const InvalidMountSetting_base: Schema.Class<InvalidMountSetting, Schema.TaggedStruct<"InvalidMountSetting", {
76
+ readonly mount: Schema.String;
77
+ readonly slot: Schema.optional<Schema.String>;
78
+ readonly reason: Schema.Literals<readonly ["UnknownMount", "NotOpen", "Missing", "PlainSecret", "InvalidChoice", "InvalidValue"]>;
79
+ }>, import("effect/Cause").YieldableError & {
80
+ readonly brand: unique symbol;
81
+ }>;
82
+ export declare class InvalidMountSetting extends InvalidMountSetting_base {
83
+ get message(): string;
84
+ }
85
+ /**
86
+ * Each mount's settings under the deployment variable the manifest names for
87
+ * it, refusing a manifest that does not decode, a mount or slot the manifest
88
+ * does not list as open, a missing required slot, a plain string for a secret
89
+ * and a provider choice the component would refuse.
90
+ */
91
+ export declare const mountVariables: (input: Manifest.Manifest, mounts: Readonly<Record<string, Settings>>) => Effect.Effect<Record<string, Variables[string]>, InvalidMountSetting | Manifest.UnsupportedManifestFormat>;
36
92
  declare const backend: (id: string, props: CommonProps & {
37
- readonly env?: Readonly<Record<string, Input<string | Redacted.Redacted<string>>>>;
93
+ readonly manifest?: Manifest.Manifest;
94
+ readonly env?: Settings;
95
+ readonly automatic?: Variables;
96
+ readonly mounts?: Readonly<Record<string, Settings>>;
38
97
  }) => Effect.Effect<{
39
98
  code: Code;
40
99
  environment: EnvironmentVariables | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Backend.d.ts","sources":["../src/Backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,UAAU,WAAW;IACnB,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;KAC7B,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,KAAK,WAAW,CAAC,CAAC,SAAS,QAAQ,CAAC,QAAQ,IAAI;IAC9C,QAAQ,EAAE,CAAC,IAAI,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAC1C;CACF,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,QAAQ,CAAC,QAAQ,GAAG,SAAS,GAAG,SAAS,IAC1E,WAAW,GACT,CAAC,CAAC,SAAS,QAAQ,CAAC,QAAQ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AO,OACP,MAAM,SACH,WAAW,GAAG;IACnB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;CACtD;;;;;6CA+EA,CAAC"}
package/dist/Backend.js CHANGED
@@ -1,17 +1,200 @@
1
1
  import { Code } from "./Code.js";
2
2
  import { EnvironmentVariables } from "./EnvironmentVariables.js";
3
+ import * as Arr from "effect/Array";
4
+ import * as Env from "@confect/core/Env";
5
+ import * as Manifest from "@confect/core/Manifest";
3
6
  import * as Namespace from "alchemy/Namespace";
4
7
  import * as Output from "alchemy/Output";
5
8
  import * as Effect from "effect/Effect";
9
+ import * as Rec from "effect/Record";
10
+ import * as Redacted from "effect/Redacted";
11
+ import * as Schema from "effect/Schema";
12
+ import * as Result from "effect/Result";
6
13
  // src/Backend.ts
7
14
  function Backend(id, props) {
8
15
  return backend(id, props);
9
16
  }
17
+ var InvalidAutomaticSetting = class extends Schema.TaggedError()("InvalidAutomaticSetting", {
18
+ slot: Schema.String,
19
+ reason: Schema.Literals([
20
+ "NotAutomatic",
21
+ "Missing",
22
+ "InvalidValue",
23
+ "PlainSecret"
24
+ ])
25
+ }) {
26
+ get message() {
27
+ if (this.reason === "PlainSecret") return `${this.slot} is a plain string. Wrap this secret with Redacted.make before passing it in Backend.automatic.`;
28
+ if (this.reason === "InvalidValue") return `${this.slot} has a value that does not match its manifest slot. Supply a string of the declared kind in Backend.automatic; secret slots require a Redacted string and literals slots require one of their values.`;
29
+ return this.reason === "NotAutomatic" ? `${this.slot} is not declared automatic in manifest.env. Supply only automatic slots in Backend.automatic; put application values in Backend.env.` : `${this.slot} is declared automatic in manifest.env but has no value. Supply it in Backend.automatic.`;
30
+ }
31
+ };
32
+ const automaticVariables = (manifest, supplied) => Result.gen(function* () {
33
+ for (const slot of Rec.keys(supplied)) if (!Rec.has(manifest.env, slot) || manifest.env[slot]?.automatic !== true) return yield* Result.fail(InvalidAutomaticSetting.make({
34
+ slot,
35
+ reason: "NotAutomatic"
36
+ }));
37
+ for (const [slot, descriptor] of Rec.toEntries(manifest.env)) if (descriptor.automatic === true && missing(Rec.has(supplied, slot) ? supplied[slot] : void 0)) return yield* Result.fail(InvalidAutomaticSetting.make({
38
+ slot,
39
+ reason: "Missing"
40
+ }));
41
+ return supplied;
42
+ });
43
+ const missing = (value) => value === void 0 || value === null || value === "" || Redacted.isRedacted(value) && Redacted.value(value) === "";
44
+ /**
45
+ * A provider choice validated and encoded with the schema the handler decodes
46
+ * it with, after refusing a choice that names a provider whose required setting
47
+ * is unset. A setting belongs to the selector its tag names.
48
+ */
49
+ const settleChoice = (at, key, selector, slots, supplied, value) => Effect.gen(function* () {
50
+ if (selector.optional && missing(value)) return void 0;
51
+ const invalid = InvalidMountSetting.make({
52
+ mount: at,
53
+ slot: key,
54
+ reason: "InvalidChoice"
55
+ });
56
+ const schema = Env.providerChoice(selector.values);
57
+ const choice = yield* Schema.decodeUnknownEffect(Schema.toType(schema))(value).pipe(Effect.mapError(() => invalid));
58
+ const named = Env.chosen(choice);
59
+ for (const [slot, other] of Rec.toEntries(slots)) if (other.provider?.selector === key && other.provider.required && named.includes(other.provider.name) && missing(Rec.has(supplied, slot) ? supplied[slot] : void 0)) return yield* InvalidMountSetting.make({
60
+ mount: at,
61
+ slot,
62
+ reason: "Missing"
63
+ });
64
+ return yield* Schema.encodeUnknownEffect(schema)(choice).pipe(Effect.mapError(() => invalid));
65
+ });
66
+ /**
67
+ * Normalize all accepted Input forms without resolving resource dependencies.
68
+ * Redacted values remain opaque; arrays and choice records retain their shape.
69
+ */
70
+ const normalize = (value) => {
71
+ if (Output.isOutput(value)) return value;
72
+ if (Effect.isEffect(value)) return value.pipe(Effect.orDie, Output.fromEffect);
73
+ if (value === null || typeof value !== "object" || Redacted.isRedacted(value)) return value;
74
+ if (Arr.isArray(value)) {
75
+ const inputs = Arr.map(value, normalize);
76
+ return Arr.some(inputs, Output.isOutput) ? Output.all(...Arr.map(inputs, (input) => Output.asOutput(input))) : inputs;
77
+ }
78
+ const entries = Arr.map(Rec.toEntries(value), ([key, input]) => [key, normalize(input)]);
79
+ const assemble = (resolved) => Rec.fromEntries(Arr.map(entries, ([key], index) => [key, resolved[index]]));
80
+ const inputs = Arr.map(entries, ([, input]) => input);
81
+ return Arr.some(inputs, Output.isOutput) ? Output.map(Output.all(...Arr.map(inputs, (input) => Output.asOutput(input))), assemble) : assemble(inputs);
82
+ };
83
+ /**
84
+ * Each supplied slot keeps its input edges. A tagged setting also reads its
85
+ * selector's input, and a selector reads only its own tagged settings.
86
+ */
87
+ const supplySettings = (at, slots, supplied, invalid) => Effect.gen(function* () {
88
+ const normalized = Rec.map(supplied, normalize);
89
+ const entries = [];
90
+ const settle = (key, descriptor, value, choice) => Effect.gen(function* () {
91
+ if (missing(value)) {
92
+ const provider = descriptor.provider;
93
+ const selector = provider === void 0 ? void 0 : slots[provider.selector];
94
+ if (provider?.required === true && selector?.kind === "providers" && !missing(choice)) yield* settleChoice(at, provider.selector, selector, { [key]: descriptor }, { [key]: value }, choice);
95
+ if (!descriptor.optional) return yield* Effect.fail(invalid(key, "Missing"));
96
+ return;
97
+ }
98
+ if (descriptor.kind === "secret" && typeof value === "string") return yield* Effect.fail(invalid(key, "PlainSecret"));
99
+ if (!(descriptor.kind === "secret" ? Redacted.isRedacted(value) && typeof Redacted.value(value) === "string" : descriptor.kind === "providers" || typeof value === "string" && (descriptor.kind !== "literals" || descriptor.values.includes(value)))) return yield* Effect.fail(invalid(key, "InvalidValue"));
100
+ return value;
101
+ });
102
+ for (const [key, descriptor] of Rec.toEntries(slots)) {
103
+ const value = Rec.has(normalized, key) ? normalized[key] : void 0;
104
+ const choice = descriptor.provider === void 0 || !Rec.has(normalized, descriptor.provider.selector) ? void 0 : normalized[descriptor.provider.selector];
105
+ const checked = Output.isOutput(value) || Output.isOutput(choice) ? Output.all(Output.asOutput(value), Output.asOutput(choice)).pipe(Output.mapEffect(([resolved, selected]) => settle(key, descriptor, resolved, selected).pipe(Effect.orDie))) : yield* settle(key, descriptor, value, choice);
106
+ if (checked !== void 0) entries.push([key, checked]);
107
+ }
108
+ const settings = Rec.fromEntries(entries);
109
+ for (const [key, descriptor] of Rec.toEntries(slots)) {
110
+ if (descriptor.kind !== "providers" || !Rec.has(settings, key)) continue;
111
+ const value = settings[key];
112
+ const tagged = Rec.filter(settings, (_, slot) => slots[slot]?.provider?.selector === key);
113
+ const check = (choice, resolved) => settleChoice(at, key, descriptor, slots, resolved, choice);
114
+ const inputs = normalize({
115
+ value,
116
+ tagged
117
+ });
118
+ settings[key] = Output.isOutput(inputs) ? inputs.pipe(Output.mapEffect((resolved) => check(resolved.value, resolved.tagged).pipe(Effect.orDie))) : yield* check(value, tagged);
119
+ }
120
+ return settings;
121
+ });
122
+ var InvalidMountSetting = class extends Schema.TaggedError()("InvalidMountSetting", {
123
+ mount: Schema.String,
124
+ slot: Schema.optional(Schema.String),
125
+ reason: Schema.Literals([
126
+ "UnknownMount",
127
+ "NotOpen",
128
+ "Missing",
129
+ "PlainSecret",
130
+ "InvalidChoice",
131
+ "InvalidValue"
132
+ ])
133
+ }) {
134
+ get message() {
135
+ const at = this.slot === void 0 ? this.mount : `${this.mount}.${this.slot}`;
136
+ const location = this.mount === "app" ? "Backend.env" : "Backend.mounts";
137
+ return `${at}: ${{
138
+ UnknownMount: "This mount is not listed. Use a mount name from manifest.mounts.",
139
+ NotOpen: "This slot is not open. Supply only slots listed in this mount's manifest env.",
140
+ Missing: `This required slot is missing. Supply this required slot in ${location}.`,
141
+ PlainSecret: `This secret is a plain string. Wrap this secret with Redacted.make before passing it in ${location}.`,
142
+ InvalidValue: "This value does not match its manifest slot. Supply a string of the declared kind; secret slots require a Redacted string and literals slots require one of their values.",
143
+ InvalidChoice: "This provider choice is one the component would refuse. Name one of the providers this selector offers, or a failover or pool of them."
144
+ }[this.reason]}`;
145
+ }
146
+ };
147
+ /**
148
+ * Each mount's settings under the deployment variable the manifest names for
149
+ * it, refusing a manifest that does not decode, a mount or slot the manifest
150
+ * does not list as open, a missing required slot, a plain string for a secret
151
+ * and a provider choice the component would refuse.
152
+ */
153
+ const mountVariables = (input, mounts) => Effect.gen(function* () {
154
+ const manifest = yield* Effect.fromResult(Manifest.decode(input, "confect/_generated/manifest.ts"));
155
+ const variables = {};
156
+ for (const mount of Rec.keys(mounts)) if (!Rec.has(manifest.mounts, mount)) return yield* InvalidMountSetting.make({
157
+ mount,
158
+ reason: "UnknownMount"
159
+ });
160
+ for (const [mount, entry] of Rec.toEntries(manifest.mounts)) {
161
+ const supplied = (Rec.has(mounts, mount) ? mounts[mount] : void 0) ?? {};
162
+ for (const slot of Rec.keys(supplied)) if (!Rec.has(entry.env, slot)) return yield* InvalidMountSetting.make({
163
+ mount,
164
+ slot,
165
+ reason: "NotOpen"
166
+ });
167
+ const settings = yield* supplySettings(mount, entry.env, supplied, (slot, reason) => InvalidMountSetting.make({
168
+ mount,
169
+ slot,
170
+ reason
171
+ }));
172
+ for (const [slot, value] of Rec.toEntries(settings)) variables[entry.env[slot].variable] = value;
173
+ }
174
+ return variables;
175
+ });
10
176
  const backend = (id, props) => Namespace.push(id, Effect.gen(function* () {
11
- const environment = props.env === void 0 ? void 0 : yield* EnvironmentVariables("Environment", {
177
+ const manifest = props.manifest === void 0 ? void 0 : yield* Effect.fromResult(Manifest.decode(props.manifest, "confect/_generated/manifest.ts")).pipe(Effect.orDie);
178
+ const promoted = manifest === void 0 ? {} : yield* mountVariables(manifest, props.mounts ?? {}).pipe(Effect.orDie);
179
+ const automaticInput = manifest === void 0 ? void 0 : yield* Effect.fromResult(automaticVariables(manifest, props.automatic ?? {})).pipe(Effect.orDie);
180
+ const automatic = manifest === void 0 || automaticInput === void 0 ? void 0 : yield* supplySettings("app", Rec.filter(manifest.env, (slot) => slot.automatic === true), automaticInput, (slot, reason) => InvalidAutomaticSetting.make({
181
+ slot,
182
+ reason
183
+ })).pipe(Effect.orDie);
184
+ const env = manifest === void 0 ? props.env : yield* supplySettings("app", Rec.filter(manifest.env, (slot) => slot.automatic !== true), props.env ?? {}, (slot, reason) => InvalidMountSetting.make({
185
+ mount: "app",
186
+ slot,
187
+ reason
188
+ })).pipe(Effect.orDie);
189
+ const variables = Rec.keys(promoted).length === 0 && props.automatic === void 0 ? env : {
190
+ ...env,
191
+ ...automatic,
192
+ ...promoted
193
+ };
194
+ const environment = variables === void 0 || props.env === void 0 && props.automatic === void 0 && Rec.keys(variables).length === 0 ? void 0 : yield* EnvironmentVariables("Environment", {
12
195
  url: props.deployment.url,
13
196
  deployKey: props.deployKey,
14
- variables: props.env
197
+ variables
15
198
  });
16
199
  const code = yield* Code("Code", {
17
200
  deployment: {
@@ -20,6 +203,7 @@ const backend = (id, props) => Namespace.push(id, Effect.gen(function* () {
20
203
  },
21
204
  deployKey: props.deployKey,
22
205
  ...props.cwd === void 0 ? {} : { cwd: props.cwd },
206
+ ...manifest === void 0 ? {} : { manifestDigest: manifest.digest },
23
207
  prepare: {
24
208
  command: "confect",
25
209
  args: ["codegen"]
@@ -32,6 +216,6 @@ const backend = (id, props) => Namespace.push(id, Effect.gen(function* () {
32
216
  url: code.url
33
217
  };
34
218
  }));
35
- export { Backend };
219
+ export { Backend, InvalidAutomaticSetting, InvalidMountSetting, mountVariables };
36
220
 
37
221
  //# sourceMappingURL=Backend.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Backend.js","names":[],"sources":["../src/Backend.ts"],"sourcesContent":["import type * as Manifest from \"@confect/core/Manifest\";\nimport type { Input } from \"alchemy/Input\";\nimport * as Namespace from \"alchemy/Namespace\";\nimport * as Output from \"alchemy/Output\";\nimport * as Effect from \"effect/Effect\";\nimport type * as Redacted from \"effect/Redacted\";\nimport { Code } from \"./Code.js\";\nimport { EnvironmentVariables } from \"./EnvironmentVariables.js\";\n\ninterface CommonProps {\n readonly deployment: {\n readonly name: Input<string>;\n readonly url: Input<string>;\n };\n readonly deployKey: Input<Redacted.Redacted<string>>;\n readonly cwd?: string;\n}\n\ntype Environment<M extends Manifest.Manifest> = {\n readonly [K in keyof Manifest.Values<M>]: Input<\n Exclude<Manifest.Values<M>[K], undefined>\n >;\n};\n\nexport type BackendProps<M extends Manifest.Manifest | undefined = undefined> =\n CommonProps &\n (M extends Manifest.Manifest\n ? { readonly manifest: M } & ({} extends Manifest.Values<M>\n ? { readonly env?: Environment<NoInfer<M>> }\n : { readonly env: Environment<NoInfer<M>> })\n : {\n readonly manifest?: never;\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n });\n\n/**\n * Deploy a declared backend with env typed by its generated manifest.\n */\nexport function Backend<\n const M extends Manifest.Manifest,\n const E extends Environment<NoInfer<M>> = Environment<NoInfer<M>>,\n>(\n id: string,\n props: BackendProps<M> & {\n readonly env?: E &\n Readonly<Record<Exclude<keyof E, keyof M[\"env\"]>, never>>;\n },\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: BackendProps,\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: CommonProps & {\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n },\n): ReturnType<typeof backend> {\n return backend(id, props);\n}\n\nconst backend = (\n id: string,\n props: CommonProps & {\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n },\n) =>\n Namespace.push(\n id,\n Effect.gen(function* () {\n const environment =\n props.env === undefined\n ? undefined\n : yield* EnvironmentVariables(\"Environment\", {\n url: props.deployment.url,\n deployKey: props.deployKey,\n variables: props.env,\n });\n const code = yield* Code(\"Code\", {\n deployment: {\n name: props.deployment.name,\n url:\n environment !== undefined\n ? Output.map(\n Output.all(environment.variables, environment.url),\n ([, url]) => url,\n )\n : props.deployment.url,\n },\n deployKey: props.deployKey,\n ...(props.cwd === undefined ? {} : { cwd: props.cwd }),\n prepare: { command: \"confect\", args: [\"codegen\"] },\n });\n return { code, environment, name: code.name, url: code.url };\n }),\n );\n"],"mappings":";;;;;;AAsDA,SAAgB,QACd,IACA,OAK4B;CAC5B,OAAO,QAAQ,IAAI,KAAK;AAC1B;AAEA,MAAM,WACJ,IACA,UAMA,UAAU,KACR,IACA,OAAO,IAAI,aAAa;CACtB,MAAM,cACJ,MAAM,QAAQ,KAAA,IACV,KAAA,IACA,OAAO,qBAAqB,eAAe;EACzC,KAAK,MAAM,WAAW;EACtB,WAAW,MAAM;EACjB,WAAW,MAAM;CACnB,CAAC;CACP,MAAM,OAAO,OAAO,KAAK,QAAQ;EAC/B,YAAY;GACV,MAAM,MAAM,WAAW;GACvB,KACE,gBAAgB,KAAA,IACZ,OAAO,IACL,OAAO,IAAI,YAAY,WAAW,YAAY,GAAG,IAChD,GAAG,SAAS,GACf,IACA,MAAM,WAAW;EACzB;EACA,WAAW,MAAM;EACjB,GAAI,MAAM,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK,MAAM,IAAI;EACpD,SAAS;GAAE,SAAS;GAAW,MAAM,CAAC,SAAS;EAAE;CACnD,CAAC;CACD,OAAO;EAAE;EAAM;EAAa,MAAM,KAAK;EAAM,KAAK,KAAK;CAAI;AAC7D,CAAC,CACH"}
1
+ {"version":3,"file":"Backend.js","names":[],"sources":["../src/Backend.ts"],"sourcesContent":["import * as Arr from \"effect/Array\";\nimport * as Env from \"@confect/core/Env\";\nimport * as Manifest from \"@confect/core/Manifest\";\nimport type { Input } from \"alchemy/Input\";\nimport * as Namespace from \"alchemy/Namespace\";\nimport * as Output from \"alchemy/Output\";\nimport * as Effect from \"effect/Effect\";\nimport * as Rec from \"effect/Record\";\nimport * as Redacted from \"effect/Redacted\";\nimport * as Schema from \"effect/Schema\";\nimport * as Result from \"effect/Result\";\nimport { Code } from \"./Code.js\";\nimport { EnvironmentVariables } from \"./EnvironmentVariables.js\";\n\ninterface CommonProps {\n readonly deployment: {\n readonly name: Input<string>;\n readonly url: Input<string>;\n };\n readonly deployKey: Input<Redacted.Redacted<string>>;\n readonly cwd?: string;\n}\n\ntype Environment<M extends Manifest.Manifest> = {\n readonly [K in keyof Manifest.Values<M>]: Input<\n Exclude<Manifest.Values<M>[K], undefined>\n >;\n};\n\ntype MountSettings<M extends Manifest.Manifest> = {\n readonly [K in keyof Manifest.Mounts<M>]: {\n readonly [S in keyof NonNullable<Manifest.Mounts<M>[K]>]: Input<\n Exclude<NonNullable<Manifest.Mounts<M>[K]>[S], undefined>\n >;\n };\n};\n\ntype AutomaticValues<M extends Manifest.Manifest> = {\n readonly [K in keyof Manifest.Automatic<M>]: Input<Manifest.Automatic<M>[K]>;\n};\n\n/**\n * Inputs for a backend deployment. An input Effect or Config may be evaluated\n * several times in plan and again in apply, more often for a provider selector\n * and its settings. It must be free of side effects and return the same value\n * every time. Otherwise, a choice can be written without a setting it\n * requires.\n */\nexport type BackendProps<M extends Manifest.Manifest | undefined = undefined> =\n CommonProps &\n (M extends Manifest.Manifest\n ? { readonly manifest: M } & ({} extends Manifest.Values<M>\n ? { readonly env?: Environment<NoInfer<M>> }\n : { readonly env: Environment<NoInfer<M>> }) &\n ({} extends Manifest.Mounts<M>\n ? { readonly mounts?: MountSettings<NoInfer<M>> }\n : { readonly mounts: MountSettings<NoInfer<M>> }) &\n ({} extends Manifest.Automatic<M>\n ? { readonly automatic?: AutomaticValues<NoInfer<M>> }\n : { readonly automatic: AutomaticValues<NoInfer<M>> })\n : {\n readonly manifest?: never;\n readonly mounts?: never;\n readonly automatic?: never;\n readonly env?: Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n >;\n });\n\n/**\n * Deploy a declared backend with env typed by its generated manifest.\n */\nexport function Backend<\n const M extends Manifest.Manifest,\n const E extends Environment<NoInfer<M>> = Environment<NoInfer<M>>,\n const S extends MountSettings<NoInfer<M>> = MountSettings<NoInfer<M>>,\n>(\n id: string,\n props: BackendProps<M> & {\n readonly env?: E &\n Readonly<Record<Exclude<keyof E, keyof Environment<M>>, never>>;\n readonly mounts?: S &\n Readonly<Record<Exclude<keyof S, keyof M[\"mounts\"]>, never>>;\n },\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: BackendProps,\n): ReturnType<typeof backend>;\nexport function Backend(\n id: string,\n props: CommonProps & {\n readonly manifest?: Manifest.Manifest;\n readonly env?: Settings;\n readonly automatic?: Variables;\n readonly mounts?: Readonly<Record<string, Settings>>;\n },\n): ReturnType<typeof backend> {\n return backend(id, props);\n}\n\ntype Settings = Readonly<\n Record<string, Input<string | Redacted.Redacted<string> | Env.ProviderChoice>>\n>;\n\ntype Variables = Readonly<\n Record<string, Input<string | Redacted.Redacted<string>>>\n>;\n\nexport class InvalidAutomaticSetting extends Schema.TaggedError<\n InvalidAutomaticSetting,\n { readonly brand: unique symbol }\n>()(\"InvalidAutomaticSetting\", {\n slot: Schema.String,\n reason: Schema.Literals([\n \"NotAutomatic\",\n \"Missing\",\n \"InvalidValue\",\n \"PlainSecret\",\n ]),\n}) {\n override get message(): string {\n if (this.reason === \"PlainSecret\")\n return `${this.slot} is a plain string. Wrap this secret with Redacted.make before passing it in Backend.automatic.`;\n if (this.reason === \"InvalidValue\")\n return `${this.slot} has a value that does not match its manifest slot. Supply a string of the declared kind in Backend.automatic; secret slots require a Redacted string and literals slots require one of their values.`;\n return this.reason === \"NotAutomatic\"\n ? `${this.slot} is not declared automatic in manifest.env. Supply only automatic slots in Backend.automatic; put application values in Backend.env.`\n : `${this.slot} is declared automatic in manifest.env but has no value. Supply it in Backend.automatic.`;\n }\n}\n\nconst automaticVariables = (\n manifest: Manifest.Manifest,\n supplied: Variables,\n): Result.Result<Variables, InvalidAutomaticSetting> =>\n Result.gen(function* () {\n for (const slot of Rec.keys(supplied)) {\n if (\n !Rec.has(manifest.env, slot) ||\n manifest.env[slot]?.automatic !== true\n )\n return yield* Result.fail(\n InvalidAutomaticSetting.make({ slot, reason: \"NotAutomatic\" }),\n );\n }\n for (const [slot, descriptor] of Rec.toEntries(manifest.env)) {\n if (\n descriptor.automatic === true &&\n missing(Rec.has(supplied, slot) ? supplied[slot] : undefined)\n )\n return yield* Result.fail(\n InvalidAutomaticSetting.make({ slot, reason: \"Missing\" }),\n );\n }\n return supplied;\n });\n\nconst missing = (value: unknown): boolean =>\n value === undefined ||\n value === null ||\n value === \"\" ||\n (Redacted.isRedacted(value) && Redacted.value(value) === \"\");\n\n/**\n * A provider choice validated and encoded with the schema the handler decodes\n * it with, after refusing a choice that names a provider whose required setting\n * is unset. A setting belongs to the selector its tag names.\n */\nconst settleChoice = (\n at: string,\n key: string,\n selector: Env.Descriptor & { readonly kind: \"providers\" },\n slots: Readonly<Record<string, Env.Descriptor>>,\n supplied: Readonly<Record<string, unknown>>,\n value: unknown,\n) =>\n Effect.gen(function* () {\n if (selector.optional && missing(value)) return undefined;\n const invalid = InvalidMountSetting.make({\n mount: at,\n slot: key,\n reason: \"InvalidChoice\",\n });\n const schema = Env.providerChoice(selector.values);\n const choice = yield* Schema.decodeUnknownEffect(Schema.toType(schema))(\n value,\n ).pipe(Effect.mapError(() => invalid));\n const named = Env.chosen(choice);\n for (const [slot, other] of Rec.toEntries(slots)) {\n if (\n other.provider?.selector === key &&\n other.provider.required &&\n named.includes(other.provider.name) &&\n missing(Rec.has(supplied, slot) ? supplied[slot] : undefined)\n )\n return yield* InvalidMountSetting.make({\n mount: at,\n slot,\n reason: \"Missing\",\n });\n }\n return yield* Schema.encodeUnknownEffect(schema)(choice).pipe(\n Effect.mapError(() => invalid),\n );\n });\n\n/**\n * Normalize all accepted Input forms without resolving resource dependencies.\n * Redacted values remain opaque; arrays and choice records retain their shape.\n */\nconst normalize = (value: unknown): unknown => {\n if (Output.isOutput(value)) return value;\n if (Effect.isEffect(value)) {\n // oxlint-disable-next-line effecttsgo/any-unknown-in-error-context -- Input admits Effects with arbitrary errors and requirements; this boundary preserves requirements on the Output and converts failures to defects.\n return value.pipe(Effect.orDie, Output.fromEffect);\n }\n if (value === null || typeof value !== \"object\" || Redacted.isRedacted(value))\n return value;\n if (Arr.isArray(value)) {\n const inputs = Arr.map(value, normalize);\n return Arr.some(inputs, Output.isOutput)\n ? Output.all(...Arr.map(inputs, (input) => Output.asOutput(input)))\n : inputs;\n }\n const entries = Arr.map(\n Rec.toEntries(value),\n ([key, input]) => [key, normalize(input)] as const,\n );\n const assemble = (resolved: ReadonlyArray<unknown>) =>\n Rec.fromEntries(Arr.map(entries, ([key], index) => [key, resolved[index]]));\n const inputs = Arr.map(entries, ([, input]) => input);\n return Arr.some(inputs, Output.isOutput)\n ? Output.map(\n Output.all(...Arr.map(inputs, (input) => Output.asOutput(input))),\n assemble,\n )\n : assemble(inputs);\n};\n\n/**\n * Each supplied slot keeps its input edges. A tagged setting also reads its\n * selector's input, and a selector reads only its own tagged settings.\n */\nconst supplySettings = <E>(\n at: string,\n slots: Readonly<Record<string, Env.Descriptor>>,\n supplied: Readonly<Record<string, unknown>>,\n invalid: (\n slot: string,\n reason: \"Missing\" | \"InvalidValue\" | \"PlainSecret\",\n ) => E,\n) =>\n Effect.gen(function* () {\n const normalized = Rec.map(supplied, normalize);\n const entries: Array<[string, unknown]> = [];\n const settle = (\n key: string,\n descriptor: Env.Descriptor,\n value: unknown,\n choice?: unknown,\n ) =>\n Effect.gen(function* () {\n if (missing(value)) {\n const provider = descriptor.provider;\n const selector =\n provider === undefined ? undefined : slots[provider.selector];\n if (\n provider?.required === true &&\n selector?.kind === \"providers\" &&\n !missing(choice)\n )\n yield* settleChoice(\n at,\n provider.selector,\n selector,\n { [key]: descriptor },\n { [key]: value },\n choice,\n );\n if (!descriptor.optional)\n return yield* Effect.fail(invalid(key, \"Missing\"));\n return undefined;\n }\n if (descriptor.kind === \"secret\" && typeof value === \"string\")\n return yield* Effect.fail(invalid(key, \"PlainSecret\"));\n const valid =\n descriptor.kind === \"secret\"\n ? Redacted.isRedacted(value) &&\n typeof Redacted.value(value) === \"string\"\n : descriptor.kind === \"providers\" ||\n (typeof value === \"string\" &&\n (descriptor.kind !== \"literals\" ||\n descriptor.values.includes(value)));\n if (!valid) return yield* Effect.fail(invalid(key, \"InvalidValue\"));\n return value;\n });\n for (const [key, descriptor] of Rec.toEntries(slots)) {\n const value = Rec.has(normalized, key) ? normalized[key] : undefined;\n const choice =\n descriptor.provider === undefined ||\n !Rec.has(normalized, descriptor.provider.selector)\n ? undefined\n : normalized[descriptor.provider.selector];\n const checked =\n Output.isOutput(value) || Output.isOutput(choice)\n ? Output.all(Output.asOutput(value), Output.asOutput(choice)).pipe(\n Output.mapEffect(([resolved, selected]) =>\n settle(key, descriptor, resolved, selected).pipe(Effect.orDie),\n ),\n )\n : yield* settle(key, descriptor, value, choice);\n if (checked !== undefined) entries.push([key, checked]);\n }\n const settings = Rec.fromEntries(entries);\n for (const [key, descriptor] of Rec.toEntries(slots)) {\n if (descriptor.kind !== \"providers\" || !Rec.has(settings, key)) continue;\n const value = settings[key];\n const tagged = Rec.filter(\n settings,\n (_, slot) => slots[slot]?.provider?.selector === key,\n );\n const check = (\n choice: unknown,\n resolved: Readonly<Record<string, unknown>>,\n ) => settleChoice(at, key, descriptor, slots, resolved, choice);\n const inputs = normalize({ value, tagged });\n settings[key] = Output.isOutput(inputs)\n ? inputs.pipe(\n Output.mapEffect(\n (resolved: {\n readonly value: unknown;\n readonly tagged: Readonly<Record<string, unknown>>;\n }) => check(resolved.value, resolved.tagged).pipe(Effect.orDie),\n ),\n )\n : yield* check(value, tagged);\n }\n return settings as Record<string, Variables[string]>;\n });\n\nexport class InvalidMountSetting extends Schema.TaggedError<\n InvalidMountSetting,\n { readonly brand: unique symbol }\n>()(\"InvalidMountSetting\", {\n mount: Schema.String,\n slot: Schema.optional(Schema.String),\n reason: Schema.Literals([\n \"UnknownMount\",\n \"NotOpen\",\n \"Missing\",\n \"PlainSecret\",\n \"InvalidChoice\",\n \"InvalidValue\",\n ]),\n}) {\n override get message() {\n const at =\n this.slot === undefined ? this.mount : `${this.mount}.${this.slot}`;\n const location = this.mount === \"app\" ? \"Backend.env\" : \"Backend.mounts\";\n const remedy = {\n UnknownMount:\n \"This mount is not listed. Use a mount name from manifest.mounts.\",\n NotOpen:\n \"This slot is not open. Supply only slots listed in this mount's manifest env.\",\n Missing: `This required slot is missing. Supply this required slot in ${location}.`,\n PlainSecret: `This secret is a plain string. Wrap this secret with Redacted.make before passing it in ${location}.`,\n InvalidValue:\n \"This value does not match its manifest slot. Supply a string of the declared kind; secret slots require a Redacted string and literals slots require one of their values.\",\n InvalidChoice:\n \"This provider choice is one the component would refuse. Name one of the providers this selector offers, or a failover or pool of them.\",\n };\n return `${at}: ${remedy[this.reason]}`;\n }\n}\n\n/**\n * Each mount's settings under the deployment variable the manifest names for\n * it, refusing a manifest that does not decode, a mount or slot the manifest\n * does not list as open, a missing required slot, a plain string for a secret\n * and a provider choice the component would refuse.\n */\nexport const mountVariables = (\n input: Manifest.Manifest,\n mounts: Readonly<Record<string, Settings>>,\n): Effect.Effect<\n Record<string, Variables[string]>,\n InvalidMountSetting | Manifest.UnsupportedManifestFormat\n> =>\n Effect.gen(function* () {\n const manifest = yield* Effect.fromResult(\n Manifest.decode(input, \"confect/_generated/manifest.ts\"),\n );\n const variables: Record<string, Variables[string]> = {};\n for (const mount of Rec.keys(mounts)) {\n if (!Rec.has(manifest.mounts, mount))\n return yield* InvalidMountSetting.make({\n mount,\n reason: \"UnknownMount\",\n });\n }\n for (const [mount, entry] of Rec.toEntries(manifest.mounts)) {\n const supplied =\n (Rec.has(mounts, mount) ? mounts[mount] : undefined) ?? {};\n for (const slot of Rec.keys(supplied)) {\n if (!Rec.has(entry.env, slot))\n return yield* InvalidMountSetting.make({\n mount,\n slot,\n reason: \"NotOpen\",\n });\n }\n const settings = yield* supplySettings(\n mount,\n entry.env,\n supplied,\n (slot, reason) => InvalidMountSetting.make({ mount, slot, reason }),\n );\n for (const [slot, value] of Rec.toEntries(settings)) {\n variables[entry.env[slot]!.variable] = value;\n }\n }\n return variables;\n });\n\nconst backend = (\n id: string,\n props: CommonProps & {\n readonly manifest?: Manifest.Manifest;\n readonly env?: Settings;\n readonly automatic?: Variables;\n readonly mounts?: Readonly<Record<string, Settings>>;\n },\n) =>\n Namespace.push(\n id,\n Effect.gen(function* () {\n const manifest =\n props.manifest === undefined\n ? undefined\n : yield* Effect.fromResult(\n Manifest.decode(props.manifest, \"confect/_generated/manifest.ts\"),\n ).pipe(Effect.orDie);\n const promoted =\n manifest === undefined\n ? {}\n : yield* mountVariables(manifest, props.mounts ?? {}).pipe(\n Effect.orDie,\n );\n const automaticInput =\n manifest === undefined\n ? undefined\n : yield* Effect.fromResult(\n automaticVariables(manifest, props.automatic ?? {}),\n ).pipe(Effect.orDie);\n const automatic =\n manifest === undefined || automaticInput === undefined\n ? undefined\n : yield* supplySettings(\n \"app\",\n Rec.filter(manifest.env, (slot) => slot.automatic === true),\n automaticInput,\n (slot, reason) => InvalidAutomaticSetting.make({ slot, reason }),\n ).pipe(Effect.orDie);\n const env =\n manifest === undefined\n ? props.env\n : yield* supplySettings(\n \"app\",\n Rec.filter(manifest.env, (slot) => slot.automatic !== true),\n props.env ?? {},\n (slot, reason) =>\n InvalidMountSetting.make({\n mount: \"app\",\n slot,\n reason,\n }),\n ).pipe(Effect.orDie);\n const variables =\n Rec.keys(promoted).length === 0 && props.automatic === undefined\n ? env\n : { ...env, ...automatic, ...promoted };\n const environment =\n variables === undefined ||\n (props.env === undefined &&\n props.automatic === undefined &&\n Rec.keys(variables).length === 0)\n ? undefined\n : yield* EnvironmentVariables(\"Environment\", {\n url: props.deployment.url,\n deployKey: props.deployKey,\n variables: variables as Variables,\n });\n const code = yield* Code(\"Code\", {\n deployment: {\n name: props.deployment.name,\n url:\n environment !== undefined\n ? Output.map(\n Output.all(environment.variables, environment.url),\n ([, url]) => url,\n )\n : props.deployment.url,\n },\n deployKey: props.deployKey,\n ...(props.cwd === undefined ? {} : { cwd: props.cwd }),\n ...(manifest === undefined ? {} : { manifestDigest: manifest.digest }),\n prepare: { command: \"confect\", args: [\"codegen\"] },\n });\n return { code, environment, name: code.name, url: code.url };\n }),\n );\n"],"mappings":";;;;;;;;;;;;;AAyFA,SAAgB,QACd,IACA,OAM4B;CAC5B,OAAO,QAAQ,IAAI,KAAK;AAC1B;AAUA,IAAa,0BAAb,cAA6C,OAAO,YAGlD,CAAC,CAAC,2BAA2B;CAC7B,MAAM,OAAO;CACb,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;CACF,CAAC;AACH,CAAC,CAAC,CAAC;CACD,IAAa,UAAkB;EAC7B,IAAI,KAAK,WAAW,eAClB,OAAO,GAAG,KAAK,KAAK;EACtB,IAAI,KAAK,WAAW,gBAClB,OAAO,GAAG,KAAK,KAAK;EACtB,OAAO,KAAK,WAAW,iBACnB,GAAG,KAAK,KAAK,wIACb,GAAG,KAAK,KAAK;CACnB;AACF;AAEA,MAAM,sBACJ,UACA,aAEA,OAAO,IAAI,aAAa;CACtB,KAAK,MAAM,QAAQ,IAAI,KAAK,QAAQ,GAClC,IACE,CAAC,IAAI,IAAI,SAAS,KAAK,IAAI,KAC3B,SAAS,IAAI,KAAK,EAAE,cAAc,MAElC,OAAO,OAAO,OAAO,KACnB,wBAAwB,KAAK;EAAE;EAAM,QAAQ;CAAe,CAAC,CAC/D;CAEJ,KAAK,MAAM,CAAC,MAAM,eAAe,IAAI,UAAU,SAAS,GAAG,GACzD,IACE,WAAW,cAAc,QACzB,QAAQ,IAAI,IAAI,UAAU,IAAI,IAAI,SAAS,QAAQ,KAAA,CAAS,GAE5D,OAAO,OAAO,OAAO,KACnB,wBAAwB,KAAK;EAAE;EAAM,QAAQ;CAAU,CAAC,CAC1D;CAEJ,OAAO;AACT,CAAC;AAEH,MAAM,WAAW,UACf,UAAU,KAAA,KACV,UAAU,QACV,UAAU,MACT,SAAS,WAAW,KAAK,KAAK,SAAS,MAAM,KAAK,MAAM;;;;;;AAO3D,MAAM,gBACJ,IACA,K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M,cACJ,cAAc,KAAA,KACb,MAAM,QAAQ,KAAA,KACb,MAAM,cAAc,KAAA,KACpB,IAAI,KAAK,SAAS,CAAC,CAAC,WAAW,IAC7B,KAAA,IACA,OAAO,qBAAqB,eAAe;EACzC,KAAK,MAAM,WAAW;EACtB,WAAW,MAAM;EACN;CACb,CAAC;CACP,MAAM,OAAO,OAAO,KAAK,QAAQ;EAC/B,YAAY;GACV,MAAM,MAAM,WAAW;GACvB,KACE,gBAAgB,KAAA,IACZ,OAAO,IACL,OAAO,IAAI,YAAY,WAAW,YAAY,GAAG,IAChD,GAAG,SAAS,GACf,IACA,MAAM,WAAW;EACzB;EACA,WAAW,MAAM;EACjB,GAAI,MAAM,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK,MAAM,IAAI;EACpD,GAAI,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,gBAAgB,SAAS,OAAO;EACpE,SAAS;GAAE,SAAS;GAAW,MAAM,CAAC,SAAS;EAAE;CACnD,CAAC;CACD,OAAO;EAAE;EAAM;EAAa,MAAM,KAAK;EAAM,KAAK,KAAK;CAAI;AAC7D,CAAC,CACH"}
package/dist/Code.d.ts CHANGED
@@ -7,6 +7,7 @@ import * as Path from "effect/Path";
7
7
  import type * as Redacted from "effect/Redacted";
8
8
  import { ConvexClient } from "./ConvexClient.js";
9
9
  import type { Providers } from "./Providers.js";
10
+ export { HealthCheckFailed, StaleManifest } from "./internal/CodeDeployment.js";
10
11
  import { CommandRunner, type PrepareCommand } from "./internal/CommandRunner.js";
11
12
  import { PushLock } from "./internal/PushLock.js";
12
13
  export interface CodeProps {
@@ -17,6 +18,17 @@ export interface CodeProps {
17
18
  readonly deployKey: Redacted.Redacted<string>;
18
19
  readonly cwd?: string;
19
20
  readonly prepare?: PrepareCommand;
21
+ /**
22
+ * The digest of the manifest this push deploys. After `prepare` and before
23
+ * the push, the deploy verifies the complete generated `confectHealth.ts`
24
+ * with LF or CRLF line endings. Edited or missing files fail with
25
+ * `StaleManifest` reason `NotGenerated`; another digest uses
26
+ * `DifferentDigest`. Both push nothing. Do not edit or format the generated
27
+ * file. After every mount's `init`, still inside the push lock, it asks the
28
+ * pushed code which digest it was generated with and fails when it answers
29
+ * nothing or another one.
30
+ */
31
+ readonly manifestDigest?: string;
20
32
  }
21
33
  export interface CodeAttributes {
22
34
  readonly name: string;
@@ -51,7 +63,7 @@ export declare const provider: Effect.Effect<{
51
63
  }) => Effect.Effect<{
52
64
  name: string;
53
65
  url: string;
54
- }, import("./internal/CommandRunner.js").CommandError | import("./internal/CodeDeployment.js").InvalidDeploymentTarget | import("./internal/MountInit.js").MountInitFailed | import("./internal/PushLock.js").PushLockError, never>;
66
+ }, import("./internal/CommandRunner.js").CommandError | import("./Code.js").HealthCheckFailed | import("./internal/CodeDeployment.js").InvalidDeploymentTarget | import("./internal/MountInit.js").MountInitFailed | import("./internal/PushLock.js").PushLockError | import("./Code.js").StaleManifest, never>;
55
67
  delete: () => Effect.Effect<void, never, never>;
56
68
  }, never, CommandRunner | ConvexClient | FileSystem.FileSystem | Path.Path | PushLock>;
57
69
  /**
@@ -83,7 +95,7 @@ export declare const localProvider: Effect.Effect<{
83
95
  }) => Effect.Effect<{
84
96
  name: string;
85
97
  url: string;
86
- }, import("./internal/CommandRunner.js").CommandError | import("./internal/CodeDeployment.js").InvalidDeploymentTarget | import("./internal/MountInit.js").MountInitFailed | import("./internal/PushLock.js").PushLockError, never>;
98
+ }, import("./internal/CommandRunner.js").CommandError | import("./Code.js").HealthCheckFailed | import("./internal/CodeDeployment.js").InvalidDeploymentTarget | import("./internal/MountInit.js").MountInitFailed | import("./internal/PushLock.js").PushLockError | import("./Code.js").StaleManifest, never>;
87
99
  delete: () => Effect.Effect<void, never, never>;
88
100
  }, never, CommandRunner | ConvexClient | FileSystem.FileSystem | Path.Path | PushLock>;
89
101
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Code.d.ts","sources":["../src/Code.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,IAAI,GAAG,QAAQ,CACzB,aAAa,EACb,SAAS,EACT,cAAc,EACd,KAAK,EACL,SAAS,CACV,CAAC;AACF,eAAO,MAAM,IAAI,uCAAgC,CAAC;AAwBlD;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;sFAAe,CAAC;AACrC;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;sFAAgB,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,KAAK,0HAAkC,CAAC;AACrD;;GAEG;AACH,eAAO,MAAM,UAAU,2GAMtB,CAAC"}
package/dist/Code.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ConvexClient, layer as layer$1 } from "./ConvexClient.js";
2
- import { deploy } from "./internal/CodeDeployment.js";
2
+ import { HealthCheckFailed, StaleManifest, deploy } from "./internal/CodeDeployment.js";
3
3
  import { CommandRunner } from "./internal/CommandRunner.js";
4
4
  import { PushLock } from "./internal/PushLock.js";
5
5
  import * as Effect from "effect/Effect";
@@ -42,6 +42,6 @@ const layer = Provider.effect(Code, provider);
42
42
  * @stability unstable
43
43
  */
44
44
  const localLayer = Provider.effect(Code, localProvider).pipe(Layer.provide(layer$1({ mode: "local" }).pipe(Layer.provide(FetchHttpClient.layer))));
45
- export { Code, layer, localLayer, localProvider, provider };
45
+ export { Code, HealthCheckFailed, StaleManifest, layer, localLayer, localProvider, provider };
46
46
 
47
47
  //# sourceMappingURL=Code.js.map
package/dist/Code.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Code.js","names":["ConvexClientLayer"],"sources":["../src/Code.ts"],"sourcesContent":["import * as Provider from \"alchemy/Provider\";\nimport type { ProviderMode } from \"alchemy/ProviderMode\";\nimport { Resource } from \"alchemy/Resource\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Path from \"effect/Path\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\nimport type * as Redacted from \"effect/Redacted\";\nimport { ConvexClient, layer as ConvexClientLayer } from \"./ConvexClient.js\";\nimport type { Providers } from \"./Providers.js\";\nimport { deploy } from \"./internal/CodeDeployment.js\";\nimport {\n CommandRunner,\n type PrepareCommand,\n} from \"./internal/CommandRunner.js\";\nimport { PushLock } from \"./internal/PushLock.js\";\n\nexport interface CodeProps {\n readonly deployment: { readonly name: string; readonly url: string };\n readonly deployKey: Redacted.Redacted<string>;\n readonly cwd?: string;\n readonly prepare?: PrepareCommand;\n}\n\nexport interface CodeAttributes {\n readonly name: string;\n readonly url: string;\n}\n\nexport type Code = Resource<\n \"Convex.Code\",\n CodeProps,\n CodeAttributes,\n never,\n Providers\n>;\nexport const Code = Resource<Code>(\"Convex.Code\");\n\nconst make = (mode: ProviderMode) =>\n Effect.gen(function* () {\n const runner = yield* CommandRunner;\n const lock = yield* PushLock;\n const client = yield* ConvexClient;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return {\n read: ({ output }) => Effect.succeed(output),\n diff: () => Effect.succeed({ action: \"update\" }),\n reconcile: ({ news }) =>\n deploy(news, mode).pipe(\n Effect.provideService(CommandRunner, runner),\n Effect.provideService(PushLock, lock),\n Effect.provideService(ConvexClient, client),\n Effect.provideService(FileSystem.FileSystem, fs),\n Effect.provideService(Path.Path, path),\n ),\n delete: () => Effect.void,\n } satisfies Provider.ProviderServiceInput<Code>;\n });\n\n/**\n * @stability unstable\n */\nexport const provider = make(\"live\");\n/**\n * Under `alchemy dev`, pushes go to the local backend's self-hosted target.\n *\n * @stability unstable\n */\nexport const localProvider = make(\"local\");\n\n/**\n * @stability unstable\n */\nexport const layer = Provider.effect(Code, provider);\n/**\n * @stability unstable\n */\nexport const localLayer = Provider.effect(Code, localProvider).pipe(\n Layer.provide(\n ConvexClientLayer({ mode: \"local\" }).pipe(\n Layer.provide(FetchHttpClient.layer),\n ),\n ),\n);\n"],"mappings":";;;;;;;;;;;;AAqCA,MAAa,OAAO,SAAe,aAAa;AAEhD,MAAM,QAAQ,SACZ,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO;CACtB,MAAM,OAAO,OAAO;CACpB,MAAM,SAAS,OAAO;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,OAAO;EACL,OAAO,EAAE,aAAa,OAAO,QAAQ,MAAM;EAC3C,YAAY,OAAO,QAAQ,EAAE,QAAQ,SAAS,CAAC;EAC/C,YAAY,EAAE,WACZ,OAAO,MAAM,IAAI,CAAC,CAAC,KACjB,OAAO,eAAe,eAAe,MAAM,GAC3C,OAAO,eAAe,UAAU,IAAI,GACpC,OAAO,eAAe,cAAc,MAAM,GAC1C,OAAO,eAAe,WAAW,YAAY,EAAE,GAC/C,OAAO,eAAe,KAAK,MAAM,IAAI,CACvC;EACF,cAAc,OAAO;CACvB;AACF,CAAC;;;;AAKH,MAAa,WAAW,KAAK,MAAM;;;;;;AAMnC,MAAa,gBAAgB,KAAK,OAAO;;;;AAKzC,MAAa,QAAQ,SAAS,OAAO,MAAM,QAAQ;;;;AAInD,MAAa,aAAa,SAAS,OAAO,MAAM,aAAa,CAAC,CAAC,KAC7D,MAAM,QACJA,QAAkB,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,KACnC,MAAM,QAAQ,gBAAgB,KAAK,CACrC,CACF,CACF"}
1
+ {"version":3,"file":"Code.js","names":["ConvexClientLayer"],"sources":["../src/Code.ts"],"sourcesContent":["import * as Provider from \"alchemy/Provider\";\nimport type { ProviderMode } from \"alchemy/ProviderMode\";\nimport { Resource } from \"alchemy/Resource\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as Layer from \"effect/Layer\";\nimport * as Path from \"effect/Path\";\nimport * as FetchHttpClient from \"effect/http/FetchHttpClient\";\nimport type * as Redacted from \"effect/Redacted\";\nimport { ConvexClient, layer as ConvexClientLayer } from \"./ConvexClient.js\";\nimport type { Providers } from \"./Providers.js\";\nimport { deploy } from \"./internal/CodeDeployment.js\";\n\nexport { HealthCheckFailed, StaleManifest } from \"./internal/CodeDeployment.js\";\nimport {\n CommandRunner,\n type PrepareCommand,\n} from \"./internal/CommandRunner.js\";\nimport { PushLock } from \"./internal/PushLock.js\";\n\nexport interface CodeProps {\n readonly deployment: { readonly name: string; readonly url: string };\n readonly deployKey: Redacted.Redacted<string>;\n readonly cwd?: string;\n readonly prepare?: PrepareCommand;\n /**\n * The digest of the manifest this push deploys. After `prepare` and before\n * the push, the deploy verifies the complete generated `confectHealth.ts`\n * with LF or CRLF line endings. Edited or missing files fail with\n * `StaleManifest` reason `NotGenerated`; another digest uses\n * `DifferentDigest`. Both push nothing. Do not edit or format the generated\n * file. After every mount's `init`, still inside the push lock, it asks the\n * pushed code which digest it was generated with and fails when it answers\n * nothing or another one.\n */\n readonly manifestDigest?: string;\n}\n\nexport interface CodeAttributes {\n readonly name: string;\n readonly url: string;\n}\n\nexport type Code = Resource<\n \"Convex.Code\",\n CodeProps,\n CodeAttributes,\n never,\n Providers\n>;\nexport const Code = Resource<Code>(\"Convex.Code\");\n\nconst make = (mode: ProviderMode) =>\n Effect.gen(function* () {\n const runner = yield* CommandRunner;\n const lock = yield* PushLock;\n const client = yield* ConvexClient;\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n return {\n read: ({ output }) => Effect.succeed(output),\n diff: () => Effect.succeed({ action: \"update\" }),\n reconcile: ({ news }) =>\n deploy(news, mode).pipe(\n Effect.provideService(CommandRunner, runner),\n Effect.provideService(PushLock, lock),\n Effect.provideService(ConvexClient, client),\n Effect.provideService(FileSystem.FileSystem, fs),\n Effect.provideService(Path.Path, path),\n ),\n delete: () => Effect.void,\n } satisfies Provider.ProviderServiceInput<Code>;\n });\n\n/**\n * @stability unstable\n */\nexport const provider = make(\"live\");\n/**\n * Under `alchemy dev`, pushes go to the local backend's self-hosted target.\n *\n * @stability unstable\n */\nexport const localProvider = make(\"local\");\n\n/**\n * @stability unstable\n */\nexport const layer = Provider.effect(Code, provider);\n/**\n * @stability unstable\n */\nexport const localLayer = Provider.effect(Code, localProvider).pipe(\n Layer.provide(\n ConvexClientLayer({ mode: \"local\" }).pipe(\n Layer.provide(FetchHttpClient.layer),\n ),\n ),\n);\n"],"mappings":";;;;;;;;;;;;AAkDA,MAAa,OAAO,SAAe,aAAa;AAEhD,MAAM,QAAQ,SACZ,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO;CACtB,MAAM,OAAO,OAAO;CACpB,MAAM,SAAS,OAAO;CACtB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,OAAO;EACL,OAAO,EAAE,aAAa,OAAO,QAAQ,MAAM;EAC3C,YAAY,OAAO,QAAQ,EAAE,QAAQ,SAAS,CAAC;EAC/C,YAAY,EAAE,WACZ,OAAO,MAAM,IAAI,CAAC,CAAC,KACjB,OAAO,eAAe,eAAe,MAAM,GAC3C,OAAO,eAAe,UAAU,IAAI,GACpC,OAAO,eAAe,cAAc,MAAM,GAC1C,OAAO,eAAe,WAAW,YAAY,EAAE,GAC/C,OAAO,eAAe,KAAK,MAAM,IAAI,CACvC;EACF,cAAc,OAAO;CACvB;AACF,CAAC;;;;AAKH,MAAa,WAAW,KAAK,MAAM;;;;;;AAMnC,MAAa,gBAAgB,KAAK,OAAO;;;;AAKzC,MAAa,QAAQ,SAAS,OAAO,MAAM,QAAQ;;;;AAInD,MAAa,aAAa,SAAS,OAAO,MAAM,aAAa,CAAC,CAAC,KAC7D,MAAM,QACJA,QAAkB,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,KACnC,MAAM,QAAQ,gBAAgB,KAAK,CACrC,CACF,CACF"}
package/dist/Confect.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { Backend, type BackendProps } from "./Backend.js";
1
+ export { Backend, type BackendProps, InvalidMountSetting, InvalidAutomaticSetting, mountVariables, } from "./Backend.js";
2
2
  //# sourceMappingURL=Confect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Confect.d.ts","sources":["../src/Confect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"Confect.d.ts","sources":["../src/Confect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,YAAY,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,GACf,MAAM,cAAc,CAAC"}
package/dist/Confect.js CHANGED
@@ -1,7 +1,12 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Backend } from "./Backend.js";
2
+ import { Backend, InvalidAutomaticSetting, InvalidMountSetting, mountVariables } from "./Backend.js";
3
3
  // src/Confect.ts
4
- var Confect_exports = /* @__PURE__ */ __exportAll({ Backend: () => Backend });
5
- export { Backend, Confect_exports };
4
+ var Confect_exports = /* @__PURE__ */ __exportAll({
5
+ Backend: () => Backend,
6
+ InvalidAutomaticSetting: () => InvalidAutomaticSetting,
7
+ InvalidMountSetting: () => InvalidMountSetting,
8
+ mountVariables: () => mountVariables
9
+ });
10
+ export { Backend, Confect_exports, InvalidAutomaticSetting, InvalidMountSetting, mountVariables };
6
11
 
7
12
  //# sourceMappingURL=Confect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Confect.js","names":[],"sources":["../src/Confect.ts"],"sourcesContent":["export { Backend, type BackendProps } from \"./Backend.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"Confect.js","names":[],"sources":["../src/Confect.ts"],"sourcesContent":["export {\n Backend,\n type BackendProps,\n InvalidMountSetting,\n InvalidAutomaticSetting,\n mountVariables,\n} from \"./Backend.js\";\n"],"mappings":""}
package/dist/Convex.d.ts CHANGED
@@ -2,6 +2,9 @@ export { Project, type ProjectProps, type ProjectAttributes, } from "./Project.j
2
2
  export { Deployment, type DeploymentProps, type DeploymentAttributes, } from "./Deployment.js";
3
3
  export { DeployKey, type DeployKeyProps, type DeployKeyAttributes, } from "./DeployKey.js";
4
4
  export { EnvironmentVariables, type EnvironmentVariablesProps, type EnvironmentVariablesAttributes, } from "./EnvironmentVariables.js";
5
- export { Code, type CodeProps, type CodeAttributes } from "./Code.js";
5
+ export { Code, type CodeProps, type CodeAttributes, HealthCheckFailed, StaleManifest, } from "./Code.js";
6
6
  export { providers, Providers } from "./Providers.js";
7
+ export { LogStream, type LogStreamProps, type LogStreamAttributes, } from "./LogStream.js";
8
+ export { CustomDomain, type CustomDomainProps, type CustomDomainAttributes, } from "./CustomDomain.js";
9
+ export { UsageLimit, type UsageLimitProps, type UsageLimitAttributes, } from "./UsageLimit.js";
7
10
  //# sourceMappingURL=Convex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Convex.d.ts","sources":["../src/Convex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,YAAY,EACjB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,GACpC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"Convex.d.ts","sources":["../src/Convex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,YAAY,EACjB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,GACpC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,IAAI,EACJ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC"}
package/dist/Convex.js CHANGED
@@ -1,20 +1,29 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { HealthCheckFailed, StaleManifest } from "./internal/CodeDeployment.js";
2
3
  import { Project } from "./Project.js";
3
4
  import { Deployment } from "./Deployment.js";
4
5
  import { DeployKey } from "./DeployKey.js";
5
6
  import { EnvironmentVariables } from "./EnvironmentVariables.js";
6
7
  import { Code } from "./Code.js";
7
8
  import { Providers, providers } from "./Providers.js";
9
+ import { LogStream } from "./LogStream.js";
10
+ import { CustomDomain } from "./CustomDomain.js";
11
+ import { UsageLimit } from "./UsageLimit.js";
8
12
  // src/Convex.ts
9
13
  var Convex_exports = /* @__PURE__ */ __exportAll({
10
14
  Code: () => Code,
15
+ CustomDomain: () => CustomDomain,
11
16
  DeployKey: () => DeployKey,
12
17
  Deployment: () => Deployment,
13
18
  EnvironmentVariables: () => EnvironmentVariables,
19
+ HealthCheckFailed: () => HealthCheckFailed,
20
+ LogStream: () => LogStream,
14
21
  Project: () => Project,
15
22
  Providers: () => Providers,
23
+ StaleManifest: () => StaleManifest,
24
+ UsageLimit: () => UsageLimit,
16
25
  providers: () => providers
17
26
  });
18
- export { Code, Convex_exports, DeployKey, Deployment, EnvironmentVariables, Project, Providers, providers };
27
+ export { Code, Convex_exports, CustomDomain, DeployKey, Deployment, EnvironmentVariables, HealthCheckFailed, LogStream, Project, Providers, StaleManifest, UsageLimit, providers };
19
28
 
20
29
  //# sourceMappingURL=Convex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Convex.js","names":[],"sources":["../src/Convex.ts"],"sourcesContent":["export {\n Project,\n type ProjectProps,\n type ProjectAttributes,\n} from \"./Project.js\";\nexport {\n Deployment,\n type DeploymentProps,\n type DeploymentAttributes,\n} from \"./Deployment.js\";\nexport {\n DeployKey,\n type DeployKeyProps,\n type DeployKeyAttributes,\n} from \"./DeployKey.js\";\nexport {\n EnvironmentVariables,\n type EnvironmentVariablesProps,\n type EnvironmentVariablesAttributes,\n} from \"./EnvironmentVariables.js\";\nexport { Code, type CodeProps, type CodeAttributes } from \"./Code.js\";\nexport { providers, Providers } from \"./Providers.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"Convex.js","names":[],"sources":["../src/Convex.ts"],"sourcesContent":["export {\n Project,\n type ProjectProps,\n type ProjectAttributes,\n} from \"./Project.js\";\nexport {\n Deployment,\n type DeploymentProps,\n type DeploymentAttributes,\n} from \"./Deployment.js\";\nexport {\n DeployKey,\n type DeployKeyProps,\n type DeployKeyAttributes,\n} from \"./DeployKey.js\";\nexport {\n EnvironmentVariables,\n type EnvironmentVariablesProps,\n type EnvironmentVariablesAttributes,\n} from \"./EnvironmentVariables.js\";\nexport {\n Code,\n type CodeProps,\n type CodeAttributes,\n HealthCheckFailed,\n StaleManifest,\n} from \"./Code.js\";\nexport { providers, Providers } from \"./Providers.js\";\nexport {\n LogStream,\n type LogStreamProps,\n type LogStreamAttributes,\n} from \"./LogStream.js\";\n\nexport {\n CustomDomain,\n type CustomDomainProps,\n type CustomDomainAttributes,\n} from \"./CustomDomain.js\";\n\nexport {\n UsageLimit,\n type UsageLimitProps,\n type UsageLimitAttributes,\n} from \"./UsageLimit.js\";\n"],"mappings":""}