Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createDeploy = async () => {
// Required
const site = 'calibre'
// Optional
const revision = 'v100'
const repository = 'https://github.com/calibreapp'
const username = 'micdijkstra'
const createdAt = '2019-04-25T04:11:00+10:00'
// Create the deploy
const deploy = await Deploy.create({
site,
revision,
repository,
username,
createdAt
})
// Output the formatted JSON response
console.log(JSON.stringify(deploy, null, 2))
}
const listDeploys = async () => {
// Required
const site = 'calibre'
// List the deploys
const deploys = await Deploy.list({
site
})
// Output the formatted JSON response
console.log(JSON.stringify(deploys, null, 2))
}
const listIntegrations = async () => {
const site = 'calibre' // site slug
const count = 20 // number of integrations to return, maximum 500
// List the integrations
const integrations = await Integration.list({
site,
count
})
// Output the formatted JSON response
console.log(JSON.stringify(integrations, null, 2))
}
const createSnapshot = async () => {
// Required
const site = 'calibre'
// Optional
const ref = 'v100'
// Create the snapshot
const snapshot = await Snapshot.create({
site,
ref
})
// Output the formatted JSON response
console.log(JSON.stringify(snapshot, null, 2))
}
const site = async () => {
const query = `
query Site($slug: String!){
organisation {
site(slug: $slug) {
name
slug
}
}
}
`
const slug = 'calibre'
try {
const result = await GraphQL.request({ query, slug })
console.log(result)
} catch (e) {
console.error(e)
}
}
value: 'sessionId',
domain: 'calibreapp.com',
path: '/',
secure: true,
httpOnly: true
}
]
},
{
name: 'iPhone 8, 3G',
device: 'iPhone8',
connection: 'good3G'
}
]
try {
const site = await Site.create({ name, location, pages, testProfiles })
console.log('Created', site)
} catch (e) {
console.error(e)
}
}
const main = async () => {
const sites = await Site.list()
const to = new Date()
const from = new Date()
from.setDate(to.getDate() - 7)
console.log(`=== ${sites.length} sites`)
const metrics = await Promise.all(
sites.map(({ slug }) => {
return TimeSeries.list({
site: slug,
from: from.toUTCString(),
to: to.toUTCString(),
measurements: ['consistently-interactive']
})
sites.map(({ slug }) => {
return TimeSeries.list({
site: slug,
from: from.toUTCString(),
to: to.toUTCString(),
measurements: ['consistently-interactive']
})
})
)