appwrite-utils-cli 0.9.88 → 0.9.90
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 +1 -0
- package/dist/appwrite/appwriteConfig.d.ts +3 -0
- package/dist/appwrite/appwriteConfig.js +40 -0
- package/dist/appwrite/collections/Album.d.ts +3 -0
- package/dist/appwrite/collections/Album.js +58 -0
- package/dist/appwrite/collections/Artist.d.ts +3 -0
- package/dist/appwrite/collections/Artist.js +65 -0
- package/dist/appwrite/collections/Genre.d.ts +3 -0
- package/dist/appwrite/collections/Genre.js +33 -0
- package/dist/appwrite/collections/Playlist.d.ts +3 -0
- package/dist/appwrite/collections/Playlist.js +55 -0
- package/dist/appwrite/collections/Song.d.ts +3 -0
- package/dist/appwrite/collections/Song.js +88 -0
- package/dist/appwrite/collections/UserActivity.d.ts +3 -0
- package/dist/appwrite/collections/UserActivity.js +51 -0
- package/dist/appwrite/collections/UserData.d.ts +3 -0
- package/dist/appwrite/collections/UserData.js +33 -0
- package/dist/appwrite/schemas/album.d.ts +32 -0
- package/dist/appwrite/schemas/album.js +12 -0
- package/dist/appwrite/schemas/artist.d.ts +35 -0
- package/dist/appwrite/schemas/artist.js +13 -0
- package/dist/appwrite/schemas/genre.d.ts +23 -0
- package/dist/appwrite/schemas/genre.js +9 -0
- package/dist/appwrite/schemas/playlist.d.ts +32 -0
- package/dist/appwrite/schemas/playlist.js +12 -0
- package/dist/appwrite/schemas/song.d.ts +47 -0
- package/dist/appwrite/schemas/song.js +17 -0
- package/dist/appwrite/schemas/userActivity.d.ts +29 -0
- package/dist/appwrite/schemas/userActivity.js +11 -0
- package/dist/appwrite/schemas/userData.d.ts +23 -0
- package/dist/appwrite/schemas/userData.js +9 -0
- package/dist/interactiveCLI.js +2 -0
- package/dist/utils/loadConfigs.js +8 -2
- package/package.json +1 -1
- package/src/interactiveCLI.ts +3 -1
- package/src/utils/loadConfigs.ts +8 -2
- package/tsconfig.json +1 -1
package/README.md
CHANGED
@@ -125,6 +125,7 @@ This updated CLI ensures that developers have robust tools at their fingertips t
|
|
125
125
|
|
126
126
|
## Changelog
|
127
127
|
|
128
|
+
- 0.9.90: Fixed Webpack errors (why tf does webpack add an extra `default`...???)
|
128
129
|
- 0.9.80: Fixed collections not being unique between local and remote
|
129
130
|
- 0.9.79: Fixed local collections not being considered for the synchronization unless all de-selected
|
130
131
|
- 0.9.78: Added colored text! And also added a lot more customization options as to what to wipe, update, etc.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import {} from "appwrite-utils";
|
2
|
+
const appwriteConfig = {
|
3
|
+
appwriteEndpoint: "https://appwrite.blackleafdigital.com/v1",
|
4
|
+
appwriteProject: "6717441100056a90bb20",
|
5
|
+
appwriteKey: "standard_f8664be4666240926caa1a2ed15a87424948036e3fd47b8d99a3de0cad83cdea7309ae30d004a3edd44c45292605f4a6b9c654aa44924a7cc5e3e95a77e0c9513d9c29a9059b7cf4fdafe626b67147d26de78390f946aeca22328f7ebdcdad159a644eb7589cacecdf4e397bd51362230cd319544a804db62d8edb968de1392a",
|
6
|
+
enableBackups: true,
|
7
|
+
backupInterval: 3600,
|
8
|
+
backupRetention: 30,
|
9
|
+
enableBackupCleanup: true,
|
10
|
+
enableMockData: false,
|
11
|
+
documentBucketId: "documents",
|
12
|
+
usersCollectionName: "Members",
|
13
|
+
databases: [
|
14
|
+
{
|
15
|
+
$id: "main",
|
16
|
+
name: "Main",
|
17
|
+
bucket: {
|
18
|
+
$id: "main_bucket",
|
19
|
+
name: "Main Bucket",
|
20
|
+
enabled: true,
|
21
|
+
maximumFileSize: 30000000,
|
22
|
+
allowedFileExtensions: [],
|
23
|
+
encryption: true,
|
24
|
+
antivirus: true
|
25
|
+
}
|
26
|
+
},
|
27
|
+
],
|
28
|
+
buckets: [
|
29
|
+
{
|
30
|
+
$id: "global_bucket",
|
31
|
+
name: "Global Bucket",
|
32
|
+
enabled: true,
|
33
|
+
maximumFileSize: 30000000,
|
34
|
+
allowedFileExtensions: [],
|
35
|
+
encryption: true,
|
36
|
+
antivirus: true
|
37
|
+
}
|
38
|
+
]
|
39
|
+
};
|
40
|
+
export default appwriteConfig;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
const Album = {
|
2
|
+
$id: '01JASDQZ5TXZZ1Z9EVR5PKC10G',
|
3
|
+
documentSecurity: false,
|
4
|
+
enabled: true,
|
5
|
+
name: 'Album',
|
6
|
+
$permissions: [
|
7
|
+
{ permission: 'read', target: 'any' },
|
8
|
+
{ permission: 'create', target: 'users' },
|
9
|
+
{ permission: 'update', target: 'users' },
|
10
|
+
{ permission: 'delete', target: 'users' }
|
11
|
+
],
|
12
|
+
attributes: [
|
13
|
+
{
|
14
|
+
key: 'title',
|
15
|
+
type: 'string',
|
16
|
+
size: 256,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
key: 'artistId',
|
21
|
+
type: 'string',
|
22
|
+
size: 36,
|
23
|
+
required: true,
|
24
|
+
},
|
25
|
+
{
|
26
|
+
key: 'releaseDate',
|
27
|
+
type: 'float',
|
28
|
+
min: 0,
|
29
|
+
required: true,
|
30
|
+
},
|
31
|
+
{
|
32
|
+
key: 'coverArtId',
|
33
|
+
type: 'string',
|
34
|
+
size: 36,
|
35
|
+
required: false,
|
36
|
+
},
|
37
|
+
{
|
38
|
+
key: 'genreIds',
|
39
|
+
type: 'string',
|
40
|
+
size: 36,
|
41
|
+
array: true,
|
42
|
+
required: false,
|
43
|
+
},
|
44
|
+
],
|
45
|
+
indexes: [
|
46
|
+
{
|
47
|
+
key: 'title',
|
48
|
+
type: 'fulltext',
|
49
|
+
attributes: ['title'],
|
50
|
+
},
|
51
|
+
{
|
52
|
+
key: 'artistId',
|
53
|
+
type: 'key',
|
54
|
+
attributes: ['artistId'],
|
55
|
+
},
|
56
|
+
],
|
57
|
+
};
|
58
|
+
export default Album;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
const Artist = {
|
2
|
+
$id: '01JASCJ8AZ9V1Y5758ZXCWEA8Q',
|
3
|
+
documentSecurity: false,
|
4
|
+
enabled: true,
|
5
|
+
name: 'Artist',
|
6
|
+
$permissions: [
|
7
|
+
{ permission: 'read', target: 'any' },
|
8
|
+
{ permission: 'create', target: 'users' },
|
9
|
+
{ permission: 'update', target: 'users' },
|
10
|
+
{ permission: 'delete', target: 'users' }
|
11
|
+
],
|
12
|
+
attributes: [
|
13
|
+
{
|
14
|
+
key: 'name',
|
15
|
+
type: 'string',
|
16
|
+
size: 256,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
key: 'bio',
|
21
|
+
type: 'string',
|
22
|
+
size: 1024,
|
23
|
+
required: false,
|
24
|
+
},
|
25
|
+
{
|
26
|
+
key: 'genreIds',
|
27
|
+
type: 'string',
|
28
|
+
size: 36,
|
29
|
+
array: true,
|
30
|
+
required: false,
|
31
|
+
},
|
32
|
+
{
|
33
|
+
key: 'profileImageId',
|
34
|
+
type: 'string',
|
35
|
+
size: 36,
|
36
|
+
required: false,
|
37
|
+
},
|
38
|
+
{
|
39
|
+
key: 'socialLinks',
|
40
|
+
type: 'string',
|
41
|
+
size: 256,
|
42
|
+
array: true,
|
43
|
+
required: false,
|
44
|
+
},
|
45
|
+
{
|
46
|
+
key: 'userId',
|
47
|
+
type: 'string',
|
48
|
+
size: 36,
|
49
|
+
required: true,
|
50
|
+
},
|
51
|
+
],
|
52
|
+
indexes: [
|
53
|
+
{
|
54
|
+
key: 'name',
|
55
|
+
type: 'fulltext',
|
56
|
+
attributes: ['name'],
|
57
|
+
},
|
58
|
+
{
|
59
|
+
key: 'userId',
|
60
|
+
type: 'key',
|
61
|
+
attributes: ['userId'],
|
62
|
+
},
|
63
|
+
],
|
64
|
+
};
|
65
|
+
export default Artist;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
const Genre = {
|
2
|
+
$id: '01JASDXQDKAPCQBDW3NR5D9SBX',
|
3
|
+
documentSecurity: false,
|
4
|
+
enabled: true,
|
5
|
+
name: 'Genre',
|
6
|
+
$permissions: [
|
7
|
+
{ permission: 'read', target: 'any' },
|
8
|
+
{ permission: 'create', target: 'users' },
|
9
|
+
{ permission: 'update', target: 'users' },
|
10
|
+
{ permission: 'delete', target: 'users' }
|
11
|
+
],
|
12
|
+
attributes: [
|
13
|
+
{
|
14
|
+
key: 'name',
|
15
|
+
type: 'string',
|
16
|
+
size: 64,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
key: 'description',
|
21
|
+
type: 'string',
|
22
|
+
size: 256,
|
23
|
+
},
|
24
|
+
],
|
25
|
+
indexes: [
|
26
|
+
{
|
27
|
+
key: 'name',
|
28
|
+
type: 'fulltext',
|
29
|
+
attributes: ['name'],
|
30
|
+
},
|
31
|
+
],
|
32
|
+
};
|
33
|
+
export default Genre;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
const Playlist = {
|
2
|
+
$id: '01JASDR2H46MJQJZNS65T9B138',
|
3
|
+
documentSecurity: false,
|
4
|
+
enabled: true,
|
5
|
+
name: 'Playlist',
|
6
|
+
$permissions: [
|
7
|
+
{ permission: 'read', target: 'any' },
|
8
|
+
{ permission: 'create', target: 'users' },
|
9
|
+
{ permission: 'update', target: 'users' },
|
10
|
+
{ permission: 'delete', target: 'users' }
|
11
|
+
],
|
12
|
+
attributes: [
|
13
|
+
{
|
14
|
+
key: 'name',
|
15
|
+
type: 'string',
|
16
|
+
size: 256,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
key: 'userId',
|
21
|
+
type: 'string',
|
22
|
+
size: 36,
|
23
|
+
required: true,
|
24
|
+
},
|
25
|
+
{
|
26
|
+
key: 'description',
|
27
|
+
type: 'string',
|
28
|
+
size: 1024,
|
29
|
+
},
|
30
|
+
{
|
31
|
+
key: 'isPublic',
|
32
|
+
type: 'boolean',
|
33
|
+
required: true,
|
34
|
+
},
|
35
|
+
{
|
36
|
+
key: 'songIds',
|
37
|
+
type: 'string',
|
38
|
+
size: 36,
|
39
|
+
array: true,
|
40
|
+
},
|
41
|
+
],
|
42
|
+
indexes: [
|
43
|
+
{
|
44
|
+
key: 'name',
|
45
|
+
type: 'fulltext',
|
46
|
+
attributes: ['name'],
|
47
|
+
},
|
48
|
+
{
|
49
|
+
key: 'userId',
|
50
|
+
type: 'key',
|
51
|
+
attributes: ['userId'],
|
52
|
+
},
|
53
|
+
],
|
54
|
+
};
|
55
|
+
export default Playlist;
|
@@ -0,0 +1,88 @@
|
|
1
|
+
const Song = {
|
2
|
+
$id: '01JASCJBWTMDS9K742CKDYD7S3',
|
3
|
+
documentSecurity: false,
|
4
|
+
enabled: true,
|
5
|
+
name: 'Song',
|
6
|
+
$permissions: [
|
7
|
+
{ permission: 'read', target: 'any' },
|
8
|
+
{ permission: 'create', target: 'users' },
|
9
|
+
{ permission: 'update', target: 'users' },
|
10
|
+
{ permission: 'delete', target: 'users' }
|
11
|
+
],
|
12
|
+
attributes: [
|
13
|
+
{
|
14
|
+
key: 'title',
|
15
|
+
type: 'string',
|
16
|
+
size: 256,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
key: 'artistId',
|
21
|
+
type: 'string',
|
22
|
+
size: 36,
|
23
|
+
required: true,
|
24
|
+
},
|
25
|
+
{
|
26
|
+
key: 'featuredArtistIds',
|
27
|
+
type: 'string',
|
28
|
+
size: 36,
|
29
|
+
array: true,
|
30
|
+
},
|
31
|
+
{
|
32
|
+
key: 'albumId',
|
33
|
+
type: 'string',
|
34
|
+
size: 36,
|
35
|
+
},
|
36
|
+
{
|
37
|
+
key: 'duration',
|
38
|
+
type: 'float',
|
39
|
+
min: 0,
|
40
|
+
required: true,
|
41
|
+
},
|
42
|
+
{
|
43
|
+
key: 'genre',
|
44
|
+
type: 'string',
|
45
|
+
size: 64,
|
46
|
+
},
|
47
|
+
{
|
48
|
+
key: 'releaseDate',
|
49
|
+
type: 'float',
|
50
|
+
min: 0,
|
51
|
+
required: true,
|
52
|
+
},
|
53
|
+
{
|
54
|
+
key: 'audioFileId',
|
55
|
+
type: 'string',
|
56
|
+
size: 36,
|
57
|
+
required: true,
|
58
|
+
},
|
59
|
+
{
|
60
|
+
key: 'coverArtId',
|
61
|
+
type: 'string',
|
62
|
+
size: 36,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
key: 'lyrics',
|
66
|
+
type: 'string',
|
67
|
+
size: 100000,
|
68
|
+
},
|
69
|
+
],
|
70
|
+
indexes: [
|
71
|
+
{
|
72
|
+
key: 'title',
|
73
|
+
type: 'fulltext',
|
74
|
+
attributes: ['title'],
|
75
|
+
},
|
76
|
+
{
|
77
|
+
key: 'artistId',
|
78
|
+
type: 'key',
|
79
|
+
attributes: ['artistId'],
|
80
|
+
},
|
81
|
+
{
|
82
|
+
key: 'albumId',
|
83
|
+
type: 'key',
|
84
|
+
attributes: ['albumId'],
|
85
|
+
},
|
86
|
+
],
|
87
|
+
};
|
88
|
+
export default Song;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
const UserActivity = {
|
2
|
+
$id: '01JASDSEY956GTW8K4JWRV10G8',
|
3
|
+
documentSecurity: false,
|
4
|
+
enabled: true,
|
5
|
+
name: 'UserActivity',
|
6
|
+
$permissions: [
|
7
|
+
{ permission: 'read', target: 'users' },
|
8
|
+
{ permission: 'create', target: 'users' },
|
9
|
+
{ permission: 'update', target: 'users' },
|
10
|
+
{ permission: 'delete', target: 'users' }
|
11
|
+
],
|
12
|
+
attributes: [
|
13
|
+
{
|
14
|
+
key: 'userId',
|
15
|
+
type: 'string',
|
16
|
+
size: 36,
|
17
|
+
required: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
key: 'activityType',
|
21
|
+
type: 'string',
|
22
|
+
size: 64,
|
23
|
+
required: true,
|
24
|
+
},
|
25
|
+
{
|
26
|
+
key: 'targetId',
|
27
|
+
type: 'string',
|
28
|
+
size: 36,
|
29
|
+
required: true,
|
30
|
+
},
|
31
|
+
{
|
32
|
+
key: 'timestamp',
|
33
|
+
type: 'float',
|
34
|
+
min: 0,
|
35
|
+
required: true,
|
36
|
+
},
|
37
|
+
],
|
38
|
+
indexes: [
|
39
|
+
{
|
40
|
+
key: 'userId',
|
41
|
+
type: 'key',
|
42
|
+
attributes: ['userId'],
|
43
|
+
},
|
44
|
+
{
|
45
|
+
key: 'activityType',
|
46
|
+
type: 'key',
|
47
|
+
attributes: ['activityType'],
|
48
|
+
},
|
49
|
+
],
|
50
|
+
};
|
51
|
+
export default UserActivity;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
const UserData = {
|
2
|
+
$id: '01JASCH88CF1CVXBXY488WFF2Z',
|
3
|
+
documentSecurity: false,
|
4
|
+
enabled: true,
|
5
|
+
name: 'UserData',
|
6
|
+
$permissions: [
|
7
|
+
{ permission: 'read', target: 'any' },
|
8
|
+
{ permission: 'create', target: 'any' },
|
9
|
+
{ permission: 'update', target: 'label:admin' },
|
10
|
+
{ permission: 'delete', target: 'label:admin' }
|
11
|
+
],
|
12
|
+
attributes: [
|
13
|
+
{
|
14
|
+
key: 'address',
|
15
|
+
type: 'string',
|
16
|
+
size: 256,
|
17
|
+
required: true
|
18
|
+
},
|
19
|
+
{
|
20
|
+
key: 'bio',
|
21
|
+
type: 'string',
|
22
|
+
size: 1024,
|
23
|
+
}
|
24
|
+
],
|
25
|
+
indexes: [
|
26
|
+
{
|
27
|
+
key: 'UniqueAddress',
|
28
|
+
type: 'unique',
|
29
|
+
attributes: ['address']
|
30
|
+
}
|
31
|
+
],
|
32
|
+
};
|
33
|
+
export default UserData;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const AlbumSchemaBase: z.ZodObject<{
|
3
|
+
$id: z.ZodOptional<z.ZodString>;
|
4
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
5
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
6
|
+
title: z.ZodString;
|
7
|
+
artistId: z.ZodString;
|
8
|
+
releaseDate: z.ZodNumber;
|
9
|
+
coverArtId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
10
|
+
genreIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
12
|
+
title: string;
|
13
|
+
artistId: string;
|
14
|
+
releaseDate: number;
|
15
|
+
$id?: string | undefined;
|
16
|
+
$createdAt?: string | undefined;
|
17
|
+
$updatedAt?: string | undefined;
|
18
|
+
coverArtId?: string | null | undefined;
|
19
|
+
genreIds?: string[] | null | undefined;
|
20
|
+
}, {
|
21
|
+
title: string;
|
22
|
+
artistId: string;
|
23
|
+
releaseDate: number;
|
24
|
+
$id?: string | undefined;
|
25
|
+
$createdAt?: string | undefined;
|
26
|
+
$updatedAt?: string | undefined;
|
27
|
+
coverArtId?: string | null | undefined;
|
28
|
+
genreIds?: string[] | null | undefined;
|
29
|
+
}>;
|
30
|
+
export type AlbumBase = z.infer<typeof AlbumSchemaBase>;
|
31
|
+
export declare const AlbumSchema: z.ZodType<AlbumBase>;
|
32
|
+
export type Album = z.infer<typeof AlbumSchema>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const AlbumSchemaBase = z.object({
|
3
|
+
$id: z.string().optional(),
|
4
|
+
$createdAt: z.string().optional(),
|
5
|
+
$updatedAt: z.string().optional(),
|
6
|
+
title: z.string().max(256, "Maximum length of 256 characters exceeded"),
|
7
|
+
artistId: z.string().max(36, "Maximum length of 36 characters exceeded"),
|
8
|
+
releaseDate: z.number().min(0, "Minimum value of 0 not met"),
|
9
|
+
coverArtId: z.string().max(36, "Maximum length of 36 characters exceeded").nullish(),
|
10
|
+
genreIds: z.array(z.string().max(36, "Maximum length of 36 characters exceeded")).nullish(),
|
11
|
+
});
|
12
|
+
export const AlbumSchema = AlbumSchemaBase;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const ArtistSchemaBase: z.ZodObject<{
|
3
|
+
$id: z.ZodOptional<z.ZodString>;
|
4
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
5
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
6
|
+
name: z.ZodString;
|
7
|
+
bio: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
8
|
+
genreIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
9
|
+
profileImageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
10
|
+
socialLinks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
11
|
+
userId: z.ZodString;
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
13
|
+
name: string;
|
14
|
+
userId: string;
|
15
|
+
$id?: string | undefined;
|
16
|
+
$createdAt?: string | undefined;
|
17
|
+
$updatedAt?: string | undefined;
|
18
|
+
genreIds?: string[] | null | undefined;
|
19
|
+
bio?: string | null | undefined;
|
20
|
+
profileImageId?: string | null | undefined;
|
21
|
+
socialLinks?: string[] | null | undefined;
|
22
|
+
}, {
|
23
|
+
name: string;
|
24
|
+
userId: string;
|
25
|
+
$id?: string | undefined;
|
26
|
+
$createdAt?: string | undefined;
|
27
|
+
$updatedAt?: string | undefined;
|
28
|
+
genreIds?: string[] | null | undefined;
|
29
|
+
bio?: string | null | undefined;
|
30
|
+
profileImageId?: string | null | undefined;
|
31
|
+
socialLinks?: string[] | null | undefined;
|
32
|
+
}>;
|
33
|
+
export type ArtistBase = z.infer<typeof ArtistSchemaBase>;
|
34
|
+
export declare const ArtistSchema: z.ZodType<ArtistBase>;
|
35
|
+
export type Artist = z.infer<typeof ArtistSchema>;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const ArtistSchemaBase = z.object({
|
3
|
+
$id: z.string().optional(),
|
4
|
+
$createdAt: z.string().optional(),
|
5
|
+
$updatedAt: z.string().optional(),
|
6
|
+
name: z.string().max(256, "Maximum length of 256 characters exceeded"),
|
7
|
+
bio: z.string().max(1024, "Maximum length of 1024 characters exceeded").nullish(),
|
8
|
+
genreIds: z.array(z.string().max(36, "Maximum length of 36 characters exceeded")).nullish(),
|
9
|
+
profileImageId: z.string().max(36, "Maximum length of 36 characters exceeded").nullish(),
|
10
|
+
socialLinks: z.array(z.string().max(256, "Maximum length of 256 characters exceeded")).nullish(),
|
11
|
+
userId: z.string().max(36, "Maximum length of 36 characters exceeded"),
|
12
|
+
});
|
13
|
+
export const ArtistSchema = ArtistSchemaBase;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const GenreSchemaBase: z.ZodObject<{
|
3
|
+
$id: z.ZodOptional<z.ZodString>;
|
4
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
5
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
6
|
+
name: z.ZodString;
|
7
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
9
|
+
name: string;
|
10
|
+
$id?: string | undefined;
|
11
|
+
$createdAt?: string | undefined;
|
12
|
+
$updatedAt?: string | undefined;
|
13
|
+
description?: string | null | undefined;
|
14
|
+
}, {
|
15
|
+
name: string;
|
16
|
+
$id?: string | undefined;
|
17
|
+
$createdAt?: string | undefined;
|
18
|
+
$updatedAt?: string | undefined;
|
19
|
+
description?: string | null | undefined;
|
20
|
+
}>;
|
21
|
+
export type GenreBase = z.infer<typeof GenreSchemaBase>;
|
22
|
+
export declare const GenreSchema: z.ZodType<GenreBase>;
|
23
|
+
export type Genre = z.infer<typeof GenreSchema>;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const GenreSchemaBase = z.object({
|
3
|
+
$id: z.string().optional(),
|
4
|
+
$createdAt: z.string().optional(),
|
5
|
+
$updatedAt: z.string().optional(),
|
6
|
+
name: z.string().max(64, "Maximum length of 64 characters exceeded"),
|
7
|
+
description: z.string().max(256, "Maximum length of 256 characters exceeded").nullish(),
|
8
|
+
});
|
9
|
+
export const GenreSchema = GenreSchemaBase;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const PlaylistSchemaBase: z.ZodObject<{
|
3
|
+
$id: z.ZodOptional<z.ZodString>;
|
4
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
5
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
6
|
+
name: z.ZodString;
|
7
|
+
userId: z.ZodString;
|
8
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
9
|
+
isPublic: z.ZodBoolean;
|
10
|
+
songIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
12
|
+
name: string;
|
13
|
+
userId: string;
|
14
|
+
isPublic: boolean;
|
15
|
+
$id?: string | undefined;
|
16
|
+
$createdAt?: string | undefined;
|
17
|
+
$updatedAt?: string | undefined;
|
18
|
+
description?: string | null | undefined;
|
19
|
+
songIds?: string[] | null | undefined;
|
20
|
+
}, {
|
21
|
+
name: string;
|
22
|
+
userId: string;
|
23
|
+
isPublic: boolean;
|
24
|
+
$id?: string | undefined;
|
25
|
+
$createdAt?: string | undefined;
|
26
|
+
$updatedAt?: string | undefined;
|
27
|
+
description?: string | null | undefined;
|
28
|
+
songIds?: string[] | null | undefined;
|
29
|
+
}>;
|
30
|
+
export type PlaylistBase = z.infer<typeof PlaylistSchemaBase>;
|
31
|
+
export declare const PlaylistSchema: z.ZodType<PlaylistBase>;
|
32
|
+
export type Playlist = z.infer<typeof PlaylistSchema>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const PlaylistSchemaBase = z.object({
|
3
|
+
$id: z.string().optional(),
|
4
|
+
$createdAt: z.string().optional(),
|
5
|
+
$updatedAt: z.string().optional(),
|
6
|
+
name: z.string().max(256, "Maximum length of 256 characters exceeded"),
|
7
|
+
userId: z.string().max(36, "Maximum length of 36 characters exceeded"),
|
8
|
+
description: z.string().max(1024, "Maximum length of 1024 characters exceeded").nullish(),
|
9
|
+
isPublic: z.boolean(),
|
10
|
+
songIds: z.array(z.string().max(36, "Maximum length of 36 characters exceeded")).nullish(),
|
11
|
+
});
|
12
|
+
export const PlaylistSchema = PlaylistSchemaBase;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const SongSchemaBase: z.ZodObject<{
|
3
|
+
$id: z.ZodOptional<z.ZodString>;
|
4
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
5
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
6
|
+
title: z.ZodString;
|
7
|
+
artistId: z.ZodString;
|
8
|
+
featuredArtistIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
9
|
+
albumId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
10
|
+
duration: z.ZodNumber;
|
11
|
+
genre: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
12
|
+
releaseDate: z.ZodNumber;
|
13
|
+
audioFileId: z.ZodString;
|
14
|
+
coverArtId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
15
|
+
lyrics: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
17
|
+
title: string;
|
18
|
+
artistId: string;
|
19
|
+
releaseDate: number;
|
20
|
+
duration: number;
|
21
|
+
audioFileId: string;
|
22
|
+
$id?: string | undefined;
|
23
|
+
$createdAt?: string | undefined;
|
24
|
+
$updatedAt?: string | undefined;
|
25
|
+
coverArtId?: string | null | undefined;
|
26
|
+
featuredArtistIds?: string[] | null | undefined;
|
27
|
+
albumId?: string | null | undefined;
|
28
|
+
genre?: string | null | undefined;
|
29
|
+
lyrics?: string | null | undefined;
|
30
|
+
}, {
|
31
|
+
title: string;
|
32
|
+
artistId: string;
|
33
|
+
releaseDate: number;
|
34
|
+
duration: number;
|
35
|
+
audioFileId: string;
|
36
|
+
$id?: string | undefined;
|
37
|
+
$createdAt?: string | undefined;
|
38
|
+
$updatedAt?: string | undefined;
|
39
|
+
coverArtId?: string | null | undefined;
|
40
|
+
featuredArtistIds?: string[] | null | undefined;
|
41
|
+
albumId?: string | null | undefined;
|
42
|
+
genre?: string | null | undefined;
|
43
|
+
lyrics?: string | null | undefined;
|
44
|
+
}>;
|
45
|
+
export type SongBase = z.infer<typeof SongSchemaBase>;
|
46
|
+
export declare const SongSchema: z.ZodType<SongBase>;
|
47
|
+
export type Song = z.infer<typeof SongSchema>;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const SongSchemaBase = z.object({
|
3
|
+
$id: z.string().optional(),
|
4
|
+
$createdAt: z.string().optional(),
|
5
|
+
$updatedAt: z.string().optional(),
|
6
|
+
title: z.string().max(256, "Maximum length of 256 characters exceeded"),
|
7
|
+
artistId: z.string().max(36, "Maximum length of 36 characters exceeded"),
|
8
|
+
featuredArtistIds: z.array(z.string().max(36, "Maximum length of 36 characters exceeded")).nullish(),
|
9
|
+
albumId: z.string().max(36, "Maximum length of 36 characters exceeded").nullish(),
|
10
|
+
duration: z.number().min(0, "Minimum value of 0 not met"),
|
11
|
+
genre: z.string().max(64, "Maximum length of 64 characters exceeded").nullish(),
|
12
|
+
releaseDate: z.number().min(0, "Minimum value of 0 not met"),
|
13
|
+
audioFileId: z.string().max(36, "Maximum length of 36 characters exceeded"),
|
14
|
+
coverArtId: z.string().max(36, "Maximum length of 36 characters exceeded").nullish(),
|
15
|
+
lyrics: z.string().max(100000, "Maximum length of 100000 characters exceeded").nullish(),
|
16
|
+
});
|
17
|
+
export const SongSchema = SongSchemaBase;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const UserActivitySchemaBase: z.ZodObject<{
|
3
|
+
$id: z.ZodOptional<z.ZodString>;
|
4
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
5
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
6
|
+
userId: z.ZodString;
|
7
|
+
activityType: z.ZodString;
|
8
|
+
targetId: z.ZodString;
|
9
|
+
timestamp: z.ZodNumber;
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
11
|
+
userId: string;
|
12
|
+
activityType: string;
|
13
|
+
targetId: string;
|
14
|
+
timestamp: number;
|
15
|
+
$id?: string | undefined;
|
16
|
+
$createdAt?: string | undefined;
|
17
|
+
$updatedAt?: string | undefined;
|
18
|
+
}, {
|
19
|
+
userId: string;
|
20
|
+
activityType: string;
|
21
|
+
targetId: string;
|
22
|
+
timestamp: number;
|
23
|
+
$id?: string | undefined;
|
24
|
+
$createdAt?: string | undefined;
|
25
|
+
$updatedAt?: string | undefined;
|
26
|
+
}>;
|
27
|
+
export type UserActivityBase = z.infer<typeof UserActivitySchemaBase>;
|
28
|
+
export declare const UserActivitySchema: z.ZodType<UserActivityBase>;
|
29
|
+
export type UserActivity = z.infer<typeof UserActivitySchema>;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const UserActivitySchemaBase = z.object({
|
3
|
+
$id: z.string().optional(),
|
4
|
+
$createdAt: z.string().optional(),
|
5
|
+
$updatedAt: z.string().optional(),
|
6
|
+
userId: z.string().max(36, "Maximum length of 36 characters exceeded"),
|
7
|
+
activityType: z.string().max(64, "Maximum length of 64 characters exceeded"),
|
8
|
+
targetId: z.string().max(36, "Maximum length of 36 characters exceeded"),
|
9
|
+
timestamp: z.number().min(0, "Minimum value of 0 not met"),
|
10
|
+
});
|
11
|
+
export const UserActivitySchema = UserActivitySchemaBase;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export declare const UserDataSchemaBase: z.ZodObject<{
|
3
|
+
$id: z.ZodOptional<z.ZodString>;
|
4
|
+
$createdAt: z.ZodOptional<z.ZodString>;
|
5
|
+
$updatedAt: z.ZodOptional<z.ZodString>;
|
6
|
+
address: z.ZodString;
|
7
|
+
bio: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
9
|
+
address: string;
|
10
|
+
$id?: string | undefined;
|
11
|
+
$createdAt?: string | undefined;
|
12
|
+
$updatedAt?: string | undefined;
|
13
|
+
bio?: string | null | undefined;
|
14
|
+
}, {
|
15
|
+
address: string;
|
16
|
+
$id?: string | undefined;
|
17
|
+
$createdAt?: string | undefined;
|
18
|
+
$updatedAt?: string | undefined;
|
19
|
+
bio?: string | null | undefined;
|
20
|
+
}>;
|
21
|
+
export type UserDataBase = z.infer<typeof UserDataSchemaBase>;
|
22
|
+
export declare const UserDataSchema: z.ZodType<UserDataBase>;
|
23
|
+
export type UserData = z.infer<typeof UserDataSchema>;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { z } from "zod";
|
2
|
+
export const UserDataSchemaBase = z.object({
|
3
|
+
$id: z.string().optional(),
|
4
|
+
$createdAt: z.string().optional(),
|
5
|
+
$updatedAt: z.string().optional(),
|
6
|
+
address: z.string().max(256, "Maximum length of 256 characters exceeded"),
|
7
|
+
bio: z.string().max(1024, "Maximum length of 1024 characters exceeded").nullish(),
|
8
|
+
});
|
9
|
+
export const UserDataSchema = UserDataSchemaBase;
|
package/dist/interactiveCLI.js
CHANGED
@@ -104,6 +104,7 @@ export class InteractiveCLI {
|
|
104
104
|
}
|
105
105
|
}
|
106
106
|
async selectDatabases(databases, message, multiSelect = true) {
|
107
|
+
await this.initControllerIfNeeded();
|
107
108
|
const configDatabases = this.getLocalDatabases();
|
108
109
|
const allDatabases = [...databases, ...configDatabases].reduce((acc, db) => {
|
109
110
|
if (!acc.find(d => d.name === db.name)) {
|
@@ -128,6 +129,7 @@ export class InteractiveCLI {
|
|
128
129
|
return selectedDatabases;
|
129
130
|
}
|
130
131
|
async selectCollections(database, databasesClient, message, multiSelect = true) {
|
132
|
+
await this.initControllerIfNeeded();
|
131
133
|
const collections = await fetchAllCollections(database.$id, databasesClient);
|
132
134
|
const configCollections = this.getLocalCollections();
|
133
135
|
const collectionNames = collections.map((c) => c.name).concat(configCollections.map((c) => c.name));
|
@@ -41,10 +41,16 @@ export const loadConfig = async (configDir) => {
|
|
41
41
|
const collectionFiles = fs.readdirSync(collectionsDir);
|
42
42
|
config.collections = [];
|
43
43
|
for (const file of collectionFiles) {
|
44
|
+
if (file === "index.ts") {
|
45
|
+
continue;
|
46
|
+
}
|
44
47
|
const filePath = path.join(collectionsDir, file);
|
45
48
|
const fileUrl = pathToFileURL(filePath).href;
|
46
|
-
const collectionModule = (await import(fileUrl))
|
47
|
-
|
49
|
+
const collectionModule = (await import(fileUrl));
|
50
|
+
const collection = collectionModule.default?.default || collectionModule.default || collectionModule;
|
51
|
+
if (collection) {
|
52
|
+
config.collections.push(collection);
|
53
|
+
}
|
48
54
|
}
|
49
55
|
return config;
|
50
56
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "appwrite-utils-cli",
|
3
3
|
"description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
|
4
|
-
"version": "0.9.
|
4
|
+
"version": "0.9.90",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
package/src/interactiveCLI.ts
CHANGED
@@ -121,6 +121,7 @@ export class InteractiveCLI {
|
|
121
121
|
message: string,
|
122
122
|
multiSelect = true
|
123
123
|
): Promise<Models.Database[]> {
|
124
|
+
await this.initControllerIfNeeded();
|
124
125
|
const configDatabases = this.getLocalDatabases();
|
125
126
|
const allDatabases = [...databases, ...configDatabases].reduce((acc, db) => {
|
126
127
|
if (!acc.find(d => d.name === db.name)) {
|
@@ -152,8 +153,9 @@ export class InteractiveCLI {
|
|
152
153
|
database: Models.Database,
|
153
154
|
databasesClient: Databases,
|
154
155
|
message: string,
|
155
|
-
multiSelect = true
|
156
|
+
multiSelect = true
|
156
157
|
): Promise<Models.Collection[]> {
|
158
|
+
await this.initControllerIfNeeded();
|
157
159
|
const collections = await fetchAllCollections(
|
158
160
|
database.$id,
|
159
161
|
databasesClient
|
package/src/utils/loadConfigs.ts
CHANGED
@@ -49,10 +49,16 @@ export const loadConfig = async (
|
|
49
49
|
config.collections = [];
|
50
50
|
|
51
51
|
for (const file of collectionFiles) {
|
52
|
+
if (file === "index.ts") {
|
53
|
+
continue;
|
54
|
+
}
|
52
55
|
const filePath = path.join(collectionsDir, file);
|
53
56
|
const fileUrl = pathToFileURL(filePath).href;
|
54
|
-
const collectionModule = (await import(fileUrl))
|
55
|
-
|
57
|
+
const collectionModule = (await import(fileUrl));
|
58
|
+
const collection: Collection | undefined = collectionModule.default?.default || collectionModule.default || collectionModule;
|
59
|
+
if (collection) {
|
60
|
+
config.collections.push(collection);
|
61
|
+
}
|
56
62
|
}
|
57
63
|
|
58
64
|
return config;
|
package/tsconfig.json
CHANGED