netlify-cli 20.0.2 → 20.0.4
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/commands/base-command.d.ts +8 -0
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/build/index.d.ts.map +1 -1
- package/dist/commands/build/index.js +6 -2
- package/dist/commands/build/index.js.map +1 -1
- package/dist/commands/deploy/deploy.d.ts +2 -2
- package/dist/commands/deploy/deploy.d.ts.map +1 -1
- package/dist/commands/deploy/deploy.js +16 -34
- package/dist/commands/deploy/deploy.js.map +1 -1
- package/dist/commands/deploy/index.d.ts.map +1 -1
- package/dist/commands/deploy/index.js +9 -2
- package/dist/commands/deploy/index.js.map +1 -1
- package/dist/commands/deploy/option_values.d.ts +19 -0
- package/dist/commands/deploy/option_values.d.ts.map +1 -0
- package/dist/commands/deploy/option_values.js +3 -0
- package/dist/commands/deploy/option_values.js.map +1 -0
- package/dist/commands/dev/index.d.ts.map +1 -1
- package/dist/commands/dev/index.js +4 -2
- package/dist/commands/dev/index.js.map +1 -1
- package/dist/commands/dev-exec/index.d.ts.map +1 -1
- package/dist/commands/dev-exec/index.js +6 -2
- package/dist/commands/dev-exec/index.js.map +1 -1
- package/dist/commands/env/env-get.d.ts.map +1 -1
- package/dist/commands/env/env-get.js +3 -2
- package/dist/commands/env/env-get.js.map +1 -1
- package/dist/commands/env/env-list.js +2 -2
- package/dist/commands/env/env-set.js +5 -5
- package/dist/commands/env/env-set.js.map +1 -1
- package/dist/commands/env/env-unset.js +3 -3
- package/dist/commands/env/env.js +9 -9
- package/dist/commands/env/env.js.map +1 -1
- package/dist/commands/serve/index.d.ts.map +1 -1
- package/dist/commands/serve/index.js +8 -2
- package/dist/commands/serve/index.js.map +1 -1
- package/dist/lib/account.d.ts +2 -5
- package/dist/lib/account.d.ts.map +1 -1
- package/dist/lib/account.js +0 -11
- package/dist/lib/account.js.map +1 -1
- package/dist/lib/build.d.ts +1 -1
- package/dist/lib/build.d.ts.map +1 -1
- package/dist/lib/completion/get-autocompletion.d.ts +11 -11
- package/dist/lib/completion/get-autocompletion.d.ts.map +1 -1
- package/dist/lib/completion/get-autocompletion.js +1 -15
- package/dist/lib/completion/get-autocompletion.js.map +1 -1
- package/dist/lib/edge-functions/proxy.d.ts +6 -2
- package/dist/lib/edge-functions/proxy.d.ts.map +1 -1
- package/dist/lib/edge-functions/proxy.js.map +1 -1
- package/dist/lib/functions/runtimes/go/index.d.ts.map +1 -1
- package/dist/lib/functions/runtimes/go/index.js +1 -1
- package/dist/lib/functions/runtimes/go/index.js.map +1 -1
- package/dist/lib/functions/server.d.ts +1 -1
- package/dist/lib/functions/server.d.ts.map +1 -1
- package/dist/lib/geo-location.d.ts +15 -30
- package/dist/lib/geo-location.d.ts.map +1 -1
- package/dist/lib/geo-location.js +4 -28
- package/dist/lib/geo-location.js.map +1 -1
- package/dist/lib/http-agent.d.ts +14 -10
- package/dist/lib/http-agent.d.ts.map +1 -1
- package/dist/lib/http-agent.js +1 -2
- package/dist/lib/http-agent.js.map +1 -1
- package/dist/lib/images/proxy.d.ts +1 -1
- package/dist/lib/images/proxy.d.ts.map +1 -1
- package/dist/lib/images/proxy.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/copy-template-dir/copy-template-dir.d.ts.map +1 -1
- package/dist/utils/copy-template-dir/copy-template-dir.js +0 -4
- package/dist/utils/copy-template-dir/copy-template-dir.js.map +1 -1
- package/dist/utils/deploy/deploy-site.d.ts.map +1 -1
- package/dist/utils/deploy/deploy-site.js +1 -1
- package/dist/utils/deploy/deploy-site.js.map +1 -1
- package/dist/utils/deploy/hash-files.d.ts +8 -7
- package/dist/utils/deploy/hash-files.d.ts.map +1 -1
- package/dist/utils/deploy/hash-files.js +1 -11
- package/dist/utils/deploy/hash-files.js.map +1 -1
- package/dist/utils/deploy/hash-fns.d.ts +17 -8
- package/dist/utils/deploy/hash-fns.d.ts.map +1 -1
- package/dist/utils/deploy/hash-fns.js +3 -4
- package/dist/utils/deploy/hash-fns.js.map +1 -1
- package/dist/utils/deploy/upload-files.d.ts.map +1 -1
- package/dist/utils/deploy/upload-files.js +1 -1
- package/dist/utils/deploy/upload-files.js.map +1 -1
- package/dist/utils/deploy/util.d.ts +1 -1
- package/dist/utils/deploy/util.d.ts.map +1 -1
- package/dist/utils/deploy/util.js +0 -1
- package/dist/utils/deploy/util.js.map +1 -1
- package/dist/utils/dev.d.ts +13 -1
- package/dist/utils/dev.d.ts.map +1 -1
- package/dist/utils/dev.js +2 -5
- package/dist/utils/dev.js.map +1 -1
- package/dist/utils/env/index.d.ts +118 -54
- package/dist/utils/env/index.d.ts.map +1 -1
- package/dist/utils/env/index.js +94 -71
- package/dist/utils/env/index.js.map +1 -1
- package/dist/utils/feature-flags.d.ts +6 -3
- package/dist/utils/feature-flags.d.ts.map +1 -1
- package/dist/utils/feature-flags.js.map +1 -1
- package/dist/utils/proxy-server.d.ts +1 -1
- package/dist/utils/proxy-server.d.ts.map +1 -1
- package/dist/utils/read-repo-url.d.ts +7 -7
- package/dist/utils/read-repo-url.d.ts.map +1 -1
- package/dist/utils/read-repo-url.js +17 -26
- package/dist/utils/read-repo-url.js.map +1 -1
- package/dist/utils/rules-proxy.d.ts +1 -1
- package/dist/utils/rules-proxy.d.ts.map +1 -1
- package/dist/utils/rules-proxy.js +3 -2
- package/dist/utils/rules-proxy.js.map +1 -1
- package/dist/utils/temporary-file.d.ts +7 -0
- package/dist/utils/temporary-file.d.ts.map +1 -0
- package/dist/utils/temporary-file.js +16 -0
- package/dist/utils/temporary-file.js.map +1 -0
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/npm-shrinkwrap.json +50 -189
- package/package.json +9 -7
|
@@ -1,34 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const AVAILABLE_SCOPES: string[];
|
|
1
|
+
import type { NetlifyAPI } from 'netlify';
|
|
2
|
+
import type { SiteInfo, EnvironmentVariableSource } from '../../utils/types.js';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Supported values for the user-provided env `context` option.
|
|
5
|
+
* These all match possible `context` values returned by the Envelope API.
|
|
6
|
+
* Note that a user may also specify a branch name with the special `branch:my-branch-name` format.
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const SUPPORTED_CONTEXTS: readonly ["all", "production", "deploy-preview", "branch-deploy", "dev"];
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @returns {object<context: enum<dev,branch-deploy,deploy-preview,production,branch>, context_parameter: <string>, value: string>} The matching environment variable value object
|
|
10
|
+
* Supported values for the user-provided env `scope` option.
|
|
11
|
+
* These exactly match possible `scope` values returned by the Envelope API.
|
|
12
|
+
* Note that `any` is also supported.
|
|
14
13
|
*/
|
|
15
|
-
export declare const
|
|
14
|
+
export declare const ALL_ENVELOPE_SCOPES: readonly ["builds", "functions", "runtime", "post_processing"];
|
|
15
|
+
type EnvelopeEnvVarScope = Exclude<NonNullable<Awaited<ReturnType<NetlifyAPI['getEnvVars']>>[number]['scopes']>[number], 'post-processing'> | 'post_processing';
|
|
16
|
+
type EnvelopeEnvVar = Awaited<ReturnType<NetlifyAPI['getEnvVars']>>[number] & {
|
|
17
|
+
scopes: EnvelopeEnvVarScope[];
|
|
18
|
+
};
|
|
19
|
+
type EnvelopeEnvVarContext = NonNullable<NonNullable<EnvelopeEnvVar['values']>[number]['context']>;
|
|
20
|
+
export type EnvelopeEnvVarValue = {
|
|
21
|
+
/**
|
|
22
|
+
* The deploy context of the this env var value
|
|
23
|
+
*/
|
|
24
|
+
context?: EnvelopeEnvVarContext;
|
|
25
|
+
/**
|
|
26
|
+
* For parameterized contexts (i.e. only `branch`), context parameter (i.e. the branch name)
|
|
27
|
+
*/
|
|
28
|
+
context_parameter?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The value of the environment variable for this context. Note that this appears to be an empty string
|
|
31
|
+
* when the env var is not set for this context.
|
|
32
|
+
*/
|
|
33
|
+
value?: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
export type EnvelopeItem = {
|
|
36
|
+
key: string;
|
|
37
|
+
scopes: EnvelopeEnvVarScope[];
|
|
38
|
+
values: EnvelopeEnvVarValue[];
|
|
39
|
+
};
|
|
40
|
+
type SupportedScope = EnvelopeEnvVarScope | 'post_processing' | 'any';
|
|
41
|
+
type ContextOrBranch = string;
|
|
42
|
+
/**
|
|
43
|
+
* Normalizes a user-provided "context". Note that this may be the special `branch:my-branch-name` format.
|
|
44
|
+
*
|
|
45
|
+
* - If this is a supported alias of a context, it will be normalized to the canonical context.
|
|
46
|
+
* - Valid canonical contexts are returned as is.
|
|
47
|
+
* - If this starts with `branch:`, it will be normalized to the branch name.
|
|
48
|
+
*
|
|
49
|
+
* @param context A user-provided context, context alias, or a string in the `branch:my-branch-name` format.
|
|
50
|
+
*
|
|
51
|
+
* @returns The normalized context name or just the branch name
|
|
52
|
+
*/
|
|
53
|
+
export declare const normalizeContext: (context: string) => ContextOrBranch;
|
|
54
|
+
/**
|
|
55
|
+
* Finds a matching environment variable value for a given context
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
export declare const getValueForContext: (
|
|
59
|
+
/**
|
|
60
|
+
* An array of environment variable values from Envelope
|
|
61
|
+
*/
|
|
62
|
+
values: EnvelopeEnvVarValue[],
|
|
63
|
+
/**
|
|
64
|
+
* The deploy context or branch of the environment variable value
|
|
65
|
+
*/
|
|
66
|
+
contextOrBranch: ContextOrBranch) => EnvelopeEnvVarValue | undefined;
|
|
16
67
|
/**
|
|
17
68
|
* Finds environment variables that match a given source
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
69
|
+
* @param env - The dictionary of environment variables
|
|
70
|
+
* @param source - The source of the environment variable
|
|
71
|
+
* @returns The dictionary of env vars that match the given source
|
|
21
72
|
*/
|
|
22
|
-
export declare const filterEnvBySource: (env:
|
|
23
|
-
[k: string]: unknown;
|
|
24
|
-
};
|
|
73
|
+
export declare const filterEnvBySource: (env: object, source: EnvironmentVariableSource) => typeof env;
|
|
25
74
|
/**
|
|
26
75
|
* Filters and sorts data from Envelope by a given context and/or scope
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @returns
|
|
76
|
+
* @param context - The deploy context or branch of the environment variable value
|
|
77
|
+
* @param envelopeItems - An array of environment variables from the Envelope service
|
|
78
|
+
* @param scope - The scope of the environment variables
|
|
79
|
+
* @param source - The source of the environment variable
|
|
80
|
+
* @returns A dicionary in the following format:
|
|
32
81
|
* {
|
|
33
82
|
* FOO: {
|
|
34
83
|
* context: 'dev',
|
|
@@ -46,55 +95,70 @@ export declare const filterEnvBySource: (env: any, source: any) => {
|
|
|
46
95
|
* }
|
|
47
96
|
*/
|
|
48
97
|
export declare const formatEnvelopeData: ({ context, envelopeItems, scope, source, }: {
|
|
49
|
-
context?:
|
|
50
|
-
envelopeItems:
|
|
51
|
-
scope?:
|
|
98
|
+
context?: ContextOrBranch;
|
|
99
|
+
envelopeItems: EnvelopeItem[];
|
|
100
|
+
scope?: SupportedScope;
|
|
52
101
|
source: string;
|
|
53
|
-
}) =>
|
|
102
|
+
}) => Record<string, {
|
|
103
|
+
context: ContextOrBranch;
|
|
104
|
+
branch: string | undefined;
|
|
105
|
+
scopes: string[];
|
|
106
|
+
sources: string[];
|
|
107
|
+
value: string;
|
|
108
|
+
}>;
|
|
54
109
|
/**
|
|
55
110
|
* Collects env vars from multiple sources and arranges them in the correct order of precedence
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @returns
|
|
111
|
+
* @param opts.api The api singleton object
|
|
112
|
+
* @param opts.context The deploy context or branch of the environment variable
|
|
113
|
+
* @param opts.env The dictionary of environment variables
|
|
114
|
+
* @param opts.key If present, fetch a single key (case-sensitive)
|
|
115
|
+
* @param opts.raw Return a dictionary of raw key/value pairs for only the account and site sources
|
|
116
|
+
* @param opts.scope The scope of the environment variables
|
|
117
|
+
* @param opts.siteInfo The site object
|
|
118
|
+
* @returns An object of environment variables keys and their metadata
|
|
64
119
|
*/
|
|
65
|
-
export declare const getEnvelopeEnv: ({ api, context, env, key, raw, scope, siteInfo }: {
|
|
66
|
-
api:
|
|
67
|
-
context?:
|
|
68
|
-
env:
|
|
120
|
+
export declare const getEnvelopeEnv: ({ api, context, env, key, raw, scope, siteInfo, }: {
|
|
121
|
+
api: NetlifyAPI;
|
|
122
|
+
context?: ContextOrBranch | undefined;
|
|
123
|
+
env: object;
|
|
69
124
|
key?: string | undefined;
|
|
70
125
|
raw?: boolean | undefined;
|
|
71
|
-
scope?:
|
|
72
|
-
siteInfo:
|
|
73
|
-
}) => Promise<
|
|
126
|
+
scope?: SupportedScope | undefined;
|
|
127
|
+
siteInfo: SiteInfo;
|
|
128
|
+
}) => Promise<{}>;
|
|
74
129
|
/**
|
|
75
130
|
* Returns a human-readable, comma-separated list of scopes
|
|
76
|
-
* @param
|
|
77
|
-
* @returns
|
|
131
|
+
* @param scopes An array of scopes
|
|
132
|
+
* @returns A human-readable, comma-separated list of scopes
|
|
78
133
|
*/
|
|
79
|
-
export declare const getHumanReadableScopes: (scopes
|
|
134
|
+
export declare const getHumanReadableScopes: (scopes?: EnvelopeEnvVarScope[]) => string;
|
|
80
135
|
/**
|
|
81
136
|
* Translates a Mongo env into an Envelope env
|
|
82
|
-
* @param
|
|
83
|
-
* @returns
|
|
137
|
+
* @param env The site's env as it exists in Mongo
|
|
138
|
+
* @returns The array of Envelope env vars
|
|
84
139
|
*/
|
|
85
|
-
export declare const translateFromMongoToEnvelope: (env?:
|
|
140
|
+
export declare const translateFromMongoToEnvelope: (env?: Record<string, string>) => {
|
|
86
141
|
key: string;
|
|
87
|
-
scopes:
|
|
142
|
+
scopes: readonly ["builds", "functions", "runtime", "post_processing"];
|
|
88
143
|
values: {
|
|
89
|
-
context:
|
|
90
|
-
value:
|
|
144
|
+
context: "all";
|
|
145
|
+
value: string;
|
|
91
146
|
}[];
|
|
92
147
|
}[];
|
|
93
148
|
/**
|
|
94
149
|
* Translates an Envelope env into a Mongo env
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
97
|
-
* @returns
|
|
150
|
+
* @param envVars The array of Envelope env vars
|
|
151
|
+
* @param context The deploy context or branch of the environment variable
|
|
152
|
+
* @returns The env object as compatible with Mongo
|
|
98
153
|
*/
|
|
99
|
-
export declare const translateFromEnvelopeToMongo: (envVars?:
|
|
154
|
+
export declare const translateFromEnvelopeToMongo: (envVars?: {
|
|
155
|
+
key: string;
|
|
156
|
+
scopes: string[];
|
|
157
|
+
values: {
|
|
158
|
+
context: string;
|
|
159
|
+
value: string;
|
|
160
|
+
context_parameter?: string | undefined;
|
|
161
|
+
}[];
|
|
162
|
+
}[], context?: string) => {};
|
|
163
|
+
export {};
|
|
100
164
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/env/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/env/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGzC,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,0EAA2E,CAAA;AAQ1G;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,gEAAiE,CAAA;AAGjG,KAAK,mBAAmB,GACpB,OAAO,CAAC,W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AAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,EAAE,CAAA;CACrF,EAAO,EACR,gBAAe,OAaP,CAAA"}
|
package/dist/utils/env/index.js
CHANGED
|
@@ -1,58 +1,81 @@
|
|
|
1
1
|
import { logAndThrowError } from '../command-helpers.js';
|
|
2
|
-
export const AVAILABLE_CONTEXTS = ['all', 'production', 'deploy-preview', 'branch-deploy', 'dev'];
|
|
3
|
-
export const AVAILABLE_SCOPES = ['builds', 'functions', 'runtime', 'post_processing'];
|
|
4
2
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Supported values for the user-provided env `context` option.
|
|
4
|
+
* These all match possible `context` values returned by the Envelope API.
|
|
5
|
+
* Note that a user may also specify a branch name with the special `branch:my-branch-name` format.
|
|
6
|
+
*/
|
|
7
|
+
export const SUPPORTED_CONTEXTS = ['all', 'production', 'deploy-preview', 'branch-deploy', 'dev'];
|
|
8
|
+
/**
|
|
9
|
+
* Additional aliases for the user-provided env `context` option.
|
|
10
|
+
*/
|
|
11
|
+
const SUPPORTED_CONTEXT_ALIASES = {
|
|
12
|
+
dp: 'deploy-preview',
|
|
13
|
+
prod: 'production',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Supported values for the user-provided env `scope` option.
|
|
17
|
+
* These exactly match possible `scope` values returned by the Envelope API.
|
|
18
|
+
* Note that `any` is also supported.
|
|
19
|
+
*/
|
|
20
|
+
export const ALL_ENVELOPE_SCOPES = ['builds', 'functions', 'runtime', 'post_processing'];
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes a user-provided "context". Note that this may be the special `branch:my-branch-name` format.
|
|
23
|
+
*
|
|
24
|
+
* - If this is a supported alias of a context, it will be normalized to the canonical context.
|
|
25
|
+
* - Valid canonical contexts are returned as is.
|
|
26
|
+
* - If this starts with `branch:`, it will be normalized to the branch name.
|
|
27
|
+
*
|
|
28
|
+
* @param context A user-provided context, context alias, or a string in the `branch:my-branch-name` format.
|
|
29
|
+
*
|
|
30
|
+
* @returns The normalized context name or just the branch name
|
|
7
31
|
*/
|
|
8
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'context' implicitly has an 'any' type.
|
|
9
32
|
export const normalizeContext = (context) => {
|
|
10
33
|
if (!context) {
|
|
11
34
|
return context;
|
|
12
35
|
}
|
|
13
|
-
const CONTEXT_SYNONYMS = {
|
|
14
|
-
dp: 'deploy-preview',
|
|
15
|
-
prod: 'production',
|
|
16
|
-
};
|
|
17
36
|
context = context.toLowerCase();
|
|
18
|
-
if (context in
|
|
19
|
-
|
|
20
|
-
context = CONTEXT_SYNONYMS[context];
|
|
37
|
+
if (context in SUPPORTED_CONTEXT_ALIASES) {
|
|
38
|
+
context = SUPPORTED_CONTEXT_ALIASES[context];
|
|
21
39
|
}
|
|
22
|
-
const forbiddenContexts =
|
|
40
|
+
const forbiddenContexts = SUPPORTED_CONTEXTS.map((ctx) => `branch:${ctx}`);
|
|
23
41
|
if (forbiddenContexts.includes(context)) {
|
|
24
42
|
return logAndThrowError(`The context ${context} includes a reserved keyword and is not allowed`);
|
|
25
43
|
}
|
|
26
|
-
|
|
27
|
-
return context;
|
|
44
|
+
return context.replace(/^branch:/, '');
|
|
28
45
|
};
|
|
29
46
|
/**
|
|
30
|
-
* Finds a matching environment variable value
|
|
31
|
-
* @
|
|
32
|
-
* @param {string} context - The deploy context or branch of the environment variable value
|
|
33
|
-
* @returns {object<context: enum<dev,branch-deploy,deploy-preview,production,branch>, context_parameter: <string>, value: string>} The matching environment variable value object
|
|
47
|
+
* Finds a matching environment variable value for a given context
|
|
48
|
+
* @private
|
|
34
49
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
export const getValueForContext = (
|
|
51
|
+
/**
|
|
52
|
+
* An array of environment variable values from Envelope
|
|
53
|
+
*/
|
|
54
|
+
values,
|
|
55
|
+
/**
|
|
56
|
+
* The deploy context or branch of the environment variable value
|
|
57
|
+
*/
|
|
58
|
+
contextOrBranch) => {
|
|
59
|
+
const isSupportedContext = SUPPORTED_CONTEXTS.includes(contextOrBranch);
|
|
60
|
+
if (!isSupportedContext) {
|
|
61
|
+
const valueMatchingAsBranch = values.find((val) => val.context_parameter === contextOrBranch);
|
|
62
|
+
// This is a `branch` context, which is an override, so it takes precedence
|
|
63
|
+
if (valueMatchingAsBranch != null) {
|
|
64
|
+
return valueMatchingAsBranch;
|
|
65
|
+
}
|
|
66
|
+
const valueMatchingContext = values.find((val) => val.context === 'all' || val.context === 'branch-deploy');
|
|
67
|
+
return valueMatchingContext ?? undefined;
|
|
42
68
|
}
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
const valueMatchingAsContext = values.find((val) => val.context === 'all' || val.context === contextOrBranch);
|
|
70
|
+
return valueMatchingAsContext ?? undefined;
|
|
71
|
+
};
|
|
45
72
|
/**
|
|
46
73
|
* Finds environment variables that match a given source
|
|
47
|
-
* @param
|
|
48
|
-
* @param
|
|
49
|
-
* @returns
|
|
74
|
+
* @param env - The dictionary of environment variables
|
|
75
|
+
* @param source - The source of the environment variable
|
|
76
|
+
* @returns The dictionary of env vars that match the given source
|
|
50
77
|
*/
|
|
51
|
-
|
|
52
|
-
export const filterEnvBySource = (env, source) =>
|
|
53
|
-
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
54
|
-
Object.fromEntries(Object.entries(env).filter(([, variable]) => variable.sources[0] === source));
|
|
55
|
-
// Fetches data from Envelope
|
|
78
|
+
export const filterEnvBySource = (env, source) => Object.fromEntries(Object.entries(env).filter(([, variable]) => variable.sources[0] === source));
|
|
56
79
|
const fetchEnvelopeItems = async function ({ accountId, api, key, siteId, }) {
|
|
57
80
|
if (accountId === undefined) {
|
|
58
81
|
return [];
|
|
@@ -61,10 +84,12 @@ const fetchEnvelopeItems = async function ({ accountId, api, key, siteId, }) {
|
|
|
61
84
|
// if a single key is passed, fetch that single env var
|
|
62
85
|
if (key) {
|
|
63
86
|
const envelopeItem = await api.getEnvVar({ accountId, key, siteId });
|
|
87
|
+
// See FIXME(serhalp) above
|
|
64
88
|
return [envelopeItem];
|
|
65
89
|
}
|
|
66
90
|
// otherwise, fetch the entire list of env vars
|
|
67
91
|
const envelopeItems = await api.getEnvVars({ accountId, siteId });
|
|
92
|
+
// See FIXME(serhalp) above
|
|
68
93
|
return envelopeItems;
|
|
69
94
|
}
|
|
70
95
|
catch {
|
|
@@ -75,11 +100,11 @@ const fetchEnvelopeItems = async function ({ accountId, api, key, siteId, }) {
|
|
|
75
100
|
};
|
|
76
101
|
/**
|
|
77
102
|
* Filters and sorts data from Envelope by a given context and/or scope
|
|
78
|
-
* @param
|
|
79
|
-
* @param
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
82
|
-
* @returns
|
|
103
|
+
* @param context - The deploy context or branch of the environment variable value
|
|
104
|
+
* @param envelopeItems - An array of environment variables from the Envelope service
|
|
105
|
+
* @param scope - The scope of the environment variables
|
|
106
|
+
* @param source - The source of the environment variable
|
|
107
|
+
* @returns A dicionary in the following format:
|
|
83
108
|
* {
|
|
84
109
|
* FOO: {
|
|
85
110
|
* context: 'dev',
|
|
@@ -98,18 +123,22 @@ const fetchEnvelopeItems = async function ({ accountId, api, key, siteId, }) {
|
|
|
98
123
|
*/
|
|
99
124
|
export const formatEnvelopeData = ({ context = 'dev', envelopeItems = [], scope = 'any', source, }) => envelopeItems
|
|
100
125
|
// filter by context
|
|
101
|
-
.filter(({ values }) => Boolean(
|
|
126
|
+
.filter(({ values }) => Boolean(getValueForContext(values, context)))
|
|
102
127
|
// filter by scope
|
|
103
128
|
.filter(({ scopes }) => (scope === 'any' ? true : scopes.includes(scope)))
|
|
104
129
|
// sort alphabetically, case insensitive
|
|
105
130
|
.sort((left, right) => (left.key.toLowerCase() < right.key.toLowerCase() ? -1 : 1))
|
|
106
131
|
// format the data
|
|
107
132
|
.reduce((acc, cur) => {
|
|
108
|
-
const
|
|
133
|
+
const val = getValueForContext(cur.values, context);
|
|
134
|
+
if (val === undefined) {
|
|
135
|
+
throw new TypeError(`failed to locate environment variable value for ${context} context`);
|
|
136
|
+
}
|
|
137
|
+
const { context: itemContext, context_parameter: branch, value } = val;
|
|
109
138
|
return {
|
|
110
139
|
...acc,
|
|
111
140
|
[cur.key]: {
|
|
112
|
-
context:
|
|
141
|
+
context: itemContext,
|
|
113
142
|
branch,
|
|
114
143
|
scopes: cur.scopes,
|
|
115
144
|
sources: [source],
|
|
@@ -119,20 +148,18 @@ export const formatEnvelopeData = ({ context = 'dev', envelopeItems = [], scope
|
|
|
119
148
|
}, {});
|
|
120
149
|
/**
|
|
121
150
|
* Collects env vars from multiple sources and arranges them in the correct order of precedence
|
|
122
|
-
* @param
|
|
123
|
-
* @param
|
|
124
|
-
* @param
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @returns
|
|
151
|
+
* @param opts.api The api singleton object
|
|
152
|
+
* @param opts.context The deploy context or branch of the environment variable
|
|
153
|
+
* @param opts.env The dictionary of environment variables
|
|
154
|
+
* @param opts.key If present, fetch a single key (case-sensitive)
|
|
155
|
+
* @param opts.raw Return a dictionary of raw key/value pairs for only the account and site sources
|
|
156
|
+
* @param opts.scope The scope of the environment variables
|
|
157
|
+
* @param opts.siteInfo The site object
|
|
158
|
+
* @returns An object of environment variables keys and their metadata
|
|
130
159
|
*/
|
|
131
|
-
|
|
132
|
-
export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', raw = false, scope = 'any', siteInfo }) => {
|
|
160
|
+
export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', raw = false, scope = 'any', siteInfo, }) => {
|
|
133
161
|
const { account_slug: accountId, id: siteId } = siteInfo;
|
|
134
162
|
const [accountEnvelopeItems, siteEnvelopeItems] = await Promise.all([
|
|
135
|
-
// @ts-expect-error TS(2345) FIXME: Argument of type '{ api: any; accountId: any; key:... Remove this comment to see the full error message
|
|
136
163
|
fetchEnvelopeItems({ api, accountId, key }),
|
|
137
164
|
fetchEnvelopeItems({ api, accountId, key, siteId }),
|
|
138
165
|
]);
|
|
@@ -142,7 +169,6 @@ export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', raw
|
|
|
142
169
|
const entries = Object.entries({ ...accountEnv, ...siteEnv });
|
|
143
170
|
return entries.reduce((obj, [envVarKey, metadata]) => ({
|
|
144
171
|
...obj,
|
|
145
|
-
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
146
172
|
[envVarKey]: metadata.value,
|
|
147
173
|
}), {});
|
|
148
174
|
}
|
|
@@ -164,10 +190,9 @@ export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', raw
|
|
|
164
190
|
};
|
|
165
191
|
/**
|
|
166
192
|
* Returns a human-readable, comma-separated list of scopes
|
|
167
|
-
* @param
|
|
168
|
-
* @returns
|
|
193
|
+
* @param scopes An array of scopes
|
|
194
|
+
* @returns A human-readable, comma-separated list of scopes
|
|
169
195
|
*/
|
|
170
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'scopes' implicitly has an 'any' type.
|
|
171
196
|
export const getHumanReadableScopes = (scopes) => {
|
|
172
197
|
const HUMAN_SCOPES = ['Builds', 'Functions', 'Runtime', 'Post processing'];
|
|
173
198
|
const SCOPES_MAP = {
|
|
@@ -175,6 +200,8 @@ export const getHumanReadableScopes = (scopes) => {
|
|
|
175
200
|
functions: HUMAN_SCOPES[1],
|
|
176
201
|
runtime: HUMAN_SCOPES[2],
|
|
177
202
|
post_processing: HUMAN_SCOPES[3],
|
|
203
|
+
// TODO(serhalp) I believe this isn't needed, as `post-processing` is a user-provided
|
|
204
|
+
// CLI option, not a scope returned by the Envelope API.
|
|
178
205
|
'post-processing': HUMAN_SCOPES[3],
|
|
179
206
|
};
|
|
180
207
|
if (!scopes) {
|
|
@@ -186,18 +213,17 @@ export const getHumanReadableScopes = (scopes) => {
|
|
|
186
213
|
// shorthand instead of listing every available scope
|
|
187
214
|
return 'All';
|
|
188
215
|
}
|
|
189
|
-
// @ts-expect-error TS(7006) FIXME: Parameter 'scope' implicitly has an 'any' type.
|
|
190
216
|
return scopes.map((scope) => SCOPES_MAP[scope]).join(', ');
|
|
191
217
|
};
|
|
192
218
|
/**
|
|
193
219
|
* Translates a Mongo env into an Envelope env
|
|
194
|
-
* @param
|
|
195
|
-
* @returns
|
|
220
|
+
* @param env The site's env as it exists in Mongo
|
|
221
|
+
* @returns The array of Envelope env vars
|
|
196
222
|
*/
|
|
197
223
|
export const translateFromMongoToEnvelope = (env = {}) => {
|
|
198
224
|
const envVars = Object.entries(env).map(([key, value]) => ({
|
|
199
225
|
key,
|
|
200
|
-
scopes:
|
|
226
|
+
scopes: ALL_ENVELOPE_SCOPES,
|
|
201
227
|
values: [
|
|
202
228
|
{
|
|
203
229
|
context: 'all',
|
|
@@ -209,20 +235,17 @@ export const translateFromMongoToEnvelope = (env = {}) => {
|
|
|
209
235
|
};
|
|
210
236
|
/**
|
|
211
237
|
* Translates an Envelope env into a Mongo env
|
|
212
|
-
* @param
|
|
213
|
-
* @param
|
|
214
|
-
* @returns
|
|
238
|
+
* @param envVars The array of Envelope env vars
|
|
239
|
+
* @param context The deploy context or branch of the environment variable
|
|
240
|
+
* @returns The env object as compatible with Mongo
|
|
215
241
|
*/
|
|
216
242
|
export const translateFromEnvelopeToMongo = (envVars = [], context = 'dev') => envVars
|
|
217
|
-
|
|
218
|
-
.sort((left, right) => (left.key.toLowerCase() < right.key.toLowerCase() ? -1 : 1))
|
|
243
|
+
.sort((a, b) => (a.key.toLowerCase() < b.key.toLowerCase() ? -1 : 1))
|
|
219
244
|
.reduce((acc, cur) => {
|
|
220
|
-
|
|
221
|
-
const envVar = cur.values.find((val) => [context, 'all'].includes(val.context_parameter || val.context));
|
|
245
|
+
const envVar = cur.values.find((val) => [context, 'all'].includes((val.context_parameter ?? '') || val.context));
|
|
222
246
|
if (envVar && envVar.value) {
|
|
223
247
|
return {
|
|
224
248
|
...acc,
|
|
225
|
-
// @ts-expect-error TS(2339) FIXME: Property 'key' does not exist on type 'never'.
|
|
226
249
|
[cur.key]: envVar.value,
|
|
227
250
|
};
|
|
228
251
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/env/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/env/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAGxD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,CAAU,CAAA;AAC1G;;GAEG;AACH,MAAM,yBAAyB,GAAG;IAChC,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,YAAY;CACnB,CAAA;AACD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,CAAU,CAAA;AAwCjG;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAmB,EAAE;IACnE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAA;IAC/B,IAAI,OAAO,IAAI,yBAAyB,EAAE,CAAC;QACzC,OAAO,GAAG,yBAAyB,CAAC,OAAiD,CAAC,CAAA;IACxF,CAAC;IACD,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;IAC1E,IAAI,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,OAAO,gBAAgB,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AAC,EAAE,EAAE,CAAC,CAAC;QACzD,GAAG;QACH,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,KAAc;gBACvB,KAAK;aACN;SACF;KACF,CAAC,CAAC,CAAA;IAEH,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,UAIM,EAAE,EACR,OAAO,GAAG,KAAK,EACf,EAAE,CACF,OAAO;KACJ,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACpE,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACnB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAChH,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAC3B,OAAO;YACL,GAAG,GAAG;YACN,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,KAAK;SACxB,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,EAAE,EAAE,CAAC,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SiteInfo } from './types.js';
|
|
2
1
|
/**
|
|
3
2
|
* Allows us to check if a feature flag is enabled for a site.
|
|
4
3
|
* Due to versioning of the cli, and the desire to remove flags from
|
|
@@ -8,10 +7,14 @@ import type { SiteInfo } from './types.js';
|
|
|
8
7
|
* Instead, we return that the feature flag is enabled if it isn't
|
|
9
8
|
* specifically set to false in the response
|
|
10
9
|
*/
|
|
11
|
-
export declare const isFeatureFlagEnabled: (flagName: string, siteInfo:
|
|
10
|
+
export declare const isFeatureFlagEnabled: (flagName: string, siteInfo: {
|
|
11
|
+
feature_flags?: Record<string, string | boolean> | undefined;
|
|
12
|
+
}) => boolean;
|
|
12
13
|
/**
|
|
13
14
|
* Retrieves all Feature flags from the siteInfo
|
|
14
15
|
*/
|
|
15
|
-
export declare const getFeatureFlagsFromSiteInfo: (siteInfo:
|
|
16
|
+
export declare const getFeatureFlagsFromSiteInfo: (siteInfo: {
|
|
17
|
+
feature_flags?: Record<string, string | boolean> | undefined;
|
|
18
|
+
}) => FeatureFlags;
|
|
16
19
|
export type FeatureFlags = Record<string, boolean | string | number>;
|
|
17
20
|
//# sourceMappingURL=feature-flags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,MAAM,EAChB,UAAU;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,SAAS,CAAA;CAAE,KACzE,OAAwF,CAAA;AAE3F;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,UAAU;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,SAAS,CAAA;CAC7D,KAAG,YAMF,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,QAAgB,EAChB,QAA0E,EACjE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,CAAA;AAE3F;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,QAE3C,EAAgB,EAAE,CAAC,CAAC;IACnB,GAAG,QAAQ,CAAC,aAAa;IACzB,wFAAwF;IACxF,mBAAmB,EAAE,oBAAoB,CAAC,oBAAoB,EAAE,QAAQ,CAAC;IACzE,4BAA4B,EAAE,IAAI;IAClC,oBAAoB,EAAE,IAAI;CAC3B,CAAC,CAAA"}
|
|
@@ -12,7 +12,7 @@ interface InspectSettings {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const generateInspectSettings: (edgeInspect: boolean | string, edgeInspectBrk: boolean | string) => InspectSettings;
|
|
14
14
|
export declare const startProxyServer: ({ accountId, addonsUrls, api, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, site, siteInfo, state, }: {
|
|
15
|
-
accountId: string;
|
|
15
|
+
accountId: string | undefined;
|
|
16
16
|
addonsUrls: $TSFixMe;
|
|
17
17
|
api?: NetlifyOptions["api"];
|
|
18
18
|
blobsContext?: BlobsContextWithEdgeAccess;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-server.d.ts","sourceRoot":"","sources":["../../src/utils/proxy-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,M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AAA;IAEd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,uBAAuB,GAClC,aAAa,OAAO,GAAG,MAAM,EAC7B,gBAAgB,OAAO,GAAG,MAAM,KAC/B,eAiBF,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,uQAuBpC;IACD,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,UAAU,EAAE,QAAQ,CAAA;IACpB,GAAG,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAA;IAC3B,YAAY,CAAC,EAAE,0BAA0B,CAAA;IACzC,OAAO,EAAE,WAAW,CAAA;IACpB,MAAM,EAAE,4BAA4B,CAAA;IAEpC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,oBAAoB,EAAE,OAAO,CAAA;IAC7B,GAAG,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAA;IAC1C,eAAe,EAAE,eAAe,CAAA;IAChC,gBAAgB,EAAE,MAAM,OAAO,CAAC,4BAA4B,CAAC,CAAA;IAC7D,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,cAAc,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,KAAK,EAAE,QAAQ,CAAA;IACf,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;CACtC,oBA8BA,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
declare const GITHUB = "GitHub";
|
|
1
2
|
/**
|
|
2
|
-
* @param {string} _url
|
|
3
3
|
* Takes a url like https://github.com/netlify-labs/all-the-functions/tree/master/functions/9-using-middleware
|
|
4
4
|
* and returns https://api.github.com/repos/netlify-labs/all-the-functions/contents/functions/9-using-middleware
|
|
5
5
|
*/
|
|
6
|
-
export declare const readRepoURL: (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
6
|
+
export declare const readRepoURL: (url: string) => Promise<unknown>;
|
|
7
|
+
export declare const validateRepoURL: (url: string) => typeof GITHUB | null;
|
|
8
|
+
export declare const parseRepoURL: (repoHost: string, url: {
|
|
9
|
+
path: string | null;
|
|
10
|
+
}) => string[];
|
|
11
|
+
export {};
|
|
12
12
|
//# sourceMappingURL=read-repo-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-repo-url.d.ts","sourceRoot":"","sources":["../../src/utils/read-repo-url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-repo-url.d.ts","sourceRoot":"","sources":["../../src/utils/read-repo-url.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,MAAM,WAAW,CAAA;AAEvB;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAmB,KAAK,MAAM,qBAWrD,CAAA;AAqBD,eAAO,MAAM,eAAe,GAAa,KAAK,MAAM,KAAG,OAAO,MAAM,GAAG,IAOtE,CAAA;AAED,eAAO,MAAM,YAAY,GAAa,UAAU,MAAM,EAAE,KAAK;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,aASnF,CAAA"}
|