netlify-cli 8.12.0 → 8.14.0-scheduled-functions
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/README.md +12 -1
- package/npm-shrinkwrap.json +1669 -2534
- package/package.json +9 -5
- package/src/commands/dev/dev.js +31 -6
- package/src/commands/functions/functions-invoke.js +17 -2
- package/src/commands/graph/graph-edit.js +91 -0
- package/src/commands/graph/graph-pull.js +95 -0
- package/src/commands/graph/graph.js +30 -0
- package/src/commands/graph/index.js +5 -0
- package/src/commands/main.js +2 -0
- package/src/functions-templates/javascript/hasura-event-triggered/package.json +1 -1
- package/src/functions-templates/javascript/stripe-charge/package-lock.json +7 -7
- package/src/functions-templates/javascript/stripe-subscription/package-lock.json +7 -7
- package/src/functions-templates/javascript/token-hider/package-lock.json +16 -16
- package/src/functions-templates/javascript/token-hider/package.json +1 -1
- package/src/functions-templates/typescript/hello-world/package-lock.json +13 -13
- package/src/lib/functions/netlify-function.js +9 -1
- package/src/lib/functions/runtimes/js/builders/zisi.js +25 -6
- package/src/lib/functions/runtimes/js/index.js +2 -1
- package/src/lib/functions/scheduled.js +78 -0
- package/src/lib/functions/server.js +10 -0
- package/src/lib/one-graph/cli-client.js +278 -0
- package/src/lib/one-graph/cli-netlify-graph.js +278 -0
- package/src/utils/functions/constants.js +5 -0
- package/src/utils/functions/get-functions.js +5 -3
- package/src/utils/functions/index.js +2 -0
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.14.0-scheduled-functions",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
|
|
8
8
|
"David Calavera <david@netlify.com> (https://twitter.com/calavera)",
|
|
9
9
|
"David Wells <david.wells@netlify.com> (https://davidwells.io/)",
|
|
10
10
|
"Raees Iqbal <raees@netlify.com> (https://raeesbhatti.com/)",
|
|
11
|
-
"Bret Comnes <bcomnes@gmail.com> (https://bret.io)"
|
|
11
|
+
"Bret Comnes <bcomnes@gmail.com> (https://bret.io)",
|
|
12
|
+
"Sean Grove <sean.s.grove@netlify.com> (https://twitter.com/sgrove)"
|
|
12
13
|
],
|
|
13
14
|
"engines": {
|
|
14
15
|
"node": "^12.20.0 || ^14.14.0 || >=16.0.0"
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
},
|
|
78
79
|
"dependencies": {
|
|
79
80
|
"@netlify/build": "^26.2.0",
|
|
80
|
-
"@netlify/config": "^17.0.
|
|
81
|
+
"@netlify/config": "^17.0.6",
|
|
81
82
|
"@netlify/framework-info": "^9.0.0",
|
|
82
83
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
83
84
|
"@netlify/plugin-edge-handlers": "^3.0.4",
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"@sindresorhus/slugify": "^1.1.0",
|
|
89
90
|
"ansi-escapes": "^5.0.0",
|
|
90
91
|
"ansi-styles": "^5.0.0",
|
|
92
|
+
"ansi2html": "^0.0.1",
|
|
91
93
|
"ascii-table": "0.0.9",
|
|
92
94
|
"backoff": "^2.5.0",
|
|
93
95
|
"better-opn": "^3.0.0",
|
|
@@ -102,6 +104,7 @@
|
|
|
102
104
|
"content-type": "^1.0.4",
|
|
103
105
|
"cookie": "^0.4.0",
|
|
104
106
|
"copy-template-dir": "^1.4.0",
|
|
107
|
+
"cron-parser": "^4.2.1",
|
|
105
108
|
"debug": "^4.1.1",
|
|
106
109
|
"decache": "^4.6.0",
|
|
107
110
|
"del": "^6.0.0",
|
|
@@ -121,6 +124,7 @@
|
|
|
121
124
|
"gh-release-fetch": "^3.0.0",
|
|
122
125
|
"git-repo-info": "^2.1.0",
|
|
123
126
|
"gitconfiglocal": "^2.1.0",
|
|
127
|
+
"graphql": "^16.1.0",
|
|
124
128
|
"hasbin": "^1.2.3",
|
|
125
129
|
"hasha": "^5.2.2",
|
|
126
130
|
"http-proxy": "^1.18.0",
|
|
@@ -144,6 +148,7 @@
|
|
|
144
148
|
"multiparty": "^4.2.1",
|
|
145
149
|
"netlify": "^10.1.2",
|
|
146
150
|
"netlify-headers-parser": "^6.0.1",
|
|
151
|
+
"netlify-onegraph-internal": "0.0.15",
|
|
147
152
|
"netlify-redirect-parser": "^13.0.1",
|
|
148
153
|
"netlify-redirector": "^0.2.1",
|
|
149
154
|
"node-fetch": "^2.6.0",
|
|
@@ -183,7 +188,7 @@
|
|
|
183
188
|
"devDependencies": {
|
|
184
189
|
"@babel/preset-react": "^7.12.13",
|
|
185
190
|
"@netlify/eslint-config-node": "^4.1.6",
|
|
186
|
-
"ava": "^
|
|
191
|
+
"ava": "^4.0.0",
|
|
187
192
|
"c8": "^7.11.0",
|
|
188
193
|
"eslint-plugin-sort-destructure-keys": "^1.3.5",
|
|
189
194
|
"fast-glob": "^3.2.7",
|
|
@@ -194,7 +199,6 @@
|
|
|
194
199
|
"ini": "^2.0.0",
|
|
195
200
|
"jsonwebtoken": "^8.5.1",
|
|
196
201
|
"mock-fs": "^5.1.2",
|
|
197
|
-
"mock-require": "^3.0.3",
|
|
198
202
|
"p-timeout": "^4.0.0",
|
|
199
203
|
"proxyquire": "^2.1.3",
|
|
200
204
|
"seedrandom": "^3.0.5",
|
package/src/commands/dev/dev.js
CHANGED
|
@@ -11,6 +11,8 @@ const stripAnsiCc = require('strip-ansi-control-characters')
|
|
|
11
11
|
const waitPort = require('wait-port')
|
|
12
12
|
|
|
13
13
|
const { startFunctionsServer } = require('../../lib/functions/server')
|
|
14
|
+
const { OneGraphCliClient, startOneGraphCLISession } = require('../../lib/one-graph/cli-client')
|
|
15
|
+
const { getNetlifyGraphConfig } = require('../../lib/one-graph/cli-netlify-graph')
|
|
14
16
|
const {
|
|
15
17
|
NETLIFYDEV,
|
|
16
18
|
NETLIFYDEVERR,
|
|
@@ -18,6 +20,7 @@ const {
|
|
|
18
20
|
NETLIFYDEVWARN,
|
|
19
21
|
chalk,
|
|
20
22
|
detectServerSettings,
|
|
23
|
+
error,
|
|
21
24
|
exit,
|
|
22
25
|
getSiteInformation,
|
|
23
26
|
injectEnvVariables,
|
|
@@ -46,10 +49,10 @@ const startStaticServer = async ({ settings }) => {
|
|
|
46
49
|
log(`\n${NETLIFYDEVLOG} Static server listening to`, settings.frameworkPort)
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
const isNonExistingCommandError = ({ command, error }) => {
|
|
52
|
+
const isNonExistingCommandError = ({ command, error: commandError }) => {
|
|
50
53
|
// `ENOENT` is only returned for non Windows systems
|
|
51
54
|
// See https://github.com/sindresorhus/execa/pull/447
|
|
52
|
-
if (
|
|
55
|
+
if (commandError.code === 'ENOENT') {
|
|
53
56
|
return true
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -60,7 +63,8 @@ const isNonExistingCommandError = ({ command, error }) => {
|
|
|
60
63
|
|
|
61
64
|
// this only works on English versions of Windows
|
|
62
65
|
return (
|
|
63
|
-
typeof
|
|
66
|
+
typeof commandError.message === 'string' &&
|
|
67
|
+
commandError.message.includes('is not recognized as an internal or external command')
|
|
64
68
|
)
|
|
65
69
|
}
|
|
66
70
|
|
|
@@ -231,7 +235,7 @@ const printBanner = ({ url }) => {
|
|
|
231
235
|
*/
|
|
232
236
|
const dev = async (options, command) => {
|
|
233
237
|
log(`${NETLIFYDEV}`)
|
|
234
|
-
const { api, config, site, siteInfo } = command.netlify
|
|
238
|
+
const { api, config, site, siteInfo, state } = command.netlify
|
|
235
239
|
config.dev = { ...config.dev }
|
|
236
240
|
config.build = { ...config.build }
|
|
237
241
|
/** @type {import('./types').DevConfig} */
|
|
@@ -262,8 +266,8 @@ const dev = async (options, command) => {
|
|
|
262
266
|
let settings = {}
|
|
263
267
|
try {
|
|
264
268
|
settings = await detectServerSettings(devConfig, options, site.root)
|
|
265
|
-
} catch (
|
|
266
|
-
log(NETLIFYDEVERR,
|
|
269
|
+
} catch (error_) {
|
|
270
|
+
log(NETLIFYDEVERR, error_.message)
|
|
267
271
|
exit(1)
|
|
268
272
|
}
|
|
269
273
|
|
|
@@ -291,6 +295,26 @@ const dev = async (options, command) => {
|
|
|
291
295
|
process.env.URL = url
|
|
292
296
|
process.env.DEPLOY_URL = url
|
|
293
297
|
|
|
298
|
+
const startNetlifyGraphWatcher = Boolean(options.graph)
|
|
299
|
+
|
|
300
|
+
if (startNetlifyGraphWatcher && options.offline) {
|
|
301
|
+
warn(`Unable to start Netlify Graph in offline mode`)
|
|
302
|
+
} else if (startNetlifyGraphWatcher && !site.id) {
|
|
303
|
+
error(
|
|
304
|
+
`No siteId defined, unable to start Netlify Graph. To enable, run ${chalk.yellow(
|
|
305
|
+
'netlify init',
|
|
306
|
+
)} or ${chalk.yellow('netlify link')}.`,
|
|
307
|
+
)
|
|
308
|
+
} else if (startNetlifyGraphWatcher) {
|
|
309
|
+
const netlifyToken = await command.authenticate()
|
|
310
|
+
await OneGraphCliClient.ensureAppForSite(netlifyToken, site.id)
|
|
311
|
+
const netlifyGraphConfig = await getNetlifyGraphConfig({ command, options })
|
|
312
|
+
|
|
313
|
+
log(`Starting Netlify Graph session, to edit your library run \`netlify graph:edit\` in another tab`)
|
|
314
|
+
|
|
315
|
+
startOneGraphCLISession({ netlifyGraphConfig, netlifyToken, site, state })
|
|
316
|
+
}
|
|
317
|
+
|
|
294
318
|
printBanner({ url })
|
|
295
319
|
}
|
|
296
320
|
|
|
@@ -335,6 +359,7 @@ const createDevCommand = (program) => {
|
|
|
335
359
|
'specify the path to a local GeoIP location database in MMDB format',
|
|
336
360
|
).hideHelp(),
|
|
337
361
|
)
|
|
362
|
+
.addOption(new Option('--graph', 'enable Netlify Graph support').hideHelp())
|
|
338
363
|
.addExamples([
|
|
339
364
|
'netlify dev',
|
|
340
365
|
'netlify dev -d public',
|
|
@@ -3,10 +3,11 @@ const fs = require('fs')
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const process = require('process')
|
|
5
5
|
|
|
6
|
+
const CronParser = require('cron-parser')
|
|
6
7
|
const inquirer = require('inquirer')
|
|
7
8
|
const fetch = require('node-fetch')
|
|
8
9
|
|
|
9
|
-
const { BACKGROUND, NETLIFYDEVWARN, chalk, error, exit, getFunctions } = require('../../utils')
|
|
10
|
+
const { BACKGROUND, CLOCKWORK_USERAGENT, NETLIFYDEVWARN, chalk, error, exit, getFunctions } = require('../../utils')
|
|
10
11
|
|
|
11
12
|
// https://www.netlify.com/docs/functions/#event-triggered-functions
|
|
12
13
|
const events = [
|
|
@@ -130,6 +131,13 @@ const getFunctionToTrigger = function (options, argumentName) {
|
|
|
130
131
|
return argumentName
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
const getNextRun = function (schedule) {
|
|
135
|
+
const cron = CronParser.parseExpression(schedule, {
|
|
136
|
+
tz: 'Etc/UTC',
|
|
137
|
+
})
|
|
138
|
+
return cron.next().toDate()
|
|
139
|
+
}
|
|
140
|
+
|
|
133
141
|
/**
|
|
134
142
|
* The functions:invoke command
|
|
135
143
|
* @param {string} nameArgument
|
|
@@ -150,11 +158,18 @@ const functionsInvoke = async (nameArgument, options, command) => {
|
|
|
150
158
|
|
|
151
159
|
const functions = await getFunctions(functionsDir)
|
|
152
160
|
const functionToTrigger = await getNameFromArgs(functions, options, nameArgument)
|
|
161
|
+
const functionObj = functions.find((func) => func.name === functionToTrigger)
|
|
153
162
|
|
|
154
163
|
let headers = {}
|
|
155
164
|
let body = {}
|
|
156
165
|
|
|
157
|
-
if (
|
|
166
|
+
if (functionObj.schedule) {
|
|
167
|
+
body.next_run = getNextRun(functionObj.schedule)
|
|
168
|
+
headers = {
|
|
169
|
+
'user-agent': CLOCKWORK_USERAGENT,
|
|
170
|
+
'X-NF-Event': 'schedule',
|
|
171
|
+
}
|
|
172
|
+
} else if (eventTriggeredFunctions.has(functionToTrigger)) {
|
|
158
173
|
/** handle event triggered fns */
|
|
159
174
|
// https://www.netlify.com/docs/functions/#event-triggered-functions
|
|
160
175
|
const [name, event] = functionToTrigger.split('-')
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const gitRepoInfo = require('git-repo-info')
|
|
2
|
+
|
|
3
|
+
const { OneGraphCliClient, generateSessionName, loadCLISession } = require('../../lib/one-graph/cli-client')
|
|
4
|
+
const {
|
|
5
|
+
defaultExampleOperationsDoc,
|
|
6
|
+
getGraphEditUrlBySiteName,
|
|
7
|
+
getNetlifyGraphConfig,
|
|
8
|
+
readGraphQLOperationsSourceFile,
|
|
9
|
+
} = require('../../lib/one-graph/cli-netlify-graph')
|
|
10
|
+
const { NETLIFYDEVERR, chalk, error } = require('../../utils')
|
|
11
|
+
const { openBrowser } = require('../../utils/open-browser')
|
|
12
|
+
|
|
13
|
+
const { createCLISession, createPersistedQuery, ensureAppForSite, updateCLISessionMetadata } = OneGraphCliClient
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates the `netlify graph:edit` command
|
|
17
|
+
* @param {import('commander').OptionValues} options
|
|
18
|
+
* @param {import('../base-command').BaseCommand} program
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
const graphEdit = async (options, command) => {
|
|
22
|
+
const { api, site, siteInfo, state } = command.netlify
|
|
23
|
+
const siteId = site.id
|
|
24
|
+
|
|
25
|
+
if (!site.id) {
|
|
26
|
+
error(
|
|
27
|
+
`${NETLIFYDEVERR} Warning: no siteId defined, unable to start Netlify Graph. To enable, run ${chalk.yellow(
|
|
28
|
+
'netlify init',
|
|
29
|
+
)} or ${chalk.yellow('netlify link')}`,
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
const netlifyGraphConfig = await getNetlifyGraphConfig({ command, options })
|
|
33
|
+
|
|
34
|
+
const { branch } = gitRepoInfo()
|
|
35
|
+
|
|
36
|
+
let graphqlDocument = readGraphQLOperationsSourceFile(netlifyGraphConfig)
|
|
37
|
+
|
|
38
|
+
if (graphqlDocument.trim().length === 0) {
|
|
39
|
+
graphqlDocument = defaultExampleOperationsDoc
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const netlifyToken = await command.authenticate()
|
|
43
|
+
|
|
44
|
+
await ensureAppForSite(netlifyToken, siteId)
|
|
45
|
+
|
|
46
|
+
let oneGraphSessionId = loadCLISession(state)
|
|
47
|
+
if (!oneGraphSessionId) {
|
|
48
|
+
const sessionName = generateSessionName()
|
|
49
|
+
const oneGraphSession = await createCLISession(netlifyToken, site.id, sessionName)
|
|
50
|
+
state.set('oneGraphSessionId', oneGraphSession.id)
|
|
51
|
+
oneGraphSessionId = state.get('oneGraphSessionId')
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const persistedDoc = await createPersistedQuery(netlifyToken, {
|
|
55
|
+
appId: siteId,
|
|
56
|
+
description: 'Temporary snapshot of local queries',
|
|
57
|
+
document: graphqlDocument,
|
|
58
|
+
tags: ['netlify-cli', `session:${oneGraphSessionId}`, `git-branch:${branch}`],
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
await updateCLISessionMetadata(netlifyToken, siteId, oneGraphSessionId, { docId: persistedDoc.id })
|
|
62
|
+
|
|
63
|
+
let siteName = siteInfo.name
|
|
64
|
+
|
|
65
|
+
if (!siteName) {
|
|
66
|
+
const siteData = await api.getSite({ siteId })
|
|
67
|
+
siteName = siteData.name
|
|
68
|
+
if (!siteName) {
|
|
69
|
+
error(`No site name found for siteId ${siteId}`)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const graphEditUrl = getGraphEditUrlBySiteName({ siteName, oneGraphSessionId })
|
|
74
|
+
|
|
75
|
+
await openBrowser({ url: graphEditUrl })
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Creates the `netlify graph:edit` command
|
|
80
|
+
* @param {import('../base-command').BaseCommand} program
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
const createGraphEditCommand = (program) =>
|
|
84
|
+
program
|
|
85
|
+
.command('graph:edit')
|
|
86
|
+
.description('Launch the browser to edit your local graph functions from Netlify')
|
|
87
|
+
.action(async (options, command) => {
|
|
88
|
+
await graphEdit(options, command)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
module.exports = { createGraphEditCommand }
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* eslint-disable eslint-comments/disable-enable-pair */
|
|
2
|
+
/* eslint-disable fp/no-loops */
|
|
3
|
+
const {
|
|
4
|
+
OneGraphCliClient,
|
|
5
|
+
handleCliSessionEvent,
|
|
6
|
+
loadCLISession,
|
|
7
|
+
refetchAndGenerateFromOneGraph,
|
|
8
|
+
} = require('../../lib/one-graph/cli-client')
|
|
9
|
+
const { buildSchema, getNetlifyGraphConfig, readGraphQLSchemaFile } = require('../../lib/one-graph/cli-netlify-graph')
|
|
10
|
+
const { chalk, error, warn } = require('../../utils')
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates the `netlify graph:pull` command
|
|
14
|
+
* @param {import('commander').OptionValues} options
|
|
15
|
+
* @param {import('../base-command').BaseCommand} program
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
const graphPull = async (options, command) => {
|
|
19
|
+
const { site, state } = command.netlify
|
|
20
|
+
|
|
21
|
+
if (!site.id) {
|
|
22
|
+
error(
|
|
23
|
+
`No siteId defined, unable to start Netlify Graph. To enable, run ${chalk.yellow(
|
|
24
|
+
'netlify init',
|
|
25
|
+
)} or ${chalk.yellow('netlify link')}`,
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const netlifyGraphConfig = await getNetlifyGraphConfig({ command, options })
|
|
30
|
+
const netlifyToken = await command.authenticate()
|
|
31
|
+
const siteId = site.id
|
|
32
|
+
|
|
33
|
+
await refetchAndGenerateFromOneGraph({ netlifyGraphConfig, netlifyToken, state, siteId })
|
|
34
|
+
|
|
35
|
+
const oneGraphSessionId = loadCLISession(state)
|
|
36
|
+
|
|
37
|
+
if (!oneGraphSessionId) {
|
|
38
|
+
warn('No local Netlify Graph session found, skipping command queue drain')
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const schemaString = readGraphQLSchemaFile(netlifyGraphConfig)
|
|
43
|
+
|
|
44
|
+
let schema
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
schema = buildSchema(schemaString)
|
|
48
|
+
} catch (buildSchemaError) {
|
|
49
|
+
error(`Error parsing schema: ${buildSchemaError}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!schema) {
|
|
53
|
+
error(`Failed to fetch and update Netlify GraphQL schema`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const next = await OneGraphCliClient.fetchCliSessionEvents({
|
|
57
|
+
appId: siteId,
|
|
58
|
+
authToken: netlifyToken,
|
|
59
|
+
sessionId: oneGraphSessionId,
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
if (next.errors) {
|
|
63
|
+
error(`Failed to fetch Netlify Graph cli session events`, next.errors)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (next.events) {
|
|
67
|
+
const ackIds = []
|
|
68
|
+
for (const event of next.events) {
|
|
69
|
+
await handleCliSessionEvent({ netlifyToken, event, netlifyGraphConfig, schema, siteId: site.id })
|
|
70
|
+
ackIds.push(event.id)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
await OneGraphCliClient.ackCLISessionEvents({
|
|
74
|
+
appId: siteId,
|
|
75
|
+
authToken: netlifyToken,
|
|
76
|
+
sessionId: oneGraphSessionId,
|
|
77
|
+
eventIds: ackIds,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Creates the `netlify graph:pull` command
|
|
84
|
+
* @param {import('../base-command').BaseCommand} program
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
const createGraphPullCommand = (program) =>
|
|
88
|
+
program
|
|
89
|
+
.command('graph:pull')
|
|
90
|
+
.description('Pull down your local Netlify Graph schema, and process pending Graph edit events')
|
|
91
|
+
.action(async (options, command) => {
|
|
92
|
+
await graphPull(options, command)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
module.exports = { createGraphPullCommand }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
const { createGraphEditCommand } = require('./graph-edit')
|
|
3
|
+
const { createGraphPullCommand } = require('./graph-pull')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The graph command
|
|
7
|
+
* @param {import('commander').OptionValues} options
|
|
8
|
+
* @param {import('../base-command').BaseCommand} command
|
|
9
|
+
*/
|
|
10
|
+
const graph = (options, command) => {
|
|
11
|
+
command.help()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates the `netlify graph` command
|
|
16
|
+
* @param {import('../base-command').BaseCommand} program
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
const createGraphCommand = (program) => {
|
|
20
|
+
createGraphEditCommand(program)
|
|
21
|
+
createGraphPullCommand(program)
|
|
22
|
+
|
|
23
|
+
return program
|
|
24
|
+
.command('graph')
|
|
25
|
+
.description('(Beta) Control the Netlify Graph functions for the current site')
|
|
26
|
+
.addExamples(['netlify graph:pull', 'netlify graph:edit'])
|
|
27
|
+
.action(graph)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { createGraphCommand }
|
package/src/commands/main.js
CHANGED
|
@@ -29,6 +29,7 @@ const { createDeployCommand } = require('./deploy')
|
|
|
29
29
|
const { createDevCommand } = require('./dev')
|
|
30
30
|
const { createEnvCommand } = require('./env')
|
|
31
31
|
const { createFunctionsCommand } = require('./functions')
|
|
32
|
+
const { createGraphCommand } = require('./graph')
|
|
32
33
|
const { createInitCommand } = require('./init')
|
|
33
34
|
const { createLinkCommand } = require('./link')
|
|
34
35
|
const { createLmCommand } = require('./lm')
|
|
@@ -170,6 +171,7 @@ const createMainCommand = () => {
|
|
|
170
171
|
createDevCommand(program)
|
|
171
172
|
createEnvCommand(program)
|
|
172
173
|
createFunctionsCommand(program)
|
|
174
|
+
createGraphCommand(program)
|
|
173
175
|
createInitCommand(program)
|
|
174
176
|
createLinkCommand(program)
|
|
175
177
|
createLmCommand(program)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"stripe": "^8.
|
|
12
|
+
"stripe": "^8.199.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@types/node": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"node_modules/stripe": {
|
|
108
|
-
"version": "8.
|
|
109
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
110
|
-
"integrity": "sha512-
|
|
108
|
+
"version": "8.199.0",
|
|
109
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.199.0.tgz",
|
|
110
|
+
"integrity": "sha512-Bc5Zfp6eOOCdde9x5NPrAczeGSKuNwemzjsfGJXWtpbUfQXgJujzTGgkhx2YuzamqakDYJkTgf9w7Ry2uY8QNA==",
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@types/node": ">=8.1.0",
|
|
113
113
|
"qs": "^6.6.0"
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"stripe": {
|
|
187
|
-
"version": "8.
|
|
188
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
189
|
-
"integrity": "sha512-
|
|
187
|
+
"version": "8.199.0",
|
|
188
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.199.0.tgz",
|
|
189
|
+
"integrity": "sha512-Bc5Zfp6eOOCdde9x5NPrAczeGSKuNwemzjsfGJXWtpbUfQXgJujzTGgkhx2YuzamqakDYJkTgf9w7Ry2uY8QNA==",
|
|
190
190
|
"requires": {
|
|
191
191
|
"@types/node": ">=8.1.0",
|
|
192
192
|
"qs": "^6.6.0"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"stripe": "^8.
|
|
12
|
+
"stripe": "^8.199.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@types/node": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"node_modules/stripe": {
|
|
108
|
-
"version": "8.
|
|
109
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
110
|
-
"integrity": "sha512-
|
|
108
|
+
"version": "8.199.0",
|
|
109
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.199.0.tgz",
|
|
110
|
+
"integrity": "sha512-Bc5Zfp6eOOCdde9x5NPrAczeGSKuNwemzjsfGJXWtpbUfQXgJujzTGgkhx2YuzamqakDYJkTgf9w7Ry2uY8QNA==",
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@types/node": ">=8.1.0",
|
|
113
113
|
"qs": "^6.6.0"
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"stripe": {
|
|
187
|
-
"version": "8.
|
|
188
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.
|
|
189
|
-
"integrity": "sha512-
|
|
187
|
+
"version": "8.199.0",
|
|
188
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-8.199.0.tgz",
|
|
189
|
+
"integrity": "sha512-Bc5Zfp6eOOCdde9x5NPrAczeGSKuNwemzjsfGJXWtpbUfQXgJujzTGgkhx2YuzamqakDYJkTgf9w7Ry2uY8QNA==",
|
|
190
190
|
"requires": {
|
|
191
191
|
"@types/node": ">=8.1.0",
|
|
192
192
|
"qs": "^6.6.0"
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"axios": "^0.
|
|
13
|
-
"qs": "^6.
|
|
12
|
+
"axios": "^0.25.0",
|
|
13
|
+
"qs": "^6.7.0"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"node_modules/axios": {
|
|
17
|
-
"version": "0.
|
|
18
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-0.
|
|
19
|
-
"integrity": "sha512-
|
|
17
|
+
"version": "0.25.0",
|
|
18
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz",
|
|
19
|
+
"integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"follow-redirects": "^1.14.
|
|
21
|
+
"follow-redirects": "^1.14.7"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"node_modules/call-bind": {
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"node_modules/follow-redirects": {
|
|
37
|
-
"version": "1.14.
|
|
38
|
-
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.
|
|
39
|
-
"integrity": "sha512
|
|
37
|
+
"version": "1.14.7",
|
|
38
|
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
|
39
|
+
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
|
|
40
40
|
"funding": [
|
|
41
41
|
{
|
|
42
42
|
"type": "individual",
|
|
@@ -130,11 +130,11 @@
|
|
|
130
130
|
},
|
|
131
131
|
"dependencies": {
|
|
132
132
|
"axios": {
|
|
133
|
-
"version": "0.
|
|
134
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-0.
|
|
135
|
-
"integrity": "sha512-
|
|
133
|
+
"version": "0.25.0",
|
|
134
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz",
|
|
135
|
+
"integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==",
|
|
136
136
|
"requires": {
|
|
137
|
-
"follow-redirects": "^1.14.
|
|
137
|
+
"follow-redirects": "^1.14.7"
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
"call-bind": {
|
|
@@ -147,9 +147,9 @@
|
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
"follow-redirects": {
|
|
150
|
-
"version": "1.14.
|
|
151
|
-
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.
|
|
152
|
-
"integrity": "sha512
|
|
150
|
+
"version": "1.14.7",
|
|
151
|
+
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
|
152
|
+
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
|
|
153
153
|
},
|
|
154
154
|
"function-bind": {
|
|
155
155
|
"version": "1.1.1",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@netlify/functions": "^0.11.0",
|
|
13
13
|
"@types/node": "^14.0.0",
|
|
14
|
-
"typescript": "^4.
|
|
14
|
+
"typescript": "^4.5.5"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"node_modules/@netlify/functions": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"node_modules/@types/node": {
|
|
29
|
-
"version": "14.18.
|
|
30
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
31
|
-
"integrity": "sha512-
|
|
29
|
+
"version": "14.18.9",
|
|
30
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.9.tgz",
|
|
31
|
+
"integrity": "sha512-j11XSuRuAlft6vLDEX4RvhqC0KxNxx6QIyMXNb0vHHSNPXTPeiy3algESWmOOIzEtiEL0qiowPU3ewW9hHVa7Q=="
|
|
32
32
|
},
|
|
33
33
|
"node_modules/is-promise": {
|
|
34
34
|
"version": "4.0.0",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
|
|
37
37
|
},
|
|
38
38
|
"node_modules/typescript": {
|
|
39
|
-
"version": "4.5.
|
|
40
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.
|
|
41
|
-
"integrity": "sha512-
|
|
39
|
+
"version": "4.5.5",
|
|
40
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
|
41
|
+
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
|
|
42
42
|
"bin": {
|
|
43
43
|
"tsc": "bin/tsc",
|
|
44
44
|
"tsserver": "bin/tsserver"
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"@types/node": {
|
|
61
|
-
"version": "14.18.
|
|
62
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
63
|
-
"integrity": "sha512-
|
|
61
|
+
"version": "14.18.9",
|
|
62
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.9.tgz",
|
|
63
|
+
"integrity": "sha512-j11XSuRuAlft6vLDEX4RvhqC0KxNxx6QIyMXNb0vHHSNPXTPeiy3algESWmOOIzEtiEL0qiowPU3ewW9hHVa7Q=="
|
|
64
64
|
},
|
|
65
65
|
"is-promise": {
|
|
66
66
|
"version": "4.0.0",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
|
|
69
69
|
},
|
|
70
70
|
"typescript": {
|
|
71
|
-
"version": "4.5.
|
|
72
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.
|
|
73
|
-
"integrity": "sha512-
|
|
71
|
+
"version": "4.5.5",
|
|
72
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
|
|
73
|
+
"integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA=="
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|