@vercel/config 0.0.31 → 0.0.32

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/router.d.ts CHANGED
@@ -173,6 +173,12 @@ export interface Condition extends ConditionOperators {
173
173
  */
174
174
  value?: string;
175
175
  }
176
+ export declare const matchers: {
177
+ header: (key: string, value?: string | ConditionOperators) => Condition;
178
+ cookie: (key: string, value?: string | ConditionOperators) => Condition;
179
+ query: (key: string, value?: string | ConditionOperators) => Condition;
180
+ host: (value: string | ConditionOperators) => Condition;
181
+ };
176
182
  /**
177
183
  * Transform type specifies the scope of what the transform will apply to.
178
184
  * - 'request.query': Transform query parameters in the request
package/dist/router.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.routes = exports.createRoutes = exports.Router = exports.deploymentEnv = void 0;
3
+ exports.routes = exports.createRoutes = exports.Router = exports.matchers = exports.deploymentEnv = void 0;
4
4
  const pretty_cache_header_1 = require("pretty-cache-header");
5
5
  const validation_1 = require("./utils/validation");
6
6
  /**
@@ -21,6 +21,31 @@ function deploymentEnv(name) {
21
21
  return `$${name}`;
22
22
  }
23
23
  exports.deploymentEnv = deploymentEnv;
24
+ function createKeyedConditionHelper(type) {
25
+ return (key, value) => {
26
+ if (value === undefined) {
27
+ return { type, key };
28
+ }
29
+ if (typeof value === 'string') {
30
+ return { type, key, value };
31
+ }
32
+ return { type, key, ...value };
33
+ };
34
+ }
35
+ function createKeylessConditionHelper(type) {
36
+ return (value) => {
37
+ if (typeof value === 'string') {
38
+ return { type, value };
39
+ }
40
+ return { type, ...value };
41
+ };
42
+ }
43
+ exports.matchers = {
44
+ header: createKeyedConditionHelper('header'),
45
+ cookie: createKeyedConditionHelper('cookie'),
46
+ query: createKeyedConditionHelper('query'),
47
+ host: createKeylessConditionHelper('host'),
48
+ };
24
49
  /**
25
50
  * Extract environment variable names from a string or array of strings
26
51
  * Returns env var names without the $ prefix, excluding path parameters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/config",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "A TypeScript SDK for programmatically configuring Vercel projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://vercel.com/docs/projects/project-configuration",