-
Notifications
You must be signed in to change notification settings - Fork 41
feat: Command Line SDK update for version 13.0.0-rc.1 #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| appwrite databases upsert-document \ | ||
| --database-id <DATABASE_ID> \ | ||
| --collection-id <COLLECTION_ID> \ | ||
| --document-id <DOCUMENT_ID> \ | ||
| --data '{ "key": "value" }' | ||
| --document-id <DOCUMENT_ID> | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| #! /usr/bin/env node | ||
|
|
||
| /** Required to set max width of the help commands */ | ||
| const oldWidth = process.stdout.columns; | ||
| process.stdout.columns = 100; | ||
| /** ---------------------------------------------- */ | ||
|
|
||
| import program = require('commander'); | ||
| import chalk = require('chalk'); | ||
| const { version } = require('../package.json'); | ||
| import { commandDescriptions, cliConfig } from './lib/parser'; | ||
| import { client } from './lib/commands/generic'; | ||
| import { getLatestVersion, compareVersions } from './lib/utils'; | ||
| import inquirer = require('inquirer'); | ||
| import { login, logout, whoami, migrate, register } from './lib/commands/generic'; | ||
| import { init } from './lib/commands/init'; | ||
| import { types } from './lib/commands/types'; | ||
| import { pull } from './lib/commands/pull'; | ||
| import { run } from './lib/commands/run'; | ||
| import { push, deploy } from './lib/commands/push'; | ||
| import { update } from './lib/commands/update'; | ||
| import { account } from './lib/commands/account'; | ||
| import { console } from './lib/commands/console'; | ||
| import { databases } from './lib/commands/databases'; | ||
| import { functions } from './lib/commands/functions'; | ||
| import { graphql } from './lib/commands/graphql'; | ||
| import { health } from './lib/commands/health'; | ||
| import { locale } from './lib/commands/locale'; | ||
| import { messaging } from './lib/commands/messaging'; | ||
| import { migrations } from './lib/commands/migrations'; | ||
| import { project } from './lib/commands/project'; | ||
| import { projects } from './lib/commands/projects'; | ||
| import { proxy } from './lib/commands/proxy'; | ||
| import { sites } from './lib/commands/sites'; | ||
| import { storage } from './lib/commands/storage'; | ||
| import { tablesDB } from './lib/commands/tables-db'; | ||
| import { teams } from './lib/commands/teams'; | ||
| import { tokens } from './lib/commands/tokens'; | ||
| import { users } from './lib/commands/users'; | ||
| import { vcs } from './lib/commands/vcs'; | ||
|
|
||
| inquirer.registerPrompt('search-list', require('inquirer-search-list')); | ||
|
|
||
| /** | ||
| * Check for updates and show version information | ||
| */ | ||
| async function checkVersion(): Promise<void> { | ||
| process.stdout.write(chalk.bold(`appwrite version ${version}`) + '\n'); | ||
|
|
||
| try { | ||
| const latestVersion = await getLatestVersion(); | ||
| const comparison = compareVersions(version, latestVersion); | ||
|
|
||
| if (comparison > 0) { | ||
| // Current version is older than latest | ||
| process.stdout.write( | ||
| chalk.yellow(`\n⚠️ A newer version is available: ${chalk.bold(latestVersion)}`) + '\n' | ||
| ); | ||
| process.stdout.write( | ||
| chalk.cyan( | ||
| `💡 Run '${chalk.bold('appwrite update')}' to update to the latest version.` | ||
| ) + '\n' | ||
| ); | ||
| } else if (comparison === 0) { | ||
| process.stdout.write(chalk.green('\n✅ You are running the latest version!') + '\n'); | ||
| } else { | ||
| // Current version is newer than latest (pre-release/dev) | ||
| process.stdout.write(chalk.blue('\n🚀 You are running a pre-release or development version.') + '\n'); | ||
| } | ||
| } catch (error) { | ||
| // Silently fail version check, just show current version | ||
| process.stdout.write(chalk.gray('\n(Unable to check for updates)') + '\n'); | ||
| } | ||
| } | ||
|
|
||
| // Intercept version flag before Commander.js processes it | ||
| if (process.argv.includes('-v') || process.argv.includes('--version')) { | ||
| (async () => { | ||
| await checkVersion(); | ||
| process.exit(0); | ||
| })(); | ||
| } else { | ||
| program | ||
| .description(commandDescriptions['main']) | ||
| .configureHelp({ | ||
| helpWidth: process.stdout.columns || 80, | ||
| sortSubcommands: true, | ||
| }) | ||
| .helpOption('-h, --help', 'Display help for command') | ||
| .version(version, '-v, --version', 'Output the version number') | ||
| .option('-V, --verbose', 'Show complete error log') | ||
| .option('-j, --json', 'Output in JSON format') | ||
| .hook('preAction', migrate) | ||
| .option('-f,--force', 'Flag to confirm all warnings') | ||
| .option('-a,--all', 'Flag to push all resources') | ||
| .option('--id [id...]', 'Flag to pass a list of ids for a given action') | ||
| .option('--report', 'Enable reporting in case of CLI errors') | ||
| .on('option:json', () => { | ||
| cliConfig.json = true; | ||
| }) | ||
| .on('option:verbose', () => { | ||
| cliConfig.verbose = true; | ||
| }) | ||
| .on('option:report', function () { | ||
| cliConfig.report = true; | ||
| cliConfig.reportData = { data: this }; | ||
| }) | ||
| .on('option:force', () => { | ||
| cliConfig.force = true; | ||
| }) | ||
| .on('option:all', () => { | ||
| cliConfig.all = true; | ||
| }) | ||
| .on('option:id', function () { | ||
| cliConfig.ids = (this as any).opts().id; | ||
| }) | ||
| .showSuggestionAfterError() | ||
| .addCommand(whoami) | ||
| .addCommand(register) | ||
| .addCommand(login) | ||
| .addCommand(init) | ||
| .addCommand(pull) | ||
| .addCommand(push) | ||
| .addCommand(types) | ||
| .addCommand(deploy) | ||
| .addCommand(run) | ||
| .addCommand(update) | ||
| .addCommand(logout) | ||
| .addCommand(account) | ||
| .addCommand(console) | ||
| .addCommand(databases) | ||
| .addCommand(functions) | ||
| .addCommand(graphql) | ||
| .addCommand(health) | ||
| .addCommand(locale) | ||
| .addCommand(messaging) | ||
| .addCommand(migrations) | ||
| .addCommand(project) | ||
| .addCommand(projects) | ||
| .addCommand(proxy) | ||
| .addCommand(sites) | ||
| .addCommand(storage) | ||
| .addCommand(tablesDB) | ||
| .addCommand(teams) | ||
| .addCommand(tokens) | ||
| .addCommand(users) | ||
| .addCommand(vcs) | ||
| .addCommand(client) | ||
| .parse(process.argv); | ||
|
|
||
| process.stdout.columns = oldWidth; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
--dataparameter to the upsert-document example.The upsertDocument operation requires a
dataparameter containing the document attributes to be created or updated. The example must include this parameter with sample JSON data for the command to function correctly:🤖 Prompt for AI Agents