netlify-cli 24.11.3 → 25.0.1
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.map +1 -1
- package/dist/commands/base-command.js +18 -2
- package/dist/commands/base-command.js.map +1 -1
- package/dist/commands/functions/functions-create.d.ts.map +1 -1
- package/dist/commands/functions/functions-create.js +1 -6
- package/dist/commands/functions/functions-create.js.map +1 -1
- package/dist/commands/login/login.d.ts.map +1 -1
- package/dist/commands/login/login.js +0 -6
- package/dist/commands/login/login.js.map +1 -1
- package/dist/commands/logs/index.d.ts +0 -2
- package/dist/commands/logs/index.d.ts.map +1 -1
- package/dist/commands/logs/index.js +95 -29
- package/dist/commands/logs/index.js.map +1 -1
- package/dist/commands/logs/log-api.d.ts +64 -0
- package/dist/commands/logs/log-api.d.ts.map +1 -0
- package/dist/commands/logs/log-api.js +200 -0
- package/dist/commands/logs/log-api.js.map +1 -0
- package/dist/commands/logs/logs.d.ts +4 -0
- package/dist/commands/logs/logs.d.ts.map +1 -0
- package/dist/commands/logs/logs.js +302 -0
- package/dist/commands/logs/logs.js.map +1 -0
- package/dist/commands/logs/sources/deploy.d.ts +13 -0
- package/dist/commands/logs/sources/deploy.d.ts.map +1 -0
- package/dist/commands/logs/sources/deploy.js +71 -0
- package/dist/commands/logs/sources/deploy.js.map +1 -0
- package/dist/commands/logs/sources/edge-functions.d.ts +17 -0
- package/dist/commands/logs/sources/edge-functions.d.ts.map +1 -0
- package/dist/commands/logs/sources/edge-functions.js +71 -0
- package/dist/commands/logs/sources/edge-functions.js.map +1 -0
- package/dist/commands/logs/sources/functions.d.ts +22 -0
- package/dist/commands/logs/sources/functions.d.ts.map +1 -0
- package/dist/commands/logs/sources/functions.js +75 -0
- package/dist/commands/logs/sources/functions.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/open-browser.d.ts +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js +4 -2
- package/dist/utils/open-browser.js.map +1 -1
- package/package.json +69 -6
- package/scripts/netlifyPackage.js +2 -26
- package/dist/commands/logs/functions.d.ts +0 -4
- package/dist/commands/logs/functions.d.ts.map +0 -1
- package/dist/commands/logs/functions.js +0 -79
- package/dist/commands/logs/functions.js.map +0 -1
- package/functions-templates/go/hello-world/.netlify-function-template.mjs +0 -6
- package/functions-templates/go/hello-world/go.mod +0 -5
- package/functions-templates/go/hello-world/go.sum +0 -22
- package/functions-templates/go/hello-world/main.go +0 -24
- package/functions-templates/rust/hello-world/.netlify-function-template.mjs +0 -6
- package/functions-templates/rust/hello-world/Cargo.lock +0 -1149
- package/functions-templates/rust/hello-world/Cargo.toml +0 -14
- package/functions-templates/rust/hello-world/src/main.rs +0 -29
- package/npm-shrinkwrap.json +0 -13402
- package/scripts/prepublishOnly.js +0 -29
|
@@ -2,6 +2,6 @@ type OpenBrowsrProps = {
|
|
|
2
2
|
silentBrowserNoneError?: boolean;
|
|
3
3
|
url: string;
|
|
4
4
|
};
|
|
5
|
-
declare const openBrowser: ({ silentBrowserNoneError, url }: OpenBrowsrProps) => Promise<
|
|
5
|
+
declare const openBrowser: ({ silentBrowserNoneError, url }: OpenBrowsrProps) => Promise<boolean>;
|
|
6
6
|
export default openBrowser;
|
|
7
7
|
//# sourceMappingURL=open-browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-browser.d.ts","sourceRoot":"","sources":["../../src/utils/open-browser.ts"],"names":[],"mappings":"AAoBA,KAAK,eAAe,GAAG;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,QAAA,MAAM,WAAW,GAAmB,iCAAiC,eAAe,
|
|
1
|
+
{"version":3,"file":"open-browser.d.ts","sourceRoot":"","sources":["../../src/utils/open-browser.ts"],"names":[],"mappings":"AAoBA,KAAK,eAAe,GAAG;IACrB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,QAAA,MAAM,WAAW,GAAmB,iCAAiC,eAAe,KAAG,OAAO,CAAC,OAAO,CAqBrG,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -12,21 +12,23 @@ const unableToOpenBrowserMessage = function ({ message, url }) {
|
|
|
12
12
|
const openBrowser = async function ({ silentBrowserNoneError, url }) {
|
|
13
13
|
if (isDockerContainer()) {
|
|
14
14
|
unableToOpenBrowserMessage({ url, message: 'Running inside a docker container' });
|
|
15
|
-
return;
|
|
15
|
+
return false;
|
|
16
16
|
}
|
|
17
17
|
if (process.env.BROWSER === 'none') {
|
|
18
18
|
if (!silentBrowserNoneError) {
|
|
19
19
|
unableToOpenBrowserMessage({ url, message: "BROWSER environment variable is set to 'none'" });
|
|
20
20
|
}
|
|
21
|
-
return;
|
|
21
|
+
return false;
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
24
|
await open(url);
|
|
25
|
+
return true;
|
|
25
26
|
}
|
|
26
27
|
catch (error) {
|
|
27
28
|
if (error instanceof Error) {
|
|
28
29
|
unableToOpenBrowserMessage({ url, message: error.message });
|
|
29
30
|
}
|
|
31
|
+
return false;
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
export default openBrowser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-browser.js","sourceRoot":"","sources":["../../src/utils/open-browser.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,iBAAiB,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAOjD,MAAM,0BAA0B,GAAG,UAAU,EAAE,OAAO,EAAE,GAAG,EAAwB;IACjF,GAAG,CAAC,6BAA6B,CAAC,CAAA;IAClC,GAAG,CAAC,KAAK,CAAC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AmC,EAAE,CAAC,CAAA;QACjF,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC5B,0BAA0B,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,+CAA+C,EAAE,CAAC,CAAA;QAC/F,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,GAAG,CAAC,CAAA;QACf,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,0BAA0B,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7D,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED,eAAe,WAAW,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "25.0.1",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"/bin",
|
|
12
|
-
"/npm-shrinkwrap.json",
|
|
13
12
|
"/scripts",
|
|
14
13
|
"/functions-templates",
|
|
15
14
|
"/dist"
|
|
@@ -52,7 +51,6 @@
|
|
|
52
51
|
"test:integration": "vitest run --retry=3 tests/integration/",
|
|
53
52
|
"test:unit": "vitest run tests/unit/",
|
|
54
53
|
"postinstall": "node ./scripts/postinstall.js",
|
|
55
|
-
"prepublishOnly": "node ./scripts/prepublishOnly.js",
|
|
56
54
|
"typecheck": "tsc",
|
|
57
55
|
"typecheck:watch": "tsc --watch"
|
|
58
56
|
},
|
|
@@ -64,7 +62,7 @@
|
|
|
64
62
|
"@netlify/build": "35.13.1",
|
|
65
63
|
"@netlify/build-info": "10.5.0",
|
|
66
64
|
"@netlify/config": "24.5.0",
|
|
67
|
-
"@netlify/dev": "4.
|
|
65
|
+
"@netlify/dev": "4.17.1",
|
|
68
66
|
"@netlify/dev-utils": "4.4.3",
|
|
69
67
|
"@netlify/edge-bundler": "14.10.0",
|
|
70
68
|
"@netlify/edge-functions": "3.0.6",
|
|
@@ -103,7 +101,7 @@
|
|
|
103
101
|
"express-logging": "1.1.1",
|
|
104
102
|
"extract-zip": "2.0.1",
|
|
105
103
|
"fastest-levenshtein": "1.0.16",
|
|
106
|
-
"fastify": "5.8.
|
|
104
|
+
"fastify": "5.8.5",
|
|
107
105
|
"find-up": "8.0.0",
|
|
108
106
|
"folder-walker": "3.2.0",
|
|
109
107
|
"fuzzy": "0.1.3",
|
|
@@ -138,6 +136,7 @@
|
|
|
138
136
|
"p-map": "7.0.3",
|
|
139
137
|
"p-wait-for": "6.0.0",
|
|
140
138
|
"parallel-transform": "1.2.0",
|
|
139
|
+
"parse-duration": "^2.1.6",
|
|
141
140
|
"parse-github-url": "1.0.3",
|
|
142
141
|
"pg": "8.20.0",
|
|
143
142
|
"prettyjson": "1.2.5",
|
|
@@ -155,6 +154,70 @@
|
|
|
155
154
|
"write-file-atomic": "5.0.1",
|
|
156
155
|
"ws": "8.19.0"
|
|
157
156
|
},
|
|
157
|
+
"devDependencies": {
|
|
158
|
+
"@babel/preset-react": "7.27.1",
|
|
159
|
+
"@bugsnag/js": "8.6.0",
|
|
160
|
+
"@eslint/compat": "1.4.1",
|
|
161
|
+
"@eslint/js": "9.36.0",
|
|
162
|
+
"@netlify/functions": "5.1.5",
|
|
163
|
+
"@netlify/types": "2.6.0",
|
|
164
|
+
"@sindresorhus/slugify": "3.0.0",
|
|
165
|
+
"@tsconfig/node20": "20.1.0",
|
|
166
|
+
"@tsconfig/recommended": "1.0.13",
|
|
167
|
+
"@types/backoff": "2.5.5",
|
|
168
|
+
"@types/content-type": "1.1.9",
|
|
169
|
+
"@types/debug": "4.1.12",
|
|
170
|
+
"@types/envinfo": "7.8.4",
|
|
171
|
+
"@types/eslint-config-prettier": "6.11.3",
|
|
172
|
+
"@types/etag": "1.8.4",
|
|
173
|
+
"@types/express": "5.0.6",
|
|
174
|
+
"@types/folder-walker": "3.2.5",
|
|
175
|
+
"@types/gitconfiglocal": "2.0.3",
|
|
176
|
+
"@types/inquirer": "9.0.9",
|
|
177
|
+
"@types/inquirer-autocomplete-prompt": "3.0.3",
|
|
178
|
+
"@types/jsonwebtoken": "9.0.10",
|
|
179
|
+
"@types/lodash": "4.17.24",
|
|
180
|
+
"@types/lodash.shuffle": "4.2.9",
|
|
181
|
+
"@types/multiparty": "4.2.1",
|
|
182
|
+
"@types/node": "22.18.11",
|
|
183
|
+
"@types/node-fetch": "2.6.13",
|
|
184
|
+
"@types/parallel-transform": "1.1.4",
|
|
185
|
+
"@types/parse-github-url": "1.0.3",
|
|
186
|
+
"@types/pg": "8.18.0",
|
|
187
|
+
"@types/picomatch": "4.0.2",
|
|
188
|
+
"@types/prettyjson": "0.0.33",
|
|
189
|
+
"@types/semver": "7.7.1",
|
|
190
|
+
"@types/serialize-javascript": "5.0.4",
|
|
191
|
+
"@types/source-map-support": "0.5.10",
|
|
192
|
+
"@types/update-notifier": "6.0.8",
|
|
193
|
+
"@types/write-file-atomic": "4.0.3",
|
|
194
|
+
"@types/ws": "8.18.1",
|
|
195
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
196
|
+
"@vitest/eslint-plugin": "1.3.13",
|
|
197
|
+
"c8": "10.1.3",
|
|
198
|
+
"cheerio": "1.1.2",
|
|
199
|
+
"dedent": "1.7.2",
|
|
200
|
+
"eslint": "9.36.0",
|
|
201
|
+
"eslint-config-prettier": "10.1.8",
|
|
202
|
+
"eslint-plugin-n": "17.23.1",
|
|
203
|
+
"form-data": "4.0.4",
|
|
204
|
+
"lodash.shuffle": "4.2.0",
|
|
205
|
+
"memfs": "4.56.10",
|
|
206
|
+
"nock": "14.0.10",
|
|
207
|
+
"npm-run-all2": "8.0.4",
|
|
208
|
+
"p-timeout": "7.0.0",
|
|
209
|
+
"picomatch": "4.0.4",
|
|
210
|
+
"prettier": "2.8.8",
|
|
211
|
+
"serialize-javascript": "7.0.5",
|
|
212
|
+
"strip-ansi": "7.1.2",
|
|
213
|
+
"temp-dir": "3.0.0",
|
|
214
|
+
"tree-kill": "1.2.2",
|
|
215
|
+
"tsx": "4.20.6",
|
|
216
|
+
"typescript": "5.8.3",
|
|
217
|
+
"typescript-eslint": "8.45.0",
|
|
218
|
+
"verdaccio": "6.3.2",
|
|
219
|
+
"vitest": "3.2.4"
|
|
220
|
+
},
|
|
158
221
|
"ava": {
|
|
159
222
|
"files": [
|
|
160
223
|
"tools/**/*.test.js",
|
|
@@ -162,4 +225,4 @@
|
|
|
162
225
|
]
|
|
163
226
|
},
|
|
164
227
|
"packageManager": "npm@10.9.4+sha512.3a7506f37e85c1ba1021baad79f0cd9724748131f321fc117c4dc3ba235ec01be7327584a41d15117c01945560aa9373220628fcc1e1dddd877a5fe9b336a900"
|
|
165
|
-
}
|
|
228
|
+
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { readFile, stat, writeFile } from 'node:fs/promises'
|
|
5
|
-
|
|
6
|
-
import execa from 'execa'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
6
|
* @import {Package} from "normalize-package-data"
|
|
@@ -35,34 +32,13 @@ async function preparePackageJSON() {
|
|
|
35
32
|
...packageJSON.contents,
|
|
36
33
|
main: './dist/index.js',
|
|
37
34
|
name: 'netlify',
|
|
38
|
-
scripts: {
|
|
39
|
-
...packageJSON.contents.scripts,
|
|
40
|
-
|
|
41
|
-
// We don't need the pre-publish script because we expect the work in
|
|
42
|
-
// there to be done when publishing the `netlify-cli` package. We'll
|
|
43
|
-
// ensure this is the case by throwing if a shrinkwrap file isn't found.
|
|
44
|
-
prepublishOnly: undefined,
|
|
45
|
-
},
|
|
46
35
|
bin: {
|
|
47
36
|
npxnetlify: binPath,
|
|
48
37
|
},
|
|
49
38
|
}
|
|
50
39
|
|
|
51
|
-
try {
|
|
52
|
-
const shrinkwrap = await stat(resolve(packageJSON.path, '../npm-shrinkwrap.json'))
|
|
53
|
-
|
|
54
|
-
assert.ok(shrinkwrap.isFile())
|
|
55
|
-
} catch {
|
|
56
|
-
throw new Error('Failed to find npm-shrinkwrap.json file. Did you run the pre-publish script?')
|
|
57
|
-
}
|
|
58
|
-
|
|
59
40
|
console.log(`Writing updated package.json to ${packageJSON.path}...`)
|
|
60
41
|
await writeFile(packageJSON.path, `${JSON.stringify(newPackageJSON, null, 2)}\n`)
|
|
61
|
-
|
|
62
|
-
console.log('Regenerating shrinkwrap file with updated package name...')
|
|
63
|
-
await execa('npm', ['shrinkwrap'], {
|
|
64
|
-
cwd: dirname(packageJSON.path),
|
|
65
|
-
})
|
|
66
42
|
}
|
|
67
43
|
|
|
68
44
|
await preparePackageJSON()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/commands/logs/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAKxC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AAwBjD,eAAO,MAAM,YAAY,GAAU,cAAc,MAAM,GAAG,SAAS,EAAE,SAAS,YAAY,EAAE,SAAS,WAAW,kBAqE/G,CAAA"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import inquirer from 'inquirer';
|
|
2
|
-
import { chalk, log } from '../../utils/command-helpers.js';
|
|
3
|
-
import { getWebSocket } from '../../utils/websockets/index.js';
|
|
4
|
-
import { CLI_LOG_LEVEL_CHOICES_STRING, LOG_LEVELS, LOG_LEVELS_LIST } from './log-levels.js';
|
|
5
|
-
function getLog(logData) {
|
|
6
|
-
let logString = '';
|
|
7
|
-
switch (logData.level) {
|
|
8
|
-
case LOG_LEVELS.INFO:
|
|
9
|
-
logString += chalk.blueBright(logData.level);
|
|
10
|
-
break;
|
|
11
|
-
case LOG_LEVELS.WARN:
|
|
12
|
-
logString += chalk.yellowBright(logData.level);
|
|
13
|
-
break;
|
|
14
|
-
case LOG_LEVELS.ERROR:
|
|
15
|
-
logString += chalk.redBright(logData.level);
|
|
16
|
-
break;
|
|
17
|
-
default:
|
|
18
|
-
logString += logData.level;
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
return `${logString} ${logData.message}`;
|
|
22
|
-
}
|
|
23
|
-
export const logsFunction = async (functionName, options, command) => {
|
|
24
|
-
const client = command.netlify.api;
|
|
25
|
-
const { site } = command.netlify;
|
|
26
|
-
const { id: siteId } = site;
|
|
27
|
-
if (options.level && !options.level.every((level) => LOG_LEVELS_LIST.includes(level))) {
|
|
28
|
-
log(`Invalid log level. Choices are:${CLI_LOG_LEVEL_CHOICES_STRING}`);
|
|
29
|
-
}
|
|
30
|
-
const levelsToPrint = options.level || LOG_LEVELS_LIST;
|
|
31
|
-
// TODO: Update type once the open api spec is updated https://open-api.netlify.com/#tag/function/operation/searchSiteFunctions
|
|
32
|
-
const { functions = [] } = (await client.searchSiteFunctions({ siteId: siteId }));
|
|
33
|
-
if (functions.length === 0) {
|
|
34
|
-
log(`No functions found for the project`);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
let selectedFunction;
|
|
38
|
-
if (functionName) {
|
|
39
|
-
selectedFunction = functions.find((fn) => fn.n === functionName);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const { result } = await inquirer.prompt({
|
|
43
|
-
name: 'result',
|
|
44
|
-
type: 'list',
|
|
45
|
-
message: 'Select a function',
|
|
46
|
-
choices: functions.map((fn) => fn.n),
|
|
47
|
-
});
|
|
48
|
-
selectedFunction = functions.find((fn) => fn.n === result);
|
|
49
|
-
}
|
|
50
|
-
if (!selectedFunction) {
|
|
51
|
-
log(`Could not find function ${functionName}`);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const { a: accountId, oid: functionId } = selectedFunction;
|
|
55
|
-
const ws = getWebSocket('wss://socketeer.services.netlify.com/function/logs');
|
|
56
|
-
ws.on('open', () => {
|
|
57
|
-
ws.send(JSON.stringify({
|
|
58
|
-
function_id: functionId,
|
|
59
|
-
site_id: siteId,
|
|
60
|
-
access_token: client.accessToken,
|
|
61
|
-
account_id: accountId,
|
|
62
|
-
}));
|
|
63
|
-
});
|
|
64
|
-
ws.on('message', (data) => {
|
|
65
|
-
const logData = JSON.parse(data);
|
|
66
|
-
if (!levelsToPrint.includes(logData.level.toLowerCase())) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
log(getLog(logData));
|
|
70
|
-
});
|
|
71
|
-
ws.on('close', () => {
|
|
72
|
-
log('Connection closed');
|
|
73
|
-
});
|
|
74
|
-
ws.on('error', (err) => {
|
|
75
|
-
log('Connection error');
|
|
76
|
-
log(err);
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/commands/logs/functions.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAG9D,OAAO,EAAE,4BAA4B,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE3F,SAAS,MAAM,CAAC,OAA2C;IACzD,IAAI,SA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CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,IAAY,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACzD,OAAM;QACR,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QAClB,GAAG,CAAC,mBAAmB,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAQ,EAAE,EAAE;QAC1B,GAAG,CAAC,kBAAkB,CAAC,CAAA;QACvB,GAAG,CAAC,GAAG,CAAC,CAAA;IACV,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
2
|
-
github.com/aws/aws-lambda-go v1.20.0 h1:ZSweJx/Hy9BoIDXKBEh16vbHH0t0dehnF8MKpMiOWc0=
|
|
3
|
-
github.com/aws/aws-lambda-go v1.20.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU=
|
|
4
|
-
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
|
5
|
-
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
|
6
|
-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
7
|
-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
8
|
-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
9
|
-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
10
|
-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
11
|
-
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
|
12
|
-
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
|
13
|
-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
14
|
-
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
|
15
|
-
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
16
|
-
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
|
|
17
|
-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
18
|
-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
19
|
-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
20
|
-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
21
|
-
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
|
|
22
|
-
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package main
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
|
|
7
|
-
"github.com/aws/aws-lambda-go/events"
|
|
8
|
-
"github.com/aws/aws-lambda-go/lambda"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
func handler(ctx context.Context, request events.APIGatewayProxyRequest) (*events.APIGatewayProxyResponse, error) {
|
|
12
|
-
fmt.Println("This message will show up in the CLI console.")
|
|
13
|
-
|
|
14
|
-
return &events.APIGatewayProxyResponse{
|
|
15
|
-
StatusCode: 200,
|
|
16
|
-
Headers: map[string]string{"Content-Type": "text/plain"},
|
|
17
|
-
Body: "Hello, world!",
|
|
18
|
-
IsBase64Encoded: false,
|
|
19
|
-
}, nil
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
func main() {
|
|
23
|
-
lambda.Start(handler)
|
|
24
|
-
}
|