appwrite-cli 8.2.2 → 9.0.0
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/CHANGELOG.md +12 -0
- package/README.md +5 -5
- package/docs/examples/account/create-anonymous-session.md +1 -1
- package/docs/examples/account/create-email-password-session.md +3 -3
- package/docs/examples/account/create-email-token.md +3 -4
- package/docs/examples/account/create-jwt.md +1 -0
- package/docs/examples/account/create-magic-url-token.md +3 -0
- package/docs/examples/account/create-mfa-authenticator.md +2 -2
- package/docs/examples/account/create-mfa-challenge.md +2 -2
- package/docs/examples/account/create-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/create-o-auth-2-session.md +2 -0
- package/docs/examples/account/create-o-auth-2-token.md +2 -0
- package/docs/examples/account/create-phone-token.md +3 -3
- package/docs/examples/account/create-phone-verification.md +1 -1
- package/docs/examples/account/create-push-target.md +3 -4
- package/docs/examples/account/create-recovery.md +3 -3
- package/docs/examples/account/create-session.md +3 -3
- package/docs/examples/account/create-verification.md +2 -2
- package/docs/examples/account/create.md +3 -4
- package/docs/examples/account/delete-identity.md +2 -2
- package/docs/examples/account/delete-mfa-authenticator.md +2 -2
- package/docs/examples/account/delete-push-target.md +2 -2
- package/docs/examples/account/delete-session.md +2 -2
- package/docs/examples/account/delete-sessions.md +1 -1
- package/docs/examples/account/get-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/get-prefs.md +1 -1
- package/docs/examples/account/get-session.md +2 -2
- package/docs/examples/account/list-identities.md +1 -2
- package/docs/examples/account/list-logs.md +1 -2
- package/docs/examples/account/list-mfa-factors.md +1 -1
- package/docs/examples/account/list-sessions.md +1 -1
- package/docs/examples/account/update-email.md +3 -3
- package/docs/examples/account/update-magic-url-session.md +3 -0
- package/docs/examples/account/update-mfa-authenticator.md +3 -3
- package/docs/examples/account/update-mfa-challenge.md +3 -3
- package/docs/examples/account/update-mfa-recovery-codes.md +1 -1
- package/docs/examples/account/update-mfa.md +2 -0
- package/docs/examples/account/update-name.md +2 -2
- package/docs/examples/account/update-password.md +2 -3
- package/docs/examples/account/update-phone-session.md +3 -3
- package/docs/examples/account/update-phone-verification.md +3 -3
- package/docs/examples/account/update-phone.md +3 -3
- package/docs/examples/account/update-prefs.md +2 -2
- package/docs/examples/account/update-push-target.md +3 -3
- package/docs/examples/account/update-recovery.md +4 -4
- package/docs/examples/account/update-session.md +2 -2
- package/docs/examples/account/update-status.md +1 -1
- package/docs/examples/account/update-verification.md +3 -3
- package/docs/examples/avatars/get-browser.md +2 -5
- package/docs/examples/avatars/get-credit-card.md +2 -5
- package/docs/examples/avatars/get-favicon.md +2 -2
- package/docs/examples/avatars/get-flag.md +2 -5
- package/docs/examples/avatars/get-image.md +2 -4
- package/docs/examples/avatars/get-initials.md +1 -5
- package/docs/examples/avatars/get-qr.md +2 -0
- package/docs/examples/console/get-resource.md +3 -3
- package/docs/examples/databases/create-boolean-attribute.md +5 -7
- package/docs/examples/databases/create-collection.md +4 -7
- package/docs/examples/databases/create-datetime-attribute.md +5 -7
- package/docs/examples/databases/create-document.md +5 -6
- package/docs/examples/databases/create-documents.md +4 -4
- package/docs/examples/databases/create-email-attribute.md +5 -7
- package/docs/examples/databases/create-enum-attribute.md +6 -8
- package/docs/examples/databases/create-float-attribute.md +5 -9
- package/docs/examples/databases/create-index.md +6 -8
- package/docs/examples/databases/create-integer-attribute.md +5 -9
- package/docs/examples/databases/create-ip-attribute.md +5 -7
- package/docs/examples/databases/create-relationship-attribute.md +5 -9
- package/docs/examples/databases/create-string-attribute.md +6 -9
- package/docs/examples/databases/create-url-attribute.md +5 -7
- package/docs/examples/databases/create.md +2 -3
- package/docs/examples/databases/decrement-document-attribute.md +5 -0
- package/docs/examples/databases/delete-attribute.md +4 -4
- package/docs/examples/databases/delete-collection.md +3 -3
- package/docs/examples/databases/delete-document.md +4 -4
- package/docs/examples/databases/delete-documents.md +3 -4
- package/docs/examples/databases/delete-index.md +4 -4
- package/docs/examples/databases/delete.md +1 -1
- package/docs/examples/databases/get-attribute.md +4 -4
- package/docs/examples/databases/get-collection-usage.md +3 -4
- package/docs/examples/databases/get-collection.md +3 -3
- package/docs/examples/databases/get-document.md +4 -5
- package/docs/examples/databases/get-index.md +4 -4
- package/docs/examples/databases/get-usage.md +2 -2
- package/docs/examples/databases/get.md +1 -1
- package/docs/examples/databases/increment-document-attribute.md +5 -0
- package/docs/examples/databases/list-attributes.md +3 -4
- package/docs/examples/databases/list-collection-logs.md +3 -4
- package/docs/examples/databases/list-collections.md +2 -4
- package/docs/examples/databases/list-document-logs.md +4 -5
- package/docs/examples/databases/list-documents.md +3 -4
- package/docs/examples/databases/list-indexes.md +3 -4
- package/docs/examples/databases/list-logs.md +2 -3
- package/docs/examples/databases/list-usage.md +1 -0
- package/docs/examples/databases/list.md +1 -3
- package/docs/examples/databases/update-boolean-attribute.md +6 -7
- package/docs/examples/databases/update-collection.md +4 -7
- package/docs/examples/databases/update-datetime-attribute.md +6 -7
- package/docs/examples/databases/update-document.md +4 -6
- package/docs/examples/databases/update-documents.md +3 -5
- package/docs/examples/databases/update-email-attribute.md +6 -7
- package/docs/examples/databases/update-enum-attribute.md +7 -8
- package/docs/examples/databases/update-float-attribute.md +6 -9
- package/docs/examples/databases/update-integer-attribute.md +6 -9
- package/docs/examples/databases/update-ip-attribute.md +6 -7
- package/docs/examples/databases/update-relationship-attribute.md +4 -6
- package/docs/examples/databases/update-string-attribute.md +6 -8
- package/docs/examples/databases/update-url-attribute.md +6 -7
- package/docs/examples/databases/update.md +2 -3
- package/docs/examples/databases/upsert-document.md +5 -6
- package/docs/examples/databases/upsert-documents.md +4 -4
- package/docs/examples/functions/create-deployment.md +4 -6
- package/docs/examples/functions/create-duplicate-deployment.md +3 -4
- package/docs/examples/functions/create-execution.md +2 -8
- package/docs/examples/functions/create-template-deployment.md +6 -7
- package/docs/examples/functions/create-variable.md +4 -5
- package/docs/examples/functions/create-vcs-deployment.md +4 -5
- package/docs/examples/functions/create.md +3 -18
- package/docs/examples/functions/delete-deployment.md +3 -3
- package/docs/examples/functions/delete-execution.md +3 -3
- package/docs/examples/functions/delete-variable.md +3 -3
- package/docs/examples/functions/delete.md +1 -1
- package/docs/examples/functions/get-deployment-download.md +3 -4
- package/docs/examples/functions/get-deployment.md +3 -3
- package/docs/examples/functions/get-execution.md +3 -3
- package/docs/examples/functions/get-template.md +2 -2
- package/docs/examples/functions/get-usage.md +2 -3
- package/docs/examples/functions/get-variable.md +3 -3
- package/docs/examples/functions/get.md +1 -1
- package/docs/examples/functions/list-deployments.md +2 -4
- package/docs/examples/functions/list-executions.md +2 -3
- package/docs/examples/functions/list-runtimes.md +1 -1
- package/docs/examples/functions/list-specifications.md +1 -1
- package/docs/examples/functions/list-templates.md +1 -5
- package/docs/examples/functions/list-usage.md +1 -2
- package/docs/examples/functions/list-variables.md +2 -2
- package/docs/examples/functions/list.md +1 -3
- package/docs/examples/functions/update-deployment-status.md +3 -3
- package/docs/examples/functions/update-function-deployment.md +3 -3
- package/docs/examples/functions/update-variable.md +4 -6
- package/docs/examples/functions/update.md +2 -18
- package/docs/examples/graphql/mutation.md +1 -1
- package/docs/examples/graphql/query.md +1 -1
- package/docs/examples/health/get-antivirus.md +1 -1
- package/docs/examples/health/get-cache.md +1 -1
- package/docs/examples/health/get-certificate.md +1 -2
- package/docs/examples/health/get-db.md +1 -0
- package/docs/examples/health/get-failed-jobs.md +2 -3
- package/docs/examples/health/get-pub-sub.md +1 -1
- package/docs/examples/health/get-queue-builds.md +1 -2
- package/docs/examples/health/get-queue-certificates.md +1 -2
- package/docs/examples/health/get-queue-databases.md +1 -3
- package/docs/examples/health/get-queue-deletes.md +1 -2
- package/docs/examples/health/get-queue-functions.md +1 -2
- package/docs/examples/health/get-queue-logs.md +1 -2
- package/docs/examples/health/get-queue-mails.md +1 -2
- package/docs/examples/health/get-queue-messaging.md +1 -2
- package/docs/examples/health/get-queue-migrations.md +1 -2
- package/docs/examples/health/get-queue-stats-resources.md +1 -2
- package/docs/examples/health/get-queue-usage.md +1 -2
- package/docs/examples/health/get-queue-webhooks.md +1 -2
- package/docs/examples/health/get-storage-local.md +1 -1
- package/docs/examples/health/get-storage.md +1 -1
- package/docs/examples/health/get-time.md +1 -1
- package/docs/examples/locale/list-codes.md +1 -1
- package/docs/examples/locale/list-continents.md +1 -1
- package/docs/examples/locale/list-countries-eu.md +1 -0
- package/docs/examples/locale/list-countries-phones.md +1 -1
- package/docs/examples/locale/list-countries.md +1 -1
- package/docs/examples/locale/list-currencies.md +1 -1
- package/docs/examples/locale/list-languages.md +1 -1
- package/docs/examples/messaging/create-apns-provider.md +3 -9
- package/docs/examples/messaging/create-email.md +4 -13
- package/docs/examples/messaging/create-fcm-provider.md +3 -5
- package/docs/examples/messaging/create-mailgun-provider.md +3 -11
- package/docs/examples/messaging/create-msg-91-provider.md +3 -0
- package/docs/examples/messaging/create-push.md +2 -20
- package/docs/examples/messaging/create-sendgrid-provider.md +3 -9
- package/docs/examples/messaging/create-sms.md +3 -8
- package/docs/examples/messaging/create-smtp-provider.md +4 -15
- package/docs/examples/messaging/create-subscriber.md +4 -4
- package/docs/examples/messaging/create-telesign-provider.md +3 -7
- package/docs/examples/messaging/create-textmagic-provider.md +3 -7
- package/docs/examples/messaging/create-topic.md +3 -4
- package/docs/examples/messaging/create-twilio-provider.md +3 -7
- package/docs/examples/messaging/create-vonage-provider.md +3 -7
- package/docs/examples/messaging/delete-provider.md +2 -2
- package/docs/examples/messaging/delete-subscriber.md +3 -3
- package/docs/examples/messaging/delete-topic.md +2 -2
- package/docs/examples/messaging/delete.md +1 -1
- package/docs/examples/messaging/get-message.md +2 -2
- package/docs/examples/messaging/get-provider.md +2 -2
- package/docs/examples/messaging/get-subscriber.md +3 -3
- package/docs/examples/messaging/get-topic.md +2 -2
- package/docs/examples/messaging/list-message-logs.md +2 -3
- package/docs/examples/messaging/list-messages.md +1 -3
- package/docs/examples/messaging/list-provider-logs.md +2 -3
- package/docs/examples/messaging/list-providers.md +1 -3
- package/docs/examples/messaging/list-subscriber-logs.md +2 -3
- package/docs/examples/messaging/list-subscribers.md +2 -4
- package/docs/examples/messaging/list-targets.md +2 -3
- package/docs/examples/messaging/list-topic-logs.md +2 -3
- package/docs/examples/messaging/list-topics.md +1 -3
- package/docs/examples/messaging/update-apns-provider.md +2 -9
- package/docs/examples/messaging/update-email.md +2 -13
- package/docs/examples/messaging/update-fcm-provider.md +2 -5
- package/docs/examples/messaging/update-mailgun-provider.md +2 -11
- package/docs/examples/messaging/update-msg-91-provider.md +2 -0
- package/docs/examples/messaging/update-push.md +2 -20
- package/docs/examples/messaging/update-sendgrid-provider.md +2 -9
- package/docs/examples/messaging/update-sms.md +2 -8
- package/docs/examples/messaging/update-smtp-provider.md +2 -15
- package/docs/examples/messaging/update-telesign-provider.md +2 -7
- package/docs/examples/messaging/update-textmagic-provider.md +2 -7
- package/docs/examples/messaging/update-topic.md +2 -4
- package/docs/examples/messaging/update-twilio-provider.md +2 -7
- package/docs/examples/messaging/update-vonage-provider.md +2 -7
- package/docs/examples/migrations/create-appwrite-migration.md +5 -5
- package/docs/examples/migrations/create-csv-migration.md +4 -4
- package/docs/examples/migrations/create-firebase-migration.md +3 -3
- package/docs/examples/migrations/create-n-host-migration.md +8 -9
- package/docs/examples/migrations/create-supabase-migration.md +7 -8
- package/docs/examples/migrations/delete.md +1 -1
- package/docs/examples/migrations/get-appwrite-report.md +5 -5
- package/docs/examples/migrations/get-firebase-report.md +3 -3
- package/docs/examples/migrations/get-n-host-report.md +8 -9
- package/docs/examples/migrations/get-supabase-report.md +7 -8
- package/docs/examples/migrations/get.md +1 -1
- package/docs/examples/migrations/list.md +1 -3
- package/docs/examples/migrations/retry.md +1 -1
- package/docs/examples/project/create-variable.md +3 -4
- package/docs/examples/project/delete-variable.md +2 -2
- package/docs/examples/project/get-usage.md +3 -4
- package/docs/examples/project/get-variable.md +2 -2
- package/docs/examples/project/list-variables.md +1 -1
- package/docs/examples/project/update-variable.md +3 -5
- package/docs/examples/projects/create-dev-key.md +4 -4
- package/docs/examples/projects/create-jwt.md +3 -0
- package/docs/examples/projects/create-key.md +4 -5
- package/docs/examples/projects/create-platform.md +4 -7
- package/docs/examples/projects/create-smtp-test.md +6 -11
- package/docs/examples/projects/create-webhook.md +6 -9
- package/docs/examples/projects/create.md +3 -13
- package/docs/examples/projects/delete-dev-key.md +3 -3
- package/docs/examples/projects/delete-email-template.md +4 -4
- package/docs/examples/projects/delete-key.md +3 -3
- package/docs/examples/projects/delete-platform.md +3 -3
- package/docs/examples/projects/delete-sms-template.md +4 -4
- package/docs/examples/projects/delete-webhook.md +3 -3
- package/docs/examples/projects/delete.md +1 -1
- package/docs/examples/projects/get-dev-key.md +3 -3
- package/docs/examples/projects/get-email-template.md +4 -4
- package/docs/examples/projects/get-key.md +3 -3
- package/docs/examples/projects/get-platform.md +3 -3
- package/docs/examples/projects/get-sms-template.md +4 -4
- package/docs/examples/projects/get-webhook.md +3 -3
- package/docs/examples/projects/get.md +1 -1
- package/docs/examples/projects/list-dev-keys.md +2 -3
- package/docs/examples/projects/list-keys.md +2 -2
- package/docs/examples/projects/list-platforms.md +2 -2
- package/docs/examples/projects/list-webhooks.md +2 -2
- package/docs/examples/projects/list.md +1 -3
- package/docs/examples/projects/update-api-status-all.md +3 -3
- package/docs/examples/projects/update-api-status.md +4 -4
- package/docs/examples/projects/update-auth-duration.md +3 -3
- package/docs/examples/projects/update-auth-limit.md +3 -3
- package/docs/examples/projects/update-auth-password-dictionary.md +3 -3
- package/docs/examples/projects/update-auth-password-history.md +3 -3
- package/docs/examples/projects/update-auth-sessions-limit.md +3 -3
- package/docs/examples/projects/update-auth-status.md +4 -4
- package/docs/examples/projects/update-dev-key.md +5 -5
- package/docs/examples/projects/update-email-template.md +6 -9
- package/docs/examples/projects/update-key.md +5 -6
- package/docs/examples/projects/update-memberships-privacy.md +5 -5
- package/docs/examples/projects/update-mock-numbers.md +3 -3
- package/docs/examples/projects/update-o-auth-2.md +3 -0
- package/docs/examples/projects/update-personal-data-check.md +3 -3
- package/docs/examples/projects/update-platform.md +4 -7
- package/docs/examples/projects/update-service-status-all.md +3 -3
- package/docs/examples/projects/update-service-status.md +4 -4
- package/docs/examples/projects/update-session-alerts.md +3 -3
- package/docs/examples/projects/update-session-invalidation.md +3 -0
- package/docs/examples/projects/update-sms-template.md +5 -5
- package/docs/examples/projects/update-smtp.md +3 -11
- package/docs/examples/projects/update-team.md +3 -3
- package/docs/examples/projects/update-webhook-signature.md +3 -3
- package/docs/examples/projects/update-webhook.md +7 -10
- package/docs/examples/projects/update.md +2 -11
- package/docs/examples/proxy/create-api-rule.md +2 -0
- package/docs/examples/proxy/create-function-rule.md +3 -4
- package/docs/examples/proxy/create-redirect-rule.md +6 -6
- package/docs/examples/proxy/create-site-rule.md +3 -4
- package/docs/examples/proxy/delete-rule.md +2 -2
- package/docs/examples/proxy/get-rule.md +2 -2
- package/docs/examples/proxy/list-rules.md +1 -3
- package/docs/examples/proxy/update-rule-verification.md +2 -2
- package/docs/examples/sites/create-deployment.md +4 -7
- package/docs/examples/sites/create-duplicate-deployment.md +3 -3
- package/docs/examples/sites/create-template-deployment.md +6 -7
- package/docs/examples/sites/create-variable.md +4 -5
- package/docs/examples/sites/create-vcs-deployment.md +4 -5
- package/docs/examples/sites/create.md +4 -18
- package/docs/examples/sites/delete-deployment.md +3 -3
- package/docs/examples/sites/delete-log.md +3 -3
- package/docs/examples/sites/delete-variable.md +3 -3
- package/docs/examples/sites/delete.md +1 -1
- package/docs/examples/sites/get-deployment-download.md +3 -4
- package/docs/examples/sites/get-deployment.md +3 -3
- package/docs/examples/sites/get-log.md +3 -3
- package/docs/examples/sites/get-template.md +2 -2
- package/docs/examples/sites/get-usage.md +2 -3
- package/docs/examples/sites/get-variable.md +3 -3
- package/docs/examples/sites/get.md +1 -1
- package/docs/examples/sites/list-deployments.md +2 -4
- package/docs/examples/sites/list-frameworks.md +1 -1
- package/docs/examples/sites/list-logs.md +2 -3
- package/docs/examples/sites/list-specifications.md +1 -1
- package/docs/examples/sites/list-templates.md +1 -5
- package/docs/examples/sites/list-usage.md +1 -2
- package/docs/examples/sites/list-variables.md +2 -2
- package/docs/examples/sites/list.md +1 -3
- package/docs/examples/sites/update-deployment-status.md +3 -3
- package/docs/examples/sites/update-site-deployment.md +3 -3
- package/docs/examples/sites/update-variable.md +4 -6
- package/docs/examples/sites/update.md +3 -18
- package/docs/examples/storage/create-bucket.md +3 -11
- package/docs/examples/storage/create-file.md +4 -5
- package/docs/examples/storage/delete-bucket.md +2 -2
- package/docs/examples/storage/delete-file.md +3 -3
- package/docs/examples/storage/get-bucket-usage.md +2 -3
- package/docs/examples/storage/get-bucket.md +2 -2
- package/docs/examples/storage/get-file-download.md +3 -4
- package/docs/examples/storage/get-file-preview.md +3 -15
- package/docs/examples/storage/get-file-view.md +3 -4
- package/docs/examples/storage/get-file.md +3 -3
- package/docs/examples/storage/get-usage.md +1 -2
- package/docs/examples/storage/list-buckets.md +1 -3
- package/docs/examples/storage/list-files.md +2 -4
- package/docs/examples/storage/update-bucket.md +3 -11
- package/docs/examples/storage/update-file.md +3 -5
- package/docs/examples/tablesdb/create-boolean-column.md +5 -0
- package/docs/examples/tablesdb/create-datetime-column.md +5 -0
- package/docs/examples/tablesdb/create-email-column.md +5 -0
- package/docs/examples/tablesdb/create-enum-column.md +6 -0
- package/docs/examples/tablesdb/create-float-column.md +5 -0
- package/docs/examples/tablesdb/create-index.md +6 -0
- package/docs/examples/tablesdb/create-integer-column.md +5 -0
- package/docs/examples/tablesdb/create-ip-column.md +5 -0
- package/docs/examples/tablesdb/create-relationship-column.md +5 -0
- package/docs/examples/tablesdb/create-row.md +5 -0
- package/docs/examples/tablesdb/create-rows.md +4 -0
- package/docs/examples/tablesdb/create-string-column.md +6 -0
- package/docs/examples/tablesdb/create-table.md +4 -0
- package/docs/examples/tablesdb/create-url-column.md +5 -0
- package/docs/examples/tablesdb/create.md +3 -0
- package/docs/examples/tablesdb/decrement-row-column.md +5 -0
- package/docs/examples/tablesdb/delete-column.md +4 -0
- package/docs/examples/tablesdb/delete-index.md +4 -0
- package/docs/examples/tablesdb/delete-row.md +4 -0
- package/docs/examples/tablesdb/delete-rows.md +3 -0
- package/docs/examples/tablesdb/delete-table.md +3 -0
- package/docs/examples/tablesdb/delete.md +2 -0
- package/docs/examples/tablesdb/get-column.md +4 -0
- package/docs/examples/tablesdb/get-index.md +4 -0
- package/docs/examples/tablesdb/get-row.md +4 -0
- package/docs/examples/tablesdb/get-table-usage.md +3 -0
- package/docs/examples/tablesdb/get-table.md +3 -0
- package/docs/examples/tablesdb/get-usage.md +2 -0
- package/docs/examples/tablesdb/get.md +2 -0
- package/docs/examples/tablesdb/increment-row-column.md +5 -0
- package/docs/examples/tablesdb/list-columns.md +3 -0
- package/docs/examples/tablesdb/list-indexes.md +3 -0
- package/docs/examples/tablesdb/list-row-logs.md +4 -0
- package/docs/examples/tablesdb/list-rows.md +3 -0
- package/docs/examples/tablesdb/list-table-logs.md +3 -0
- package/docs/examples/tablesdb/list-tables.md +2 -0
- package/docs/examples/tablesdb/list-usage.md +1 -0
- package/docs/examples/tablesdb/list.md +1 -0
- package/docs/examples/tablesdb/update-boolean-column.md +6 -0
- package/docs/examples/tablesdb/update-datetime-column.md +6 -0
- package/docs/examples/tablesdb/update-email-column.md +6 -0
- package/docs/examples/tablesdb/update-enum-column.md +7 -0
- package/docs/examples/tablesdb/update-float-column.md +6 -0
- package/docs/examples/tablesdb/update-integer-column.md +6 -0
- package/docs/examples/tablesdb/update-ip-column.md +6 -0
- package/docs/examples/tablesdb/update-relationship-column.md +4 -0
- package/docs/examples/tablesdb/update-row.md +4 -0
- package/docs/examples/tablesdb/update-rows.md +3 -0
- package/docs/examples/tablesdb/update-string-column.md +6 -0
- package/docs/examples/tablesdb/update-table.md +4 -0
- package/docs/examples/tablesdb/update-url-column.md +6 -0
- package/docs/examples/tablesdb/update.md +3 -0
- package/docs/examples/tablesdb/upsert-row.md +4 -0
- package/docs/examples/tablesdb/upsert-rows.md +4 -0
- package/docs/examples/teams/create-membership.md +3 -8
- package/docs/examples/teams/create.md +2 -3
- package/docs/examples/teams/delete-membership.md +3 -3
- package/docs/examples/teams/delete.md +1 -1
- package/docs/examples/teams/get-membership.md +3 -3
- package/docs/examples/teams/get-prefs.md +2 -2
- package/docs/examples/teams/get.md +1 -1
- package/docs/examples/teams/list-logs.md +2 -3
- package/docs/examples/teams/list-memberships.md +2 -4
- package/docs/examples/teams/list.md +1 -3
- package/docs/examples/teams/update-membership-status.md +5 -5
- package/docs/examples/teams/update-membership.md +4 -4
- package/docs/examples/teams/update-name.md +3 -3
- package/docs/examples/teams/update-prefs.md +3 -3
- package/docs/examples/tokens/create-file-token.md +3 -4
- package/docs/examples/tokens/delete.md +1 -1
- package/docs/examples/tokens/get.md +1 -1
- package/docs/examples/tokens/list.md +2 -3
- package/docs/examples/tokens/update.md +1 -2
- package/docs/examples/users/create-argon-2-user.md +4 -0
- package/docs/examples/users/create-bcrypt-user.md +4 -5
- package/docs/examples/users/create-jwt.md +2 -0
- package/docs/examples/users/create-md-5-user.md +4 -0
- package/docs/examples/users/create-mfa-recovery-codes.md +2 -2
- package/docs/examples/users/create-ph-pass-user.md +4 -0
- package/docs/examples/users/create-scrypt-modified-user.md +7 -8
- package/docs/examples/users/create-scrypt-user.md +9 -10
- package/docs/examples/users/create-session.md +2 -2
- package/docs/examples/users/create-sha-user.md +4 -0
- package/docs/examples/users/create-target.md +5 -7
- package/docs/examples/users/create-token.md +2 -4
- package/docs/examples/users/create.md +1 -5
- package/docs/examples/users/delete-identity.md +2 -2
- package/docs/examples/users/delete-mfa-authenticator.md +3 -3
- package/docs/examples/users/delete-session.md +3 -3
- package/docs/examples/users/delete-sessions.md +2 -2
- package/docs/examples/users/delete-target.md +3 -3
- package/docs/examples/users/delete.md +1 -1
- package/docs/examples/users/get-mfa-recovery-codes.md +2 -2
- package/docs/examples/users/get-prefs.md +2 -2
- package/docs/examples/users/get-target.md +3 -3
- package/docs/examples/users/get-usage.md +1 -2
- package/docs/examples/users/get.md +1 -1
- package/docs/examples/users/list-identities.md +1 -3
- package/docs/examples/users/list-logs.md +2 -3
- package/docs/examples/users/list-memberships.md +2 -4
- package/docs/examples/users/list-mfa-factors.md +2 -2
- package/docs/examples/users/list-sessions.md +2 -2
- package/docs/examples/users/list-targets.md +2 -3
- package/docs/examples/users/list.md +1 -3
- package/docs/examples/users/update-email-verification.md +3 -3
- package/docs/examples/users/update-email.md +3 -3
- package/docs/examples/users/update-labels.md +3 -3
- package/docs/examples/users/update-mfa-recovery-codes.md +2 -2
- package/docs/examples/users/update-mfa.md +3 -3
- package/docs/examples/users/update-name.md +3 -3
- package/docs/examples/users/update-password.md +3 -3
- package/docs/examples/users/update-phone-verification.md +3 -3
- package/docs/examples/users/update-phone.md +3 -3
- package/docs/examples/users/update-prefs.md +3 -3
- package/docs/examples/users/update-status.md +3 -3
- package/docs/examples/users/update-target.md +3 -6
- package/docs/examples/vcs/create-repository-detection.md +4 -5
- package/docs/examples/vcs/create-repository.md +4 -4
- package/docs/examples/vcs/delete-installation.md +2 -2
- package/docs/examples/vcs/get-installation.md +2 -2
- package/docs/examples/vcs/get-repository-contents.md +3 -5
- package/docs/examples/vcs/get-repository.md +3 -3
- package/docs/examples/vcs/list-installations.md +1 -3
- package/docs/examples/vcs/list-repositories.md +3 -4
- package/docs/examples/vcs/list-repository-branches.md +3 -3
- package/docs/examples/vcs/update-external-deployments.md +4 -4
- package/index.js +40 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +3 -8
- package/lib/commands/account.js +55 -103
- package/lib/commands/avatars.js +1 -8
- package/lib/commands/console.js +1 -3
- package/lib/commands/databases.js +279 -226
- package/lib/commands/functions.js +3 -33
- package/lib/commands/graphql.js +1 -3
- package/lib/commands/health.js +1 -23
- package/lib/commands/init.js +1 -1
- package/lib/commands/locale.js +1 -9
- package/lib/commands/messaging.js +41 -87
- package/lib/commands/migrations.js +7 -15
- package/lib/commands/project.js +1 -7
- package/lib/commands/projects.js +77 -86
- package/lib/commands/proxy.js +1 -9
- package/lib/commands/pull.js +62 -1
- package/lib/commands/push.js +163 -8
- package/lib/commands/run.js +1 -1
- package/lib/commands/sites.js +3 -32
- package/lib/commands/storage.js +3 -18
- package/lib/commands/tables-db.js +2896 -0
- package/lib/commands/teams.js +1 -15
- package/lib/commands/tokens.js +1 -6
- package/lib/commands/types.js +7 -9
- package/lib/commands/update.js +218 -0
- package/lib/commands/users.js +34 -77
- package/lib/commands/vcs.js +2 -12
- package/lib/config.js +99 -14
- package/lib/parser.js +2 -1
- package/lib/questions.js +32 -7
- package/lib/type-generation/languages/dart.js +13 -13
- package/lib/type-generation/languages/java.js +13 -13
- package/lib/type-generation/languages/javascript.js +14 -14
- package/lib/type-generation/languages/kotlin.js +11 -10
- package/lib/type-generation/languages/php.js +15 -14
- package/lib/type-generation/languages/swift.js +13 -13
- package/lib/type-generation/languages/typescript.js +8 -8
- package/lib/utils.js +39 -2
- package/package.json +1 -1
- package/scoop/{appwrite.json → appwrite.config.json} +3 -3
- package/docs/examples/account/create-j-w-t.md +0 -1
- package/docs/examples/account/create-magic-u-r-l-token.md +0 -5
- package/docs/examples/account/create-o-auth2session.md +0 -5
- package/docs/examples/account/create-o-auth2token.md +0 -5
- package/docs/examples/account/update-m-f-a.md +0 -2
- package/docs/examples/account/update-magic-u-r-l-session.md +0 -3
- package/docs/examples/avatars/get-q-r.md +0 -5
- package/docs/examples/databases/get-database-usage.md +0 -3
- package/docs/examples/health/get-d-b.md +0 -1
- package/docs/examples/locale/list-countries-e-u.md +0 -1
- package/docs/examples/messaging/create-msg91provider.md +0 -7
- package/docs/examples/messaging/update-msg91provider.md +0 -7
- package/docs/examples/projects/create-j-w-t.md +0 -4
- package/docs/examples/projects/update-o-auth2.md +0 -6
- package/docs/examples/proxy/create-a-p-i-rule.md +0 -2
- package/docs/examples/users/create-argon2user.md +0 -5
- package/docs/examples/users/create-j-w-t.md +0 -4
- package/docs/examples/users/create-m-d5user.md +0 -5
- package/docs/examples/users/create-p-h-pass-user.md +0 -5
- package/docs/examples/users/create-s-h-a-user.md +0 -6
package/lib/commands/teams.js
CHANGED
|
@@ -7,7 +7,7 @@ const libClient = require('../client.js');
|
|
|
7
7
|
const { getAllFiles, showConsoleLink } = require('../utils.js');
|
|
8
8
|
const { Command } = require('commander');
|
|
9
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
10
|
-
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
10
|
+
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser')
|
|
11
11
|
const { localConfig, globalConfig } = require("../config");
|
|
12
12
|
const { File } = require('undici');
|
|
13
13
|
const { ReadableStream } = require('stream/web');
|
|
@@ -79,7 +79,6 @@ const teamsList = async ({queries,search,parseOutput = true, overrideForCli = fa
|
|
|
79
79
|
return response;
|
|
80
80
|
|
|
81
81
|
}
|
|
82
|
-
|
|
83
82
|
/**
|
|
84
83
|
* @typedef {Object} TeamsCreateRequestParams
|
|
85
84
|
* @property {string} teamId Team ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
@@ -122,7 +121,6 @@ const teamsCreate = async ({teamId,name,roles,parseOutput = true, overrideForCli
|
|
|
122
121
|
return response;
|
|
123
122
|
|
|
124
123
|
}
|
|
125
|
-
|
|
126
124
|
/**
|
|
127
125
|
* @typedef {Object} TeamsGetRequestParams
|
|
128
126
|
* @property {string} teamId Team ID.
|
|
@@ -156,7 +154,6 @@ const teamsGet = async ({teamId,parseOutput = true, overrideForCli = false, sdk
|
|
|
156
154
|
return response;
|
|
157
155
|
|
|
158
156
|
}
|
|
159
|
-
|
|
160
157
|
/**
|
|
161
158
|
* @typedef {Object} TeamsUpdateNameRequestParams
|
|
162
159
|
* @property {string} teamId Team ID.
|
|
@@ -191,7 +188,6 @@ const teamsUpdateName = async ({teamId,name,parseOutput = true, overrideForCli =
|
|
|
191
188
|
return response;
|
|
192
189
|
|
|
193
190
|
}
|
|
194
|
-
|
|
195
191
|
/**
|
|
196
192
|
* @typedef {Object} TeamsDeleteRequestParams
|
|
197
193
|
* @property {string} teamId Team ID.
|
|
@@ -222,7 +218,6 @@ const teamsDelete = async ({teamId,parseOutput = true, overrideForCli = false, s
|
|
|
222
218
|
return response;
|
|
223
219
|
|
|
224
220
|
}
|
|
225
|
-
|
|
226
221
|
/**
|
|
227
222
|
* @typedef {Object} TeamsListLogsRequestParams
|
|
228
223
|
* @property {string} teamId Team ID.
|
|
@@ -256,7 +251,6 @@ const teamsListLogs = async ({teamId,queries,parseOutput = true, overrideForCli
|
|
|
256
251
|
return response;
|
|
257
252
|
|
|
258
253
|
}
|
|
259
|
-
|
|
260
254
|
/**
|
|
261
255
|
* @typedef {Object} TeamsListMembershipsRequestParams
|
|
262
256
|
* @property {string} teamId Team ID.
|
|
@@ -294,7 +288,6 @@ const teamsListMemberships = async ({teamId,queries,search,parseOutput = true, o
|
|
|
294
288
|
return response;
|
|
295
289
|
|
|
296
290
|
}
|
|
297
|
-
|
|
298
291
|
/**
|
|
299
292
|
* @typedef {Object} TeamsCreateMembershipRequestParams
|
|
300
293
|
* @property {string} teamId Team ID.
|
|
@@ -350,7 +343,6 @@ const teamsCreateMembership = async ({teamId,roles,email,userId,phone,url,name,p
|
|
|
350
343
|
return response;
|
|
351
344
|
|
|
352
345
|
}
|
|
353
|
-
|
|
354
346
|
/**
|
|
355
347
|
* @typedef {Object} TeamsGetMembershipRequestParams
|
|
356
348
|
* @property {string} teamId Team ID.
|
|
@@ -381,7 +373,6 @@ const teamsGetMembership = async ({teamId,membershipId,parseOutput = true, overr
|
|
|
381
373
|
return response;
|
|
382
374
|
|
|
383
375
|
}
|
|
384
|
-
|
|
385
376
|
/**
|
|
386
377
|
* @typedef {Object} TeamsUpdateMembershipRequestParams
|
|
387
378
|
* @property {string} teamId Team ID.
|
|
@@ -418,7 +409,6 @@ const teamsUpdateMembership = async ({teamId,membershipId,roles,parseOutput = tr
|
|
|
418
409
|
return response;
|
|
419
410
|
|
|
420
411
|
}
|
|
421
|
-
|
|
422
412
|
/**
|
|
423
413
|
* @typedef {Object} TeamsDeleteMembershipRequestParams
|
|
424
414
|
* @property {string} teamId Team ID.
|
|
@@ -450,7 +440,6 @@ const teamsDeleteMembership = async ({teamId,membershipId,parseOutput = true, ov
|
|
|
450
440
|
return response;
|
|
451
441
|
|
|
452
442
|
}
|
|
453
|
-
|
|
454
443
|
/**
|
|
455
444
|
* @typedef {Object} TeamsUpdateMembershipStatusRequestParams
|
|
456
445
|
* @property {string} teamId Team ID.
|
|
@@ -490,7 +479,6 @@ const teamsUpdateMembershipStatus = async ({teamId,membershipId,userId,secret,pa
|
|
|
490
479
|
return response;
|
|
491
480
|
|
|
492
481
|
}
|
|
493
|
-
|
|
494
482
|
/**
|
|
495
483
|
* @typedef {Object} TeamsGetPrefsRequestParams
|
|
496
484
|
* @property {string} teamId Team ID.
|
|
@@ -520,7 +508,6 @@ const teamsGetPrefs = async ({teamId,parseOutput = true, overrideForCli = false,
|
|
|
520
508
|
return response;
|
|
521
509
|
|
|
522
510
|
}
|
|
523
|
-
|
|
524
511
|
/**
|
|
525
512
|
* @typedef {Object} TeamsUpdatePrefsRequestParams
|
|
526
513
|
* @property {string} teamId Team ID.
|
|
@@ -555,7 +542,6 @@ const teamsUpdatePrefs = async ({teamId,prefs,parseOutput = true, overrideForCli
|
|
|
555
542
|
return response;
|
|
556
543
|
|
|
557
544
|
}
|
|
558
|
-
|
|
559
545
|
teams
|
|
560
546
|
.command(`list`)
|
|
561
547
|
.description(`Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.`)
|
package/lib/commands/tokens.js
CHANGED
|
@@ -7,7 +7,7 @@ const libClient = require('../client.js');
|
|
|
7
7
|
const { getAllFiles, showConsoleLink } = require('../utils.js');
|
|
8
8
|
const { Command } = require('commander');
|
|
9
9
|
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
10
|
-
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
10
|
+
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } = require('../parser')
|
|
11
11
|
const { localConfig, globalConfig } = require("../config");
|
|
12
12
|
const { File } = require('undici');
|
|
13
13
|
const { ReadableStream } = require('stream/web');
|
|
@@ -77,7 +77,6 @@ const tokensList = async ({bucketId,fileId,queries,parseOutput = true, overrideF
|
|
|
77
77
|
return response;
|
|
78
78
|
|
|
79
79
|
}
|
|
80
|
-
|
|
81
80
|
/**
|
|
82
81
|
* @typedef {Object} TokensCreateFileTokenRequestParams
|
|
83
82
|
* @property {string} bucketId Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
|
|
@@ -113,7 +112,6 @@ const tokensCreateFileToken = async ({bucketId,fileId,expire,parseOutput = true,
|
|
|
113
112
|
return response;
|
|
114
113
|
|
|
115
114
|
}
|
|
116
|
-
|
|
117
115
|
/**
|
|
118
116
|
* @typedef {Object} TokensGetRequestParams
|
|
119
117
|
* @property {string} tokenId Token ID.
|
|
@@ -147,7 +145,6 @@ const tokensGet = async ({tokenId,parseOutput = true, overrideForCli = false, sd
|
|
|
147
145
|
return response;
|
|
148
146
|
|
|
149
147
|
}
|
|
150
|
-
|
|
151
148
|
/**
|
|
152
149
|
* @typedef {Object} TokensUpdateRequestParams
|
|
153
150
|
* @property {string} tokenId Token unique ID.
|
|
@@ -182,7 +179,6 @@ const tokensUpdate = async ({tokenId,expire,parseOutput = true, overrideForCli =
|
|
|
182
179
|
return response;
|
|
183
180
|
|
|
184
181
|
}
|
|
185
|
-
|
|
186
182
|
/**
|
|
187
183
|
* @typedef {Object} TokensDeleteRequestParams
|
|
188
184
|
* @property {string} tokenId Token ID.
|
|
@@ -213,7 +209,6 @@ const tokensDelete = async ({tokenId,parseOutput = true, overrideForCli = false,
|
|
|
213
209
|
return response;
|
|
214
210
|
|
|
215
211
|
}
|
|
216
|
-
|
|
217
212
|
tokens
|
|
218
213
|
.command(`list`)
|
|
219
214
|
.description(`List all the tokens created for a specific file or bucket. You can use the query params to filter your results.`)
|
package/lib/commands/types.js
CHANGED
|
@@ -4,7 +4,7 @@ const path = require("path");
|
|
|
4
4
|
const { LanguageMeta, detectLanguage } = require("../type-generation/languages/language");
|
|
5
5
|
const { Command, Option, Argument } = require("commander");
|
|
6
6
|
const { localConfig } = require("../config");
|
|
7
|
-
const { success, log, actionRunner } = require("../parser");
|
|
7
|
+
const { success, log, warn, actionRunner } = require("../parser");
|
|
8
8
|
const { PHP } = require("../type-generation/languages/php");
|
|
9
9
|
const { TypeScript } = require("../type-generation/languages/typescript");
|
|
10
10
|
const { Kotlin } = require("../type-generation/languages/kotlin");
|
|
@@ -71,7 +71,7 @@ const typesCommand = actionRunner(async (rawOutputDirectory, {language, strict})
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (strict) {
|
|
74
|
-
|
|
74
|
+
warn(`Strict mode enabled: Field names will be converted to follow ${language} conventions`);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const meta = createLanguageMeta(language);
|
|
@@ -97,13 +97,10 @@ const typesCommand = actionRunner(async (rawOutputDirectory, {language, strict})
|
|
|
97
97
|
fs.mkdirSync(outputDirectory, { recursive: true });
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
if (!fs.existsSync("appwrite.json")) {
|
|
101
|
-
throw new Error("appwrite.json not found in current directory");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
100
|
const collections = localConfig.getCollections();
|
|
105
101
|
if (collections.length === 0) {
|
|
106
|
-
|
|
102
|
+
const configFileName = path.basename(localConfig.path);
|
|
103
|
+
throw new Error(`No collections found in configuration. Make sure ${configFileName} exists and contains collections.`);
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
log(`Found ${collections.length} collections: ${collections.map(c => c.name).join(", ")}`);
|
|
@@ -118,7 +115,7 @@ const typesCommand = actionRunner(async (rawOutputDirectory, {language, strict})
|
|
|
118
115
|
collections,
|
|
119
116
|
strict,
|
|
120
117
|
...templateHelpers,
|
|
121
|
-
getType: meta.getType
|
|
118
|
+
getType: meta.getType,
|
|
122
119
|
});
|
|
123
120
|
|
|
124
121
|
const destination = singleFileDestination || path.join(outputDirectory, meta.getFileName());
|
|
@@ -128,10 +125,11 @@ const typesCommand = actionRunner(async (rawOutputDirectory, {language, strict})
|
|
|
128
125
|
} else {
|
|
129
126
|
for (const collection of collections) {
|
|
130
127
|
const content = templater({
|
|
128
|
+
collections,
|
|
131
129
|
collection,
|
|
132
130
|
strict,
|
|
133
131
|
...templateHelpers,
|
|
134
|
-
getType: meta.getType
|
|
132
|
+
getType: meta.getType,
|
|
135
133
|
});
|
|
136
134
|
|
|
137
135
|
const destination = path.join(outputDirectory, meta.getFileName(collection));
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { spawn } = require("child_process");
|
|
4
|
+
const { Command } = require("commander");
|
|
5
|
+
const { fetch } = require("undici");
|
|
6
|
+
const chalk = require("chalk");
|
|
7
|
+
const inquirer = require("inquirer");
|
|
8
|
+
const { success, log, warn, error, hint, actionRunner, commandDescriptions } = require("../parser");
|
|
9
|
+
const { getLatestVersion, compareVersions } = require("../utils");
|
|
10
|
+
const { version } = require("../../package.json");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Check if the CLI was installed via npm
|
|
14
|
+
*/
|
|
15
|
+
const isInstalledViaNpm = () => {
|
|
16
|
+
try {
|
|
17
|
+
const scriptPath = process.argv[1];
|
|
18
|
+
|
|
19
|
+
if (scriptPath.includes('node_modules') && scriptPath.includes('appwrite-cli')) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (scriptPath.includes('/usr/local/lib/node_modules/') ||
|
|
24
|
+
scriptPath.includes('/opt/homebrew/lib/node_modules/') ||
|
|
25
|
+
scriptPath.includes('/.npm-global/') ||
|
|
26
|
+
scriptPath.includes('/node_modules/.bin/')) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return false;
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Check if the CLI was installed via Homebrew
|
|
38
|
+
*/
|
|
39
|
+
const isInstalledViaHomebrew = () => {
|
|
40
|
+
try {
|
|
41
|
+
const scriptPath = process.argv[1];
|
|
42
|
+
return scriptPath.includes('/opt/homebrew/') || scriptPath.includes('/usr/local/Cellar/');
|
|
43
|
+
} catch (e) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Execute command and return promise
|
|
52
|
+
*/
|
|
53
|
+
const execCommand = (command, args = [], options = {}) => {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const child = spawn(command, args, {
|
|
56
|
+
stdio: 'inherit',
|
|
57
|
+
shell: true,
|
|
58
|
+
...options
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
child.on('close', (code) => {
|
|
62
|
+
if (code === 0) {
|
|
63
|
+
resolve();
|
|
64
|
+
} else {
|
|
65
|
+
reject(new Error(`Command failed with exit code ${code}`));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
child.on('error', (err) => {
|
|
70
|
+
reject(err);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Update via npm
|
|
77
|
+
*/
|
|
78
|
+
const updateViaNpm = async () => {
|
|
79
|
+
try {
|
|
80
|
+
await execCommand('npm', ['install', '-g', 'appwrite-cli@latest']);
|
|
81
|
+
console.log("");
|
|
82
|
+
success("Updated to latest version via npm!");
|
|
83
|
+
hint("Run 'appwrite --version' to verify the new version.");
|
|
84
|
+
} catch (e) {
|
|
85
|
+
if (e.message.includes('EEXIST') || e.message.includes('file already exists')) {
|
|
86
|
+
console.log("");
|
|
87
|
+
success("Latest version is already installed via npm!");
|
|
88
|
+
hint("The CLI is up to date. Run 'appwrite --version' to verify.");
|
|
89
|
+
} else {
|
|
90
|
+
console.log("");
|
|
91
|
+
error(`Failed to update via npm: ${e.message}`);
|
|
92
|
+
hint("Try running: npm install -g appwrite-cli@latest --force");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Update via Homebrew
|
|
99
|
+
*/
|
|
100
|
+
const updateViaHomebrew = async () => {
|
|
101
|
+
try {
|
|
102
|
+
await execCommand('brew', ['upgrade', 'appwrite']);
|
|
103
|
+
console.log("");
|
|
104
|
+
success("Updated to latest version via Homebrew!");
|
|
105
|
+
hint("Run 'appwrite --version' to verify the new version.");
|
|
106
|
+
} catch (e) {
|
|
107
|
+
if (e.message.includes('already installed') || e.message.includes('up-to-date')) {
|
|
108
|
+
console.log("");
|
|
109
|
+
success("Latest version is already installed via Homebrew!");
|
|
110
|
+
hint("The CLI is up to date. Run 'appwrite --version' to verify.");
|
|
111
|
+
} else {
|
|
112
|
+
console.log("");
|
|
113
|
+
error(`Failed to update via Homebrew: ${e.message}`);
|
|
114
|
+
hint("Try running: brew upgrade appwrite");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Show manual update instructions
|
|
121
|
+
*/
|
|
122
|
+
const showManualInstructions = (latestVersion) => {
|
|
123
|
+
log("Manual update options:");
|
|
124
|
+
console.log("");
|
|
125
|
+
|
|
126
|
+
log(`${chalk.bold("Option 1: NPM")}`);
|
|
127
|
+
console.log(` npm install -g appwrite-cli@latest`);
|
|
128
|
+
console.log("");
|
|
129
|
+
|
|
130
|
+
log(`${chalk.bold("Option 2: Homebrew")}`);
|
|
131
|
+
console.log(` brew upgrade appwrite`);
|
|
132
|
+
console.log("");
|
|
133
|
+
|
|
134
|
+
log(`${chalk.bold("Option 3: Download Binary")}`);
|
|
135
|
+
console.log(` Visit: https://github.com/appwrite-cli/releases/tag/${latestVersion}`);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Show interactive menu for choosing update method
|
|
140
|
+
*/
|
|
141
|
+
const chooseUpdateMethod = async (latestVersion) => {
|
|
142
|
+
const choices = [
|
|
143
|
+
{ name: 'NPM', value: 'npm' },
|
|
144
|
+
{ name: 'Homebrew', value: 'homebrew' },
|
|
145
|
+
{ name: 'Show manual instructions', value: 'manual' }
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
const { method } = await inquirer.prompt([
|
|
149
|
+
{
|
|
150
|
+
type: 'list',
|
|
151
|
+
name: 'method',
|
|
152
|
+
message: 'Could not detect installation method. How would you like to update?',
|
|
153
|
+
choices: choices
|
|
154
|
+
}
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
switch (method) {
|
|
158
|
+
case 'npm':
|
|
159
|
+
await updateViaNpm();
|
|
160
|
+
break;
|
|
161
|
+
case 'homebrew':
|
|
162
|
+
await updateViaHomebrew();
|
|
163
|
+
break;
|
|
164
|
+
case 'manual':
|
|
165
|
+
showManualInstructions(latestVersion);
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Main update function
|
|
172
|
+
*/
|
|
173
|
+
const updateCli = async ({ manual } = {}) => {
|
|
174
|
+
try {
|
|
175
|
+
const latestVersion = await getLatestVersion();
|
|
176
|
+
|
|
177
|
+
const comparison = compareVersions(version, latestVersion);
|
|
178
|
+
|
|
179
|
+
if (comparison === 0) {
|
|
180
|
+
success(`You're already running the latest version (${chalk.bold(version)})!`);
|
|
181
|
+
return;
|
|
182
|
+
} else if (comparison < 0) {
|
|
183
|
+
warn(`You're running a newer version (${chalk.bold(version)}) than the latest released version (${chalk.bold(latestVersion)}).`);
|
|
184
|
+
hint("This might be a pre-release or development version.");
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
log(`Updating from ${chalk.blue(version)} to ${chalk.green(latestVersion)}...`);
|
|
189
|
+
console.log("");
|
|
190
|
+
|
|
191
|
+
if (manual) {
|
|
192
|
+
showManualInstructions(latestVersion);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (isInstalledViaNpm()) {
|
|
197
|
+
await updateViaNpm();
|
|
198
|
+
} else if (isInstalledViaHomebrew()) {
|
|
199
|
+
await updateViaHomebrew();
|
|
200
|
+
} else {
|
|
201
|
+
await chooseUpdateMethod(latestVersion);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
} catch (e) {
|
|
205
|
+
console.log("");
|
|
206
|
+
error(`Failed to check for updates: ${e.message}`);
|
|
207
|
+
hint("You can manually check for updates at: https://github.com/appwrite-cli/releases");
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const update = new Command("update")
|
|
212
|
+
.description("Update the Appwrite CLI to the latest version")
|
|
213
|
+
.option("--manual", "Show manual update instructions instead of auto-updating")
|
|
214
|
+
.action(actionRunner(updateCli));
|
|
215
|
+
|
|
216
|
+
module.exports = {
|
|
217
|
+
update
|
|
218
|
+
};
|