@akis05/akis 0.1.4 → 0.1.6
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/README.md +161 -161
- package/dist/cli/akis.js +28 -28
- package/dist/cli/akis.js.map +1 -1
- package/dist/cli/commands/delete.js +15 -15
- package/dist/cli/commands/delete.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +28 -29
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/migrate.js +20 -20
- package/dist/cli/commands/migrate.js.map +1 -1
- package/dist/cli/commands/status.js +16 -16
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/update.js +16 -16
- package/dist/cli/commands/update.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
# AKIS - Appwrite CLI Tool
|
|
2
2
|
|
|
3
|
-
**AKIS**
|
|
3
|
+
**AKIS** is a CLI tool that automatically syncs your Appwrite collections with your TypeScript types. Define your types once, and AKIS creates/updates your collections and generates the corresponding schema.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
7
|
+
- **Auto-generation**: Creates Appwrite collections from your TypeScript types
|
|
8
|
+
- **Synchronization**: Detects differences between your types and Appwrite
|
|
9
|
+
- **Auto-generated schema**: The `schema.ts` file is automatically generated during migration
|
|
10
|
+
- **Automatic indexes**: Creates indexes for common fields (storeId, email, etc.)
|
|
11
|
+
- **Dry-run mode**: Preview changes before applying them
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
###
|
|
17
|
+
### With npm
|
|
18
18
|
```bash
|
|
19
19
|
npm install @akis05/akis
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
###
|
|
22
|
+
### With pnpm
|
|
23
23
|
```bash
|
|
24
24
|
pnpm add @akis05/akis
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Global installation (optional)
|
|
28
28
|
```bash
|
|
29
29
|
npm install -g @akis05/akis
|
|
30
30
|
```
|
|
@@ -33,97 +33,97 @@ npm install -g @akis05/akis
|
|
|
33
33
|
|
|
34
34
|
## Configuration
|
|
35
35
|
|
|
36
|
-
### 1. Variables
|
|
36
|
+
### 1. Environment Variables
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Create a `.env` file at the root of your project:
|
|
39
39
|
|
|
40
40
|
```env
|
|
41
|
-
# Endpoint
|
|
41
|
+
# Appwrite Endpoint (Cloud or Self-hosted)
|
|
42
42
|
APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
|
|
43
43
|
|
|
44
|
-
#
|
|
45
|
-
APPWRITE_PROJECT_ID=
|
|
44
|
+
# Your Appwrite project ID
|
|
45
|
+
APPWRITE_PROJECT_ID=your_project_id
|
|
46
46
|
|
|
47
|
-
#
|
|
48
|
-
APPWRITE_DATABASE_ID=
|
|
47
|
+
# Your database ID
|
|
48
|
+
APPWRITE_DATABASE_ID=your_database_id
|
|
49
49
|
|
|
50
|
-
#
|
|
51
|
-
APPWRITE_API_KEY=
|
|
50
|
+
# API Key with Database permissions (Create, Read, Update, Delete)
|
|
51
|
+
APPWRITE_API_KEY=your_api_key
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
### 2.
|
|
54
|
+
### 2. Getting Appwrite Credentials
|
|
55
55
|
|
|
56
|
-
1.
|
|
57
|
-
2. **Project ID
|
|
58
|
-
3. **Database ID
|
|
59
|
-
4. **API Key
|
|
56
|
+
1. Log in to [Appwrite Console](https://cloud.appwrite.io)
|
|
57
|
+
2. **Project ID**: Settings → Project ID
|
|
58
|
+
3. **Database ID**: Databases → Click on your DB → Settings
|
|
59
|
+
4. **API Key**: Settings → API Keys → Create API Key (check Database permissions)
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
63
|
-
##
|
|
63
|
+
## Quick Start
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### Step 1: Initialize the project
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
68
|
npx akis init
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
This command creates the following structure:
|
|
72
72
|
|
|
73
73
|
```
|
|
74
74
|
core/
|
|
75
75
|
└── appwrite-model/
|
|
76
|
-
├── types.ts #
|
|
77
|
-
├── schema.ts #
|
|
78
|
-
├── client.ts #
|
|
79
|
-
└── setup-collections.ts #
|
|
76
|
+
├── types.ts # Your TypeScript definitions
|
|
77
|
+
├── schema.ts # Generated schema (do not edit manually)
|
|
78
|
+
├── client.ts # Configured Appwrite client
|
|
79
|
+
└── setup-collections.ts # Utility functions
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
###
|
|
82
|
+
### Step 2: Define your types
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
Edit `core/appwrite-model/types.ts`:
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
87
|
export type Client = {
|
|
88
|
-
_id: string; // ID
|
|
89
|
-
_creationTime: number; //
|
|
90
|
-
|
|
91
|
-
email?: string; //
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
tags?: string[]; //
|
|
88
|
+
_id: string; // Appwrite ID (required)
|
|
89
|
+
_creationTime: number; // Creation timestamp (required)
|
|
90
|
+
name: string; // Required field
|
|
91
|
+
email?: string; // Optional field (?)
|
|
92
|
+
phone?: string;
|
|
93
|
+
status: "active" | "inactive"; // Enum
|
|
94
|
+
tags?: string[]; // String array
|
|
95
95
|
storeId: string;
|
|
96
96
|
createdAt: number;
|
|
97
97
|
deletedAt?: number;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export type
|
|
100
|
+
export type Product = {
|
|
101
101
|
_id: string;
|
|
102
102
|
_creationTime: number;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
name: string;
|
|
104
|
+
price: number;
|
|
105
|
+
quantity: number;
|
|
106
|
+
category: "electronics" | "clothing" | "food";
|
|
107
107
|
storeId: string;
|
|
108
108
|
createdAt: number;
|
|
109
109
|
};
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
###
|
|
112
|
+
### Step 3: Migrate to Appwrite
|
|
113
113
|
|
|
114
114
|
```bash
|
|
115
|
-
#
|
|
115
|
+
# Preview changes (recommended)
|
|
116
116
|
npx akis migrate --dry-run
|
|
117
117
|
|
|
118
|
-
#
|
|
118
|
+
# Create collections
|
|
119
119
|
npx akis migrate
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
**
|
|
123
|
-
- Collections
|
|
124
|
-
-
|
|
122
|
+
**Result**:
|
|
123
|
+
- Collections created in Appwrite
|
|
124
|
+
- `schema.ts` file automatically generated
|
|
125
125
|
|
|
126
|
-
###
|
|
126
|
+
### Step 4: Check status
|
|
127
127
|
|
|
128
128
|
```bash
|
|
129
129
|
npx akis status
|
|
@@ -131,212 +131,212 @@ npx akis status
|
|
|
131
131
|
|
|
132
132
|
---
|
|
133
133
|
|
|
134
|
-
##
|
|
134
|
+
## Commands
|
|
135
135
|
|
|
136
136
|
### `akis init`
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
Initializes the project structure.
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
|
-
npx akis init #
|
|
142
|
-
npx akis init --force #
|
|
141
|
+
npx akis init # Create files
|
|
142
|
+
npx akis init --force # Overwrite existing files
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
**Options:**
|
|
146
146
|
| Option | Description |
|
|
147
147
|
|--------|-------------|
|
|
148
|
-
| `-f, --force` |
|
|
148
|
+
| `-f, --force` | Overwrites existing files |
|
|
149
149
|
|
|
150
150
|
---
|
|
151
151
|
|
|
152
152
|
### `akis migrate`
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
Creates missing collections in Appwrite and generates `schema.ts`.
|
|
155
155
|
|
|
156
156
|
```bash
|
|
157
|
-
npx akis migrate #
|
|
158
|
-
npx akis migrate --name clients #
|
|
159
|
-
npx akis migrate --dry-run #
|
|
157
|
+
npx akis migrate # Migrate all collections
|
|
158
|
+
npx akis migrate --name clients # Migrate a specific collection
|
|
159
|
+
npx akis migrate --dry-run # Preview without executing
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
**Options:**
|
|
163
163
|
| Option | Description |
|
|
164
164
|
|--------|-------------|
|
|
165
|
-
| `-n, --name <name>` |
|
|
166
|
-
| `-d, --dry-run` |
|
|
165
|
+
| `-n, --name <name>` | Name of the collection to migrate |
|
|
166
|
+
| `-d, --dry-run` | Shows actions without executing them |
|
|
167
167
|
|
|
168
|
-
**
|
|
168
|
+
**Example output:**
|
|
169
169
|
```
|
|
170
|
-
🚀 AKIS Migrate -
|
|
170
|
+
🚀 AKIS Migrate - Creating missing collections
|
|
171
171
|
|
|
172
|
-
📖
|
|
173
|
-
2 collection(s)
|
|
172
|
+
📖 Reading types.ts...
|
|
173
|
+
2 collection(s) to process
|
|
174
174
|
|
|
175
|
-
📡
|
|
175
|
+
📡 Connecting to Appwrite...
|
|
176
176
|
|
|
177
|
-
📦
|
|
178
|
-
✓
|
|
177
|
+
📦 Creating clients...
|
|
178
|
+
✓ name
|
|
179
179
|
✓ email
|
|
180
|
-
✓
|
|
181
|
-
✓
|
|
180
|
+
✓ phone
|
|
181
|
+
✓ status
|
|
182
182
|
✓ storeId
|
|
183
183
|
🔑 idx_storeId
|
|
184
184
|
🔑 idx_email
|
|
185
|
-
✅ clients
|
|
185
|
+
✅ clients created
|
|
186
186
|
|
|
187
|
-
📝 schema.ts
|
|
187
|
+
📝 schema.ts generated with 2 collections
|
|
188
188
|
|
|
189
|
-
✨ Migration
|
|
189
|
+
✨ Migration complete: 1 created, 1 skipped
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
---
|
|
193
193
|
|
|
194
194
|
### `akis update`
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
Adds new attributes to existing collections.
|
|
197
197
|
|
|
198
198
|
```bash
|
|
199
|
-
npx akis update #
|
|
200
|
-
npx akis update --name clients #
|
|
201
|
-
npx akis update --dry-run #
|
|
199
|
+
npx akis update # Update all collections
|
|
200
|
+
npx akis update --name clients # Update a specific collection
|
|
201
|
+
npx akis update --dry-run # Preview without executing
|
|
202
202
|
```
|
|
203
203
|
|
|
204
204
|
**Options:**
|
|
205
205
|
| Option | Description |
|
|
206
206
|
|--------|-------------|
|
|
207
|
-
| `-n, --name <name>` |
|
|
208
|
-
| `-d, --dry-run` |
|
|
207
|
+
| `-n, --name <name>` | Name of the collection to update |
|
|
208
|
+
| `-d, --dry-run` | Shows actions without executing them |
|
|
209
209
|
|
|
210
|
-
**
|
|
211
|
-
-
|
|
212
|
-
-
|
|
210
|
+
**Use cases:**
|
|
211
|
+
- You added a new field in `types.ts`
|
|
212
|
+
- You want to sync without recreating the collection
|
|
213
213
|
|
|
214
214
|
---
|
|
215
215
|
|
|
216
216
|
### `akis status`
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
Compares local types with Appwrite collections.
|
|
219
219
|
|
|
220
220
|
```bash
|
|
221
|
-
npx akis status #
|
|
222
|
-
npx akis status --name clients #
|
|
221
|
+
npx akis status # View all collections
|
|
222
|
+
npx akis status --name clients # View a specific collection
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
**Options:**
|
|
226
226
|
| Option | Description |
|
|
227
227
|
|--------|-------------|
|
|
228
|
-
| `-n, --name <name>` |
|
|
228
|
+
| `-n, --name <name>` | Name of the collection to check |
|
|
229
229
|
|
|
230
|
-
**
|
|
230
|
+
**Example output:**
|
|
231
231
|
```
|
|
232
|
-
📊 AKIS Status -
|
|
232
|
+
📊 AKIS Status - Collection Status
|
|
233
233
|
|
|
234
234
|
┌─────────────────────────────┬────────┬────────────┬─────────────┐
|
|
235
|
-
│ Collection │ Status │
|
|
235
|
+
│ Collection │ Status │ Attributes │ Missing │
|
|
236
236
|
├─────────────────────────────┼────────┼────────────┼─────────────┤
|
|
237
237
|
│ clients │ ✅ │ 9/9 │ 0 │
|
|
238
|
-
│
|
|
239
|
-
│
|
|
238
|
+
│ products │ ⚠️ │ 5/7 │ 2 │
|
|
239
|
+
│ orders │ ❌ │ - │ - │
|
|
240
240
|
└─────────────────────────────┴────────┴────────────┴─────────────┘
|
|
241
241
|
|
|
242
|
-
📈
|
|
243
|
-
✅ 1
|
|
244
|
-
⚠️ 1
|
|
245
|
-
❌ 1
|
|
242
|
+
📈 Summary:
|
|
243
|
+
✅ 1 synchronized
|
|
244
|
+
⚠️ 1 needs update (akis update)
|
|
245
|
+
❌ 1 missing (akis migrate)
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
---
|
|
249
249
|
|
|
250
250
|
### `akis delete`
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
Deletes collections in Appwrite.
|
|
253
253
|
|
|
254
254
|
```bash
|
|
255
|
-
npx akis delete --name clients #
|
|
256
|
-
npx akis delete --force #
|
|
257
|
-
npx akis delete --name clients -f #
|
|
255
|
+
npx akis delete --name clients # Delete a collection (with confirmation)
|
|
256
|
+
npx akis delete --force # Delete ALL collections without confirmation
|
|
257
|
+
npx akis delete --name clients -f # Delete without confirmation
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
**Options:**
|
|
261
261
|
| Option | Description |
|
|
262
262
|
|--------|-------------|
|
|
263
|
-
| `-n, --name <name>` |
|
|
264
|
-
| `-f, --force` |
|
|
263
|
+
| `-n, --name <name>` | Name of the collection to delete |
|
|
264
|
+
| `-f, --force` | Delete without asking for confirmation |
|
|
265
265
|
|
|
266
|
-
⚠️ **
|
|
266
|
+
⚠️ **Warning**: This action is irreversible!
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
270
|
-
##
|
|
270
|
+
## Supported TypeScript Types
|
|
271
271
|
|
|
272
|
-
AKIS
|
|
272
|
+
AKIS automatically recognizes the following types:
|
|
273
273
|
|
|
274
274
|
| TypeScript | Appwrite Attribute |
|
|
275
275
|
|------------|-------------------|
|
|
276
|
-
| `string` | String (
|
|
277
|
-
| `number` | Float
|
|
276
|
+
| `string` | String (auto-detected size) |
|
|
277
|
+
| `number` | Float or Integer (based on field name) |
|
|
278
278
|
| `boolean` | Boolean |
|
|
279
279
|
| `string[]` | String Array |
|
|
280
280
|
| `number[]` | Integer Array |
|
|
281
281
|
| `"a" \| "b" \| "c"` | Enum |
|
|
282
282
|
|
|
283
|
-
### Conventions
|
|
283
|
+
### Naming Conventions
|
|
284
284
|
|
|
285
|
-
AKIS
|
|
285
|
+
AKIS automatically infers certain properties:
|
|
286
286
|
|
|
287
|
-
|
|
|
288
|
-
|
|
287
|
+
| Field Name | Inferred Type | Size |
|
|
288
|
+
|------------|---------------|------|
|
|
289
289
|
| `*Id`, `storeId` | string | 36 |
|
|
290
290
|
| `email` | string | 255 |
|
|
291
|
-
| `
|
|
291
|
+
| `phone`, `tel` | string | 50 |
|
|
292
292
|
| `note`, `description` | string | 2000 |
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
293
|
+
| `address` | string | 500 |
|
|
294
|
+
| `quantity*`, `*Minutes` | integer | - |
|
|
295
295
|
| `createdAt`, `deletedAt` | integer | - |
|
|
296
296
|
|
|
297
|
-
###
|
|
297
|
+
### System Fields (ignored)
|
|
298
298
|
|
|
299
|
-
|
|
300
|
-
- `_id` - ID
|
|
301
|
-
- `_creationTime` -
|
|
299
|
+
These fields are automatically ignored as they are managed by Appwrite:
|
|
300
|
+
- `_id` - Document ID
|
|
301
|
+
- `_creationTime` - Creation timestamp
|
|
302
302
|
|
|
303
303
|
---
|
|
304
304
|
|
|
305
|
-
## Workflow
|
|
305
|
+
## Recommended Workflow
|
|
306
306
|
|
|
307
307
|
```
|
|
308
308
|
┌─────────────────────────────────────────────────────────────┐
|
|
309
|
-
│ 1.
|
|
309
|
+
│ 1. Define types in types.ts │
|
|
310
310
|
│ export type Client = { ... } │
|
|
311
311
|
└─────────────────────────────────────────────────────────────┘
|
|
312
312
|
↓
|
|
313
313
|
┌─────────────────────────────────────────────────────────────┐
|
|
314
|
-
│ 2.
|
|
314
|
+
│ 2. Preview changes │
|
|
315
315
|
│ npx akis migrate --dry-run │
|
|
316
316
|
└─────────────────────────────────────────────────────────────┘
|
|
317
317
|
↓
|
|
318
318
|
┌─────────────────────────────────────────────────────────────┐
|
|
319
|
-
│ 3.
|
|
319
|
+
│ 3. Migrate to Appwrite │
|
|
320
320
|
│ npx akis migrate │
|
|
321
|
-
│ → Collections
|
|
321
|
+
│ → Collections created + schema.ts generated │
|
|
322
322
|
└─────────────────────────────────────────────────────────────┘
|
|
323
323
|
↓
|
|
324
324
|
┌─────────────────────────────────────────────────────────────┐
|
|
325
|
-
│ 4.
|
|
325
|
+
│ 4. Verify synchronization │
|
|
326
326
|
│ npx akis status │
|
|
327
327
|
└─────────────────────────────────────────────────────────────┘
|
|
328
328
|
↓
|
|
329
329
|
┌─────────────────────────────────────────────────────────────┐
|
|
330
|
-
│ 5.
|
|
330
|
+
│ 5. Adding new fields? → Back to step 1 │
|
|
331
331
|
│ npx akis update │
|
|
332
332
|
└─────────────────────────────────────────────────────────────┘
|
|
333
333
|
```
|
|
334
334
|
|
|
335
335
|
---
|
|
336
336
|
|
|
337
|
-
##
|
|
337
|
+
## Using with pnpm
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
If you use pnpm, add a script to your `package.json`:
|
|
340
340
|
|
|
341
341
|
```json
|
|
342
342
|
{
|
|
@@ -346,7 +346,7 @@ Si vous utilisez pnpm, ajoutez un script dans votre `package.json`:
|
|
|
346
346
|
}
|
|
347
347
|
```
|
|
348
348
|
|
|
349
|
-
|
|
349
|
+
Then use:
|
|
350
350
|
```bash
|
|
351
351
|
pnpm akis status
|
|
352
352
|
pnpm akis migrate
|
|
@@ -355,85 +355,85 @@ pnpm akis update
|
|
|
355
355
|
|
|
356
356
|
---
|
|
357
357
|
|
|
358
|
-
##
|
|
358
|
+
## Examples
|
|
359
359
|
|
|
360
|
-
###
|
|
360
|
+
### Complete types.ts Example
|
|
361
361
|
|
|
362
362
|
```typescript
|
|
363
363
|
/* ═══════════════════════════════════════════════════════════
|
|
364
|
-
Types
|
|
364
|
+
Types for my application
|
|
365
365
|
═══════════════════════════════════════════════════════════ */
|
|
366
366
|
|
|
367
367
|
export type Client = {
|
|
368
368
|
_id: string;
|
|
369
369
|
_creationTime: number;
|
|
370
|
-
|
|
370
|
+
name: string;
|
|
371
371
|
email?: string;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
372
|
+
phone?: string;
|
|
373
|
+
address?: string;
|
|
374
|
+
status: "active" | "inactive" | "prospect";
|
|
375
|
+
discount?: number;
|
|
376
376
|
tags?: string[];
|
|
377
377
|
storeId: string;
|
|
378
378
|
createdAt: number;
|
|
379
379
|
deletedAt?: number;
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
export type
|
|
382
|
+
export type Product = {
|
|
383
383
|
_id: string;
|
|
384
384
|
_creationTime: number;
|
|
385
|
-
|
|
385
|
+
name: string;
|
|
386
386
|
description?: string;
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
price: number;
|
|
388
|
+
costPrice?: number;
|
|
389
|
+
quantity: number;
|
|
390
|
+
minStock?: number;
|
|
391
|
+
category: "electronics" | "clothing" | "food" | "other";
|
|
392
392
|
image?: string;
|
|
393
393
|
storeId: string;
|
|
394
394
|
createdAt: number;
|
|
395
395
|
};
|
|
396
396
|
|
|
397
|
-
export type
|
|
397
|
+
export type Sale = {
|
|
398
398
|
_id: string;
|
|
399
399
|
_creationTime: number;
|
|
400
|
-
|
|
400
|
+
number: string;
|
|
401
401
|
clientId?: string;
|
|
402
|
-
|
|
402
|
+
lines: string; // Stringified JSON
|
|
403
403
|
total: number;
|
|
404
|
-
|
|
404
|
+
status: "draft" | "validated" | "paid" | "cancelled";
|
|
405
405
|
storeId: string;
|
|
406
406
|
createdAt: number;
|
|
407
407
|
};
|
|
408
408
|
|
|
409
|
-
//
|
|
409
|
+
// Utilities
|
|
410
410
|
export type NewDoc<T> = Omit<T, "_id" | "_creationTime">;
|
|
411
411
|
export type UpdateDoc<T> = Partial<Omit<T, "_id" | "_creationTime">>;
|
|
412
412
|
```
|
|
413
413
|
|
|
414
414
|
---
|
|
415
415
|
|
|
416
|
-
##
|
|
416
|
+
## Troubleshooting
|
|
417
417
|
|
|
418
|
-
###
|
|
418
|
+
### Error: APPWRITE_API_KEY not configured
|
|
419
419
|
|
|
420
|
-
|
|
420
|
+
Check that your `.env` file exists and contains the API key:
|
|
421
421
|
```bash
|
|
422
422
|
cat .env | grep APPWRITE_API_KEY
|
|
423
423
|
```
|
|
424
424
|
|
|
425
|
-
###
|
|
425
|
+
### Error: Collection not found in types.ts
|
|
426
426
|
|
|
427
|
-
|
|
427
|
+
Make sure the type name corresponds to a name recognized by AKIS:
|
|
428
428
|
- `Client` → `clients`
|
|
429
|
-
- `
|
|
430
|
-
- `
|
|
429
|
+
- `Product` → `products`
|
|
430
|
+
- `Sale` → `sales`
|
|
431
431
|
|
|
432
|
-
###
|
|
432
|
+
### Attributes are not created
|
|
433
433
|
|
|
434
|
-
Appwrite
|
|
435
|
-
-
|
|
436
|
-
-
|
|
434
|
+
Appwrite has size limits for attributes. Check:
|
|
435
|
+
- String size (max 16000 characters)
|
|
436
|
+
- Number of attributes per collection (max ~100)
|
|
437
437
|
|
|
438
438
|
---
|
|
439
439
|
|
|
@@ -443,7 +443,7 @@ MIT
|
|
|
443
443
|
|
|
444
444
|
---
|
|
445
445
|
|
|
446
|
-
##
|
|
446
|
+
## Links
|
|
447
447
|
|
|
448
448
|
- [Appwrite Documentation](https://appwrite.io/docs)
|
|
449
449
|
- [npm Package](https://www.npmjs.com/package/@akis05/akis)
|