@gigadrive/network-config 1.0.0 → 1.1.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/build-output-v3/index.d.ts +120 -0
- package/dist/build-output-v3/parse.d.ts +17 -0
- package/dist/build-output-v3/parse.js +1 -1
- package/dist/build-output-v3/parse.js.map +3 -3
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/normalized-config.d.ts +125 -0
- package/dist/parse-raw-config.d.ts +1 -0
- package/dist/regions.d.ts +4 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/v4/index.d.ts +162 -0
- package/dist/v4/parse.d.ts +10 -0
- package/dist/v4/parse.js +1 -1
- package/dist/v4/parse.js.map +3 -3
- package/dist/v4/schema.json +334 -0
- package/package.json +26 -5
- package/src/v4/schema.json +334 -0
- package/tsconfig.json +11 -0
package/dist/v4/parse.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/v4/parse.ts"],
|
|
4
|
-
"sourcesContent": ["import fs from 'fs';\nimport { minimatch } from 'minimatch';\nimport type { ConfigV4, ConfigV4FunctionSettings } from '.';\nimport
|
|
5
|
-
"mappings": "AAAA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { getFilesForPattern } from '@gigadrive/build-utils/get-files-for-pattern';\nimport fs from 'fs';\nimport { minimatch } from 'minimatch';\nimport type { ConfigV4, ConfigV4FunctionSettings } from '.';\nimport type {\n NormalizedConfig,\n NormalizedConfigEntrypoint,\n NormalizedConfigRoute,\n NormalizedConfigRouteHandler,\n} from '../normalized-config';\nimport { AVAILABLE_REGIONS, type Region } from '../regions';\n\nexport const parseConfigV4 = async (config: ConfigV4, projectFolder: string): Promise<NormalizedConfig> => {\n const regions =\n config.regions?.includes('global') === true\n ? AVAILABLE_REGIONS\n : (config.regions?.filter((region) => region !== 'global') ?? ['global']);\n\n const populateAssetCache = config.populateAssetCache ?? false;\n const environmentVariables = config.env ?? {};\n const commands = config.build_commands ?? [];\n const entrypoints: NormalizedConfigEntrypoint[] = [];\n const errors: string[] = [];\n const warnings: string[] = [];\n\n if (config.functions != null) {\n for (const [path, func] of Object.entries(config.functions)) {\n const settings = getFunctionSettings(path, config);\n\n if (settings == null) {\n throw new Error(`Settings invalid for function at path '${path}'`);\n }\n\n (await getFilesForPattern(path, projectFolder, func.excludeFiles)).forEach((file) => {\n // check if file is already in entrypoints, or if the path has a definition other than this one that matches it exactly\n if (entrypoints.find((entrypoint) => entrypoint.path === file)) {\n return;\n }\n\n if (config.functions != null && Object.keys(config.functions).find((func) => func === file && func !== path)) {\n return;\n }\n\n entrypoints.push({\n path: file,\n runtime: settings.runtime ?? 'node-20',\n memory: settings.memory ?? 128,\n maxDuration: settings.max_duration ?? 30,\n schedule: func.schedule,\n symlinks: func.symlinks,\n streaming:\n settings.runtime == null || settings.runtime.startsWith('node-') || settings.runtime.startsWith('bun-'),\n });\n });\n }\n }\n\n const assets: string[] = [];\n\n if (config.assets != null) {\n // list all files in assets folder recursively\n\n const assetsPath = `${projectFolder}/${config.assets}`;\n\n if (fs.existsSync(assetsPath) && fs.statSync(assetsPath).isDirectory()) {\n // console.debug('---- ASSET DEBUG ----');\n // console.debug('projectFolder', fs.readdirSync(assetsPath, { recursive: true }));\n\n // find all files in assets folder using fs\n for (const asset of fs.readdirSync(`${projectFolder}/${config.assets}`, {\n recursive: true,\n })) {\n // if file is a directory, skip it\n if (fs.statSync(`${projectFolder}/${config.assets}/${asset}`).isDirectory()) {\n continue;\n }\n\n const disallowedExtensions = ['.htaccess', '.htpasswd'];\n\n const assetName = asset.toString();\n\n if (disallowedExtensions.some((ext) => assetName.toLowerCase().endsWith(ext.toLowerCase()))) {\n continue;\n }\n\n assets.push(`${config.assets}/${assetName}`);\n }\n }\n }\n\n const routes = config.routes ?? [];\n\n return {\n regions: regions as Region[],\n assets: {\n paths: assets.sort(),\n prefixToStrip: (config.assets ?? '') + '/',\n dynamicRoutes: true,\n populateCache: populateAssetCache,\n },\n environmentVariables,\n commands,\n entrypoints,\n errors,\n warnings,\n routes: routes.map((route) => {\n // check if the destination has a protocol, if so use REDIRECT handler\n const handler: NormalizedConfigRouteHandler =\n route.destination.toLowerCase().startsWith('http://') || route.destination.toLowerCase().startsWith('https://')\n ? route.redirect === true\n ? 'HTTP_REDIRECT'\n : 'HTTP_PROXY'\n : route.redirect === true\n ? 'HTTP_REDIRECT'\n : 'SERVERLESS_FUNCTION';\n\n return {\n path: route.source,\n destination: route.destination,\n handler,\n headers: route.headers ?? {},\n methods: route.methods ?? ['ANY'],\n positiveRequirements: route.has,\n negativeRequirements: route.missing,\n status: route.statusCode,\n } as NormalizedConfigRoute;\n }),\n };\n};\n\n/**\n * Gets the runtime, memory and max duration for a given path.\n * @param path\n * @param config\n * @returns The runtime, memory and max duration for the given path. Should return undefined when a path should not be deployed as a function.\n */\nexport const getFunctionSettings = (path: string, config: ConfigV4): ConfigV4FunctionSettings | undefined => {\n // functions don't have to state all their options.\n // some function definitions might be glob or regex patterns.\n // go through all function definitions, find those that match the path and merge them.\n\n let functionSettings: ConfigV4FunctionSettings | undefined;\n\n for (const [key, value] of Object.entries(config.functions ?? {})) {\n // make sure to check for both glob and regex patterns\n if (minimatch(path, key) || new RegExp(key).test(path)) {\n if (functionSettings == null) {\n functionSettings = {\n memory: 128,\n max_duration: 30,\n schedule: undefined,\n symlinks: undefined,\n excludeFiles: undefined,\n includeFiles: undefined,\n };\n }\n\n if (value.runtime != null) {\n functionSettings.runtime = value.runtime;\n }\n\n if (value.memory != null) {\n functionSettings.memory = value.memory;\n }\n\n if (value.max_duration != null) {\n functionSettings.max_duration = value.max_duration;\n }\n\n if (value.schedule != null) {\n functionSettings.schedule = value.schedule;\n }\n\n if (value.symlinks != null) {\n functionSettings.symlinks = value.symlinks;\n }\n\n if (value.excludeFiles != null) {\n functionSettings.excludeFiles = value.excludeFiles;\n }\n\n if (value.includeFiles != null) {\n functionSettings.includeFiles = value.includeFiles;\n }\n }\n }\n\n return functionSettings;\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["getFilesForPattern", "fs", "minimatch", "AVAILABLE_REGIONS", "parseConfigV4", "config", "projectFolder", "regions", "region", "populateAssetCache", "environmentVariables", "commands", "entrypoints", "errors", "warnings", "path", "func", "settings", "getFunctionSettings", "file", "entrypoint", "assets", "assetsPath", "asset", "disallowedExtensions", "assetName", "ext", "routes", "route", "handler", "functionSettings", "key", "value"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Config V4",
|
|
4
|
+
"description": "Configuration schema for version 4",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["version"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"version": {
|
|
9
|
+
"type": "integer",
|
|
10
|
+
"enum": [4],
|
|
11
|
+
"description": "The version of the configuration file"
|
|
12
|
+
},
|
|
13
|
+
"presets": {
|
|
14
|
+
"type": ["array", "null"],
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"format": "uri"
|
|
18
|
+
},
|
|
19
|
+
"description": "A list of presets to apply to the project. Each preset will be applied in order."
|
|
20
|
+
},
|
|
21
|
+
"assets": {
|
|
22
|
+
"type": ["string", "null"],
|
|
23
|
+
"description": "The folder which holds the assets to be deployed to the edge. Defaults to none."
|
|
24
|
+
},
|
|
25
|
+
"populateAssetCache": {
|
|
26
|
+
"type": ["boolean", "null"],
|
|
27
|
+
"description": "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."
|
|
28
|
+
},
|
|
29
|
+
"regions": {
|
|
30
|
+
"type": ["array", "null"],
|
|
31
|
+
"description": "The regions to which the project will be deployed. Use \"global\" to deploy to all regions. More regions will incur higher costs.",
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"build_commands": {
|
|
37
|
+
"type": ["array", "null"],
|
|
38
|
+
"description": "The commands to run to build the project. For example, `bun install` or `npm install`.",
|
|
39
|
+
"items": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"functions": {
|
|
44
|
+
"type": ["object", "null"],
|
|
45
|
+
"description": "The serverless functions to deploy.",
|
|
46
|
+
"additionalProperties": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"properties": {
|
|
49
|
+
"memory": {
|
|
50
|
+
"type": "number",
|
|
51
|
+
"description": "The memory in MB to allocate to the function. Defaults to 128.",
|
|
52
|
+
"maximum": 3009,
|
|
53
|
+
"minimum": 128
|
|
54
|
+
},
|
|
55
|
+
"max_duration": {
|
|
56
|
+
"type": "number",
|
|
57
|
+
"description": "The max duration in seconds for the function after which it will be terminated. Defaults to 30.",
|
|
58
|
+
"maximum": 900,
|
|
59
|
+
"minimum": 1
|
|
60
|
+
},
|
|
61
|
+
"runtime": {
|
|
62
|
+
"$ref": "#/$defs/runtimes",
|
|
63
|
+
"description": "The runtime to use for the function."
|
|
64
|
+
},
|
|
65
|
+
"schedule": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "An expression to schedule the function to run at specific times.",
|
|
68
|
+
"pattern": "^(?:rate[(](?:(?:1[ ]+(hour|minute|day))|(?:[0-9]+[ ]+(hours|minutes|days)))[)])|(?:cron[(](?:(?:(?:[0-5]?[0-9])|[*])(?:(?:[-](?:(?:[0-5]?[0-9])|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[0-5]?[0-9])|[*])(?:(?:[-](?:(?:[0-5]?[0-9])|[*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[0-2]?[0-9])|[*])(?:(?:[-](?:(?:[0-2]?[0-9])|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[0-2]?[0-9])|[*])(?:(?:[-](?:(?:[0-2]?[0-9])|[*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:[?][ ]+(?:(?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?(?:[,](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))[#][0-5])|(?:(?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*])(?:(?:[-](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*]))|(?:[/][0-9]+))?(?:[,](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*])(?:(?:[-](?:(?:(?:[1-7]|(?:SUN|MON|TUE|WED|THU|FRI|SAT))L?)|[L*]))|(?:[/][0-9]+))?)*)))|(?:(?:(?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?(?:[,](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*])(?:(?:[-](?:(?:(?:[1-3]?[0-9])W?)|LW|[L*]))|(?:[/][0-9]+))?)*)[ ]+(?:(?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?(?:[,](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:(?:[-](?:(?:[1]?[0-9])|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|[*])(?:[/][0-9]+)?)|(?:[/][0-9]+))?)*)[ ]+[?]))[ ]+(?:(?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?(?:[,](?:(?:[12][0-9]{3})|[*])(?:(?:[-](?:(?:[12][0-9]{3})|[*]))|(?:[/][0-9]+))?)*)[)])$"
|
|
69
|
+
},
|
|
70
|
+
"symlinks": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"description": "A list of symbolic links to create in the function's package.",
|
|
73
|
+
"maxProperties": 100,
|
|
74
|
+
"minProperties": 1,
|
|
75
|
+
"patternProperties": {
|
|
76
|
+
"^.{1,256}$": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"maxLength": 256
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"additionalProperties": false
|
|
82
|
+
},
|
|
83
|
+
"excludeFiles": {
|
|
84
|
+
"oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
|
|
85
|
+
"description": "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."
|
|
86
|
+
},
|
|
87
|
+
"includeFiles": {
|
|
88
|
+
"oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
|
|
89
|
+
"description": "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."
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"env": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"maxProperties": 100,
|
|
97
|
+
"minProperties": 0,
|
|
98
|
+
"patternProperties": {
|
|
99
|
+
".+": {
|
|
100
|
+
"maxLength": 65536,
|
|
101
|
+
"minLength": 0,
|
|
102
|
+
"type": "string"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"description": "Additional environment variables to set during runtime and build."
|
|
107
|
+
},
|
|
108
|
+
"routes": {
|
|
109
|
+
"type": ["array", "null"],
|
|
110
|
+
"description": "A list of route definitions.",
|
|
111
|
+
"maxItems": 1024,
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"required": ["source", "destination"],
|
|
115
|
+
"properties": {
|
|
116
|
+
"source": {
|
|
117
|
+
"description": "A pattern that matches each incoming pathname (excluding querystring).",
|
|
118
|
+
"type": "string",
|
|
119
|
+
"maxLength": 4096
|
|
120
|
+
},
|
|
121
|
+
"destination": {
|
|
122
|
+
"description": "An absolute pathname to an existing resource or an external URL.",
|
|
123
|
+
"type": "string",
|
|
124
|
+
"maxLength": 4096
|
|
125
|
+
},
|
|
126
|
+
"has": {
|
|
127
|
+
"$ref": "#/$defs/matchRequirements"
|
|
128
|
+
},
|
|
129
|
+
"missing": {
|
|
130
|
+
"$ref": "#/$defs/matchRequirements"
|
|
131
|
+
},
|
|
132
|
+
"statusCode": {
|
|
133
|
+
"description": "An optional integer to override the status code of the response.",
|
|
134
|
+
"type": "integer",
|
|
135
|
+
"minimum": 100,
|
|
136
|
+
"maximum": 999
|
|
137
|
+
},
|
|
138
|
+
"redirect": {
|
|
139
|
+
"type": "boolean",
|
|
140
|
+
"description": "An optional boolean to force a redirect response."
|
|
141
|
+
},
|
|
142
|
+
"methods": {
|
|
143
|
+
"type": "array",
|
|
144
|
+
"description": "The HTTP methods to match for the route. Defaults to all methods.",
|
|
145
|
+
"items": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"enum": ["ANY", "GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"headers": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"description": "Additional headers to add to the response.",
|
|
153
|
+
"additionalProperties": {
|
|
154
|
+
"type": "string"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"services": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"description": "Optionally, specify additional services like databases to deploy.",
|
|
163
|
+
"properties": {
|
|
164
|
+
"redis": {
|
|
165
|
+
"oneOf": [
|
|
166
|
+
{
|
|
167
|
+
"type": "null"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "object",
|
|
171
|
+
"properties": {
|
|
172
|
+
"envBindings": {
|
|
173
|
+
"type": "object",
|
|
174
|
+
"description": "Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'REDIS_URL' }` will bind the `url` environment variable to the Redis URL. 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.",
|
|
175
|
+
"additionalProperties": false,
|
|
176
|
+
"properties": {
|
|
177
|
+
"url": { "type": "string" },
|
|
178
|
+
"host": { "type": "string" },
|
|
179
|
+
"port": { "type": "string" },
|
|
180
|
+
"password": { "type": "string" },
|
|
181
|
+
"db": { "type": "string" },
|
|
182
|
+
"ssl": { "type": "string" }
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"primaryRegion": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"description": "The primary region to deploy the Redis instance to.",
|
|
188
|
+
"enum": [
|
|
189
|
+
"us-east-1",
|
|
190
|
+
"us-east-2",
|
|
191
|
+
"us-west-1",
|
|
192
|
+
"us-west-2",
|
|
193
|
+
"eu-central-1",
|
|
194
|
+
"eu-west-1",
|
|
195
|
+
"eu-west-2",
|
|
196
|
+
"sa-east-1",
|
|
197
|
+
"ap-south-1",
|
|
198
|
+
"ap-northeast-1",
|
|
199
|
+
"ap-southeast-1",
|
|
200
|
+
"ap-southeast-2",
|
|
201
|
+
"us-central1"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"readRegions": {
|
|
205
|
+
"type": "array",
|
|
206
|
+
"description": "Optionally, add additional regions to read from. More regions will incur higher costs.",
|
|
207
|
+
"items": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"enum": [
|
|
210
|
+
"us-east-1",
|
|
211
|
+
"us-east-2",
|
|
212
|
+
"us-west-1",
|
|
213
|
+
"us-west-2",
|
|
214
|
+
"eu-central-1",
|
|
215
|
+
"eu-west-1",
|
|
216
|
+
"eu-west-2",
|
|
217
|
+
"sa-east-1",
|
|
218
|
+
"ap-south-1",
|
|
219
|
+
"ap-northeast-1",
|
|
220
|
+
"ap-southeast-1",
|
|
221
|
+
"ap-southeast-2"
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"eviction": {
|
|
226
|
+
"type": "boolean",
|
|
227
|
+
"description": "Optionally, enable Redis eviction. This will evict the least recently used keys in order to make space for new ones."
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
"postgres": {
|
|
234
|
+
"oneOf": [
|
|
235
|
+
{
|
|
236
|
+
"type": "null"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"type": "object",
|
|
240
|
+
"properties": {
|
|
241
|
+
"envBindings": {
|
|
242
|
+
"type": "object",
|
|
243
|
+
"description": "Optionally, specify what environment variables the credentials will be bound to. For example: `{ url: 'POSTGRES_URL' }` will bind the `url` environment variable to the Postgres URL. 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.",
|
|
244
|
+
"additionalProperties": false,
|
|
245
|
+
"properties": {
|
|
246
|
+
"url": { "type": "string" },
|
|
247
|
+
"host": { "type": "string" },
|
|
248
|
+
"port": { "type": "string" },
|
|
249
|
+
"user": { "type": "string" },
|
|
250
|
+
"password": { "type": "string" },
|
|
251
|
+
"database": { "type": "string" }
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"postgresVersion": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"description": "The version of Postgres to deploy.",
|
|
257
|
+
"enum": ["17", "16", "15", "14"]
|
|
258
|
+
},
|
|
259
|
+
"region": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"description": "The region to deploy the Postgres instance to.",
|
|
262
|
+
"enum": [
|
|
263
|
+
"us-east-1",
|
|
264
|
+
"us-east-2",
|
|
265
|
+
"us-west-2",
|
|
266
|
+
"ap-southeast-1",
|
|
267
|
+
"ap-southeast-2",
|
|
268
|
+
"eu-central-1",
|
|
269
|
+
"eu-west-2",
|
|
270
|
+
"sa-east-1"
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"$defs": {
|
|
281
|
+
"runtimes": {
|
|
282
|
+
"type": "string",
|
|
283
|
+
"enum": ["php-83", "php-82", "php-81", "php-80", "node-20", "node-18", "node-16", "bun-1"]
|
|
284
|
+
},
|
|
285
|
+
"matchRequirements": {
|
|
286
|
+
"description": "An array of requirements that are needed to match",
|
|
287
|
+
"type": "array",
|
|
288
|
+
"maxItems": 16,
|
|
289
|
+
"items": {
|
|
290
|
+
"anyOf": [
|
|
291
|
+
{
|
|
292
|
+
"type": "object",
|
|
293
|
+
"additionalProperties": false,
|
|
294
|
+
"required": ["type", "value"],
|
|
295
|
+
"properties": {
|
|
296
|
+
"type": {
|
|
297
|
+
"description": "The type of request element to check",
|
|
298
|
+
"type": "string",
|
|
299
|
+
"enum": ["host"]
|
|
300
|
+
},
|
|
301
|
+
"value": {
|
|
302
|
+
"description": "A regular expression used to match the value. Named groups can be used in the destination",
|
|
303
|
+
"type": "string",
|
|
304
|
+
"maxLength": 4096
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"type": "object",
|
|
310
|
+
"additionalProperties": false,
|
|
311
|
+
"required": ["type", "key"],
|
|
312
|
+
"properties": {
|
|
313
|
+
"type": {
|
|
314
|
+
"description": "The type of request element to check",
|
|
315
|
+
"type": "string",
|
|
316
|
+
"enum": ["header", "cookie", "query"]
|
|
317
|
+
},
|
|
318
|
+
"key": {
|
|
319
|
+
"description": "The name of the element contained in the particular type",
|
|
320
|
+
"type": "string",
|
|
321
|
+
"maxLength": 4096
|
|
322
|
+
},
|
|
323
|
+
"value": {
|
|
324
|
+
"description": "A regular expression used to match the value. Named groups can be used in the destination",
|
|
325
|
+
"type": "string",
|
|
326
|
+
"maxLength": 4096
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gigadrive/network-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"devDependencies": {
|
|
5
|
-
"esbuild": "^0.25.0"
|
|
5
|
+
"esbuild": "^0.25.0",
|
|
6
|
+
"@types/node": "^22"
|
|
6
7
|
},
|
|
7
8
|
"files": [
|
|
8
|
-
"dist"
|
|
9
|
+
"dist",
|
|
10
|
+
"**/*.json"
|
|
9
11
|
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": {
|
|
16
|
+
"production": "./dist/index.js",
|
|
17
|
+
"development": "./src/index.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./*": {
|
|
22
|
+
"types": "./dist/*.d.ts",
|
|
23
|
+
"import": {
|
|
24
|
+
"production": "./dist/*.js",
|
|
25
|
+
"development": "./src/*.ts",
|
|
26
|
+
"default": "./dist/*.js"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
10
30
|
"dependencies": {
|
|
11
31
|
"ajv": "^8.17.1",
|
|
12
32
|
"ajv-formats": "^3.0.1",
|
|
13
33
|
"minimatch": "^9.0.4",
|
|
14
|
-
"yaml": "^2.7.0"
|
|
34
|
+
"yaml": "^2.7.0",
|
|
35
|
+
"@gigadrive/build-utils": "0.1.0"
|
|
15
36
|
},
|
|
16
37
|
"publishConfig": {
|
|
17
38
|
"access": "public"
|
|
@@ -22,6 +43,6 @@
|
|
|
22
43
|
},
|
|
23
44
|
"scripts": {
|
|
24
45
|
"clean": "rm -rf dist",
|
|
25
|
-
"build": "node build.mjs"
|
|
46
|
+
"build": "node ../../scripts/build.mjs && tsc && cp -r ./src/v4/schema.json ./dist/v4/schema.json"
|
|
26
47
|
}
|
|
27
48
|
}
|