How to use the @vtex/api.Workspaces function in @vtex/api

To help you get started, we’ve selected a few @vtex/api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtex / toolbelt / scripts / mass-apps-operations.ts View on Github external
const main = async () => {
  try {
    console.log('\n' + dragons)
    if (!await confirm(accounts.length, command, app)) {
      console.log('What do we say to the God of Death? Not today.')
      process.exit(2)
    }
    console.log(c.blue('I sure hope you know what you\'re doing.'))

    const workspace = `${WORKSPACE_NAME_PREFIX}-${command}`
    const workspaces = new Workspaces({
      account: 'vtex',
      workspace: 'master',
      authToken,
      userAgent: USER_AGENT,
      region: REGION,
    })

    await Promise.map(accounts, queue.wrap(uninstall(workspace, workspaces)))

    if (skippedAccounts.length === 0) {
      console.log('✅  All done!')
    } else {
      writeJSON('./errors.json', errorLogs, {spaces: 2})
      writeJSON('./skipped-accounts.json', skippedAccounts.map(a => ({name: a})), {spaces: 2})
      console.log()
      console.log('🚫  The following accounts were skipped:')
github vtex / toolbelt / src / clients / index.ts View on Github external
const mergedContext = { ...context, ...customContext }
  const mergedOptions = { ...options, ...customOptions }
  return {
    builder: new Builder(mergedContext, mergedOptions),
    logger: new Logger(mergedContext, mergedOptions),
    registry: new Registry(mergedContext, mergedOptions),
    rewriter: new Rewriter(mergedContext, mergedOptions),
    events: new Events(mergedContext, mergedOptions),
  }
}

const [apps, router, workspaces, logger, events, billing, rewriter] = getToken()
  ? [
      new Apps(context, options),
      new Router(context, options),
      new Workspaces(context, options),
      new Logger(context),
      new Events(context),
      new Billing(context, options),
      new Rewriter(context, options),
    ]
  : [
      interceptor('apps'),
      interceptor('router'),
      interceptor('workspaces'),
      interceptor('logger'),
      interceptor('events'),
      interceptor('billing'),
      interceptor('rewriter'),
    ]

export { apps, router, workspaces, logger, events, createClients, billing, rewriter }