@gigadrive/network-config 4.5.0 → 4.6.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/define-config.d.mts +304 -0
- package/dist/define-config.d.ts +304 -0
- package/dist/define-config.js +31 -0
- package/dist/define-config.js.map +1 -0
- package/dist/define-config.mjs +6 -0
- package/dist/define-config.mjs.map +1 -0
- package/dist/index.d.mts +365 -316
- package/dist/index.d.ts +365 -316
- package/dist/index.js +153 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -59
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs-adapter.js +22 -1
- package/dist/nextjs-adapter.js.map +1 -1
- package/dist/nextjs-adapter.mjs +22 -1
- package/dist/nextjs-adapter.mjs.map +1 -1
- package/package.json +8 -2
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
interface NormalizedImageLocalPattern {
|
|
2
|
+
pathname?: string;
|
|
3
|
+
search?: string;
|
|
4
|
+
}
|
|
5
|
+
interface NormalizedImageRemotePattern extends NormalizedImageLocalPattern {
|
|
6
|
+
protocol?: 'http' | 'https';
|
|
7
|
+
hostname: string;
|
|
8
|
+
port?: string;
|
|
9
|
+
}
|
|
10
|
+
type NormalizedImageFormat = 'image/avif' | 'image/webp' | 'image/jpeg' | 'image/png';
|
|
11
|
+
type NormalizedImageFit = 'contain' | 'cover' | 'fill' | 'inside' | 'outside';
|
|
12
|
+
interface NormalizedImageVariant {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
quality?: number;
|
|
16
|
+
format?: NormalizedImageFormat;
|
|
17
|
+
fit?: NormalizedImageFit;
|
|
18
|
+
}
|
|
19
|
+
interface NormalizedImagePolicy {
|
|
20
|
+
localPatterns: NormalizedImageLocalPattern[];
|
|
21
|
+
remotePatterns: NormalizedImageRemotePattern[];
|
|
22
|
+
widths: number[];
|
|
23
|
+
heights: number[];
|
|
24
|
+
qualities: number[];
|
|
25
|
+
formats: NormalizedImageFormat[];
|
|
26
|
+
minimumCacheTTL: number;
|
|
27
|
+
dangerouslyAllowSVG: boolean;
|
|
28
|
+
contentSecurityPolicy: string;
|
|
29
|
+
contentDispositionType: 'inline' | 'attachment';
|
|
30
|
+
maximumRedirects: number;
|
|
31
|
+
maximumResponseBody: number;
|
|
32
|
+
variants: Record<string, NormalizedImageVariant>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare const RUNTIME_DEFINITIONS: readonly ["php-84", "php-83", "php-81", "node-22", "node-20", "node-18", "node-16", "bun-1"];
|
|
36
|
+
type Runtime = (typeof RUNTIME_DEFINITIONS)[number];
|
|
37
|
+
|
|
38
|
+
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';
|
|
39
|
+
type NeonAWSRegion = 'us-east-1' | 'us-east-2' | 'us-west-2' | 'ap-southeast-1' | 'ap-southeast-2' | 'eu-central-1' | 'eu-west-2' | 'sa-east-1';
|
|
40
|
+
type NormalizedConfigRouteMethod = 'ANY' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
41
|
+
type NormalizedConfigRouteMatchRequirements = [] | [
|
|
42
|
+
{
|
|
43
|
+
/**
|
|
44
|
+
* The type of request element to check
|
|
45
|
+
*/
|
|
46
|
+
type: 'host';
|
|
47
|
+
/**
|
|
48
|
+
* A regular expression used to match the value. Named groups can be used in the destination
|
|
49
|
+
*/
|
|
50
|
+
value: string;
|
|
51
|
+
} | {
|
|
52
|
+
/**
|
|
53
|
+
* The type of request element to check
|
|
54
|
+
*/
|
|
55
|
+
type: 'header' | 'cookie' | 'query';
|
|
56
|
+
/**
|
|
57
|
+
* The name of the element contained in the particular type
|
|
58
|
+
*/
|
|
59
|
+
key: string;
|
|
60
|
+
/**
|
|
61
|
+
* A regular expression used to match the value. Named groups can be used in the destination
|
|
62
|
+
*/
|
|
63
|
+
value?: string;
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
interface Config {
|
|
68
|
+
version: number;
|
|
69
|
+
env?: Record<string, string>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface ConfigV4 extends Config {
|
|
73
|
+
version: 4;
|
|
74
|
+
/**
|
|
75
|
+
* A list of presets to apply to the project. Each preset will be applied in order.
|
|
76
|
+
*/
|
|
77
|
+
presets?: string[] | null;
|
|
78
|
+
/**
|
|
79
|
+
* The folder which holds the assets to be deployed to the edge. Defaults to none.
|
|
80
|
+
*/
|
|
81
|
+
assets?: string | null;
|
|
82
|
+
/**
|
|
83
|
+
* If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false.
|
|
84
|
+
*/
|
|
85
|
+
populateAssetCache?: boolean | null;
|
|
86
|
+
/** Managed image optimization policy for this deployment. */
|
|
87
|
+
images?: Partial<NormalizedImagePolicy> | null;
|
|
88
|
+
/**
|
|
89
|
+
* The regions to which the project will be deployed. Use "global" to deploy to all regions. More regions will incur higher costs.
|
|
90
|
+
*/
|
|
91
|
+
regions?: string[] | null;
|
|
92
|
+
/**
|
|
93
|
+
* The commands to run to build the project. For example, `bun install` or `npm install`.
|
|
94
|
+
*/
|
|
95
|
+
build_commands?: string[] | null;
|
|
96
|
+
/**
|
|
97
|
+
* The serverless functions to deploy.
|
|
98
|
+
*/
|
|
99
|
+
functions?: {
|
|
100
|
+
/**
|
|
101
|
+
* The pattern to match the file path of the function. May be a glob pattern or a regular expression.
|
|
102
|
+
*/
|
|
103
|
+
[pattern: string]: ConfigV4FunctionSettings;
|
|
104
|
+
} | null;
|
|
105
|
+
/**
|
|
106
|
+
* A list of route definitions.
|
|
107
|
+
*
|
|
108
|
+
* @maxItems 1024
|
|
109
|
+
*/
|
|
110
|
+
routes?: {
|
|
111
|
+
/**
|
|
112
|
+
* A pattern that matches each incoming pathname (excluding querystring).
|
|
113
|
+
*/
|
|
114
|
+
source: string;
|
|
115
|
+
/**
|
|
116
|
+
* An absolute pathname to an existing resource or an external URL.
|
|
117
|
+
*/
|
|
118
|
+
destination: string;
|
|
119
|
+
/**
|
|
120
|
+
* An array of requirements that are needed to match
|
|
121
|
+
*
|
|
122
|
+
* @maxItems 16
|
|
123
|
+
*/
|
|
124
|
+
has?: NormalizedConfigRouteMatchRequirements;
|
|
125
|
+
/**
|
|
126
|
+
* An array of requirements that are needed to match
|
|
127
|
+
*
|
|
128
|
+
* @maxItems 16
|
|
129
|
+
*/
|
|
130
|
+
missing?: NormalizedConfigRouteMatchRequirements;
|
|
131
|
+
/**
|
|
132
|
+
* An optional integer to override the status code of the response.
|
|
133
|
+
*/
|
|
134
|
+
statusCode?: number;
|
|
135
|
+
/**
|
|
136
|
+
* An optional boolean to force a redirect response.
|
|
137
|
+
*/
|
|
138
|
+
redirect?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* The HTTP methods to match for the route. Defaults to all methods.
|
|
141
|
+
*/
|
|
142
|
+
methods?: NormalizedConfigRouteMethod[];
|
|
143
|
+
/**
|
|
144
|
+
* Additional headers to add to the response.
|
|
145
|
+
*/
|
|
146
|
+
headers?: {
|
|
147
|
+
[k: string]: string;
|
|
148
|
+
};
|
|
149
|
+
}[] | null;
|
|
150
|
+
/**
|
|
151
|
+
* Additional environment variables to set during runtime and build.
|
|
152
|
+
*/
|
|
153
|
+
env?: Record<string, string>;
|
|
154
|
+
/** Declares managed services to provision for the deployment environment. */
|
|
155
|
+
services?: ConfigV4Services;
|
|
156
|
+
}
|
|
157
|
+
interface ConfigV4Service {
|
|
158
|
+
}
|
|
159
|
+
interface ConfigV4ServiceRedis extends ConfigV4Service {
|
|
160
|
+
/**
|
|
161
|
+
* Optionally, specify what environment variables the credentials will be bound to.
|
|
162
|
+
* For example: `{ url: 'REDIS_URL' }` will bind the `url` environment variable to the Redis URL.
|
|
163
|
+
* If you don't specify any bindings, they will be bound to the REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_DB, and REDIS_SSL environment variables.
|
|
164
|
+
*/
|
|
165
|
+
envBindings?: Record<'url' | 'host' | 'port' | 'password' | 'db' | 'ssl', string>;
|
|
166
|
+
/**
|
|
167
|
+
* The primary region to deploy the Redis instance to.
|
|
168
|
+
*/
|
|
169
|
+
primaryRegion?: UpstashAWSRegion | 'us-central1';
|
|
170
|
+
/**
|
|
171
|
+
* Optionally, add additional regions to read from. More regions will incur higher costs.
|
|
172
|
+
*/
|
|
173
|
+
readRegions?: UpstashAWSRegion[];
|
|
174
|
+
/**
|
|
175
|
+
* Optionally, enable Redis eviction. This will evict the least recently used keys in order to make space for new ones.
|
|
176
|
+
*/
|
|
177
|
+
eviction?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface ConfigV4ServicePostgres extends ConfigV4Service {
|
|
180
|
+
/**
|
|
181
|
+
* Optionally, specify what environment variables the credentials will be bound to.
|
|
182
|
+
* For example: `{ url: 'POSTGRES_URL' }` will bind the `url` environment variable to the Postgres URL.
|
|
183
|
+
* If you don't specify any bindings, they will be bound to the POSTGRES_URL, POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DATABASE environment variables.
|
|
184
|
+
*/
|
|
185
|
+
envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;
|
|
186
|
+
/**
|
|
187
|
+
* The version of Postgres to deploy.
|
|
188
|
+
*/
|
|
189
|
+
postgresVersion?: '17' | '16' | '15' | '14';
|
|
190
|
+
/**
|
|
191
|
+
* The region to deploy the Postgres instance to.
|
|
192
|
+
*/
|
|
193
|
+
region?: NeonAWSRegion;
|
|
194
|
+
}
|
|
195
|
+
/** Managed services accepted under the v4 `services` key. */
|
|
196
|
+
interface ConfigV4Services {
|
|
197
|
+
/** Managed Redis configuration. `null` selects provider defaults. */
|
|
198
|
+
redis?: ConfigV4ServiceRedis | null;
|
|
199
|
+
/** Managed Postgres configuration. `null` selects provider defaults. */
|
|
200
|
+
postgres?: ConfigV4ServicePostgres | null;
|
|
201
|
+
/** Declarative File Storage buckets for the deployment environment. */
|
|
202
|
+
storage?: ConfigV4ServiceStorage;
|
|
203
|
+
}
|
|
204
|
+
/** Declarative File Storage configuration for one deployment environment. */
|
|
205
|
+
interface ConfigV4ServiceStorage extends ConfigV4Service {
|
|
206
|
+
/**
|
|
207
|
+
* Buckets keyed by their immutable environment-scoped name.
|
|
208
|
+
*
|
|
209
|
+
* Use `null` or an empty object to accept the default private visibility.
|
|
210
|
+
* Names are validated exactly and are never normalized. The environment and
|
|
211
|
+
* global CDN/S3 slug are intentionally not configurable here.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```yaml
|
|
215
|
+
* services:
|
|
216
|
+
* storage:
|
|
217
|
+
* buckets:
|
|
218
|
+
* assets:
|
|
219
|
+
* visibility: public
|
|
220
|
+
* uploads: null
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
buckets: Record<string, ConfigV4StorageBucket | null>;
|
|
224
|
+
}
|
|
225
|
+
/** Optional settings for a declaratively provisioned File Storage bucket. */
|
|
226
|
+
interface ConfigV4StorageBucket {
|
|
227
|
+
/** Access policy applied when the bucket is first provisioned. Defaults to `private`. */
|
|
228
|
+
visibility?: 'public' | 'private';
|
|
229
|
+
}
|
|
230
|
+
interface ConfigV4FunctionSettings {
|
|
231
|
+
/**
|
|
232
|
+
* The memory limit for the function in MB.
|
|
233
|
+
*/
|
|
234
|
+
memory?: number;
|
|
235
|
+
/**
|
|
236
|
+
* Maximum lifetime of one HTTP request, response stream, or WebSocket connection, in seconds.
|
|
237
|
+
* Defaults to 30 seconds and may not be higher than eight hours (28,800 seconds).
|
|
238
|
+
*
|
|
239
|
+
* This is an invocation limit. It does not control how long the platform retains or reuses the
|
|
240
|
+
* underlying execution environment after the invocation finishes.
|
|
241
|
+
*/
|
|
242
|
+
max_duration?: number;
|
|
243
|
+
/**
|
|
244
|
+
* The runtime to use for the function.
|
|
245
|
+
*/
|
|
246
|
+
runtime?: Runtime;
|
|
247
|
+
/**
|
|
248
|
+
* Enable function response streaming. When omitted, Node and Bun runtimes stream by default.
|
|
249
|
+
*/
|
|
250
|
+
streaming?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Use to create symlinks on the final function. This is useful for applications that require use of the file system, since serverless functions are ephemeral and have read-only file systems, except for /tmp.
|
|
253
|
+
*/
|
|
254
|
+
symlinks?: {
|
|
255
|
+
/**
|
|
256
|
+
* Left side is where the symlink will be created, right side is the target path.
|
|
257
|
+
*/
|
|
258
|
+
[path: string]: string;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* A glob pattern to match files that should be excluded from your Serverless Function. If you’re using a Community Runtime, the behavior might vary.
|
|
262
|
+
*/
|
|
263
|
+
excludeFiles?: string | string[];
|
|
264
|
+
/**
|
|
265
|
+
* A glob pattern to match files that should be included in your Serverless Function. If you’re using a Community Runtime, the behavior might vary.
|
|
266
|
+
*/
|
|
267
|
+
includeFiles?: string | string[];
|
|
268
|
+
/**
|
|
269
|
+
* Optionally, provide a schedule to run the function on periodically. Examples: `rate(1 hour)`, `rate(1 day)`, `cron(0 12 * * *)`.
|
|
270
|
+
*/
|
|
271
|
+
schedule?: string;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Identity helper providing type inference and checking for `gigadrive.ts`
|
|
276
|
+
* config files. Using it is optional — a plain object default export works the
|
|
277
|
+
* same, but `defineConfig` gives editor autocompletion without a type
|
|
278
|
+
* annotation. Requires `@gigadrive/network-config` to be installed in the
|
|
279
|
+
* project (e.g. as a devDependency).
|
|
280
|
+
*
|
|
281
|
+
* Prefer importing from the `@gigadrive/network-config/define-config` subpath:
|
|
282
|
+
* it is dependency-free, whereas the package root eagerly imports peer
|
|
283
|
+
* dependencies (`effect`, `@effect/platform`) that package managers which do
|
|
284
|
+
* not auto-install peers (e.g. Yarn) will not have installed.
|
|
285
|
+
*
|
|
286
|
+
* Note that a `gigadrive.ts` config is executed as code when the config is
|
|
287
|
+
* read — the same trust model as `build_commands`.
|
|
288
|
+
*
|
|
289
|
+
* @param config - The deployment configuration
|
|
290
|
+
* @returns The configuration, unchanged
|
|
291
|
+
* @example
|
|
292
|
+
* ```ts
|
|
293
|
+
* // gigadrive.ts
|
|
294
|
+
* import { defineConfig } from '@gigadrive/network-config/define-config';
|
|
295
|
+
*
|
|
296
|
+
* export default defineConfig({
|
|
297
|
+
* version: 4,
|
|
298
|
+
* regions: ['eu-central-1'],
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
declare const defineConfig: (config: ConfigV4) => ConfigV4;
|
|
303
|
+
|
|
304
|
+
export { defineConfig };
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
interface NormalizedImageLocalPattern {
|
|
2
|
+
pathname?: string;
|
|
3
|
+
search?: string;
|
|
4
|
+
}
|
|
5
|
+
interface NormalizedImageRemotePattern extends NormalizedImageLocalPattern {
|
|
6
|
+
protocol?: 'http' | 'https';
|
|
7
|
+
hostname: string;
|
|
8
|
+
port?: string;
|
|
9
|
+
}
|
|
10
|
+
type NormalizedImageFormat = 'image/avif' | 'image/webp' | 'image/jpeg' | 'image/png';
|
|
11
|
+
type NormalizedImageFit = 'contain' | 'cover' | 'fill' | 'inside' | 'outside';
|
|
12
|
+
interface NormalizedImageVariant {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
quality?: number;
|
|
16
|
+
format?: NormalizedImageFormat;
|
|
17
|
+
fit?: NormalizedImageFit;
|
|
18
|
+
}
|
|
19
|
+
interface NormalizedImagePolicy {
|
|
20
|
+
localPatterns: NormalizedImageLocalPattern[];
|
|
21
|
+
remotePatterns: NormalizedImageRemotePattern[];
|
|
22
|
+
widths: number[];
|
|
23
|
+
heights: number[];
|
|
24
|
+
qualities: number[];
|
|
25
|
+
formats: NormalizedImageFormat[];
|
|
26
|
+
minimumCacheTTL: number;
|
|
27
|
+
dangerouslyAllowSVG: boolean;
|
|
28
|
+
contentSecurityPolicy: string;
|
|
29
|
+
contentDispositionType: 'inline' | 'attachment';
|
|
30
|
+
maximumRedirects: number;
|
|
31
|
+
maximumResponseBody: number;
|
|
32
|
+
variants: Record<string, NormalizedImageVariant>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare const RUNTIME_DEFINITIONS: readonly ["php-84", "php-83", "php-81", "node-22", "node-20", "node-18", "node-16", "bun-1"];
|
|
36
|
+
type Runtime = (typeof RUNTIME_DEFINITIONS)[number];
|
|
37
|
+
|
|
38
|
+
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';
|
|
39
|
+
type NeonAWSRegion = 'us-east-1' | 'us-east-2' | 'us-west-2' | 'ap-southeast-1' | 'ap-southeast-2' | 'eu-central-1' | 'eu-west-2' | 'sa-east-1';
|
|
40
|
+
type NormalizedConfigRouteMethod = 'ANY' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
41
|
+
type NormalizedConfigRouteMatchRequirements = [] | [
|
|
42
|
+
{
|
|
43
|
+
/**
|
|
44
|
+
* The type of request element to check
|
|
45
|
+
*/
|
|
46
|
+
type: 'host';
|
|
47
|
+
/**
|
|
48
|
+
* A regular expression used to match the value. Named groups can be used in the destination
|
|
49
|
+
*/
|
|
50
|
+
value: string;
|
|
51
|
+
} | {
|
|
52
|
+
/**
|
|
53
|
+
* The type of request element to check
|
|
54
|
+
*/
|
|
55
|
+
type: 'header' | 'cookie' | 'query';
|
|
56
|
+
/**
|
|
57
|
+
* The name of the element contained in the particular type
|
|
58
|
+
*/
|
|
59
|
+
key: string;
|
|
60
|
+
/**
|
|
61
|
+
* A regular expression used to match the value. Named groups can be used in the destination
|
|
62
|
+
*/
|
|
63
|
+
value?: string;
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
interface Config {
|
|
68
|
+
version: number;
|
|
69
|
+
env?: Record<string, string>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface ConfigV4 extends Config {
|
|
73
|
+
version: 4;
|
|
74
|
+
/**
|
|
75
|
+
* A list of presets to apply to the project. Each preset will be applied in order.
|
|
76
|
+
*/
|
|
77
|
+
presets?: string[] | null;
|
|
78
|
+
/**
|
|
79
|
+
* The folder which holds the assets to be deployed to the edge. Defaults to none.
|
|
80
|
+
*/
|
|
81
|
+
assets?: string | null;
|
|
82
|
+
/**
|
|
83
|
+
* If true, the assets will be cached at the edge during deployment. This may increase the deployment time, depending on the size of the assets. Defaults to false.
|
|
84
|
+
*/
|
|
85
|
+
populateAssetCache?: boolean | null;
|
|
86
|
+
/** Managed image optimization policy for this deployment. */
|
|
87
|
+
images?: Partial<NormalizedImagePolicy> | null;
|
|
88
|
+
/**
|
|
89
|
+
* The regions to which the project will be deployed. Use "global" to deploy to all regions. More regions will incur higher costs.
|
|
90
|
+
*/
|
|
91
|
+
regions?: string[] | null;
|
|
92
|
+
/**
|
|
93
|
+
* The commands to run to build the project. For example, `bun install` or `npm install`.
|
|
94
|
+
*/
|
|
95
|
+
build_commands?: string[] | null;
|
|
96
|
+
/**
|
|
97
|
+
* The serverless functions to deploy.
|
|
98
|
+
*/
|
|
99
|
+
functions?: {
|
|
100
|
+
/**
|
|
101
|
+
* The pattern to match the file path of the function. May be a glob pattern or a regular expression.
|
|
102
|
+
*/
|
|
103
|
+
[pattern: string]: ConfigV4FunctionSettings;
|
|
104
|
+
} | null;
|
|
105
|
+
/**
|
|
106
|
+
* A list of route definitions.
|
|
107
|
+
*
|
|
108
|
+
* @maxItems 1024
|
|
109
|
+
*/
|
|
110
|
+
routes?: {
|
|
111
|
+
/**
|
|
112
|
+
* A pattern that matches each incoming pathname (excluding querystring).
|
|
113
|
+
*/
|
|
114
|
+
source: string;
|
|
115
|
+
/**
|
|
116
|
+
* An absolute pathname to an existing resource or an external URL.
|
|
117
|
+
*/
|
|
118
|
+
destination: string;
|
|
119
|
+
/**
|
|
120
|
+
* An array of requirements that are needed to match
|
|
121
|
+
*
|
|
122
|
+
* @maxItems 16
|
|
123
|
+
*/
|
|
124
|
+
has?: NormalizedConfigRouteMatchRequirements;
|
|
125
|
+
/**
|
|
126
|
+
* An array of requirements that are needed to match
|
|
127
|
+
*
|
|
128
|
+
* @maxItems 16
|
|
129
|
+
*/
|
|
130
|
+
missing?: NormalizedConfigRouteMatchRequirements;
|
|
131
|
+
/**
|
|
132
|
+
* An optional integer to override the status code of the response.
|
|
133
|
+
*/
|
|
134
|
+
statusCode?: number;
|
|
135
|
+
/**
|
|
136
|
+
* An optional boolean to force a redirect response.
|
|
137
|
+
*/
|
|
138
|
+
redirect?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* The HTTP methods to match for the route. Defaults to all methods.
|
|
141
|
+
*/
|
|
142
|
+
methods?: NormalizedConfigRouteMethod[];
|
|
143
|
+
/**
|
|
144
|
+
* Additional headers to add to the response.
|
|
145
|
+
*/
|
|
146
|
+
headers?: {
|
|
147
|
+
[k: string]: string;
|
|
148
|
+
};
|
|
149
|
+
}[] | null;
|
|
150
|
+
/**
|
|
151
|
+
* Additional environment variables to set during runtime and build.
|
|
152
|
+
*/
|
|
153
|
+
env?: Record<string, string>;
|
|
154
|
+
/** Declares managed services to provision for the deployment environment. */
|
|
155
|
+
services?: ConfigV4Services;
|
|
156
|
+
}
|
|
157
|
+
interface ConfigV4Service {
|
|
158
|
+
}
|
|
159
|
+
interface ConfigV4ServiceRedis extends ConfigV4Service {
|
|
160
|
+
/**
|
|
161
|
+
* Optionally, specify what environment variables the credentials will be bound to.
|
|
162
|
+
* For example: `{ url: 'REDIS_URL' }` will bind the `url` environment variable to the Redis URL.
|
|
163
|
+
* If you don't specify any bindings, they will be bound to the REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_DB, and REDIS_SSL environment variables.
|
|
164
|
+
*/
|
|
165
|
+
envBindings?: Record<'url' | 'host' | 'port' | 'password' | 'db' | 'ssl', string>;
|
|
166
|
+
/**
|
|
167
|
+
* The primary region to deploy the Redis instance to.
|
|
168
|
+
*/
|
|
169
|
+
primaryRegion?: UpstashAWSRegion | 'us-central1';
|
|
170
|
+
/**
|
|
171
|
+
* Optionally, add additional regions to read from. More regions will incur higher costs.
|
|
172
|
+
*/
|
|
173
|
+
readRegions?: UpstashAWSRegion[];
|
|
174
|
+
/**
|
|
175
|
+
* Optionally, enable Redis eviction. This will evict the least recently used keys in order to make space for new ones.
|
|
176
|
+
*/
|
|
177
|
+
eviction?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface ConfigV4ServicePostgres extends ConfigV4Service {
|
|
180
|
+
/**
|
|
181
|
+
* Optionally, specify what environment variables the credentials will be bound to.
|
|
182
|
+
* For example: `{ url: 'POSTGRES_URL' }` will bind the `url` environment variable to the Postgres URL.
|
|
183
|
+
* If you don't specify any bindings, they will be bound to the POSTGRES_URL, POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DATABASE environment variables.
|
|
184
|
+
*/
|
|
185
|
+
envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;
|
|
186
|
+
/**
|
|
187
|
+
* The version of Postgres to deploy.
|
|
188
|
+
*/
|
|
189
|
+
postgresVersion?: '17' | '16' | '15' | '14';
|
|
190
|
+
/**
|
|
191
|
+
* The region to deploy the Postgres instance to.
|
|
192
|
+
*/
|
|
193
|
+
region?: NeonAWSRegion;
|
|
194
|
+
}
|
|
195
|
+
/** Managed services accepted under the v4 `services` key. */
|
|
196
|
+
interface ConfigV4Services {
|
|
197
|
+
/** Managed Redis configuration. `null` selects provider defaults. */
|
|
198
|
+
redis?: ConfigV4ServiceRedis | null;
|
|
199
|
+
/** Managed Postgres configuration. `null` selects provider defaults. */
|
|
200
|
+
postgres?: ConfigV4ServicePostgres | null;
|
|
201
|
+
/** Declarative File Storage buckets for the deployment environment. */
|
|
202
|
+
storage?: ConfigV4ServiceStorage;
|
|
203
|
+
}
|
|
204
|
+
/** Declarative File Storage configuration for one deployment environment. */
|
|
205
|
+
interface ConfigV4ServiceStorage extends ConfigV4Service {
|
|
206
|
+
/**
|
|
207
|
+
* Buckets keyed by their immutable environment-scoped name.
|
|
208
|
+
*
|
|
209
|
+
* Use `null` or an empty object to accept the default private visibility.
|
|
210
|
+
* Names are validated exactly and are never normalized. The environment and
|
|
211
|
+
* global CDN/S3 slug are intentionally not configurable here.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```yaml
|
|
215
|
+
* services:
|
|
216
|
+
* storage:
|
|
217
|
+
* buckets:
|
|
218
|
+
* assets:
|
|
219
|
+
* visibility: public
|
|
220
|
+
* uploads: null
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
buckets: Record<string, ConfigV4StorageBucket | null>;
|
|
224
|
+
}
|
|
225
|
+
/** Optional settings for a declaratively provisioned File Storage bucket. */
|
|
226
|
+
interface ConfigV4StorageBucket {
|
|
227
|
+
/** Access policy applied when the bucket is first provisioned. Defaults to `private`. */
|
|
228
|
+
visibility?: 'public' | 'private';
|
|
229
|
+
}
|
|
230
|
+
interface ConfigV4FunctionSettings {
|
|
231
|
+
/**
|
|
232
|
+
* The memory limit for the function in MB.
|
|
233
|
+
*/
|
|
234
|
+
memory?: number;
|
|
235
|
+
/**
|
|
236
|
+
* Maximum lifetime of one HTTP request, response stream, or WebSocket connection, in seconds.
|
|
237
|
+
* Defaults to 30 seconds and may not be higher than eight hours (28,800 seconds).
|
|
238
|
+
*
|
|
239
|
+
* This is an invocation limit. It does not control how long the platform retains or reuses the
|
|
240
|
+
* underlying execution environment after the invocation finishes.
|
|
241
|
+
*/
|
|
242
|
+
max_duration?: number;
|
|
243
|
+
/**
|
|
244
|
+
* The runtime to use for the function.
|
|
245
|
+
*/
|
|
246
|
+
runtime?: Runtime;
|
|
247
|
+
/**
|
|
248
|
+
* Enable function response streaming. When omitted, Node and Bun runtimes stream by default.
|
|
249
|
+
*/
|
|
250
|
+
streaming?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Use to create symlinks on the final function. This is useful for applications that require use of the file system, since serverless functions are ephemeral and have read-only file systems, except for /tmp.
|
|
253
|
+
*/
|
|
254
|
+
symlinks?: {
|
|
255
|
+
/**
|
|
256
|
+
* Left side is where the symlink will be created, right side is the target path.
|
|
257
|
+
*/
|
|
258
|
+
[path: string]: string;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* A glob pattern to match files that should be excluded from your Serverless Function. If you’re using a Community Runtime, the behavior might vary.
|
|
262
|
+
*/
|
|
263
|
+
excludeFiles?: string | string[];
|
|
264
|
+
/**
|
|
265
|
+
* A glob pattern to match files that should be included in your Serverless Function. If you’re using a Community Runtime, the behavior might vary.
|
|
266
|
+
*/
|
|
267
|
+
includeFiles?: string | string[];
|
|
268
|
+
/**
|
|
269
|
+
* Optionally, provide a schedule to run the function on periodically. Examples: `rate(1 hour)`, `rate(1 day)`, `cron(0 12 * * *)`.
|
|
270
|
+
*/
|
|
271
|
+
schedule?: string;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Identity helper providing type inference and checking for `gigadrive.ts`
|
|
276
|
+
* config files. Using it is optional — a plain object default export works the
|
|
277
|
+
* same, but `defineConfig` gives editor autocompletion without a type
|
|
278
|
+
* annotation. Requires `@gigadrive/network-config` to be installed in the
|
|
279
|
+
* project (e.g. as a devDependency).
|
|
280
|
+
*
|
|
281
|
+
* Prefer importing from the `@gigadrive/network-config/define-config` subpath:
|
|
282
|
+
* it is dependency-free, whereas the package root eagerly imports peer
|
|
283
|
+
* dependencies (`effect`, `@effect/platform`) that package managers which do
|
|
284
|
+
* not auto-install peers (e.g. Yarn) will not have installed.
|
|
285
|
+
*
|
|
286
|
+
* Note that a `gigadrive.ts` config is executed as code when the config is
|
|
287
|
+
* read — the same trust model as `build_commands`.
|
|
288
|
+
*
|
|
289
|
+
* @param config - The deployment configuration
|
|
290
|
+
* @returns The configuration, unchanged
|
|
291
|
+
* @example
|
|
292
|
+
* ```ts
|
|
293
|
+
* // gigadrive.ts
|
|
294
|
+
* import { defineConfig } from '@gigadrive/network-config/define-config';
|
|
295
|
+
*
|
|
296
|
+
* export default defineConfig({
|
|
297
|
+
* version: 4,
|
|
298
|
+
* regions: ['eu-central-1'],
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
declare const defineConfig: (config: ConfigV4) => ConfigV4;
|
|
303
|
+
|
|
304
|
+
export { defineConfig };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/define-config.ts
|
|
21
|
+
var define_config_exports = {};
|
|
22
|
+
__export(define_config_exports, {
|
|
23
|
+
defineConfig: () => defineConfig
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(define_config_exports);
|
|
26
|
+
var defineConfig = (config) => config;
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
defineConfig
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=define-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/define-config.ts"],"sourcesContent":["import type { ConfigV4 } from './v4';\n\n/**\n * Identity helper providing type inference and checking for `gigadrive.ts`\n * config files. Using it is optional — a plain object default export works the\n * same, but `defineConfig` gives editor autocompletion without a type\n * annotation. Requires `@gigadrive/network-config` to be installed in the\n * project (e.g. as a devDependency).\n *\n * Prefer importing from the `@gigadrive/network-config/define-config` subpath:\n * it is dependency-free, whereas the package root eagerly imports peer\n * dependencies (`effect`, `@effect/platform`) that package managers which do\n * not auto-install peers (e.g. Yarn) will not have installed.\n *\n * Note that a `gigadrive.ts` config is executed as code when the config is\n * read — the same trust model as `build_commands`.\n *\n * @param config - The deployment configuration\n * @returns The configuration, unchanged\n * @example\n * ```ts\n * // gigadrive.ts\n * import { defineConfig } from '@gigadrive/network-config/define-config';\n *\n * export default defineConfig({\n * version: 4,\n * regions: ['eu-central-1'],\n * });\n * ```\n */\nexport const defineConfig = (config: ConfigV4): ConfigV4 => config;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,IAAM,eAAe,CAAC,WAA+B;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/define-config.ts"],"sourcesContent":["import type { ConfigV4 } from './v4';\n\n/**\n * Identity helper providing type inference and checking for `gigadrive.ts`\n * config files. Using it is optional — a plain object default export works the\n * same, but `defineConfig` gives editor autocompletion without a type\n * annotation. Requires `@gigadrive/network-config` to be installed in the\n * project (e.g. as a devDependency).\n *\n * Prefer importing from the `@gigadrive/network-config/define-config` subpath:\n * it is dependency-free, whereas the package root eagerly imports peer\n * dependencies (`effect`, `@effect/platform`) that package managers which do\n * not auto-install peers (e.g. Yarn) will not have installed.\n *\n * Note that a `gigadrive.ts` config is executed as code when the config is\n * read — the same trust model as `build_commands`.\n *\n * @param config - The deployment configuration\n * @returns The configuration, unchanged\n * @example\n * ```ts\n * // gigadrive.ts\n * import { defineConfig } from '@gigadrive/network-config/define-config';\n *\n * export default defineConfig({\n * version: 4,\n * regions: ['eu-central-1'],\n * });\n * ```\n */\nexport const defineConfig = (config: ConfigV4): ConfigV4 => config;\n"],"mappings":";AA8BO,IAAM,eAAe,CAAC,WAA+B;","names":[]}
|