@gigadrive/network-config 2.0.0 → 2.0.2

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.mts CHANGED
@@ -1,8 +1,18 @@
1
+ declare const ALLOWED_CONFIG_NAMES: string[];
2
+ /**
3
+ * Finds a config file in the project folder.
4
+ * @param projectFolder The folder to search for a config file in.
5
+ * @returns The path to the config file, or null if no config file is found.
6
+ */
7
+ declare const findConfig: (projectFolder: string) => string | null;
8
+
1
9
  declare const REGION_DEFINITIONS: readonly ["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"];
2
10
  type Region = (typeof REGION_DEFINITIONS)[number];
11
+ declare const AVAILABLE_REGIONS: Region[];
3
12
 
4
13
  declare const RUNTIME_DEFINITIONS: readonly ["php-84", "php-83", "php-81", "node-22", "node-20", "node-18", "node-16", "bun-1"];
5
14
  type Runtime = (typeof RUNTIME_DEFINITIONS)[number];
15
+ declare const AVAILABLE_RUNTIMES: Runtime[];
6
16
 
7
17
  /**
8
18
  * The object structure that all config versions will be parsed into.
@@ -62,6 +72,19 @@ interface NormalizedConfigService {
62
72
  type: NormalizedConfigServiceType;
63
73
  }
64
74
  type NormalizedConfigServiceType = 'redis' | 'postgres';
75
+ 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';
76
+ interface NormalizedConfigServiceRedis extends NormalizedConfigService {
77
+ envBindings?: Record<'url' | 'host' | 'port' | 'password' | 'db' | 'ssl', string>;
78
+ primaryRegion?: UpstashAWSRegion | 'us-central1';
79
+ readRegions?: UpstashAWSRegion[];
80
+ eviction?: boolean;
81
+ }
82
+ 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';
83
+ interface NormalizedConfigServicePostgres extends NormalizedConfigService {
84
+ envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;
85
+ postgresVersion?: '17' | '16' | '15' | '14';
86
+ region?: NeonAWSRegion;
87
+ }
65
88
  interface NormalizedConfigEntrypoint {
66
89
  displayName?: string;
67
90
  path: string;
@@ -115,13 +138,8 @@ type NormalizedConfigRouteMatchRequirements = [] | [
115
138
  }
116
139
  ];
117
140
 
118
- declare const ALLOWED_CONFIG_NAMES: string[];
119
- /**
120
- * Finds a config file in the project folder.
121
- * @param projectFolder The folder to search for a config file in.
122
- * @returns The path to the config file, or null if no config file is found.
123
- */
124
- declare const findConfig: (projectFolder: string) => string | null;
125
141
  declare const parseConfig: (filePath: string, projectFolder: string) => Promise<NormalizedConfig>;
126
142
 
127
- export { ALLOWED_CONFIG_NAMES, findConfig, parseConfig };
143
+ declare const parseRawConfig: (filePath: string) => Promise<any>;
144
+
145
+ export { ALLOWED_CONFIG_NAMES, AVAILABLE_REGIONS, AVAILABLE_RUNTIMES, type NeonAWSRegion, type NormalizedConfig, type NormalizedConfigEntrypoint, type NormalizedConfigRoute, type NormalizedConfigRouteHandler, type NormalizedConfigRouteMatchRequirements, type NormalizedConfigRouteMethod, type NormalizedConfigService, type NormalizedConfigServicePostgres, type NormalizedConfigServiceRedis, type NormalizedConfigServiceType, type Region, type Runtime, type UpstashAWSRegion, findConfig, parseConfig, parseRawConfig };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,18 @@
1
+ declare const ALLOWED_CONFIG_NAMES: string[];
2
+ /**
3
+ * Finds a config file in the project folder.
4
+ * @param projectFolder The folder to search for a config file in.
5
+ * @returns The path to the config file, or null if no config file is found.
6
+ */
7
+ declare const findConfig: (projectFolder: string) => string | null;
8
+
1
9
  declare const REGION_DEFINITIONS: readonly ["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"];
2
10
  type Region = (typeof REGION_DEFINITIONS)[number];
11
+ declare const AVAILABLE_REGIONS: Region[];
3
12
 
