appwrite-utils-cli 0.0.32 → 0.0.34
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 +103 -97
- package/dist/migrations/backup.d.ts +2 -0
- package/dist/migrations/dataLoader.d.ts +40 -4
- package/dist/migrations/dataLoader.js +119 -126
- package/dist/migrations/importController.js +54 -50
- package/dist/migrations/schemaStrings.js +38 -38
- package/dist/migrations/users.js +4 -0
- package/package.json +54 -54
- package/src/main.ts +83 -83
- package/src/migrations/dataLoader.ts +140 -169
- package/src/migrations/importController.ts +62 -63
- package/src/migrations/openapi.ts +83 -83
- package/src/migrations/schemaStrings.ts +473 -473
- package/src/migrations/users.ts +4 -0
- package/src/utilsController.ts +194 -194
package/README.md
CHANGED
|
@@ -1,97 +1,103 @@
|
|
|
1
|
-
# appwrite-utils-cli
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
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 much more. This CLI tool facilitates complex tasks like setting up databases, running migrations, generating schemas, and managing backups efficiently, making it an indispensable part of your Appwrite project management.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- **Easy Configuration**: Initialize your Appwrite project configurations interactively directly from the command line.
|
|
10
|
-
- **Database Migrations**: Control the migration process with options to target production, staging, or development environments.
|
|
11
|
-
- **Schema Generation**: Generate and manage TypeScript schemas directly from your Appwrite database schemas.
|
|
12
|
-
- **Data Import**: Facilitate the import of data into your Appwrite databases with comprehensive command-line support.
|
|
13
|
-
- **Backup Management**: Create backups of your Appwrite databases to ensure data integrity and safety.
|
|
14
|
-
- **Flexible Database Management**: Includes commands to wipe databases, documents, or user data, providing flexibility in managing your database state during development or testing.
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
To use `appwrite-utils-cli`, you can install it globally via npm to make it accessible from anywhere in your command line:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install -g appwrite-utils-cli
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
However, due to the nature of the speed at which I am developing this project, I would recommend the following command:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npx --package=appwrite-utils-cli@latest appwrite-migrate --arg1 --arg2 --arg3
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**DO NOT INSTALL THIS LOCALLY INTO YOUR PROJECT, IT IS MEANT TO BE USED AS A COMMAND LINE TOOL ONLY**
|
|
31
|
-
|
|
32
|
-
## Usage
|
|
33
|
-
|
|
34
|
-
After installation, you can access the tool directly from your command line using the provided commands. Here's how you can use the different functionalities:
|
|
35
|
-
|
|
36
|
-
### Initialization
|
|
37
|
-
|
|
38
|
-
Interactively set up your Appwrite project with necessary configurations:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npx --package=appwrite-utils-cli@latest appwrite-init
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Running Migrations and Tasks
|
|
45
|
-
|
|
46
|
-
Run migration and management tasks with specific flags according to your needs:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx --package=appwrite-utils-cli@latest appwrite-migrate --args
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Replace `--args` with the appropriate options:
|
|
53
|
-
|
|
54
|
-
- `--prod`: Run tasks in the production environment.
|
|
55
|
-
- `--staging`: Run tasks in the staging environment.
|
|
56
|
-
- `--dev`: Run tasks in the development environment.
|
|
57
|
-
- `--wipe`: Wipe all databases.
|
|
58
|
-
- `--wipe-docs
|
|
59
|
-
- `--generate`: Generate TypeScript schemas from database schemas.
|
|
60
|
-
- `--import`: Import data into your databases.
|
|
61
|
-
- `--backup`: Perform a backup of your databases.
|
|
62
|
-
- `--wipe-users
|
|
63
|
-
- `--write-data
|
|
64
|
-
- `--sync`: Synchronize your project's config and generate schema for your database
|
|
65
|
-
- `--endpoint`: Set a different endpoint for the migration target
|
|
66
|
-
- `--project`: Set a different project ID for the migration target
|
|
67
|
-
- `--key`: Set a different API key for the migration target
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
- 0.0.
|
|
90
|
-
- 0.0.
|
|
91
|
-
- 0.0.
|
|
92
|
-
- 0.0.
|
|
93
|
-
- 0.0.
|
|
94
|
-
- 0.0.
|
|
95
|
-
- 0.0.
|
|
96
|
-
- 0.0.
|
|
97
|
-
- 0.0.
|
|
1
|
+
# appwrite-utils-cli
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
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 much more. This CLI tool facilitates complex tasks like setting up databases, running migrations, generating schemas, and managing backups efficiently, making it an indispensable part of your Appwrite project management.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Easy Configuration**: Initialize your Appwrite project configurations interactively directly from the command line.
|
|
10
|
+
- **Database Migrations**: Control the migration process with options to target production, staging, or development environments.
|
|
11
|
+
- **Schema Generation**: Generate and manage TypeScript schemas directly from your Appwrite database schemas.
|
|
12
|
+
- **Data Import**: Facilitate the import of data into your Appwrite databases with comprehensive command-line support.
|
|
13
|
+
- **Backup Management**: Create backups of your Appwrite databases to ensure data integrity and safety.
|
|
14
|
+
- **Flexible Database Management**: Includes commands to wipe databases, documents, or user data, providing flexibility in managing your database state during development or testing.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
To use `appwrite-utils-cli`, you can install it globally via npm to make it accessible from anywhere in your command line:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g appwrite-utils-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
However, due to the nature of the speed at which I am developing this project, I would recommend the following command:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx --package=appwrite-utils-cli@latest appwrite-migrate --arg1 --arg2 --arg3
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**DO NOT INSTALL THIS LOCALLY INTO YOUR PROJECT, IT IS MEANT TO BE USED AS A COMMAND LINE TOOL ONLY**
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
After installation, you can access the tool directly from your command line using the provided commands. Here's how you can use the different functionalities:
|
|
35
|
+
|
|
36
|
+
### Initialization
|
|
37
|
+
|
|
38
|
+
Interactively set up your Appwrite project with necessary configurations:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx --package=appwrite-utils-cli@latest appwrite-init
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Running Migrations and Tasks
|
|
45
|
+
|
|
46
|
+
Run migration and management tasks with specific flags according to your needs:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx --package=appwrite-utils-cli@latest appwrite-migrate --args
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Replace `--args` with the appropriate options:
|
|
53
|
+
|
|
54
|
+
- `--prod`: Run tasks in the production environment.
|
|
55
|
+
- `--staging`: Run tasks in the staging environment.
|
|
56
|
+
- `--dev`: Run tasks in the development environment.
|
|
57
|
+
- `--wipe`: Wipe all databases.
|
|
58
|
+
- `--wipe-docs`: Wipe all documents in the databases.
|
|
59
|
+
- `--generate`: Generate TypeScript schemas from database schemas.
|
|
60
|
+
- `--import`: Import data into your databases.
|
|
61
|
+
- `--backup`: Perform a backup of your databases.
|
|
62
|
+
- `--wipe-users`: Wipe all user data.
|
|
63
|
+
- `--write-data`: Write converted imported data to file
|
|
64
|
+
- `--sync`: Synchronize your project's config and generate schema for your database
|
|
65
|
+
- `--endpoint`: Set a different endpoint for the migration target
|
|
66
|
+
- `--project`: Set a different project ID for the migration target
|
|
67
|
+
- `--key`: Set a different API key for the migration target
|
|
68
|
+
|
|
69
|
+
## If you run out of RAM
|
|
70
|
+
|
|
71
|
+
This happens because Node only allocates 4 GB, it'll only happen if you're importing a ton of data, but you can use `export NODE_OPTIONS="--max-old-space-size=16384"` or the relevant command for your system if that doesn't work, and it'll set the env var to whatever. That's 16 GB, I would recommend `8192` for most.
|
|
72
|
+
|
|
73
|
+
### OpenAPI Generation (almost done, in progress)
|
|
74
|
+
|
|
75
|
+
Recently, I have also added an optional OpenAPI generation for each attribute in the schema. This is because I needed it and because I felt it would be nice to have. This is done using [this package](https://github.com/asteasolutions/zod-to-openapi), many thanks to them.
|
|
76
|
+
|
|
77
|
+
To use it, add a `description` to any attribute or collection, and it will export that schema to the `appwrite/openapi` folder
|
|
78
|
+
|
|
79
|
+
This setup ensures that developers have robust tools at their fingertips to manage complex Appwrite projects effectively from the command line. I also have added logging automatically for information and errors as the console can be hard to keep up with.
|
|
80
|
+
|
|
81
|
+
### Roadmap
|
|
82
|
+
|
|
83
|
+
- Syncing configuration (DONE)
|
|
84
|
+
- Better file format for config (potentially)
|
|
85
|
+
- Separation of collections and import configuration from main config
|
|
86
|
+
|
|
87
|
+
### Changelog
|
|
88
|
+
|
|
89
|
+
- 0.0.34: Fixed the `bin` section of the package.json, apparently you can't use `node` to run it
|
|
90
|
+
- 0.0.33: Fixed `idMappings`, if you are importing data and use the `idMappings` functionality, you can set a `fieldToSet` based on the value of a `sourceField` in the current imported items data (whether it's in the final data or the original), in order to match another field in another collection. So if you had a store, and it had items and the items have a Region ID for instance. You can then, in your regionId of the items, setup an `idMapping` that will allow you to map the value of the `targetField` based on the value of the `targetFieldToMatch` in the `targetCollection`. Sounds complex, but it's very useful. Like psuedo-relationship resolution, without the relationships.
|
|
91
|
+
- 0.0.29: If you use the `description` variable in an attribute and collection, it'll add that description to the generated schemas. This assumes you have `zod-to-openpi`
|
|
92
|
+
- 0.0.275: THINGS ARE NOW IN TYPESCRIPT WOOHOO. No but for reaal, super happy to report that everything has been converted to TypeScript, just way too many changes, I hope you enjoy it!
|
|
93
|
+
- 0.0.274: Small improvement for attribute handling, rather than getting it every attribute, I check the collections attributes
|
|
94
|
+
- 0.0.273: Small fix for relationship attribute comparisons
|
|
95
|
+
- 0.0.272: That's what I get for not testing lmao, also updated logic for checking for existing attributes to take the `format` into consideration from the database (URL's are not of `type: "url"`, they are of `format: "url"`)
|
|
96
|
+
- 0.0.271: Small change to update attributes that are different from each other by deleting the attribute and recreating, as we cannot update most things
|
|
97
|
+
- 0.0.270: Fixed enums in `--sync`, added optional OpenAPI generation (in progress, almost done, but wanted to push other changes), added `--endpoint`, `--project`, `--key` as optional parameters to change the target destination (shoutout to [pingu24k](https://github.com/pingu2k4) for pointing out these bugs and suggesting those changes for endpoint customization)
|
|
98
|
+
- 0.0.254: Added `--sync` to synchronize your Appwrite instance with your local `appwriteConfig.yaml` and generate schemas
|
|
99
|
+
- 0.0.253: Added `--writeData` (or `--write-data`) to command to write the output of the import data to a file called dataLoaderOutput in your root dir
|
|
100
|
+
- 0.0.23: Added batching to user deletion
|
|
101
|
+
- 0.0.22: Converted all import processes except `postImportActions` and Relationship Resolution to the local data import, so it should be much faster.
|
|
102
|
+
- 0.0.6: Added `setTargetFieldFromOtherCollectionDocumentsByMatchingField` for the below, but setting a different field than the field you matched. The names are long, but at least you know what's going on lmao.
|
|
103
|
+
- 0.0.5: Added `setFieldFromOtherCollectionDocuments` to set an array of ID's for instance from another collection as a `postImportAction`
|
|
@@ -316,6 +316,7 @@ export declare const getMigrationCollectionSchemas: () => {
|
|
|
316
316
|
targetField: string;
|
|
317
317
|
targetCollection: string;
|
|
318
318
|
fieldToSet?: string | undefined;
|
|
319
|
+
targetFieldToMatch?: string | undefined;
|
|
319
320
|
}[] | undefined;
|
|
320
321
|
updateMapping?: {
|
|
321
322
|
targetField: string;
|
|
@@ -568,6 +569,7 @@ export declare const getMigrationCollectionSchemas: () => {
|
|
|
568
569
|
targetField: string;
|
|
569
570
|
targetCollection: string;
|
|
570
571
|
fieldToSet?: string | undefined;
|
|
572
|
+
targetFieldToMatch?: string | undefined;
|
|
571
573
|
}[] | undefined;
|
|
572
574
|
updateMapping?: {
|
|
573
575
|
targetField: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImportDataActions } from "./importDataActions.js";
|
|
2
|
-
import { type AppwriteConfig, type AttributeMappings, type CollectionCreate, type ConfigDatabase, type
|
|
2
|
+
import { type AppwriteConfig, type AttributeMappings, type CollectionCreate, type ConfigDatabase, type ImportDef } from "appwrite-utils";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { type Databases } from "node-appwrite";
|
|
5
5
|
export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
@@ -61,6 +61,14 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
61
61
|
required: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
62
62
|
array: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
63
63
|
min: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
/**
|
|
65
|
+
* Prepares the data for creating documents in a collection.
|
|
66
|
+
* This involves loading the data, transforming it, and handling ID mappings.
|
|
67
|
+
*
|
|
68
|
+
* @param db - The database configuration.
|
|
69
|
+
* @param collection - The collection configuration.
|
|
70
|
+
* @param importDef - The import definition containing the attribute mappings and other relevant info.
|
|
71
|
+
*/
|
|
64
72
|
max: z.ZodOptional<z.ZodNumber>;
|
|
65
73
|
xdefault: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
66
74
|
description: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
|
|
@@ -359,10 +367,21 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
359
367
|
type: z.ZodOptional<z.ZodDefault<z.ZodEnum<["create", "update"]>>>;
|
|
360
368
|
filePath: z.ZodString;
|
|
361
369
|
basePath: z.ZodOptional<z.ZodString>;
|
|
370
|
+
/**
|
|
371
|
+
* Generates attribute mappings with post-import actions based on the provided attribute mappings.
|
|
372
|
+
* This method checks each mapping for a fileData attribute and adds a post-import action to create a file
|
|
373
|
+
* and update the field with the file's ID if necessary.
|
|
374
|
+
*
|
|
375
|
+
* @param attributeMappings - The attribute mappings from the import definition.
|
|
376
|
+
* @param context - The context object containing information about the database, collection, and document.
|
|
377
|
+
* @param item - The item being imported, used for resolving template paths in fileData mappings.
|
|
378
|
+
* @returns The attribute mappings updated with any necessary post-import actions.
|
|
379
|
+
*/
|
|
362
380
|
primaryKeyField: z.ZodDefault<z.ZodString>;
|
|
363
381
|
idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
364
382
|
sourceField: z.ZodString;
|
|
365
383
|
fieldToSet: z.ZodOptional<z.ZodString>;
|
|
384
|
+
targetFieldToMatch: z.ZodOptional<z.ZodString>;
|
|
366
385
|
targetField: z.ZodString;
|
|
367
386
|
targetCollection: z.ZodString;
|
|
368
387
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -370,11 +389,13 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
370
389
|
targetField: string;
|
|
371
390
|
targetCollection: string;
|
|
372
391
|
fieldToSet?: string | undefined;
|
|
392
|
+
targetFieldToMatch?: string | undefined;
|
|
373
393
|
}, {
|
|
374
394
|
sourceField: string;
|
|
375
395
|
targetField: string;
|
|
376
396
|
targetCollection: string;
|
|
377
397
|
fieldToSet?: string | undefined;
|
|
398
|
+
targetFieldToMatch?: string | undefined;
|
|
378
399
|
}>, "many">>;
|
|
379
400
|
updateMapping: z.ZodOptional<z.ZodObject<{
|
|
380
401
|
originalIdField: z.ZodString;
|
|
@@ -484,6 +505,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
484
505
|
targetField: string;
|
|
485
506
|
targetCollection: string;
|
|
486
507
|
fieldToSet?: string | undefined;
|
|
508
|
+
targetFieldToMatch?: string | undefined;
|
|
487
509
|
}[] | undefined;
|
|
488
510
|
updateMapping?: {
|
|
489
511
|
targetField: string;
|
|
@@ -517,6 +539,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
517
539
|
targetField: string;
|
|
518
540
|
targetCollection: string;
|
|
519
541
|
fieldToSet?: string | undefined;
|
|
542
|
+
targetFieldToMatch?: string | undefined;
|
|
520
543
|
}[] | undefined;
|
|
521
544
|
updateMapping?: {
|
|
522
545
|
targetField: string;
|
|
@@ -665,6 +688,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
665
688
|
targetField: string;
|
|
666
689
|
targetCollection: string;
|
|
667
690
|
fieldToSet?: string | undefined;
|
|
691
|
+
targetFieldToMatch?: string | undefined;
|
|
668
692
|
}[] | undefined;
|
|
669
693
|
updateMapping?: {
|
|
670
694
|
targetField: string;
|
|
@@ -819,6 +843,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
819
843
|
targetField: string;
|
|
820
844
|
targetCollection: string;
|
|
821
845
|
fieldToSet?: string | undefined;
|
|
846
|
+
targetFieldToMatch?: string | undefined;
|
|
822
847
|
}[] | undefined;
|
|
823
848
|
updateMapping?: {
|
|
824
849
|
targetField: string;
|
|
@@ -839,6 +864,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
839
864
|
idMappings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
840
865
|
sourceField: z.ZodString;
|
|
841
866
|
fieldToSet: z.ZodOptional<z.ZodString>;
|
|
867
|
+
targetFieldToMatch: z.ZodOptional<z.ZodString>;
|
|
842
868
|
targetField: z.ZodString;
|
|
843
869
|
targetCollection: z.ZodString;
|
|
844
870
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -846,11 +872,13 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
846
872
|
targetField: string;
|
|
847
873
|
targetCollection: string;
|
|
848
874
|
fieldToSet?: string | undefined;
|
|
875
|
+
targetFieldToMatch?: string | undefined;
|
|
849
876
|
}, {
|
|
850
877
|
sourceField: string;
|
|
851
878
|
targetField: string;
|
|
852
879
|
targetCollection: string;
|
|
853
880
|
fieldToSet?: string | undefined;
|
|
881
|
+
targetFieldToMatch?: string | undefined;
|
|
854
882
|
}>, "many">>;
|
|
855
883
|
updateMapping: z.ZodOptional<z.ZodObject<{
|
|
856
884
|
originalIdField: z.ZodString;
|
|
@@ -960,6 +988,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
960
988
|
targetField: string;
|
|
961
989
|
targetCollection: string;
|
|
962
990
|
fieldToSet?: string | undefined;
|
|
991
|
+
targetFieldToMatch?: string | undefined;
|
|
963
992
|
}[] | undefined;
|
|
964
993
|
updateMapping?: {
|
|
965
994
|
targetField: string;
|
|
@@ -993,6 +1022,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
993
1022
|
targetField: string;
|
|
994
1023
|
targetCollection: string;
|
|
995
1024
|
fieldToSet?: string | undefined;
|
|
1025
|
+
targetFieldToMatch?: string | undefined;
|
|
996
1026
|
}[] | undefined;
|
|
997
1027
|
updateMapping?: {
|
|
998
1028
|
targetField: string;
|
|
@@ -1031,6 +1061,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
1031
1061
|
targetField: string;
|
|
1032
1062
|
targetCollection: string;
|
|
1033
1063
|
fieldToSet?: string | undefined;
|
|
1064
|
+
targetFieldToMatch?: string | undefined;
|
|
1034
1065
|
}[] | undefined;
|
|
1035
1066
|
updateMapping?: {
|
|
1036
1067
|
targetField: string;
|
|
@@ -1069,6 +1100,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
1069
1100
|
targetField: string;
|
|
1070
1101
|
targetCollection: string;
|
|
1071
1102
|
fieldToSet?: string | undefined;
|
|
1103
|
+
targetFieldToMatch?: string | undefined;
|
|
1072
1104
|
}[] | undefined;
|
|
1073
1105
|
updateMapping?: {
|
|
1074
1106
|
targetField: string;
|
|
@@ -1109,6 +1141,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
1109
1141
|
targetField: string;
|
|
1110
1142
|
targetCollection: string;
|
|
1111
1143
|
fieldToSet?: string | undefined;
|
|
1144
|
+
targetFieldToMatch?: string | undefined;
|
|
1112
1145
|
}[] | undefined;
|
|
1113
1146
|
updateMapping?: {
|
|
1114
1147
|
targetField: string;
|
|
@@ -1257,6 +1290,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
1257
1290
|
targetField: string;
|
|
1258
1291
|
targetCollection: string;
|
|
1259
1292
|
fieldToSet?: string | undefined;
|
|
1293
|
+
targetFieldToMatch?: string | undefined;
|
|
1260
1294
|
}[] | undefined;
|
|
1261
1295
|
updateMapping?: {
|
|
1262
1296
|
targetField: string;
|
|
@@ -1301,6 +1335,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
1301
1335
|
targetField: string;
|
|
1302
1336
|
targetCollection: string;
|
|
1303
1337
|
fieldToSet?: string | undefined;
|
|
1338
|
+
targetFieldToMatch?: string | undefined;
|
|
1304
1339
|
}[] | undefined;
|
|
1305
1340
|
updateMapping?: {
|
|
1306
1341
|
targetField: string;
|
|
@@ -1452,6 +1487,7 @@ export declare const CollectionImportDataSchema: z.ZodObject<{
|
|
|
1452
1487
|
targetField: string;
|
|
1453
1488
|
targetCollection: string;
|
|
1454
1489
|
fieldToSet?: string | undefined;
|
|
1490
|
+
targetFieldToMatch?: string | undefined;
|
|
1455
1491
|
}[] | undefined;
|
|
1456
1492
|
updateMapping?: {
|
|
1457
1493
|
targetField: string;
|
|
@@ -1501,6 +1537,7 @@ export declare class DataLoader {
|
|
|
1501
1537
|
targetField: string;
|
|
1502
1538
|
targetCollection: string;
|
|
1503
1539
|
fieldToSet?: string | undefined;
|
|
1540
|
+
targetFieldToMatch?: string | undefined;
|
|
1504
1541
|
}[] | undefined;
|
|
1505
1542
|
updateMapping?: {
|
|
1506
1543
|
targetField: string;
|
|
@@ -1649,6 +1686,7 @@ export declare class DataLoader {
|
|
|
1649
1686
|
targetField: string;
|
|
1650
1687
|
targetCollection: string;
|
|
1651
1688
|
fieldToSet?: string | undefined;
|
|
1689
|
+
targetFieldToMatch?: string | undefined;
|
|
1652
1690
|
}[] | undefined;
|
|
1653
1691
|
updateMapping?: {
|
|
1654
1692
|
targetField: string;
|
|
@@ -1697,10 +1735,8 @@ export declare class DataLoader {
|
|
|
1697
1735
|
setupMaps(dbId: string): Promise<void>;
|
|
1698
1736
|
getAllUsers(): Promise<import("node-appwrite").Models.User<import("node-appwrite").Models.Preferences>[]>;
|
|
1699
1737
|
start(dbId: string): Promise<void>;
|
|
1700
|
-
dealWithMergedUsers():
|
|
1738
|
+
dealWithMergedUsers(): void;
|
|
1701
1739
|
updateOldReferencesForNew(): Promise<void>;
|
|
1702
|
-
updateReferencesInRelatedCollections(): Promise<void>;
|
|
1703
|
-
findNewIdForOldId(oldId: string, idMapping: IdMapping, importDef: ImportDef): any;
|
|
1704
1740
|
private writeMapsToJsonFile;
|
|
1705
1741
|
/**
|
|
1706
1742
|
* Prepares user data by checking for duplicates based on email or phone, adding to a duplicate map if found,
|