appwrite-utils-cli 0.10.86 → 1.0.2
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/.appwrite/.yaml_schemas/appwrite-config.schema.json +380 -0
- package/.appwrite/.yaml_schemas/collection.schema.json +255 -0
- package/.appwrite/collections/Categories.yaml +182 -0
- package/.appwrite/collections/ExampleCollection.yaml +36 -0
- package/.appwrite/collections/Posts.yaml +227 -0
- package/.appwrite/collections/Users.yaml +149 -0
- package/.appwrite/config.yaml +109 -0
- package/.appwrite/import/README.md +148 -0
- package/.appwrite/import/categories-import.yaml +129 -0
- package/.appwrite/import/posts-import.yaml +208 -0
- package/.appwrite/import/users-import.yaml +130 -0
- package/.appwrite/importData/categories.json +194 -0
- package/.appwrite/importData/posts.json +270 -0
- package/.appwrite/importData/users.json +220 -0
- package/.appwrite/schemas/categories.json +128 -0
- package/.appwrite/schemas/exampleCollection.json +52 -0
- package/.appwrite/schemas/posts.json +173 -0
- package/.appwrite/schemas/users.json +125 -0
- package/README.md +264 -33
- package/dist/collections/attributes.js +3 -2
- package/dist/collections/methods.js +56 -38
- package/dist/config/yamlConfig.d.ts +501 -0
- package/dist/config/yamlConfig.js +452 -0
- package/dist/databases/setup.d.ts +6 -0
- package/dist/databases/setup.js +119 -0
- package/dist/functions/methods.d.ts +1 -1
- package/dist/functions/methods.js +5 -2
- package/dist/functions/openapi.d.ts +4 -0
- package/dist/functions/openapi.js +60 -0
- package/dist/interactiveCLI.d.ts +5 -0
- package/dist/interactiveCLI.js +194 -49
- package/dist/main.js +91 -30
- package/dist/migrations/afterImportActions.js +2 -2
- package/dist/migrations/appwriteToX.d.ts +10 -0
- package/dist/migrations/appwriteToX.js +15 -4
- package/dist/migrations/backup.d.ts +16 -16
- package/dist/migrations/dataLoader.d.ts +83 -1
- package/dist/migrations/dataLoader.js +4 -4
- package/dist/migrations/importController.js +25 -18
- package/dist/migrations/importDataActions.js +2 -2
- package/dist/migrations/logging.d.ts +9 -1
- package/dist/migrations/logging.js +41 -22
- package/dist/migrations/migrationHelper.d.ts +4 -4
- package/dist/migrations/relationships.js +1 -1
- package/dist/migrations/services/DataTransformationService.d.ts +55 -0
- package/dist/migrations/services/DataTransformationService.js +158 -0
- package/dist/migrations/services/FileHandlerService.d.ts +75 -0
- package/dist/migrations/services/FileHandlerService.js +236 -0
- package/dist/migrations/services/ImportOrchestrator.d.ts +97 -0
- package/dist/migrations/services/ImportOrchestrator.js +488 -0
- package/dist/migrations/services/RateLimitManager.d.ts +138 -0
- package/dist/migrations/services/RateLimitManager.js +279 -0
- package/dist/migrations/services/RelationshipResolver.d.ts +120 -0
- package/dist/migrations/services/RelationshipResolver.js +332 -0
- package/dist/migrations/services/UserMappingService.d.ts +109 -0
- package/dist/migrations/services/UserMappingService.js +277 -0
- package/dist/migrations/services/ValidationService.d.ts +74 -0
- package/dist/migrations/services/ValidationService.js +260 -0
- package/dist/migrations/transfer.d.ts +0 -6
- package/dist/migrations/transfer.js +16 -132
- package/dist/migrations/yaml/YamlImportConfigLoader.d.ts +384 -0
- package/dist/migrations/yaml/YamlImportConfigLoader.js +375 -0
- package/dist/migrations/yaml/YamlImportIntegration.d.ts +87 -0
- package/dist/migrations/yaml/YamlImportIntegration.js +330 -0
- package/dist/migrations/yaml/generateImportSchemas.d.ts +17 -0
- package/dist/migrations/yaml/generateImportSchemas.js +575 -0
- package/dist/schemas/authUser.d.ts +9 -9
- package/dist/shared/attributeManager.d.ts +17 -0
- package/dist/shared/attributeManager.js +273 -0
- package/dist/shared/confirmationDialogs.d.ts +75 -0
- package/dist/shared/confirmationDialogs.js +236 -0
- package/dist/shared/functionManager.d.ts +48 -0
- package/dist/shared/functionManager.js +322 -0
- package/dist/shared/indexManager.d.ts +24 -0
- package/dist/shared/indexManager.js +150 -0
- package/dist/shared/jsonSchemaGenerator.d.ts +51 -0
- package/dist/shared/jsonSchemaGenerator.js +313 -0
- package/dist/shared/logging.d.ts +10 -0
- package/dist/shared/logging.js +46 -0
- package/dist/shared/messageFormatter.d.ts +37 -0
- package/dist/shared/messageFormatter.js +152 -0
- package/dist/shared/migrationHelpers.d.ts +173 -0
- package/dist/shared/migrationHelpers.js +142 -0
- package/dist/shared/operationLogger.d.ts +3 -0
- package/dist/shared/operationLogger.js +25 -0
- package/dist/shared/operationQueue.d.ts +13 -0
- package/dist/shared/operationQueue.js +79 -0
- package/dist/shared/progressManager.d.ts +62 -0
- package/dist/shared/progressManager.js +215 -0
- package/dist/shared/schemaGenerator.d.ts +18 -0
- package/dist/shared/schemaGenerator.js +523 -0
- package/dist/storage/methods.d.ts +3 -1
- package/dist/storage/methods.js +144 -55
- package/dist/storage/schemas.d.ts +56 -16
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/users/methods.d.ts +16 -0
- package/dist/users/methods.js +276 -0
- package/dist/utils/configMigration.d.ts +1 -0
- package/dist/utils/configMigration.js +262 -0
- package/dist/utils/dataConverters.d.ts +46 -0
- package/dist/utils/dataConverters.js +139 -0
- package/dist/utils/loadConfigs.d.ts +15 -4
- package/dist/utils/loadConfigs.js +379 -51
- package/dist/utils/schemaStrings.js +2 -1
- package/dist/utils/setupFiles.d.ts +2 -1
- package/dist/utils/setupFiles.js +723 -28
- package/dist/utils/validationRules.d.ts +43 -0
- package/dist/utils/validationRules.js +42 -0
- package/dist/utils/yamlConverter.d.ts +48 -0
- package/dist/utils/yamlConverter.js +98 -0
- package/dist/utilsController.js +65 -43
- package/package.json +19 -15
- package/src/collections/attributes.ts +3 -2
- package/src/collections/methods.ts +85 -51
- package/src/config/yamlConfig.ts +488 -0
- package/src/{migrations/setupDatabase.ts → databases/setup.ts} +11 -5
- package/src/functions/methods.ts +8 -4
- package/src/functions/templates/count-docs-in-collection/package.json +25 -0
- package/src/functions/templates/count-docs-in-collection/tsconfig.json +28 -0
- package/src/functions/templates/typescript-node/package.json +24 -0
- package/src/functions/templates/typescript-node/tsconfig.json +28 -0
- package/src/functions/templates/uv/README.md +31 -0
- package/src/functions/templates/uv/pyproject.toml +29 -0
- package/src/interactiveCLI.ts +226 -61
- package/src/main.ts +111 -37
- package/src/migrations/afterImportActions.ts +2 -2
- package/src/migrations/appwriteToX.ts +17 -4
- package/src/migrations/dataLoader.ts +4 -4
- package/src/migrations/importController.ts +30 -22
- package/src/migrations/importDataActions.ts +2 -2
- package/src/migrations/relationships.ts +1 -1
- package/src/migrations/services/DataTransformationService.ts +196 -0
- package/src/migrations/services/FileHandlerService.ts +311 -0
- package/src/migrations/services/ImportOrchestrator.ts +669 -0
- package/src/migrations/services/RateLimitManager.ts +363 -0
- package/src/migrations/services/RelationshipResolver.ts +461 -0
- package/src/migrations/services/UserMappingService.ts +345 -0
- package/src/migrations/services/ValidationService.ts +349 -0
- package/src/migrations/transfer.ts +22 -228
- package/src/migrations/yaml/YamlImportConfigLoader.ts +427 -0
- package/src/migrations/yaml/YamlImportIntegration.ts +419 -0
- package/src/migrations/yaml/generateImportSchemas.ts +589 -0
- package/src/shared/attributeManager.ts +429 -0
- package/src/shared/confirmationDialogs.ts +327 -0
- package/src/shared/functionManager.ts +515 -0
- package/src/shared/indexManager.ts +253 -0
- package/src/shared/jsonSchemaGenerator.ts +403 -0
- package/src/shared/logging.ts +74 -0
- package/src/shared/messageFormatter.ts +195 -0
- package/src/{migrations/migrationHelper.ts → shared/migrationHelpers.ts} +22 -4
- package/src/{migrations/helper.ts → shared/operationLogger.ts} +7 -2
- package/src/{migrations/queue.ts → shared/operationQueue.ts} +1 -1
- package/src/shared/progressManager.ts +278 -0
- package/src/{migrations/schemaStrings.ts → shared/schemaGenerator.ts} +71 -17
- package/src/storage/methods.ts +199 -78
- package/src/types.ts +2 -2
- package/src/{migrations/users.ts → users/methods.ts} +2 -2
- package/src/utils/configMigration.ts +349 -0
- package/src/utils/loadConfigs.ts +416 -52
- package/src/utils/schemaStrings.ts +2 -1
- package/src/utils/setupFiles.ts +742 -40
- package/src/{migrations → utils}/validationRules.ts +1 -1
- package/src/utils/yamlConverter.ts +131 -0
- package/src/utilsController.ts +75 -54
- package/src/functions/templates/poetry/README.md +0 -30
- package/src/functions/templates/poetry/pyproject.toml +0 -16
- package/src/migrations/attributes.ts +0 -561
- package/src/migrations/backup.ts +0 -205
- package/src/migrations/databases.ts +0 -39
- package/src/migrations/dbHelpers.ts +0 -92
- package/src/migrations/indexes.ts +0 -40
- package/src/migrations/logging.ts +0 -29
- package/src/migrations/storage.ts +0 -538
- /package/src/{migrations → functions}/openapi.ts +0 -0
- /package/src/functions/templates/{poetry → uv}/src/__init__.py +0 -0
- /package/src/functions/templates/{poetry → uv}/src/index.py +0 -0
- /package/src/{migrations/converters.ts → utils/dataConverters.ts} +0 -0
@@ -0,0 +1,125 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
3
|
+
"$id": "https://example.com/schemas/users.json",
|
4
|
+
"title": "Users",
|
5
|
+
"description": "Schema for Users collection",
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"$id": {
|
9
|
+
"type": "string",
|
10
|
+
"description": "Document ID",
|
11
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,35}$"
|
12
|
+
},
|
13
|
+
"$createdAt": {
|
14
|
+
"type": "string",
|
15
|
+
"format": "date-time",
|
16
|
+
"description": "Document creation date"
|
17
|
+
},
|
18
|
+
"$updatedAt": {
|
19
|
+
"type": "string",
|
20
|
+
"format": "date-time",
|
21
|
+
"description": "Document last update date"
|
22
|
+
},
|
23
|
+
"$permissions": {
|
24
|
+
"type": "array",
|
25
|
+
"items": {
|
26
|
+
"type": "string"
|
27
|
+
},
|
28
|
+
"description": "Document permissions"
|
29
|
+
},
|
30
|
+
"name": {
|
31
|
+
"type": "string",
|
32
|
+
"description": "User's full name",
|
33
|
+
"maxLength": 100
|
34
|
+
},
|
35
|
+
"email": {
|
36
|
+
"type": "string",
|
37
|
+
"description": "User's email address for authentication",
|
38
|
+
"format": "email"
|
39
|
+
},
|
40
|
+
"username": {
|
41
|
+
"type": "string",
|
42
|
+
"description": "Unique username handle",
|
43
|
+
"maxLength": 50
|
44
|
+
},
|
45
|
+
"avatar": {
|
46
|
+
"type": "string",
|
47
|
+
"description": "User avatar file ID stored in Appwrite storage",
|
48
|
+
"maxLength": 255
|
49
|
+
},
|
50
|
+
"phone": {
|
51
|
+
"type": "string",
|
52
|
+
"description": "User's phone number",
|
53
|
+
"maxLength": 20
|
54
|
+
},
|
55
|
+
"bio": {
|
56
|
+
"type": "string",
|
57
|
+
"description": "User biography or description",
|
58
|
+
"maxLength": 500
|
59
|
+
},
|
60
|
+
"dateOfBirth": {
|
61
|
+
"type": "string",
|
62
|
+
"description": "User's date of birth",
|
63
|
+
"format": "date-time"
|
64
|
+
},
|
65
|
+
"location": {
|
66
|
+
"type": "string",
|
67
|
+
"description": "User's location or city",
|
68
|
+
"maxLength": 100
|
69
|
+
},
|
70
|
+
"role": {
|
71
|
+
"type": "string",
|
72
|
+
"description": "User's role in the system",
|
73
|
+
"enum": [
|
74
|
+
"admin",
|
75
|
+
"user",
|
76
|
+
"moderator",
|
77
|
+
"editor"
|
78
|
+
],
|
79
|
+
"default": "user"
|
80
|
+
},
|
81
|
+
"isActive": {
|
82
|
+
"type": "boolean",
|
83
|
+
"description": "Whether the user account is active",
|
84
|
+
"default": true
|
85
|
+
},
|
86
|
+
"isVerified": {
|
87
|
+
"type": "boolean",
|
88
|
+
"description": "Whether the user's email is verified",
|
89
|
+
"default": false
|
90
|
+
},
|
91
|
+
"profileViews": {
|
92
|
+
"type": "integer",
|
93
|
+
"description": "Number of times user profile has been viewed",
|
94
|
+
"minimum": 0,
|
95
|
+
"default": 0
|
96
|
+
},
|
97
|
+
"lastLoginAt": {
|
98
|
+
"type": "string",
|
99
|
+
"description": "Timestamp of user's last login",
|
100
|
+
"format": "date-time"
|
101
|
+
},
|
102
|
+
"socialLinks": {
|
103
|
+
"type": "string",
|
104
|
+
"description": "JSON string of social media links",
|
105
|
+
"maxLength": 1000
|
106
|
+
},
|
107
|
+
"preferences": {
|
108
|
+
"type": "string",
|
109
|
+
"description": "JSON string of user preferences and settings",
|
110
|
+
"maxLength": 2000
|
111
|
+
}
|
112
|
+
},
|
113
|
+
"required": [
|
114
|
+
"$id",
|
115
|
+
"$createdAt",
|
116
|
+
"$updatedAt",
|
117
|
+
"name",
|
118
|
+
"email",
|
119
|
+
"role",
|
120
|
+
"isActive",
|
121
|
+
"isVerified",
|
122
|
+
"profileViews"
|
123
|
+
],
|
124
|
+
"additionalProperties": false
|
125
|
+
}
|
package/README.md
CHANGED
@@ -2,19 +2,30 @@
|
|
2
2
|
|
3
3
|
## Overview
|
4
4
|
|
5
|
-
`appwrite-utils-cli` is a powerful command-line interface tool designed for Appwrite developers who need to manage database migrations, schema generation, data import, and
|
5
|
+
`appwrite-utils-cli` is a powerful, YAML-first command-line interface tool designed for Appwrite developers who need to manage database migrations, schema generation, data import, and comprehensive project management. Built on a modular architecture with enhanced performance, this CLI tool facilitates complex tasks like setting up databases, running migrations, generating schemas, and managing backups efficiently. With version 1.0.0, the CLI introduces a completely refactored import system with 50%+ complexity reduction, YAML-first configuration, and sophisticated data handling capabilities.
|
6
6
|
|
7
7
|
## Features
|
8
8
|
|
9
|
-
|
10
|
-
- **
|
11
|
-
- **
|
12
|
-
- **
|
13
|
-
- **
|
14
|
-
- **
|
15
|
-
|
16
|
-
|
17
|
-
- **
|
9
|
+
### Core Capabilities
|
10
|
+
- **YAML-First Configuration**: Modern YAML-based configuration with JSON Schema support for IntelliSense
|
11
|
+
- **Interactive Mode**: Professional guided CLI experience with rich visual feedback and progress tracking
|
12
|
+
- **Modular Import System**: Completely refactored import architecture with 50%+ complexity reduction
|
13
|
+
- **Enhanced Performance**: Configurable rate limiting and batch processing for optimal performance
|
14
|
+
- **Safety First**: Smart confirmation dialogs for destructive operations with explicit confirmations
|
15
|
+
|
16
|
+
### Data Management
|
17
|
+
- **Advanced Data Import**: YAML-configured imports with sophisticated file handling, URL support, and user deduplication
|
18
|
+
- **Relationship Resolution**: Intelligent cross-collection relationship mapping and ID resolution
|
19
|
+
- **User Management**: Advanced user deduplication with email/phone matching and merge capabilities
|
20
|
+
- **File Operations**: Complete file handling with URL downloads, local file search, and afterImportActions
|
21
|
+
- **Backup Management**: Comprehensive backup system with progress tracking and detailed reporting
|
22
|
+
|
23
|
+
### Development Tools
|
24
|
+
- **Database Migrations**: Full migration control with progress tracking and operation summaries
|
25
|
+
- **Schema Generation**: Generate TypeScript and JSON schemas from database configurations
|
26
|
+
- **Data Transfer**: Transfer data between databases, collections, and instances with real-time progress
|
27
|
+
- **Configuration Sync**: Bidirectional synchronization between local YAML configs and Appwrite projects
|
28
|
+
- **Function Management**: Deploy and manage Appwrite Functions with specification updates
|
18
29
|
|
19
30
|
## Installation
|
20
31
|
|
@@ -32,19 +43,69 @@ npx --package=appwrite-utils-cli@latest appwrite-migrate [options]
|
|
32
43
|
|
33
44
|
**Note: Do not install this locally into your project. It is meant to be used as a command-line tool only.**
|
34
45
|
|
46
|
+
## YAML-First Configuration
|
47
|
+
|
48
|
+
Version 1.0.0 introduces a YAML-first approach for better cross-platform compatibility and enhanced developer experience.
|
49
|
+
|
50
|
+
### Configuration Structure
|
51
|
+
|
52
|
+
The CLI automatically detects configuration files in this order:
|
53
|
+
1. `.appwrite/config.yaml` (recommended)
|
54
|
+
2. `appwrite.yaml`
|
55
|
+
3. `appwriteConfig.ts` (legacy, still supported)
|
56
|
+
|
57
|
+
### YAML Configuration Example
|
58
|
+
|
59
|
+
```yaml
|
60
|
+
# .appwrite/config.yaml with JSON Schema support
|
61
|
+
# yaml-language-server: $schema=./.yaml_schemas/appwrite-config.schema.json
|
62
|
+
|
63
|
+
appwriteEndpoint: "https://cloud.appwrite.io/v1"
|
64
|
+
appwriteProject: "your-project-id"
|
65
|
+
appwriteKey: "your-api-key"
|
66
|
+
|
67
|
+
databases:
|
68
|
+
- name: "main"
|
69
|
+
id: "main"
|
70
|
+
collections:
|
71
|
+
- name: "Users"
|
72
|
+
id: "users"
|
73
|
+
attributes:
|
74
|
+
- key: "email"
|
75
|
+
type: "string"
|
76
|
+
required: true
|
77
|
+
format: "email"
|
78
|
+
|
79
|
+
buckets:
|
80
|
+
- name: "documents"
|
81
|
+
id: "documents"
|
82
|
+
permissions:
|
83
|
+
- target: "any"
|
84
|
+
permission: "read"
|
85
|
+
|
86
|
+
logging:
|
87
|
+
enabled: false # Disabled by default
|
88
|
+
level: "info"
|
89
|
+
console: true
|
90
|
+
```
|
91
|
+
|
35
92
|
## Usage
|
36
93
|
|
37
94
|
After installation, you can access the tool directly from your command line using the provided commands.
|
38
95
|
|
39
96
|
### Interactive Mode
|
40
97
|
|
41
|
-
Run the CLI in interactive mode:
|
98
|
+
Run the CLI in interactive mode with enhanced visual feedback:
|
42
99
|
|
43
100
|
```bash
|
44
101
|
npx --package=appwrite-utils-cli@latest appwrite-migrate --it
|
45
102
|
```
|
46
103
|
|
47
|
-
This
|
104
|
+
This provides a professional guided experience with:
|
105
|
+
- Rich visual feedback and progress tracking
|
106
|
+
- Smart confirmation dialogs for destructive operations
|
107
|
+
- Operation summaries with detailed statistics
|
108
|
+
- Real-time progress bars with ETA calculations
|
48
109
|
|
49
110
|
### Non-Interactive Mode
|
50
111
|
|
@@ -54,38 +115,108 @@ You can also use specific flags to run tasks without the interactive prompt:
|
|
54
115
|
npx --package=appwrite-utils-cli@latest appwrite-migrate [options]
|
55
116
|
```
|
56
117
|
|
118
|
+
## YAML Import Configuration System
|
119
|
+
|
120
|
+
Version 1.0.0 introduces a powerful YAML-based import system with sophisticated data handling capabilities.
|
121
|
+
|
122
|
+
### Import Configuration Example
|
123
|
+
|
124
|
+
```yaml
|
125
|
+
# .appwrite/import/users-import.yaml
|
126
|
+
# yaml-language-server: $schema=../.yaml_schemas/import-config.schema.json
|
127
|
+
|
128
|
+
source:
|
129
|
+
file: "importData/users.json"
|
130
|
+
basePath: "RECORDS"
|
131
|
+
type: "json"
|
132
|
+
|
133
|
+
target:
|
134
|
+
collection: "Users"
|
135
|
+
type: "create"
|
136
|
+
primaryKey: "user_id"
|
137
|
+
createUsers: true
|
138
|
+
|
139
|
+
mapping:
|
140
|
+
attributes:
|
141
|
+
- oldKey: "user_id"
|
142
|
+
targetKey: "userId"
|
143
|
+
converters: ["anyToString"]
|
144
|
+
validation:
|
145
|
+
- rule: "required"
|
146
|
+
params: ["{userId}"]
|
147
|
+
|
148
|
+
- oldKey: "profile_image_url"
|
149
|
+
targetKey: "avatar"
|
150
|
+
fileData:
|
151
|
+
path: "{profile_image_url}"
|
152
|
+
name: "{user_id}_avatar"
|
153
|
+
afterImport:
|
154
|
+
- action: "createFileAndUpdateField"
|
155
|
+
params: ["{dbId}", "{collId}", "{docId}", "avatar", "{bucketId}", "{filePath}", "{fileName}"]
|
156
|
+
|
157
|
+
relationships:
|
158
|
+
- sourceField: "department_id"
|
159
|
+
targetField: "departmentId"
|
160
|
+
targetCollection: "Departments"
|
161
|
+
|
162
|
+
options:
|
163
|
+
batchSize: 50
|
164
|
+
continueOnError: true
|
165
|
+
```
|
166
|
+
|
167
|
+
### Import System Features
|
168
|
+
|
169
|
+
- **File Handling**: Complete support for URL downloads and local file search
|
170
|
+
- **User Deduplication**: Sophisticated email/phone matching with merge capabilities
|
171
|
+
- **Rate Limiting**: Configurable p-limit for optimal performance (5 concurrent by default)
|
172
|
+
- **Relationship Resolution**: Intelligent cross-collection ID mapping
|
173
|
+
- **Validation**: Pre-import validation with detailed error reporting
|
174
|
+
- **Progress Tracking**: Real-time progress bars with batch processing statistics
|
175
|
+
- **AfterImportActions**: Complete post-import action system for file uploads and field updates
|
176
|
+
|
177
|
+
## Command-Line Options
|
178
|
+
|
57
179
|
Available options:
|
58
180
|
|
59
|
-
|
181
|
+
### Core Operations
|
182
|
+
- `--it`: Run in interactive mode with enhanced visual feedback
|
183
|
+
- `--setup`: Create setup files (supports both YAML and TypeScript)
|
184
|
+
- `--generate`: Generate TypeScript and JSON schemas from database configurations
|
185
|
+
- `--import`: Import data using YAML configurations with advanced processing
|
186
|
+
- `--backup`: Comprehensive backup with progress tracking and detailed reporting
|
187
|
+
|
188
|
+
### Data Management
|
60
189
|
- `--dbIds`: Comma-separated list of database IDs to operate on
|
61
190
|
- `--collectionIds`: Comma-separated list of collection IDs to operate on
|
62
191
|
- `--bucketIds`: Comma-separated list of bucket IDs to operate on
|
63
|
-
- `--wipe`: Wipe data (all: everything, docs: only documents, users: only user data)
|
64
|
-
- `--wipeCollections`:
|
65
|
-
- `--
|
66
|
-
|
67
|
-
|
68
|
-
- `--
|
69
|
-
- `--
|
70
|
-
- `--sync`: Synchronize by pulling your Appwrite config from your configured Appwrite Project
|
192
|
+
- `--wipe`: Wipe data with smart confirmation (all: everything, docs: only documents, users: only user data)
|
193
|
+
- `--wipeCollections`: Non-destructively wipe specified collections
|
194
|
+
- `--writeData`: Write converted imported data to file for validation
|
195
|
+
|
196
|
+
### Configuration & Synchronization
|
197
|
+
- `--push`: Push local YAML/TypeScript config to Appwrite project
|
198
|
+
- `--sync`: Synchronize by pulling config from Appwrite project
|
71
199
|
- `--endpoint`: Set the Appwrite endpoint
|
72
200
|
- `--projectId`: Set the Appwrite project ID
|
73
201
|
- `--apiKey`: Set the Appwrite API key
|
74
|
-
|
202
|
+
|
203
|
+
### Transfer Operations
|
204
|
+
- `--transfer`: Transfer data between databases or collections with progress tracking
|
75
205
|
- `--transfer-users`: Transfer users between instances (will not overwrite)
|
76
|
-
- `--fromDbId
|
77
|
-
- `--toDbId
|
78
|
-
- `--fromCollectionId`:
|
79
|
-
- `--toCollectionId`:
|
80
|
-
- `--fromBucketId`:
|
81
|
-
- `--toBucketId`:
|
82
|
-
- `--remoteEndpoint`:
|
83
|
-
- `--remoteProjectId`:
|
84
|
-
- `--remoteApiKey`:
|
85
|
-
|
206
|
+
- `--fromDbId` / `--sourceDbId`: Source database ID for transfer
|
207
|
+
- `--toDbId` / `--targetDbId`: Destination database ID for transfer
|
208
|
+
- `--fromCollectionId`: Source collection ID for transfer
|
209
|
+
- `--toCollectionId`: Destination collection ID for transfer
|
210
|
+
- `--fromBucketId`: Source bucket ID for transfer
|
211
|
+
- `--toBucketId`: Destination bucket ID for transfer
|
212
|
+
- `--remoteEndpoint`: Remote Appwrite endpoint for transfers
|
213
|
+
- `--remoteProjectId`: Remote Appwrite project ID for transfers
|
214
|
+
- `--remoteApiKey`: Remote Appwrite API key for transfers
|
215
|
+
|
216
|
+
### Function Management
|
86
217
|
- `--updateFunctionSpec`: Update function specifications
|
87
218
|
- `--functionId`: Function ID to update
|
88
|
-
- `--specification`: New function specification (
|
219
|
+
- `--specification`: New function specification (s-0.5vcpu-512mb to s-8vcpu-8gb)
|
89
220
|
|
90
221
|
## Examples
|
91
222
|
|
@@ -150,6 +281,106 @@ This updated CLI ensures that developers have robust tools at their fingertips t
|
|
150
281
|
|
151
282
|
## Changelog
|
152
283
|
|
284
|
+
### 1.0.1 - Function Templates & Attribute Type Improvements
|
285
|
+
|
286
|
+
**🚀 Enhanced Function Management & Type System Fixes**
|
287
|
+
|
288
|
+
#### Function Template System Improvements
|
289
|
+
- **ES Module Compatibility**: Fixed `__dirname is not defined` error when creating function templates
|
290
|
+
- **Template-Specific Defaults**: Added pre-configured settings for all function templates:
|
291
|
+
- `typescript-node`: Node.js 21.0, TypeScript build setup, 0.5vCPU/512MB
|
292
|
+
- `uv`: Python 3.12, UV package manager, 0.5vCPU/512MB
|
293
|
+
- `count-docs-in-collection`: Node.js 21.0, specialized counting function, 1vCPU/512MB
|
294
|
+
- **YAML Config Integration**: Functions now automatically added to YAML config with generated ULIDs
|
295
|
+
- **Interactive Enhancement**: Improved template selection with descriptive names and smart defaults
|
296
|
+
|
297
|
+
#### YAML Collections Loading Fix
|
298
|
+
- **Path Resolution**: Fixed collections directory resolution for YAML configurations
|
299
|
+
- **Cross-Platform Support**: Collections now properly detected in `.appwrite/collections/` regardless of config location
|
300
|
+
- **Backwards Compatibility**: Both TypeScript and YAML collection structures fully supported
|
301
|
+
|
302
|
+
#### Attribute Type System Overhaul
|
303
|
+
- **Double/Float Compatibility**: Resolved Zod discriminated union errors with proper schema separation
|
304
|
+
- **Backwards Compatibility**: Full support for both "double" and "float" attribute types
|
305
|
+
- **Schema Architecture**: Clean separation with shared base schema for numeric attributes
|
306
|
+
- **Type Safety**: Enhanced TypeScript support with proper type inference
|
307
|
+
|
308
|
+
#### Developer Experience Improvements
|
309
|
+
- **Error Resolution**: Eliminated all TypeScript compilation errors
|
310
|
+
- **Template Updates**: Updated function template references from deprecated "poetry" to "uv"
|
311
|
+
- **Schema Validation**: Improved attribute validation with better error messages
|
312
|
+
- **Clean Architecture**: Removed deprecated relationship attributes for better performance
|
313
|
+
|
314
|
+
#### Bug Fixes
|
315
|
+
- Fixed YAML collection path resolution in nested directory structures
|
316
|
+
- Resolved ES module compatibility issues in function template creation
|
317
|
+
- Eliminated Zod discriminated union conflicts for numeric attribute types
|
318
|
+
- Updated outdated template references and improved template selection UX
|
319
|
+
|
320
|
+
**Migration Notes**:
|
321
|
+
- Function templates now automatically integrate with YAML configs
|
322
|
+
- Existing collections continue to work; deprecated relationship attributes converted to manual references
|
323
|
+
- All numeric attributes now use consistent "double" type with "float" backwards compatibility
|
324
|
+
|
325
|
+
### 1.0.0 - YAML-First Architecture & Import System Revolution
|
326
|
+
|
327
|
+
**🎉 Major Release - Comprehensive Architecture Overhaul**
|
328
|
+
|
329
|
+
#### YAML-First Configuration System
|
330
|
+
- **Complete YAML support** with JSON Schema validation for IntelliSense
|
331
|
+
- **Automatic discovery**: `.appwrite/config.yaml`, `appwrite.yaml`, or `appwriteConfig.ts`
|
332
|
+
- **Cross-platform compatibility**: No TypeScript runner required
|
333
|
+
- **Better organization**: Clean `.appwrite` directory structure
|
334
|
+
- **Backward compatibility**: Existing TypeScript configs continue to work
|
335
|
+
|
336
|
+
#### Import System Revolution (50%+ Complexity Reduction)
|
337
|
+
- **Modular architecture**: Extracted DataLoader (1,688 lines) into focused services
|
338
|
+
- `DataTransformationService` - Pure data transformation logic
|
339
|
+
- `FileHandlerService` - URL downloads and local file handling
|
340
|
+
- `UserMappingService` - Sophisticated email/phone deduplication
|
341
|
+
- `ValidationService` - Centralized validation with detailed reporting
|
342
|
+
- `RelationshipResolver` - Cross-collection ID mapping
|
343
|
+
- `ImportOrchestrator` - High-level coordination
|
344
|
+
- **Enhanced rate limiting**: Configurable p-limit for different operations
|
345
|
+
- `dataInsertion: 5` (concurrent document creation)
|
346
|
+
- `fileUpload: 2` (conservative for large files)
|
347
|
+
- `validation: 10` (pre-import validation)
|
348
|
+
- `dataQuery: 25` (relationship resolution)
|
349
|
+
|
350
|
+
#### YAML Import Configuration System
|
351
|
+
- **Complete YAML import definitions** with JSON Schema support
|
352
|
+
- **Advanced file handling**: URL downloads with local file search fallback
|
353
|
+
- **Sophisticated validation**: Pre-import validation with detailed error reporting
|
354
|
+
- **Template generation**: Easy creation of new import configurations
|
355
|
+
- **Relationship mapping**: Intelligent cross-collection ID resolution
|
356
|
+
- **User deduplication**: Advanced email/phone matching with merge capabilities
|
357
|
+
- **AfterImportActions**: Complete post-import action system
|
358
|
+
|
359
|
+
#### Enhanced User Experience
|
360
|
+
- **Rich visual feedback**: Progress bars with ETA and speed indicators
|
361
|
+
- **Smart confirmation dialogs**: Risk-based confirmations for destructive operations
|
362
|
+
- **Operation summaries**: Detailed post-operation reports with statistics
|
363
|
+
- **Professional messaging**: Unified MessageFormatter with consistent styling
|
364
|
+
- **Configurable logging**: Disabled by default, full configuration support
|
365
|
+
|
366
|
+
#### Performance & Safety Improvements
|
367
|
+
- **Batch processing**: Enhanced with progress tracking and memory efficiency
|
368
|
+
- **Error resilience**: Improved error handling and recovery mechanisms
|
369
|
+
- **Transaction safety**: Better handling of partial failures
|
370
|
+
- **Memory optimization**: Efficient processing of large datasets
|
371
|
+
|
372
|
+
#### Developer Experience
|
373
|
+
- **JSON Schema generation**: Full IntelliSense support for YAML files
|
374
|
+
- **Example configurations**: Comprehensive templates and examples
|
375
|
+
- **Better error messages**: Clear validation and error reporting
|
376
|
+
- **Type safety**: Full TypeScript support for all new features
|
377
|
+
|
378
|
+
### Changelog
|
379
|
+
|
380
|
+
- 1.0.2: Fixed migrations, sorry about that!
|
381
|
+
|
382
|
+
**Migration Note**: While fully backward compatible, we recommend migrating to YAML configuration for the best experience. Use `--setup` to generate new YAML configurations.
|
383
|
+
|
153
384
|
- 0.10.86: Fixed `selectCollections` not always filtering by `databaseId`
|
154
385
|
- 0.10.85: Added logging to `wipeCollection`
|
155
386
|
- 0.10.83: Actually fixed the import oops
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Query } from "node-appwrite";
|
2
2
|
import { attributeSchema, parseAttribute, } from "appwrite-utils";
|
3
|
-
import { nameToIdMapping, enqueueOperation } from "../
|
3
|
+
import { nameToIdMapping, enqueueOperation } from "../shared/operationQueue.js";
|
4
4
|
import { delay, tryAwaitWithRetry } from "../utils/helperFunctions.js";
|
5
5
|
import chalk from "chalk";
|
6
6
|
const attributesSame = (databaseAttribute, configAttribute) => {
|
@@ -175,7 +175,8 @@ export const createOrUpdateAttribute = async (db, dbId, collection, attribute) =
|
|
175
175
|
: null));
|
176
176
|
}
|
177
177
|
break;
|
178
|
-
case "
|
178
|
+
case "double":
|
179
|
+
case "float": // Backward compatibility
|
179
180
|
if (action === "create") {
|
180
181
|
await tryAwaitWithRetry(async () => await db.createFloatAttribute(dbId, collection.$id, finalAttribute.key, finalAttribute.required || false, finalAttribute.min || -2147483647, finalAttribute.max || 2147483647, finalAttribute.xdefault !== undefined && !finalAttribute.required
|
181
182
|
? finalAttribute.xdefault
|