4
13
  declare const RUNTIME_DEFINITIONS: readonly ["php-84", "php-83", "php-81", "node-22", "node-20", "node-18", "node-16", "bun-1"];
5
14
  type Runtime = (typeof RUNTIME_DEFINITIONS)[number];
15
+ declare const AVAILABLE_RUNTIMES: Runtime[];
6
16
 
7
17
  /**
8
18
  * The object structure that all config versions will be parsed into.
@@ -62,6 +72,19 @@ interface NormalizedConfigService {
62
72
  type: NormalizedConfigServiceType;
63
73
  }
64
74
  type NormalizedConfigServiceType = 'redis' | 'postgres';
75
+ 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';
76
+ interface NormalizedConfigServiceRedis extends NormalizedConfigService {
77
+ envBindings?: Record<'url' | 'host' | 'port' | 'password' | 'db' | 'ssl', string>;
78
+ primaryRegion?: UpstashAWSRegion | 'us-central1';
79
+ readRegions?: UpstashAWSRegion[];
80
+ eviction?: boolean;
81
+ }
82
+ 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';
83
+ interface NormalizedConfigServicePostgres extends NormalizedConfigService {
84
+ envBindings?: Record<'url' | 'host' | 'port' | 'user' | 'password' | 'database', string>;
85
+ postgresVersion?: '17' | '16' | '15' | '14';
86
+ region?: NeonAWSRegion;
87
+ }
65
88
  interface NormalizedConfigEntrypoint {
66
89
  displayName?: string;
67
90
  path: string;
@@ -115,13 +138,8 @@ type NormalizedConfigRouteMatchRequirements = [] | [
115
138
  }
116
139
  ];
117
140
 
118
- declare const ALLOWED_CONFIG_NAMES: string[];
119
- /**
120
- * Finds a config file in the project folder.
121
- * @param projectFolder The folder to search for a config file in.
122
- * @returns The path to the config file, or null if no config file is found.
123
- */
124
- declare const findConfig: (projectFolder: string) => string | null;
125
141
  declare const parseConfig: (filePath: string, projectFolder: string) => Promise<NormalizedConfig>;
126
142
 
127
- export { ALLOWED_CONFIG_NAMES, findConfig, parseConfig };
143
+ declare const parseRawConfig: (filePath: string) => Promise<any>;
144
+
145
+ export { ALLOWED_CONFIG_NAMES, AVAILABLE_REGIONS, AVAILABLE_RUNTIMES, type NeonAWSRegion, type NormalizedConfig, type NormalizedConfigEntrypoint, type NormalizedConfigRoute, type NormalizedConfigRouteHandler, type NormalizedConfigRouteMatchRequirements, type NormalizedConfigRouteMethod, type NormalizedConfigService, type NormalizedConfigServicePostgres, type NormalizedConfigServiceRedis, type NormalizedConfigServiceType, type Region, type Runtime, type UpstashAWSRegion, findConfig, parseConfig, parseRawConfig };
package/dist/index.js CHANGED
@@ -14219,11 +14219,23 @@ ${end.comment}` : end.comment;
14219
14219
  }
14220
14220
  });
14221
14221
 
14222
- // src/index.ts
14222
+ // src/find-config.ts
14223
+ var import_fs = __toESM(__require("fs"));
14224
+ var import_path = __toESM(__require("path"));
14225
+ var ALLOWED_CONFIG_NAMES = ["gigadrive.yaml", "gigadrive.yml", "nebula.yaml", "nebula.yml", "nebula.json"];
14226
+ var findConfig = (projectFolder) => {
14227
+ for (const name of ALLOWED_CONFIG_NAMES) {
14228
+ const filePath = import_path.default.join(projectFolder, name);
14229
+ if (import_fs.default.existsSync(filePath)) {
14230
+ return filePath;
14231
+ }
14232
+ }
14233
+ return null;
14234
+ };
14235
+
14236
+ // src/parse-config.ts
14223
14237
  var import_ajv = __toESM(require_ajv());
14224
14238
  var import_ajv_formats = __toESM(require_dist());
14225
- var import_fs4 = __toESM(__require("fs"));
14226
- var import_path3 = __toESM(__require("path"));
14227
14239
 
14228
14240
  // ../../node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.js
14229
14241
  var import_brace_expansion = __toESM(require_brace_expansion(), 1);
@@ -14896,11 +14908,11 @@ ${end.comment}` : end.comment;
14896
14908
  return (f) => f.length === len && f !== "." && f !== "..";
