@gigadrive/network-config 5.0.0 → 5.2.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/dist/index.d.ts CHANGED
@@ -51,6 +51,77 @@ declare const parseStaticAssetManifest: (content: string) => StaticAssetManifest
51
51
  */
52
52
  declare const collectAssetFiles: (projectFolder: string, assetsDir: string) => Effect.Effect<string[], never, FileSystem.FileSystem | Path.Path>;
53
53
 
54
+ declare const ConfigFileNotFoundError_base: Schema.TaggedErrorClass<ConfigFileNotFoundError, "ConfigFileNotFoundError", {
55
+ readonly _tag: Schema.tag<"ConfigFileNotFoundError">;
56
+ } & {
57
+ message: typeof Schema.String;
58
+ filePath: typeof Schema.String;
59
+ }>;
60
+ declare class ConfigFileNotFoundError extends ConfigFileNotFoundError_base {
61
+ }
62
+ declare const ConfigFileEmptyError_base: Schema.TaggedErrorClass<ConfigFileEmptyError, "ConfigFileEmptyError", {
63
+ readonly _tag: Schema.tag<"ConfigFileEmptyError">;
64
+ } & {
65
+ message: typeof Schema.String;
66
+ filePath: typeof Schema.String;
67
+ }>;
68
+ declare class ConfigFileEmptyError extends ConfigFileEmptyError_base {
69
+ }
70
+ declare const ConfigFileParseError_base: Schema.TaggedErrorClass<ConfigFileParseError, "ConfigFileParseError", {
71
+ readonly _tag: Schema.tag<"ConfigFileParseError">;
72
+ } & {
73
+ message: typeof Schema.String;
74
+ filePath: typeof Schema.String;
75
+ cause: Schema.optional<typeof Schema.String>;
76
+ }>;
77
+ declare class ConfigFileParseError extends ConfigFileParseError_base {
78
+ }
79
+ declare const ConfigModuleLoadError_base: Schema.TaggedErrorClass<ConfigModuleLoadError, "ConfigModuleLoadError", {
80
+ readonly _tag: Schema.tag<"ConfigModuleLoadError">;
81
+ } & {
82
+ message: typeof Schema.String;
83
+ filePath: typeof Schema.String;
84
+ cause: Schema.optional<typeof Schema.String>;
85
+ }>;
86
+ declare class ConfigModuleLoadError extends ConfigModuleLoadError_base {
87
+ }
88
+ declare const ConfigVersionError_base: Schema.TaggedErrorClass<ConfigVersionError, "ConfigVersionError", {
89
+ readonly _tag: Schema.tag<"ConfigVersionError">;
90
+ } & {
91
+ message: typeof Schema.String;
92
+ filePath: typeof Schema.String;
93
+ version: Schema.optional<typeof Schema.Number>;
94
+ }>;
95
+ declare class ConfigVersionError extends ConfigVersionError_base {
96
+ }
97
+ declare const ConfigSchemaValidationError_base: Schema.TaggedErrorClass<ConfigSchemaValidationError, "ConfigSchemaValidationError", {
98
+ readonly _tag: Schema.tag<"ConfigSchemaValidationError">;
99
+ } & {
100
+ message: typeof Schema.String;
101
+ filePath: typeof Schema.String;
102
+ validationErrors: Schema.Array$<typeof Schema.String>;
103
+ }>;
104
+ declare class ConfigSchemaValidationError extends ConfigSchemaValidationError_base {
105
+ }
106
+ declare const FunctionConfigError_base: Schema.TaggedErrorClass<FunctionConfigError, "FunctionConfigError", {
107
+ readonly _tag: Schema.tag<"FunctionConfigError">;
108
+ } & {
109
+ message: typeof Schema.String;
110
+ functionPath: typeof Schema.String;
111
+ }>;
112
+ declare class FunctionConfigError extends FunctionConfigError_base {
113
+ }
114
+ declare const ContainerConfigError_base: Schema.TaggedErrorClass<ContainerConfigError, "ContainerConfigError", {
115
+ readonly _tag: Schema.tag<"ContainerConfigError">;
116
+ } & {
117
+ message: typeof Schema.String;
118
+ containerName: Schema.optional<typeof Schema.String>;
119
+ filePath: Schema.optional<typeof Schema.String>;
120
+ }>;
121
+ /** A `containers` entry, or a Compose file imported into one, cannot be deployed as written. */
122
+ declare class ContainerConfigError extends ContainerConfigError_base {
123
+ }
124
+
54
125
  interface NormalizedImageLocalPattern {
55
126
  pathname?: string;
56
127
  search?: string;
@@ -711,6 +782,15 @@ interface NormalizedConfig {
711
782
  routes: Array<NormalizedConfigRoute>;
712
783
  /** Managed infrastructure declarations supplied through `gigadrive.yaml`. */
713
784
  services?: NormalizedConfigService[];
785
+ /**
786
+ * Container images that run inside the microVM of every function instance of
787
+ * the deployment, next to the function. Each one is reachable from the
788
+ * function, and from every other sidecar, at `<name>:<port>`.
789
+ *
790
+ * Sidecar state belongs to one instance: it is lost when the instance is
791
+ * retired, and two replicas of a function never share a sidecar.
792
+ */
793
+ sidecars?: NormalizedSidecar[];
714
794
  /**
715
795
  * Settings related to the archive the user uploads to the build workers.
716
796
  */
@@ -745,9 +825,9 @@ interface NormalizedConfigService {
745
825
  type: NormalizedConfigServiceType;
746
826
  }
747
827
  /** Service kinds supported by the normalized deployment configuration. */
748
- type NormalizedConfigServiceType = 'redis' | 'postgres' | 'storage';
828
+ type NormalizedConfigServiceType = 'redis' | 'postgres' | 'storage' | 'queues';
749
829
  /** Fully normalized managed-service declaration consumed by provisioning. */
750
- type NormalizedConfigServiceDefinition = NormalizedConfigServiceRedis | NormalizedConfigServicePostgres | NormalizedConfigServiceStorage;
830
+ type NormalizedConfigServiceDefinition = NormalizedConfigServiceRedis | NormalizedConfigServicePostgres | NormalizedConfigServiceStorage | NormalizedConfigServiceQueues;
751
831
  type UpstashAWSRegion = 'us-east-1' | 'us-east-2' | 'us-west-1' | 'us-west-2' | 'eu-central-1' | 'eu-west-1' | 'eu-west-2' | 'sa-east-1' | 'ap-south-1' | 'ap-northeast-1' | 'ap-southeast-1' | 'ap-southeast-2';
752
832
  interface NormalizedConfigServiceRedis extends NormalizedConfigService {
753
833
  type: 'redis';
@@ -782,14 +862,123 @@ interface NormalizedConfigStorageBucket {
782
862
  /** Access policy to apply when the bucket is first provisioned. */
783
863
  visibility: 'public' | 'private';
784
864
  }
865
+ /**
866
+ * Declarative queues provisioned in the deployment environment.
867
+ *
868
+ * Durations are resolved to seconds and schedule bodies to strings, so the
869
+ * platform receives one canonical shape. Settings the config omits stay
870
+ * absent and keep the platform's defaults.
871
+ */
872
+ interface NormalizedConfigServiceQueues extends NormalizedConfigService {
873
+ type: 'queues';
874
+ /** Queues sorted by name for deterministic deployment plans. */
875
+ queues: NormalizedConfigQueue[];
876
+ }
877
+ /** Desired state for one environment-scoped queue. */
878
+ interface NormalizedConfigQueue {
879
+ name: string;
880
+ /** Push consumer path; absent or `null` declares a pull queue. */
881
+ consumer?: string | null;
882
+ visibilityTimeoutSeconds?: number;
883
+ retentionSeconds?: number;
884
+ maxAttempts?: number;
885
+ retryBackoffMinSeconds?: number;
886
+ retryBackoffMaxSeconds?: number;
887
+ deduplicationWindowSeconds?: number;
888
+ concurrency?: number | null;
889
+ rateLimit?: {
890
+ count: number;
891
+ periodSeconds: number;
892
+ } | null;
893
+ deadLetter?: boolean;
894
+ /** Schedules sorted by name. */
895
+ schedules?: NormalizedConfigQueueSchedule[];
896
+ }
897
+ /** One cron schedule that sends into a declared queue. */
898
+ interface NormalizedConfigQueueSchedule {
899
+ name: string;
900
+ cron: string;
901
+ timezone?: string;
902
+ body?: string;
903
+ contentType?: string;
904
+ headers?: Record<string, string>;
905
+ enabled?: boolean;
906
+ }
785
907
  /** Default maximum lifetime of one function invocation, in seconds. */
786
908
  declare const DEFAULT_FUNCTION_DURATION_SECONDS = 30;
787
909
  /** Maximum configurable lifetime of one function invocation, in seconds (eight hours). */
788
910
  declare const MAX_FUNCTION_DURATION_SECONDS = 28800;
911
+ /**
912
+ * Runtime tag of an entrypoint that runs a container image instead of a
913
+ * managed language runtime. Such an entrypoint always carries a
914
+ * {@link NormalizedConfigEntrypoint.container} spec.
915
+ */
916
+ declare const CONTAINER_RUNTIME = "docker";
917
+ /** Runtime tag of a container entrypoint. */
918
+ type ContainerRuntime = typeof CONTAINER_RUNTIME;
919
+ /**
920
+ * Prefix of the synthetic `path` a container entrypoint carries. Routes target a
921
+ * container function with `destination: container:<name>`.
922
+ */
923
+ declare const CONTAINER_ENTRYPOINT_PREFIX = "container:";
924
+ /** Default memory of a container function, in MB. */
925
+ declare const DEFAULT_CONTAINER_MEMORY_MB = 512;
926
+ /** Default memory of a sidecar, in MB. It is added to the memory of every function it runs next to. */
927
+ declare const DEFAULT_SIDECAR_MEMORY_MB = 256;
928
+ /** Most sidecars one deployment may declare. */
929
+ declare const MAX_SIDECARS = 4;
930
+ /** Where the root filesystem of a container comes from. */
931
+ type NormalizedContainerImageSource = {
932
+ type: 'registry';
933
+ /** Image reference as written, e.g. `redis:7-alpine` or `ghcr.io/acme/api@sha256:...`. */
934
+ reference: string;
935
+ } | {
936
+ type: 'dockerfile';
937
+ /** Project-relative build context directory, `.` for the project root. */
938
+ context: string;
939
+ /** Dockerfile path relative to {@link context}. */
940
+ dockerfile: string;
941
+ /** Build stage to stop at, for multi-stage Dockerfiles. */
942
+ target?: string;
943
+ /** `--build-arg` values. */
944
+ buildArgs?: Record<string, string>;
945
+ };
946
+ /**
947
+ * A container image plus the settings that override its image config. The
948
+ * overrides are baked into the signed launch metadata at build time.
949
+ */
950
+ interface NormalizedContainerSpec {
951
+ /** Name from the `containers` map. Also the hostname a sidecar answers to. */
952
+ name: string;
953
+ source: NormalizedContainerImageSource;
954
+ /** TCP port the process listens on. Defaults to the image's first exposed port, then 8080. */
955
+ port?: number;
956
+ /** Replaces the image `ENTRYPOINT`. */
957
+ entrypoint?: string[];
958
+ /** Replaces the image `CMD`. */
959
+ command?: string[];
960
+ /** Replaces the image `WORKDIR`. */
961
+ workingDirectory?: string;
962
+ /** Replaces the image `USER`: a name, a uid, `name:group` or `uid:gid`. */
963
+ user?: string;
964
+ /** Merged over the image `ENV`. */
965
+ environmentVariables?: Record<string, string>;
966
+ }
967
+ /** A container that runs next to every function instance of the deployment. */
968
+ interface NormalizedSidecar extends NormalizedContainerSpec {
969
+ /** Memory reserved for the sidecar, in MB. Added to each function's memory. */
970
+ memory: number;
971
+ }
789
972
  interface NormalizedConfigEntrypoint {
790
973
  displayName?: string;
974
+ /**
975
+ * Project-relative file of the function, or `container:<name>` for a
976
+ * container function.
977
+ */
791
978
  path: string;
792
- runtime: Runtime;
979
+ runtime: Runtime | ContainerRuntime;
980
+ /** Image to run, present exactly when {@link runtime} is `docker`. */
981
+ container?: NormalizedContainerSpec;
793
982
  memory: number;
794
983
  /**
795
984
  * Maximum lifetime of one HTTP request, response stream, or WebSocket connection, in seconds.
@@ -815,6 +1004,13 @@ interface NormalizedConfigEntrypoint {
815
1004
  excludeFiles?: string[];
816
1005
  /** Shared deployment artifacts that must be mounted before this overlay. */
817
1006
  sharedArtifactIds?: string[];
1007
+ /**
1008
+ * Project-relative directories the function writes to at runtime, such as
1009
+ * a framework's cache, session and log directories. The package creates
1010
+ * each one and makes it writable by the runtime user; what a copy of the
1011
+ * function writes there is private to that copy and lost when it stops.
1012
+ */
1013
+ writablePaths?: string[];
818
1014
  };
819
1015
  }
820
1016
  type NormalizedFramework = NormalizedNextjsFramework;
@@ -877,67 +1073,6 @@ type NormalizedConfigRouteMatchRequirements = [] | [
877
1073
  }
878
1074
  ];
879
1075
 
880
- declare const ConfigFileNotFoundError_base: Schema.TaggedErrorClass<ConfigFileNotFoundError, "ConfigFileNotFoundError", {
881
- readonly _tag: Schema.tag<"ConfigFileNotFoundError">;
882
- } & {
883
- message: typeof Schema.String;
884
- filePath: typeof Schema.String;
885
- }>;
886
- declare class ConfigFileNotFoundError extends ConfigFileNotFoundError_base {
887
- }
888
- declare const ConfigFileEmptyError_base: Schema.TaggedErrorClass<ConfigFileEmptyError, "ConfigFileEmptyError", {
889
- readonly _tag: Schema.tag<"ConfigFileEmptyError">;
890
- } & {
891
- message: typeof Schema.String;
892
- filePath: typeof Schema.String;
893
- }>;
894
- declare class ConfigFileEmptyError extends ConfigFileEmptyError_base {
895
- }
896
- declare const ConfigFileParseError_base: Schema.TaggedErrorClass<ConfigFileParseError, "ConfigFileParseError", {
897
- readonly _tag: Schema.tag<"ConfigFileParseError">;
898
- } & {
899
- message: typeof Schema.String;
900
- filePath: typeof Schema.String;
901
- cause: Schema.optional<typeof Schema.String>;
902
- }>;
903
- declare class ConfigFileParseError extends ConfigFileParseError_base {
904
- }
905
- declare const ConfigModuleLoadError_base: Schema.TaggedErrorClass<ConfigModuleLoadError, "ConfigModuleLoadError", {
906
- readonly _tag: Schema.tag<"ConfigModuleLoadError">;
907
- } & {
908
- message: typeof Schema.String;
909
- filePath: typeof Schema.String;
910
- cause: Schema.optional<typeof Schema.String>;
911
- }>;
912
- declare class ConfigModuleLoadError extends ConfigModuleLoadError_base {
913
- }
914
- declare const ConfigVersionError_base: Schema.TaggedErrorClass<ConfigVersionError, "ConfigVersionError", {
915
- readonly _tag: Schema.tag<"ConfigVersionError">;
916
- } & {
917
- message: typeof Schema.String;
918
- filePath: typeof Schema.String;
919
- version: Schema.optional<typeof Schema.Number>;
920
- }>;
921
- declare class ConfigVersionError extends ConfigVersionError_base {
922
- }
923
- declare const ConfigSchemaValidationError_base: Schema.TaggedErrorClass<ConfigSchemaValidationError, "ConfigSchemaValidationError", {
924
- readonly _tag: Schema.tag<"ConfigSchemaValidationError">;
925
- } & {
926
- message: typeof Schema.String;
927
- filePath: typeof Schema.String;
928
- validationErrors: Schema.Array$<typeof Schema.String>;
929
- }>;
930
- declare class ConfigSchemaValidationError extends ConfigSchemaValidationError_base {
931
- }
932
- declare const FunctionConfigError_base: Schema.TaggedErrorClass<FunctionConfigError, "FunctionConfigError", {
933
- readonly _tag: Schema.tag<"FunctionConfigError">;
934
- } & {
935
- message: typeof Schema.String;
936
- functionPath: typeof Schema.String;
937
- }>;
938
- declare class FunctionConfigError extends FunctionConfigError_base {
939
- }
940
-
941
1076
  declare const ConfigModuleLoader_base: Effect.Service.Class<ConfigModuleLoader, "ConfigModuleLoader", {
942
1077
  readonly effect: Effect.Effect<{
943
1078
  loadConfigModule: (filePath: string) => Effect.Effect<Record<string, unknown>, ConfigModuleLoadError, never>;
@@ -985,6 +1120,11 @@ declare const V4ConfigParser_base: Effect.Service.Class<V4ConfigParser, "V4Confi
985
1120
  * @param projectFolder - Absolute path to the project root
986
1121
  */
987
1122
  parse: (config: ConfigV4, projectFolder: string) => Effect.Effect<{
1123
+ entrypoints: NormalizedConfigEntrypoint[];
1124
+ errors: never[];
1125
+ warnings: string[];
1126
+ routes: NormalizedConfigRoute[];
1127
+ sidecars?: NormalizedSidecar[] | undefined;
988
1128
  regions: ("us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "ap-south-1" | "ap-northeast-3" | "ap-northeast-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ca-central-1" | "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "sa-east-1")[];
989
1129
  assets: {
990
1130
  paths: string[];
@@ -996,11 +1136,7 @@ declare const V4ConfigParser_base: Effect.Service.Class<V4ConfigParser, "V4Confi
996
1136
  commands: string[];
997
1137
  images: NormalizedImagePolicy | undefined;
998
1138
  services: NormalizedConfigServiceDefinition[] | undefined;
999
- entrypoints: NormalizedConfigEntrypoint[];
1000
- errors: never[];
1001
- warnings: never[];
1002
- routes: NormalizedConfigRoute[];
1003
- }, FunctionConfigError, _effect_platform_FileSystem.FileSystem | _effect_platform_Path.Path>;
1139
+ }, FunctionConfigError | ContainerConfigError, _effect_platform_FileSystem.FileSystem | _effect_platform_Path.Path>;
1004
1140
  }, never, never>;
1005
1141
  }>;
1006
1142
  declare class V4ConfigParser extends V4ConfigParser_base {
@@ -1029,6 +1165,11 @@ interface Config {
1029
1165
  * @param projectFolder - Absolute path to the project root
1030
1166
  */
1031
1167
  declare const parseConfigRaw: (filePath: string, projectFolder: string) => Effect.Effect<{
1168
+ entrypoints: NormalizedConfigEntrypoint[];
1169
+ errors: never[];
1170
+ warnings: string[];
1171
+ routes: NormalizedConfigRoute[];
1172
+ sidecars?: NormalizedSidecar[] | undefined;
1032
1173
  regions: ("us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "ap-south-1" | "ap-northeast-3" | "ap-northeast-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ca-central-1" | "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "sa-east-1")[];
1033
1174
  assets: {
1034
1175
  paths: string[];
@@ -1040,11 +1181,7 @@ declare const parseConfigRaw: (filePath: string, projectFolder: string) => Effec
1040
1181
  commands: string[];
1041
1182
  images: NormalizedImagePolicy | undefined;
1042
1183
  services: NormalizedConfigServiceDefinition[] | undefined;
1043
- entrypoints: NormalizedConfigEntrypoint[];
1044
- errors: never[];
1045
- warnings: never[];
1046
- routes: NormalizedConfigRoute[];
1047
- }, ConfigFileNotFoundError | ConfigFileEmptyError | ConfigFileParseError | ConfigModuleLoadError | ConfigVersionError | ConfigSchemaValidationError | FunctionConfigError, _effect_platform_FileSystem.FileSystem | _effect_platform_Path.Path | RawConfigReader | SchemaValidator | V4ConfigParser>;
1184
+ }, ConfigFileNotFoundError | ConfigFileEmptyError | ConfigFileParseError | ConfigModuleLoadError | ConfigVersionError | ConfigSchemaValidationError | FunctionConfigError | ContainerConfigError, _effect_platform_FileSystem.FileSystem | _effect_platform_Path.Path | RawConfigReader | SchemaValidator | V4ConfigParser>;
1048
1185
  /**
1049
1186
  * Parses a config file at the given path, validates it against the appropriate
1050
1187
  * JSON Schema, converts it to a NormalizedConfig, and applies post-processing.
@@ -1052,7 +1189,7 @@ declare const parseConfigRaw: (filePath: string, projectFolder: string) => Effec
1052
1189
  * @param filePath - Absolute path to the config file
1053
1190
  * @param projectFolder - Absolute path to the project root
1054
1191
  */
1055
- declare const parseConfig: (filePath: string, projectFolder: string) => Effect.Effect<NormalizedConfig, ConfigFileNotFoundError | ConfigFileEmptyError | ConfigFileParseError | ConfigModuleLoadError | ConfigVersionError | ConfigSchemaValidationError | FunctionConfigError, _effect_platform_FileSystem.FileSystem | _effect_platform_Path.Path | RawConfigReader | SchemaValidator | V4ConfigParser | VercelBuildOutputParser>;
1192
+ declare const parseConfig: (filePath: string, projectFolder: string) => Effect.Effect<NormalizedConfig, ConfigFileNotFoundError | ConfigFileEmptyError | ConfigFileParseError | ConfigModuleLoadError | ConfigVersionError | ConfigSchemaValidationError | FunctionConfigError | ContainerConfigError, _effect_platform_FileSystem.FileSystem | _effect_platform_Path.Path | RawConfigReader | SchemaValidator | V4ConfigParser | VercelBuildOutputParser>;
1056
1193
  /**
1057
1194
  * Applies post-processing transformers to a NormalizedConfig:
1058
1195
  * - Vercel Build Output v3 (merges functions/routes from .vercel/output if present)
@@ -1149,6 +1286,75 @@ interface ConfigV4 extends Config {
1149
1286
  env?: Record<string, string>;
1150
1287
  /** Declares managed services to provision for the deployment environment. */
1151
1288
  services?: ConfigV4Services;
1289
+ /**
1290
+ * Container images to run, keyed by name. A container without `sidecar: true`
1291
+ * runs as a function that routes target with `destination: container:<name>`.
1292
+ * A sidecar runs next to every function instance and answers at `<name>:<port>`.
1293
+ * A name is 1 to 63 lowercase letters, digits, `-` or `_`, starts with a
1294
+ * letter (so it never reads as an IP address), and is not `localhost`.
1295
+ *
1296
+ * @example
1297
+ * ```yaml
1298
+ * containers:
1299
+ * web:
1300
+ * build: .
1301
+ * port: 3000
1302
+ * redis:
1303
+ * image: redis:7-alpine
1304
+ * sidecar: true
1305
+ * ```
1306
+ */
1307
+ containers?: Record<string, ConfigV4Container> | null;
1308
+ /**
1309
+ * Project-relative path of a Compose file whose services are imported as
1310
+ * `containers`. Entries in `containers` win over imported services of the
1311
+ * same name.
1312
+ */
1313
+ compose?: string | null;
1314
+ }
1315
+ /** One entry of the v4 `containers` map. Exactly one of `image` and `build` is required. */
1316
+ interface ConfigV4Container {
1317
+ /** Registry image reference, e.g. `redis:7-alpine` or `ghcr.io/acme/api:1.4`. */
1318
+ image?: string;
1319
+ /** Build context directory, or the full build settings, for a Dockerfile in the repository. */
1320
+ build?: string | ConfigV4ContainerBuild;
1321
+ /** Run next to every function instance instead of serving routes. Defaults to `false`. */
1322
+ sidecar?: boolean;
1323
+ /** TCP port the container listens on. Defaults to the image's first exposed port, then 8080. */
1324
+ port?: number;
1325
+ /** Replaces the image `ENTRYPOINT`. A string is split into words the way Compose splits it. */
1326
+ entrypoint?: string | string[];
1327
+ /** Replaces the image `CMD`. A string is split into words the way Compose splits it. */
1328
+ command?: string | string[];
1329
+ /** Environment variables baked into the container, merged over the image `ENV`. */
1330
+ env?: Record<string, string>;
1331
+ /** Replaces the image `WORKDIR`. Must be absolute. */
1332
+ working_dir?: string;
1333
+ /**
1334
+ * Replaces the image `USER`: a name, a uid, `name:group` or `uid:gid`. A bare
1335
+ * uid may be written as a number. Root is never used: a root image runs as a
1336
+ * dedicated non-root user.
1337
+ */
1338
+ user?: string | number;
1339
+ /** Memory in MB, a whole number from 128 to 3009. Defaults to 512 for a container function and 256 for a sidecar. */
1340
+ memory?: number;
1341
+ /** Maximum lifetime of one request, in seconds. Container functions only. */
1342
+ max_duration?: number;
1343
+ /** Stream responses. Defaults to `true`. Container functions only. */
1344
+ streaming?: boolean;
1345
+ /** Run on a timer, like a function `schedule`. Container functions only. */
1346
+ schedule?: string;
1347
+ }
1348
+ /** Dockerfile build settings for a container. */
1349
+ interface ConfigV4ContainerBuild {
1350
+ /** Project-relative build context. Defaults to `.`. */
1351
+ context?: string;
1352
+ /** Dockerfile path relative to the context. Defaults to `Dockerfile`. */
1353
+ dockerfile?: string;
1354
+ /** Build stage to stop at. */
1355
+ target?: string;
1356
+ /** Build arguments. */
1357
+ args?: Record<string, string>;
1152
1358
  }
1153
1359
  interface ConfigV4Service {
1154
1360
  }
@@ -1196,6 +1402,75 @@ interface ConfigV4Services {
1196
1402
  postgres?: ConfigV4ServicePostgres | null;
1197
1403
  /** Declarative File Storage buckets for the deployment environment. */
1198
1404
  storage?: ConfigV4ServiceStorage;
1405
+ /**
1406
+ * Queues for the deployment environment, keyed by name. `null` declares a
1407
+ * pull queue with default settings.
1408
+ *
1409
+ * @example
1410
+ * ```yaml
1411
+ * services:
1412
+ * queues:
1413
+ * emails:
1414
+ * consumer: /api/queues/emails
1415
+ * maxAttempts: 5
1416
+ * schedules:
1417
+ * daily-digest:
1418
+ * cron: '0 8 * * MON-FRI'
1419
+ * timezone: Europe/Berlin
1420
+ * body: { kind: digest }
1421
+ * jobs: null
1422
+ * ```
1423
+ */
1424
+ queues?: Record<string, ConfigV4Queue | null>;
1425
+ }
1426
+ /** A duration in seconds, or a string such as `30s`, `10m`, `1.5h` or `4d`. */
1427
+ type ConfigV4QueueDuration = number | `${number}${'s' | 'm' | 'h' | 'd'}`;
1428
+ /** Settings for a declaratively provisioned queue. Omitted settings keep the platform defaults. */
1429
+ interface ConfigV4Queue {
1430
+ /**
1431
+ * Deployment-relative path that receives each message as a signed POST, for
1432
+ * example `/api/queues/emails`. Omit it for a pull queue.
1433
+ */
1434
+ consumer?: string | null;
1435
+ /** How long a push delivery may run, or how long a received message stays leased. Defaults to 60 seconds. */
1436
+ visibilityTimeout?: ConfigV4QueueDuration;
1437
+ /** How long an undelivered message is kept. Defaults to 4 days, at most 14 days. */
1438
+ retention?: ConfigV4QueueDuration;
1439
+ /** Deliveries per message before it moves to the dead-letter list. Defaults to 10. */
1440
+ maxAttempts?: number;
1441
+ /** Exponential backoff between failed deliveries. Defaults to 5 seconds up to 15 minutes. */
1442
+ retryBackoff?: {
1443
+ min?: ConfigV4QueueDuration;
1444
+ max?: ConfigV4QueueDuration;
1445
+ };
1446
+ /** How long a deduplication key is remembered. Defaults to 24 hours. */
1447
+ deduplicationWindow?: ConfigV4QueueDuration;
1448
+ /** Most push deliveries in flight at once. Defaults to 100. */
1449
+ concurrency?: number | null;
1450
+ /** Most deliveries started per period. The period defaults to one second. */
1451
+ rateLimit?: {
1452
+ count: number;
1453
+ period?: ConfigV4QueueDuration;
1454
+ } | null;
1455
+ /** Keep messages that run out of attempts for inspection and redrive. Defaults to `true`. */
1456
+ deadLetter?: boolean;
1457
+ /** Cron schedules that send a message into this queue, keyed by schedule name. */
1458
+ schedules?: Record<string, ConfigV4QueueSchedule>;
1459
+ }
1460
+ /** A recurring send into a queue. */
1461
+ interface ConfigV4QueueSchedule {
1462
+ /** Five-field cron expression, or a macro such as `@hourly`. */
1463
+ cron: string;
1464
+ /** IANA time zone the expression is evaluated in. Defaults to `UTC`. */
1465
+ timezone?: string;
1466
+ /** Message body. Strings are sent as is; any other value is serialized as JSON. */
1467
+ body?: unknown;
1468
+ /** Content type of the body. Defaults to `text/plain` for a string body and `application/json` otherwise. */
1469
+ contentType?: string;
1470
+ /** Headers delivered with every message from this schedule. */
1471
+ headers?: Record<string, string>;
1472
+ /** Set to `false` to keep the schedule without sending. Defaults to `true`. */
1473
+ enabled?: boolean;
1199
1474
  }
1200
1475
  /** Declarative File Storage configuration for one deployment environment. */
1201
1476
  interface ConfigV4ServiceStorage extends ConfigV4Service {
@@ -1237,9 +1512,17 @@ interface ConfigV4FunctionSettings {
1237
1512
  */
1238
1513
  max_duration?: number;
1239
1514
  /**
1240
- * The runtime to use for the function.
1515
+ * The runtime to use for the function. `docker` builds the matched file as a
1516
+ * Dockerfile, with its directory as the build context, and runs the image as
1517
+ * the function. Routes target it by the Dockerfile's path, like any other
1518
+ * function file.
1519
+ */
1520
+ runtime?: Runtime | ContainerRuntime;
1521
+ /**
1522
+ * TCP port the image listens on. Only for `runtime: docker`. Defaults to the
1523
+ * image's first exposed port, then 8080.
1241
1524
  */
1242
- runtime?: Runtime;
1525
+ port?: number;
1243
1526
  /**
1244
1527
  * Enable function response streaming. When omitted, Node and Bun runtimes stream by default.
1245
1528
  */
@@ -1267,6 +1550,98 @@ interface ConfigV4FunctionSettings {
1267
1550
  schedule?: string;
1268
1551
  }
1269
1552
 
1553
+ /** Compose file names, in the order `docker compose` looks for them. */
1554
+ declare const COMPOSE_FILE_NAMES: readonly ["compose.yaml", "compose.yml", "docker-compose.yaml", "docker-compose.yml"];
1555
+ /**
1556
+ * Returns the synthetic entrypoint path of a container function, which routes
1557
+ * use as their `destination`.
1558
+ *
1559
+ * @example
1560
+ * ```ts
1561
+ * containerEntrypointPath('web'); // 'container:web'
1562
+ * ```
1563
+ */
1564
+ declare const containerEntrypointPath: (name: string) => string;
1565
+ /**
1566
+ * Derives the container name of a `functions` entry that runs a Dockerfile
1567
+ * (`runtime: docker`): the directory the Dockerfile sits in, plus any suffix
1568
+ * or prefix around `Dockerfile` in its file name. A root `Dockerfile` is `app`,
1569
+ * and a name that would not start with a letter gets an `app-` prefix.
1570
+ *
1571
+ * @param file - Project-relative path of the Dockerfile
1572
+ * @returns A valid container name
1573
+ * @example
1574
+ * ```ts
1575
+ * dockerFunctionContainerName('Dockerfile'); // 'app'
1576
+ * dockerFunctionContainerName('services/api/Dockerfile'); // 'api'
1577
+ * dockerFunctionContainerName('docker/worker.Dockerfile'); // 'docker-worker'
1578
+ * dockerFunctionContainerName('services/1/Dockerfile'); // 'app-1'
1579
+ * ```
1580
+ */
1581
+ declare const dockerFunctionContainerName: (file: string) => string;
1582
+ /**
1583
+ * Splits a command string into words the way Compose does: whitespace
1584
+ * separates words, single and double quotes group them, and a backslash
1585
+ * escapes the next character outside single quotes. No shell runs.
1586
+ *
1587
+ * @param input - Command as written, e.g. `redis-server --save ""`
1588
+ * @returns The argv words
1589
+ * @throws Error when a quote is left open
1590
+ * @example
1591
+ * ```ts
1592
+ * splitCommandWords('sh -c "echo hi"'); // ['sh', '-c', 'echo hi']
1593
+ * ```
1594
+ */
1595
+ declare const splitCommandWords: (input: string) => string[];
1596
+ /**
1597
+ * Turns the `containers` map into container-function entrypoints and sidecars.
1598
+ *
1599
+ * Validates names, the bounds the v4 schema sets (so Compose-imported entries
1600
+ * fail as early as written ones), the sidecar count, and explicitly declared
1601
+ * ports that would collide inside one microVM. Ports an image only exposes are
1602
+ * checked later, once the image config is known.
1603
+ *
1604
+ * @param containers - The `containers` map, after any Compose import
1605
+ * @param projectFolder - Absolute path to the project root
1606
+ */
1607
+ declare const normalizeContainers: (containers: Readonly<Record<string, ConfigV4Container>>, projectFolder: string) => Effect.Effect<{
1608
+ entrypoints: NormalizedConfigEntrypoint[];
1609
+ sidecars: NormalizedSidecar[];
1610
+ warnings: string[];
1611
+ }, ContainerConfigError, FileSystem.FileSystem | Path.Path>;
1612
+ /**
1613
+ * Tells whether a Compose file names an application to deploy: a service
1614
+ * marked `x-gigadrive: { public: true }`, or one that builds from source.
1615
+ * Auto-detection skips a Compose file without one, such as one that only runs
1616
+ * a database for local development.
1617
+ *
1618
+ * @param composePath - Project-relative path of the Compose file
1619
+ * @param projectFolder - Absolute path to the project root
1620
+ */
1621
+ declare const composeDeclaresApp: (composePath: string, projectFolder: string) => Effect.Effect<boolean, ContainerConfigError, FileSystem.FileSystem | Path.Path>;
1622
+ /**
1623
+ * Reads a Compose file and maps its services onto `containers` entries.
1624
+ *
1625
+ * The container function is the service marked `x-gigadrive: { public: true }`,
1626
+ * or else the only service that builds from source; anything else is
1627
+ * ambiguous and fails. Every other service becomes a sidecar that the function
1628
+ * reaches by its service name, the way Compose's default network resolves it.
1629
+ * Services behind a profile are skipped, as `docker compose up` skips them.
1630
+ * Volumes, networks, health checks and restart policies have no equivalent and
1631
+ * are dropped; volumes, `extends` and override files are reported.
1632
+ *
1633
+ * Every file read (the Compose file, `.env`, `env_file`) must resolve inside
1634
+ * the project after following symbolic links.
1635
+ *
1636
+ * @param composePath - Project-relative path of the Compose file
1637
+ * @param projectFolder - Absolute path to the project root
1638
+ */
1639
+ declare const readComposeContainers: (composePath: string, projectFolder: string) => Effect.Effect<{
1640
+ containers: Record<string, ConfigV4Container>;
1641
+ publicService: string;
1642
+ warnings: string[];
1643
+ }, ContainerConfigError, FileSystem.FileSystem | Path.Path>;
1644
+
1270
1645
  /**
1271
1646
  * Identity helper providing type inference and checking for `gigadrive.ts`
1272
1647
  * config files. Using it is optional — a plain object default export works the
@@ -1297,6 +1672,36 @@ interface ConfigV4FunctionSettings {
1297
1672
  */
1298
1673
  declare const defineConfig: (config: ConfigV4) => ConfigV4;
1299
1674
 
1675
+ /** How a container project was recognized. */
1676
+ interface ContainerProjectDetection {
1677
+ /** `compose` for a Compose file, `dockerfile` for a lone root `Dockerfile`. */
1678
+ kind: 'compose' | 'dockerfile';
1679
+ /** Project-relative file the configuration came from. */
1680
+ file: string;
1681
+ /** Deployable configuration: one container function behind a catch-all route, plus any sidecars. */
1682
+ config: NormalizedConfig;
1683
+ }
1684
+ /**
1685
+ * Recognizes a project that ships as container images: a Compose file first,
1686
+ * then a `Dockerfile` at the project root.
1687
+ *
1688
+ * Callers try this only after finding neither a `gigadrive.yaml` nor a
1689
+ * framework. A framework project often carries a Compose file for local
1690
+ * databases, and deploying that file instead of the framework would change
1691
+ * what an existing project deploys. For the same reason a Compose file counts
1692
+ * only when it names an application: a service that builds from source or is
1693
+ * marked `x-gigadrive: { public: true }`. One that only runs, say, a database
1694
+ * for local development is ignored, and the root `Dockerfile` check follows.
1695
+ *
1696
+ * @param projectFolder - Absolute path to the project root
1697
+ * @returns The detection, or `undefined` when the project has neither file
1698
+ */
1699
+ declare const detectContainerProject: (projectFolder: string) => Effect.Effect<{
1700
+ kind: "dockerfile" | "compose";
1701
+ file: string;
1702
+ config: NormalizedConfig;
1703
+ } | undefined, ContainerConfigError, FileSystem.FileSystem | Path.Path>;
1704
+
1300
1705
  declare const ManifestNotFoundError_base: Schema.TaggedErrorClass<ManifestNotFoundError, "ManifestNotFoundError", {
1301
1706
  readonly _tag: Schema.tag<"ManifestNotFoundError">;
1302
1707
  } & {
@@ -1399,6 +1804,8 @@ interface FrameworkDefaultConfig {
1399
1804
  filePathMap?: Record<string, string>;
1400
1805
  includeFiles?: string[];
1401
1806
  excludeFiles?: string[];
1807
+ /** Project-relative directories the function may write to at runtime. */
1808
+ writablePaths?: string[];
1402
1809
  };
1403
1810
  /** Advanced framework output that replaces the one-entrypoint defaults. */
1404
1811
  normalizedConfig?: Partial<NormalizedConfig>;
@@ -1459,13 +1866,18 @@ declare const generateConfig: (framework: FrameworkDefinition, packageManager: P
1459
1866
  * User config always takes precedence; framework defaults fill gaps.
1460
1867
  *
1461
1868
  * - commands: use user's if non-empty, otherwise framework's
1462
- * - entrypoints: use user's if non-empty, otherwise framework's
1463
- * - routes: use user's if non-empty, otherwise framework's
1869
+ * - entrypoints: use user's if non-empty, otherwise framework's. Container
1870
+ * functions (`runtime: docker`) do not count: they are always kept, next to
1871
+ * whichever file functions win, because a framework never declares them.
1872
+ * - routes: use user's if any of them targets something other than a container
1873
+ * function, otherwise the framework's, preceded by the user's routes to
1874
+ * container functions so that e.g. `/api/*` wins over a framework catch-all.
1464
1875
  * - assets: use user's if it declares any sources, otherwise framework's
1465
1876
  * - excludeFiles: use user's if non-empty, otherwise framework's
1466
1877
  * - regions: always use user's (always populated from parsing)
1467
1878
  * - environmentVariables: deep merge (framework base, user overrides)
1468
1879
  * - services: always use user's (frameworks don't define services)
1880
+ * - sidecars: always use user's (frameworks don't define sidecars)
1469
1881
  * - warnings/errors: concatenate both
1470
1882
  *
1471
1883
  * @param userConfig - The config parsed from the user's config file
@@ -1499,4 +1911,4 @@ declare const filterFunctionsFromAssets: (config: NormalizedConfig) => Normalize
1499
1911
 
1500
1912
  declare const NetworkConfigLive: Layer.Layer<ConfigModuleLoader | RawConfigReader | SchemaValidator | V4ConfigParser | VercelBuildOutputParser, never, _effect_platform_FileSystem.FileSystem | _effect_platform_Path.Path>;
1501
1913
 
1502
- export { ALLOWED_CONFIG_NAMES, AVAILABLE_REGIONS, AVAILABLE_RUNTIMES, type Config, ConfigFileEmptyError, ConfigFileNotFoundError, ConfigFileParseError, ConfigModuleLoadError, ConfigModuleLoader, ConfigSchemaValidationError, type ConfigV4, type ConfigV4FunctionSettings, type ConfigV4Service, type ConfigV4ServicePostgres, type ConfigV4ServiceRedis, type ConfigV4ServiceStorage, type ConfigV4Services, type ConfigV4StorageBucket, ConfigVersionError, DEFAULT_FUNCTION_DURATION_SECONDS, type DetectionResult, FRAMEWORK_DEFINITIONS, type FilePathMap, type FrameworkDefaultConfig, type FrameworkDefinition, type FrameworkDetectionItem, type FrameworkLanguage, FrameworkNotDetectedError, FunctionConfigError, type GigadriveNextBuildManifest, GigadriveNextBuildManifestSchema, type GigadriveNextBuildManifestV1, GigadriveNextBuildManifestV1Schema, type GigadriveNextBuildManifestV2, type GigadriveNextBuildManifestV2Export, GigadriveNextBuildManifestV2ExportSchema, type GigadriveNextBuildManifestV2Standalone, GigadriveNextBuildManifestV2StandaloneSchema, type GigadriveNextMiddlewareDescriptor, GigadriveNextMiddlewareDescriptorSchema, type GigadriveNextMiddlewareMatcher, GigadriveNextMiddlewareMatcherSchema, type GigadriveNextPrerenderManifestV1, GigadriveNextPrerenderManifestV1Schema, type GigadriveNextPrerenderOutput, GigadriveNextPrerenderOutputSchema, type GigadriveNextPrerenderSeedMethods, GigadriveNextPrerenderSeedMethodsSchema, type GigadriveNextRouteCondition, GigadriveNextRouteConditionSchema, type GigadriveNextServerDescriptor, GigadriveNextServerDescriptorSchema, type GigadriveNextStaticAssetPrefix, GigadriveNextStaticAssetPrefixSchema, type JsonValue, MAX_FUNCTION_DURATION_SECONDS, ManifestNotFoundError, ManifestParseError, ManifestReadError, type NeonAWSRegion, NetworkConfigLive, type NormalizedConfig, type NormalizedConfigEntrypoint, type NormalizedConfigRoute, type NormalizedConfigRouteHandler, type NormalizedConfigRouteMatchRequirements, type NormalizedConfigRouteMethod, type NormalizedConfigService, type NormalizedConfigServiceDefinition, type NormalizedConfigServicePostgres, type NormalizedConfigServiceRedis, type NormalizedConfigServiceStorage, type NormalizedConfigServiceType, type NormalizedConfigStorageBucket, type NormalizedFramework, type NormalizedImageFit, type NormalizedImageFormat, type NormalizedImageLocalPattern, type NormalizedImagePolicy, type NormalizedImageRemotePattern, type NormalizedImageVariant, type NormalizedNextjsFramework, type NormalizedSharedArtifact, type PackageManager, RawConfigReader, type Region, type Runtime, SchemaValidator, type StaticAssetHeaders, StaticAssetHeadersSchema, type StaticAssetManifest, type StaticAssetManifestEntry, StaticAssetManifestEntrySchema, type StaticAssetManifestV1, StaticAssetManifestV1Schema, type UpstashAWSRegion, V4ConfigParser, VercelBuildOutputParser, collectAssetFiles, defineConfig, detectFramework, detectPackageManager, filterFunctionsFromAssets, generateConfig, getFunctionSettings, mergeWithFrameworkDefaults, parseConfig, parseConfigRaw, parseGigadriveNextBuildManifest, parseGigadriveNextPrerenderManifest, parseStaticAssetManifest, postProcessConfig, readDependencies };
1914
+ export { ALLOWED_CONFIG_NAMES, AVAILABLE_REGIONS, AVAILABLE_RUNTIMES, COMPOSE_FILE_NAMES, CONTAINER_ENTRYPOINT_PREFIX, CONTAINER_RUNTIME, type Config, ConfigFileEmptyError, ConfigFileNotFoundError, ConfigFileParseError, ConfigModuleLoadError, ConfigModuleLoader, ConfigSchemaValidationError, type ConfigV4, type ConfigV4Container, type ConfigV4ContainerBuild, type ConfigV4FunctionSettings, type ConfigV4Queue, type ConfigV4QueueDuration, type ConfigV4QueueSchedule, type ConfigV4Service, type ConfigV4ServicePostgres, type ConfigV4ServiceRedis, type ConfigV4ServiceStorage, type ConfigV4Services, type ConfigV4StorageBucket, ConfigVersionError, ContainerConfigError, type ContainerProjectDetection, type ContainerRuntime, DEFAULT_CONTAINER_MEMORY_MB, DEFAULT_FUNCTION_DURATION_SECONDS, DEFAULT_SIDECAR_MEMORY_MB, type DetectionResult, FRAMEWORK_DEFINITIONS, type FilePathMap, type FrameworkDefaultConfig, type FrameworkDefinition, type FrameworkDetectionItem, type FrameworkLanguage, FrameworkNotDetectedError, FunctionConfigError, type GigadriveNextBuildManifest, GigadriveNextBuildManifestSchema, type GigadriveNextBuildManifestV1, GigadriveNextBuildManifestV1Schema, type GigadriveNextBuildManifestV2, type GigadriveNextBuildManifestV2Export, GigadriveNextBuildManifestV2ExportSchema, type GigadriveNextBuildManifestV2Standalone, GigadriveNextBuildManifestV2StandaloneSchema, type GigadriveNextMiddlewareDescriptor, GigadriveNextMiddlewareDescriptorSchema, type GigadriveNextMiddlewareMatcher, GigadriveNextMiddlewareMatcherSchema, type GigadriveNextPrerenderManifestV1, GigadriveNextPrerenderManifestV1Schema, type GigadriveNextPrerenderOutput, GigadriveNextPrerenderOutputSchema, type GigadriveNextPrerenderSeedMethods, GigadriveNextPrerenderSeedMethodsSchema, type GigadriveNextRouteCondition, GigadriveNextRouteConditionSchema, type GigadriveNextServerDescriptor, GigadriveNextServerDescriptorSchema, type GigadriveNextStaticAssetPrefix, GigadriveNextStaticAssetPrefixSchema, type JsonValue, MAX_FUNCTION_DURATION_SECONDS, MAX_SIDECARS, ManifestNotFoundError, ManifestParseError, ManifestReadError, type NeonAWSRegion, NetworkConfigLive, type NormalizedConfig, type NormalizedConfigEntrypoint, type NormalizedConfigQueue, type NormalizedConfigQueueSchedule, type NormalizedConfigRoute, type NormalizedConfigRouteHandler, type NormalizedConfigRouteMatchRequirements, type NormalizedConfigRouteMethod, type NormalizedConfigService, type NormalizedConfigServiceDefinition, type NormalizedConfigServicePostgres, type NormalizedConfigServiceQueues, type NormalizedConfigServiceRedis, type NormalizedConfigServiceStorage, type NormalizedConfigServiceType, type NormalizedConfigStorageBucket, type NormalizedContainerImageSource, type NormalizedContainerSpec, type NormalizedFramework, type NormalizedImageFit, type NormalizedImageFormat, type NormalizedImageLocalPattern, type NormalizedImagePolicy, type NormalizedImageRemotePattern, type NormalizedImageVariant, type NormalizedNextjsFramework, type NormalizedSharedArtifact, type NormalizedSidecar, type PackageManager, RawConfigReader, type Region, type Runtime, SchemaValidator, type StaticAssetHeaders, StaticAssetHeadersSchema, type StaticAssetManifest, type StaticAssetManifestEntry, StaticAssetManifestEntrySchema, type StaticAssetManifestV1, StaticAssetManifestV1Schema, type UpstashAWSRegion, V4ConfigParser, VercelBuildOutputParser, collectAssetFiles, composeDeclaresApp, containerEntrypointPath, defineConfig, detectContainerProject, detectFramework, detectPackageManager, dockerFunctionContainerName, filterFunctionsFromAssets, generateConfig, getFunctionSettings, mergeWithFrameworkDefaults, normalizeContainers, parseConfig, parseConfigRaw, parseGigadriveNextBuildManifest, parseGigadriveNextPrerenderManifest, parseStaticAssetManifest, postProcessConfig, readComposeContainers, readDependencies, splitCommandWords };