14897
14909
  };
14898
14910
  var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
14899
- var path = {
14911
+ var path2 = {
14900
14912
  win32: { sep: "\\" },
14901
14913
  posix: { sep: "/" }
14902
14914
  };
14903
- var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
14915
+ var sep = defaultPlatform === "win32" ? path2.win32.sep : path2.posix.sep;
14904
14916
  minimatch.sep = sep;
14905
14917
  var GLOBSTAR = Symbol("globstar **");
14906
14918
  minimatch.GLOBSTAR = GLOBSTAR;
@@ -15590,22 +15602,22 @@ ${end.comment}` : end.comment;
15590
15602
  };
15591
15603
 
15592
15604
  // src/build-output-v3/parse.ts
15593
- var import_fs2 = __toESM(__require("fs"));
15594
- var import_path2 = __toESM(__require("path"));
15605
+ var import_fs3 = __toESM(__require("fs"));
15606
+ var import_path3 = __toESM(__require("path"));
15595
15607
 
15596
15608
  // src/parse-raw-config.ts
15597
- var import_fs = __toESM(__require("fs"));
15598
- var import_path = __toESM(__require("path"));
15609
+ var import_fs2 = __toESM(__require("fs"));
15610
+ var import_path2 = __toESM(__require("path"));
15599
15611
  var import_yaml = __toESM(require_dist2());
15600
15612
  var parseRawConfig = async (filePath) => {
15601
- if (!import_fs.default.existsSync(filePath)) {
15613
+ if (!import_fs2.default.existsSync(filePath)) {
15602
15614
  throw new Error(`Config file not found at ${filePath}`);
15603
15615
  }
15604
- const fileContents = import_fs.default.readFileSync(filePath, "utf8");
15616
+ const fileContents = import_fs2.default.readFileSync(filePath, "utf8");
15605
15617
  if (fileContents.length === 0) {
15606
15618
  throw new Error(`Config file is empty at ${filePath}`);
15607
15619
  }
15608
- const fileExtension = import_path.default.extname(filePath).toLowerCase();
15620
+ const fileExtension = import_path2.default.extname(filePath).toLowerCase();
15609
15621
  let parsed;
15610
15622
  try {
15611
15623
  if (fileExtension === ".json") {
@@ -15633,7 +15645,7 @@ ${end.comment}` : end.comment;
15633
15645
  var configPath = ".vercel/output/config.json";
15634
15646
  var functionConfigsPattern = ".vercel/output/functions/*.func/.vc-config.json";
15635
15647
  var parseVercelBuildOutputV3 = async (parseResult, projectFolder) => {
15636
- const config = await readConfigFile(import_path2.default.join(projectFolder, configPath));
15648
+ const config = await readConfigFile(import_path3.default.join(projectFolder, configPath));
15637
15649
  if (!config || config.version < 3) {
15638
15650
  return parseResult;
15639
15651
  }
@@ -15656,12 +15668,12 @@ ${end.comment}` : end.comment;
15656
15668
  var loadFunctions = async (config, parseResult, projectFolder) => {
15657
15669
  const functionConfigs = await getFilesForPattern(functionConfigsPattern, projectFolder);
15658
15670
  for (const functionConfigPath of functionConfigs) {
15659
- const functionConfig = await readConfigFile(import_path2.default.join(projectFolder, functionConfigPath));
15671
+ const functionConfig = await readConfigFile(import_path3.default.join(projectFolder, functionConfigPath));
15660
15672
  if (!functionConfig) {
15661
15673
  parseResult.errors.push(`Failed to read function config at ${functionConfigPath}`);
15662
15674
  continue;
15663
15675
  }
15664
- const functionName = import_path2.default.basename(import_path2.default.dirname(functionConfigPath)).replace(/\.func$/, "");
15676
+ const functionName = import_path3.default.basename(import_path3.default.dirname(functionConfigPath)).replace(/\.func$/, "");
15665
15677
  const runtime = translateVercelRuntime(functionConfig.runtime);
15666
15678
  if (!runtime) {
15667
15679
  parseResult.errors.push(`Unsupported runtime for function ${functionName}: ${functionConfig.runtime}`);
@@ -15689,7 +15701,7 @@ ${end.comment}` : end.comment;
15689
15701
  const streaming = runtime == null || runtime.startsWith("node-") || runtime.startsWith("bun-");
15690
15702
  const filePathMap = {};
15691
15703
  for (const [key, value] of Object.entries(functionConfig.filePathMap ?? {})) {
15692
- filePathMap[import_path2.default.join(projectFolder, key)] = value;
15704
+ filePathMap[import_path3.default.join(projectFolder, key)] = value;
15693
15705
  }
15694
15706
  parseResult.entrypoints.push({
15695
15707
  displayName: functionName,
@@ -15700,7 +15712,7 @@ ${end.comment}` : end.comment;
15700
15712
  environmentVariables,
15701
15713
  streaming,
15702
15714
  package: {
15703
- rootOverwrite: import_path2.default.join(projectFolder, functionDirectory),
15715
+ rootOverwrite: import_path3.default.join(projectFolder, functionDirectory),
15704
15716
  filePathMap
15705
15717
  }
15706
15718
  });
@@ -15726,7 +15738,7 @@ ${end.comment}` : end.comment;
15726
15738
  }
15727
15739
  };
15728
15740
  var readConfigFile = async (configFilePath) => {
15729
- if (!import_fs2.default.existsSync(configFilePath)) {
15741
+ if (!import_fs3.default.existsSync(configFilePath)) {
15730
15742
  return null;
15731
15743
  }
15732
15744
  const parsed = await parseRawConfig(configFilePath);
@@ -15771,7 +15783,7 @@ ${end.comment}` : end.comment;
15771
15783
  };
15772
15784
 
15773
15785
  // src/v4/parse.ts
15774
- var import_fs3 = __toESM(__require("fs"));
15786
+ var import_fs4 = __toESM(__require("fs"));
15775
15787
 
15776
15788
  // src/regions.ts
15777
15789
  var REGION_DEFINITIONS = [
@@ -15832,11 +15844,11 @@ ${end.comment}` : end.comment;
15832
15844
  const assets = [];
15833
15845
  if (config.assets != null) {
15834
15846
  const assetsPath = `${projectFolder}/${config.assets}`;
15835
- if (import_fs3.default.existsSync(assetsPath) && import_fs3.default.statSync(assetsPath).isDirectory()) {
15836
- for (const asset of import_fs3.default.readdirSync(`${projectFolder}/${config.assets}`, {
15847
+ if (import_fs4.default.existsSync(assetsPath) && import_fs4.default.statSync(assetsPath).isDirectory()) {
15848
+ for (const asset of import_fs4.default.readdirSync(`${projectFolder}/${config.assets}`, {
15837
15849
  recursive: true
15838
15850
  })) {
15839
- if (import_fs3.default.statSync(`${projectFolder}/${config.assets}/${asset}`).isDirectory()) {
15851
+ if (import_fs4.default.statSync(`${projectFolder}/${config.assets}/${asset}`).isDirectory()) {
15840
15852
  continue;
15841
15853
  }
15842
15854
  const disallowedExtensions = [".htaccess", ".htpasswd"];
@@ -15917,18 +15929,343 @@ ${end.comment}` : end.comment;
15917
15929
  return functionSettings;
15918
15930
  };
15919
15931
 
15920
- // src/index.ts
15921
- var schemaV4 = JSON.parse(import_fs4.default.readFileSync(import_path3.default.join(__dirname, "./v4/schema.json"), "utf8"));
15922
- var ALLOWED_CONFIG_NAMES = ["gigadrive.yaml", "gigadrive.yml", "nebula.yaml", "nebula.yml", "nebula.json"];
15923
- var findConfig = (projectFolder) => {
15924
- for (const name of ALLOWED_CONFIG_NAMES) {
15925
- const filePath = import_path3.default.join(projectFolder, name);
15926
- if (import_fs4.default.existsSync(filePath)) {
15927
- return filePath;
15932
+ // src/v4/schema.json
15933
+ var schema_default = {
15934
+ $schema: "http://json-schema.org/draft-07/schema#",
15935
+ title: "Config V4",
15936
+ description: "Configuration schema for version 4",
15937
+ type: "object",
15938
+ required: ["version"],
15939
+ properties: {
15940
+ version: {
15941
+ type: "integer",
15942
+ enum: [4],
15943
+ description: "The version of the configuration file"
15944
+ },
15945
+ presets: {
15946
+ type: ["array", "null"],
15947
+ items: {
15948
+ type: "string",
15949
+ format: "uri"
15950
+ },
15951
+ description: "A list of presets to apply to the project. Each preset will be applied in order."
15952
+ },
15953
+ assets: {
15954
+ type: ["string", "null"],
15955
+ description: "The folder which holds the assets to be deployed to the edge. Defaults to none."
15956
+ },
15957
+ populateAssetCache: {
15958
+ type: ["boolean", "null"],
15959
+ 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."
15960
+ },
15961
+ regions: {
15962
+ type: ["array", "null"],
15963
+ description: 'The regions to which the project will be deployed. Use "global" to deploy to all regions. More regions will incur higher costs.',
15964
+ items: {
15965
+ type: "string"
15966
+ }
15967
+ },
15968
+ build_commands: {
15969
+ type: ["array", "null"],
15970
+ description: "The commands to run to build the project. For example, `bun install` or `npm install`.",
15971
+ items: {
15972
+ type: "string"
15973
+ }
15974
+ },
15975
+ functions: {
15976
+ type: ["object", "null"],
15977
+ description: "The serverless functions to deploy.",
15978
+ additionalProperties: {
15979
+ type: "object",
15980
+ properties: {
15981
+ memory: {
15982
+ type: "number",
15983
+ description: "The memory in MB to allocate to the function. Defaults to 128.",
15984
+ maximum: 3009,
15985
+ minimum: 128
15986
+ },
15987
+ max_duration: {
15988
+ type: "number",
15989
+ description: "The max duration in seconds for the function after which it will be terminated. Defaults to 30.",
15990
+ maximum: 900,
15991
+ minimum: 1
15992
+ },
15993
+ runtime: {
15994
+ $ref: "#/$defs/runtimes",
15995
+ description: "The runtime to use for the function."
15996
+ },
15997
+ schedule: {
15998
+ type: "string",
15999
+ description: "An expression to schedule the function to run at specific times.",
16000
+ 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]+))?)*)[)])$"
16001
+ },
16002
+ symlinks: {
16003
+ type: "object",
16004
+ description: "A list of symbolic links to create in the function's package.",
16005
+ maxProperties: 100,
16006
+ minProperties: 1,
16007
+ patternProperties: {
16008
+ "^.{1,256}$": {
16009
+ type: "string",
16010
+ maxLength: 256
16011
+ }
16012
+ },
16013
+ additionalProperties: false
16014
+ },
16015
+ excludeFiles: {
16016
+ oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
16017
+ 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."
16018
+ },
16019
+ includeFiles: {
16020
+ oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
16021
+ 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."
16022
+ }
16023
+ }
16024
+ }
16025
+ },
16026
+ env: {
16027
+ type: "object",
16028
+ maxProperties: 100,
16029
+ minProperties: 0,
16030
+ patternProperties: {
16031
+ ".+": {
16032
+ maxLength: 65536,
16033
+ minLength: 0,
16034
+ type: "string"
16035
+ }
16036
+ },
16037
+ additionalProperties: false,
16038
+ description: "Additional environment variables to set during runtime and build."
16039
+ },
16040
+ routes: {
16041
+ type: ["array", "null"],
16042
+ description: "A list of route definitions.",
16043
+ maxItems: 1024,
16044
+ items: {
16045
+ type: "object",
16046
+ required: ["source", "destination"],
16047
+ properties: {
16048
+ source: {
16049
+ description: "A pattern that matches each incoming pathname (excluding querystring).",
16050
+ type: "string",
16051
+ maxLength: 4096
16052
+ },
16053
+ destination: {
16054
+ description: "An absolute pathname to an existing resource or an external URL.",
16055
+ type: "string",
16056
+ maxLength: 4096
16057
+ },
16058
+ has: {
16059
+ $ref: "#/$defs/matchRequirements"
16060
+ },
16061
+ missing: {
16062
+ $ref: "#/$defs/matchRequirements"
16063
+ },
16064
+ statusCode: {
16065
+ description: "An optional integer to override the status code of the response.",
16066
+ type: "integer",
16067
+ minimum: 100,
16068
+ maximum: 999
16069
+ },
16070
+ redirect: {
16071
+ type: "boolean",
16072
+ description: "An optional boolean to force a redirect response."
16073
+ },
16074
+ methods: {
16075
+ type: "array",
16076
+ description: "The HTTP methods to match for the route. Defaults to all methods.",
16077
+ items: {
16078
+ type: "string",
16079
+ enum: ["ANY", "GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]
16080
+ }
16081
+ },
16082
+ headers: {
16083
+ type: "object",
16084
+ description: "Additional headers to add to the response.",
16085
+ additionalProperties: {
16086
+ type: "string"
16087
+ }
16088
+ }
16089
+ }
16090
+ }
16091
+ },
16092
+ services: {
16093
+ type: "object",
16094
+ description: "Optionally, specify additional services like databases to deploy.",
16095
+ properties: {
16096
+ redis: {
16097
+ oneOf: [
16098
+ {
16099
+ type: "null"
16100
+ },
16101
+ {
16102
+ type: "object",
16103
+ properties: {
16104
+ envBindings: {
16105
+ type: "object",
16106
+ 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.",
16107
+ additionalProperties: false,
16108
+ properties: {
16109
+ url: { type: "string" },
16110
+ host: { type: "string" },
16111
+ port: { type: "string" },
16112
+ password: { type: "string" },
16113
+ db: { type: "string" },
16114
+ ssl: { type: "string" }
16115
+ }
16116
+ },
16117
+ primaryRegion: {
16118
+ type: "string",
16119
+ description: "The primary region to deploy the Redis instance to.",
16120
+ enum: [
16121
+ "us-east-1",
16122
+ "us-east-2",
16123
+ "us-west-1",
16124
+ "us-west-2",
16125
+ "eu-central-1",
16126
+ "eu-west-1",
16127
+ "eu-west-2",
16128
+ "sa-east-1",
16129
+ "ap-south-1",
16130
+ "ap-northeast-1",
16131
+ "ap-southeast-1",
16132
+ "ap-southeast-2",
16133
+ "us-central1"
16134
+ ]
16135
+ },
16136
+ readRegions: {
16137
+ type: "array",
16138
+ description: "Optionally, add additional regions to read from. More regions will incur higher costs.",
16139
+ items: {
16140
+ type: "string",
16141
+ enum: [
16142
+ "us-east-1",
16143
+ "us-east-2",
16144
+ "us-west-1",
16145
+ "us-west-2",
16146
+ "eu-central-1",
16147
+ "eu-west-1",
16148
+ "eu-west-2",
16149
+ "sa-east-1",
16150
+ "ap-south-1",
16151
+ "ap-northeast-1",
16152
+ "ap-southeast-1",
16153
+ "ap-southeast-2"
16154
+ ]
16155
+ }
16156
+ },
16157
+ eviction: {
16158
+ type: "boolean",
16159
+ description: "Optionally, enable Redis eviction. This will evict the least recently used keys in order to make space for new ones."
16160
+ }
16161
+ }
16162
+ }
16163
+ ]
16164
+ },
16165
+ postgres: {
16166
+ oneOf: [
16167
+ {
16168
+ type: "null"
16169
+ },
16170
+ {
16171
+ type: "object",
16172
+ properties: {
16173
+ envBindings: {
16174
+ type: "object",
16175
+ 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.",
16176
+ additionalProperties: false,
16177
+ properties: {
16178
+ url: { type: "string" },
16179
+ host: { type: "string" },
16180
+ port: { type: "string" },
16181
+ user: { type: "string" },
16182
+ password: { type: "string" },
16183
+ database: { type: "string" }
16184
+ }
16185
+ },
16186
+ postgresVersion: {
16187
+ type: "string",
16188
+ description: "The version of Postgres to deploy.",
16189
+ enum: ["17", "16", "15", "14"]
16190
+ },
16191
+ region: {
16192
+ type: "string",
16193
+ description: "The region to deploy the Postgres instance to.",
16194
+ enum: [
16195
+ "us-east-1",
16196
+ "us-east-2",
16197
+ "us-west-2",
16198
+ "ap-southeast-1",
16199
+ "ap-southeast-2",
16200
+ "eu-central-1",
16201
+ "eu-west-2",
16202
+ "sa-east-1"
16203
+ ]
16204
+ }
16205
+ }
16206
+ }
16207
+ ]
16208
+ }
16209
+ }
16210
+ }
16211
+ },
16212
+ $defs: {
16213
+ runtimes: {
16214
+ type: "string",
16215
+ enum: ["php-83", "php-82", "php-81", "php-80", "node-20", "node-18", "node-16", "bun-1"]
16216
+ },
16217
+ matchRequirements: {
16218
+ description: "An array of requirements that are needed to match",
16219
+ type: "array",
16220
+ maxItems: 16,
16221
+ items: {
16222
+ anyOf: [
16223
+ {
16224
+ type: "object",
16225
+ additionalProperties: false,
16226
+ required: ["type", "value"],
16227
+ properties: {
16228
+ type: {
16229
+ description: "The type of request element to check",
16230
+ type: "string",
16231
+ enum: ["host"]
16232
+ },
16233
+ value: {
16234
+ description: "A regular expression used to match the value. Named groups can be used in the destination",
16235
+ type: "string",
16236
+ maxLength: 4096
16237
+ }
16238
+ }
16239
+ },
16240
+ {
16241
+ type: "object",
16242
+ additionalProperties: false,
16243
+ required: ["type", "key"],
16244
+ properties: {
16245
+ type: {
16246
+ description: "The type of request element to check",
16247
+ type: "string",
16248
+ enum: ["header", "cookie", "query"]
16249
+ },
16250
+ key: {
16251
+ description: "The name of the element contained in the particular type",
16252
+ type: "string",
16253
+ maxLength: 4096
16254
+ },
16255
+ value: {
16256
+ description: "A regular expression used to match the value. Named groups can be used in the destination",
16257
+ type: "string",
16258
+ maxLength: 4096
16259
+ }
16260
+ }
16261
+ }
16262
+ ]
16263
+ }
15928
16264
  }
15929
16265
  }
15930
- return null;
15931
16266
  };
16267
+
16268
+ // src/parse-config.ts
15932
16269
  var parseConfig = async (filePath, projectFolder) => {
15933
16270
  const parsed = await parseRawConfig(filePath);
15934
16271
  const version = parsed.version;
@@ -15936,7 +16273,7 @@ ${end.comment}` : end.comment;
15936
16273
  /*1: schemaV1,
15937
16274
  2: schemaV2,
15938
16275
  3: schemaV3,*/
15939
- 4: schemaV4
16276
+ 4: schema_default
15940
16277
  };
15941
16278
  const relativePath = filePath.replace("/tmp/unzipped/", "");
15942
16279
  const schema = schemaMap[version];
@@ -15967,5 +16304,18 @@ ${end.comment}` : end.comment;
15967
16304
  }
15968
16305
  return parseResult;
15969
16306
  };
16307
+
16308
+ // src/runtime.ts
16309
+ var RUNTIME_DEFINITIONS = [
16310
+ "php-84",
16311
+ "php-83",
16312
+ "php-81",
16313
+ "node-22",
16314
+ "node-20",
16315
+ "node-18",
16316
+ "node-16",
16317
+ "bun-1"
16318
+ ];
16319
+ var AVAILABLE_RUNTIMES = [...RUNTIME_DEFINITIONS];
15970
16320
  })();
15971
16321
  //# sourceMappingURL=index.js.map